Bug 78642 - Convert 2 svg repaint tests to not use setTimeout
Summary: Convert 2 svg repaint tests to not use setTimeout
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tony Chang
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-14 15:34 PST by Tony Chang
Modified: 2012-02-15 16:49 PST (History)
1 user (show)

See Also:


Attachments
Patch (17.66 KB, patch)
2012-02-14 15:37 PST, Tony Chang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tony Chang 2012-02-14 15:34:25 PST
Convert 2 svg repaint tests to not use setTimeout
Comment 1 Tony Chang 2012-02-14 15:37:12 PST
Created attachment 127062 [details]
Patch
Comment 2 Tony Chang 2012-02-14 15:38:30 PST
Similar to the changes in bug 78516.

Chromium may need some new baselines, but I'm gardening so I can do that.
Comment 3 Tony Chang 2012-02-14 17:18:22 PST
(In reply to comment #2)
> Chromium may need some new baselines, but I'm gardening so I can do that.

Actually, I tried it locally and it seems like this should pass Chromium with no new baselines.
Comment 4 Nikolas Zimmermann 2012-02-15 00:40:51 PST
(In reply to comment #3)
> (In reply to comment #2)
> > Chromium may need some new baselines, but I'm gardening so I can do that.
> 
> Actually, I tried it locally and it seems like this should pass Chromium with no new baselines.
Can you hold back this patch? I have a massive patch waiting for review, that switches all svg/custom tests to use the repaint.js harness.
Comment 5 Nikolas Zimmermann 2012-02-15 01:44:53 PST
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > Chromium may need some new baselines, but I'm gardening so I can do that.
> > 
> > Actually, I tried it locally and it seems like this should pass Chromium with no new baselines.
> Can you hold back this patch? I have a massive patch waiting for review, that switches all svg/custom tests to use the repaint.js harness.

Ooops, the svg/custom changes are already in, sorry. Can you explain why they shouldn't use setTimeout? Any flakiness?
Comment 6 Tony Chang 2012-02-15 10:21:50 PST
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > (In reply to comment #2)
> > > > Chromium may need some new baselines, but I'm gardening so I can do that.
> > > 
> > > Actually, I tried it locally and it seems like this should pass Chromium with no new baselines.
> > Can you hold back this patch? I have a massive patch waiting for review, that switches all svg/custom tests to use the repaint.js harness.
> 
> Ooops, the svg/custom changes are already in, sorry. Can you explain why they shouldn't use setTimeout? Any flakiness?

Sorry for not explaining.  Yes, the Chromium bots were getting different results in debug and release because in debug, we would do an extra layout and paint.  Removing the setTimeouts doesn't allow those extra layouts or paints to happen.
Comment 7 Nikolas Zimmermann 2012-02-15 15:26:06 PST
Comment on attachment 127062 [details]
Patch

Ah ok, thanks for the explanation. I'd r+ this, but following should be resolved first:
I have some worries regarding the svg/repaint/image-with-clip-path.svg changes.
Can you try to comment out the repaint() in RenderSVGImage::imageChanged in rendering/svg/RenderSVGImage.cpp, and then rerun all pixel tests. Check if the image-with-clip-path.svg is now broken, as expected - if that's the case I'm fine with your change.

I remember the timeouts were added at some point to be sure we detect this repaint(). Not 100% sure, so you'd need to try first.
Comment 8 Tony Chang 2012-02-15 15:37:38 PST
(In reply to comment #7)
> (From update of attachment 127062 [details])
> Ah ok, thanks for the explanation. I'd r+ this, but following should be resolved first:
> I have some worries regarding the svg/repaint/image-with-clip-path.svg changes.
> Can you try to comment out the repaint() in RenderSVGImage::imageChanged in rendering/svg/RenderSVGImage.cpp, and then rerun all pixel tests. Check if the image-with-clip-path.svg is now broken, as expected - if that's the case I'm fine with your change.
> 
> I remember the timeouts were added at some point to be sure we detect this repaint(). Not 100% sure, so you'd need to try first.

I commented out the call to repaint() then ran the image-with-clip-path.svg test with my changes.  It passed.

I then reverted my changes to image-with-clip-path.svg (repaint() is still commented out) and ran the test again, and it passed again.

Does something different happen on Apple Mac?  I tested on Chromium Linux.
Comment 9 Nikolas Zimmermann 2012-02-15 16:20:19 PST
(In reply to comment #8)
> I then reverted my changes to image-with-clip-path.svg (repaint() is still commented out) and ran the test again, and it passed again.
> 
> Does something different happen on Apple Mac?  I tested on Chromium Linux.
Hrm, this is unfortunate. Is repainting throttled on Chromium?
Comment 10 Tony Chang 2012-02-15 16:24:54 PST
(In reply to comment #9)
> (In reply to comment #8)
> > I then reverted my changes to image-with-clip-path.svg (repaint() is still commented out) and ran the test again, and it passed again.
> > 
> > Does something different happen on Apple Mac?  I tested on Chromium Linux.
> Hrm, this is unfortunate. Is repainting throttled on Chromium?

Yes, we coalesce repaints and generate the union of smaller repaint regions.  I think it's like a 40ms window or something.
Comment 11 Nikolas Zimmermann 2012-02-15 16:28:26 PST
(In reply to comment #10)
> Yes, we coalesce repaints and generate the union of smaller repaint regions.  I think it's like a 40ms window or something.
The test makes the assumption that this doesn't happen - we expect repaints to happen in between the setTimeout(, 0) timeouts.
Hmpf, it's probably time to rename layoutTestController.display() to startTrackingRepaintRectsAndDisplay() and to make display() really only display the web view, so that we can force redraws for all platforms at specific points, to make tests like this reliable everywhere.

What do you think?
Comment 12 Tony Chang 2012-02-15 16:34:30 PST
(In reply to comment #11)
> (In reply to comment #10)
> > Yes, we coalesce repaints and generate the union of smaller repaint regions.  I think it's like a 40ms window or something.
> The test makes the assumption that this doesn't happen - we expect repaints to happen in between the setTimeout(, 0) timeouts.
> Hmpf, it's probably time to rename layoutTestController.display() to startTrackingRepaintRectsAndDisplay() and to make display() really only display the web view, so that we can force redraws for all platforms at specific points, to make tests like this reliable everywhere.
> 
> What do you think?

I see.  Maybe we could also add a method layoutTestController.layoutAndRepaint() and call that explicitly rather than using setTimeout?

Renaming display() also sounds useful, but changing it's behavior sounds tricky (I'm not opposed, it just sounds like a lot of work).
Comment 13 Nikolas Zimmermann 2012-02-15 16:45:27 PST
(In reply to comment #12) 
> I see.  Maybe we could also add a method layoutTestController.layoutAndRepaint() and call that explicitly rather than using setTimeout?
That would avoid the "document.body.offsetTop" hack as well in repaint.js.
If we'd use "layoutAndRepaint()" there instead of "document.body.offsetTop; layoutTestController.display()". Sounds good to me.

> Renaming display() also sounds useful, but changing it's behavior sounds tricky (I'm not opposed, it just sounds like a lot of work).
Well it's a global find . -type f | xargs perl -pi -e s/layoutTestController.display()/layoutTestController.startTrackingRepaintRectAndDisplay()/ :-)

Let's hear Simons opinion and other rendering/testing webkittens.