Bug 1598080 [wpt PR 20345] - Fix paint worklet hidpi, a=testonly

Automatic update from web-platform-tests
Fix paint worklet hidpi

Right now in the PaintRenderingContext2D::setTransform, we account for
the device_scale_factor_. This is wrong. It appears that internally
the recording canvas handles the device scale factor in the correct way.
Instead it should account for browser zoom.

A layout test has been changed to expect the correct result.
Screen recordings here to show that the demo is rendered correctly:
https://drive.google.com/drive/folders/1NbHlFgxBvJDvtN3wrq61uyzzIPk83FXR?usp=sharing

Bug: 970783
Change-Id: I8f2b6287fe5b0c443d7de5c8c61bfb62ae1ef42b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1841530
Commit-Queue: Xida Chen <xidachen@chromium.org>
Reviewed-by: Yi Gu <yigu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#717322}

--

wpt-commits: 1a0e1500a99c6e5742246aa75e45e54a7dab0a51
wpt-pr: 20345
This commit is contained in:
Xida Chen 2019-11-26 11:27:07 +00:00 коммит произвёл moz-wptsync-bot
Родитель 21bf88a29b
Коммит 2945952266
1 изменённых файлов: 5 добавлений и 4 удалений

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

@ -4,13 +4,14 @@
<canvas id ="canvas" width="540" height="550"></canvas>
<script>
var canvas = document.getElementById('canvas');
canvas.style.width = (canvas.width / devicePixelRatio) + 'px';
canvas.style.height = (canvas.height / devicePixelRatio) + 'px';
// In the test page, the paint worklet canvas has a size of width of 270 CSS
// pixels, and height of 275. To divided by 2 is to match the canvas size.
canvas.style.width = (canvas.width / 2) + 'px';
canvas.style.height = (canvas.height / 2) + 'px';
var ctx = canvas.getContext("2d");
ctx.scale(devicePixelRatio, devicePixelRatio);
var fillW = 250;
var fillH = 50;
ctx.setTransform(devicePixelRatio, 0, 0, devicePixelRatio, 0, 100);
ctx.setTransform(2 * devicePixelRatio, 0, 0, 2 * devicePixelRatio, 0, 200);
ctx.beginPath();
ctx.rect(0, 0, fillW, fillH);
ctx.closePath();