Changeset 113983 in webkit


Ignore:
Timestamp:
Apr 12, 2012 8:35:13 AM (12 years ago)
Author:
yael.aharon@nokia.com
Message:

[Qt][WK2] Nested fixed elements scroll too fast
https://bugs.webkit.org/show_bug.cgi?id=83720

Reviewed by Noam Rosenthal.

.:

  • ManualTests/nested-fixed-position.html: Added.

Source/WebCore:

Before setting the scrollPositionDelta to a fixed layer, check if it has an ancestor which also has fixed position.
If it does, do not set scrollPositionDelta.
Added a flag to TextureMapperLayer and GraphicsLayerTextureMapper indicating if it is a fixed position layer.

  • platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:

(WebCore::GraphicsLayerTextureMapper::GraphicsLayerTextureMapper):

  • platform/graphics/texmap/GraphicsLayerTextureMapper.h:

(WebCore::GraphicsLayerTextureMapper::setFixedToViewport):
(WebCore::GraphicsLayerTextureMapper::fixedToViewport):
(GraphicsLayerTextureMapper):

  • platform/graphics/texmap/TextureMapperLayer.cpp:

(WebCore::TextureMapperLayer::syncCompositingStateSelf):
(WebCore::TextureMapperLayer::isAncestorFixedToViewport):
(WebCore):
(WebCore::TextureMapperLayer::setScrollPositionDeltaIfNeeded):

  • platform/graphics/texmap/TextureMapperLayer.h:

(TextureMapperLayer):
(WebCore::TextureMapperLayer::setFixedToViewport):

Source/WebKit2:

Set the fixedToViewport flag on the fixed position layers and adjust to
the new function name for setting scrollPositionDelta.

  • UIProcess/WebLayerTreeRenderer.cpp:

(WebKit::WebLayerTreeRenderer::adjustPositionForFixedLayers):
(WebKit::WebLayerTreeRenderer::setLayerState):

Location:
trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r113909 r113983  
     12012-04-12  Yael Aharon  <yael.aharon@nokia.com>
     2
     3        [Qt][WK2] Nested fixed elements scroll too fast
     4        https://bugs.webkit.org/show_bug.cgi?id=83720
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        * ManualTests/nested-fixed-position.html: Added.
     9
    1102012-03-15  Martin Robinson  <mrobinson@igalia.com>
    211
  • trunk/Source/WebCore/ChangeLog

    r113976 r113983  
     12012-04-12  Yael Aharon  <yael.aharon@nokia.com>
     2
     3        [Qt][WK2] Nested fixed elements scroll too fast
     4        https://bugs.webkit.org/show_bug.cgi?id=83720
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        Before setting the scrollPositionDelta to a fixed layer, check if it has an ancestor which also has fixed position.
     9        If it does, do not set scrollPositionDelta.
     10        Added a flag to TextureMapperLayer and GraphicsLayerTextureMapper indicating if it is a fixed position layer.
     11
     12        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
     13        (WebCore::GraphicsLayerTextureMapper::GraphicsLayerTextureMapper):
     14        * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
     15        (WebCore::GraphicsLayerTextureMapper::setFixedToViewport):
     16        (WebCore::GraphicsLayerTextureMapper::fixedToViewport):
     17        (GraphicsLayerTextureMapper):
     18        * platform/graphics/texmap/TextureMapperLayer.cpp:
     19        (WebCore::TextureMapperLayer::syncCompositingStateSelf):
     20        (WebCore::TextureMapperLayer::isAncestorFixedToViewport):
     21        (WebCore):
     22        (WebCore::TextureMapperLayer::setScrollPositionDeltaIfNeeded):
     23        * platform/graphics/texmap/TextureMapperLayer.h:
     24        (TextureMapperLayer):
     25        (WebCore::TextureMapperLayer::setFixedToViewport):
     26
    1272012-04-12  Charles Wei  <charles.wei@torchmobile.com.cn>
    228
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp

    r113135 r113983  
    3030    , m_changeMask(0)
    3131    , m_needsDisplay(false)
     32    , m_fixedToViewport(false)
    3233    , m_contentsLayer(0)
    3334    , m_animationStartedTimer(this, &GraphicsLayerTextureMapper::animationStartedTimerFired)
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h

    r113135 r113983  
    9595#endif
    9696
     97    void setFixedToViewport(bool fixed) { m_fixedToViewport = fixed; }
     98    bool fixedToViewport() const { return m_fixedToViewport; }
     99
    97100private:
    98101    virtual void willBeDestroyed();
     
    104107    int m_changeMask;
    105108    bool m_needsDisplay;
     109    bool m_fixedToViewport;
    106110    TextureMapperPlatformLayer* m_contentsLayer;
    107111    FloatRect m_needsDisplayRect;
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp

    r113791 r113983  
    428428    m_state.filters = graphicsLayer->filters();
    429429#endif
     430    m_fixedToViewport = graphicsLayer->fixedToViewport();
    430431
    431432    m_state.needsDisplay = m_state.needsDisplay || graphicsLayer->needsDisplay();
     
    512513}
    513514
    514 void TextureMapperLayer::setScrollPositionDelta(const IntPoint& delta)
     515bool TextureMapperLayer::isAncestorFixedToViewport() const
     516{
     517    for (TextureMapperLayer* parent = m_parent; parent; parent = parent->m_parent) {
     518        if (parent->m_fixedToViewport)
     519            return true;
     520    }
     521
     522    return false;
     523}
     524
     525void TextureMapperLayer::setScrollPositionDeltaIfNeeded(const IntPoint& delta)
    515526{
    516527    // delta is the difference between the scroll offset in the ui process and the scroll offset
    517528    // in the web process. We add this delta to the position of fixed layers, to make
    518     // sure that they do not move while scrolling.
    519     m_scrollPositionDelta = delta;
     529    // sure that they do not move while scrolling. We need to reset this delta to fixed layers
     530    // that have an ancestor which is also a fixed layer, because the delta will be added to the ancestor.
     531    if (isAncestorFixedToViewport())
     532        m_scrollPositionDelta = IntPoint();
     533    else
     534        m_scrollPositionDelta = delta;
    520535    m_transform.setPosition(m_state.pos + m_scrollPositionDelta);
    521536}
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h

    r113791 r113983  
    127127    void clearBackingStoresRecursive();
    128128
    129     void setScrollPositionDelta(const IntPoint&);
     129    void setScrollPositionDeltaIfNeeded(const IntPoint&);
     130    void setFixedToViewport(bool fixed) { m_fixedToViewport = fixed; }
    130131
    131132private:
     
    146147
    147148    PassRefPtr<BitmapTexture> texture() { return m_backingStore ? m_backingStore->texture() : 0; }
     149    bool isAncestorFixedToViewport() const;
    148150
    149151    void paintRecursive(const TextureMapperPaintOptions&);
     
    221223    TextureMapperAnimations m_animations;
    222224    IntPoint m_scrollPositionDelta;
     225    bool m_fixedToViewport;
    223226};
    224227
  • trunk/Source/WebKit2/ChangeLog

    r113974 r113983  
     12012-04-12  Yael Aharon  <yael.aharon@nokia.com>
     2
     3        [Qt][WK2] Nested fixed elements scroll too fast
     4        https://bugs.webkit.org/show_bug.cgi?id=83720
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        Set the fixedToViewport flag on the fixed position layers and adjust to
     9        the new function name for setting scrollPositionDelta.
     10
     11        * UIProcess/WebLayerTreeRenderer.cpp:
     12        (WebKit::WebLayerTreeRenderer::adjustPositionForFixedLayers):
     13        (WebKit::WebLayerTreeRenderer::setLayerState):
     14
    1152012-04-12  Kenneth Rohde Christiansen  <kenneth@webkit.org>
    216
  • trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp

    r113859 r113983  
    180180    LayerMap::iterator end = m_fixedLayers.end();
    181181    for (LayerMap::iterator it = m_fixedLayers.begin(); it != end; ++it)
    182         toTextureMapperLayer(it->second)->setScrollPositionDelta(IntPoint(scrollPosition.x() - m_renderedContentsScrollPosition.x(), scrollPosition.y() - m_renderedContentsScrollPosition.y()));
     182        toTextureMapperLayer(it->second)->setScrollPositionDeltaIfNeeded(IntPoint(scrollPosition.x() - m_renderedContentsScrollPosition.x(), scrollPosition.y() - m_renderedContentsScrollPosition.y()));
    183183}
    184184
     
    227227    layer->setContentsRect(layerInfo.contentsRect);
    228228    layer->setDrawsContent(layerInfo.drawsContent);
     229    toGraphicsLayerTextureMapper(layer)->setFixedToViewport(layerInfo.fixedToViewport);
    229230
    230231    if (layerInfo.fixedToViewport)
Note: See TracChangeset for help on using the changeset viewer.