HTMLOutputElement.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 HTMLOutputElement final
  13. : public HTMLElement
  14. , public FormAssociatedElement {
  15. WEB_PLATFORM_OBJECT(HTMLOutputElement, HTMLElement);
  16. JS_DECLARE_ALLOCATOR(HTMLOutputElement);
  17. FORM_ASSOCIATED_ELEMENT(HTMLElement, HTMLOutputElement)
  18. public:
  19. virtual ~HTMLOutputElement() override;
  20. DeprecatedString const& type() const
  21. {
  22. static DeprecatedString output = "output";
  23. return output;
  24. }
  25. // ^FormAssociatedElement
  26. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  27. virtual bool is_listed() const override { return true; }
  28. // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
  29. virtual bool is_resettable() const override { return true; }
  30. // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
  31. virtual bool is_auto_capitalize_inheriting() const override { return true; }
  32. // ^HTMLElement
  33. // https://html.spec.whatwg.org/multipage/forms.html#category-label
  34. virtual bool is_labelable() const override { return true; }
  35. virtual void reset_algorithm() override;
  36. // https://www.w3.org/TR/html-aria/#el-output
  37. virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::status; }
  38. private:
  39. HTMLOutputElement(DOM::Document&, DOM::QualifiedName);
  40. virtual void initialize(JS::Realm&) override;
  41. };
  42. }