Bug 93795

Summary: [chromium] renderSurface in incorrect space if owning layer has empty but non-zero bounds
Product: WebKit Reporter: Shawn Singh <shawnsingh>
Component: Layout and RenderingAssignee: Shawn Singh <shawnsingh>
Status: RESOLVED FIXED    
Severity: Normal CC: cc-bugs, enne, jamesr, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch enne: review+

Description Shawn Singh 2012-08-12 23:20:54 PDT
A particular translation transform was inside an if-statement that caused it to be accidentally skipped when it shouldn't be.  The fix is simply to move it outside of the if-statement so it is not skipped.

I have a feeling the other transform that remains inside the if-statement will also get incorrectly skipped, affecting correctness in high-DPI mode.  However, that one is not as clear how to fix (if it actually is a problem in the first place?), because not-skipping it means that we might be scaling by a zero width or height, causing the entire subtree to become invisible.   It might work to have separate scale transforms for width and height, and skip them individually when appropriate, but i'm not completely sure that would work as intended either.

So yeah, if it's OK with reviewers I would like to land this simple straightforward part first, get it merged to m22 sooner, and then deal with the high-DPI part separately.
Comment 1 Shawn Singh 2012-08-12 23:37:41 PDT
Created attachment 157926 [details]
Patch

tested on osx with layout and unit tests.  Also fixed one comment that used right-to-left name...  We have discussed possibly switching the naming convention of transforms to that style, but for now those transforms were being written so that their name interprets what happens to the coordinate space from left-to-right.
Comment 2 Adrienne Walker 2012-08-13 08:47:04 PDT
(In reply to comment #0)
> A particular translation transform was inside an if-statement that caused it to be accidentally skipped when it shouldn't be.  The fix is simply to move it outside of the if-statement so it is not skipped.
> 
> I have a feeling the other transform that remains inside the if-statement will also get incorrectly skipped, affecting correctness in high-DPI mode.

I am less sure about that, actually.  I think the surface-creating code makes some assumptions that device scale = contentsScale(), and it's possible that this other transform might be moot.  Along with a degenerate case like this bug with bounds() != contentBounds() case, I also worry about a layer with bounds() == contentBounds() creating a surface when deviceScale != 1.

> So yeah, if it's OK with reviewers I would like to land this simple straightforward part first, get it merged to m22 sooner, and then deal with the high-DPI part separately.

Is there a separate bug for investigating the high-DPI end of things? Is this something that you can also look into?
Comment 3 Adrienne Walker 2012-08-13 08:48:17 PDT
Comment on attachment 157926 [details]
Patch

R=me.  That's a really elegant test, to have all draw transforms come out to be identity.  :)
Comment 4 Shawn Singh 2012-08-13 17:58:33 PDT
Thanks for the review =)

I created https://bugs.webkit.org/show_bug.cgi?id=93919 for the highDPI questions we have.  Of course please correct me if my comments there are not actually what you were worried about. =)
Comment 5 Shawn Singh 2012-08-13 18:04:07 PDT
Committed r125486: <http://trac.webkit.org/changeset/125486>