diff --git a/Libraries/LibWeb/Bindings/EventWrapperFactory.cpp b/Libraries/LibWeb/Bindings/EventWrapperFactory.cpp index 46d99f4fd52..3064799cf0b 100644 --- a/Libraries/LibWeb/Bindings/EventWrapperFactory.cpp +++ b/Libraries/LibWeb/Bindings/EventWrapperFactory.cpp @@ -33,7 +33,7 @@ namespace Bindings { EventWrapper* wrap(JS::GlobalObject& global_object, DOM::Event& event) { - if (event.is_mouse_event()) + if (is(event)) return static_cast(wrap_impl(global_object, static_cast(event))); return static_cast(wrap_impl(global_object, event)); } diff --git a/Libraries/LibWeb/CSS/SelectorEngine.cpp b/Libraries/LibWeb/CSS/SelectorEngine.cpp index 306356ff570..5f553e2be08 100644 --- a/Libraries/LibWeb/CSS/SelectorEngine.cpp +++ b/Libraries/LibWeb/CSS/SelectorEngine.cpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace Web::SelectorEngine { @@ -86,7 +87,7 @@ static bool matches(const CSS::Selector::SimpleSelector& component, const DOM::E return false; break; case CSS::Selector::SimpleSelector::PseudoClass::Root: - if (!element.is_html_element()) + if (!is(element)) return false; break; } diff --git a/Libraries/LibWeb/DOM/Event.cpp b/Libraries/LibWeb/DOM/Event.cpp index 17ad7c06b66..9fd75ab2267 100644 --- a/Libraries/LibWeb/DOM/Event.cpp +++ b/Libraries/LibWeb/DOM/Event.cpp @@ -39,7 +39,7 @@ void Event::append_to_path(EventTarget& invocation_target, RefPtr s if (is(invocation_target)) { auto& invocation_target_node = downcast(invocation_target); - if (invocation_target_node.root()->is_shadow_root()) + if (is(invocation_target_node.root())) invocation_target_in_shadow_tree = true; if (is(invocation_target_node)) { auto& invocation_target_shadow_root = downcast(invocation_target_node); diff --git a/Libraries/LibWeb/DOM/Event.h b/Libraries/LibWeb/DOM/Event.h index 2ffd95950de..1acc60a3864 100644 --- a/Libraries/LibWeb/DOM/Event.h +++ b/Libraries/LibWeb/DOM/Event.h @@ -149,9 +149,6 @@ public: m_stop_immediate_propagation = true; } - virtual bool is_ui_event() const { return false; } - virtual bool is_mouse_event() const { return false; } - protected: explicit Event(const FlyString& type) : m_type(type) diff --git a/Libraries/LibWeb/DOM/EventDispatcher.cpp b/Libraries/LibWeb/DOM/EventDispatcher.cpp index 65376607f8c..e45b42c23e1 100644 --- a/Libraries/LibWeb/DOM/EventDispatcher.cpp +++ b/Libraries/LibWeb/DOM/EventDispatcher.cpp @@ -57,7 +57,7 @@ static EventTarget* retarget(EventTarget* left, [[maybe_unused]] EventTarget* ri auto* left_node = downcast(left); auto* left_root = left_node->root(); - if (!left_root->is_shadow_root()) + if (!is(left_root)) return left; // FIXME: If right is a node and left’s root is a shadow-including inclusive ancestor of right, return left. diff --git a/Libraries/LibWeb/DOM/EventTarget.h b/Libraries/LibWeb/DOM/EventTarget.h index 082a35fd8a4..32399a6a7a1 100644 --- a/Libraries/LibWeb/DOM/EventTarget.h +++ b/Libraries/LibWeb/DOM/EventTarget.h @@ -63,9 +63,6 @@ public: const Vector& listeners() const { return m_listeners; } - virtual bool is_node() const { return false; } - virtual bool is_window() const { return false; } - Function activation_behaviour; // NOTE: These only exist for checkbox and radio input elements. diff --git a/Libraries/LibWeb/DOM/Node.h b/Libraries/LibWeb/DOM/Node.h index 2b0d36382b1..de4b3755d9f 100644 --- a/Libraries/LibWeb/DOM/Node.h +++ b/Libraries/LibWeb/DOM/Node.h @@ -77,10 +77,6 @@ public: bool is_document_fragment() const { return type() == NodeType::DOCUMENT_FRAGMENT_NODE; } bool is_parent_node() const { return is_element() || is_document() || is_document_fragment(); } bool is_slottable() const { return is_element() || is_text(); } - virtual bool is_svg_element() const { return false; } - virtual bool is_shadow_root() const { return false; } - - virtual bool is_node() const final { return true; } virtual bool is_editable() const; @@ -103,9 +99,6 @@ public: String child_text_content() const; - virtual bool is_html_element() const { return false; } - virtual bool is_unknown_html_element() const { return false; } - Node* root(); const Node* root() const { diff --git a/Libraries/LibWeb/DOM/ShadowRoot.h b/Libraries/LibWeb/DOM/ShadowRoot.h index 455b47723d9..4bee76470de 100644 --- a/Libraries/LibWeb/DOM/ShadowRoot.h +++ b/Libraries/LibWeb/DOM/ShadowRoot.h @@ -42,9 +42,6 @@ public: bool available_to_element_internals() const { return m_available_to_element_internals; } void set_available_to_element_internals(bool available_to_element_internals) { m_available_to_element_internals = available_to_element_internals; } - // ^Node - virtual bool is_shadow_root() const override { return true; } - // ^EventTarget virtual EventTarget* get_parent(const Event&) override; diff --git a/Libraries/LibWeb/DOM/Window.h b/Libraries/LibWeb/DOM/Window.h index 862c2a97208..4118bebbe24 100644 --- a/Libraries/LibWeb/DOM/Window.h +++ b/Libraries/LibWeb/DOM/Window.h @@ -79,8 +79,6 @@ public: HighResolutionTime::Performance& performance() { return *m_performance; } - virtual bool is_window() const override { return true; } - const Event* current_event() const { return m_current_event; } void set_current_event(Event* event) { m_current_event = event; } diff --git a/Libraries/LibWeb/HTML/HTMLElement.h b/Libraries/LibWeb/HTML/HTMLElement.h index aa041cdc453..ee602a62b56 100644 --- a/Libraries/LibWeb/HTML/HTMLElement.h +++ b/Libraries/LibWeb/HTML/HTMLElement.h @@ -49,8 +49,6 @@ public: bool cannot_navigate() const; private: - virtual bool is_html_element() const final { return true; } - enum class ContentEditableState { True, False, diff --git a/Libraries/LibWeb/HTML/HTMLUnknownElement.h b/Libraries/LibWeb/HTML/HTMLUnknownElement.h index 5fdacf66ecf..896df0d064b 100644 --- a/Libraries/LibWeb/HTML/HTMLUnknownElement.h +++ b/Libraries/LibWeb/HTML/HTMLUnknownElement.h @@ -36,9 +36,6 @@ public: HTMLUnknownElement(DOM::Document&, const QualifiedName& qualified_name); virtual ~HTMLUnknownElement() override; - -private: - virtual bool is_unknown_html_element() const final { return true; } }; } diff --git a/Libraries/LibWeb/SVG/SVGElement.h b/Libraries/LibWeb/SVG/SVGElement.h index 94fbb80c764..99041728f85 100644 --- a/Libraries/LibWeb/SVG/SVGElement.h +++ b/Libraries/LibWeb/SVG/SVGElement.h @@ -34,13 +34,8 @@ class SVGElement : public DOM::Element { public: using WrapperType = Bindings::SVGElementWrapper; - virtual bool is_graphics_element() const { return false; } - protected: SVGElement(DOM::Document&, const QualifiedName& qualified_name); - -private: - virtual bool is_svg_element() const final { return true; } }; } diff --git a/Libraries/LibWeb/SVG/SVGGraphicsElement.h b/Libraries/LibWeb/SVG/SVGGraphicsElement.h index 0a380456b9d..ec8735a70bd 100644 --- a/Libraries/LibWeb/SVG/SVGGraphicsElement.h +++ b/Libraries/LibWeb/SVG/SVGGraphicsElement.h @@ -49,9 +49,6 @@ protected: Optional m_fill_color; Optional m_stroke_color; Optional m_stroke_width; - -private: - virtual bool is_graphics_element() const final { return true; } }; } diff --git a/Libraries/LibWeb/UIEvents/MouseEvent.h b/Libraries/LibWeb/UIEvents/MouseEvent.h index 1314858baf7..13fc8d3322c 100644 --- a/Libraries/LibWeb/UIEvents/MouseEvent.h +++ b/Libraries/LibWeb/UIEvents/MouseEvent.h @@ -49,8 +49,6 @@ protected: MouseEvent(const FlyString& event_name, i32 offset_x, i32 offset_y); private: - virtual bool is_mouse_event() const override { return true; } - void set_event_characteristics(); i32 m_offset_x { 0 }; diff --git a/Libraries/LibWeb/UIEvents/UIEvent.h b/Libraries/LibWeb/UIEvents/UIEvent.h index 325d1cb8abc..cbb8ee7de99 100644 --- a/Libraries/LibWeb/UIEvents/UIEvent.h +++ b/Libraries/LibWeb/UIEvents/UIEvent.h @@ -41,9 +41,6 @@ protected: : Event(event_name) { } - -private: - virtual bool is_ui_event() const final { return true; } }; }