4 <!-- This test case reproduces a bug that is hopefully solved by https://bugs.webkit.org/show_bug.cgi?id=80641
6 In the bug, a div element begins as non-composited, and the repaintRect had a
7 correct non-zero offset because it paints into an ancestor container. Later, the
8 layer becomes composited (in this case, because the layer is moved to overlap
9 another composited layer). Because the layer is now composited, the repaintRect
10 should have been recomputed - in particular, the offset of the repaintRect should
11 become zero because it is now its own repaint container.
13 Therefore, after the layer became composited, it was using the wrong repaint rect,
14 which caused things not to repaint properly.
17 <style type=
"text/css">
19 transform: translatez
(0);
20 border: 2px solid black
;
39 background-color: red
;
43 background-color: green
;
49 <script src=
"../../resources/run-after-layout-and-paint.js"></script>
52 if (window
.testRunner
) {
53 testRunner
.dumpAsTextWithPixelResults();
54 testRunner
.waitUntilDone();
57 function changeDivPosition() {
58 document
.getElementById("scrolldiv").style
.left
="50px";
61 function repaintTest() {
62 runAfterLayoutAndPaint(function() {
63 // Changing the position will cause the scrolldiv to become composited becuase it overlaps another compostied element.
66 // Force DumpRenderTree to do a layout and repaint here, this is where the repaintRect
67 // goes wrong because it does not get updated for a newly composited element.
68 runAfterLayoutAndPaint(function() {
69 // Scrolling a little will demonstrate whether the repaint rect is correct or not.
70 document
.getElementById('scrolldiv').scrollTop
= 500;
71 testRunner
.notifyDone();
78 <body onload=
"repaintTest()">
79 <div class=
"composited box"></div>
81 <div class=
"shouldNotBeSeen box"></div>
82 <div class=
"shouldBeSeen box"></div>