Title: [124012] trunk/Source
Revision
124012
Author
jocelyn.turco...@nokia.com
Date
2012-07-30 04:31:27 -0700 (Mon, 30 Jul 2012)

Log Message

[Qt] Fix issues remaining with fixed positioned layers
https://bugs.webkit.org/show_bug.cgi?id=92528

Reviewed by Noam Rosenthal.

Source/WebCore:

* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::syncCompositingStateSelf):
Make sure that the delta is used when syncCompositingStateSelf is called afterward.
(WebCore::TextureMapperLayer::setScrollPositionDeltaIfNeeded):
* platform/graphics/texmap/TextureMapperLayer.h:
Use a FloatSize instead of an IntPoint for the delta.
(TextureMapperLayer):
(WebCore::TextureMapperLayer::adjustedPosition):

Source/WebKit2:

This partially fixes jittering of fixed layers when zoomed in and the
blurriness of rendered tiles of the non-composited contents layer.

* UIProcess/WebLayerTreeRenderer.cpp:
(WebKit::boundedScrollPosition):
(WebKit::WebLayerTreeRenderer::paintToCurrentGLContext):
Remove the adjustment on the root layer. This cancels setPixelAligned and causes the blurriness.
(WebKit::WebLayerTreeRenderer::adjustPositionForFixedLayers):
Use m_accurateVisibleContentsPosition to calculate the delta.
(WebKit::WebLayerTreeRenderer::didChangeScrollPosition):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (124011 => 124012)


--- trunk/Source/WebCore/ChangeLog	2012-07-30 10:33:43 UTC (rev 124011)
+++ trunk/Source/WebCore/ChangeLog	2012-07-30 11:31:27 UTC (rev 124012)
@@ -1,3 +1,19 @@
+2012-07-27  Jocelyn Turcotte  <jocelyn.turco...@nokia.com>
+
+        [Qt] Fix issues remaining with fixed positioned layers
+        https://bugs.webkit.org/show_bug.cgi?id=92528
+
+        Reviewed by Noam Rosenthal.
+
+        * platform/graphics/texmap/TextureMapperLayer.cpp:
+        (WebCore::TextureMapperLayer::syncCompositingStateSelf):
+        Make sure that the delta is used when syncCompositingStateSelf is called afterward.
+        (WebCore::TextureMapperLayer::setScrollPositionDeltaIfNeeded):
+        * platform/graphics/texmap/TextureMapperLayer.h:
+        Use a FloatSize instead of an IntPoint for the delta.
+        (TextureMapperLayer):
+        (WebCore::TextureMapperLayer::adjustedPosition):
+
 2012-07-30  Patrick Gansterer  <par...@webkit.org>
 
         Replace UnicodeWinCE with UnicodeWchar

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (124011 => 124012)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2012-07-30 10:33:43 UTC (rev 124011)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2012-07-30 11:31:27 UTC (rev 124012)
@@ -487,7 +487,7 @@
         m_state.needsDisplayRect.unite(graphicsLayer->needsDisplayRect());
     m_contentsLayer = graphicsLayer->contentsLayer();
 
-    m_transform.setPosition(m_state.pos);
+    m_transform.setPosition(adjustedPosition());
     m_transform.setAnchorPoint(m_state.anchorPoint);
     m_transform.setSize(m_state.size);
     m_transform.setFlattening(!m_state.preserves3D);
@@ -567,17 +567,17 @@
     return false;
 }
 
-void TextureMapperLayer::setScrollPositionDeltaIfNeeded(const IntPoint& delta)
+void TextureMapperLayer::setScrollPositionDeltaIfNeeded(const FloatSize& 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. 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();
+        m_scrollPositionDelta = FloatSize();
     else
         m_scrollPositionDelta = delta;
-    m_transform.setPosition(m_state.pos + m_scrollPositionDelta);
+    m_transform.setPosition(adjustedPosition());
 }
 
 void TextureMapperLayer::setDebugBorder(const Color& color, float width)

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h (124011 => 124012)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2012-07-30 10:33:43 UTC (rev 124011)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2012-07-30 11:31:27 UTC (rev 124012)
@@ -128,7 +128,7 @@
     PassRefPtr<TextureMapperBackingStore> backingStore() { return m_backingStore; }
     void clearBackingStoresRecursive();
 
-    void setScrollPositionDeltaIfNeeded(const IntPoint&);
+    void setScrollPositionDeltaIfNeeded(const FloatSize&);
 
     void setDebugBorder(const Color&, float width);
 
@@ -149,6 +149,7 @@
     static void sortByZOrder(Vector<TextureMapperLayer* >& array, int first, int last);
 
     PassRefPtr<BitmapTexture> texture() { return m_backingStore ? m_backingStore->texture() : 0; }
+    FloatPoint adjustedPosition() const { return m_state.pos + m_scrollPositionDelta; }
     bool isAncestorFixedToViewport() const;
 
     void paintRecursive(const TextureMapperPaintOptions&);
@@ -237,7 +238,7 @@
     State m_state;
     TextureMapper* m_textureMapper;
     GraphicsLayerAnimations m_animations;
-    IntPoint m_scrollPositionDelta;
+    FloatSize m_scrollPositionDelta;
     bool m_fixedToViewport;
     Color m_debugBorderColor;
     float m_debugBorderWidth;

Modified: trunk/Source/WebKit2/ChangeLog (124011 => 124012)


--- trunk/Source/WebKit2/ChangeLog	2012-07-30 10:33:43 UTC (rev 124011)
+++ trunk/Source/WebKit2/ChangeLog	2012-07-30 11:31:27 UTC (rev 124012)
@@ -1,3 +1,21 @@
+2012-07-27  Jocelyn Turcotte  <jocelyn.turco...@nokia.com>
+
+        [Qt] Fix issues remaining with fixed positioned layers
+        https://bugs.webkit.org/show_bug.cgi?id=92528
+
+        Reviewed by Noam Rosenthal.
+
+        This partially fixes jittering of fixed layers when zoomed in and the
+        blurriness of rendered tiles of the non-composited contents layer.
+
+        * UIProcess/WebLayerTreeRenderer.cpp:
+        (WebKit::boundedScrollPosition):
+        (WebKit::WebLayerTreeRenderer::paintToCurrentGLContext):
+        Remove the adjustment on the root layer. This cancels setPixelAligned and causes the blurriness.
+        (WebKit::WebLayerTreeRenderer::adjustPositionForFixedLayers):
+        Use m_accurateVisibleContentsPosition to calculate the delta.
+        (WebKit::WebLayerTreeRenderer::didChangeScrollPosition):
+
 2012-07-29  Vsevolod Vlasov  <vse...@chromium.org>
 
         Web Inspector: Resource agent's reference to cached resources should be weak.

Modified: trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp (124011 => 124012)


--- trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp	2012-07-30 10:33:43 UTC (rev 124011)
+++ trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp	2012-07-30 11:31:27 UTC (rev 124012)
@@ -74,15 +74,14 @@
         MainThreadGuardedInvoker<WebLayerTreeRenderer>::call(this, function);
 }
 
-static IntPoint boundedScrollPosition(const IntPoint& scrollPosition, const IntRect& visibleContentRect, const FloatSize& contentSize)
+static FloatPoint boundedScrollPosition(const FloatPoint& scrollPosition, const FloatRect& visibleContentRect, const FloatSize& contentSize)
 {
-    IntSize size(contentSize.width(), contentSize.height());
-    int scrollPositionX = std::max(scrollPosition.x(), 0);
-    scrollPositionX = std::min(scrollPositionX, size.width() - visibleContentRect.width());
+    float scrollPositionX = std::max(scrollPosition.x(), 0.0f);
+    scrollPositionX = std::min(scrollPositionX, contentSize.width() - visibleContentRect.width());
 
-    int scrollPositionY = std::max(scrollPosition.y(), 0);
-    scrollPositionY = std::min(scrollPositionY, size.height() - visibleContentRect.height());
-    return IntPoint(scrollPositionX, scrollPositionY);
+    float scrollPositionY = std::max(scrollPosition.y(), 0.0f);
+    scrollPositionY = std::min(scrollPositionY, contentSize.height() - visibleContentRect.height());
+    return FloatPoint(scrollPositionX, scrollPositionY);
 }
 
 WebLayerTreeRenderer::WebLayerTreeRenderer(LayerTreeCoordinatorProxy* layerTreeCoordinatorProxy)
@@ -111,12 +110,6 @@
         m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode);
     ASSERT(m_textureMapper->accelerationMode() == TextureMapper::OpenGLMode);
 
-    // We need to compensate for the rounding error that happens due to m_visibleContentsRect being
-    // int and not float. We do that by moving the TransformationMatrix by the delta between the
-    // position of m_visibleContentsRect and the position it would have if it wasn't rounded.
- 
-    TransformationMatrix newMatrix = matrix;
-    newMatrix.translate(m_accurateVisibleContentsPosition.x() / m_contentsScale - m_visibleContentsRect.x(), m_accurateVisibleContentsPosition.y() / m_contentsScale - m_visibleContentsRect.y());
     adjustPositionForFixedLayers();
     GraphicsLayer* currentRootLayer = rootLayer();
     if (!currentRootLayer)
@@ -131,9 +124,9 @@
     m_textureMapper->beginPainting(PaintFlags);
     m_textureMapper->beginClip(TransformationMatrix(), clipRect);
 
-    if (currentRootLayer->opacity() != opacity || currentRootLayer->transform() != newMatrix) {
+    if (currentRootLayer->opacity() != opacity || currentRootLayer->transform() != matrix) {
         currentRootLayer->setOpacity(opacity);
-        currentRootLayer->setTransform(newMatrix);
+        currentRootLayer->setTransform(matrix);
         currentRootLayer->syncCompositingStateForThisLayerOnly();
     }
 
@@ -184,16 +177,21 @@
     if (m_fixedLayers.isEmpty())
         return;
 
-    IntPoint scrollPosition = boundedScrollPosition(m_visibleContentsRect.location(), m_visibleContentsRect, m_contentsSize);
+    // Fixed layer positions are updated by the web process when we update the visible contents rect / scroll position.
+    // If we want those layers to follow accurately the viewport when we move between the web process updates, we have to offset
+    // them by the delta between the current position and the position of the viewport used for the last layout.
+    FloatPoint scrollPosition = boundedScrollPosition(FloatPoint(m_accurateVisibleContentsPosition.x() / m_contentsScale, m_accurateVisibleContentsPosition.y() / m_contentsScale), m_visibleContentsRect, m_contentsSize);
+    FloatPoint renderedScrollPosition = boundedScrollPosition(m_renderedContentsScrollPosition, m_visibleContentsRect, m_contentsSize);
+    FloatSize delta = scrollPosition - renderedScrollPosition;
 
     LayerMap::iterator end = m_fixedLayers.end();
     for (LayerMap::iterator it = m_fixedLayers.begin(); it != end; ++it)
-        toTextureMapperLayer(it->second)->setScrollPositionDeltaIfNeeded(IntPoint(scrollPosition.x() - m_renderedContentsScrollPosition.x(), scrollPosition.y() - m_renderedContentsScrollPosition.y()));
+        toTextureMapperLayer(it->second)->setScrollPositionDeltaIfNeeded(delta);
 }
 
 void WebLayerTreeRenderer::didChangeScrollPosition(const IntPoint& position)
 {
-    m_pendingRenderedContentsScrollPosition = boundedScrollPosition(position, m_visibleContentsRect, m_contentsSize);
+    m_pendingRenderedContentsScrollPosition = position;
 }
 
 void WebLayerTreeRenderer::syncCanvas(WebLayerID id, const WebCore::IntSize& canvasSize, uint32_t graphicsSurfaceToken)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to