HTMLHeadingElement.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.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. GC_DECLARE_ALLOCATOR(HTMLHeadingElement);
  13. public:
  14. virtual ~HTMLHeadingElement() override;
  15. virtual bool is_presentational_hint(FlyString const&) const override;
  16. virtual void apply_presentational_hints(GC::Ref<CSS::CascadedProperties>) const override;
  17. // https://www.w3.org/TR/html-aria/#el-h1-h6
  18. virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::heading; }
  19. virtual Optional<String> aria_level() const override
  20. {
  21. // TODO: aria-level = the number in the element's tag name
  22. return get_attribute("aria-level"_fly_string);
  23. }
  24. private:
  25. HTMLHeadingElement(DOM::Document&, DOM::QualifiedName);
  26. virtual void initialize(JS::Realm&) override;
  27. };
  28. }