From db324664997287489b9f137b9a6403035172de68 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Sat, 5 Feb 2022 17:41:43 +0200 Subject: LibWeb: Mark SelectorEngine matches-related functions as inline The prologues and epilogues of these functions were pretty hot in a profile of Browser, so this should help a bit. --- Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp') diff --git a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp index fef535a51f..98a5b76ead 100644 --- a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp +++ b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp @@ -15,7 +15,7 @@ namespace Web::SelectorEngine { -static bool matches_hover_pseudo_class(DOM::Element const& element) +static inline bool matches_hover_pseudo_class(DOM::Element const& element) { auto* hovered_node = element.document().hovered_node(); if (!hovered_node) @@ -25,7 +25,7 @@ static bool matches_hover_pseudo_class(DOM::Element const& element) return element.is_ancestor_of(*hovered_node); } -static bool matches_attribute(CSS::Selector::SimpleSelector::Attribute const& attribute, DOM::Element const& element) +static inline bool matches_attribute(CSS::Selector::SimpleSelector::Attribute const& attribute, DOM::Element const& element) { switch (attribute.match_type) { case CSS::Selector::SimpleSelector::Attribute::MatchType::HasAttribute: @@ -52,7 +52,7 @@ static bool matches_attribute(CSS::Selector::SimpleSelector::Attribute const& at return false; } -static bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoClass const& pseudo_class, DOM::Element const& element) +static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoClass const& pseudo_class, DOM::Element const& element) { switch (pseudo_class.type) { case CSS::Selector::SimpleSelector::PseudoClass::Type::None: @@ -165,7 +165,7 @@ static bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoClass cons return false; } -static bool matches(CSS::Selector::SimpleSelector const& component, DOM::Element const& element) +static inline bool matches(CSS::Selector::SimpleSelector const& component, DOM::Element const& element) { switch (component.type) { case CSS::Selector::SimpleSelector::Type::Universal: @@ -188,7 +188,7 @@ static bool matches(CSS::Selector::SimpleSelector const& component, DOM::Element } } -static bool matches(CSS::Selector const& selector, int component_list_index, DOM::Element const& element) +static inline bool matches(CSS::Selector const& selector, int component_list_index, DOM::Element const& element) { auto& relative_selector = selector.compound_selectors()[component_list_index]; for (auto& simple_selector : relative_selector.simple_selectors) { -- cgit v1.2.3