Changeset 170462 in webkit


Ignore:
Timestamp:
Jun 25, 2014, 9:15:50 PM (11 years ago)
Author:
Simon Fraser
Message:

[iOS WK2] Fixed position elements jump around when zooming
https://bugs.webkit.org/show_bug.cgi?id=134328
<rdar://problem/17447048>

Reviewed by Zalan Bujtas.

If a given remote layer tree commit contains changes of layers for viewport-constrained
objects, then the associated scrolling tree also needs to show that the layers changed,
since we need to re-run the "viewport changed" logic in the UI process to get the
layers correctly positioned for the current zoom level.

The bug was that page scale changes resulted in small "pixel alignment" position
changes which touched layers, but we didn't commit any scrolling tree changes. So
the scrolling tree commit would result in visibly stale layer positions, with no scrolling tree
update to adjust them for the current transient zoom.

Fix by making use of the existing "alignment offset" field in the ViewportConstraints
data, and having RemoteScrollingCoordinatorProxy::connectStateNodeLayers() note that
fixed or sticky layers changed if any properties of fixed or sticky scrolling tree
nodes were updated.

Source/WebCore:

  • page/scrolling/ScrollingConstraints.h:

(WebCore::StickyPositionViewportConstraints::operator==):

  • platform/graphics/GraphicsLayer.h:

(WebCore::GraphicsLayer::pixelAlignmentOffset):

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::updateGeometry):

  • platform/graphics/ca/GraphicsLayerCA.h:
  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::computeFixedViewportConstraints):
(WebCore::RenderLayerCompositor::computeStickyViewportConstraints):

Source/WebKit2:

  • UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:

(WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):

Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r170461 r170462  
     12014-06-25  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] Fixed position elements jump around when zooming
     4        https://bugs.webkit.org/show_bug.cgi?id=134328
     5        <rdar://problem/17447048>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        If a given remote layer tree commit contains changes of layers for viewport-constrained
     10        objects, then the associated scrolling tree also needs to show that the layers changed,
     11        since we need to re-run the "viewport changed" logic in the UI process to get the
     12        layers correctly positioned for the current zoom level.
     13       
     14        The bug was that page scale changes resulted in small "pixel alignment" position
     15        changes which touched layers, but we didn't commit any scrolling tree changes. So
     16        the scrolling tree commit would result in visibly stale layer positions, with no scrolling tree
     17        update to adjust them for the current transient zoom.
     18
     19        Fix by making use of the existing "alignment offset" field in the ViewportConstraints
     20        data, and having RemoteScrollingCoordinatorProxy::connectStateNodeLayers() note that
     21        fixed or sticky layers changed if any properties of fixed or sticky scrolling tree
     22        nodes were updated.
     23
     24        * page/scrolling/ScrollingConstraints.h:
     25        (WebCore::StickyPositionViewportConstraints::operator==):
     26        * platform/graphics/GraphicsLayer.h:
     27        (WebCore::GraphicsLayer::pixelAlignmentOffset):
     28        * platform/graphics/ca/GraphicsLayerCA.cpp:
     29        (WebCore::GraphicsLayerCA::updateGeometry):
     30        * platform/graphics/ca/GraphicsLayerCA.h:
     31        * rendering/RenderLayerCompositor.cpp:
     32        (WebCore::RenderLayerCompositor::computeFixedViewportConstraints):
     33        (WebCore::RenderLayerCompositor::computeStickyViewportConstraints):
     34
    1352014-06-25  Simon Fraser  <simon.fraser@apple.com>
    236
  • trunk/Source/WebCore/page/scrolling/ScrollingConstraints.h

    r162139 r170462  
    168168    bool operator==(const StickyPositionViewportConstraints& other) const
    169169    {
    170         return m_leftOffset == other.m_leftOffset
     170        return m_alignmentOffset == other.m_alignmentOffset
     171            && m_anchorEdges == other.m_anchorEdges
     172            && m_leftOffset == other.m_leftOffset
    171173            && m_rightOffset == other.m_rightOffset
    172174            && m_topOffset == other.m_topOffset
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.h

    r170071 r170462  
    463463    bool hasFlattenedPerspectiveTransform() const { return !preserves3D() && m_childrenTransform.hasPerspective(); }
    464464#endif
     465    virtual FloatSize pixelAlignmentOffset() const { return FloatSize(); }
    465466   
    466467    virtual void setAppliesPageScale(bool appliesScale = true) { m_appliesPageScale = appliesScale; }
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r170071 r170462  
    15211521    }
    15221522
     1523    m_pixelAlignmentOffset = pixelAlignmentOffset;
     1524
    15231525    // Push the layer to device pixel boundary (setPosition()), but move the content back to its original position (setBounds())
    15241526    m_layer->setPosition(adjustedPosition);
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r170071 r170462  
    146146
    147147    virtual void deviceOrPageScaleFactorChanged() override;
     148
     149    virtual FloatSize pixelAlignmentOffset() const override { return m_pixelAlignmentOffset; }
    148150
    149151    struct CommitState {
     
    529531    Vector<FloatRect> m_dirtyRects;
    530532
     533    FloatSize m_pixelAlignmentOffset;
     534
    531535    LayerChangeFlags m_uncommittedChanges;
    532536    bool m_isCommittingChanges;
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r170417 r170462  
    35373537    constraints.setLayerPositionAtLastLayout(graphicsLayer->position());
    35383538    constraints.setViewportRectAtLastLayout(viewportRect);
     3539    constraints.setAlignmentOffset(graphicsLayer->pixelAlignmentOffset());
    35393540
    35403541    const RenderStyle& style = layer.renderer().style();
     
    35803581    constraints.setLayerPositionAtLastLayout(graphicsLayer->position());
    35813582    constraints.setStickyOffsetAtLastLayout(renderer.stickyPositionOffset());
     3583    constraints.setAlignmentOffset(graphicsLayer->pixelAlignmentOffset());
    35823584
    35833585    return constraints;
  • trunk/Source/WebKit2/ChangeLog

    r170460 r170462  
     12014-06-25  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] Fixed position elements jump around when zooming
     4        https://bugs.webkit.org/show_bug.cgi?id=134328
     5        <rdar://problem/17447048>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        If a given remote layer tree commit contains changes of layers for viewport-constrained
     10        objects, then the associated scrolling tree also needs to show that the layers changed,
     11        since we need to re-run the "viewport changed" logic in the UI process to get the
     12        layers correctly positioned for the current zoom level.
     13       
     14        The bug was that page scale changes resulted in small "pixel alignment" position
     15        changes which touched layers, but we didn't commit any scrolling tree changes. So
     16        the scrolling tree commit would result in visibly stale layer positions, with no scrolling tree
     17        update to adjust them for the current transient zoom.
     18
     19        Fix by making use of the existing "alignment offset" field in the ViewportConstraints
     20        data, and having RemoteScrollingCoordinatorProxy::connectStateNodeLayers() note that
     21        fixed or sticky layers changed if any properties of fixed or sticky scrolling tree
     22        nodes were updated.
     23
     24        * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
     25        (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
     26
    1272014-06-25  Benjamin Poulain  <bpoulain@apple.com>
    228
  • trunk/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm

    r169791 r170462  
    7979        }
    8080        case FixedNode:
    81             if (currNode->hasChangedProperty(ScrollingStateNode::ScrollLayer)) {
     81            if (currNode->hasChangedProperty(ScrollingStateNode::ScrollLayer))
    8282                currNode->setLayer(layerRepresentationFromLayerOrView(layerTreeHost.getLayer(currNode->layer())));
    83                 fixedOrStickyLayerChanged = true;
    84             }
     83           
     84            fixedOrStickyLayerChanged |= currNode->hasChangedProperties();
    8585            break;
    8686        case StickyNode:
    87             if (currNode->hasChangedProperty(ScrollingStateNode::ScrollLayer)) {
     87            if (currNode->hasChangedProperty(ScrollingStateNode::ScrollLayer))
    8888                currNode->setLayer(layerRepresentationFromLayerOrView(layerTreeHost.getLayer(currNode->layer())));
    89                 fixedOrStickyLayerChanged = true;
    90             }
     89
     90            fixedOrStickyLayerChanged |= currNode->hasChangedProperties();
    9191            break;
    9292        }
Note: See TracChangeset for help on using the changeset viewer.