mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Produce computed values for custom properties
Custom properties are required to produce a computed value just like regular properties. The computed value is defined in the spec as "specified value with variables substituted, or the guaranteed-invalid value", though in reality all arbitrary substitution functions should be substituted, not just `var()`. To support this, we parse the CSS-wide keywords normally in custom properties, instead of ignoring them. We don't yet handle all of them properly, and because that will require us to cascade them like regular properties. This is just enough to prevent regressions when implementing ASFs. Our output in this new test is not quite correct, because of the awkward way we handle whitespace in property values - so it has 3 spaces in the middle instead of 1, until that's fixed. It's possible this computed-value production should go in cascade_custom_properties(), but I had issues with that. Hopefully once we start cascading custom properties properly, it'll be clearer how this should all work.
This commit is contained in:
parent
1ff1093a24
commit
26acd897bf
Notes:
github-actions[bot]
2025-07-09 15:45:57 +00:00
Author: https://github.com/AtkinsSJ
Commit: 26acd897bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5226
Reviewed-by: https://github.com/tcl3 ✅
9 changed files with 119 additions and 32 deletions
|
@ -134,7 +134,7 @@ public:
|
|||
|
||||
Vector<ComponentValue> parse_as_list_of_component_values();
|
||||
|
||||
static NonnullRefPtr<CSSStyleValue const> resolve_unresolved_style_value(ParsingParams const&, DOM::Element&, Optional<PseudoElement>, PropertyID, UnresolvedStyleValue const&);
|
||||
static NonnullRefPtr<CSSStyleValue const> resolve_unresolved_style_value(ParsingParams const&, DOM::Element&, Optional<PseudoElement>, PropertyIDOrCustomPropertyName, UnresolvedStyleValue const&);
|
||||
|
||||
[[nodiscard]] LengthOrCalculated parse_as_sizes_attribute(DOM::Element const& element, HTML::HTMLImageElement const* img = nullptr);
|
||||
|
||||
|
@ -507,7 +507,7 @@ private:
|
|||
|
||||
OwnPtr<BooleanExpression> parse_supports_feature(TokenStream<ComponentValue>&);
|
||||
|
||||
NonnullRefPtr<CSSStyleValue const> resolve_unresolved_style_value(DOM::Element&, Optional<PseudoElement>, PropertyID, UnresolvedStyleValue const&);
|
||||
NonnullRefPtr<CSSStyleValue const> resolve_unresolved_style_value(DOM::Element&, Optional<PseudoElement>, PropertyIDOrCustomPropertyName, 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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue