Bug 82990 - REGRESSION (r111456): overflow-scrolling and css clip break with compositing
Summary: REGRESSION (r111456): overflow-scrolling and css clip break with compositing
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Adrienne Walker
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2012-04-02 18:00 PDT by Simon Fraser (smfr)
Modified: 2012-04-11 11:20 PDT (History)
6 users (show)

See Also:


Attachments
Testcase (1.64 KB, text/html)
2012-04-02 18:00 PDT, Simon Fraser (smfr)
no flags Details
Patch (4.75 KB, patch)
2012-04-10 17:52 PDT, Adrienne Walker
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2012-04-02 18:00:56 PDT
Created attachment 135248 [details]
Testcase

The testcase I'll attach shows a bug that started to happen in r111456. The testcase is setting CSS clip in response to a scroll event, and no longer works after that revision.

<rdar://problem/11162020>
Comment 1 Adrienne Walker 2012-04-06 12:29:54 PDT
Not knowing anything about style differences, I wonder if setting the clip style should really force layout and not just a repaint.

I suspect previously the render layer was just incorrectly not being considered clipped and considering more layers for clipping has unearthed this bug.

Sorry for not looking at this sooner, smfr.  I've pretty busy, and it's hard to tell how urgent something is to fix when I can't see rdar links.
Comment 2 Adrienne Walker 2012-04-09 14:01:42 PDT
Ok, I see what the problem is.

Along with considering overflow clip from non-compositing render layers, r111456 also started considering clip.  This test case worked before this patch, because the layer wasn't clipped at all.

In this test case, a scroll handler updates the clip.  When scrolling occurs, the render layer tree is updated (with the old clip) via updateCompositingLayersAfterScroll, and then the style is changed.  Changing the clipping style doesn't cause layout (just StyleDifferenceRepaint).  This won't cause updateLayerPositions() to be called, so the composited layer bounds will not be updated, and the incorrect clip from the previous update will be used.

This could be fixed by:
(1) Change the approach in r111456 to walk the render layer tree and only consider overflow, rather than using cached clip rects.  It seems like a bonus to have a smaller backing, but maybe this isn't intentional.

(2) Having a change in clipping style somehow triggering a call updateLayerPositions.  I'm not totally sure the best way to go about this, but it's also a possibility.  Making a change in clip style cause StyleDifferenceLayout does the right thing for this test case, but that seems too heavy handed.

Thoughts?
Comment 3 Adrienne Walker 2012-04-10 17:52:41 PDT
Created attachment 136588 [details]
Patch
Comment 4 Simon Fraser (smfr) 2012-04-10 18:21:29 PDT
Comment on attachment 136588 [details]
Patch

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

> Source/WebCore/rendering/RenderLayer.cpp:4718
> +        compositor()->setCompositingLayersNeedRebuild();

Does this end up doing just a geometry update, or does it do a full hierarchy update?

> LayoutTests/compositing/clip-change.html:35
> +      if (window.layoutTestController)
> +        layoutTestController.display();
> +      // The change in clip style should be reflected immediately in the size
> +      // of the composited clipper layer. After changing the clip, it should
> +      // entirely cover the indicator.
> +      var clipper = document.getElementById("clipper");
> +      clipper.style.clip = "rect(0px, 100px, 100px, 0px)";
> +    }

I think that tests that call display() to get layers to be updated don't always work correctly in Safari (which we should fix).
Comment 5 Adrienne Walker 2012-04-10 18:50:42 PDT
(In reply to comment #4)
> (From update of attachment 136588 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=136588&action=review
> 
> > Source/WebCore/rendering/RenderLayer.cpp:4718
> > +        compositor()->setCompositingLayersNeedRebuild();
> 
> Does this end up doing just a geometry update, or does it do a full hierarchy update?

It does a full hierarchy update.  RLB::updateGraphicsLayerGeometry() doesn't call RL::calculateLayerBounds and just uses the existing cached bounds.

> > LayoutTests/compositing/clip-change.html:35
> > +      if (window.layoutTestController)
> > +        layoutTestController.display();
> > +      // The change in clip style should be reflected immediately in the size
> > +      // of the composited clipper layer. After changing the clip, it should
> > +      // entirely cover the indicator.
> > +      var clipper = document.getElementById("clipper");
> > +      clipper.style.clip = "rect(0px, 100px, 100px, 0px)";
> > +    }
> 
> I think that tests that call display() to get layers to be updated don't always work correctly in Safari (which we should fix).

Oh, I didn't know that.  Are there more details about when display() is known to fail or known to succeed in Safari? :(

I'll check to see how this works in Safari so that I don't check in a failing test.
Comment 6 Adrienne Walker 2012-04-11 10:33:34 PDT
(In reply to comment #5)
> >
> > I think that tests that call display() to get layers to be updated don't always work correctly in Safari (which we should fix).
> 
> Oh, I didn't know that.  Are there more details about when display() is known to fail or known to succeed in Safari? :(
> 
> I'll check to see how this works in Safari so that I don't check in a failing test.

On the upside, this test doesn't fail.  On the downside, it didn't fail before this change either.

smfr: Do you want me to make this test fail on Safari as well, or just check in this patch as-is, knowing that it will start working as intended once that bug is fixed?
Comment 7 Simon Fraser (smfr) 2012-04-11 10:34:55 PDT
Go ahead with the current patch.
Comment 8 WebKit Review Bot 2012-04-11 11:20:42 PDT
Comment on attachment 136588 [details]
Patch

Clearing flags on attachment: 136588

Committed r113883: <http://trac.webkit.org/changeset/113883>
Comment 9 WebKit Review Bot 2012-04-11 11:20:47 PDT
All reviewed patches have been landed.  Closing bug.