mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-28 14:02:51 +00:00
LibWeb: Remove early continue in size parsing
Step 5 of parsing was always skipped because step 4 continues. Running step 5 causes some of the denominators to be 0 and causes divide by zero error in CSSPixelFraction. SVG Image with height of 0 will cause divide by zero error when calculating intrinsic aspect ratio of SVGDecoderImageData. We also get a divide by zero error in AlignContent::SpaceBetween of the FlexFormatingContext. During auto track stretching in GridFormatingContext there is a possibility for count_of_auto_max_sizing_tracks to stay 0.
This commit is contained in:
parent
e2bc606eeb
commit
7cd489d6aa
Notes:
sideshowbarker
2024-07-17 00:53:02 +09:00
Author: https://github.com/DasBasti
Commit: 7cd489d6aa
Pull-request: https://github.com/SerenityOS/serenity/pull/22781
Reviewed-by: https://github.com/kalenikaliaksandr ✅
6 changed files with 15 additions and 8 deletions
|
@ -181,6 +181,9 @@ Optional<CSSPixelFraction> SVGDecodedImageData::intrinsic_aspect_ratio() const
|
|||
// https://www.w3.org/TR/SVG2/coords.html#SizingSVGInCSS
|
||||
auto width = intrinsic_width();
|
||||
auto height = intrinsic_height();
|
||||
if (height.has_value() && *height == 0)
|
||||
return {};
|
||||
|
||||
if (width.has_value() && height.has_value())
|
||||
return *width / *height;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue