1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:57:45 +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

@ -8,6 +8,8 @@
#pragma once
#include <AK/NonnullOwnPtrVector.h>
#include <AK/NonnullRefPtrVector.h>
#include <AK/RefPtr.h>
#include <AK/Vector.h>
#include <LibWeb/CSS/Parser/DeclarationOrAtRule.h>
#include <LibWeb/CSS/Parser/StyleBlockRule.h>
@ -110,19 +112,19 @@ public:
Vector<Vector<StyleComponentValueRule>> parse_as_comma_separated_list_of_component_values(TokenStream<T>&);
template<typename T>
Optional<Selector> parse_single_selector(TokenStream<T>&, bool is_relative = false);
RefPtr<Selector> parse_single_selector(TokenStream<T>&, bool is_relative = false);
Optional<Selector::SimpleSelector::NthChildPattern> parse_nth_child_pattern(TokenStream<StyleComponentValueRule>&);
// FIXME: https://www.w3.org/TR/selectors-4/
// Contrary to the name, these parse a comma-separated list of selectors, according to the spec.
Vector<Selector> parse_a_selector();
NonnullRefPtrVector<Selector> parse_a_selector();
template<typename T>
Vector<Selector> parse_a_selector(TokenStream<T>&);
NonnullRefPtrVector<Selector> parse_a_selector(TokenStream<T>&);
Vector<Selector> parse_a_relative_selector();
NonnullRefPtrVector<Selector> parse_a_relative_selector();
template<typename T>
Vector<Selector> parse_a_relative_selector(TokenStream<T>&);
NonnullRefPtrVector<Selector> parse_a_relative_selector(TokenStream<T>&);
RefPtr<StyleValue> parse_css_value(PropertyID, TokenStream<StyleComponentValueRule>&);