mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-16 04:59:23 +00:00
LibWeb: Don't resolve calc'd opacity percentages at parse time
This behaviour should only apply to literal percentages as clarified
here: 4ee8429
We were also doing this wrong by converting the numeric type of the calc
to Length which was causing values to be defaulted to 1 instead (hence
the new passing tests for computed values as well)
This commit is contained in:
parent
d53668b376
commit
246a1c41ff
Notes:
github-actions[bot]
2025-09-08 10:07:16 +00:00
Author: https://github.com/Calme1709
Commit: 246a1c41ff
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6112
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/tcl3 ✅
6 changed files with 29 additions and 42 deletions
|
@ -3844,15 +3844,6 @@ RefPtr<StyleValue const> Parser::parse_opacity_value(PropertyID property_id, Tok
|
|||
// Percentages map to the range [0,1] for opacity values
|
||||
if (value->is_percentage())
|
||||
value = NumberStyleValue::create(value->as_percentage().percentage().as_fraction());
|
||||
if (value->is_calculated() && value->as_calculated().resolves_to_percentage()) {
|
||||
auto maybe_percentage = value->as_calculated().resolve_percentage_deprecated({});
|
||||
if (maybe_percentage.has_value()) {
|
||||
auto resolved_percentage = maybe_percentage->as_fraction();
|
||||
CalculationContext context {};
|
||||
auto calc_node = NumericCalculationNode::create(Number { Number::Type::Number, resolved_percentage }, context);
|
||||
value = CalculatedStyleValue::create(move(calc_node), NumericType { NumericType::BaseType::Length, 1 }, context);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue