Bug 1564658 [wpt PR 17553] - Revert "[PW] Fix paint worklet canvas clip bound calculation", a=testonly

Automatic update from web-platform-tests
Revert "[PW] Fix paint worklet canvas clip bound calculation"

This reverts commit aa7c84555637cabd3fdb0c03d781cc6f72b9efa2.

Reason for revert: virtual/scalefactor200/external/wpt/css/css-paint-api/hidpi/canvas-transform.https.html test fails on WebKit Mac10.13 (retina).

This test consistently fails starting from https://ci.chromium.org/p/chromium/builders/ci/WebKit%20Mac10.13%20%28retina%29/16135

Original change's description:
> [PW] Fix paint worklet canvas clip bound calculation
>
> Right now when we initialize the paint canvas for paint worklet with a
> scale factor or browser zoom, we do not record the zoom factor in the
> canvas transform. As a result, when computing the clip bound we will
> apply the wrong transformation matrix and thus sometimes the contents
> can be completely clipped out while it should not.
>
> This CL fixes the problem and adds a layout test.
>
> Bug: 970783
> Change-Id: Ie3709ea5845ca2b405245d4b36f9fe8f99052bad
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1678287
> Reviewed-by: Stephen McGruer <smcgruer@chromium.org>
> Commit-Queue: Xida Chen <xidachen@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#672722}

TBR=xidachen@chromium.org,smcgruer@chromium.org

Change-Id: I6c6710f76ba204c2db9d90be56845c04ff072a54
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 970783
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1679696
Reviewed-by: Sergey Poromov <poromov@chromium.org>
Commit-Queue: Sergey Poromov <poromov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672870}

--

wpt-commits: 0804e0fcb5033df46553c9e245ffd4abbf122cf2
wpt-pr: 17553
This commit is contained in:
Sergey Poromov 2019-07-19 18:16:16 +00:00 коммит произвёл James Graham
Родитель 1ef38c3c7d
Коммит ef384fe038
4 изменённых файлов: 9 добавлений и 137 удалений

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

@ -1,22 +0,0 @@
<!DOCTYPE html>
<html>
<body>
<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';
var ctx = canvas.getContext("2d");
ctx.scale(devicePixelRatio, devicePixelRatio);
var fillW = 250;
var fillH = 50;
ctx.setTransform(1, 0, 0, 1, 0, 100);
ctx.beginPath();
ctx.rect(0, 0, fillW, fillH);
ctx.closePath();
ctx.clip();
ctx.fillStyle = 'green';
ctx.fillRect(0, 0, fillW, fillH);
</script>
</body>
</html>

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

@ -1,43 +0,0 @@
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="help" href="https://drafts.css-houdini.org/css-paint-api/#dom-css-paintworklet">
<link rel="match" href="canvas-transform-ref.html">
<style>
.container {
width: 270px;
height: 275px;
}
#canvas-geometry {
background-image: paint(geometry);
}
</style>
<script src="/common/reftest-wait.js"></script>
<script src="/common/worklet-reftest.js"></script>
<body>
<div id="canvas-geometry" class="container"></div>
<script id="code" type="text/worklet">
// Regression test for crbug.com/970783. The canvas transform matrix should
// account for the devicePixelRatio, such that the clip bounds can be
// properly computed when applying clips.
registerPaint('geometry', class {
paint(ctx, geom) {
var fillW = 250;
var fillH = 50;
ctx.setTransform(1, 0, 0, 1, 0, 100);
ctx.beginPath();
ctx.rect(0, 0, fillW, fillH);
ctx.closePath();
ctx.clip();
ctx.fillStyle = 'green';
ctx.fillRect(0, 0, fillW, fillH);
}
});
</script>
<script>
importWorkletAndTerminateTestAfterAsyncPaint(CSS.paintWorklet, document.getElementById('code').textContent);
</script>
</body>
</html>

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

@ -1,50 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
const videoElementTests =
[
{
createDetector: () => { return new FaceDetector(); },
name: "Face - detect(HTMLVideoElement)",
},
{
createDetector: () => { return new BarcodeDetector(); },
name: "Barcode - detect(HTMLVideoElement)",
}
];
for (let videoElementTest of videoElementTests) {
// Detector's detect() rejects on a HAVE_NOTHING HTMLVideoElement.
promise_test(async t => {
const video = document.createElement("video");
video.src = "";
const videoWatcher = new EventWatcher(t, video, ["play", "error"]);
video.load();
await videoWatcher.wait_for("error");
assert_equals(video.readyState, video.HAVE_NOTHING);
const detector = videoElementTest.createDetector();
await promise_rejects(t, 'InvalidStateError', detector.detect(video));
}, `${videoElementTest.name} - HAVE_NOTHING`);
// Detector's detect() rejects on a HAVE_METADATA HTMLVideoElement.
promise_test(async t => {
const video = document.createElement("video");
video.src = "/media/white.webm";
video.loop = true;
video.autoplay = true;
const videoWatcher = new EventWatcher(t, video, ["loadedmetadata", "error"]);
video.load();
await videoWatcher.wait_for("loadedmetadata");
assert_equals(video.readyState, video.HAVE_METADATA);
const detector = videoElementTest.createDetector();
await promise_rejects(t, 'InvalidStateError', detector.detect(video));
}, `${videoElementTest.name} - HAVE_METADATA`);
}
</script>

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

@ -30,9 +30,9 @@ for (let crossOriginTest of crossOriginTests) {
img.src = IMAGE_URL;
await imgWatcher.wait_for("load");
const detector = crossOriginTest.createDetector();
await promise_rejects(t, "SecurityError", detector.detect(img));
}, `${crossOriginTest.detectorType} should reject cross-origin \
HTMLImageElements with a SecurityError.`);
promise_rejects(t, "SecurityError", detector.detect(img));
}, crossOriginTest.detectorType
+ " should reject cross-origin HTMLImageElements with a SecurityError.");
// Verifies that Detector rejects a cross-origin ImageBitmap.
promise_test(async t => {
@ -42,9 +42,9 @@ HTMLImageElements with a SecurityError.`);
await imgWatcher.wait_for("load");
const imgBitmap = await createImageBitmap(img);
const detector = crossOriginTest.createDetector();
await promise_rejects(t, "SecurityError", detector.detect(imgBitmap));
}, `${crossOriginTest.detectorType} should reject cross-origin \
ImageBitmaps with a SecurityError.`);
promise_rejects(t, "SecurityError", detector.detect(imgBitmap));
}, crossOriginTest.detectorType
+ " should reject cross-origin ImageBitmaps with a SecurityError.");
// Verifies that Detector rejects a cross-origin HTMLVideoElement.
promise_test(async t => {
@ -53,22 +53,9 @@ ImageBitmaps with a SecurityError.`);
video.src = VIDEO_URL;
await videoWatcher.wait_for("loadeddata");
const detector = crossOriginTest.createDetector();
await promise_rejects(t, "SecurityError", detector.detect(video));
}, `${crossOriginTest.detectorType} should reject cross-origin \
HTMLVideoElements with a SecurityError.`);
// Verifies that Detector rejects a cross-origin HTMLCanvasElement.
promise_test(async t => {
const img = new Image();
const imgWatcher = new EventWatcher(t, img, ["load", "error"]);
img.src = IMAGE_URL;
await imgWatcher.wait_for("load");
const canvas = document.createElement("canvas");
canvas.getContext("2d").drawImage(img, 0, 0);
const detector = crossOriginTest.createDetector();
await promise_rejects(t, "SecurityError", detector.detect(canvas));
}, `${crossOriginTest.detectorType} should reject cross-origin \
HTMLCanvasElement with a SecurityError.`);
promise_rejects(t, "SecurityError", detector.detect(video));
}, crossOriginTest.detectorType
+ " should reject cross-origin HTMLVideoElements with a SecurityError.");
}