Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit 424c4b8

Browse files
xidachenchromium-wpt-export-bot
authored andcommitted
[OT-PW] Implement DrawPattern
Right now when we use CSS paint to paint the background-image, and have background-repeat specified, our implementation cannot handle that because PaintWorkletDeferredImage doesn't implement DrawPattern. Currently the code path goes into the GeneratedImage::DrawPattern and that cannot handle the off-thread case. This CL implements DrawPattern for off-thread paint worklet, and two layout tests are passing with it. Another layout test is added for additional testing. Bug: 957457 Change-Id: I707b4d8e47a6bcd747156e60f1860c1ecdae22e0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1691090 Reviewed-by: Khushal <[email protected]> Reviewed-by: Rune Lillesveen <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Reviewed-by: Stephen Chenney <[email protected]> Commit-Queue: Xida Chen <[email protected]> Cr-Commit-Position: refs/heads/master@{#684594}
1 parent 1bbaac8 commit 424c4b8

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<body>
4+
<canvas id ="canvas" width="200" height="200"></canvas>
5+
<script>
6+
var ctx = document.getElementById('canvas').getContext('2d');
7+
ctx.fillStyle = 'green';
8+
ctx.fillRect(0, 0, 50, 50);
9+
ctx.fillRect(100, 0, 50, 50);
10+
</script>
11+
</body>
12+
</html>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html class="reftest-wait">
3+
<link rel="help" href="https://drafts.css-houdini.org/css-paint-api/">
4+
<link rel="match" href="background-repeat-x-ref.html">
5+
<style>
6+
.container {
7+
width: 200px;
8+
height: 200px;
9+
}
10+
#foo {
11+
background: paint(foo) top left/50% 50% repeat-x;
12+
}
13+
</style>
14+
<script src="/common/reftest-wait.js"></script>
15+
<script src="/common/worklet-reftest.js"></script>
16+
<body>
17+
<div id="foo" class="container"></div>
18+
19+
<script id="code" type="text/worklet">
20+
registerPaint('foo', class {
21+
paint(ctx, geom) {
22+
ctx.fillStyle = 'green';
23+
ctx.fillRect(0, 0, 50, 50);
24+
}
25+
});
26+
</script>
27+
28+
<script>
29+
importWorkletAndTerminateTestAfterAsyncPaint(CSS.paintWorklet, document.getElementById('code').textContent);
30+
</script>
31+
</body>
32+
</html>

0 commit comments

Comments
 (0)