[webkit-dev] Initial painting time changed?

Nikolas Zimmermann zimmermann at physik.rwth-aachen.de
Mon Jan 30 03:56:52 PST 2012


Good evening WebKit folks,

while working on some SVG Filter dynamic update issues I found out that long-standing assumptions about the paint time don't hold anymore:

<svg>
<rect id="rect" width="1" height="100"/>
<script>
function doTest() {
   document.getElementById("rect").setAttribute("width", "100");
   layoutTestController.notifyDone();
}

layoutTestController.waitUntilDone();
setTimeout(doTest, 0);
</script>
</svg>

The document was laid out and painted once before the timeout fired. Most SVG repainting tests work this way: setup document initially, then use a setTimeout(doSomething, 0) to eg. change an attribute, then dump the document to capture that invalidations/repaints work properly.

Something has changed recently - to get the same effect as we used to, following is needed:
<script>
function doTest() {
   setTimeout(function() {    // EXTRA TIMEOUT 1
       document.getElementById("rect").setAttribute("width", "100");
       setTimeout(function() { layoutTestController.notifyDone(); }, 0); // EXTRA TIMEOUT 2
   }, 0);
}

layoutTestController.waitUntilDone();
setTimeout(doTest, 0);
</script>

Does that ring a bell to anyone? Why is the initial painting not done yet, if setTimeout(, 0) fires the first time?
There's also an extra setTimeout needed now, before calling notifyDone(), otherwise the repaint is not captured.

Currently most SVG tests that exercise dynamic updates are useless, as the painting always happens after the whole script ran, that means it's not possible to capture repaint problems at the moment w/o fixing all these tests.

Cheers,
Niko




More information about the webkit-dev mailing list