Changeset 141330 in webkit


Ignore:
Timestamp:
Jan 30, 2013, 3:22:25 PM (12 years ago)
Author:
Simon Fraser
Message:

Elements that dynamically become fixed sometimes jump to the top left on scrolling
https://bugs.webkit.org/show_bug.cgi?id=108389

Source/WebCore:

Reviewed by Beth Dakin.

When an element became position:fixed and gained a compositing layer
as a result, we would compute its viewport constraints (including the
last GraphicsLayer position) before we had actually updated the GraphicsLayer
geometry for the first time. This would cause a jump to 0,0 on scrolling.

Fix by removing the call to updateViewportConstraintStatus() just after
creating the backing. Instead, hook in to registerScrollingLayers(),
which is called on every geometry update, to update the viewport
constraints for this layer.

Tested via existing tests, which now show correct positions at last
layout.

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::registerScrollingLayers):

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::updateBacking):

LayoutTests:

Reviewed by Beth Dakin.

Update test results; these results now correctly reflect the last layout
positions.

  • platform/mac/tiled-drawing/fixed/absolute-inside-fixed-expected.txt:
  • platform/mac/tiled-drawing/fixed/absolute-inside-out-of-view-fixed-expected.txt:
  • platform/mac/tiled-drawing/fixed/fixed-in-overflow-expected.txt:
  • platform/mac/tiled-drawing/fixed/four-bars-expected.txt:
  • platform/mac/tiled-drawing/fixed/nested-fixed-expected.txt:
  • platform/mac/tiled-drawing/fixed/percentage-inside-fixed-expected.txt:
  • platform/mac/tiled-drawing/sticky/sticky-horizontal-expected.txt:
  • platform/mac/tiled-drawing/sticky/sticky-vertical-expected.txt:
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r141329 r141330  
     12013-01-30  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Elements that dynamically become fixed sometimes jump to the top left on scrolling
     4        https://bugs.webkit.org/show_bug.cgi?id=108389
     5
     6        Reviewed by Beth Dakin.
     7       
     8        Update test results; these results now correctly reflect the last layout
     9        positions.
     10
     11        * platform/mac/tiled-drawing/fixed/absolute-inside-fixed-expected.txt:
     12        * platform/mac/tiled-drawing/fixed/absolute-inside-out-of-view-fixed-expected.txt:
     13        * platform/mac/tiled-drawing/fixed/fixed-in-overflow-expected.txt:
     14        * platform/mac/tiled-drawing/fixed/four-bars-expected.txt:
     15        * platform/mac/tiled-drawing/fixed/nested-fixed-expected.txt:
     16        * platform/mac/tiled-drawing/fixed/percentage-inside-fixed-expected.txt:
     17        * platform/mac/tiled-drawing/sticky/sticky-horizontal-expected.txt:
     18        * platform/mac/tiled-drawing/sticky/sticky-vertical-expected.txt:
     19
    1202013-01-30  Jessie Berlin  <jberlin@apple.com>
    221
  • trunk/LayoutTests/platform/mac/tiled-drawing/fixed/absolute-inside-fixed-expected.txt

    r133536 r141330  
    77      (anchor edges: AnchorEdgeLeft AnchorEdgeTop)
    88      (viewport rect at last layout: 0.00 200.00 785.00 600.00)
    9       (layer position at last layout 8.00 8.00)
     9      (layer position at last layout 8.00 208.00)
    1010    )
    1111  )
  • trunk/LayoutTests/platform/mac/tiled-drawing/fixed/absolute-inside-out-of-view-fixed-expected.txt

    r133807 r141330  
    77      (anchor edges: AnchorEdgeLeft AnchorEdgeTop)
    88      (viewport rect at last layout: 0.00 200.00 785.00 600.00)
     9      (layer position at last layout 0.00 200.00)
    910    )
    1011  )
  • trunk/LayoutTests/platform/mac/tiled-drawing/fixed/fixed-in-overflow-expected.txt

    r133536 r141330  
    77      (anchor edges: AnchorEdgeLeft AnchorEdgeTop)
    88      (viewport rect at last layout: 0.00 200.00 785.00 600.00)
    9       (layer position at last layout 2.00 15.00)
     9      (layer position at last layout 2.00 215.00)
    1010    )
    1111  )
  • trunk/LayoutTests/platform/mac/tiled-drawing/fixed/four-bars-expected.txt

    r133536 r141330  
    77      (anchor edges: AnchorEdgeLeft AnchorEdgeTop)
    88      (viewport rect at last layout: 0.00 200.00 785.00 600.00)
     9      (layer position at last layout 0.00 200.00)
    910    )
    1011    (Fixed node
    1112      (anchor edges: AnchorEdgeLeft AnchorEdgeTop)
    1213      (viewport rect at last layout: 0.00 200.00 785.00 600.00)
    13       (layer position at last layout 10.00 200.00)
     14      (layer position at last layout 10.00 400.00)
    1415    )
    1516    (Fixed node
    1617      (anchor edges: AnchorEdgeRight AnchorEdgeTop)
    1718      (viewport rect at last layout: 0.00 200.00 785.00 600.00)
    18       (layer position at last layout 601.00 200.00)
     19      (layer position at last layout 601.00 400.00)
    1920    )
    2021    (Fixed node
    2122      (anchor edges: AnchorEdgeLeft AnchorEdgeBottom)
    2223      (viewport rect at last layout: 0.00 200.00 785.00 600.00)
    23       (layer position at last layout 0.00 516.00)
     24      (layer position at last layout 0.00 716.00)
    2425    )
    2526  )
  • trunk/LayoutTests/platform/mac/tiled-drawing/fixed/nested-fixed-expected.txt

    r138758 r141330  
    77      (anchor edges: AnchorEdgeLeft AnchorEdgeTop)
    88      (viewport rect at last layout: 0.00 200.00 785.00 600.00)
    9       (children 0
    10       )
     9      (layer position at last layout 0.00 200.00)
    1110    )
    1211  )
  • trunk/LayoutTests/platform/mac/tiled-drawing/fixed/percentage-inside-fixed-expected.txt

    r133536 r141330  
    77      (anchor edges: AnchorEdgeLeft AnchorEdgeTop)
    88      (viewport rect at last layout: 0.00 200.00 785.00 600.00)
    9       (layer position at last layout 0.00 13.00)
     9      (layer position at last layout 0.00 213.00)
    1010    )
    1111  )
  • trunk/LayoutTests/platform/mac/tiled-drawing/sticky/sticky-horizontal-expected.txt

    r138076 r141330  
    1212      (sticky box rect 812.00 25.00 300.00 60.00)
    1313      (sticky offset at last layout 8.00 0.00)
    14       (layer position at last layout 812.00 25.00)
     14      (layer position at last layout 820.00 25.00)
    1515    )
    1616    (Sticky node
     
    2121      (sticky box rect 812.00 93.00 300.00 60.00)
    2222      (sticky offset at last layout 0.00 0.00)
    23       (layer position at last layout 612.00 93.00)
     23      (layer position at last layout 812.00 93.00)
    2424    )
    2525    (Sticky node
     
    3030      (sticky box rect 812.00 161.00 300.00 60.00)
    3131      (sticky offset at last layout 148.00 0.00)
    32       (layer position at last layout 812.00 161.00)
     32      (layer position at last layout 960.00 161.00)
    3333    )
    3434    (Sticky node
     
    3939      (sticky box rect 812.00 229.00 300.00 60.00)
    4040      (sticky offset at last layout 0.00 0.00)
    41       (layer position at last layout 612.00 229.00)
     41      (layer position at last layout 812.00 229.00)
    4242    )
    4343    (Sticky node
     
    4949      (sticky box rect 812.00 297.00 300.00 60.00)
    5050      (sticky offset at last layout 8.00 0.00)
    51       (layer position at last layout 612.00 297.00)
     51      (layer position at last layout 820.00 297.00)
    5252    )
    5353    (Sticky node
     
    5959      (sticky box rect 812.00 365.00 300.00 60.00)
    6060      (sticky offset at last layout 148.00 0.00)
    61       (layer position at last layout 612.00 365.00)
     61      (layer position at last layout 960.00 365.00)
    6262    )
    6363  )
  • trunk/LayoutTests/platform/mac/tiled-drawing/sticky/sticky-vertical-expected.txt

    r138076 r141330  
    1616      (sticky box rect 73.00 558.00 80.00 300.00)
    1717      (sticky offset at last layout 0.00 42.00)
    18       (layer position at last layout 73.00 558.00)
     18      (layer position at last layout 73.00 600.00)
    1919    )
    2020    (Sticky node
     
    2525      (sticky box rect 163.00 558.00 80.00 300.00)
    2626      (sticky offset at last layout 0.00 0.00)
    27       (layer position at last layout 163.00 406.00)
     27      (layer position at last layout 163.00 558.00)
    2828    )
    2929    (Sticky node
     
    3434      (sticky box rect 253.00 558.00 80.00 300.00)
    3535      (sticky offset at last layout 0.00 142.00)
    36       (layer position at last layout 253.00 558.00)
     36      (layer position at last layout 253.00 700.00)
    3737    )
    3838    (Sticky node
     
    4343      (sticky box rect 343.00 558.00 80.00 300.00)
    4444      (sticky offset at last layout 0.00 0.00)
    45       (layer position at last layout 343.00 406.00)
     45      (layer position at last layout 343.00 558.00)
    4646    )
    4747    (Sticky node
     
    5353      (sticky box rect 433.00 558.00 80.00 300.00)
    5454      (sticky offset at last layout 0.00 42.00)
    55       (layer position at last layout 433.00 406.00)
     55      (layer position at last layout 433.00 600.00)
    5656    )
    5757    (Sticky node
     
    6363      (sticky box rect 523.00 558.00 80.00 300.00)
    6464      (sticky offset at last layout 0.00 142.00)
    65       (layer position at last layout 523.00 406.00)
     65      (layer position at last layout 523.00 700.00)
    6666    )
    6767  )
  • trunk/Source/WebCore/ChangeLog

    r141328 r141330  
     12013-01-30  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Elements that dynamically become fixed sometimes jump to the top left on scrolling
     4        https://bugs.webkit.org/show_bug.cgi?id=108389
     5
     6        Reviewed by Beth Dakin.
     7
     8        When an element became position:fixed and gained a compositing layer
     9        as a result, we would compute its viewport constraints (including the
     10        last GraphicsLayer position) before we had actually updated the GraphicsLayer
     11        geometry for the first time. This would cause a jump to 0,0 on scrolling.
     12       
     13        Fix by removing the call to updateViewportConstraintStatus() just after
     14        creating the backing. Instead, hook in to registerScrollingLayers(),
     15        which is called on every geometry update, to update the viewport
     16        constraints for this layer.
     17       
     18        Tested via existing tests, which now show correct positions at last
     19        layout.
     20
     21        * rendering/RenderLayerBacking.cpp:
     22        (WebCore::RenderLayerBacking::registerScrollingLayers):
     23        * rendering/RenderLayerCompositor.cpp:
     24        (WebCore::RenderLayerCompositor::updateBacking):
     25
    1262013-01-30  Adam Barth  <abarth@webkit.org>
    227
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r141039 r141330  
    824824        return;
    825825
     826    compositor()->updateViewportConstraintStatus(m_owningLayer);
     827
    826828    // FIXME: it would be nice to avoid all this work if the platform doesn't implement setLayerIsFixedToContainerLayer().
    827829    if (renderer()->style()->position() == FixedPosition || compositor()->fixedPositionedByAncestor(m_owningLayer))
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r141221 r141330  
    592592            layerChanged = true;
    593593        }
    594 
    595         // Need to add for every compositing layer, because a composited layer may change from being non-fixed to fixed.
    596         updateViewportConstraintStatus(layer);
    597594    } else {
    598595        if (layer->backing()) {
Note: See TracChangeset for help on using the changeset viewer.