Bug 76850

Summary: Clipping of render layer boundaries does not take page scale into account
Product: WebKit Reporter: Sami Kyostila <skyostil>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: fsamuel, jamesr, jchaffraix, simon.fraser, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 68075    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Sami Kyostila 2012-01-23 11:56:03 PST
The boundaries for render layers that are descendants of clipping containers (e.g., overflow: hidden) are incorrectly stored into the compositor's overlap map. The problem is that the boundaries are in scaled CSS coordinates while the clip rects are unscaled. The result is that the overlap check sometimes fails depending on the page geometry and scale.
Comment 1 Sami Kyostila 2012-01-23 12:17:15 PST
Created attachment 123596 [details]
Patch
Comment 2 Sami Kyostila 2012-01-24 05:50:00 PST
Created attachment 123719 [details]
Patch

 - Fixed typo in changelog.
Comment 3 Simon Fraser (smfr) 2012-01-24 16:12:18 PST
Comment on attachment 123719 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=123719&action=review

It would be nice if the bug listed some real-world sites known by be broken.

> LayoutTests/compositing/overflow/overflow-scaled-descendant-overlapping.html:25
> +    <div style="position: absolute; left: 400px; z-index: 1; background: #0f0">
> +        <!-- Green should appear on top. -->
> +    </div>
> +
> +    <div style="position: absolute; left: 400px; overflow: hidden">
> +        <div style="-webkit-transform: translateZ(0); background: #f00">
> +            <!-- Red should be hidden. -->
> +        </div>

Please use 'red' and 'green' for colors, rather than hex values.

Also, use of css classes like '#indicator" makes the test self-documenting. I also don't like inline style in general.
Comment 4 Sami Kyostila 2012-01-25 03:11:32 PST
A real-world site where this happens is the mobile version eBay (http://mobileweb.ebay.com/). It has a popup ad which is placed to the bottom of the viewport using absolute positioning and some JavaScript. The page also has an image gallery with images that are positioned using CSS 3D transforms. The bug is that the popup is obscured by the gallery images despite having a higher z-index.

The bug is triggered because the popup does not get its own graphics layer unless it overlaps with another existing graphics layer. It is this overlap test that fails due to the missing page scale factor.

To make it easier to trigger the bug on that page, first set page scale > 1 and then call createAndroidAppPopup() on that page since the popup normally appears somewhat nondeterministically.
Comment 5 Sami Kyostila 2012-01-25 03:50:50 PST
Comment on attachment 123719 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=123719&action=review

>> LayoutTests/compositing/overflow/overflow-scaled-descendant-overlapping.html:25
>> +        </div>
> 
> Please use 'red' and 'green' for colors, rather than hex values.
> 
> Also, use of css classes like '#indicator" makes the test self-documenting. I also don't like inline style in general.

I've now removed the inline style defitions and rewritten the test to use CSS classes like existing tests do.
Comment 6 Sami Kyostila 2012-01-25 03:54:58 PST
Created attachment 123917 [details]
Patch
Comment 7 Simon Fraser (smfr) 2012-01-25 07:27:29 PST
Comment on attachment 123917 [details]
Patch

Much cleaner test, thanks.
Comment 8 WebKit Review Bot 2012-01-25 07:51:08 PST
Comment on attachment 123917 [details]
Patch

Clearing flags on attachment: 123917

Committed r105879: <http://trac.webkit.org/changeset/105879>
Comment 9 WebKit Review Bot 2012-01-25 07:51:13 PST
All reviewed patches have been landed.  Closing bug.