Title: [120105] trunk/Source/WebKit/chromium
Revision
120105
Author
[email protected]
Date
2012-06-12 12:55:29 -0700 (Tue, 12 Jun 2012)

Log Message

[chromium] Fix incorrect LayerChromium scroll position for RTL overflow pages
https://bugs.webkit.org/show_bug.cgi?id=88887

Reviewed by James Robinson.

The scroll position on layers needs to take into account the scroll
origin, since RTL pages start scrolled all the way to the right.
Otherwise, when scrolling left the scroll position incorrectly will go
negative, causing havok in scrollbar theme code that just assumes that
it's always scrolled all the way to the left.

Also, now that the scroll origin is passed into NCCH, handle
scrollOrigin.y() for layer adjusting. This is always zero in practice,
but it seemed awkward to just drop it and that assumption could always
change in the future.

* src/NonCompositedContentHost.cpp:
(WebKit::NonCompositedContentHost::setViewport):
(WebKit::NonCompositedContentHost::paintContents):
* src/NonCompositedContentHost.h:
(NonCompositedContentHost):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::updateLayerTreeViewport):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (120104 => 120105)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-06-12 19:47:59 UTC (rev 120104)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-06-12 19:55:29 UTC (rev 120105)
@@ -1,3 +1,29 @@
+2012-06-12  Adrienne Walker  <[email protected]>
+
+        [chromium] Fix incorrect LayerChromium scroll position for RTL overflow pages
+        https://bugs.webkit.org/show_bug.cgi?id=88887
+
+        Reviewed by James Robinson.
+
+        The scroll position on layers needs to take into account the scroll
+        origin, since RTL pages start scrolled all the way to the right.
+        Otherwise, when scrolling left the scroll position incorrectly will go
+        negative, causing havok in scrollbar theme code that just assumes that
+        it's always scrolled all the way to the left.
+
+        Also, now that the scroll origin is passed into NCCH, handle
+        scrollOrigin.y() for layer adjusting. This is always zero in practice,
+        but it seemed awkward to just drop it and that assumption could always
+        change in the future.
+
+        * src/NonCompositedContentHost.cpp:
+        (WebKit::NonCompositedContentHost::setViewport):
+        (WebKit::NonCompositedContentHost::paintContents):
+        * src/NonCompositedContentHost.h:
+        (NonCompositedContentHost):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::updateLayerTreeViewport):
+
 2012-06-12  Shawn Singh  <[email protected]>
 
         [chromium] Make damage tracking more robust to early exits

Modified: trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp (120104 => 120105)


--- trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp	2012-06-12 19:47:59 UTC (rev 120104)
+++ trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp	2012-06-12 19:55:29 UTC (rev 120105)
@@ -98,7 +98,7 @@
         layer->setAlwaysReserveTextures(true);
 }
 
-void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float deviceScale, int layerAdjustX)
+void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, float deviceScale)
 {
     if (!scrollLayer())
         return;
@@ -106,7 +106,8 @@
     bool visibleRectChanged = m_viewportSize != viewportSize;
 
     m_viewportSize = viewportSize;
-    scrollLayer()->setScrollPosition(scrollPosition);
+
+    scrollLayer()->setScrollPosition(scrollPosition + toSize(scrollOrigin));
     scrollLayer()->setPosition(-scrollPosition);
     // Due to the possibility of pinch zoom, the noncomposited layer is always
     // assumed to be scrollable.
@@ -115,10 +116,14 @@
     m_graphicsLayer->deviceOrPageScaleFactorChanged();
     m_graphicsLayer->setSize(contentsSize);
 
-    m_layerAdjustX = layerAdjustX;
-    if (m_graphicsLayer->transform().m41() != m_layerAdjustX) {
+    // In RTL-style pages, the origin of the initial containing block for the
+    // root layer may be positive; translate the layer to avoid negative
+    // coordinates.
+    m_layerAdjust = -toSize(scrollOrigin);
+    if (m_graphicsLayer->transform().m41() != m_layerAdjust.width() || m_graphicsLayer->transform().m42() != m_layerAdjust.height()) {
         WebCore::TransformationMatrix transform = m_graphicsLayer->transform();
-        transform.setM41(m_layerAdjustX);
+        transform.setM41(m_layerAdjust.width());
+        transform.setM42(m_layerAdjust.height());
         m_graphicsLayer->setTransform(transform);
 
         // If a tiled layer is shifted left or right, the content that goes into
@@ -160,9 +165,9 @@
 
 void NonCompositedContentHost::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext& context, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect)
 {
-    context.translate(-m_layerAdjustX, 0);
+    context.translate(-m_layerAdjust);
     WebCore::IntRect adjustedClipRect = clipRect;
-    adjustedClipRect.move(m_layerAdjustX, 0);
+    adjustedClipRect.move(m_layerAdjust);
     m_contentPaint->paint(context, adjustedClipRect);
 }
 

Modified: trunk/Source/WebKit/chromium/src/NonCompositedContentHost.h (120104 => 120105)


--- trunk/Source/WebKit/chromium/src/NonCompositedContentHost.h	2012-06-12 19:47:59 UTC (rev 120104)
+++ trunk/Source/WebKit/chromium/src/NonCompositedContentHost.h	2012-06-12 19:55:29 UTC (rev 120105)
@@ -58,7 +58,7 @@
     void setBackgroundColor(const WebCore::Color&);
     void setOpaque(bool);
     void setScrollLayer(WebCore::GraphicsLayer*);
-    void setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float deviceScale, int layerAdjustX);
+    void setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, float deviceScale);
     WebCore::GraphicsLayer* topLevelRootLayer() const { return m_graphicsLayer.get(); }
 
     void setShowDebugBorders(bool);
@@ -84,7 +84,8 @@
     OwnPtr<WebCore::GraphicsLayer> m_graphicsLayer;
     OwnPtr<WebCore::LayerPainterChromium> m_contentPaint;
     WebCore::IntSize m_viewportSize;
-    int m_layerAdjustX;
+    WebCore::IntSize m_layerAdjust;
+
     bool m_showDebugBorders;
     float m_deviceScaleFactor;
 };

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (120104 => 120105)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-06-12 19:47:59 UTC (rev 120104)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-06-12 19:55:29 UTC (rev 120105)
@@ -3637,15 +3637,10 @@
     IntRect visibleRect = view->visibleContentRect(true /* include scrollbars */);
     IntPoint scroll(view->scrollX(), view->scrollY());
 
-    // In RTL-style pages, the origin of the initial containing block for the
-    // root layer may be positive; translate the layer to avoid negative
-    // coordinates.
-    int layerAdjustX = -view->scrollOrigin().x();
-
     // This part of the deviceScale will be used to scale the contents of
     // the NCCH's GraphicsLayer.
     float deviceScale = m_deviceScaleInCompositor;
-    m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, deviceScale, layerAdjustX);
+    m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, view->scrollOrigin(), deviceScale);
 
     m_layerTreeView.setViewportSize(size());
     m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to