mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-17 05:29:56 +00:00
LibWeb: Properly clamp interpolated opacity values
Opacity values are unique in that the range which calculated and interpolated values should be clamped to [0,1] is different from the range of allowed values [-∞,∞]. This fixes 28 WPT tests that were regressed in #6112
This commit is contained in:
parent
517e3f5f1d
commit
43dd0f2dda
Notes:
github-actions[bot]
2025-09-24 11:02:58 +00:00
Author: https://github.com/Calme1709
Commit: 43dd0f2dda
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6138
Reviewed-by: https://github.com/AtkinsSJ ✅
4 changed files with 251 additions and 21 deletions
|
@ -3514,7 +3514,7 @@ NonnullRefPtr<StyleValue const> StyleComputer::compute_opacity(NonnullRefPtr<Sty
|
|||
|
||||
// NOTE: We also support calc()'d numbers
|
||||
if (specified_value->is_calculated() && specified_value->as_calculated().resolves_to_number())
|
||||
return NumberStyleValue::create(clamp(specified_value->as_calculated().resolve_number({ .length_resolution_context = computation_context.length_resolution_context }).value(), 0, 1));
|
||||
return NumberStyleValue::create(specified_value->as_calculated().resolve_number({ .length_resolution_context = computation_context.length_resolution_context }).value());
|
||||
|
||||
// <percentage>
|
||||
if (specified_value->is_percentage())
|
||||
|
@ -3522,7 +3522,7 @@ NonnullRefPtr<StyleValue const> StyleComputer::compute_opacity(NonnullRefPtr<Sty
|
|||
|
||||
// NOTE: We also support calc()'d percentages
|
||||
if (specified_value->is_calculated() && specified_value->as_calculated().resolves_to_percentage())
|
||||
return NumberStyleValue::create(clamp(specified_value->as_calculated().resolve_percentage({ .length_resolution_context = computation_context.length_resolution_context })->as_fraction(), 0, 1));
|
||||
return NumberStyleValue::create(specified_value->as_calculated().resolve_percentage({ .length_resolution_context = computation_context.length_resolution_context })->as_fraction());
|
||||
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue