LibWeb/CSS: Move and rename PseudoElement types to prep for code gen

The upcoming generated types will match those for pseudo-classes: A
PseudoElementSelector type, that then holds a PseudoElement enum
defining what it is. That enum will be at the top level in the Web::CSS
namespace.

In order to keep the diffs clearer, this commit renames and moves the
types, and then a following one will replace the handwritten enum with
a generated one.
This commit is contained in:
Sam Atkins 2025-03-20 16:56:46 +00:00
commit 0ed2e71801
Notes: github-actions[bot] 2025-03-24 09:51:36 +00:00
42 changed files with 270 additions and 271 deletions

View file

@ -56,7 +56,7 @@ void CascadedProperties::revert_layer_property(PropertyID property_id, Important
m_properties.remove(it);
}
void CascadedProperties::resolve_unresolved_properties(GC::Ref<DOM::Element> element, Optional<Selector::PseudoElement::Type> pseudo_element)
void CascadedProperties::resolve_unresolved_properties(GC::Ref<DOM::Element> element, Optional<PseudoElement> pseudo_element)
{
for (auto& [property_id, entries] : m_properties) {
for (auto& entry : entries) {

View file

@ -33,7 +33,7 @@ public:
void revert_property(PropertyID, Important, CascadeOrigin);
void revert_layer_property(PropertyID, Important, Optional<FlyString> layer_name);
void resolve_unresolved_properties(GC::Ref<DOM::Element>, Optional<Selector::PseudoElement::Type>);
void resolve_unresolved_properties(GC::Ref<DOM::Element>, Optional<PseudoElement>);
private:
CascadedProperties();

View file

@ -65,7 +65,7 @@ Optional<CSS::SelectorList> parse_selector_for_nested_style_rule(CSS::Parser::Pa
return adapt_nested_relative_selector_list(*maybe_selectors);
}
Optional<CSS::Selector::PseudoElement> parse_pseudo_element_selector(CSS::Parser::ParsingParams const& context, StringView selector_text)
Optional<CSS::Selector::PseudoElementSelector> parse_pseudo_element_selector(CSS::Parser::ParsingParams const& context, StringView selector_text)
{
return CSS::Parser::Parser::create(context, selector_text).parse_as_pseudo_element_selector();
}

View file

@ -108,7 +108,7 @@ public:
Optional<SelectorList> parse_as_selector(SelectorParsingMode = SelectorParsingMode::Standard);
Optional<SelectorList> parse_as_relative_selector(SelectorParsingMode = SelectorParsingMode::Standard);
Optional<Selector::PseudoElement> parse_as_pseudo_element_selector();
Optional<Selector::PseudoElementSelector> parse_as_pseudo_element_selector();
Vector<NonnullRefPtr<MediaQuery>> parse_as_media_query_list();
RefPtr<MediaQuery> parse_as_media_query();
@ -123,7 +123,7 @@ public:
Vector<ComponentValue> parse_as_list_of_component_values();
static NonnullRefPtr<CSSStyleValue> resolve_unresolved_style_value(ParsingParams const&, DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>, PropertyID, UnresolvedStyleValue const&);
static NonnullRefPtr<CSSStyleValue> resolve_unresolved_style_value(ParsingParams const&, DOM::Element&, Optional<PseudoElement>, PropertyID, UnresolvedStyleValue const&);
[[nodiscard]] LengthOrCalculated parse_as_sizes_attribute(DOM::Element const& element, HTML::HTMLImageElement const* img = nullptr);
@ -450,8 +450,8 @@ private:
OwnPtr<BooleanExpression> parse_supports_feature(TokenStream<ComponentValue>&);
NonnullRefPtr<CSSStyleValue> resolve_unresolved_style_value(DOM::Element&, Optional<Selector::PseudoElement::Type>, PropertyID, UnresolvedStyleValue const&);
bool expand_variables(DOM::Element&, Optional<Selector::PseudoElement::Type>, FlyString const& property_name, HashMap<FlyString, NonnullRefPtr<PropertyDependencyNode>>& dependencies, TokenStream<ComponentValue>& source, Vector<ComponentValue>& dest);
NonnullRefPtr<CSSStyleValue> resolve_unresolved_style_value(DOM::Element&, Optional<PseudoElement>, PropertyID, UnresolvedStyleValue const&);
bool expand_variables(DOM::Element&, Optional<PseudoElement>, FlyString const& property_name, HashMap<FlyString, NonnullRefPtr<PropertyDependencyNode>>& dependencies, TokenStream<ComponentValue>& source, Vector<ComponentValue>& dest);
bool expand_unresolved_values(DOM::Element&, FlyString const& property_name, TokenStream<ComponentValue>& source, Vector<ComponentValue>& dest);
bool substitute_attr_function(DOM::Element& element, FlyString const& property_name, Function const& attr_function, Vector<ComponentValue>& dest);
@ -514,7 +514,7 @@ CSS::Parser::Parser::PropertiesAndCustomProperties parse_css_style_attribute(CSS
RefPtr<CSS::CSSStyleValue> parse_css_value(CSS::Parser::ParsingParams const&, StringView, CSS::PropertyID property_id = CSS::PropertyID::Invalid);
Optional<CSS::SelectorList> parse_selector(CSS::Parser::ParsingParams const&, StringView);
Optional<CSS::SelectorList> parse_selector_for_nested_style_rule(CSS::Parser::ParsingParams const&, StringView);
Optional<CSS::Selector::PseudoElement> parse_pseudo_element_selector(CSS::Parser::ParsingParams const&, StringView);
Optional<CSS::Selector::PseudoElementSelector> parse_pseudo_element_selector(CSS::Parser::ParsingParams const&, StringView);
CSS::CSSRule* parse_css_rule(CSS::Parser::ParsingParams const&, StringView);
RefPtr<CSS::MediaQuery> parse_media_query(CSS::Parser::ParsingParams const&, StringView);
Vector<NonnullRefPtr<CSS::MediaQuery>> parse_media_query_list(CSS::Parser::ParsingParams const&, StringView);

View file

@ -32,7 +32,7 @@ Optional<SelectorList> Parser::parse_as_relative_selector(SelectorParsingMode pa
return {};
}
Optional<Selector::PseudoElement> Parser::parse_as_pseudo_element_selector()
Optional<Selector::PseudoElementSelector> Parser::parse_as_pseudo_element_selector()
{
// FIXME: This is quite janky. Selector parsing is not at all designed to allow parsing just a single part of a selector.
// So, this code parses a whole selector, then rejects it if it's not a single pseudo-element simple selector.
@ -418,8 +418,7 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_pseudo_simple_selec
auto pseudo_name = name_token.token().ident();
// Note: We allow the "ignored" -webkit prefix here for -webkit-progress-bar/-webkit-progress-bar
if (auto pseudo_element = Selector::PseudoElement::from_string(pseudo_name); pseudo_element.has_value()) {
if (auto pseudo_element = Selector::PseudoElementSelector::from_string(pseudo_name); pseudo_element.has_value()) {
// :has() is fussy about pseudo-elements inside it
if (m_pseudo_class_context.contains_slow(PseudoClass::Has) && !is_has_allowed_pseudo_element(pseudo_element->type())) {
return ParseError::SyntaxError;
@ -444,7 +443,7 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_pseudo_simple_selec
return Selector::SimpleSelector {
.type = Selector::SimpleSelector::Type::PseudoElement,
// Unknown -webkit- pseudo-elements must be serialized in ASCII lowercase.
.value = Selector::PseudoElement { Selector::PseudoElement::Type::UnknownWebKit, pseudo_name.to_string().to_ascii_lowercase() },
.value = Selector::PseudoElementSelector { PseudoElement::UnknownWebKit, pseudo_name.to_string().to_ascii_lowercase() },
};
}
@ -482,12 +481,12 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_pseudo_simple_selec
// Single-colon syntax allowed for ::after, ::before, ::first-letter and ::first-line for compatibility.
// https://www.w3.org/TR/selectors/#pseudo-element-syntax
if (auto pseudo_element = Selector::PseudoElement::from_string(pseudo_name); pseudo_element.has_value()) {
if (auto pseudo_element = Selector::PseudoElementSelector::from_string(pseudo_name); pseudo_element.has_value()) {
switch (pseudo_element.value().type()) {
case Selector::PseudoElement::Type::After:
case Selector::PseudoElement::Type::Before:
case Selector::PseudoElement::Type::FirstLetter:
case Selector::PseudoElement::Type::FirstLine:
case PseudoElement::After:
case PseudoElement::Before:
case PseudoElement::FirstLetter:
case PseudoElement::FirstLine:
// :has() is fussy about pseudo-elements inside it
if (m_pseudo_class_context.contains_slow(PseudoClass::Has) && !is_has_allowed_pseudo_element(pseudo_element->type())) {
return ParseError::SyntaxError;

View file

@ -3555,7 +3555,7 @@ RefPtr<StringStyleValue> Parser::parse_opentype_tag_value(TokenStream<ComponentV
return string_value;
}
NonnullRefPtr<CSSStyleValue> Parser::resolve_unresolved_style_value(ParsingParams const& context, DOM::Element& element, Optional<Selector::PseudoElement::Type> pseudo_element, PropertyID property_id, UnresolvedStyleValue const& unresolved)
NonnullRefPtr<CSSStyleValue> Parser::resolve_unresolved_style_value(ParsingParams const& context, DOM::Element& element, Optional<PseudoElement> pseudo_element, PropertyID property_id, UnresolvedStyleValue const& unresolved)
{
// Unresolved always contains a var() or attr(), unless it is a custom property's value, in which case we shouldn't be trying
// to produce a different CSSStyleValue from it.
@ -3610,7 +3610,7 @@ private:
bool m_marked { false };
};
NonnullRefPtr<CSSStyleValue> Parser::resolve_unresolved_style_value(DOM::Element& element, Optional<Selector::PseudoElement::Type> pseudo_element, PropertyID property_id, UnresolvedStyleValue const& unresolved)
NonnullRefPtr<CSSStyleValue> Parser::resolve_unresolved_style_value(DOM::Element& element, Optional<PseudoElement> pseudo_element, PropertyID property_id, UnresolvedStyleValue const& unresolved)
{
TokenStream unresolved_values_without_variables_expanded { unresolved.values() };
Vector<ComponentValue> values_with_variables_expanded;
@ -3639,7 +3639,7 @@ NonnullRefPtr<CSSStyleValue> Parser::resolve_unresolved_style_value(DOM::Element
return CSSKeywordValue::create(Keyword::Unset);
}
static RefPtr<CSSStyleValue const> get_custom_property(DOM::Element const& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element, FlyString const& custom_property_name)
static RefPtr<CSSStyleValue const> get_custom_property(DOM::Element const& element, Optional<CSS::PseudoElement> pseudo_element, FlyString const& custom_property_name)
{
if (pseudo_element.has_value()) {
if (auto it = element.custom_properties(pseudo_element).find(custom_property_name); it != element.custom_properties(pseudo_element).end())
@ -3653,7 +3653,7 @@ static RefPtr<CSSStyleValue const> get_custom_property(DOM::Element const& eleme
return nullptr;
}
bool Parser::expand_variables(DOM::Element& element, Optional<Selector::PseudoElement::Type> pseudo_element, FlyString const& property_name, HashMap<FlyString, NonnullRefPtr<PropertyDependencyNode>>& dependencies, TokenStream<ComponentValue>& source, Vector<ComponentValue>& dest)
bool Parser::expand_variables(DOM::Element& element, Optional<PseudoElement> pseudo_element, FlyString const& property_name, HashMap<FlyString, NonnullRefPtr<PropertyDependencyNode>>& dependencies, TokenStream<ComponentValue>& source, Vector<ComponentValue>& dest)
{
// Arbitrary large value chosen to avoid the billion-laughs attack.
// https://www.w3.org/TR/css-variables-1/#long-variables

View file

@ -535,70 +535,70 @@ String serialize_a_group_of_selectors(SelectorList const& selectors)
return MUST(String::join(", "sv, selectors));
}
StringView Selector::PseudoElement::name(Selector::PseudoElement::Type pseudo_element)
StringView Selector::PseudoElementSelector::name(PseudoElement pseudo_element)
{
switch (pseudo_element) {
case Selector::PseudoElement::Type::Before:
case PseudoElement::Before:
return "before"sv;
case Selector::PseudoElement::Type::After:
case PseudoElement::After:
return "after"sv;
case Selector::PseudoElement::Type::FirstLine:
case PseudoElement::FirstLine:
return "first-line"sv;
case Selector::PseudoElement::Type::FirstLetter:
case PseudoElement::FirstLetter:
return "first-letter"sv;
case Selector::PseudoElement::Type::Marker:
case PseudoElement::Marker:
return "marker"sv;
case Selector::PseudoElement::Type::Track:
case PseudoElement::Track:
return "track"sv;
case Selector::PseudoElement::Type::Fill:
case PseudoElement::Fill:
return "fill"sv;
case Selector::PseudoElement::Type::Thumb:
case PseudoElement::Thumb:
return "thumb"sv;
case Selector::PseudoElement::Type::Placeholder:
case PseudoElement::Placeholder:
return "placeholder"sv;
case Selector::PseudoElement::Type::Selection:
case PseudoElement::Selection:
return "selection"sv;
case Selector::PseudoElement::Type::Backdrop:
case PseudoElement::Backdrop:
return "backdrop"sv;
case Selector::PseudoElement::Type::FileSelectorButton:
case PseudoElement::FileSelectorButton:
return "file-selector-button"sv;
case Selector::PseudoElement::Type::DetailsContent:
case PseudoElement::DetailsContent:
return "details-content"sv;
case Selector::PseudoElement::Type::KnownPseudoElementCount:
case Selector::PseudoElement::Type::UnknownWebKit:
case PseudoElement::KnownPseudoElementCount:
case PseudoElement::UnknownWebKit:
VERIFY_NOT_REACHED();
}
VERIFY_NOT_REACHED();
}
Optional<Selector::PseudoElement> Selector::PseudoElement::from_string(FlyString const& name)
Optional<Selector::PseudoElementSelector> Selector::PseudoElementSelector::from_string(FlyString const& name)
{
if (name.equals_ignoring_ascii_case("after"sv)) {
return Selector::PseudoElement { Selector::PseudoElement::Type::After };
return Selector::PseudoElementSelector { PseudoElement::After };
} else if (name.equals_ignoring_ascii_case("before"sv)) {
return Selector::PseudoElement { Selector::PseudoElement::Type::Before };
return Selector::PseudoElementSelector { PseudoElement::Before };
} else if (name.equals_ignoring_ascii_case("first-letter"sv)) {
return Selector::PseudoElement { Selector::PseudoElement::Type::FirstLetter };
return Selector::PseudoElementSelector { PseudoElement::FirstLetter };
} else if (name.equals_ignoring_ascii_case("first-line"sv)) {
return Selector::PseudoElement { Selector::PseudoElement::Type::FirstLine };
return Selector::PseudoElementSelector { PseudoElement::FirstLine };
} else if (name.equals_ignoring_ascii_case("marker"sv)) {
return Selector::PseudoElement { Selector::PseudoElement::Type::Marker };
return Selector::PseudoElementSelector { PseudoElement::Marker };
} else if (name.equals_ignoring_ascii_case("track"sv)) {
return Selector::PseudoElement { Selector::PseudoElement::Type::Track };
return Selector::PseudoElementSelector { PseudoElement::Track };
} else if (name.equals_ignoring_ascii_case("fill"sv)) {
return Selector::PseudoElement { Selector::PseudoElement::Type::Fill };
return Selector::PseudoElementSelector { PseudoElement::Fill };
} else if (name.equals_ignoring_ascii_case("thumb"sv)) {
return Selector::PseudoElement { Selector::PseudoElement::Type::Thumb };
return Selector::PseudoElementSelector { PseudoElement::Thumb };
} else if (name.equals_ignoring_ascii_case("placeholder"sv)) {
return Selector::PseudoElement { Selector::PseudoElement::Type::Placeholder };
return Selector::PseudoElementSelector { PseudoElement::Placeholder };
} else if (name.equals_ignoring_ascii_case("selection"sv)) {
return Selector::PseudoElement { Selector::PseudoElement::Type::Selection };
return Selector::PseudoElementSelector { PseudoElement::Selection };
} else if (name.equals_ignoring_ascii_case("backdrop"sv)) {
return Selector::PseudoElement { Selector::PseudoElement::Type::Backdrop };
return Selector::PseudoElementSelector { PseudoElement::Backdrop };
} else if (name.equals_ignoring_ascii_case("file-selector-button"sv)) {
return Selector::PseudoElement { Selector::PseudoElement::Type::FileSelectorButton };
return Selector::PseudoElementSelector { PseudoElement::FileSelectorButton };
} else if (name.equals_ignoring_ascii_case("details-content"sv)) {
return Selector::PseudoElement { Selector::PseudoElement::Type::DetailsContent };
return Selector::PseudoElementSelector { PseudoElement::DetailsContent };
}
return {};
}
@ -636,7 +636,7 @@ bool Selector::contains_unknown_webkit_pseudo_element() const
}
}
}
if (simple_selector.type == SimpleSelector::Type::PseudoElement && simple_selector.pseudo_element().type() == PseudoElement::Type::UnknownWebKit)
if (simple_selector.type == SimpleSelector::Type::PseudoElement && simple_selector.pseudo_element().type() == PseudoElement::UnknownWebKit)
return true;
}
}
@ -828,7 +828,7 @@ SelectorList adapt_nested_relative_selector_list(SelectorList const& selectors)
}
// https://drafts.csswg.org/selectors/#has-allowed-pseudo-element
bool is_has_allowed_pseudo_element(Selector::PseudoElement::Type)
bool is_has_allowed_pseudo_element(PseudoElement)
{
// No spec currently defines any pseudo-elements that are allowed in :has()
return false;

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
* Copyright (c) 2021-2024, Sam Atkins <sam@ladybird.org>
* Copyright (c) 2021-2025, Sam Atkins <sam@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -19,56 +19,56 @@ namespace Web::CSS {
using SelectorList = Vector<NonnullRefPtr<class Selector>>;
enum class PseudoElement : u8 {
Before,
After,
FirstLine,
FirstLetter,
Marker,
Track,
Fill,
Thumb,
Placeholder,
Selection,
Backdrop,
FileSelectorButton,
DetailsContent,
// Keep this last.
KnownPseudoElementCount,
// https://www.w3.org/TR/selectors-4/#compat
// NOTE: This is not last as the 'unknown -webkit- pseudo-elements' are not stored as part of any Element.
UnknownWebKit,
};
// This is a <complex-selector> in the spec. https://www.w3.org/TR/selectors-4/#complex
class Selector : public RefCounted<Selector> {
public:
class PseudoElement {
class PseudoElementSelector {
public:
enum class Type : u8 {
Before,
After,
FirstLine,
FirstLetter,
Marker,
Track,
Fill,
Thumb,
Placeholder,
Selection,
Backdrop,
FileSelectorButton,
DetailsContent,
// Keep this last.
KnownPseudoElementCount,
// https://www.w3.org/TR/selectors-4/#compat
// NOTE: This is not last as the 'unknown -webkit- pseudo-elements' are not stored as part of any Element.
UnknownWebKit,
};
explicit PseudoElement(Type type)
explicit PseudoElementSelector(PseudoElement type)
: m_type(type)
{
VERIFY(is_known_pseudo_element_type(type));
}
PseudoElement(Type type, String name)
PseudoElementSelector(PseudoElement type, String name)
: m_type(type)
, m_name(move(name))
{
}
bool operator==(PseudoElement const&) const = default;
bool operator==(PseudoElementSelector const&) const = default;
static Optional<PseudoElement> from_string(FlyString const&);
static Optional<PseudoElementSelector> from_string(FlyString const&);
[[nodiscard]] static bool is_known_pseudo_element_type(Type type)
[[nodiscard]] static bool is_known_pseudo_element_type(PseudoElement type)
{
return to_underlying(type) < to_underlying(CSS::Selector::PseudoElement::Type::KnownPseudoElementCount);
return to_underlying(type) < to_underlying(PseudoElement::KnownPseudoElementCount);
}
static StringView name(Selector::PseudoElement::Type pseudo_element);
static StringView name(PseudoElement pseudo_element);
StringView name() const
{
@ -78,10 +78,10 @@ public:
return name(m_type);
}
Type type() const { return m_type; }
PseudoElement type() const { return m_type; }
private:
Type m_type;
PseudoElement m_type;
String m_name;
};
@ -206,14 +206,14 @@ public:
};
Type type;
Variant<Empty, Attribute, PseudoClassSelector, PseudoElement, Name, QualifiedName, Invalid> value {};
Variant<Empty, Attribute, PseudoClassSelector, PseudoElementSelector, Name, QualifiedName, Invalid> value {};
Attribute const& attribute() const { return value.get<Attribute>(); }
Attribute& attribute() { return value.get<Attribute>(); }
PseudoClassSelector const& pseudo_class() const { return value.get<PseudoClassSelector>(); }
PseudoClassSelector& pseudo_class() { return value.get<PseudoClassSelector>(); }
PseudoElement const& pseudo_element() const { return value.get<PseudoElement>(); }
PseudoElement& pseudo_element() { return value.get<PseudoElement>(); }
PseudoElementSelector const& pseudo_element() const { return value.get<PseudoElementSelector>(); }
PseudoElementSelector& pseudo_element() { return value.get<PseudoElementSelector>(); }
FlyString const& name() const { return value.get<Name>().name; }
FlyString& name() { return value.get<Name>().name; }
@ -253,7 +253,7 @@ public:
~Selector() = default;
Vector<CompoundSelector> const& compound_selectors() const { return m_compound_selectors; }
Optional<PseudoElement> const& pseudo_element() const { return m_pseudo_element; }
Optional<PseudoElementSelector> const& pseudo_element() const { return m_pseudo_element; }
NonnullRefPtr<Selector> relative_to(SimpleSelector const&) const;
bool contains_the_nesting_selector() const { return m_contains_the_nesting_selector; }
bool contains_hover_pseudo_class() const { return m_contains_hover_pseudo_class; }
@ -274,7 +274,7 @@ private:
Vector<CompoundSelector> m_compound_selectors;
mutable Optional<u32> m_specificity;
Optional<Selector::PseudoElement> m_pseudo_element;
Optional<Selector::PseudoElementSelector> m_pseudo_element;
mutable Optional<size_t> m_sibling_invalidation_distance;
bool m_can_use_fast_matches { false };
bool m_can_use_ancestor_filter { false };
@ -290,7 +290,7 @@ String serialize_a_group_of_selectors(SelectorList const& selectors);
SelectorList adapt_nested_relative_selector_list(SelectorList const&);
bool is_has_allowed_pseudo_element(Selector::PseudoElement::Type);
bool is_has_allowed_pseudo_element(PseudoElement);
}

View file

@ -1026,7 +1026,7 @@ bool matches(CSS::Selector const& selector, int component_list_index, DOM::Eleme
bool fast_matches(CSS::Selector const& selector, DOM::Element const& element_to_match, GC::Ptr<DOM::Element const> shadow_host, MatchContext& context);
bool matches(CSS::Selector const& selector, DOM::Element const& element, GC::Ptr<DOM::Element const> shadow_host, MatchContext& context, Optional<CSS::Selector::PseudoElement::Type> pseudo_element, GC::Ptr<DOM::ParentNode const> scope, SelectorKind selector_kind, GC::Ptr<DOM::Element const> anchor)
bool matches(CSS::Selector const& selector, DOM::Element const& element, GC::Ptr<DOM::Element const> shadow_host, MatchContext& context, Optional<CSS::PseudoElement> pseudo_element, GC::Ptr<DOM::ParentNode const> scope, SelectorKind selector_kind, GC::Ptr<DOM::Element const> anchor)
{
if (selector_kind == SelectorKind::Normal && selector.can_use_fast_matches()) {
return fast_matches(selector, element, shadow_host, context);

View file

@ -23,6 +23,6 @@ struct MatchContext {
bool did_match_any_hover_rules { false };
};
bool matches(CSS::Selector const&, DOM::Element const&, GC::Ptr<DOM::Element const> shadow_host, MatchContext& context, Optional<CSS::Selector::PseudoElement::Type> = {}, GC::Ptr<DOM::ParentNode const> scope = {}, SelectorKind selector_kind = SelectorKind::Normal, GC::Ptr<DOM::Element const> anchor = nullptr);
bool matches(CSS::Selector const&, DOM::Element const&, GC::Ptr<DOM::Element const> shadow_host, MatchContext& context, Optional<CSS::PseudoElement> = {}, GC::Ptr<DOM::ParentNode const> scope = {}, SelectorKind selector_kind = SelectorKind::Normal, GC::Ptr<DOM::Element const> anchor = nullptr);
}

View file

@ -173,7 +173,7 @@ OwnFontFaceKey::operator FontFaceKey() const
&& slope == other.slope;
}
static DOM::Element const* element_to_inherit_style_from(DOM::Element const*, Optional<CSS::Selector::PseudoElement::Type>);
static DOM::Element const* element_to_inherit_style_from(DOM::Element const*, Optional<CSS::PseudoElement>);
StyleComputer::StyleComputer(DOM::Document& document)
: m_document(document)
@ -472,7 +472,7 @@ bool StyleComputer::invalidation_property_used_in_has_selector(InvalidationSet::
return false;
}
Vector<MatchingRule const*> StyleComputer::collect_matching_rules(DOM::Element const& element, CascadeOrigin cascade_origin, Optional<CSS::Selector::PseudoElement::Type> pseudo_element, bool& did_match_any_hover_rules, FlyString const& qualified_layer_name) const
Vector<MatchingRule const*> StyleComputer::collect_matching_rules(DOM::Element const& element, CascadeOrigin cascade_origin, Optional<CSS::PseudoElement> pseudo_element, bool& did_match_any_hover_rules, FlyString const& qualified_layer_name) const
{
auto const& root_node = element.root();
auto shadow_root = is<DOM::ShadowRoot>(root_node) ? static_cast<DOM::ShadowRoot const*>(&root_node) : nullptr;
@ -985,7 +985,7 @@ void StyleComputer::set_property_expanding_shorthands(
void StyleComputer::set_all_properties(
CascadedProperties& cascaded_properties,
DOM::Element& element,
Optional<Selector::PseudoElement::Type> pseudo_element,
Optional<PseudoElement> pseudo_element,
CSSStyleValue const& value,
DOM::Document& document,
GC::Ptr<CSSStyleDeclaration const> declaration,
@ -1019,7 +1019,7 @@ void StyleComputer::set_all_properties(
void StyleComputer::cascade_declarations(
CascadedProperties& cascaded_properties,
DOM::Element& element,
Optional<CSS::Selector::PseudoElement::Type> pseudo_element,
Optional<CSS::PseudoElement> pseudo_element,
Vector<MatchingRule const*> const& matching_rules,
CascadeOrigin cascade_origin,
Important important,
@ -1064,7 +1064,7 @@ void StyleComputer::cascade_declarations(
}
}
static void cascade_custom_properties(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element, Vector<MatchingRule const*> const& matching_rules, HashMap<FlyString, StyleProperty>& custom_properties)
static void cascade_custom_properties(DOM::Element& element, Optional<CSS::PseudoElement> pseudo_element, Vector<MatchingRule const*> const& matching_rules, HashMap<FlyString, StyleProperty>& custom_properties)
{
size_t needed_capacity = 0;
for (auto const& matching_rule : matching_rules)
@ -1094,7 +1094,7 @@ static void cascade_custom_properties(DOM::Element& element, Optional<CSS::Selec
}
}
void StyleComputer::collect_animation_into(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element, GC::Ref<Animations::KeyframeEffect> effect, ComputedProperties& computed_properties, AnimationRefresh refresh) const
void StyleComputer::collect_animation_into(DOM::Element& element, Optional<CSS::PseudoElement> pseudo_element, GC::Ref<Animations::KeyframeEffect> effect, ComputedProperties& computed_properties, AnimationRefresh refresh) const
{
auto animation = effect->associated_animation();
if (!animation)
@ -1285,7 +1285,7 @@ static void apply_dimension_attribute(CascadedProperties& cascaded_properties, D
cascaded_properties.set_property_from_presentational_hint(property_id, parsed_value.release_nonnull());
}
static void compute_transitioned_properties(ComputedProperties const& style, DOM::Element& element, Optional<Selector::PseudoElement::Type> pseudo_element)
static void compute_transitioned_properties(ComputedProperties const& style, DOM::Element& element, Optional<PseudoElement> pseudo_element)
{
// FIXME: Implement transitioning for pseudo-elements
(void)pseudo_element;
@ -1369,7 +1369,7 @@ static void compute_transitioned_properties(ComputedProperties const& style, DOM
}
// https://drafts.csswg.org/css-transitions/#starting
void StyleComputer::start_needed_transitions(ComputedProperties const& previous_style, ComputedProperties& new_style, DOM::Element& element, Optional<Selector::PseudoElement::Type> pseudo_element) const
void StyleComputer::start_needed_transitions(ComputedProperties const& previous_style, ComputedProperties& new_style, DOM::Element& element, Optional<PseudoElement> pseudo_element) const
{
// FIXME: Implement transitions for pseudo-elements
if (pseudo_element.has_value())
@ -1563,7 +1563,7 @@ void StyleComputer::start_needed_transitions(ComputedProperties const& previous_
// https://www.w3.org/TR/css-cascade/#cascading
// https://drafts.csswg.org/css-cascade-5/#layering
GC::Ref<CascadedProperties> StyleComputer::compute_cascaded_values(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element, bool& did_match_any_pseudo_element_rules, bool& did_match_any_hover_rules, ComputeStyleMode mode) const
GC::Ref<CascadedProperties> StyleComputer::compute_cascaded_values(DOM::Element& element, Optional<CSS::PseudoElement> pseudo_element, bool& did_match_any_pseudo_element_rules, bool& did_match_any_hover_rules, ComputeStyleMode mode) const
{
auto cascaded_properties = m_document->heap().allocate<CascadedProperties>();
@ -1652,7 +1652,7 @@ GC::Ref<CascadedProperties> StyleComputer::compute_cascaded_values(DOM::Element&
return cascaded_properties;
}
DOM::Element const* element_to_inherit_style_from(DOM::Element const* element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element)
DOM::Element const* element_to_inherit_style_from(DOM::Element const* element, Optional<CSS::PseudoElement> pseudo_element)
{
// Pseudo-elements treat their originating element as their parent.
DOM::Element const* parent_element = nullptr;
@ -1664,7 +1664,7 @@ DOM::Element const* element_to_inherit_style_from(DOM::Element const* element, O
return parent_element;
}
NonnullRefPtr<CSSStyleValue const> StyleComputer::get_inherit_value(CSS::PropertyID property_id, DOM::Element const* element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element)
NonnullRefPtr<CSSStyleValue const> StyleComputer::get_inherit_value(CSS::PropertyID property_id, DOM::Element const* element, Optional<CSS::PseudoElement> pseudo_element)
{
auto* parent_element = element_to_inherit_style_from(element, pseudo_element);
@ -1673,7 +1673,7 @@ NonnullRefPtr<CSSStyleValue const> StyleComputer::get_inherit_value(CSS::Propert
return parent_element->computed_properties()->property(property_id);
}
void StyleComputer::compute_defaulted_property_value(ComputedProperties& style, DOM::Element const* element, CSS::PropertyID property_id, Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
void StyleComputer::compute_defaulted_property_value(ComputedProperties& style, DOM::Element const* element, CSS::PropertyID property_id, Optional<CSS::PseudoElement> pseudo_element) const
{
// FIXME: If we don't know the correct initial value for a property, we fall back to `initial`.
@ -1717,7 +1717,7 @@ void StyleComputer::compute_defaulted_property_value(ComputedProperties& style,
}
// https://www.w3.org/TR/css-cascade/#defaulting
void StyleComputer::compute_defaulted_values(ComputedProperties& style, DOM::Element const* element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
void StyleComputer::compute_defaulted_values(ComputedProperties& style, DOM::Element const* element, Optional<CSS::PseudoElement> pseudo_element) const
{
// Walk the list of all known CSS properties and:
// - Add them to `style` if they are missing.
@ -1880,7 +1880,7 @@ CSSPixelFraction StyleComputer::absolute_size_mapping(Keyword keyword)
}
}
RefPtr<Gfx::FontCascadeList const> StyleComputer::compute_font_for_style_values(DOM::Element const* element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element, CSSStyleValue const& font_family, CSSStyleValue const& font_size, CSSStyleValue const& font_style, CSSStyleValue const& font_weight, CSSStyleValue const& font_stretch, int math_depth) const
RefPtr<Gfx::FontCascadeList const> StyleComputer::compute_font_for_style_values(DOM::Element const* element, Optional<CSS::PseudoElement> pseudo_element, CSSStyleValue const& font_family, CSSStyleValue const& font_size, CSSStyleValue const& font_style, CSSStyleValue const& font_weight, CSSStyleValue const& font_stretch, int math_depth) const
{
auto* parent_element = element_to_inherit_style_from(element, pseudo_element);
@ -2100,7 +2100,7 @@ RefPtr<Gfx::FontCascadeList const> StyleComputer::compute_font_for_style_values(
return font_list;
}
void StyleComputer::compute_font(ComputedProperties& style, DOM::Element const* element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
void StyleComputer::compute_font(ComputedProperties& style, DOM::Element const* element, Optional<CSS::PseudoElement> pseudo_element) const
{
// To compute the font, first ensure that we've defaulted the relevant CSS font properties.
// FIXME: This should be more sophisticated.
@ -2211,7 +2211,7 @@ void StyleComputer::resolve_effective_overflow_values(ComputedProperties& style)
}
}
static void compute_text_align(ComputedProperties& style, DOM::Element const& element, Optional<Selector::PseudoElement::Type> pseudo_element)
static void compute_text_align(ComputedProperties& style, DOM::Element const& element, Optional<PseudoElement> pseudo_element)
{
// https://drafts.csswg.org/css-text-4/#valdef-text-align-match-parent
// This value behaves the same as inherit (computes to its parents computed value) except that an inherited
@ -2261,7 +2261,7 @@ enum class BoxTypeTransformation {
Inlinify,
};
static BoxTypeTransformation required_box_type_transformation(ComputedProperties const& style, DOM::Element const& element, Optional<CSS::Selector::PseudoElement::Type> const& pseudo_element)
static BoxTypeTransformation required_box_type_transformation(ComputedProperties const& style, DOM::Element const& element, Optional<CSS::PseudoElement> const& pseudo_element)
{
// NOTE: We never blockify <br> elements. They are always inline.
// There is currently no way to express in CSS how a <br> element really behaves.
@ -2289,7 +2289,7 @@ static BoxTypeTransformation required_box_type_transformation(ComputedProperties
}
// https://drafts.csswg.org/css-display/#transformations
void StyleComputer::transform_box_type_if_needed(ComputedProperties& style, DOM::Element const& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
void StyleComputer::transform_box_type_if_needed(ComputedProperties& style, DOM::Element const& element, Optional<CSS::PseudoElement> pseudo_element) const
{
// 2.7. Automatic Box Type Transformations
@ -2391,17 +2391,17 @@ GC::Ref<ComputedProperties> StyleComputer::create_document_style() const
return style;
}
GC::Ref<ComputedProperties> StyleComputer::compute_style(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
GC::Ref<ComputedProperties> StyleComputer::compute_style(DOM::Element& element, Optional<CSS::PseudoElement> pseudo_element) const
{
return *compute_style_impl(element, move(pseudo_element), ComputeStyleMode::Normal);
}
GC::Ptr<ComputedProperties> StyleComputer::compute_pseudo_element_style_if_needed(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
GC::Ptr<ComputedProperties> StyleComputer::compute_pseudo_element_style_if_needed(DOM::Element& element, Optional<CSS::PseudoElement> pseudo_element) const
{
return compute_style_impl(element, move(pseudo_element), ComputeStyleMode::CreatePseudoElementStyleIfNeeded);
}
GC::Ptr<ComputedProperties> StyleComputer::compute_style_impl(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element, ComputeStyleMode mode) const
GC::Ptr<ComputedProperties> StyleComputer::compute_style_impl(DOM::Element& element, Optional<CSS::PseudoElement> pseudo_element, ComputeStyleMode mode) const
{
build_rule_cache_if_needed();
@ -2451,7 +2451,7 @@ GC::Ptr<ComputedProperties> StyleComputer::compute_style_impl(DOM::Element& elem
// NOTE: `normal` is the initial value, so the absence of a value is treated as `normal`.
content_is_normal = true;
}
if (content_is_normal && first_is_one_of(*pseudo_element, CSS::Selector::PseudoElement::Type::Before, CSS::Selector::PseudoElement::Type::After)) {
if (content_is_normal && first_is_one_of(*pseudo_element, CSS::PseudoElement::Before, CSS::PseudoElement::After)) {
return {};
}
}
@ -2483,7 +2483,7 @@ static bool is_monospace(CSSStyleValue const& value)
// https://manishearth.github.io/blog/2017/08/10/font-size-an-unexpectedly-complex-css-property/
RefPtr<CSSStyleValue> StyleComputer::recascade_font_size_if_needed(
DOM::Element& element,
Optional<CSS::Selector::PseudoElement::Type> pseudo_element,
Optional<CSS::PseudoElement> pseudo_element,
CascadedProperties& cascaded_properties) const
{
// Check for `font-family: monospace`. Note that `font-family: monospace, AnythingElse` does not trigger this path.
@ -2545,7 +2545,7 @@ RefPtr<CSSStyleValue> StyleComputer::recascade_font_size_if_needed(
return CSS::LengthStyleValue::create(CSS::Length::make_px(current_size_in_px));
}
GC::Ref<ComputedProperties> StyleComputer::compute_properties(DOM::Element& element, Optional<Selector::PseudoElement::Type> pseudo_element, CascadedProperties& cascaded_properties) const
GC::Ref<ComputedProperties> StyleComputer::compute_properties(DOM::Element& element, Optional<PseudoElement> pseudo_element, CascadedProperties& cascaded_properties) const
{
auto computed_style = document().heap().allocate<CSS::ComputedProperties>();
@ -2620,7 +2620,7 @@ GC::Ref<ComputedProperties> StyleComputer::compute_properties(DOM::Element& elem
animation->set_effect(effect);
apply_animation_properties(m_document, cascaded_properties, animation);
if (pseudo_element.has_value())
effect->set_pseudo_element(Selector::PseudoElement { pseudo_element.value() });
effect->set_pseudo_element(Selector::PseudoElementSelector { pseudo_element.value() });
if (auto* rule_cache = rule_cache_for_cascade_origin(CascadeOrigin::Author, {}, {})) {
if (auto keyframe_set = rule_cache->rules_by_animation_keyframes.get(animation->id()); keyframe_set.has_value())
@ -2811,7 +2811,7 @@ void StyleComputer::make_rule_cache_for_cascade_origin(CascadeOrigin cascade_ori
auto& rule_cache = qualified_layer_name.is_empty() ? rule_caches.main : *rule_caches.by_layer.ensure(qualified_layer_name, [] { return make<RuleCache>(); });
bool contains_root_pseudo_class = false;
Optional<CSS::Selector::PseudoElement::Type> pseudo_element;
Optional<CSS::PseudoElement> pseudo_element;
collect_selector_insights(selector, insights);
@ -3072,7 +3072,7 @@ void StyleComputer::unload_fonts_from_sheet(CSSStyleSheet& sheet)
}
}
void StyleComputer::compute_math_depth(ComputedProperties& style, DOM::Element const* element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
void StyleComputer::compute_math_depth(ComputedProperties& style, DOM::Element const* element, Optional<CSS::PseudoElement> pseudo_element) const
{
// https://w3c.github.io/mathml-core/#propdef-math-depth
@ -3183,7 +3183,7 @@ bool StyleComputer::have_has_selectors() const
return m_selector_insights->has_has_selectors;
}
void RuleCache::add_rule(MatchingRule const& matching_rule, Optional<Selector::PseudoElement::Type> pseudo_element, bool contains_root_pseudo_class)
void RuleCache::add_rule(MatchingRule const& matching_rule, Optional<PseudoElement> pseudo_element, bool contains_root_pseudo_class)
{
// NOTE: We traverse the simple selectors in reverse order to make sure that class/ID buckets are preferred over tag buckets
// in the common case of div.foo or div#foo selectors.
@ -3230,7 +3230,7 @@ void RuleCache::add_rule(MatchingRule const& matching_rule, Optional<Selector::P
}
if (matching_rule.contains_pseudo_element && pseudo_element.has_value()) {
if (Selector::PseudoElement::is_known_pseudo_element_type(pseudo_element.value())) {
if (Selector::PseudoElementSelector::is_known_pseudo_element_type(pseudo_element.value())) {
rules_by_pseudo_element[to_underlying(pseudo_element.value())].append(matching_rule);
} else {
// NOTE: We don't cache rules for unknown pseudo-elements. They can't match anything anyway.
@ -3248,7 +3248,7 @@ void RuleCache::add_rule(MatchingRule const& matching_rule, Optional<Selector::P
}
}
void RuleCache::for_each_matching_rules(DOM::Element const& element, Optional<Selector::PseudoElement::Type> pseudo_element, Function<IterationDecision(Vector<MatchingRule> const&)> callback) const
void RuleCache::for_each_matching_rules(DOM::Element const& element, Optional<PseudoElement> pseudo_element, Function<IterationDecision(Vector<MatchingRule> const&)> callback) const
{
for (auto const& class_name : element.class_names()) {
if (auto it = rules_by_class.find(class_name); it != rules_by_class.end()) {
@ -3267,7 +3267,7 @@ void RuleCache::for_each_matching_rules(DOM::Element const& element, Optional<Se
return;
}
if (pseudo_element.has_value()) {
if (Selector::PseudoElement::is_known_pseudo_element_type(pseudo_element.value())) {
if (Selector::PseudoElementSelector::is_known_pseudo_element_type(pseudo_element.value())) {
if (callback(rules_by_pseudo_element.at(to_underlying(pseudo_element.value()))) == IterationDecision::Break)
return;
} else {

View file

@ -115,14 +115,14 @@ struct RuleCache {
HashMap<FlyString, Vector<MatchingRule>> rules_by_class;
HashMap<FlyString, Vector<MatchingRule>> rules_by_tag_name;
HashMap<FlyString, Vector<MatchingRule>, AK::ASCIICaseInsensitiveFlyStringTraits> rules_by_attribute_name;
Array<Vector<MatchingRule>, to_underlying(CSS::Selector::PseudoElement::Type::KnownPseudoElementCount)> rules_by_pseudo_element;
Array<Vector<MatchingRule>, to_underlying(CSS::PseudoElement::KnownPseudoElementCount)> rules_by_pseudo_element;
Vector<MatchingRule> root_rules;
Vector<MatchingRule> other_rules;
HashMap<FlyString, NonnullRefPtr<Animations::KeyframeEffect::KeyFrameSet>> rules_by_animation_keyframes;
void add_rule(MatchingRule const&, Optional<Selector::PseudoElement::Type>, bool contains_root_pseudo_class);
void for_each_matching_rules(DOM::Element const&, Optional<Selector::PseudoElement::Type>, Function<IterationDecision(Vector<MatchingRule> const&)> callback) const;
void add_rule(MatchingRule const&, Optional<PseudoElement>, bool contains_root_pseudo_class);
void for_each_matching_rules(DOM::Element const&, Optional<PseudoElement>, Function<IterationDecision(Vector<MatchingRule> const&)> callback) const;
};
class FontLoader;
@ -142,7 +142,7 @@ public:
CascadeOrigin,
Important,
Optional<FlyString> layer_name);
static NonnullRefPtr<CSSStyleValue const> get_inherit_value(CSS::PropertyID, DOM::Element const*, Optional<CSS::Selector::PseudoElement::Type> = {});
static NonnullRefPtr<CSSStyleValue const> get_inherit_value(CSS::PropertyID, DOM::Element const*, Optional<CSS::PseudoElement> = {});
static Optional<String> user_agent_style_sheet_source(StringView name);
@ -158,11 +158,11 @@ public:
[[nodiscard]] GC::Ref<ComputedProperties> create_document_style() const;
[[nodiscard]] GC::Ref<ComputedProperties> compute_style(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type> = {}) const;
[[nodiscard]] GC::Ptr<ComputedProperties> compute_pseudo_element_style_if_needed(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>) const;
[[nodiscard]] GC::Ref<ComputedProperties> compute_style(DOM::Element&, Optional<CSS::PseudoElement> = {}) const;
[[nodiscard]] GC::Ptr<ComputedProperties> compute_pseudo_element_style_if_needed(DOM::Element&, Optional<CSS::PseudoElement>) const;
RuleCache const& get_hover_rules() const;
[[nodiscard]] Vector<MatchingRule const*> collect_matching_rules(DOM::Element const&, CascadeOrigin, Optional<CSS::Selector::PseudoElement::Type>, bool& did_match_any_hover_rules, FlyString const& qualified_layer_name = {}) const;
[[nodiscard]] Vector<MatchingRule const*> collect_matching_rules(DOM::Element const&, CascadeOrigin, Optional<CSS::PseudoElement>, bool& did_match_any_hover_rules, FlyString const& qualified_layer_name = {}) const;
InvalidationSet invalidation_set_for_properties(Vector<InvalidationSet::Property> const&) const;
bool invalidation_property_used_in_has_selector(InvalidationSet::Property const&) const;
@ -181,9 +181,9 @@ public:
static CSSPixels default_user_font_size();
static CSSPixelFraction absolute_size_mapping(Keyword);
RefPtr<Gfx::FontCascadeList const> compute_font_for_style_values(DOM::Element const* element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element, CSSStyleValue const& font_family, CSSStyleValue const& font_size, CSSStyleValue const& font_style, CSSStyleValue const& font_weight, CSSStyleValue const& font_stretch, int math_depth = 0) const;
RefPtr<Gfx::FontCascadeList const> compute_font_for_style_values(DOM::Element const* element, Optional<CSS::PseudoElement> pseudo_element, CSSStyleValue const& font_family, CSSStyleValue const& font_size, CSSStyleValue const& font_style, CSSStyleValue const& font_weight, CSSStyleValue const& font_stretch, int math_depth = 0) const;
[[nodiscard]] RefPtr<CSSStyleValue> recascade_font_size_if_needed(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type> pseudo_element, CascadedProperties&) const;
[[nodiscard]] RefPtr<CSSStyleValue> recascade_font_size_if_needed(DOM::Element&, Optional<CSS::PseudoElement> pseudo_element, CascadedProperties&) const;
void set_viewport_rect(Badge<DOM::Document>, CSSPixelRect const& viewport_rect) { m_viewport_rect = viewport_rect; }
@ -191,17 +191,17 @@ public:
No,
Yes,
};
void collect_animation_into(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>, GC::Ref<Animations::KeyframeEffect> animation, ComputedProperties&, AnimationRefresh = AnimationRefresh::No) const;
void collect_animation_into(DOM::Element&, Optional<CSS::PseudoElement>, GC::Ref<Animations::KeyframeEffect> animation, ComputedProperties&, AnimationRefresh = AnimationRefresh::No) const;
[[nodiscard]] bool may_have_has_selectors() const;
[[nodiscard]] bool have_has_selectors() const;
size_t number_of_css_font_faces_with_loading_in_progress() const;
[[nodiscard]] GC::Ref<ComputedProperties> compute_properties(DOM::Element&, Optional<Selector::PseudoElement::Type>, CascadedProperties&) const;
[[nodiscard]] GC::Ref<ComputedProperties> compute_properties(DOM::Element&, Optional<PseudoElement>, CascadedProperties&) const;
void absolutize_values(ComputedProperties&, GC::Ptr<DOM::Element const>) const;
void compute_font(ComputedProperties&, DOM::Element const*, Optional<CSS::Selector::PseudoElement::Type>) const;
void compute_font(ComputedProperties&, DOM::Element const*, Optional<CSS::PseudoElement>) const;
[[nodiscard]] inline bool should_reject_with_ancestor_filter(Selector const&) const;
@ -213,23 +213,23 @@ private:
struct MatchingFontCandidate;
[[nodiscard]] GC::Ptr<ComputedProperties> compute_style_impl(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>, ComputeStyleMode) const;
[[nodiscard]] GC::Ref<CascadedProperties> compute_cascaded_values(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>, bool& did_match_any_pseudo_element_rules, bool& did_match_any_hover_rules, ComputeStyleMode) const;
[[nodiscard]] GC::Ptr<ComputedProperties> compute_style_impl(DOM::Element&, Optional<CSS::PseudoElement>, ComputeStyleMode) const;
[[nodiscard]] GC::Ref<CascadedProperties> compute_cascaded_values(DOM::Element&, Optional<CSS::PseudoElement>, bool& did_match_any_pseudo_element_rules, bool& did_match_any_hover_rules, ComputeStyleMode) const;
static RefPtr<Gfx::FontCascadeList const> find_matching_font_weight_ascending(Vector<MatchingFontCandidate> const& candidates, int target_weight, float font_size_in_pt, bool inclusive);
static RefPtr<Gfx::FontCascadeList const> find_matching_font_weight_descending(Vector<MatchingFontCandidate> const& candidates, int target_weight, float font_size_in_pt, bool inclusive);
RefPtr<Gfx::FontCascadeList const> font_matching_algorithm(FlyString const& family_name, int weight, int slope, float font_size_in_pt) const;
void compute_math_depth(ComputedProperties&, DOM::Element const*, Optional<CSS::Selector::PseudoElement::Type>) const;
void compute_defaulted_values(ComputedProperties&, DOM::Element const*, Optional<CSS::Selector::PseudoElement::Type>) const;
void start_needed_transitions(ComputedProperties const& old_style, ComputedProperties& new_style, DOM::Element&, Optional<Selector::PseudoElement::Type>) const;
void compute_math_depth(ComputedProperties&, DOM::Element const*, Optional<CSS::PseudoElement>) const;
void compute_defaulted_values(ComputedProperties&, DOM::Element const*, Optional<CSS::PseudoElement>) const;
void start_needed_transitions(ComputedProperties const& old_style, ComputedProperties& new_style, DOM::Element&, Optional<PseudoElement>) const;
void resolve_effective_overflow_values(ComputedProperties&) const;
void transform_box_type_if_needed(ComputedProperties&, DOM::Element const&, Optional<CSS::Selector::PseudoElement::Type>) const;
void transform_box_type_if_needed(ComputedProperties&, DOM::Element const&, Optional<CSS::PseudoElement>) const;
void compute_defaulted_property_value(ComputedProperties&, DOM::Element const*, CSS::PropertyID, Optional<CSS::Selector::PseudoElement::Type>) const;
void compute_defaulted_property_value(ComputedProperties&, DOM::Element const*, CSS::PropertyID, Optional<CSS::PseudoElement>) const;
void set_all_properties(
CascadedProperties&,
DOM::Element&,
Optional<Selector::PseudoElement::Type>,
Optional<PseudoElement>,
CSSStyleValue const&,
DOM::Document&,
GC::Ptr<CSSStyleDeclaration const>,
@ -261,7 +261,7 @@ private:
void cascade_declarations(
CascadedProperties&,
DOM::Element&,
Optional<CSS::Selector::PseudoElement::Type>,
Optional<CSS::PseudoElement>,
Vector<MatchingRule const*> const&,
CascadeOrigin,
Important,