/src/serenity/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibWeb/ARIA/Roles.h> |
10 | | #include <LibWeb/HTML/HTMLElement.h> |
11 | | #include <LibWeb/HTML/WindowEventHandlers.h> |
12 | | |
13 | | namespace Web::HTML { |
14 | | |
15 | | class HTMLBodyElement final |
16 | | : public HTMLElement |
17 | | , public WindowEventHandlers { |
18 | | WEB_PLATFORM_OBJECT(HTMLBodyElement, HTMLElement); |
19 | | JS_DECLARE_ALLOCATOR(HTMLBodyElement); |
20 | | |
21 | | public: |
22 | | virtual ~HTMLBodyElement() override; |
23 | | |
24 | | virtual void attribute_changed(FlyString const&, Optional<String> const& old_value, Optional<String> const&) override; |
25 | | virtual void apply_presentational_hints(CSS::StyleProperties&) const override; |
26 | | |
27 | | // https://www.w3.org/TR/html-aria/#el-body |
28 | 0 | virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::generic; } |
29 | | |
30 | | private: |
31 | | HTMLBodyElement(DOM::Document&, DOM::QualifiedName); |
32 | | |
33 | | virtual void visit_edges(Visitor&) override; |
34 | | |
35 | | // ^DOM::Node |
36 | 0 | virtual bool is_html_body_element() const override { return true; } |
37 | | |
38 | | virtual void initialize(JS::Realm&) override; |
39 | | |
40 | | // ^HTML::GlobalEventHandlers |
41 | | virtual JS::GCPtr<DOM::EventTarget> global_event_handlers_to_event_target(FlyString const& event_name) override; |
42 | | |
43 | | // ^HTML::WindowEventHandlers |
44 | | virtual JS::GCPtr<DOM::EventTarget> window_event_handlers_to_event_target() override; |
45 | | |
46 | | RefPtr<CSS::ImageStyleValue> m_background_style_value; |
47 | | }; |
48 | | |
49 | | } |
50 | | |
51 | | namespace Web::DOM { |
52 | | template<> |
53 | 0 | inline bool Node::fast_is<HTML::HTMLBodyElement>() const { return is_html_body_element(); } |
54 | | } |