mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
LibWeb: Fix division by zero on a zero-height viewport SVG image
This commit is contained in:
parent
d48316ce15
commit
dd20156010
Notes:
sideshowbarker
2024-07-17 01:13:25 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/dd20156010 Pull-request: https://github.com/SerenityOS/serenity/pull/24374
@ -0,0 +1,14 @@
|
||||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
|
||||
BlockContainer <body> at (8,8) content-size 784x150 children: inline
|
||||
frag 0 from ImageBox start: 0, length: 0, rect: [8,8 300x150] baseline: 150
|
||||
ImageBox <img> at (8,8) content-size 300x150 children: not-inline
|
||||
(SVG-as-image isolated context)
|
||||
Viewport <#document> at (0,0) content-size 300x150 [BFC] children: inline
|
||||
SVGSVGBox <svg> at (0,0) content-size 300x150 [SVG] children: not-inline
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<BODY>) [8,8 784x150]
|
||||
ImagePaintable (ImageBox<IMG>) [8,8 300x150]
|
@ -0,0 +1 @@
|
||||
<img src="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2040%200'%3E%3C/svg%3E">
|
@ -162,6 +162,8 @@ Optional<CSSPixelFraction> SVGDecodedImageData::intrinsic_aspect_ratio() const
|
||||
return {};
|
||||
|
||||
auto viewbox_height = CSSPixels::nearest_value_for(viewbox->height);
|
||||
if (viewbox_height == 0)
|
||||
return {};
|
||||
|
||||
return viewbox_width / viewbox_height;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user