Bug 1604770 [wpt PR 20831] - Use Image::SizeAsFloat() and unsnapped rectangle in ImagePainter, a=testonly

Automatic update from web-platform-tests
Use Image::SizeAsFloat() and unsnapped rectangle in ImagePainter

The pixel-snapping of the destination rectangle can end up distorting
the geometry use for painting an SVG image preserveAspectRatio is used -
the larger the aspect ratio, the larger the error.
By passing the unsnapped rectangle to LayoutImageResource::GetImage, and
using Image::SizeAsFloat() to compute the source rectangle of the image,
e can minimize the error and allow the Image in question (an SVGImage)
to perform compensation for the difference in aspect ratio between the
snapped and unsnapped rectangles. This means that the painted result
will better approximate the intended rendering.

Also clean up accesses to the LayoutImageResource and ImageResourceContent
by adding and using local variables for them.

Bug: 812239
Change-Id: I0778648e7dd6fcca778a95123509f15b3519564c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1969831
Reviewed-by: Stephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#726375}

--

wpt-commits: 8e4a2c71523b8b9c078a6500711ff7ec1aa69bf4
wpt-pr: 20831
This commit is contained in:
Fredrik Söderquist 2019-12-20 11:38:39 +00:00 коммит произвёл moz-wptsync-bot
Родитель 943c03aabc
Коммит 9b3fdc8482
1 изменённых файлов: 27 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,27 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-sizing/#intrinsic-sizes">
<link rel="match" href="../reference/ref-filled-green-100px-square-only.html">
<style>
.target {
height: 12.5px;
background-color: red;
display: block;
}
</style>
<p>Test passes if there is a filled green square.</p>
<img src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 12'><rect width='96' height='12' fill='green'/></svg>"
class="target">
<img src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 12'><rect width='96' height='12' fill='green'/></svg>"
class="target">
<img src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 12'><rect width='96' height='12' fill='green'/></svg>"
class="target">
<img src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 12'><rect width='96' height='12' fill='green'/></svg>"
class="target">
<img src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 12'><rect width='96' height='12' fill='green'/></svg>"
class="target">
<img src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 12'><rect width='96' height='12' fill='green'/></svg>"
class="target">
<img src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 12'><rect width='96' height='12' fill='green'/></svg>"
class="target">
<img src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 12'><rect width='96' height='12' fill='green'/></svg>"
class="target">