Commit ca98f6dd authored by enne@google.com's avatar enne@google.com

[chromium] Support RTL pages and elements in the compositor

https://bugs.webkit.org/show_bug.cgi?id=56591

Reviewed by James Robinson.

Source/WebKit/chromium:

As the noncomposited content host layer is created and managed by the
Chromium compositor, adjust its transform appropriately in the layer
tree and at paint time to handle the offset required due to the
initial containing block of RTL pages.

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

LayoutTests:

Re-enable RTL tests for Chromium.

* platform/chromium/test_expectations.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@103968 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent cf553561
2012-01-03 Adrienne Walker <enne@google.com>
[chromium] Support RTL pages and elements in the compositor
https://bugs.webkit.org/show_bug.cgi?id=56591
Reviewed by James Robinson.
Re-enable RTL tests for Chromium.
* platform/chromium/test_expectations.txt:
2012-01-03 Gavin Barraclough <barraclough@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=75429
......@@ -3299,15 +3299,6 @@ BUGWK62754 SLOW LINUX MAC DEBUG : http/tests/misc/object-embedding-svg-delayed-s
// Has been flaky/crashy for a while
BUGCR86359 WIN : fast/dom/DeviceOrientation/add-listener-from-callback.html = PASS CRASH
// Broken because Chromium disables compositing for RTL pages
BUGWK56591 : compositing/rtl/rtl-absolute-overflow-scrolled.html = TEXT
BUGWK56591 : compositing/rtl/rtl-absolute-overflow.html = TEXT
BUGWK56591 : compositing/rtl/rtl-absolute.html = TEXT
BUGWK56591 : compositing/rtl/rtl-fixed-overflow-scrolled.html = TEXT
BUGWK56591 : compositing/rtl/rtl-fixed-overflow.html = TEXT
BUGWK56591 : compositing/rtl/rtl-fixed.html = TEXT
BUGWK56591 : compositing/rtl/rtl-relative.html = TEXT
BUGWK63033 : svg/custom/absolute-root-position-masking.xhtml = IMAGE
BUGWK63036 MAC : svg/dom/SVGTransformList-basics.xhtml = IMAGE
......
2012-01-03 Adrienne Walker <enne@google.com>
[chromium] Support RTL pages and elements in the compositor
https://bugs.webkit.org/show_bug.cgi?id=56591
Reviewed by James Robinson.
As the noncomposited content host layer is created and managed by the
Chromium compositor, adjust its transform appropriately in the layer
tree and at paint time to handle the offset required due to the
initial containing block of RTL pages.
* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::allowedCompositingTriggers):
* src/NonCompositedContentHost.cpp:
(WebKit::NonCompositedContentHost::setViewport):
(WebKit::NonCompositedContentHost::paintContents):
* src/NonCompositedContentHost.h:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::updateLayerTreeViewport):
2012-01-03 Adrienne Walker <enne@google.com>
[chromium] Make tiled layer's tiler always exist
......
......@@ -895,10 +895,6 @@ void ChromeClientImpl::scheduleCompositingLayerSync()
ChromeClient::CompositingTriggerFlags ChromeClientImpl::allowedCompositingTriggers() const
{
// FIXME: RTL style not supported by the compositor yet.
if (!m_webView->allowsAcceleratedCompositing() || m_webView->pageHasRTLStyle())
return 0;
CompositingTriggerFlags flags = 0;
Settings* settings = m_webView->page()->settings();
if (settings->acceleratedCompositingFor3DTransformsEnabled())
......
......@@ -76,7 +76,7 @@ void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer)
ASSERT(scrollLayer());
}
void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float pageScale)
void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float pageScale, int layerAdjustX)
{
if (!scrollLayer())
return;
......@@ -90,7 +90,16 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize,
scrollLayer()->setScrollable(true);
m_graphicsLayer->setSize(contentsSize);
if (visibleRectChanged)
m_layerAdjustX = layerAdjustX;
if (m_graphicsLayer->transform().m41() != m_layerAdjustX) {
WebCore::TransformationMatrix transform = m_graphicsLayer->transform();
transform.setM41(m_layerAdjustX);
m_graphicsLayer->setTransform(transform);
// If a tiled layer is shifted left or right, the content that goes into
// each tile will change. Invalidate the entire layer when this happens.
m_graphicsLayer->setNeedsDisplay();
} else if (visibleRectChanged)
m_graphicsLayer->setNeedsDisplay();
if (m_graphicsLayer->pageScaleFactor() != pageScale)
......@@ -128,7 +137,10 @@ void NonCompositedContentHost::notifySyncRequired(const WebCore::GraphicsLayer*)
void NonCompositedContentHost::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext& context, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect)
{
m_contentPaint->paint(context, clipRect);
context.translate(-m_layerAdjustX, 0);
WebCore::IntRect adjustedClipRect = clipRect;
adjustedClipRect.move(m_layerAdjustX, 0);
m_contentPaint->paint(context, adjustedClipRect);
}
bool NonCompositedContentHost::showDebugBorders() const
......
......@@ -57,7 +57,7 @@ public:
void invalidateRect(const WebCore::IntRect&);
void setBackgroundColor(const WebCore::Color&);
void setScrollLayer(WebCore::GraphicsLayer*);
void setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float pageScale);
void setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float pageScale, int layerAdjustX);
void protectVisibleTileTextures();
WebCore::GraphicsLayer* topLevelRootLayer() const { return m_graphicsLayer.get(); }
......@@ -77,6 +77,7 @@ private:
OwnPtr<WebCore::GraphicsLayer> m_graphicsLayer;
OwnPtr<WebCore::LayerPainterChromium> m_contentPaint;
WebCore::IntSize m_viewportSize;
int m_layerAdjustX;
};
} // namespace WebKit
......
......@@ -3063,7 +3063,15 @@ void WebViewImpl::updateLayerTreeViewport()
IntRect visibleRect = view->visibleContentRect(true /* include scrollbars */);
IntPoint scroll(view->scrollX(), view->scrollY());
m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, pageScaleFactor());
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();
}
m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, pageScaleFactor(), layerAdjustX);
m_layerTreeHost->setViewport(visibleRect.size());
m_layerTreeHost->setPageScale(pageScaleFactor());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment