Bug 89216 - RenderView layer is marked as fixed position container in the scrolling tree if page scale != 1
Summary: RenderView layer is marked as fixed position container in the scrolling tree ...
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: Sami Kyostila
URL:
Keywords:
Depends on: 89576
Blocks: 78862
  Show dependency treegraph
 
Reported: 2012-06-15 08:14 PDT by Sami Kyostila
Modified: 2012-07-11 11:00 PDT (History)
15 users (show)

See Also:


Attachments
Patch (2.50 KB, patch)
2012-06-15 08:17 PDT, Sami Kyostila
no flags Details | Formatted Diff | Diff
Patch (56.24 KB, patch)
2012-06-18 06:46 PDT, Sami Kyostila
no flags Details | Formatted Diff | Diff
Patch (56.37 KB, patch)
2012-06-18 08:09 PDT, Sami Kyostila
no flags Details | Formatted Diff | Diff
Patch (23.53 KB, patch)
2012-06-18 11:01 PDT, Sami Kyostila
no flags Details | Formatted Diff | Diff
Patch (23.47 KB, patch)
2012-06-20 03:09 PDT, Sami Kyöstilä
no flags Details | Formatted Diff | Diff
Patch (2.58 KB, patch)
2012-06-20 09:04 PDT, Sami Kyöstilä
no flags Details | Formatted Diff | Diff
Patch (2.60 KB, patch)
2012-07-11 10:17 PDT, Sami Kyöstilä
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sami Kyostila 2012-06-15 08:14:44 PDT
Render layers with CSS transforms should become containers for any fixed positioned descendants. However, because this check is done with RenderLayer::hasTransform(), we also end up marking the RenderLayer for the RenderView as fixed position container if a non-identity page scale factor is used. This is because page scale is applied as a transform for that layer.

This breaks fixed position layers, because they become fixed relative to the RenderView layer instead of outer scroll clip layer.

The fix is to avoid marking any RenderView layers as fixed position containers.
Comment 1 Sami Kyostila 2012-06-15 08:17:48 PDT
Created attachment 147825 [details]
Patch
Comment 2 James Robinson 2012-06-15 14:24:14 PDT
(In reply to comment #0)
> Render layers with CSS transforms should become containers for any fixed positioned descendants.

This surprises me a bit - why is there a relationship between CSS transforms and fixed positioned descendants?  Is this in a spec somewhere?

> However, because this check is done with RenderLayer::hasTransform(), we also end up marking the RenderLayer for the RenderView as fixed position container if a non-identity page scale factor is used. This is because page scale is applied as a transform for that layer.
> 
> This breaks fixed position layers, because they become fixed relative to the RenderView layer instead of outer scroll clip layer.
> 
> The fix is to avoid marking any RenderView layers as fixed position containers.
Comment 3 Shawn Singh 2012-06-15 14:26:16 PDT
http://dev.w3.org/csswg/css3-transforms/ -- just search for the word "fixed".

I'm sure Simon will have something more authoritative to say, though.  Perhaps that part of the spec is still in a bit of flux?
Comment 4 Simon Fraser (smfr) 2012-06-15 14:34:13 PDT
" The object acts as a containing block for fixed positioned descendants"

Yep, it's like that because Dave Hyatt said it would be really hard to do any other way.
Comment 5 Simon Fraser (smfr) 2012-06-15 14:35:04 PDT
Comment on attachment 147825 [details]
Patch

r- for lack of a test.
Comment 6 James Robinson 2012-06-15 14:36:35 PDT
Wow, that's weird (although I guess doing otherwise would be a pain in the butt).  OK.
Comment 7 Sami Kyostila 2012-06-18 06:46:30 PDT
Created attachment 148091 [details]
Patch

- Added testing framework for ScrollingCoordinator.
- Added layout test to verify fix.
Comment 8 WebKit Review Bot 2012-06-18 06:48:40 PDT
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Comment 9 Gyuyoung Kim 2012-06-18 08:01:46 PDT
Comment on attachment 148091 [details]
Patch

Attachment 148091 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/12979166
Comment 10 Sami Kyostila 2012-06-18 08:09:24 PDT
Created attachment 148101 [details]
Patch

- Fixed efl build failure.
Comment 11 Simon Fraser (smfr) 2012-06-18 09:10:26 PDT
Comment on attachment 148101 [details]
Patch

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

> Source/WebCore/ChangeLog:3
> +        RenderView layer is marked as fixed position container if page scale != 1

Normally when we talked about "fixed position containers", we're talking about the render tree, but this bug only exists in the scrolling tree. The bug title should say this.

> Source/WebCore/ChangeLog:22
> +        This patch also adds a testing framework for ScrollingCoordinator. Layout
> +        tests can call testRunner.scrollingTreeAsText() to retrieve a text
> +        representation of the scrolling tree of the current page. This feature is
> +        currently only implemented for the Chromium scrolling coordinator back-end.

Do you think that the scrolling tree output is comparable across implementations? If not, the utility of this way of testing is reduced.

> LayoutTests/platform/chromium/compositing/fixed-position-container-with-page-scale.html:22
> +        testRunner.dumpAsText(true);

Why dumpAsText(true)? The pixel result doesn't seem useful.
Comment 12 Sami Kyostila 2012-06-18 10:33:31 PDT
Comment on attachment 148101 [details]
Patch

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

Thanks Simon.

>> Source/WebCore/ChangeLog:3
>> +        RenderView layer is marked as fixed position container if page scale != 1
> 
> Normally when we talked about "fixed position containers", we're talking about the render tree, but this bug only exists in the scrolling tree. The bug title should say this.

Good point. I'll change this.

>> Source/WebCore/ChangeLog:22
>> +        currently only implemented for the Chromium scrolling coordinator back-end.
> 
> Do you think that the scrolling tree output is comparable across implementations? If not, the utility of this way of testing is reduced.

The current format certainly isn't, but I think I can make a few tweaks to make it more feasible for all implementations to produce the same output. I think we can also adjust the format later if there is need.

>> LayoutTests/platform/chromium/compositing/fixed-position-container-with-page-scale.html:22
>> +        testRunner.dumpAsText(true);
> 
> Why dumpAsText(true)? The pixel result doesn't seem useful.

Ah, I think I got confused by the dumpAsText arguments again. Will fix.
Comment 13 Sami Kyostila 2012-06-18 11:01:55 PDT
Created attachment 148129 [details]
Patch

- Made scrollingTreeAsText() output less Chromium-specific.
- Only save text reference in the test.
- Updated bug title.
Comment 14 Sami Kyöstilä 2012-06-20 03:09:12 PDT
Created attachment 148530 [details]
Patch

Rebased. Another look please?
Comment 15 Simon Fraser (smfr) 2012-06-20 08:48:58 PDT
Comment on attachment 148530 [details]
Patch

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

> Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:295
> +String ScrollingCoordinator::scrollingTreeAsText() const
> +{
> +    ASSERT(isMainThread());
> +#if USE(ACCELERATED_COMPOSITING)
> +    if (!m_page || !m_page->mainFrame())
> +        return String();
> +
> +    RenderView* renderView = m_page->mainFrame()->contentRenderer();
> +    if (!renderView || !renderView->compositor() || !renderView->compositor()->rootGraphicsLayer())
> +        return String();
> +
> +    TextStream textStream;
> +    dumpLayer(textStream, renderView->compositor()->rootGraphicsLayer(), 0);
> +    return textStream.release();
> +#else
> +    return String();
> +#endif
> +}

I'd expect this to walk the ScrollingTree nodes, not to just go to GraphicsLayers. Not all platforms will necessarily store scrolling tree info under GraphicsLayers.

I think you should split outs the scrollingTreeAsText changes into a separate bug.
Comment 16 Sami Kyöstilä 2012-06-20 08:53:31 PDT
(In reply to comment #15)
> I'd expect this to walk the ScrollingTree nodes, not to just go to GraphicsLayers. Not all platforms will necessarily store scrolling tree info under GraphicsLayers.

The problem is that the Chromium ScrollingCoordinator implementation doesn't really have a concept of a scrolling tree, so this is the best it can do. I'm open to suggestions on how to make the coordinator testable while allowing for multiple back-end implementations.
 
> I think you should split outs the scrollingTreeAsText changes into a separate bug.

Ok, I'll do that.
Comment 17 Sami Kyöstilä 2012-06-20 09:04:55 PDT
Created attachment 148580 [details]
Patch

- Removed scrolling tree test framework and test.
Comment 18 Simon Fraser (smfr) 2012-06-20 09:09:54 PDT
Comment on attachment 148580 [details]
Patch

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

> Source/WebCore/ChangeLog:19
> +        No new test because the scrolling tree isn't currently testable.

But can't you make a pixel test or ref test that would show the bug?
Comment 19 Sami Kyöstilä 2012-06-20 09:26:29 PDT
(In reply to comment #18)
> But can't you make a pixel test or ref test that would show the bug?

The problem is that the bug is triggered only if the scrolling coordinator tries to position the fixed layer independently of the main thread. In Chromium's case this happens if the compositor processes scroll input events and renders *before* it gets a chance to synchronize the layer tree with the main thread.

Since the layout tests are driven from the main thread, I'm not sure how to capture a snapshot of this intermediate state. For manual testing I usually tie up the main thread with some blocking JS to allow the compositor thread to work independently.

Cases like this are why I wanted to have a more formal way to test ScrollingCoordinator.
Comment 20 Sami Kyöstilä 2012-06-20 09:30:42 PDT
Testing the scrolling tree is now split off into bug 89576.
Comment 21 Adam Barth 2012-07-02 09:49:56 PDT
Comment on attachment 148580 [details]
Patch

There seems to be some controversy in Bug 89576 about how to test the scrolling tree.  Would it make senes to land this fix and continue discussing the testing issues in Bug 89576?
Comment 22 Sami Kyöstilä 2012-07-11 04:41:06 PDT
Any opinions about comment #21?
Comment 23 Simon Fraser (smfr) 2012-07-11 09:17:55 PDT
Comment on attachment 148580 [details]
Patch

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

> Source/WebCore/ChangeLog:8
> +        Render layers with CSS transforms should become containers for anyfixed

any/fixed

> Source/WebCore/rendering/RenderLayerBacking.cpp:455
> +            bool isContainer = m_owningLayer->hasTransform() && !renderer()->isRenderView();

We also use isRootLayer() for the renderview's layer.
Comment 24 Sami Kyöstilä 2012-07-11 10:17:20 PDT
Created attachment 151727 [details]
Patch

Fixed typo and used isRootLayer() instead of isRenderView()
Comment 25 WebKit Review Bot 2012-07-11 11:00:46 PDT
Comment on attachment 151727 [details]
Patch

Clearing flags on attachment: 151727

Committed r122343: <http://trac.webkit.org/changeset/122343>
Comment 26 WebKit Review Bot 2012-07-11 11:00:53 PDT
All reviewed patches have been landed.  Closing bug.