HTMLHeadingElement.h 982 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/ARIA/Roles.h>
  8. #include <LibWeb/HTML/HTMLElement.h>
  9. namespace Web::HTML {
  10. class HTMLHeadingElement final : public HTMLElement {
  11. WEB_PLATFORM_OBJECT(HTMLHeadingElement, HTMLElement);
  12. JS_DECLARE_ALLOCATOR(HTMLHeadingElement);
  13. public:
  14. virtual ~HTMLHeadingElement() override;
  15. virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
  16. // https://www.w3.org/TR/html-aria/#el-h1-h6
  17. virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::heading; }
  18. virtual Optional<String> aria_level() const override
  19. {
  20. // TODO: aria-level = the number in the element's tag name
  21. return get_attribute("aria-level"_fly_string);
  22. }
  23. private:
  24. HTMLHeadingElement(DOM::Document&, DOM::QualifiedName);
  25. virtual void initialize(JS::Realm&) override;
  26. };
  27. }