Title: [99286] trunk/Source
Revision
99286
Author
[email protected]
Date
2011-11-04 09:41:19 -0700 (Fri, 04 Nov 2011)

Log Message

[chromium] Fix incorrect visibility/scissor rect for threaded compositing
https://bugs.webkit.org/show_bug.cgi?id=70962

Reviewed by James Robinson.

Source/WebCore:

In order to properly scroll independent of layout on the compositor
thread, we have to apply the scroll to the right layer. Previously,
the NonCompositedContentHost was the root of the graphics layer tree
with all other layers underneath it. However, applying a scroll to
that layer would also scroll the clip layer for the main frame
underneath it, causing visibility issues.

This patch moves the NonCompositedHost to be a child of the
RenderLayerCompositor's scroll layer. This was exposed on
RenderLayerCompositor, because there's no other way to get to this
layer in a way that doesn't make assumptions about the structure of
the layers on a frame.

This also removes the hacks in calculateVisibleLayerRect and
tilingTransform for scroll position.

Partially tested by existing compositor tests. Manually tested
threaded compositing scrolling.

* platform/graphics/chromium/NonCompositedContentHost.cpp:
(WebCore::NonCompositedContentHost::setScrollLayer):
(WebCore::NonCompositedContentHost::setViewport):
(WebCore::NonCompositedContentHost::scrollLayer):
* platform/graphics/chromium/NonCompositedContentHost.h:
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::create):
(WebCore::CCLayerTreeHost::CCLayerTreeHost):
(WebCore::CCLayerTreeHost::applyScrollDeltas):
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(WebCore::CCLayerTreeHost::setRootLayer):
* platform/graphics/chromium/cc/CCLayerTreeHostCommon.h:
(WebCore::CCLayerTreeHostCommon::calculateVisibleLayerRect):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
(WebCore::findScrollLayer):
(WebCore::CCLayerTreeHostImpl::setRootLayer):
(WebCore::CCLayerTreeHostImpl::scrollRootLayer):
(WebCore::CCLayerTreeHostImpl::processScrollDeltas):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
* platform/graphics/chromium/cc/CCTiledLayerImpl.cpp:
(WebCore::CCTiledLayerImpl::tilingTransform):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::scrollLayer):
* rendering/RenderLayerCompositor.h:

Source/WebKit/chromium:

* src/WebLayerTreeViewImpl.cpp:
(WebKit::WebLayerTreeViewImpl::WebLayerTreeViewImpl):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::setRootGraphicsLayer):
(WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
* tests/CCLayerTreeHostTest.cpp:
(WTF::MockLayerTreeHost::MockLayerTreeHost):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (99285 => 99286)


--- trunk/Source/WebCore/ChangeLog	2011-11-04 16:09:24 UTC (rev 99285)
+++ trunk/Source/WebCore/ChangeLog	2011-11-04 16:41:19 UTC (rev 99286)
@@ -1,3 +1,54 @@
+2011-11-03  Adrienne Walker  <[email protected]>
+
+        [chromium] Fix incorrect visibility/scissor rect for threaded compositing
+        https://bugs.webkit.org/show_bug.cgi?id=70962
+
+        Reviewed by James Robinson.
+
+        In order to properly scroll independent of layout on the compositor
+        thread, we have to apply the scroll to the right layer. Previously,
+        the NonCompositedContentHost was the root of the graphics layer tree
+        with all other layers underneath it. However, applying a scroll to
+        that layer would also scroll the clip layer for the main frame
+        underneath it, causing visibility issues.
+
+        This patch moves the NonCompositedHost to be a child of the
+        RenderLayerCompositor's scroll layer. This was exposed on
+        RenderLayerCompositor, because there's no other way to get to this
+        layer in a way that doesn't make assumptions about the structure of
+        the layers on a frame.
+
+        This also removes the hacks in calculateVisibleLayerRect and
+        tilingTransform for scroll position.
+
+        Partially tested by existing compositor tests. Manually tested
+        threaded compositing scrolling.
+
+        * platform/graphics/chromium/NonCompositedContentHost.cpp:
+        (WebCore::NonCompositedContentHost::setScrollLayer):
+        (WebCore::NonCompositedContentHost::setViewport):
+        (WebCore::NonCompositedContentHost::scrollLayer):
+        * platform/graphics/chromium/NonCompositedContentHost.h:
+        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+        (WebCore::CCLayerTreeHost::create):
+        (WebCore::CCLayerTreeHost::CCLayerTreeHost):
+        (WebCore::CCLayerTreeHost::applyScrollDeltas):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+        (WebCore::CCLayerTreeHost::setRootLayer):
+        * platform/graphics/chromium/cc/CCLayerTreeHostCommon.h:
+        (WebCore::CCLayerTreeHostCommon::calculateVisibleLayerRect):
+        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
+        (WebCore::findScrollLayer):
+        (WebCore::CCLayerTreeHostImpl::setRootLayer):
+        (WebCore::CCLayerTreeHostImpl::scrollRootLayer):
+        (WebCore::CCLayerTreeHostImpl::processScrollDeltas):
+        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
+        * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp:
+        (WebCore::CCTiledLayerImpl::tilingTransform):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::scrollLayer):
+        * rendering/RenderLayerCompositor.h:
+
 2011-11-04  Tor Arne Vestbø  <[email protected]>
 
         [Qt] Refactor and clean up the qmake build system

Modified: trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.cpp (99285 => 99286)


--- trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.cpp	2011-11-04 16:09:24 UTC (rev 99285)
+++ trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.cpp	2011-11-04 16:41:19 UTC (rev 99286)
@@ -49,34 +49,51 @@
 {
 }
 
-void NonCompositedContentHost::setRootLayer(GraphicsLayer* layer)
+void NonCompositedContentHost::setScrollLayer(GraphicsLayer* layer)
 {
-    m_graphicsLayer->removeAllChildren();
     m_graphicsLayer->setNeedsDisplay();
-    if (layer)
-        m_graphicsLayer->addChild(layer);
-    else
+
+    if (!layer) {
+        m_graphicsLayer->removeFromParent();
         m_graphicsLayer->platformLayer()->setLayerTreeHost(0);
+        return;
+    }
+
+    if (layer->platformLayer() == scrollLayer())
+        return;
+
+    layer->addChildAtIndex(m_graphicsLayer.get(), 0);
+    ASSERT(scrollLayer());
 }
 
 void NonCompositedContentHost::setViewport(const IntSize& viewportSize, const IntSize& contentsSize, const IntPoint& scrollPosition)
 {
+    if (!scrollLayer())
+        return;
+
     bool visibleRectChanged = m_viewportSize != viewportSize;
 
     m_viewportSize = viewportSize;
-    m_graphicsLayer->platformLayer()->setScrollPosition(scrollPosition);
+    scrollLayer()->setScrollPosition(scrollPosition);
     IntSize maxScroll = contentsSize - viewportSize;
     // The viewport may be larger than the contents in some cases, such as
     // having a vertical scrollbar but no horizontal overflow.
     maxScroll.clampNegativeToZero();
 
-    m_graphicsLayer->platformLayer()->setMaxScrollPosition(maxScroll);
+    scrollLayer()->setMaxScrollPosition(maxScroll);
     m_graphicsLayer->setSize(contentsSize);
 
     if (visibleRectChanged)
         m_graphicsLayer->setNeedsDisplay();
 }
 
+LayerChromium* NonCompositedContentHost::scrollLayer()
+{
+    if (!m_graphicsLayer->parent())
+        return 0;
+    return m_graphicsLayer->parent()->platformLayer();
+}
+
 void NonCompositedContentHost::protectVisibleTileTextures()
 {
     m_graphicsLayer->platformLayer()->protectVisibleTileTextures();

Modified: trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.h (99285 => 99286)


--- trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.h	2011-11-04 16:09:24 UTC (rev 99285)
+++ trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.h	2011-11-04 16:41:19 UTC (rev 99286)
@@ -39,6 +39,7 @@
 class GraphicsContext;
 class IntPoint;
 class IntRect;
+class LayerChromium;
 class LayerPainterChromium;
 
 class NonCompositedContentHost : public GraphicsLayerClient {
@@ -51,10 +52,9 @@
     virtual ~NonCompositedContentHost();
 
     void invalidateRect(const IntRect&);
-    void setRootLayer(GraphicsLayer*);
+    void setScrollLayer(GraphicsLayer*);
     void setViewport(const IntSize& viewportSize, const IntSize& contentsSize, const IntPoint& scrollPosition);
     void protectVisibleTileTextures();
-    GraphicsLayer* topLevelRootLayer() const { return m_graphicsLayer.get(); }
 
 private:
     explicit NonCompositedContentHost(PassOwnPtr<LayerPainterChromium> contentPaint);
@@ -66,6 +66,8 @@
     virtual bool showDebugBorders() const;
     virtual bool showRepaintCounter() const;
 
+    LayerChromium* scrollLayer();
+
     OwnPtr<GraphicsLayer> m_graphicsLayer;
     OwnPtr<LayerPainterChromium> m_contentPaint;
     IntSize m_viewportSize;
@@ -74,4 +76,3 @@
 } // namespace WebCore
 
 #endif // NonCompositedContentHost_h
-

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (99285 => 99286)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2011-11-04 16:09:24 UTC (rev 99285)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2011-11-04 16:41:19 UTC (rev 99286)
@@ -40,20 +40,19 @@
 
 namespace WebCore {
 
-PassRefPtr<CCLayerTreeHost> CCLayerTreeHost::create(CCLayerTreeHostClient* client, PassRefPtr<LayerChromium> rootLayer, const CCSettings& settings)
+PassRefPtr<CCLayerTreeHost> CCLayerTreeHost::create(CCLayerTreeHostClient* client, const CCSettings& settings)
 {
-    RefPtr<CCLayerTreeHost> layerTreeHost = adoptRef(new CCLayerTreeHost(client, rootLayer, settings));
+    RefPtr<CCLayerTreeHost> layerTreeHost = adoptRef(new CCLayerTreeHost(client, settings));
     if (!layerTreeHost->initialize())
         return 0;
     return layerTreeHost;
 }
 
-CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, PassRefPtr<LayerChromium> rootLayer, const CCSettings& settings)
+CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCSettings& settings)
     : m_compositorIdentifier(-1)
     , m_animating(false)
     , m_client(client)
     , m_frameNumber(0)
-    , m_rootLayer(rootLayer)
     , m_settings(settings)
     , m_visible(true)
     , m_haveWheelEventHandlers(false)
@@ -440,16 +439,13 @@
 
 void CCLayerTreeHost::applyScrollDeltas(const CCScrollUpdateSet& info)
 {
-    for (size_t i = 0; i < info.size(); ++i) {
-        int layerId = info[i].layerId;
-        IntSize scrollDelta = info[i].scrollDelta;
+    // FIXME: pushing scroll offsets to non-root layers not implemented
+    if (!info.size())
+        return;
 
-        // FIXME: pushing scroll offsets to non-root layers not implemented
-        if (rootLayer()->id() == layerId)
-            m_client->applyScrollDelta(scrollDelta);
-        else
-            ASSERT_NOT_REACHED();
-    }
+    ASSERT(info.size() == 1);
+    IntSize scrollDelta = info[0].scrollDelta;
+    m_client->applyScrollDelta(scrollDelta);
 }
 
 void CCLayerTreeHost::startRateLimiter(GraphicsContext3D* context)

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (99285 => 99286)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2011-11-04 16:09:24 UTC (rev 99285)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2011-11-04 16:41:19 UTC (rev 99286)
@@ -27,6 +27,7 @@
 
 #include "GraphicsTypes3D.h"
 #include "IntRect.h"
+#include "LayerChromium.h"
 #include "RateLimiter.h"
 #include "TransformationMatrix.h"
 #include "cc/CCLayerTreeHostCommon.h"
@@ -46,7 +47,6 @@
 class CCLayerTreeHostImpl;
 class CCTextureUpdater;
 class GraphicsContext3D;
-class LayerChromium;
 class LayerPainterChromium;
 class TextureAllocator;
 class TextureManager;
@@ -101,7 +101,7 @@
 
 class CCLayerTreeHost : public RefCounted<CCLayerTreeHost> {
 public:
-    static PassRefPtr<CCLayerTreeHost> create(CCLayerTreeHostClient*, PassRefPtr<LayerChromium> rootLayer, const CCSettings&);
+    static PassRefPtr<CCLayerTreeHost> create(CCLayerTreeHostClient*, const CCSettings&);
     virtual ~CCLayerTreeHost();
 
     // CCLayerTreeHost interface to CCProxy.
@@ -151,6 +151,7 @@
 
     LayerChromium* rootLayer() { return m_rootLayer.get(); }
     const LayerChromium* rootLayer() const { return m_rootLayer.get(); }
+    void setRootLayer(PassRefPtr<LayerChromium> rootLayer) { m_rootLayer = rootLayer; }
 
     const CCSettings& settings() const { return m_settings; }
 
@@ -172,7 +173,7 @@
     void stopRateLimiter(GraphicsContext3D*);
 
 protected:
-    CCLayerTreeHost(CCLayerTreeHostClient*, PassRefPtr<LayerChromium> rootLayer, const CCSettings&);
+    CCLayerTreeHost(CCLayerTreeHostClient*, const CCSettings&);
     bool initialize();
 
 private:

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.h (99285 => 99286)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.h	2011-11-04 16:09:24 UTC (rev 99285)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.h	2011-11-04 16:41:19 UTC (rev 99286)
@@ -77,8 +77,6 @@
     transform.translate(-contentBounds.width() / 2.0, -contentBounds.height() / 2.0);
 
     IntRect visibleLayerRect = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerBoundRect, transform);
-    visibleLayerRect.move(toSize(layer->scrollPosition()));
-
     return visibleLayerRect;
 }
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp (99285 => 99286)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp	2011-11-04 16:09:24 UTC (rev 99285)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp	2011-11-04 16:41:19 UTC (rev 99286)
@@ -123,9 +123,29 @@
     m_layerRenderer->getFramebufferPixels(pixels, rect);
 }
 
+static CCLayerImpl* findScrollLayer(CCLayerImpl* layer)
+{
+    if (!layer)
+        return 0;
+
+    if (!layer->maxScrollPosition().isZero())
+        return layer;
+
+    for (size_t i = 0; i < layer->children().size(); ++i) {
+        CCLayerImpl* found = findScrollLayer(layer->children()[i].get());
+        if (found)
+            return found;
+    }
+
+    return 0;
+}
+
 void CCLayerTreeHostImpl::setRootLayer(PassRefPtr<CCLayerImpl> layer)
 {
     m_rootLayerImpl = layer;
+
+    // FIXME: Currently, this only finds the first scrollable layer.
+    m_scrollLayerImpl = findScrollLayer(m_rootLayerImpl.get());
 }
 
 void CCLayerTreeHostImpl::setVisible(bool visible)
@@ -174,10 +194,10 @@
 void CCLayerTreeHostImpl::scrollRootLayer(const IntSize& scrollDelta)
 {
     TRACE_EVENT("CCLayerTreeHostImpl::scrollRootLayer", this, 0);
-    if (!m_rootLayerImpl || !m_rootLayerImpl->scrollable())
+    if (!m_scrollLayerImpl || !m_scrollLayerImpl->scrollable())
         return;
 
-    m_rootLayerImpl->scrollBy(scrollDelta);
+    m_scrollLayerImpl->scrollBy(scrollDelta);
     m_client->setNeedsCommitOnImplThread();
     m_client->setNeedsRedrawOnImplThread();
 }
@@ -191,14 +211,15 @@
 {
     OwnPtr<CCScrollUpdateSet> scrollInfo = adoptPtr(new CCScrollUpdateSet());
     // FIXME: track scrolls from layers other than the root
-    if (rootLayer() && !rootLayer()->scrollDelta().isZero()) {
+    if (m_scrollLayerImpl && !m_scrollLayerImpl->scrollDelta().isZero()) {
         CCLayerTreeHostCommon::ScrollUpdateInfo info;
-        info.layerId = rootLayer()->id();
-        info.scrollDelta = rootLayer()->scrollDelta();
+        info.layerId = m_scrollLayerImpl->id();
+        info.scrollDelta = m_scrollLayerImpl->scrollDelta();
         scrollInfo->append(info);
 
-        rootLayer()->setScrollPosition(rootLayer()->scrollPosition() + rootLayer()->scrollDelta());
-        rootLayer()->setScrollDelta(IntSize());
+        m_scrollLayerImpl->setScrollPosition(m_scrollLayerImpl->scrollPosition() + m_scrollLayerImpl->scrollDelta());
+        m_scrollLayerImpl->setPosition(m_scrollLayerImpl->position() - m_scrollLayerImpl->scrollDelta());
+        m_scrollLayerImpl->setScrollDelta(IntSize());
     }
     return scrollInfo.release();
 }

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h (99285 => 99286)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h	2011-11-04 16:09:24 UTC (rev 99285)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h	2011-11-04 16:41:19 UTC (rev 99286)
@@ -110,6 +110,7 @@
 private:
     OwnPtr<LayerRendererChromium> m_layerRenderer;
     RefPtr<CCLayerImpl> m_rootLayerImpl;
+    RefPtr<CCLayerImpl> m_scrollLayerImpl;
     CCSettings m_settings;
     IntSize m_viewportSize;
     bool m_visible;

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp (99285 => 99286)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp	2011-11-04 16:09:24 UTC (rev 99285)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp	2011-11-04 16:41:19 UTC (rev 99286)
@@ -104,9 +104,6 @@
 
     // Tiler draws with a different origin from other layers.
     transform.translate(-contentBounds().width() / 2.0, -contentBounds().height() / 2.0);
-
-    transform.translate(-scrollPosition().x(), -scrollPosition().y());
-
     return transform;
 }
 

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (99285 => 99286)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2011-11-04 16:09:24 UTC (rev 99285)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2011-11-04 16:41:19 UTC (rev 99286)
@@ -1180,6 +1180,11 @@
     return m_rootContentLayer.get();
 }
 
+GraphicsLayer* RenderLayerCompositor::scrollLayer() const
+{
+    return m_scrollLayer.get();
+}
+
 void RenderLayerCompositor::didMoveOnscreen()
 {
     if (!inCompositingMode() || m_rootLayerAttachment != RootLayerUnattached)

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (99285 => 99286)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2011-11-04 16:09:24 UTC (rev 99285)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2011-11-04 16:41:19 UTC (rev 99286)
@@ -135,6 +135,7 @@
 
     RenderLayer* rootRenderLayer() const;
     GraphicsLayer* rootGraphicsLayer() const;
+    GraphicsLayer* scrollLayer() const;
 
     enum RootLayerAttachment {
         RootLayerUnattached,

Modified: trunk/Source/WebKit/chromium/ChangeLog (99285 => 99286)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-11-04 16:09:24 UTC (rev 99285)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-11-04 16:41:19 UTC (rev 99286)
@@ -1,3 +1,18 @@
+2011-11-03  Adrienne Walker  <[email protected]>
+
+        [chromium] Fix incorrect visibility/scissor rect for threaded compositing
+        https://bugs.webkit.org/show_bug.cgi?id=70962
+
+        Reviewed by James Robinson.
+
+        * src/WebLayerTreeViewImpl.cpp:
+        (WebKit::WebLayerTreeViewImpl::WebLayerTreeViewImpl):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::setRootGraphicsLayer):
+        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+        * tests/CCLayerTreeHostTest.cpp:
+        (WTF::MockLayerTreeHost::MockLayerTreeHost):
+
 2011-11-02  Xiaomei Ji  <[email protected]>
 
         Enable ctrl-arrow move cursor by word in visual order in cr-win by command line flag.

Modified: trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp (99285 => 99286)


--- trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp	2011-11-04 16:09:24 UTC (rev 99285)
+++ trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp	2011-11-04 16:41:19 UTC (rev 99286)
@@ -49,9 +49,10 @@
 }
 
 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings) 
-    : CCLayerTreeHost(this, root, settings)
+    : CCLayerTreeHost(this, settings)
     , m_client(client)
 {
+    setRootLayer(root);
 }
 
 WebLayerTreeViewImpl::~WebLayerTreeViewImpl()

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (99285 => 99286)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-11-04 16:09:24 UTC (rev 99285)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-11-04 16:41:19 UTC (rev 99286)
@@ -91,6 +91,7 @@
 #include "PopupContainer.h"
 #include "PopupMenuClient.h"
 #include "ProgressTracker.h"
+#include "RenderLayerCompositor.h"
 #include "RenderView.h"
 #include "ResourceHandle.h"
 #include "ScrollAnimator.h"
@@ -2510,8 +2511,18 @@
     m_rootGraphicsLayer = layer;
 
     setIsAcceleratedCompositingActive(layer);
-    if (m_nonCompositedContentHost)
-        m_nonCompositedContentHost->setRootLayer(layer);
+    if (m_nonCompositedContentHost) {
+        GraphicsLayer* scrollLayer = 0;
+        if (layer) {
+            Document* document = page()->mainFrame()->document();
+            RenderView* renderView = document->renderView();
+            RenderLayerCompositor* compositor = renderView->compositor();
+            scrollLayer = compositor->scrollLayer();
+        }
+        m_nonCompositedContentHost->setScrollLayer(scrollLayer);
+    }
+    if (m_layerTreeHost)
+        m_layerTreeHost->setRootLayer(layer ? layer->platformLayer() : 0);
 
     IntRect damagedRect(0, 0, m_size.width, m_size.height);
     if (!m_isAcceleratedCompositingActive)
@@ -2625,7 +2636,7 @@
         ccSettings.showPlatformLayerTree = settings()->showPlatformLayerTree();
 
         m_nonCompositedContentHost = NonCompositedContentHost::create(WebViewImplContentPainter::create(this));
-        m_layerTreeHost = CCLayerTreeHost::create(this, m_nonCompositedContentHost->topLevelRootLayer()->platformLayer(), ccSettings);
+        m_layerTreeHost = CCLayerTreeHost::create(this, ccSettings);
         if (m_layerTreeHost) {
             m_layerTreeHost->setHaveWheelEventHandlers(m_haveWheelEventHandlers);
             updateLayerTreeViewport();

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (99285 => 99286)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2011-11-04 16:09:24 UTC (rev 99285)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2011-11-04 16:41:19 UTC (rev 99286)
@@ -111,9 +111,10 @@
 
 private:
     MockLayerTreeHost(TestHooks* testHooks, CCLayerTreeHostClient* client, PassRefPtr<LayerChromium> rootLayer, const CCSettings& settings)
-        : CCLayerTreeHost(client, rootLayer, settings)
+        : CCLayerTreeHost(client, settings)
         , m_testHooks(testHooks)
     {
+        setRootLayer(rootLayer);
         bool success = initialize();
         ASSERT(success);
         UNUSED_PARAM(success);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to