LibWeb/CSS: Add math expression support for transform-origin

(cherry picked from commit 85356094b50878e78d40d79c2a9e96ff9aac5a6b)
This commit is contained in:
Ankush Chatterjee 2024-10-23 22:15:19 +05:30 committed by Nico Weber
parent ff914bc157
commit d5ed665461
3 changed files with 7 additions and 2 deletions

View file

@ -138,8 +138,8 @@ text-indent: 'calc(2%)' -> 'calc(2%)'
text-indent: 'calc(2% * var(--n))' -> '4%'
top: 'calc(2%)' -> 'calc(2%)'
top: 'calc(2% * var(--n))' -> '4%'
transform-origin: 'calc(2px) calc(2%)' -> '50% 50%'
transform-origin: 'calc(2px * var(--n)) calc(2% * var(--n))' -> '50% 50%'
transform-origin: 'calc(2px) calc(2%)' -> 'calc(2px) calc(2%)'
transform-origin: 'calc(2px * var(--n)) calc(2% * var(--n))' -> 'calc(2px * 2) 4%'
transition-delay: 'calc(2s)' -> 'calc(2s)'
transition-delay: 'calc(2s * var(--n))' -> '4s'
transition-duration: 'calc(2s)' -> 'calc(2s)'

View file

@ -6696,6 +6696,9 @@ RefPtr<CSSStyleValue> Parser::parse_transform_origin_value(TokenStream<Component
return OptionalNone {};
}
}
if (value->is_math()) {
return AxisOffset { Axis::None, value->as_math() };
}
return OptionalNone {};
};

View file

@ -553,6 +553,8 @@ static Optional<LengthPercentage> length_percentage_for_style_value(CSSStyleValu
return value.as_length().length();
if (value.is_percentage())
return value.as_percentage().percentage();
if (value.is_math())
return LengthPercentage { const_cast<CSSMathValue&>(value.as_math()) };
return {};
}