1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:58:11 +00:00

LibWeb: Make CSS::Selector reference counted

The end goal is to make the PseudoClass::not_selector be a Selector
instead of a String that is repeatedly re-parsed. But since Selector
contains a Vector of ComplexSelectors, which each have a Vector of
SimpleSelectors, it's probably a good idea to not be passing them
around by value anyway. :^)
This commit is contained in:
Sam Atkins 2021-07-12 17:30:40 +01:00 committed by Andreas Kling
parent 8cae79cc8d
commit 776b1f4548
9 changed files with 48 additions and 38 deletions

View file

@ -117,9 +117,9 @@ static bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoClass cons
if (pseudo_class.not_selector.is_empty())
return false;
auto not_selector = Web::parse_selector(CSS::DeprecatedParsingContext(element), pseudo_class.not_selector);
if (!not_selector.has_value())
if (!not_selector)
return false;
auto not_matches = matches(not_selector.value(), element);
auto not_matches = matches(not_selector.release_nonnull(), element);
return !not_matches;
}
case CSS::Selector::SimpleSelector::PseudoClass::Type::NthChild: