mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Clamp negative computed values for padding-* properties
Interpolation can leave `padding-*` values as negative - this should be handled by interpolation clamping it to the allowed range of values but we don't yet do that. As a stop gap we can clamp this before setting it in ComputedValues. This fixes 3 crashes and gains us 11 passes in the imported WPT tests
This commit is contained in:
parent
a0b7d0542c
commit
6fcaceedd9
Notes:
github-actions[bot]
2025-09-01 11:30:30 +00:00
Author: https://github.com/Calme1709
Commit: 6fcaceedd9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5941
Reviewed-by: https://github.com/AtkinsSJ ✅
10 changed files with 490 additions and 28 deletions
|
|
@ -313,8 +313,10 @@ GC::Ref<SVGAnimatedLength> SVGElement::svg_animated_length_for_property(CSS::Pro
|
|||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto make_length = [&](SVGLength::ReadOnly read_only) {
|
||||
if (auto const computed_properties = this->computed_properties()) {
|
||||
if (auto length = computed_properties->length_percentage(property); length.has_value())
|
||||
return SVGLength::from_length_percentage(realm(), *length, read_only);
|
||||
if (auto layout_node = this->layout_node()) {
|
||||
if (auto length = computed_properties->length_percentage(property, *layout_node, CSS::ComputedProperties::ClampNegativeLengths::Yes); length.has_value())
|
||||
return SVGLength::from_length_percentage(realm(), *length, read_only);
|
||||
}
|
||||
}
|
||||
return SVGLength::create(realm(), 0, 0, read_only);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue