Title: [117915] trunk/Source/WebKit/chromium
Revision
117915
Author
[email protected]
Date
2012-05-21 23:44:09 -0700 (Mon, 21 May 2012)

Log Message

[chromium] Simplify RTL root layer adjustment
https://bugs.webkit.org/show_bug.cgi?id=85672

Patch by Alexandre Elias <[email protected]> on 2012-05-21
Reviewed by Adrienne Walker.

The compositor needs a translation to compensate for a nonzero
scrollOrigin to avoid painting at negative coordinates on RTL pages.
Previously, we were recomputing it from first principles; this change
directly reads it off the actual scrollOrigin.

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

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (117914 => 117915)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-05-22 06:43:43 UTC (rev 117914)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-05-22 06:44:09 UTC (rev 117915)
@@ -1,3 +1,20 @@
+2012-05-21  Alexandre Elias  <[email protected]>
+
+        [chromium] Simplify RTL root layer adjustment
+        https://bugs.webkit.org/show_bug.cgi?id=85672
+
+        Reviewed by Adrienne Walker.
+
+        The compositor needs a translation to compensate for a nonzero
+        scrollOrigin to avoid painting at negative coordinates on RTL pages.
+        Previously, we were recomputing it from first principles; this change
+        directly reads it off the actual scrollOrigin.
+
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::updateLayerTreeViewport):
+        * src/WebViewImpl.h:
+        (WebViewImpl):
+
 2012-05-21  James Robinson  <[email protected]>
 
         Chromium compile fix, unreviewed.

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (117914 => 117915)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-05-22 06:43:43 UTC (rev 117914)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-05-22 06:44:09 UTC (rev 117915)
@@ -3304,22 +3304,6 @@
     return !m_compositorCreationFailed;
 }
 
-bool WebViewImpl::pageHasRTLStyle() const
-{
-    if (!page())
-        return false;
-    Document* document = page()->mainFrame()->document();
-    if (!document)
-        return false;
-    RenderView* renderView = document->renderView();
-    if (!renderView)
-        return false;
-    RenderStyle* style = renderView->style();
-    if (!style)
-        return false;
-    return (style->direction() == RTL);
-}
-
 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
 {
     m_rootGraphicsLayer = layer;
@@ -3614,14 +3598,10 @@
     IntRect visibleRect = view->visibleContentRect(true /* include scrollbars */);
     IntPoint scroll(view->scrollX(), view->scrollY());
 
-    int layerAdjustX = 0;
-    if (pageHasRTLStyle()) {
-        // The origin of the initial containing block for RTL root layers is not
-        // at the far left side of the layer bounds. Instead, it's one viewport
-        // width (not including scrollbars) to the left of the right side of the
-        // layer.
-        layerAdjustX = -view->contentsSize().width() + view->visibleContentRect(false).width();
-    }
+    // 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.

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (117914 => 117915)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.h	2012-05-22 06:43:43 UTC (rev 117914)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h	2012-05-22 06:44:09 UTC (rev 117915)
@@ -495,7 +495,6 @@
 
 #if USE(ACCELERATED_COMPOSITING)
     bool allowsAcceleratedCompositing();
-    bool pageHasRTLStyle() const;
     void setRootGraphicsLayer(WebCore::GraphicsLayer*);
     void scheduleCompositingLayerSync();
     void scrollRootLayerRect(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& clipRect);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to