HTMLBodyElement.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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(FlyString const&, Optional<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. virtual void visit_edges(Visitor&) override;
  24. // ^DOM::Node
  25. virtual bool is_html_body_element() const override { return true; }
  26. virtual void initialize(JS::Realm&) override;
  27. // ^HTML::GlobalEventHandlers
  28. virtual EventTarget& global_event_handlers_to_event_target(FlyString const& event_name) override;
  29. // ^HTML::WindowEventHandlers
  30. virtual EventTarget& window_event_handlers_to_event_target() override;
  31. RefPtr<CSS::ImageStyleValue> m_background_style_value;
  32. };
  33. }
  34. namespace Web::DOM {
  35. template<>
  36. inline bool Node::fast_is<HTML::HTMLBodyElement>() const { return is_html_body_element(); }
  37. }