HTMLOutputElement.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. String const& type() const
  21. {
  22. static String const output = "output"_string;
  23. return output;
  24. }
  25. String default_value() const;
  26. void set_default_value(String const&);
  27. String value() const override;
  28. void set_value(String const&);
  29. // ^FormAssociatedElement
  30. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  31. virtual bool is_listed() const override { return true; }
  32. // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
  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-output
  41. virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::status; }
  42. private:
  43. HTMLOutputElement(DOM::Document&, DOM::QualifiedName);
  44. virtual void initialize(JS::Realm&) override;
  45. Optional<String> m_default_value_override {};
  46. };
  47. }