HTMLButtonElement.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #include <LibWeb/HTML/HTMLElement.h>
  9. namespace Web::HTML {
  10. #define ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTES \
  11. __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(submit, Submit) \
  12. __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(reset, Reset) \
  13. __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(button, Button)
  14. class HTMLButtonElement final
  15. : public HTMLElement
  16. , public FormAssociatedElement {
  17. FORM_ASSOCIATED_ELEMENT(HTMLElement, HTMLButtonElement)
  18. public:
  19. using WrapperType = Bindings::HTMLButtonElementWrapper;
  20. HTMLButtonElement(DOM::Document&, DOM::QualifiedName);
  21. virtual ~HTMLButtonElement() override;
  22. enum class TypeAttributeState {
  23. #define __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(_, state) state,
  24. ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTES
  25. #undef __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE
  26. };
  27. String type() const;
  28. TypeAttributeState type_state() const;
  29. void set_type(String const&);
  30. // ^EventTarget
  31. // https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-button-element
  32. virtual bool is_focusable() const override { return true; }
  33. // ^FormAssociatedElement
  34. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  35. virtual bool is_listed() const override { return true; }
  36. // https://html.spec.whatwg.org/multipage/forms.html#category-submit
  37. virtual bool is_submittable() const override { return true; }
  38. // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
  39. virtual bool is_auto_capitalize_inheriting() const override { return true; }
  40. // ^HTMLElement
  41. // https://html.spec.whatwg.org/multipage/forms.html#category-label
  42. virtual bool is_labelable() const override { return true; }
  43. };
  44. }