HTMLBodyElement.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. JS_DECLARE_ALLOCATOR(HTMLBodyElement);
  16. public:
  17. virtual ~HTMLBodyElement() override;
  18. virtual void attribute_changed(FlyString const&, Optional<String> const&) override;
  19. virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
  20. // https://www.w3.org/TR/html-aria/#el-body
  21. virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::generic; }
  22. private:
  23. HTMLBodyElement(DOM::Document&, DOM::QualifiedName);
  24. virtual void visit_edges(Visitor&) override;
  25. // ^DOM::Node
  26. virtual bool is_html_body_element() const override { return true; }
  27. virtual void initialize(JS::Realm&) override;
  28. // ^HTML::GlobalEventHandlers
  29. virtual JS::GCPtr<DOM::EventTarget> global_event_handlers_to_event_target(FlyString const& event_name) override;
  30. // ^HTML::WindowEventHandlers
  31. virtual JS::GCPtr<DOM::EventTarget> window_event_handlers_to_event_target() override;
  32. RefPtr<CSS::ImageStyleValue> m_background_style_value;
  33. };
  34. }
  35. namespace Web::DOM {
  36. template<>
  37. inline bool Node::fast_is<HTML::HTMLBodyElement>() const { return is_html_body_element(); }
  38. }