mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
LibWeb: Make transform: scale(calc(..))
work
The `transform` property supports transform functions that sometimes need their `calc(percentage)` values to be converted to a number instead of a length. Currently this only applies to the `scale*` family of functions, which are marked as such in `TransformFunctions.json`. We were not consistently applying the `NumberPercentage` type to these functions though, and in addition, any `NumberPercentage` value would not consider calculated values.
This commit is contained in:
parent
202cbe7df6
commit
545d151948
Notes:
github-actions[bot]
2025-03-25 19:54:42 +00:00
Author: https://github.com/gmta
Commit: 545d151948
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4088
Reviewed-by: https://github.com/AtkinsSJ ✅
5 changed files with 26 additions and 10 deletions
|
@ -3313,6 +3313,12 @@ RefPtr<CSSStyleValue> Parser::parse_calculated_value(ComponentValue const& compo
|
|||
"conic-gradient"sv, "repeating-conic-gradient"sv)) {
|
||||
return CalculationContext { .percentages_resolve_as = ValueType::Length };
|
||||
}
|
||||
// https://drafts.csswg.org/css-transforms-2/#transform-functions
|
||||
// The scale family of functions treats percentages as numbers.
|
||||
if (function.name.is_one_of_ignoring_ascii_case(
|
||||
"scale"sv, "scalex"sv, "scaley"sv, "scalez"sv, "scale3d"sv)) {
|
||||
return CalculationContext { .percentages_resolve_as = ValueType::Number };
|
||||
}
|
||||
// FIXME: Add other functions that provide a context for resolving values
|
||||
return {};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue