mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 21:15:14 +00:00
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:
parent
40760308c6
commit
eb1ad8655e
42 changed files with 270 additions and 271 deletions
|
@ -66,9 +66,9 @@ NodeIdentifier NodeIdentifier::for_node(JsonObject const& node)
|
|||
{
|
||||
NodeIdentifier identifier;
|
||||
|
||||
identifier.pseudo_element = node.get_integer<UnderlyingType<Web::CSS::Selector::PseudoElement::Type>>("pseudo-element"sv).map([](auto value) {
|
||||
VERIFY(value < to_underlying(Web::CSS::Selector::PseudoElement::Type::KnownPseudoElementCount));
|
||||
return static_cast<Web::CSS::Selector::PseudoElement::Type>(value);
|
||||
identifier.pseudo_element = node.get_integer<UnderlyingType<Web::CSS::PseudoElement>>("pseudo-element"sv).map([](auto value) {
|
||||
VERIFY(value < to_underlying(Web::CSS::PseudoElement::KnownPseudoElementCount));
|
||||
return static_cast<Web::CSS::PseudoElement>(value);
|
||||
});
|
||||
|
||||
if (identifier.pseudo_element.has_value())
|
||||
|
|
|
@ -21,7 +21,7 @@ struct NodeIdentifier {
|
|||
bool operator==(NodeIdentifier const&) const = default;
|
||||
|
||||
Web::UniqueNodeID id { 0 };
|
||||
Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element;
|
||||
Optional<Web::CSS::PseudoElement> pseudo_element;
|
||||
};
|
||||
|
||||
class NodeActor final : public Actor {
|
||||
|
@ -55,7 +55,7 @@ struct AK::Traits<DevTools::NodeIdentifier> : public AK::DefaultTraits<DevTools:
|
|||
|
||||
static unsigned hash(DevTools::NodeIdentifier const& node_identifier)
|
||||
{
|
||||
auto pseudo_element = node_identifier.pseudo_element.value_or(Web::CSS::Selector::PseudoElement::Type::KnownPseudoElementCount);
|
||||
auto pseudo_element = node_identifier.pseudo_element.value_or(Web::CSS::PseudoElement::KnownPseudoElementCount);
|
||||
return pair_int_hash(node_identifier.id.value(), to_underlying(pseudo_element));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -35,10 +35,10 @@ public:
|
|||
using OnDOMNodePropertiesReceived = Function<void(WebView::DOMNodeProperties)>;
|
||||
virtual void listen_for_dom_properties(TabDescription const&, OnDOMNodePropertiesReceived) const { }
|
||||
virtual void stop_listening_for_dom_properties(TabDescription const&) const { }
|
||||
virtual void inspect_dom_node(TabDescription const&, WebView::DOMNodeProperties::Type, Web::UniqueNodeID, Optional<Web::CSS::Selector::PseudoElement::Type>) const { }
|
||||
virtual void inspect_dom_node(TabDescription const&, WebView::DOMNodeProperties::Type, Web::UniqueNodeID, Optional<Web::CSS::PseudoElement>) const { }
|
||||
virtual void clear_inspected_dom_node(TabDescription const&) const { }
|
||||
|
||||
virtual void highlight_dom_node(TabDescription const&, Web::UniqueNodeID, Optional<Web::CSS::Selector::PseudoElement::Type>) const { }
|
||||
virtual void highlight_dom_node(TabDescription const&, Web::UniqueNodeID, Optional<Web::CSS::PseudoElement>) const { }
|
||||
virtual void clear_highlighted_dom_node(TabDescription const&) const { }
|
||||
|
||||
using OnDOMMutationReceived = Function<void(WebView::Mutation)>;
|
||||
|
|
|
@ -72,7 +72,7 @@ WebIDL::ExceptionOr<Vector<GC::Ref<Animation>>> Animatable::get_animations_inter
|
|||
|
||||
// 2. Let pseudoElement be the result of pseudo-element parsing applied to pseudoElement of options, or null if options is not passed.
|
||||
// FIXME: Currently only DOM::Element includes Animatable, but that might not always be true.
|
||||
Optional<CSS::Selector::PseudoElement> pseudo_element;
|
||||
Optional<CSS::Selector::PseudoElementSelector> pseudo_element;
|
||||
if (options.has_value() && options->pseudo_element.has_value()) {
|
||||
auto& realm = static_cast<DOM::Element&>(*this).realm();
|
||||
pseudo_element = TRY(pseudo_element_parsing(realm, options->pseudo_element));
|
||||
|
@ -185,10 +185,10 @@ void Animatable::visit_edges(JS::Cell::Visitor& visitor)
|
|||
visitor.visit(m_associated_transitions);
|
||||
}
|
||||
|
||||
GC::Ptr<CSS::CSSStyleDeclaration const> Animatable::cached_animation_name_source(Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
|
||||
GC::Ptr<CSS::CSSStyleDeclaration const> Animatable::cached_animation_name_source(Optional<CSS::PseudoElement> pseudo_element) const
|
||||
{
|
||||
if (pseudo_element.has_value()) {
|
||||
if (!CSS::Selector::PseudoElement::is_known_pseudo_element_type(pseudo_element.value())) {
|
||||
if (!CSS::Selector::PseudoElementSelector::is_known_pseudo_element_type(pseudo_element.value())) {
|
||||
return {};
|
||||
}
|
||||
return m_cached_animation_name_source[to_underlying(pseudo_element.value()) + 1];
|
||||
|
@ -196,10 +196,10 @@ GC::Ptr<CSS::CSSStyleDeclaration const> Animatable::cached_animation_name_source
|
|||
return m_cached_animation_name_source[0];
|
||||
}
|
||||
|
||||
void Animatable::set_cached_animation_name_source(GC::Ptr<CSS::CSSStyleDeclaration const> value, Optional<CSS::Selector::PseudoElement::Type> pseudo_element)
|
||||
void Animatable::set_cached_animation_name_source(GC::Ptr<CSS::CSSStyleDeclaration const> value, Optional<CSS::PseudoElement> pseudo_element)
|
||||
{
|
||||
if (pseudo_element.has_value()) {
|
||||
if (!CSS::Selector::PseudoElement::is_known_pseudo_element_type(pseudo_element.value())) {
|
||||
if (!CSS::Selector::PseudoElementSelector::is_known_pseudo_element_type(pseudo_element.value())) {
|
||||
return;
|
||||
}
|
||||
m_cached_animation_name_source[to_underlying(pseudo_element.value()) + 1] = value;
|
||||
|
@ -208,10 +208,10 @@ void Animatable::set_cached_animation_name_source(GC::Ptr<CSS::CSSStyleDeclarati
|
|||
}
|
||||
}
|
||||
|
||||
GC::Ptr<Animations::Animation> Animatable::cached_animation_name_animation(Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
|
||||
GC::Ptr<Animations::Animation> Animatable::cached_animation_name_animation(Optional<CSS::PseudoElement> pseudo_element) const
|
||||
{
|
||||
if (pseudo_element.has_value()) {
|
||||
if (!CSS::Selector::PseudoElement::is_known_pseudo_element_type(pseudo_element.value())) {
|
||||
if (!CSS::Selector::PseudoElementSelector::is_known_pseudo_element_type(pseudo_element.value())) {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -220,11 +220,11 @@ GC::Ptr<Animations::Animation> Animatable::cached_animation_name_animation(Optio
|
|||
return m_cached_animation_name_animation[0];
|
||||
}
|
||||
|
||||
void Animatable::set_cached_animation_name_animation(GC::Ptr<Animations::Animation> value, Optional<CSS::Selector::PseudoElement::Type> pseudo_element)
|
||||
void Animatable::set_cached_animation_name_animation(GC::Ptr<Animations::Animation> value, Optional<CSS::PseudoElement> pseudo_element)
|
||||
{
|
||||
|
||||
if (pseudo_element.has_value()) {
|
||||
if (!CSS::Selector::PseudoElement::is_known_pseudo_element_type(pseudo_element.value())) {
|
||||
if (!CSS::Selector::PseudoElementSelector::is_known_pseudo_element_type(pseudo_element.value())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,11 +47,11 @@ public:
|
|||
void associate_with_animation(GC::Ref<Animation>);
|
||||
void disassociate_with_animation(GC::Ref<Animation>);
|
||||
|
||||
GC::Ptr<CSS::CSSStyleDeclaration const> cached_animation_name_source(Optional<CSS::Selector::PseudoElement::Type>) const;
|
||||
void set_cached_animation_name_source(GC::Ptr<CSS::CSSStyleDeclaration const> value, Optional<CSS::Selector::PseudoElement::Type>);
|
||||
GC::Ptr<CSS::CSSStyleDeclaration const> cached_animation_name_source(Optional<CSS::PseudoElement>) const;
|
||||
void set_cached_animation_name_source(GC::Ptr<CSS::CSSStyleDeclaration const> value, Optional<CSS::PseudoElement>);
|
||||
|
||||
GC::Ptr<Animations::Animation> cached_animation_name_animation(Optional<CSS::Selector::PseudoElement::Type>) const;
|
||||
void set_cached_animation_name_animation(GC::Ptr<Animations::Animation> value, Optional<CSS::Selector::PseudoElement::Type>);
|
||||
GC::Ptr<Animations::Animation> cached_animation_name_animation(Optional<CSS::PseudoElement>) const;
|
||||
void set_cached_animation_name_animation(GC::Ptr<Animations::Animation> value, Optional<CSS::PseudoElement>);
|
||||
|
||||
GC::Ptr<CSS::CSSStyleDeclaration const> cached_transition_property_source() const { return m_cached_transition_property_source; }
|
||||
void set_cached_transition_property_source(GC::Ptr<CSS::CSSStyleDeclaration const> value) { m_cached_transition_property_source = value; }
|
||||
|
@ -70,8 +70,8 @@ private:
|
|||
Vector<GC::Ref<Animation>> m_associated_animations;
|
||||
bool m_is_sorted_by_composite_order { true };
|
||||
|
||||
Array<GC::Ptr<CSS::CSSStyleDeclaration const>, to_underlying(CSS::Selector::PseudoElement::Type::KnownPseudoElementCount) + 1> m_cached_animation_name_source;
|
||||
Array<GC::Ptr<Animations::Animation>, to_underlying(CSS::Selector::PseudoElement::Type::KnownPseudoElementCount) + 1> m_cached_animation_name_animation;
|
||||
Array<GC::Ptr<CSS::CSSStyleDeclaration const>, to_underlying(CSS::PseudoElement::KnownPseudoElementCount) + 1> m_cached_animation_name_source;
|
||||
Array<GC::Ptr<Animations::Animation>, to_underlying(CSS::PseudoElement::KnownPseudoElementCount) + 1> m_cached_animation_name_animation;
|
||||
|
||||
HashMap<CSS::PropertyID, size_t> m_transition_attribute_indices;
|
||||
Vector<TransitionAttributes> m_transition_attributes;
|
||||
|
|
|
@ -791,7 +791,7 @@ WebIDL::ExceptionOr<void> KeyframeEffect::set_pseudo_element(Optional<String> va
|
|||
return {};
|
||||
}
|
||||
|
||||
Optional<CSS::Selector::PseudoElement::Type> KeyframeEffect::pseudo_element_type() const
|
||||
Optional<CSS::PseudoElement> KeyframeEffect::pseudo_element_type() const
|
||||
{
|
||||
if (!m_target_pseudo_selector.has_value())
|
||||
return {};
|
||||
|
|
|
@ -91,8 +91,8 @@ public:
|
|||
Optional<String> pseudo_element() const;
|
||||
WebIDL::ExceptionOr<void> set_pseudo_element(Optional<String>);
|
||||
|
||||
Optional<CSS::Selector::PseudoElement::Type> pseudo_element_type() const;
|
||||
void set_pseudo_element(Optional<CSS::Selector::PseudoElement> pseudo_element) { m_target_pseudo_selector = pseudo_element; }
|
||||
Optional<CSS::PseudoElement> pseudo_element_type() const;
|
||||
void set_pseudo_element(Optional<CSS::Selector::PseudoElementSelector> pseudo_element) { m_target_pseudo_selector = pseudo_element; }
|
||||
|
||||
Bindings::CompositeOperation composite() const { return m_composite; }
|
||||
void set_composite(Bindings::CompositeOperation value) { m_composite = value; }
|
||||
|
@ -121,7 +121,7 @@ private:
|
|||
GC::Ptr<DOM::Element> m_target_element {};
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#dom-keyframeeffect-pseudoelement
|
||||
Optional<CSS::Selector::PseudoElement> m_target_pseudo_selector {};
|
||||
Optional<CSS::Selector::PseudoElementSelector> m_target_pseudo_selector {};
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#dom-keyframeeffect-composite
|
||||
Bindings::CompositeOperation m_composite { Bindings::CompositeOperation::Replace };
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
namespace Web::Animations {
|
||||
|
||||
// https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-pseudo-element-parsing
|
||||
WebIDL::ExceptionOr<Optional<CSS::Selector::PseudoElement>> pseudo_element_parsing(JS::Realm& realm, Optional<String> const& value)
|
||||
WebIDL::ExceptionOr<Optional<CSS::Selector::PseudoElementSelector>> pseudo_element_parsing(JS::Realm& realm, Optional<String> const& value)
|
||||
{
|
||||
// 1. Given the value value, perform the following steps:
|
||||
|
||||
// 2. If value is not null and is an invalid <pseudo-element-selector>,
|
||||
Optional<CSS::Selector::PseudoElement> pseudo_element;
|
||||
Optional<CSS::Selector::PseudoElementSelector> pseudo_element;
|
||||
if (value.has_value()) {
|
||||
pseudo_element = parse_pseudo_element_selector(CSS::Parser::ParsingParams { realm }, *value);
|
||||
if (!pseudo_element.has_value()) {
|
||||
|
@ -28,7 +28,7 @@ WebIDL::ExceptionOr<Optional<CSS::Selector::PseudoElement>> pseudo_element_parsi
|
|||
// 3. If value is one of the legacy Selectors Level 2 single-colon selectors (':before', ':after', ':first-letter', or ':first-line'),
|
||||
// then return the equivalent two-colon selector (e.g. '::before').
|
||||
if (value.has_value() && value->is_one_of(":before", ":after", ":first-letter", ":first-line")) {
|
||||
return CSS::Selector::PseudoElement::from_string(MUST(value->substring_from_byte_offset(1)));
|
||||
return CSS::Selector::PseudoElementSelector::from_string(MUST(value->substring_from_byte_offset(1)));
|
||||
}
|
||||
|
||||
// 4. Otherwise, return value.
|
||||
|
|
|
@ -14,6 +14,6 @@
|
|||
namespace Web::Animations {
|
||||
|
||||
// https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-pseudo-element-parsing
|
||||
WebIDL::ExceptionOr<Optional<CSS::Selector::PseudoElement>> pseudo_element_parsing(JS::Realm&, Optional<String> const&);
|
||||
WebIDL::ExceptionOr<Optional<CSS::Selector::PseudoElementSelector>> pseudo_element_parsing(JS::Realm&, Optional<String> const&);
|
||||
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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 parent’s 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 {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1685,7 +1685,7 @@ void Document::set_inspected_node(GC::Ptr<Node> node)
|
|||
m_inspected_node = node;
|
||||
}
|
||||
|
||||
void Document::set_highlighted_node(GC::Ptr<Node> node, Optional<CSS::Selector::PseudoElement::Type> pseudo_element)
|
||||
void Document::set_highlighted_node(GC::Ptr<Node> node, Optional<CSS::PseudoElement> pseudo_element)
|
||||
{
|
||||
if (m_highlighted_node == node && m_highlighted_pseudo_element == pseudo_element)
|
||||
return;
|
||||
|
@ -1797,12 +1797,12 @@ void Document::invalidate_style_for_elements_affected_by_hover_change(Node& old_
|
|||
SelectorEngine::MatchContext context;
|
||||
if (SelectorEngine::matches(selector, element, {}, context, {}))
|
||||
return true;
|
||||
if (element.has_pseudo_element(CSS::Selector::PseudoElement::Type::Before)) {
|
||||
if (SelectorEngine::matches(selector, element, {}, context, CSS::Selector::PseudoElement::Type::Before))
|
||||
if (element.has_pseudo_element(CSS::PseudoElement::Before)) {
|
||||
if (SelectorEngine::matches(selector, element, {}, context, CSS::PseudoElement::Before))
|
||||
return true;
|
||||
}
|
||||
if (element.has_pseudo_element(CSS::Selector::PseudoElement::Type::After)) {
|
||||
if (SelectorEngine::matches(selector, element, {}, context, CSS::Selector::PseudoElement::Type::After))
|
||||
if (element.has_pseudo_element(CSS::PseudoElement::After)) {
|
||||
if (SelectorEngine::matches(selector, element, {}, context, CSS::PseudoElement::After))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -265,7 +265,7 @@ public:
|
|||
void set_inspected_node(GC::Ptr<Node>);
|
||||
GC::Ptr<Node const> inspected_node() const { return m_inspected_node; }
|
||||
|
||||
void set_highlighted_node(GC::Ptr<Node>, Optional<CSS::Selector::PseudoElement::Type>);
|
||||
void set_highlighted_node(GC::Ptr<Node>, Optional<CSS::PseudoElement>);
|
||||
GC::Ptr<Node const> highlighted_node() const { return m_highlighted_node; }
|
||||
GC::Ptr<Layout::Node> highlighted_layout_node();
|
||||
GC::Ptr<Layout::Node const> highlighted_layout_node() const { return const_cast<Document*>(this)->highlighted_layout_node(); }
|
||||
|
@ -963,7 +963,7 @@ private:
|
|||
GC::Ptr<Node> m_hovered_node;
|
||||
GC::Ptr<Node> m_inspected_node;
|
||||
GC::Ptr<Node> m_highlighted_node;
|
||||
Optional<CSS::Selector::PseudoElement::Type> m_highlighted_pseudo_element;
|
||||
Optional<CSS::PseudoElement> m_highlighted_pseudo_element;
|
||||
|
||||
Optional<Color> m_normal_link_color;
|
||||
Optional<Color> m_active_link_color;
|
||||
|
|
|
@ -547,7 +547,7 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_style()
|
|||
}
|
||||
|
||||
// Any document change that can cause this element's style to change, could also affect its pseudo-elements.
|
||||
auto recompute_pseudo_element_style = [&](CSS::Selector::PseudoElement::Type pseudo_element) {
|
||||
auto recompute_pseudo_element_style = [&](CSS::PseudoElement pseudo_element) {
|
||||
style_computer.push_ancestor(*this);
|
||||
|
||||
auto pseudo_element_style = pseudo_element_computed_properties(pseudo_element);
|
||||
|
@ -564,10 +564,10 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_style()
|
|||
style_computer.pop_ancestor(*this);
|
||||
};
|
||||
|
||||
recompute_pseudo_element_style(CSS::Selector::PseudoElement::Type::Before);
|
||||
recompute_pseudo_element_style(CSS::Selector::PseudoElement::Type::After);
|
||||
recompute_pseudo_element_style(CSS::PseudoElement::Before);
|
||||
recompute_pseudo_element_style(CSS::PseudoElement::After);
|
||||
if (had_list_marker || m_computed_properties->display().is_list_item())
|
||||
recompute_pseudo_element_style(CSS::Selector::PseudoElement::Type::Marker);
|
||||
recompute_pseudo_element_style(CSS::PseudoElement::Marker);
|
||||
|
||||
if (invalidation.is_none())
|
||||
return invalidation;
|
||||
|
@ -582,8 +582,8 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_style()
|
|||
paintable()->set_needs_display();
|
||||
|
||||
// Do the same for pseudo-elements.
|
||||
for (auto i = 0; i < to_underlying(CSS::Selector::PseudoElement::Type::KnownPseudoElementCount); i++) {
|
||||
auto pseudo_element_type = static_cast<CSS::Selector::PseudoElement::Type>(i);
|
||||
for (auto i = 0; i < to_underlying(CSS::PseudoElement::KnownPseudoElementCount); i++) {
|
||||
auto pseudo_element_type = static_cast<CSS::PseudoElement>(i);
|
||||
auto pseudo_element = get_pseudo_element(pseudo_element_type);
|
||||
if (!pseudo_element.has_value() || !pseudo_element->layout_node)
|
||||
continue;
|
||||
|
@ -647,7 +647,7 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_inherited_style()
|
|||
return invalidation;
|
||||
}
|
||||
|
||||
GC::Ref<CSS::ComputedProperties> Element::resolved_css_values(Optional<CSS::Selector::PseudoElement::Type> type)
|
||||
GC::Ref<CSS::ComputedProperties> Element::resolved_css_values(Optional<CSS::PseudoElement> type)
|
||||
{
|
||||
auto element_computed_style = CSS::CSSStyleProperties::create_resolved_style({ *this, type });
|
||||
auto properties = heap().allocate<CSS::ComputedProperties>();
|
||||
|
@ -1164,20 +1164,20 @@ void Element::children_changed(ChildrenChangedMetadata const* metadata)
|
|||
set_needs_style_update(true);
|
||||
}
|
||||
|
||||
void Element::set_pseudo_element_node(Badge<Layout::TreeBuilder>, CSS::Selector::PseudoElement::Type pseudo_element, GC::Ptr<Layout::NodeWithStyle> pseudo_element_node)
|
||||
void Element::set_pseudo_element_node(Badge<Layout::TreeBuilder>, CSS::PseudoElement pseudo_element, GC::Ptr<Layout::NodeWithStyle> pseudo_element_node)
|
||||
{
|
||||
auto existing_pseudo_element = get_pseudo_element(pseudo_element);
|
||||
if (!existing_pseudo_element.has_value() && !pseudo_element_node)
|
||||
return;
|
||||
|
||||
if (!CSS::Selector::PseudoElement::is_known_pseudo_element_type(pseudo_element)) {
|
||||
if (!CSS::Selector::PseudoElementSelector::is_known_pseudo_element_type(pseudo_element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ensure_pseudo_element(pseudo_element).layout_node = move(pseudo_element_node);
|
||||
}
|
||||
|
||||
GC::Ptr<Layout::NodeWithStyle> Element::get_pseudo_element_node(CSS::Selector::PseudoElement::Type pseudo_element) const
|
||||
GC::Ptr<Layout::NodeWithStyle> Element::get_pseudo_element_node(CSS::PseudoElement pseudo_element) const
|
||||
{
|
||||
if (auto element_data = get_pseudo_element(pseudo_element); element_data.has_value())
|
||||
return element_data->layout_node;
|
||||
|
@ -1385,7 +1385,7 @@ void Element::serialize_pseudo_elements_as_json(JsonArraySerializer<StringBuilde
|
|||
if (!pseudo_element)
|
||||
continue;
|
||||
auto object = MUST(children_array.add_object());
|
||||
MUST(object.add("name"sv, MUST(String::formatted("::{}", CSS::Selector::PseudoElement::name(static_cast<CSS::Selector::PseudoElement::Type>(i))))));
|
||||
MUST(object.add("name"sv, MUST(String::formatted("::{}", CSS::Selector::PseudoElementSelector::name(static_cast<CSS::PseudoElement>(i))))));
|
||||
MUST(object.add("type"sv, "pseudo-element"));
|
||||
MUST(object.add("parent-id"sv, unique_id().value()));
|
||||
MUST(object.add("pseudo-element"sv, i));
|
||||
|
@ -2645,7 +2645,7 @@ size_t Element::attribute_list_size() const
|
|||
return m_attributes->length();
|
||||
}
|
||||
|
||||
GC::Ptr<CSS::CascadedProperties> Element::cascaded_properties(Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
|
||||
GC::Ptr<CSS::CascadedProperties> Element::cascaded_properties(Optional<CSS::PseudoElement> pseudo_element) const
|
||||
{
|
||||
if (pseudo_element.has_value()) {
|
||||
auto pseudo_element_data = get_pseudo_element(pseudo_element.value());
|
||||
|
@ -2656,10 +2656,10 @@ GC::Ptr<CSS::CascadedProperties> Element::cascaded_properties(Optional<CSS::Sele
|
|||
return m_cascaded_properties;
|
||||
}
|
||||
|
||||
void Element::set_cascaded_properties(Optional<CSS::Selector::PseudoElement::Type> pseudo_element, GC::Ptr<CSS::CascadedProperties> cascaded_properties)
|
||||
void Element::set_cascaded_properties(Optional<CSS::PseudoElement> pseudo_element, GC::Ptr<CSS::CascadedProperties> cascaded_properties)
|
||||
{
|
||||
if (pseudo_element.has_value()) {
|
||||
if (pseudo_element.value() >= CSS::Selector::PseudoElement::Type::KnownPseudoElementCount)
|
||||
if (pseudo_element.value() >= CSS::PseudoElement::KnownPseudoElementCount)
|
||||
return;
|
||||
ensure_pseudo_element(pseudo_element.value()).cascaded_properties = cascaded_properties;
|
||||
} else {
|
||||
|
@ -2673,19 +2673,19 @@ void Element::set_computed_properties(GC::Ptr<CSS::ComputedProperties> style)
|
|||
computed_properties_changed();
|
||||
}
|
||||
|
||||
void Element::set_pseudo_element_computed_properties(CSS::Selector::PseudoElement::Type pseudo_element, GC::Ptr<CSS::ComputedProperties> style)
|
||||
void Element::set_pseudo_element_computed_properties(CSS::PseudoElement pseudo_element, GC::Ptr<CSS::ComputedProperties> style)
|
||||
{
|
||||
if (!m_pseudo_element_data && !style)
|
||||
return;
|
||||
|
||||
if (!CSS::Selector::PseudoElement::is_known_pseudo_element_type(pseudo_element)) {
|
||||
if (!CSS::Selector::PseudoElementSelector::is_known_pseudo_element_type(pseudo_element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ensure_pseudo_element(pseudo_element).computed_properties = style;
|
||||
}
|
||||
|
||||
GC::Ptr<CSS::ComputedProperties> Element::pseudo_element_computed_properties(CSS::Selector::PseudoElement::Type type)
|
||||
GC::Ptr<CSS::ComputedProperties> Element::pseudo_element_computed_properties(CSS::PseudoElement type)
|
||||
{
|
||||
auto pseudo_element = get_pseudo_element(type);
|
||||
if (pseudo_element.has_value())
|
||||
|
@ -2693,48 +2693,48 @@ GC::Ptr<CSS::ComputedProperties> Element::pseudo_element_computed_properties(CSS
|
|||
return {};
|
||||
}
|
||||
|
||||
Optional<Element::PseudoElement&> Element::get_pseudo_element(CSS::Selector::PseudoElement::Type type) const
|
||||
Optional<Element::PseudoElement&> Element::get_pseudo_element(CSS::PseudoElement type) const
|
||||
{
|
||||
if (!m_pseudo_element_data)
|
||||
return {};
|
||||
|
||||
if (!CSS::Selector::PseudoElement::is_known_pseudo_element_type(type)) {
|
||||
if (!CSS::Selector::PseudoElementSelector::is_known_pseudo_element_type(type)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return m_pseudo_element_data->at(to_underlying(type));
|
||||
}
|
||||
|
||||
Element::PseudoElement& Element::ensure_pseudo_element(CSS::Selector::PseudoElement::Type type) const
|
||||
Element::PseudoElement& Element::ensure_pseudo_element(CSS::PseudoElement type) const
|
||||
{
|
||||
if (!m_pseudo_element_data)
|
||||
m_pseudo_element_data = make<PseudoElementData>();
|
||||
|
||||
VERIFY(CSS::Selector::PseudoElement::is_known_pseudo_element_type(type));
|
||||
VERIFY(CSS::Selector::PseudoElementSelector::is_known_pseudo_element_type(type));
|
||||
|
||||
return m_pseudo_element_data->at(to_underlying(type));
|
||||
}
|
||||
|
||||
void Element::set_custom_properties(Optional<CSS::Selector::PseudoElement::Type> pseudo_element, HashMap<FlyString, CSS::StyleProperty> custom_properties)
|
||||
void Element::set_custom_properties(Optional<CSS::PseudoElement> pseudo_element, HashMap<FlyString, CSS::StyleProperty> custom_properties)
|
||||
{
|
||||
if (!pseudo_element.has_value()) {
|
||||
m_custom_properties = move(custom_properties);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CSS::Selector::PseudoElement::is_known_pseudo_element_type(pseudo_element.value())) {
|
||||
if (!CSS::Selector::PseudoElementSelector::is_known_pseudo_element_type(pseudo_element.value())) {
|
||||
return;
|
||||
}
|
||||
|
||||
ensure_pseudo_element(pseudo_element.value()).custom_properties = move(custom_properties);
|
||||
}
|
||||
|
||||
HashMap<FlyString, CSS::StyleProperty> const& Element::custom_properties(Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
|
||||
HashMap<FlyString, CSS::StyleProperty> const& Element::custom_properties(Optional<CSS::PseudoElement> pseudo_element) const
|
||||
{
|
||||
if (!pseudo_element.has_value())
|
||||
return m_custom_properties;
|
||||
|
||||
VERIFY(CSS::Selector::PseudoElement::is_known_pseudo_element_type(pseudo_element.value()));
|
||||
VERIFY(CSS::Selector::PseudoElementSelector::is_known_pseudo_element_type(pseudo_element.value()));
|
||||
|
||||
return ensure_pseudo_element(pseudo_element.value()).custom_properties;
|
||||
}
|
||||
|
|
|
@ -192,8 +192,8 @@ public:
|
|||
CSS::RequiredInvalidationAfterStyleChange recompute_style();
|
||||
CSS::RequiredInvalidationAfterStyleChange recompute_inherited_style();
|
||||
|
||||
Optional<CSS::Selector::PseudoElement::Type> use_pseudo_element() const { return m_use_pseudo_element; }
|
||||
void set_use_pseudo_element(Optional<CSS::Selector::PseudoElement::Type> use_pseudo_element) { m_use_pseudo_element = move(use_pseudo_element); }
|
||||
Optional<CSS::PseudoElement> use_pseudo_element() const { return m_use_pseudo_element; }
|
||||
void set_use_pseudo_element(Optional<CSS::PseudoElement> use_pseudo_element) { m_use_pseudo_element = move(use_pseudo_element); }
|
||||
|
||||
GC::Ptr<Layout::NodeWithStyle> layout_node();
|
||||
GC::Ptr<Layout::NodeWithStyle const> layout_node() const;
|
||||
|
@ -201,13 +201,13 @@ public:
|
|||
GC::Ptr<CSS::ComputedProperties> computed_properties() { return m_computed_properties; }
|
||||
GC::Ptr<CSS::ComputedProperties const> computed_properties() const { return m_computed_properties; }
|
||||
void set_computed_properties(GC::Ptr<CSS::ComputedProperties>);
|
||||
GC::Ref<CSS::ComputedProperties> resolved_css_values(Optional<CSS::Selector::PseudoElement::Type> = {});
|
||||
GC::Ref<CSS::ComputedProperties> resolved_css_values(Optional<CSS::PseudoElement> = {});
|
||||
|
||||
[[nodiscard]] GC::Ptr<CSS::CascadedProperties> cascaded_properties(Optional<CSS::Selector::PseudoElement::Type>) const;
|
||||
void set_cascaded_properties(Optional<CSS::Selector::PseudoElement::Type>, GC::Ptr<CSS::CascadedProperties>);
|
||||
[[nodiscard]] GC::Ptr<CSS::CascadedProperties> cascaded_properties(Optional<CSS::PseudoElement>) const;
|
||||
void set_cascaded_properties(Optional<CSS::PseudoElement>, GC::Ptr<CSS::CascadedProperties>);
|
||||
|
||||
void set_pseudo_element_computed_properties(CSS::Selector::PseudoElement::Type, GC::Ptr<CSS::ComputedProperties>);
|
||||
GC::Ptr<CSS::ComputedProperties> pseudo_element_computed_properties(CSS::Selector::PseudoElement::Type);
|
||||
void set_pseudo_element_computed_properties(CSS::PseudoElement, GC::Ptr<CSS::ComputedProperties>);
|
||||
GC::Ptr<CSS::ComputedProperties> pseudo_element_computed_properties(CSS::PseudoElement);
|
||||
|
||||
void reset_animated_css_properties();
|
||||
|
||||
|
@ -242,8 +242,8 @@ public:
|
|||
GC::Ptr<ShadowRoot const> shadow_root() const { return m_shadow_root; }
|
||||
void set_shadow_root(GC::Ptr<ShadowRoot>);
|
||||
|
||||
void set_custom_properties(Optional<CSS::Selector::PseudoElement::Type>, HashMap<FlyString, CSS::StyleProperty> custom_properties);
|
||||
[[nodiscard]] HashMap<FlyString, CSS::StyleProperty> const& custom_properties(Optional<CSS::Selector::PseudoElement::Type>) const;
|
||||
void set_custom_properties(Optional<CSS::PseudoElement>, HashMap<FlyString, CSS::StyleProperty> custom_properties);
|
||||
[[nodiscard]] HashMap<FlyString, CSS::StyleProperty> const& custom_properties(Optional<CSS::PseudoElement>) const;
|
||||
|
||||
bool style_uses_css_custom_properties() const { return m_style_uses_css_custom_properties; }
|
||||
void set_style_uses_css_custom_properties(bool value) { m_style_uses_css_custom_properties = value; }
|
||||
|
@ -268,9 +268,9 @@ public:
|
|||
bool affected_by_hover() const;
|
||||
bool includes_properties_from_invalidation_set(CSS::InvalidationSet const&) const;
|
||||
|
||||
void set_pseudo_element_node(Badge<Layout::TreeBuilder>, CSS::Selector::PseudoElement::Type, GC::Ptr<Layout::NodeWithStyle>);
|
||||
GC::Ptr<Layout::NodeWithStyle> get_pseudo_element_node(CSS::Selector::PseudoElement::Type) const;
|
||||
bool has_pseudo_element(CSS::Selector::PseudoElement::Type) const;
|
||||
void set_pseudo_element_node(Badge<Layout::TreeBuilder>, CSS::PseudoElement, GC::Ptr<Layout::NodeWithStyle>);
|
||||
GC::Ptr<Layout::NodeWithStyle> get_pseudo_element_node(CSS::PseudoElement) const;
|
||||
bool has_pseudo_element(CSS::PseudoElement) const;
|
||||
bool has_pseudo_elements() const;
|
||||
void clear_pseudo_element_nodes(Badge<Layout::TreeBuilder>);
|
||||
void serialize_pseudo_elements_as_json(JsonArraySerializer<StringBuilder>& children_array) const;
|
||||
|
@ -513,14 +513,14 @@ private:
|
|||
GC::Ptr<CSS::ComputedProperties> computed_properties;
|
||||
HashMap<FlyString, CSS::StyleProperty> custom_properties;
|
||||
};
|
||||
// TODO: CSS::Selector::PseudoElement::Type includes a lot of pseudo-elements that exist in shadow trees,
|
||||
// TODO: CSS::Selector::PseudoElement includes a lot of pseudo-elements that exist in shadow trees,
|
||||
// and so we don't want to include data for them here.
|
||||
using PseudoElementData = Array<PseudoElement, to_underlying(CSS::Selector::PseudoElement::Type::KnownPseudoElementCount)>;
|
||||
using PseudoElementData = Array<PseudoElement, to_underlying(CSS::PseudoElement::KnownPseudoElementCount)>;
|
||||
mutable OwnPtr<PseudoElementData> m_pseudo_element_data;
|
||||
Optional<PseudoElement&> get_pseudo_element(CSS::Selector::PseudoElement::Type) const;
|
||||
PseudoElement& ensure_pseudo_element(CSS::Selector::PseudoElement::Type) const;
|
||||
Optional<PseudoElement&> get_pseudo_element(CSS::PseudoElement) const;
|
||||
PseudoElement& ensure_pseudo_element(CSS::PseudoElement) const;
|
||||
|
||||
Optional<CSS::Selector::PseudoElement::Type> m_use_pseudo_element;
|
||||
Optional<CSS::PseudoElement> m_use_pseudo_element;
|
||||
|
||||
Vector<FlyString> m_classes;
|
||||
Optional<Dir> m_dir;
|
||||
|
@ -600,11 +600,11 @@ inline bool Element::has_class(FlyString const& class_name, CaseSensitivity case
|
|||
});
|
||||
}
|
||||
|
||||
inline bool Element::has_pseudo_element(CSS::Selector::PseudoElement::Type type) const
|
||||
inline bool Element::has_pseudo_element(CSS::PseudoElement type) const
|
||||
{
|
||||
if (!m_pseudo_element_data)
|
||||
return false;
|
||||
if (!CSS::Selector::PseudoElement::is_known_pseudo_element_type(type))
|
||||
if (!CSS::Selector::PseudoElementSelector::is_known_pseudo_element_type(type))
|
||||
return false;
|
||||
return m_pseudo_element_data->at(to_underlying(type)).layout_node;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Web::DOM {
|
|||
|
||||
class ElementReference {
|
||||
public:
|
||||
ElementReference(GC::Ref<Element> element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element = {})
|
||||
ElementReference(GC::Ref<Element> element, Optional<CSS::PseudoElement> pseudo_element = {})
|
||||
: m_element(element)
|
||||
, m_pseudo_element(move(pseudo_element))
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ public:
|
|||
|
||||
Element& element() { return m_element; }
|
||||
Element const& element() const { return m_element; }
|
||||
Optional<CSS::Selector::PseudoElement::Type> pseudo_element() const { return m_pseudo_element; }
|
||||
Optional<CSS::PseudoElement> pseudo_element() const { return m_pseudo_element; }
|
||||
|
||||
void visit(GC::Cell::Visitor& visitor) const
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
private:
|
||||
GC::Ref<Element> m_element;
|
||||
Optional<CSS::Selector::PseudoElement::Type> m_pseudo_element;
|
||||
Optional<CSS::PseudoElement> m_pseudo_element;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -2750,7 +2750,7 @@ ErrorOr<String> Node::name_or_description(NameOrDescription target, Document con
|
|||
// b. For ::after pseudo elements, User agents MUST append CSS textual content, without a space, to the textual
|
||||
// content of the current node. NOTE: The code for handling the ::after pseudo elements case is further below,
|
||||
// following the “iii. For each child node of the current node” code.
|
||||
if (auto before = element->get_pseudo_element_node(CSS::Selector::PseudoElement::Type::Before)) {
|
||||
if (auto before = element->get_pseudo_element_node(CSS::PseudoElement::Before)) {
|
||||
if (before->computed_values().content().alt_text.has_value())
|
||||
total_accumulated_text.append(before->computed_values().content().alt_text.release_value());
|
||||
else
|
||||
|
@ -2806,7 +2806,7 @@ ErrorOr<String> Node::name_or_description(NameOrDescription target, Document con
|
|||
}
|
||||
|
||||
// NOTE: See step ii.b above.
|
||||
if (auto after = element->get_pseudo_element_node(CSS::Selector::PseudoElement::Type::After)) {
|
||||
if (auto after = element->get_pseudo_element_node(CSS::PseudoElement::After)) {
|
||||
if (after->computed_values().content().alt_text.has_value())
|
||||
total_accumulated_text.append(after->computed_values().content().alt_text.release_value());
|
||||
else
|
||||
|
@ -2960,8 +2960,8 @@ void Node::play_or_cancel_animations_after_display_property_change()
|
|||
auto const& element = static_cast<Element const&>(node);
|
||||
if (auto animation = element.cached_animation_name_animation({}))
|
||||
play_or_cancel_depending_on_display(*animation);
|
||||
for (auto i = 0; i < to_underlying(CSS::Selector::PseudoElement::Type::KnownPseudoElementCount); i++) {
|
||||
auto pseudo_element = static_cast<CSS::Selector::PseudoElement::Type>(i);
|
||||
for (auto i = 0; i < to_underlying(CSS::PseudoElement::KnownPseudoElementCount); i++) {
|
||||
auto pseudo_element = static_cast<CSS::PseudoElement>(i);
|
||||
if (auto animation = element.cached_animation_name_animation(pseudo_element))
|
||||
play_or_cancel_depending_on_display(*animation);
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ void dump_tree(StringBuilder& builder, DOM::Node const& node)
|
|||
if (element.use_pseudo_element().has_value()) {
|
||||
for (int i = 0; i < indent; ++i)
|
||||
builder.append(" "sv);
|
||||
builder.appendff(" (pseudo-element: {})\n", CSS::Selector::PseudoElement::name(element.use_pseudo_element().value()));
|
||||
builder.appendff(" (pseudo-element: {})\n", CSS::Selector::PseudoElementSelector::name(element.use_pseudo_element().value()));
|
||||
}
|
||||
} else if (is<DOM::Text>(node)) {
|
||||
builder.appendff("\"{}\"\n", as<DOM::Text>(node).data());
|
||||
|
|
|
@ -243,7 +243,7 @@ WebIDL::ExceptionOr<void> HTMLDetailsElement::create_shadow_tree_if_needed()
|
|||
|
||||
// The second child element is a slot that is expected to take the details element's remaining descendants, if any.
|
||||
auto descendants_slot = TRY(DOM::create_element(document(), HTML::TagNames::slot, Namespace::HTML));
|
||||
descendants_slot->set_use_pseudo_element(CSS::Selector::PseudoElement::Type::DetailsContent);
|
||||
descendants_slot->set_use_pseudo_element(CSS::PseudoElement::DetailsContent);
|
||||
MUST(shadow_root->append_child(descendants_slot));
|
||||
|
||||
// The third child element is either a link or style element with the following styles for the default summary:
|
||||
|
|
|
@ -1000,7 +1000,7 @@ void HTMLInputElement::create_text_input_shadow_tree()
|
|||
MUST(shadow_root->append_child(element));
|
||||
|
||||
m_placeholder_element = MUST(DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML));
|
||||
m_placeholder_element->set_use_pseudo_element(CSS::Selector::PseudoElement::Type::Placeholder);
|
||||
m_placeholder_element->set_use_pseudo_element(CSS::PseudoElement::Placeholder);
|
||||
|
||||
// https://www.w3.org/TR/css-ui-4/#input-rules
|
||||
MUST(m_placeholder_element->set_attribute(HTML::AttributeNames::style, R"~~~(
|
||||
|
@ -1137,7 +1137,7 @@ void HTMLInputElement::create_file_input_shadow_tree()
|
|||
auto shadow_root = realm.create<DOM::ShadowRoot>(document(), *this, Bindings::ShadowRootMode::Closed);
|
||||
|
||||
m_file_button = DOM::create_element(document(), HTML::TagNames::button, Namespace::HTML).release_value_but_fixme_should_propagate_errors();
|
||||
m_file_button->set_use_pseudo_element(CSS::Selector::PseudoElement::Type::FileSelectorButton);
|
||||
m_file_button->set_use_pseudo_element(CSS::PseudoElement::FileSelectorButton);
|
||||
|
||||
m_file_label = DOM::create_element(document(), HTML::TagNames::label, Namespace::HTML).release_value_but_fixme_should_propagate_errors();
|
||||
MUST(m_file_label->set_attribute(HTML::AttributeNames::style, "padding-left: 4px;"_string));
|
||||
|
@ -1183,15 +1183,15 @@ void HTMLInputElement::create_range_input_shadow_tree()
|
|||
set_shadow_root(shadow_root);
|
||||
|
||||
m_slider_runnable_track = MUST(DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML));
|
||||
m_slider_runnable_track->set_use_pseudo_element(CSS::Selector::PseudoElement::Type::Track);
|
||||
m_slider_runnable_track->set_use_pseudo_element(CSS::PseudoElement::Track);
|
||||
MUST(shadow_root->append_child(*m_slider_runnable_track));
|
||||
|
||||
m_slider_progress_element = MUST(DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML));
|
||||
m_slider_progress_element->set_use_pseudo_element(CSS::Selector::PseudoElement::Type::Fill);
|
||||
m_slider_progress_element->set_use_pseudo_element(CSS::PseudoElement::Fill);
|
||||
MUST(m_slider_runnable_track->append_child(*m_slider_progress_element));
|
||||
|
||||
m_slider_thumb = MUST(DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML));
|
||||
m_slider_thumb->set_use_pseudo_element(CSS::Selector::PseudoElement::Type::Thumb);
|
||||
m_slider_thumb->set_use_pseudo_element(CSS::PseudoElement::Thumb);
|
||||
MUST(m_slider_runnable_track->append_child(*m_slider_thumb));
|
||||
|
||||
update_slider_shadow_tree_elements();
|
||||
|
|
|
@ -197,11 +197,11 @@ void HTMLMeterElement::create_shadow_tree_if_needed()
|
|||
set_shadow_root(shadow_root);
|
||||
|
||||
auto meter_bar_element = MUST(DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML));
|
||||
meter_bar_element->set_use_pseudo_element(CSS::Selector::PseudoElement::Type::Track);
|
||||
meter_bar_element->set_use_pseudo_element(CSS::PseudoElement::Track);
|
||||
MUST(shadow_root->append_child(*meter_bar_element));
|
||||
|
||||
m_meter_value_element = MUST(DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML));
|
||||
m_meter_value_element->set_use_pseudo_element(CSS::Selector::PseudoElement::Type::Fill);
|
||||
m_meter_value_element->set_use_pseudo_element(CSS::PseudoElement::Fill);
|
||||
MUST(meter_bar_element->append_child(*m_meter_value_element));
|
||||
update_meter_value_element();
|
||||
}
|
||||
|
|
|
@ -118,11 +118,11 @@ void HTMLProgressElement::create_shadow_tree_if_needed()
|
|||
set_shadow_root(shadow_root);
|
||||
|
||||
auto progress_bar_element = MUST(DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML));
|
||||
progress_bar_element->set_use_pseudo_element(CSS::Selector::PseudoElement::Type::Track);
|
||||
progress_bar_element->set_use_pseudo_element(CSS::PseudoElement::Track);
|
||||
MUST(shadow_root->append_child(*progress_bar_element));
|
||||
|
||||
m_progress_value_element = MUST(DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML));
|
||||
m_progress_value_element->set_use_pseudo_element(CSS::Selector::PseudoElement::Type::Fill);
|
||||
m_progress_value_element->set_use_pseudo_element(CSS::PseudoElement::Fill);
|
||||
MUST(progress_bar_element->append_child(*m_progress_value_element));
|
||||
update_progress_value_element();
|
||||
}
|
||||
|
|
|
@ -372,7 +372,7 @@ void HTMLTextAreaElement::create_shadow_tree_if_needed()
|
|||
MUST(shadow_root->append_child(element));
|
||||
|
||||
m_placeholder_element = MUST(DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML));
|
||||
m_placeholder_element->set_use_pseudo_element(CSS::Selector::PseudoElement::Type::Placeholder);
|
||||
m_placeholder_element->set_use_pseudo_element(CSS::PseudoElement::Placeholder);
|
||||
MUST(element->append_child(*m_placeholder_element));
|
||||
|
||||
m_placeholder_text_node = realm().create<DOM::Text>(document(), String {});
|
||||
|
|
|
@ -186,7 +186,7 @@ void TreeBuilder::insert_node_into_inline_or_block_ancestor(Layout::Node& node,
|
|||
}
|
||||
}
|
||||
|
||||
void TreeBuilder::create_pseudo_element_if_needed(DOM::Element& element, CSS::Selector::PseudoElement::Type pseudo_element, AppendOrPrepend mode)
|
||||
void TreeBuilder::create_pseudo_element_if_needed(DOM::Element& element, CSS::PseudoElement pseudo_element, AppendOrPrepend mode)
|
||||
{
|
||||
auto& document = element.document();
|
||||
|
||||
|
@ -213,7 +213,7 @@ void TreeBuilder::create_pseudo_element_if_needed(DOM::Element& element, CSS::Se
|
|||
|
||||
// FIXME: This code actually computes style for element::marker, and shouldn't for element::pseudo::marker
|
||||
if (is<ListItemBox>(*pseudo_element_node)) {
|
||||
auto marker_style = style_computer.compute_style(element, CSS::Selector::PseudoElement::Type::Marker);
|
||||
auto marker_style = style_computer.compute_style(element, CSS::PseudoElement::Marker);
|
||||
auto list_item_marker = document.heap().allocate<ListItemMarkerBox>(
|
||||
document,
|
||||
pseudo_element_node->computed_values().list_style_type(),
|
||||
|
@ -221,14 +221,14 @@ void TreeBuilder::create_pseudo_element_if_needed(DOM::Element& element, CSS::Se
|
|||
element,
|
||||
marker_style);
|
||||
static_cast<ListItemBox&>(*pseudo_element_node).set_marker(list_item_marker);
|
||||
element.set_pseudo_element_node({}, CSS::Selector::PseudoElement::Type::Marker, list_item_marker);
|
||||
element.set_pseudo_element_node({}, CSS::PseudoElement::Marker, list_item_marker);
|
||||
pseudo_element_node->append_child(*list_item_marker);
|
||||
}
|
||||
|
||||
auto generated_for = Node::GeneratedFor::NotGenerated;
|
||||
if (pseudo_element == CSS::Selector::PseudoElement::Type::Before) {
|
||||
if (pseudo_element == CSS::PseudoElement::Before) {
|
||||
generated_for = Node::GeneratedFor::PseudoBefore;
|
||||
} else if (pseudo_element == CSS::Selector::PseudoElement::Type::After) {
|
||||
} else if (pseudo_element == CSS::PseudoElement::After) {
|
||||
generated_for = Node::GeneratedFor::PseudoAfter;
|
||||
} else {
|
||||
VERIFY_NOT_REACHED();
|
||||
|
@ -694,7 +694,7 @@ void TreeBuilder::update_layout_tree_before_children(DOM::Node& dom_node, GC::Re
|
|||
if (is<DOM::Element>(dom_node) && layout_node->can_have_children() && !element_has_content_visibility_hidden) {
|
||||
auto& element = static_cast<DOM::Element&>(dom_node);
|
||||
push_parent(as<NodeWithStyle>(*layout_node));
|
||||
create_pseudo_element_if_needed(element, CSS::Selector::PseudoElement::Type::Before, AppendOrPrepend::Prepend);
|
||||
create_pseudo_element_if_needed(element, CSS::PseudoElement::Before, AppendOrPrepend::Prepend);
|
||||
pop_parent();
|
||||
}
|
||||
}
|
||||
|
@ -706,10 +706,10 @@ void TreeBuilder::update_layout_tree_after_children(DOM::Node& dom_node, GC::Ref
|
|||
|
||||
if (is<ListItemBox>(*layout_node)) {
|
||||
auto& element = static_cast<DOM::Element&>(dom_node);
|
||||
auto marker_style = style_computer.compute_style(element, CSS::Selector::PseudoElement::Type::Marker);
|
||||
auto marker_style = style_computer.compute_style(element, CSS::PseudoElement::Marker);
|
||||
auto list_item_marker = document.heap().allocate<ListItemMarkerBox>(document, layout_node->computed_values().list_style_type(), layout_node->computed_values().list_style_position(), element, marker_style);
|
||||
static_cast<ListItemBox&>(*layout_node).set_marker(list_item_marker);
|
||||
element.set_pseudo_element_node({}, CSS::Selector::PseudoElement::Type::Marker, list_item_marker);
|
||||
element.set_pseudo_element_node({}, CSS::PseudoElement::Marker, list_item_marker);
|
||||
layout_node->append_child(*list_item_marker);
|
||||
}
|
||||
|
||||
|
@ -735,7 +735,7 @@ void TreeBuilder::update_layout_tree_after_children(DOM::Node& dom_node, GC::Ref
|
|||
if (is<DOM::Element>(dom_node) && layout_node->can_have_children() && !element_has_content_visibility_hidden) {
|
||||
auto& element = static_cast<DOM::Element&>(dom_node);
|
||||
push_parent(as<NodeWithStyle>(*layout_node));
|
||||
create_pseudo_element_if_needed(element, CSS::Selector::PseudoElement::Type::After, AppendOrPrepend::Append);
|
||||
create_pseudo_element_if_needed(element, CSS::PseudoElement::After, AppendOrPrepend::Append);
|
||||
pop_parent();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ private:
|
|||
Prepend,
|
||||
};
|
||||
void insert_node_into_inline_or_block_ancestor(Layout::Node&, CSS::Display, AppendOrPrepend);
|
||||
void create_pseudo_element_if_needed(DOM::Element&, CSS::Selector::PseudoElement::Type, AppendOrPrepend);
|
||||
void create_pseudo_element_if_needed(DOM::Element&, CSS::PseudoElement, AppendOrPrepend);
|
||||
void restructure_block_node_in_inline_parent(NodeWithStyleAndBoxModelMetrics&);
|
||||
|
||||
GC::Ptr<Layout::Node> m_layout_root;
|
||||
|
|
|
@ -469,7 +469,7 @@ void Application::stop_listening_for_dom_properties(DevTools::TabDescription con
|
|||
view->on_received_dom_node_properties = nullptr;
|
||||
}
|
||||
|
||||
void Application::inspect_dom_node(DevTools::TabDescription const& description, DOMNodeProperties::Type property_type, Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element) const
|
||||
void Application::inspect_dom_node(DevTools::TabDescription const& description, DOMNodeProperties::Type property_type, Web::UniqueNodeID node_id, Optional<Web::CSS::PseudoElement> pseudo_element) const
|
||||
{
|
||||
auto view = ViewImplementation::find_view_by_id(description.id);
|
||||
if (!view.has_value())
|
||||
|
@ -484,7 +484,7 @@ void Application::clear_inspected_dom_node(DevTools::TabDescription const& descr
|
|||
view->clear_inspected_dom_node();
|
||||
}
|
||||
|
||||
void Application::highlight_dom_node(DevTools::TabDescription const& description, Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element) const
|
||||
void Application::highlight_dom_node(DevTools::TabDescription const& description, Web::UniqueNodeID node_id, Optional<Web::CSS::PseudoElement> pseudo_element) const
|
||||
{
|
||||
if (auto view = ViewImplementation::find_view_by_id(description.id); view.has_value())
|
||||
view->highlight_dom_node(node_id, pseudo_element);
|
||||
|
|
|
@ -99,9 +99,9 @@ private:
|
|||
virtual void inspect_tab(DevTools::TabDescription const&, OnTabInspectionComplete) const override;
|
||||
virtual void listen_for_dom_properties(DevTools::TabDescription const&, OnDOMNodePropertiesReceived) const override;
|
||||
virtual void stop_listening_for_dom_properties(DevTools::TabDescription const&) const override;
|
||||
virtual void inspect_dom_node(DevTools::TabDescription const&, DOMNodeProperties::Type, Web::UniqueNodeID, Optional<Web::CSS::Selector::PseudoElement::Type>) const override;
|
||||
virtual void inspect_dom_node(DevTools::TabDescription const&, DOMNodeProperties::Type, Web::UniqueNodeID, Optional<Web::CSS::PseudoElement>) const override;
|
||||
virtual void clear_inspected_dom_node(DevTools::TabDescription const&) const override;
|
||||
virtual void highlight_dom_node(DevTools::TabDescription const&, Web::UniqueNodeID, Optional<Web::CSS::Selector::PseudoElement::Type>) const override;
|
||||
virtual void highlight_dom_node(DevTools::TabDescription const&, Web::UniqueNodeID, Optional<Web::CSS::PseudoElement>) const override;
|
||||
virtual void clear_highlighted_dom_node(DevTools::TabDescription const&) const override;
|
||||
virtual void listen_for_dom_mutations(DevTools::TabDescription const&, OnDOMMutationReceived) const override;
|
||||
virtual void stop_listening_for_dom_mutations(DevTools::TabDescription const&) const override;
|
||||
|
|
|
@ -329,7 +329,7 @@ void ViewImplementation::get_hovered_node_id()
|
|||
client().async_get_hovered_node_id(page_id());
|
||||
}
|
||||
|
||||
void ViewImplementation::inspect_dom_node(Web::UniqueNodeID node_id, DOMNodeProperties::Type property_type, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element)
|
||||
void ViewImplementation::inspect_dom_node(Web::UniqueNodeID node_id, DOMNodeProperties::Type property_type, Optional<Web::CSS::PseudoElement> pseudo_element)
|
||||
{
|
||||
client().async_inspect_dom_node(page_id(), property_type, node_id, pseudo_element);
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ void ViewImplementation::clear_inspected_dom_node()
|
|||
client().async_clear_inspected_dom_node(page_id());
|
||||
}
|
||||
|
||||
void ViewImplementation::highlight_dom_node(Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element)
|
||||
void ViewImplementation::highlight_dom_node(Web::UniqueNodeID node_id, Optional<Web::CSS::PseudoElement> pseudo_element)
|
||||
{
|
||||
client().async_highlight_dom_node(page_id(), node_id, pseudo_element);
|
||||
}
|
||||
|
|
|
@ -99,10 +99,10 @@ public:
|
|||
void inspect_accessibility_tree();
|
||||
void get_hovered_node_id();
|
||||
|
||||
void inspect_dom_node(Web::UniqueNodeID node_id, DOMNodeProperties::Type, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element);
|
||||
void inspect_dom_node(Web::UniqueNodeID node_id, DOMNodeProperties::Type, Optional<Web::CSS::PseudoElement> pseudo_element);
|
||||
void clear_inspected_dom_node();
|
||||
|
||||
void highlight_dom_node(Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element);
|
||||
void highlight_dom_node(Web::UniqueNodeID node_id, Optional<Web::CSS::PseudoElement> pseudo_element);
|
||||
void clear_highlighted_dom_node();
|
||||
|
||||
void set_listen_for_dom_mutations(bool);
|
||||
|
|
|
@ -438,7 +438,7 @@ void ConnectionFromClient::inspect_dom_tree(u64 page_id)
|
|||
}
|
||||
}
|
||||
|
||||
void ConnectionFromClient::inspect_dom_node(u64 page_id, WebView::DOMNodeProperties::Type property_type, Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element)
|
||||
void ConnectionFromClient::inspect_dom_node(u64 page_id, WebView::DOMNodeProperties::Type property_type, Web::UniqueNodeID node_id, Optional<Web::CSS::PseudoElement> pseudo_element)
|
||||
{
|
||||
auto page = this->page(page_id);
|
||||
if (!page.has_value())
|
||||
|
@ -565,7 +565,7 @@ void ConnectionFromClient::clear_inspected_dom_node(u64 page_id)
|
|||
}
|
||||
}
|
||||
|
||||
void ConnectionFromClient::highlight_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element)
|
||||
void ConnectionFromClient::highlight_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional<Web::CSS::PseudoElement> pseudo_element)
|
||||
{
|
||||
auto page = this->page(page_id);
|
||||
if (!page.has_value())
|
||||
|
|
|
@ -76,9 +76,9 @@ private:
|
|||
virtual void debug_request(u64 page_id, ByteString, ByteString) override;
|
||||
virtual void get_source(u64 page_id) override;
|
||||
virtual void inspect_dom_tree(u64 page_id) override;
|
||||
virtual void inspect_dom_node(u64 page_id, WebView::DOMNodeProperties::Type, Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element) override;
|
||||
virtual void inspect_dom_node(u64 page_id, WebView::DOMNodeProperties::Type, Web::UniqueNodeID node_id, Optional<Web::CSS::PseudoElement> pseudo_element) override;
|
||||
virtual void clear_inspected_dom_node(u64 page_id) override;
|
||||
virtual void highlight_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element) override;
|
||||
virtual void highlight_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional<Web::CSS::PseudoElement> pseudo_element) override;
|
||||
virtual void inspect_accessibility_tree(u64 page_id) override;
|
||||
virtual void get_hovered_node_id(u64 page_id) override;
|
||||
|
||||
|
|
|
@ -45,9 +45,9 @@ endpoint WebContentServer
|
|||
debug_request(u64 page_id, ByteString request, ByteString argument) =|
|
||||
get_source(u64 page_id) =|
|
||||
inspect_dom_tree(u64 page_id) =|
|
||||
inspect_dom_node(u64 page_id, WebView::DOMNodeProperties::Type property_type, Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element) =|
|
||||
inspect_dom_node(u64 page_id, WebView::DOMNodeProperties::Type property_type, Web::UniqueNodeID node_id, Optional<Web::CSS::PseudoElement> pseudo_element) =|
|
||||
clear_inspected_dom_node(u64 page_id) =|
|
||||
highlight_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element) =|
|
||||
highlight_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional<Web::CSS::PseudoElement> pseudo_element) =|
|
||||
inspect_accessibility_tree(u64 page_id) =|
|
||||
get_hovered_node_id(u64 page_id) =|
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue