HTMLButtonElement.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2020, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/HTML/FormAssociatedElement.h>
  8. namespace Web::HTML {
  9. #define ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTES \
  10. __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(submit, Submit) \
  11. __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(reset, Reset) \
  12. __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(button, Button)
  13. class HTMLButtonElement final : public FormAssociatedElement {
  14. public:
  15. using WrapperType = Bindings::HTMLButtonElementWrapper;
  16. HTMLButtonElement(DOM::Document&, DOM::QualifiedName);
  17. virtual ~HTMLButtonElement() override;
  18. enum class TypeAttributeState {
  19. #define __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(_, state) state,
  20. ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTES
  21. #undef __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE
  22. };
  23. String type() const;
  24. TypeAttributeState type_state() const;
  25. void set_type(String const&);
  26. // ^FormAssociatedElement
  27. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  28. virtual bool is_listed() const override { return true; }
  29. // https://html.spec.whatwg.org/multipage/forms.html#category-submit
  30. virtual bool is_submittable() const override { return true; }
  31. // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
  32. virtual bool is_auto_capitalize_inheriting() const override { return true; }
  33. // ^HTMLElement
  34. // https://html.spec.whatwg.org/multipage/forms.html#category-label
  35. virtual bool is_labelable() const override { return true; }
  36. };
  37. }