Changeset 187271 in webkit


Ignore:
Timestamp:
Jul 23, 2015, 4:43:35 PM (11 years ago)
Author:
Simon Fraser
Message:

Layer z-ordering is incorrect when scrolling on page witih position:fixed
https://bugs.webkit.org/show_bug.cgi?id=147220
rdar://problem/15849697&21929247

Reviewed by Dean Jackson.

Source/WebCore:

Overlap testing for compositing uses the currently laid out position of fixed
elements, without taking into account the fact that async scrolling can move
them around, and possibly under other non-composited elements. This manifested
as position:fixed elements moving over other elements on some pages when
scrolling, when they should have moved behind.

Fix by expanding the overlap map entry for position:fixed elements to create
an rect for the area they cover at all scroll locations, taking min and max
scroll offsets into account.

Also add a couple more LOG(Compositing) statements.

Tests: compositing/layer-creation/fixed-overlap-extent-rtl.html

compositing/layer-creation/fixed-overlap-extent.html

  • rendering/RenderLayerCompositor.cpp:

(WebCore::fixedPositionOffset):
(WebCore::RenderLayerCompositor::computeExtent):
(WebCore::RenderLayerCompositor::needsFixedRootBackgroundLayer):
(WebCore::RenderLayerCompositor::rootBackgroundTransparencyChanged):

LayoutTests:

Tests that reveal the overlap area by creating lots of small layers, and dumping
the layer tree.

  • compositing/layer-creation/fixed-overlap-extent-expected.txt: Added.
  • compositing/layer-creation/fixed-overlap-extent-rtl-expected.txt: Added.
  • compositing/layer-creation/fixed-overlap-extent-rtl.html: Added.
  • compositing/layer-creation/fixed-overlap-extent.html: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r187269 r187271  
     12015-07-22  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Layer z-ordering is incorrect when scrolling on page witih position:fixed
     4        https://bugs.webkit.org/show_bug.cgi?id=147220
     5        rdar://problem/15849697&21929247
     6
     7        Reviewed by Dean Jackson.
     8
     9        Tests that reveal the overlap area by creating lots of small layers, and dumping
     10        the layer tree.
     11
     12        * compositing/layer-creation/fixed-overlap-extent-expected.txt: Added.
     13        * compositing/layer-creation/fixed-overlap-extent-rtl-expected.txt: Added.
     14        * compositing/layer-creation/fixed-overlap-extent-rtl.html: Added.
     15        * compositing/layer-creation/fixed-overlap-extent.html: Added.
     16
    1172015-07-23  Brian J. Burg  <burg@cs.washington.edu>
    218
  • trunk/Source/WebCore/ChangeLog

    r187262 r187271  
     12015-07-22  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Layer z-ordering is incorrect when scrolling on page witih position:fixed
     4        https://bugs.webkit.org/show_bug.cgi?id=147220
     5        rdar://problem/15849697&21929247
     6
     7        Reviewed by Dean Jackson.
     8
     9        Overlap testing for compositing uses the currently laid out position of fixed
     10        elements, without taking into account the fact that async scrolling can move
     11        them around, and possibly under other non-composited elements. This manifested
     12        as position:fixed elements moving over other elements on some pages when
     13        scrolling, when they should have moved behind.
     14       
     15        Fix by expanding the overlap map entry for position:fixed elements to create
     16        an rect for the area they cover at all scroll locations, taking min and max
     17        scroll offsets into account.
     18       
     19        Also add a couple more LOG(Compositing) statements.
     20
     21        Tests: compositing/layer-creation/fixed-overlap-extent-rtl.html
     22               compositing/layer-creation/fixed-overlap-extent.html
     23
     24        * rendering/RenderLayerCompositor.cpp:
     25        (WebCore::fixedPositionOffset):
     26        (WebCore::RenderLayerCompositor::computeExtent):
     27        (WebCore::RenderLayerCompositor::needsFixedRootBackgroundLayer):
     28        (WebCore::RenderLayerCompositor::rootBackgroundTransparencyChanged):
     29
    1302015-07-23  Jer Noble  <jer.noble@apple.com>
    231
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r186911 r187271  
    11661166}
    11671167
     1168#if PLATFORM(IOS)
     1169// FIXME: Share with RenderView.
     1170static inline LayoutSize fixedPositionOffset(const FrameView& frameView)
     1171{
     1172    return frameView.useCustomFixedPositionLayoutRect() ? (frameView.customFixedPositionLayoutRect().location() - LayoutPoint()) : frameView.scrollOffset();
     1173}
     1174#endif
     1175
    11681176void RenderLayerCompositor::computeExtent(const OverlapMap& overlapMap, const RenderLayer& layer, OverlapExtent& extent) const
    11691177{
     
    11841192    if (extent.bounds.isEmpty())
    11851193        extent.bounds.setSize(LayoutSize(1, 1));
     1194
     1195
     1196    RenderLayerModelObject& renderer = layer.renderer();
     1197    if (renderer.isOutOfFlowPositioned() && renderer.style().position() == FixedPosition && renderer.container() == &m_renderView) {
     1198        // Because fixed elements get moved around without re-computing overlap, we have to compute an overlap
     1199        // rect that covers all the locations that the fixed element could move to.
     1200        // FIXME: need to handle sticky too.
     1201        LayoutRect viewportRect;
     1202        if (m_renderView.frameView().useFixedLayout())
     1203            viewportRect = m_renderView.unscaledDocumentRect();
     1204        else
     1205            viewportRect = m_renderView.frameView().viewportConstrainedVisibleContentRect();
     1206
     1207#if PLATFORM(IOS)
     1208        LayoutSize scrollPosition = fixedPositionOffset(m_renderView.frameView());
     1209#else
     1210        LayoutSize scrollPosition = m_renderView.frameView().scrollOffsetForFixedPosition();
     1211#endif
     1212
     1213        LayoutPoint minimumScrollPosition = m_renderView.frameView().minimumScrollPosition();
     1214        LayoutPoint maximumScrollPosition = m_renderView.frameView().maximumScrollPosition();
     1215       
     1216        LayoutSize topLeftExpansion = scrollPosition - toLayoutSize(minimumScrollPosition);
     1217        LayoutSize bottomRightExpansion = toLayoutSize(maximumScrollPosition) - scrollPosition;
     1218
     1219        extent.bounds.setLocation(extent.bounds.location() - topLeftExpansion);
     1220        extent.bounds.setSize(extent.bounds.size() + topLeftExpansion + bottomRightExpansion);
     1221    }
    11861222
    11871223    extent.extentComputed = true;
     
    28542890        return false;
    28552891
     2892    LOG(Compositing, "RenderLayerCompositor %p needsFixedRootBackgroundLayer returning %d", this, supportsFixedRootBackgroundCompositing() && m_renderView.rootBackgroundIsEntirelyFixed());
     2893
    28562894    return supportsFixedRootBackgroundCompositing() && m_renderView.rootBackgroundIsEntirelyFixed();
    28572895}
     
    32053243
    32063244    bool isTransparent = viewHasTransparentBackground();
     3245
     3246    LOG(Compositing, "RenderLayerCompositor %p rootBackgroundTransparencyChanged. isTransparent=%d, changed=%d", this, isTransparent, m_viewBackgroundIsTransparent == isTransparent);
    32073247    if (m_viewBackgroundIsTransparent == isTransparent)
    32083248        return;
Note: See TracChangeset for help on using the changeset viewer.