HTMLTextAreaElement.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) 2020, the SerenityOS developers.
  3. * Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <LibWeb/ARIA/Roles.h>
  9. #include <LibWeb/HTML/FormAssociatedElement.h>
  10. #include <LibWeb/HTML/HTMLElement.h>
  11. namespace Web::HTML {
  12. class HTMLTextAreaElement final
  13. : public HTMLElement
  14. , public FormAssociatedElement {
  15. WEB_PLATFORM_OBJECT(HTMLTextAreaElement, HTMLElement);
  16. FORM_ASSOCIATED_ELEMENT(HTMLElement, HTMLTextAreaElement)
  17. public:
  18. virtual ~HTMLTextAreaElement() override;
  19. DeprecatedString const& type() const
  20. {
  21. static DeprecatedString textarea = "textarea";
  22. return textarea;
  23. }
  24. // ^EventTarget
  25. // https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-textarea-element
  26. virtual bool is_focusable() const override { return true; }
  27. // ^FormAssociatedElement
  28. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  29. virtual bool is_listed() const override { return true; }
  30. // https://html.spec.whatwg.org/multipage/forms.html#category-submit
  31. virtual bool is_submittable() const override { return true; }
  32. // https://html.spec.whatwg.org/multipage/forms.html#category-reset
  33. virtual bool is_resettable() const override { return true; }
  34. // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
  35. virtual bool is_auto_capitalize_inheriting() const override { return true; }
  36. // ^HTMLElement
  37. // https://html.spec.whatwg.org/multipage/forms.html#category-label
  38. virtual bool is_labelable() const override { return true; }
  39. virtual void reset_algorithm() override;
  40. // https://www.w3.org/TR/html-aria/#el-textarea
  41. virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::textbox; }
  42. private:
  43. HTMLTextAreaElement(DOM::Document&, DOM::QualifiedName);
  44. virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
  45. // ^DOM::Element
  46. virtual i32 default_tab_index_value() const override;
  47. };
  48. }