LibWeb: Absolutize StyleValueList in StyleComputer::absolutize_values

This commit is contained in:
Callum Law 2025-08-04 20:13:18 +12:00 committed by Sam Atkins
commit ba4a57b34d
Notes: github-actions[bot] 2025-08-06 16:46:14 +00:00
4 changed files with 36 additions and 23 deletions

View file

@ -17,6 +17,17 @@ bool StyleValueList::Properties::operator==(Properties const& other) const
return separator == other.separator && values.span() == other.values.span();
}
ValueComparingNonnullRefPtr<CSSStyleValue const> StyleValueList::absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const
{
StyleValueVector absolutized_style_values;
absolutized_style_values.ensure_capacity(m_properties.values.size());
for (auto const& value : m_properties.values)
absolutized_style_values.append(value->absolutized(viewport_rect, font_metrics, root_font_metrics));
return StyleValueList::create(move(absolutized_style_values), m_properties.separator);
}
String StyleValueList::to_string(SerializationMode mode) const
{
if (m_properties.values.is_empty())

View file

@ -36,6 +36,8 @@ public:
virtual String to_string(SerializationMode) const override;
virtual Vector<Parser::ComponentValue> tokenize() const override;
virtual ValueComparingNonnullRefPtr<CSSStyleValue const> absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const override;
bool properties_equal(StyleValueList const& other) const { return m_properties == other.m_properties; }
Separator separator() const { return m_properties.separator; }

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 402 tests
274 Pass
128 Fail
290 Pass
112 Fail
Pass CSS Transitions: property <box-shadow> from neutral to [20px 20px 20px 20px black] at (-0.3) should be [rgb(0, 0, 0) 7px 33px 7px 33px]
Pass CSS Transitions: property <box-shadow> from neutral to [20px 20px 20px 20px black] at (0) should be [rgb(0, 0, 0) 10px 30px 10px 30px]
Pass CSS Transitions: property <box-shadow> from neutral to [20px 20px 20px 20px black] at (0.3) should be [rgb(0, 0, 0) 13px 27px 13px 27px]
@ -244,30 +244,30 @@ Pass Web Animations: property <box-shadow> from [10px 10px 10px 10px black] to [
Pass Web Animations: property <box-shadow> from [10px 10px 10px 10px black] to [10px 10px 10px 10px currentColor] at (0.6) should be [rgb(0, 77, 0) 10px 10px 10px 10px]
Pass Web Animations: property <box-shadow> from [10px 10px 10px 10px black] to [10px 10px 10px 10px currentColor] at (1) should be [rgb(0, 128, 0) 10px 10px 10px 10px]
Pass Web Animations: property <box-shadow> from [10px 10px 10px 10px black] to [10px 10px 10px 10px currentColor] at (1.5) should be [rgb(0, 192, 0) 10px 10px 10px 10px]
Fail CSS Transitions: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (-0.3) should be [rgba(255, 255, 0, 0.65) 13px 26px 0px 0px, rgb(0, 166, 0) 6.5px 39px 0px 0px inset]
Fail CSS Transitions: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (0) should be [rgba(255, 255, 0, 0.5) 10px 20px 0px 0px, rgb(0, 128, 0) 5px 30px 0px 0px inset]
Pass CSS Transitions: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (-0.3) should be [rgba(255, 255, 0, 0.65) 13px 26px 0px 0px, rgb(0, 166, 0) 6.5px 39px 0px 0px inset]
Pass CSS Transitions: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (0) should be [rgba(255, 255, 0, 0.5) 10px 20px 0px 0px, rgb(0, 128, 0) 5px 30px 0px 0px inset]
Fail CSS Transitions: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (0.3) should be [rgba(255, 255, 0, 0.353) 7px 14px 0px 0px, rgba(0, 128, 0, 0.7) 3.5px 21px 0px 0px inset]
Fail CSS Transitions: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (0.6) should be [rgba(255, 255, 0, 0.2) 4px 8px 0px 0px, rgba(0, 128, 0, 0.4) 2px 12px 0px 0px inset]
Fail CSS Transitions: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (1) should be [rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px inset]
Fail CSS Transitions: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (1.5) should be [rgba(0, 0, 0, 0) -5px -10px 0px 0px, rgba(0, 0, 0, 0) -2.5px -15px 0px 0px inset]
Fail CSS Transitions with transition: all: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (-0.3) should be [rgba(255, 255, 0, 0.65) 13px 26px 0px 0px, rgb(0, 166, 0) 6.5px 39px 0px 0px inset]
Fail CSS Transitions with transition: all: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (0) should be [rgba(255, 255, 0, 0.5) 10px 20px 0px 0px, rgb(0, 128, 0) 5px 30px 0px 0px inset]
Pass CSS Transitions: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (1) should be [rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px inset]
Pass CSS Transitions: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (1.5) should be [rgba(0, 0, 0, 0) -5px -10px 0px 0px, rgba(0, 0, 0, 0) -2.5px -15px 0px 0px inset]
Pass CSS Transitions with transition: all: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (-0.3) should be [rgba(255, 255, 0, 0.65) 13px 26px 0px 0px, rgb(0, 166, 0) 6.5px 39px 0px 0px inset]
Pass CSS Transitions with transition: all: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (0) should be [rgba(255, 255, 0, 0.5) 10px 20px 0px 0px, rgb(0, 128, 0) 5px 30px 0px 0px inset]
Fail CSS Transitions with transition: all: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (0.3) should be [rgba(255, 255, 0, 0.353) 7px 14px 0px 0px, rgba(0, 128, 0, 0.7) 3.5px 21px 0px 0px inset]
Fail CSS Transitions with transition: all: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (0.6) should be [rgba(255, 255, 0, 0.2) 4px 8px 0px 0px, rgba(0, 128, 0, 0.4) 2px 12px 0px 0px inset]
Fail CSS Transitions with transition: all: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (1) should be [rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px inset]
Fail CSS Transitions with transition: all: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (1.5) should be [rgba(0, 0, 0, 0) -5px -10px 0px 0px, rgba(0, 0, 0, 0) -2.5px -15px 0px 0px inset]
Fail CSS Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (-0.3) should be [rgba(255, 255, 0, 0.65) 13px 26px 0px 0px, rgb(0, 166, 0) 6.5px 39px 0px 0px inset]
Fail CSS Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (0) should be [rgba(255, 255, 0, 0.5) 10px 20px 0px 0px, rgb(0, 128, 0) 5px 30px 0px 0px inset]
Pass CSS Transitions with transition: all: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (1) should be [rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px inset]
Pass CSS Transitions with transition: all: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (1.5) should be [rgba(0, 0, 0, 0) -5px -10px 0px 0px, rgba(0, 0, 0, 0) -2.5px -15px 0px 0px inset]
Pass CSS Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (-0.3) should be [rgba(255, 255, 0, 0.65) 13px 26px 0px 0px, rgb(0, 166, 0) 6.5px 39px 0px 0px inset]
Pass CSS Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (0) should be [rgba(255, 255, 0, 0.5) 10px 20px 0px 0px, rgb(0, 128, 0) 5px 30px 0px 0px inset]
Fail CSS Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (0.3) should be [rgba(255, 255, 0, 0.353) 7px 14px 0px 0px, rgba(0, 128, 0, 0.7) 3.5px 21px 0px 0px inset]
Fail CSS Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (0.6) should be [rgba(255, 255, 0, 0.2) 4px 8px 0px 0px, rgba(0, 128, 0, 0.4) 2px 12px 0px 0px inset]
Fail CSS Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (1) should be [rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px inset]
Fail CSS Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (1.5) should be [rgba(0, 0, 0, 0) -5px -10px 0px 0px, rgba(0, 0, 0, 0) -2.5px -15px 0px 0px inset]
Fail Web Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (-0.3) should be [rgba(255, 255, 0, 0.65) 13px 26px 0px 0px, rgb(0, 166, 0) 6.5px 39px 0px 0px inset]
Fail Web Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (0) should be [rgba(255, 255, 0, 0.5) 10px 20px 0px 0px, rgb(0, 128, 0) 5px 30px 0px 0px inset]
Pass CSS Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (1) should be [rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px inset]
Pass CSS Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (1.5) should be [rgba(0, 0, 0, 0) -5px -10px 0px 0px, rgba(0, 0, 0, 0) -2.5px -15px 0px 0px inset]
Pass Web Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (-0.3) should be [rgba(255, 255, 0, 0.65) 13px 26px 0px 0px, rgb(0, 166, 0) 6.5px 39px 0px 0px inset]
Pass Web Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (0) should be [rgba(255, 255, 0, 0.5) 10px 20px 0px 0px, rgb(0, 128, 0) 5px 30px 0px 0px inset]
Fail Web Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (0.3) should be [rgba(255, 255, 0, 0.353) 7px 14px 0px 0px, rgba(0, 128, 0, 0.7) 3.5px 21px 0px 0px inset]
Fail Web Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (0.6) should be [rgba(255, 255, 0, 0.2) 4px 8px 0px 0px, rgba(0, 128, 0, 0.4) 2px 12px 0px 0px inset]
Fail Web Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (1) should be [rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px inset]
Fail Web Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (1.5) should be [rgba(0, 0, 0, 0) -5px -10px 0px 0px, rgba(0, 0, 0, 0) -2.5px -15px 0px 0px inset]
Pass Web Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (1) should be [rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px inset]
Pass Web Animations: property <box-shadow> from [10px 20px rgba(255, 255, 0, 0.5), inset 5px 10em #008000] to [none] at (1.5) should be [rgba(0, 0, 0, 0) -5px -10px 0px 0px, rgba(0, 0, 0, 0) -2.5px -15px 0px 0px inset]
Fail CSS Transitions: property <box-shadow> from [inset 0 0 0 0 black] to [inset 0 0 0 calc(max(10em, 20px) / 2) black] at (-0.3) should be [rgb(0, 0, 0) 0px 0px 0px -4.5px inset]
Fail CSS Transitions: property <box-shadow> from [inset 0 0 0 0 black] to [inset 0 0 0 calc(max(10em, 20px) / 2) black] at (0) should be [rgb(0, 0, 0) 0px 0px 0px 0px inset]
Fail CSS Transitions: property <box-shadow> from [inset 0 0 0 0 black] to [inset 0 0 0 calc(max(10em, 20px) / 2) black] at (0.3) should be [rgb(0, 0, 0) 0px 0px 0px 4.5px inset]

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 233 tests
209 Pass
24 Fail
212 Pass
21 Fail
Pass abs(1) should be used-value-equivalent to 1
Pass sign(1) should be used-value-equivalent to 1
Pass abs(-1) should be used-value-equivalent to 1
@ -222,9 +222,9 @@ Pass calc(50px + 100px * sign(38px - 2em)) should be used-value-equivalent to -5
Fail calc(90deg + 30deg * sign(42px - 2em)) should be used-value-equivalent to 120deg
Fail calc(90deg + 30deg * sign(40px - 2em)) should be used-value-equivalent to 90deg
Fail calc(90deg + 30deg * sign(38px - 2em)) should be used-value-equivalent to 60deg
Fail calc(5s + 15s * sign(42px - 2em)) should be used-value-equivalent to 20s
Fail calc(5s + 15s * sign(40px - 2em)) should be used-value-equivalent to 5s
Fail calc(5s + 15s * sign(38px - 2em)) should be used-value-equivalent to -10s
Pass calc(5s + 15s * sign(42px - 2em)) should be used-value-equivalent to 20s
Pass calc(5s + 15s * sign(40px - 2em)) should be used-value-equivalent to 5s
Pass calc(5s + 15s * sign(38px - 2em)) should be used-value-equivalent to -10s
Fail calc(100dpi + 20dpi * sign(42px - 2em)) should be used-value-equivalent to 120dpi
Fail calc(100dpi + 20dpi * sign(40px - 2em)) should be used-value-equivalent to 100dpi
Fail calc(100dpi + 20dpi * sign(38px - 2em)) should be used-value-equivalent to 80dpi