Skip to content

Commit

Permalink
[OT-PW] Implement DrawPattern
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
xidachen authored and chromium-wpt-export-bot committed Aug 7, 2019
1 parent 1bbaac8 commit 424c4b8
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
12 changes: 12 additions & 0 deletions css/css-paint-api/background-repeat-x-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<body>
<canvas id ="canvas" width="200" height="200"></canvas>
<script>
var ctx = document.getElementById('canvas').getContext('2d');
ctx.fillStyle = 'green';
ctx.fillRect(0, 0, 50, 50);
ctx.fillRect(100, 0, 50, 50);
</script>
</body>
</html>
32 changes: 32 additions & 0 deletions css/css-paint-api/background-repeat-x.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="help" href="https://drafts.css-houdini.org/css-paint-api/">
<link rel="match" href="background-repeat-x-ref.html">
<style>
.container {
width: 200px;
height: 200px;
}
#foo {
background: paint(foo) top left/50% 50% repeat-x;
}
</style>
<script src="/common/reftest-wait.js"></script>
<script src="/common/worklet-reftest.js"></script>
<body>
<div id="foo" class="container"></div>

<script id="code" type="text/worklet">
registerPaint('foo', class {
paint(ctx, geom) {
ctx.fillStyle = 'green';
ctx.fillRect(0, 0, 50, 50);
}
});
</script>

<script>
importWorkletAndTerminateTestAfterAsyncPaint(CSS.paintWorklet, document.getElementById('code').textContent);
</script>
</body>
</html>

0 comments on commit 424c4b8

Please sign in to comment.