mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38: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:
parent
8cae79cc8d
commit
776b1f4548
9 changed files with 48 additions and 38 deletions
|
@ -683,10 +683,10 @@ public:
|
|||
return;
|
||||
complex_selectors.first().relation = CSS::Selector::ComplexSelector::Relation::None;
|
||||
|
||||
current_rule.selectors.append(CSS::Selector(move(complex_selectors)));
|
||||
current_rule.selectors.append(CSS::Selector::create(move(complex_selectors)));
|
||||
}
|
||||
|
||||
Optional<CSS::Selector> parse_individual_selector()
|
||||
RefPtr<CSS::Selector> parse_individual_selector()
|
||||
{
|
||||
parse_selector();
|
||||
if (current_rule.selectors.is_empty())
|
||||
|
@ -1037,7 +1037,7 @@ private:
|
|||
NonnullRefPtrVector<CSS::CSSRule> rules;
|
||||
|
||||
struct CurrentRule {
|
||||
Vector<CSS::Selector> selectors;
|
||||
NonnullRefPtrVector<CSS::Selector> selectors;
|
||||
Vector<CSS::StyleProperty> properties;
|
||||
HashMap<String, CSS::StyleProperty> custom_properties;
|
||||
};
|
||||
|
@ -1050,7 +1050,7 @@ private:
|
|||
StringView css;
|
||||
};
|
||||
|
||||
Optional<CSS::Selector> parse_selector(const CSS::DeprecatedParsingContext& context, const StringView& selector_text)
|
||||
RefPtr<CSS::Selector> parse_selector(const CSS::DeprecatedParsingContext& context, const StringView& selector_text)
|
||||
{
|
||||
CSSParser parser(context, selector_text);
|
||||
return parser.parse_individual_selector();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue