HTMLBodyElement.h 1.7 KB

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