+2012-05-21 Alexandre Elias <aelias@google.com>
+
+ [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 <jamesr@chromium.org>
Chromium compile fix, unreviewed.
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;
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.
#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);