- Revision
- 113983
- Author
- [email protected]
- Date
- 2012-04-12 08:35:13 -0700 (Thu, 12 Apr 2012)
Log 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):
Modified Paths
Added Paths
Diff
Modified: trunk/ChangeLog (113982 => 113983)
--- trunk/ChangeLog 2012-04-12 15:32:21 UTC (rev 113982)
+++ trunk/ChangeLog 2012-04-12 15:35:13 UTC (rev 113983)
@@ -1,3 +1,12 @@
+2012-04-12 Yael Aharon <[email protected]>
+
+ [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.
+
2012-03-15 Martin Robinson <[email protected]>
[CAIRO] Make GLContextGLX a subclass of GLContext
Added: trunk/ManualTests/nested-fixed-position.html (0 => 113983)
--- trunk/ManualTests/nested-fixed-position.html (rev 0)
+++ trunk/ManualTests/nested-fixed-position.html 2012-04-12 15:35:13 UTC (rev 113983)
@@ -0,0 +1,93 @@
+<html><head>
+
+<meta content="text/html; charset=windows-1251" http-equiv="Content-Type">
+<style>
+.d1{position:fixed;top:50%;right:50%;z-index:2;overflow:hidden;}
+.d2{position:fixed;bottom:0;left:0;z-index:2;width:100%;background-color:darkgray;}
+.o {background:green;height:40px;width:200px;}
+.t { width:2000px; height:198px;background-color: lightgray; border: 1px solid blue;}
+body { margin: 0px; }
+</style>
+<script>
+function remove_fixed()
+{
+ document.getElementById("d2").style.position = "static";
+}
+
+function add_fixed()
+{
+ document.getElementById("d2").style.position = "fixed";
+}
+
+</script>
+</head>
+<body>
+<div class="d2" id="d2">This is the parent div.
+<div class="d1" id="d1"><div class="o">This is the nested div.</div></div>
+</div>
+<div class="t">
+000
+</div>
+<div class="t">
+200
+</div>
+<div class="t">
+400<br>
+<button _onclick_="remove_fixed();">remove fixed</button>
+</div>
+<div class="t">
+600<br>
+<button _onclick_="add_fixed();">add fixed</button>
+</div>
+<div class="t">
+800
+</div>
+<div class="t">
+1000
+</div>
+<div class="t">
+1200
+</div>
+<div class="t">
+1400
+</div>
+<div class="t">
+1600
+</div>
+<div class="t">
+1800
+</div>
+<div class="t">
+2000
+</div>
+<div class="t">
+2200
+</div>
+<div class="t">
+2400
+</div>
+<div class="t">
+2600
+</div>
+<div class="t">
+2800
+</div>
+<div class="t">
+3000
+</div>
+<div class="t">
+3200
+</div>
+<div class="t">
+3400
+</div>
+<div class="t">
+3600
+</div>
+<div class="t">
+3800
+</div>
+<div class="t">
+4000
+</div>
+</body></html>
Modified: trunk/Source/WebCore/ChangeLog (113982 => 113983)
--- trunk/Source/WebCore/ChangeLog 2012-04-12 15:32:21 UTC (rev 113982)
+++ trunk/Source/WebCore/ChangeLog 2012-04-12 15:35:13 UTC (rev 113983)
@@ -1,3 +1,29 @@
+2012-04-12 Yael Aharon <[email protected]>
+
+ [Qt][WK2] Nested fixed elements scroll too fast
+ https://bugs.webkit.org/show_bug.cgi?id=83720
+
+ Reviewed by Noam Rosenthal.
+
+ 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):
+
2012-04-12 Charles Wei <[email protected]>
[BlackBerry] Revert the patch for 82764
Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp (113982 => 113983)
--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp 2012-04-12 15:32:21 UTC (rev 113982)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp 2012-04-12 15:35:13 UTC (rev 113983)
@@ -29,6 +29,7 @@
, m_layer(adoptPtr(new TextureMapperLayer()))
, m_changeMask(0)
, m_needsDisplay(false)
+ , m_fixedToViewport(false)
, m_contentsLayer(0)
, m_animationStartedTimer(this, &GraphicsLayerTextureMapper::animationStartedTimerFired)
{
Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h (113982 => 113983)
--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h 2012-04-12 15:32:21 UTC (rev 113982)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h 2012-04-12 15:35:13 UTC (rev 113983)
@@ -94,6 +94,9 @@
virtual bool setFilters(const FilterOperations&);
#endif
+ void setFixedToViewport(bool fixed) { m_fixedToViewport = fixed; }
+ bool fixedToViewport() const { return m_fixedToViewport; }
+
private:
virtual void willBeDestroyed();
@@ -103,6 +106,7 @@
bool m_syncQueued;
int m_changeMask;
bool m_needsDisplay;
+ bool m_fixedToViewport;
TextureMapperPlatformLayer* m_contentsLayer;
FloatRect m_needsDisplayRect;
TextureMapperAnimations m_animations;
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (113982 => 113983)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp 2012-04-12 15:32:21 UTC (rev 113982)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp 2012-04-12 15:35:13 UTC (rev 113983)
@@ -427,6 +427,7 @@
#if ENABLE(CSS_FILTERS)
m_state.filters = graphicsLayer->filters();
#endif
+ m_fixedToViewport = graphicsLayer->fixedToViewport();
m_state.needsDisplay = m_state.needsDisplay || graphicsLayer->needsDisplay();
if (!m_state.needsDisplay)
@@ -511,12 +512,26 @@
}
}
-void TextureMapperLayer::setScrollPositionDelta(const IntPoint& delta)
+bool TextureMapperLayer::isAncestorFixedToViewport() const
{
+ for (TextureMapperLayer* parent = m_parent; parent; parent = parent->m_parent) {
+ if (parent->m_fixedToViewport)
+ return true;
+ }
+
+ return false;
+}
+
+void TextureMapperLayer::setScrollPositionDeltaIfNeeded(const IntPoint& delta)
+{
// delta is the difference between the scroll offset in the ui process and the scroll offset
// in the web process. We add this delta to the position of fixed layers, to make
- // sure that they do not move while scrolling.
- m_scrollPositionDelta = delta;
+ // sure that they do not move while scrolling. We need to reset this delta to fixed layers
+ // that have an ancestor which is also a fixed layer, because the delta will be added to the ancestor.
+ if (isAncestorFixedToViewport())
+ m_scrollPositionDelta = IntPoint();
+ else
+ m_scrollPositionDelta = delta;
m_transform.setPosition(m_state.pos + m_scrollPositionDelta);
}
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h (113982 => 113983)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h 2012-04-12 15:32:21 UTC (rev 113982)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h 2012-04-12 15:35:13 UTC (rev 113983)
@@ -126,7 +126,8 @@
PassRefPtr<TextureMapperBackingStore> backingStore() { return m_backingStore; }
void clearBackingStoresRecursive();
- void setScrollPositionDelta(const IntPoint&);
+ void setScrollPositionDeltaIfNeeded(const IntPoint&);
+ void setFixedToViewport(bool fixed) { m_fixedToViewport = fixed; }
private:
TextureMapperLayer* rootLayer();
@@ -145,6 +146,7 @@
static void sortByZOrder(Vector<TextureMapperLayer* >& array, int first, int last);
PassRefPtr<BitmapTexture> texture() { return m_backingStore ? m_backingStore->texture() : 0; }
+ bool isAncestorFixedToViewport() const;
void paintRecursive(const TextureMapperPaintOptions&);
void paintSelf(const TextureMapperPaintOptions&);
@@ -220,6 +222,7 @@
TextureMapper* m_textureMapper;
TextureMapperAnimations m_animations;
IntPoint m_scrollPositionDelta;
+ bool m_fixedToViewport;
};
Modified: trunk/Source/WebKit2/ChangeLog (113982 => 113983)
--- trunk/Source/WebKit2/ChangeLog 2012-04-12 15:32:21 UTC (rev 113982)
+++ trunk/Source/WebKit2/ChangeLog 2012-04-12 15:35:13 UTC (rev 113983)
@@ -1,3 +1,17 @@
+2012-04-12 Yael Aharon <[email protected]>
+
+ [Qt][WK2] Nested fixed elements scroll too fast
+ https://bugs.webkit.org/show_bug.cgi?id=83720
+
+ Reviewed by Noam Rosenthal.
+
+ 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):
+
2012-04-12 Kenneth Rohde Christiansen <[email protected]>
Move viewport meta handling to the web process side
Modified: trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp (113982 => 113983)
--- trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp 2012-04-12 15:32:21 UTC (rev 113982)
+++ trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp 2012-04-12 15:35:13 UTC (rev 113983)
@@ -179,7 +179,7 @@
LayerMap::iterator end = m_fixedLayers.end();
for (LayerMap::iterator it = m_fixedLayers.begin(); it != end; ++it)
- toTextureMapperLayer(it->second)->setScrollPositionDelta(IntPoint(scrollPosition.x() - m_renderedContentsScrollPosition.x(), scrollPosition.y() - m_renderedContentsScrollPosition.y()));
+ toTextureMapperLayer(it->second)->setScrollPositionDeltaIfNeeded(IntPoint(scrollPosition.x() - m_renderedContentsScrollPosition.x(), scrollPosition.y() - m_renderedContentsScrollPosition.y()));
}
void WebLayerTreeRenderer::didChangeScrollPosition(const IntPoint& position)
@@ -226,6 +226,7 @@
layer->setContentsOpaque(layerInfo.contentsOpaque);
layer->setContentsRect(layerInfo.contentsRect);
layer->setDrawsContent(layerInfo.drawsContent);
+ toGraphicsLayerTextureMapper(layer)->setFixedToViewport(layerInfo.fixedToViewport);
if (layerInfo.fixedToViewport)
m_fixedLayers.add(id, layer);