Bug 1804289 [wpt PR 37356] - Only synthesize a 'viewBox' in <img> for the document element <svg>, a=testonly

Automatic update from web-platform-tests
Only synthesize a 'viewBox' in <img> for the document element <svg>

SVGSVGElement::ShouldSynthesizeViewBox() needs to check that it is the
document element as well.

Use the IsDocumentElement() helper from Element, and replace another
instance of the same check as well.

Fixed: 1313530
Change-Id: I785a8ce83780cc2a4c9d697065453f69bc3d69e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4079162
Auto-Submit: Fredrik Söderquist <fs@opera.com>
Reviewed-by: Philip Rogers <pdr@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1081216}

--

wpt-commits: 161ce8659673b5d66b1bb35e7ea96700f10b3d30
wpt-pr: 37356
This commit is contained in:
Fredrik Söderquist 2022-12-11 21:38:25 +00:00 committed by moz-wptsync-bot
parent a8c64f2f3f
commit c1afe7c676

View File

@ -0,0 +1,16 @@
<!doctype html>
<title>Only synthesize a 'viewBox' for the outermost SVG root in image contexts</title>
<link rel="help" href="https://crbug.com/1313530">
<link rel="match" href="../struct/reftests/reference/green-100x100.html">
<img width="100" height="100" src="data:image/svg+xml,
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200' width='100' id='svg'>
<rect width='200' height='200' fill='red'/>
<foreignObject width='200' height='200'>
<div xmlns='http://www.w3.org/1999/xhtml' style='height: 100px; width: 100px'>
<svg xmlns='http://www.w3.org/2000/svg' style='width: 100%; height: 100%; overflow: visible' width='200' height='200'>
<rect width='200' height='200' fill='green'/>
</svg>
</div>
</foreignObject>
</svg>
">