HTMLBodyElement.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #include <LibWeb/HTML/WindowEventHandlers.h>
  10. namespace Web::HTML {
  11. class HTMLBodyElement final
  12. : public HTMLElement
  13. , public WindowEventHandlers {
  14. WEB_PLATFORM_OBJECT(HTMLBodyElement, HTMLElement);
  15. public:
  16. virtual ~HTMLBodyElement() override;
  17. virtual void attribute_changed(DeprecatedFlyString const&, DeprecatedString const&) override;
  18. virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
  19. // https://www.w3.org/TR/html-aria/#el-body
  20. virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::generic; }
  21. private:
  22. HTMLBodyElement(DOM::Document&, DOM::QualifiedName);
  23. // ^DOM::Node
  24. virtual bool is_html_body_element() const override { return true; }
  25. virtual void initialize(JS::Realm&) override;
  26. // ^HTML::GlobalEventHandlers
  27. virtual EventTarget& global_event_handlers_to_event_target(FlyString const& event_name) override;
  28. // ^HTML::WindowEventHandlers
  29. virtual EventTarget& window_event_handlers_to_event_target() override;
  30. RefPtr<CSS::ImageStyleValue> m_background_style_value;
  31. };
  32. }
  33. namespace Web::DOM {
  34. template<>
  35. inline bool Node::fast_is<HTML::HTMLBodyElement>() const { return is_html_body_element(); }
  36. }