mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-20 16:28:54 +00:00
LibWeb/SVG: Ignore view boxes with negative width or height
This commit is contained in:
parent
a990de65e4
commit
d38fac7518
Notes:
github-actions[bot]
2025-07-21 22:53:29 +00:00
Author: https://github.com/tcl3
Commit: d38fac7518
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5418
Reviewed-by: https://github.com/konradekk
4 changed files with 17 additions and 0 deletions
|
@ -41,9 +41,13 @@ Optional<ViewBox> try_parse_view_box(StringView string)
|
|||
view_box.min_y = maybe_number.value();
|
||||
break;
|
||||
case State::Width:
|
||||
if (*maybe_number < 0)
|
||||
return {};
|
||||
view_box.width = maybe_number.value();
|
||||
break;
|
||||
case State::Height:
|
||||
if (*maybe_number < 0)
|
||||
return {};
|
||||
view_box.height = maybe_number.value();
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
<!DOCTYPE html>
|
||||
<div style="width: 100px; height: 100px; background-color: green"></div>
|
|
@ -0,0 +1,5 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="100" viewBox="0 0 100 100">
|
||||
<view id="transform" viewBox="-100 -100 200 200"/>
|
||||
<view id="invalid" viewBox="0 0 -100 200"/>
|
||||
<rect width="100" height="100" fill="green"/>
|
||||
</svg>
|
After Width: | Height: | Size: 229 B |
|
@ -0,0 +1,6 @@
|
|||
<!doctype HTML>
|
||||
<title>view element with invalid viewBox should be ignored</title>
|
||||
<link rel="help" href="https://svgwg.org/svg2-draft/linking.html#ViewElement">
|
||||
<link rel="match" href="../../../../expected/wpt-import/svg/coordinate-systems/../struct/reftests/reference/green-100x100.html">
|
||||
<img src="support/views.svg#invalid">
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue