diff options
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Document.h | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Node.h | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLInputElement.h | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/ListItemBox.h | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/Node.h | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/SVGSVGBox.h | 6 |
8 files changed, 48 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index 44f4512e2c..47e21b6938 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -618,4 +618,7 @@ private: JS::GCPtr<HTML::HTMLBaseElement const> m_first_base_element_with_href_in_tree_order; }; +template<> +inline bool Node::fast_is<Document>() const { return is_document(); } + } diff --git a/Userland/Libraries/LibWeb/DOM/Node.h b/Userland/Libraries/LibWeb/DOM/Node.h index 172fc6a756..89cf7014df 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.h +++ b/Userland/Libraries/LibWeb/DOM/Node.h @@ -85,6 +85,9 @@ public: virtual bool is_html_html_element() const { return false; } virtual bool is_html_anchor_element() const { return false; } virtual bool is_html_base_element() const { return false; } + virtual bool is_html_body_element() const { return false; } + virtual bool is_html_input_element() const { return false; } + virtual bool is_html_progress_element() const { return false; } virtual bool is_html_template_element() const { return false; } virtual bool is_browsing_context_container() const { return false; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h index dc3725a3dc..e20cb07daa 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h @@ -29,6 +29,9 @@ public: private: HTMLBodyElement(DOM::Document&, DOM::QualifiedName); + // ^DOM::Node + virtual bool is_html_body_element() const override { return true; } + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; // ^HTML::GlobalEventHandlers @@ -41,3 +44,8 @@ private: }; } + +namespace Web::DOM { +template<> +inline bool Node::fast_is<HTML::HTMLBodyElement>() const { return is_html_body_element(); } +} diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h index ee916ff5c5..2d85ed6409 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h @@ -125,6 +125,9 @@ public: private: HTMLInputElement(DOM::Document&, DOM::QualifiedName); + // ^DOM::Node + virtual bool is_html_input_element() const final { return true; } + // ^DOM::EventTarget virtual void did_receive_focus() override; virtual void legacy_pre_activation_behavior() override; @@ -166,3 +169,8 @@ private: }; } + +namespace Web::DOM { +template<> +inline bool Node::fast_is<HTML::HTMLInputElement>() const { return is_html_input_element(); } +} diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h index 5417d3ff50..17905b6ee3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h @@ -39,6 +39,9 @@ public: private: HTMLProgressElement(DOM::Document&, DOM::QualifiedName); + // ^DOM::Node + virtual bool is_html_input_element() const final { return true; } + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; void progress_position_updated(); @@ -47,3 +50,8 @@ private: }; } + +namespace Web::DOM { +template<> +inline bool Node::fast_is<HTML::HTMLProgressElement>() const { return is_html_progress_element(); } +} diff --git a/Userland/Libraries/LibWeb/Layout/ListItemBox.h b/Userland/Libraries/LibWeb/Layout/ListItemBox.h index d3b79f3e3d..7f4598b398 100644 --- a/Userland/Libraries/LibWeb/Layout/ListItemBox.h +++ b/Userland/Libraries/LibWeb/Layout/ListItemBox.h @@ -25,9 +25,13 @@ public: void set_marker(JS::GCPtr<ListItemMarkerBox>); private: + virtual bool is_list_item_box() const override { return true; } + virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr<ListItemMarkerBox> m_marker; }; +template<> +inline bool Node::fast_is<ListItemBox>() const { return is_list_item_box(); } } diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h index 9e8319a402..271da99197 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.h +++ b/Userland/Libraries/LibWeb/Layout/Node.h @@ -89,11 +89,14 @@ public: virtual bool is_viewport() const { return false; } virtual bool is_svg_box() const { return false; } virtual bool is_svg_geometry_box() const { return false; } + virtual bool is_svg_svg_box() const { return false; } virtual bool is_label() const { return false; } virtual bool is_replaced_box() const { return false; } + virtual bool is_list_item_box() const { return false; } virtual bool is_list_item_marker_box() const { return false; } virtual bool is_table_wrapper() const { return false; } virtual bool is_table() const { return false; } + virtual bool is_node_with_style_and_box_model_metrics() const { return false; } template<typename T> bool fast_is() const = delete; @@ -219,9 +222,14 @@ protected: } private: + virtual bool is_node_with_style_and_box_model_metrics() const final { return true; } + BoxModelMetrics m_box_model; }; +template<> +inline bool Node::fast_is<NodeWithStyleAndBoxModelMetrics>() const { return is_node_with_style_and_box_model_metrics(); } + inline Gfx::Font const& Node::font() const { if (m_has_style) diff --git a/Userland/Libraries/LibWeb/Layout/SVGSVGBox.h b/Userland/Libraries/LibWeb/Layout/SVGSVGBox.h index d63052879e..4e91029664 100644 --- a/Userland/Libraries/LibWeb/Layout/SVGSVGBox.h +++ b/Userland/Libraries/LibWeb/Layout/SVGSVGBox.h @@ -25,6 +25,12 @@ public: virtual JS::GCPtr<Painting::Paintable> create_paintable() const override; virtual void prepare_for_replaced_layout() override; + +private: + virtual bool is_svg_svg_box() const final { return true; } }; +template<> +inline bool Node::fast_is<SVGSVGBox>() const { return is_svg_svg_box(); } + } |