Diff
Modified: trunk/Source/WebCore/ChangeLog (95151 => 95152)
--- trunk/Source/WebCore/ChangeLog 2011-09-15 02:26:42 UTC (rev 95151)
+++ trunk/Source/WebCore/ChangeLog 2011-09-15 02:34:02 UTC (rev 95152)
@@ -1,3 +1,35 @@
+2011-09-14 Antoine Labour <[email protected]>
+
+ Remove the dependency on GraphicsLayer from CCLayerTreeHost.
+ Move root layer management into the NonCompositedContentHost.
+ Have WebViewImpl create a NonCompositedContentHost explicitly.
+ https://bugs.webkit.org/show_bug.cgi?id=67883
+
+ Reviewed by James Robinson.
+
+ Covered by compositing/ layout tests.
+
+ * platform/graphics/chromium/NonCompositedContentHost.cpp:
+ (WebCore::NonCompositedContentHost::setRootLayer):
+ (WebCore::NonCompositedContentHost::setViewport):
+ (WebCore::NonCompositedContentHost::setVisible):
+ (WebCore::NonCompositedContentHost::clearRenderSurfacesRecursive):
+ (WebCore::NonCompositedContentHost::invalidateRect):
+ * platform/graphics/chromium/NonCompositedContentHost.h:
+ (WebCore::NonCompositedContentHost::topLevelRootLayer):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+ (WebCore::CCLayerTreeHost::create):
+ (WebCore::CCLayerTreeHost::CCLayerTreeHost):
+ (WebCore::CCLayerTreeHost::initialize):
+ (WebCore::CCLayerTreeHost::commitTo):
+ (WebCore::CCLayerTreeHost::didRecreateGraphicsContext):
+ (WebCore::CCLayerTreeHost::setViewport):
+ (WebCore::CCLayerTreeHost::setVisible):
+ (WebCore::CCLayerTreeHost::updateLayers):
+ (WebCore::CCLayerTreeHost::paintLayerContents):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+ (WebCore::CCLayerTreeHost::rootLayer):
+
2011-09-14 Henrik Grunell <[email protected]>
MediaStream API: Change PeerConnection constructor name to webkitPeerConnection
Modified: trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.cpp (95151 => 95152)
--- trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.cpp 2011-09-15 02:26:42 UTC (rev 95151)
+++ trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.cpp 2011-09-15 02:34:02 UTC (rev 95152)
@@ -49,19 +49,26 @@
{
}
-void NonCompositedContentHost::invalidateRect(const IntRect& rect)
+void NonCompositedContentHost::setRootLayer(GraphicsLayer* layer)
{
- m_graphicsLayer->setNeedsDisplayInRect(FloatRect(rect));
+ m_graphicsLayer->removeAllChildren();
+ m_graphicsLayer->setNeedsDisplay();
+ if (layer)
+ m_graphicsLayer->addChild(layer);
+ else
+ m_graphicsLayer->platformLayer()->setLayerTreeHost(0);
}
-void NonCompositedContentHost::invalidateEntireLayer()
+void NonCompositedContentHost::setViewport(const IntSize& viewportSize, const IntSize& contentsSize, const IntPoint& scrollPosition)
{
- m_graphicsLayer->setNeedsDisplay();
-}
+ bool visibleRectChanged = m_viewportSize != viewportSize;
-void NonCompositedContentHost::setScrollPosition(const IntPoint& scrollPosition)
-{
+ m_viewportSize = viewportSize;
m_graphicsLayer->platformLayer()->setScrollPosition(scrollPosition);
+ m_graphicsLayer->setSize(contentsSize);
+
+ if (visibleRectChanged)
+ m_graphicsLayer->setNeedsDisplay();
}
void NonCompositedContentHost::protectVisibleTileTextures()
@@ -69,6 +76,11 @@
m_graphicsLayer->platformLayer()->protectVisibleTileTextures();
}
+void NonCompositedContentHost::invalidateRect(const IntRect& rect)
+{
+ m_graphicsLayer->setNeedsDisplayInRect(FloatRect(rect));
+}
+
void NonCompositedContentHost::notifyAnimationStarted(const GraphicsLayer*, double /* time */)
{
// Intentionally left empty since we don't support animations on the non-composited content.
Modified: trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.h (95151 => 95152)
--- trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.h 2011-09-15 02:26:42 UTC (rev 95151)
+++ trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.h 2011-09-15 02:34:02 UTC (rev 95152)
@@ -27,6 +27,7 @@
#define NonCompositedContentHost_h
#include "GraphicsLayerClient.h"
+#include "IntSize.h"
#include <wtf/Noncopyable.h>
#include <wtf/OwnPtr.h>
@@ -36,6 +37,7 @@
class GraphicsLayer;
class GraphicsContext;
+class IntPoint;
class IntRect;
class LayerPainterChromium;
@@ -49,12 +51,11 @@
virtual ~NonCompositedContentHost();
void invalidateRect(const IntRect&);
- void invalidateEntireLayer();
- void setScrollPosition(const IntPoint&);
+ void setRootLayer(GraphicsLayer*);
+ void setViewport(const IntSize& viewportSize, const IntSize& contentsSize, const IntPoint& scrollPosition);
void protectVisibleTileTextures();
+ GraphicsLayer* topLevelRootLayer() const { return m_graphicsLayer.get(); }
- GraphicsLayer* graphicsLayer() const { return m_graphicsLayer.get(); }
-
private:
explicit NonCompositedContentHost(PassOwnPtr<LayerPainterChromium> contentPaint);
@@ -67,6 +68,7 @@
OwnPtr<GraphicsLayer> m_graphicsLayer;
OwnPtr<LayerPainterChromium> m_contentPaint;
+ IntSize m_viewportSize;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (95151 => 95152)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2011-09-15 02:26:42 UTC (rev 95151)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2011-09-15 02:34:02 UTC (rev 95152)
@@ -29,7 +29,6 @@
#include "LayerChromium.h"
#include "LayerPainterChromium.h"
#include "LayerRendererChromium.h"
-#include "NonCompositedContentHost.h"
#include "TraceEvent.h"
#include "TreeSynchronizer.h"
#include "cc/CCLayerTreeHostCommon.h"
@@ -40,19 +39,19 @@
namespace WebCore {
-PassRefPtr<CCLayerTreeHost> CCLayerTreeHost::create(CCLayerTreeHostClient* client, const CCSettings& settings)
+PassRefPtr<CCLayerTreeHost> CCLayerTreeHost::create(CCLayerTreeHostClient* client, PassRefPtr<LayerChromium> rootLayer, const CCSettings& settings)
{
- RefPtr<CCLayerTreeHost> layerTreeHost = adoptRef(new CCLayerTreeHost(client, settings));
+ RefPtr<CCLayerTreeHost> layerTreeHost = adoptRef(new CCLayerTreeHost(client, rootLayer, settings));
if (!layerTreeHost->initialize())
return 0;
return layerTreeHost;
}
-CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCSettings& settings)
+CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, PassRefPtr<LayerChromium> rootLayer, const CCSettings& settings)
: m_animating(false)
, m_client(client)
, m_frameNumber(0)
- , m_nonCompositedContentHost(NonCompositedContentHost::create(m_client->createRootLayerPainter()))
+ , m_rootLayer(rootLayer)
, m_settings(settings)
, m_zoomAnimatorScale(1)
, m_visible(true)
@@ -75,14 +74,6 @@
// Update m_settings based on capabilities that we got back from the renderer.
m_settings.acceleratePainting = m_proxy->layerRendererCapabilities().usingAcceleratedPainting;
- m_rootLayer = GraphicsLayer::create(0);
-#ifndef NDEBUG
- m_rootLayer->setName("root layer");
-#endif
- m_rootLayer->setDrawsContent(false);
-
- m_rootLayer->addChild(m_nonCompositedContentHost->graphicsLayer());
-
// We changed the root layer. Tell the proxy a commit is needed.
m_proxy->setNeedsCommitAndRedraw();
@@ -96,7 +87,7 @@
TRACE_EVENT("CCLayerTreeHost::~CCLayerTreeHost", this, 0);
m_proxy->stop();
m_proxy.clear();
- m_updateList.clear();
+ clearPendingUpdate();
ASSERT(!m_contentsTextureManager || !m_contentsTextureManager->currentMemoryUseBytes());
m_contentsTextureManager.clear();
}
@@ -125,7 +116,7 @@
contentsTextureManager()->deleteEvictedTextures(hostImpl->context());
updateCompositorResources(m_updateList, hostImpl->context());
- m_updateList.clear();
+ clearPendingUpdate();
hostImpl->setVisible(m_visible);
hostImpl->setZoomAnimatorScale(m_zoomAnimatorScale);
@@ -136,7 +127,7 @@
// Synchronize trees, if one exists at all...
if (rootLayer())
- hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer()->platformLayer(), hostImpl->rootLayer()));
+ hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostImpl->rootLayer()));
else
hostImpl->setRootLayer(0);
@@ -163,7 +154,7 @@
m_contentsTextureManager->evictAndDeleteAllTextures(0);
if (rootLayer())
- rootLayer()->platformLayer()->cleanupResourcesRecursive();
+ rootLayer()->cleanupResourcesRecursive();
m_client->didRecreateGraphicsContext(success);
}
@@ -191,11 +182,6 @@
m_proxy->finishAllRendering();
}
-void CCLayerTreeHost::invalidateRootLayerRect(const IntRect& dirtyRect)
-{
- m_nonCompositedContentHost->invalidateRect(dirtyRect);
-}
-
const LayerRendererCapabilities& CCLayerTreeHost::layerRendererCapabilities() const
{
return m_proxy->layerRendererCapabilities();
@@ -231,45 +217,9 @@
#endif
}
-void CCLayerTreeHost::clearRenderSurfacesRecursive(LayerChromium* layer)
+void CCLayerTreeHost::setViewport(const IntSize& viewportSize)
{
- for (size_t i = 0; i < layer->children().size(); ++i)
- clearRenderSurfacesRecursive(layer->children()[i].get());
-
- if (layer->replicaLayer())
- clearRenderSurfacesRecursive(layer->replicaLayer());
-
- if (layer->maskLayer())
- clearRenderSurfacesRecursive(layer->maskLayer());
-
- layer->clearRenderSurface();
-}
-
-
-void CCLayerTreeHost::setRootLayer(GraphicsLayer* layer)
-{
- m_nonCompositedContentHost->graphicsLayer()->removeAllChildren();
- m_nonCompositedContentHost->invalidateEntireLayer();
- if (layer)
- m_nonCompositedContentHost->graphicsLayer()->addChild(layer);
- else {
- clearRenderSurfacesRecursive(rootLayer()->platformLayer());
- m_nonCompositedContentHost->graphicsLayer()->platformLayer()->setLayerTreeHost(0);
- m_rootLayer->platformLayer()->setLayerTreeHost(0);
- }
-}
-
-void CCLayerTreeHost::setViewport(const IntSize& viewportSize, const IntSize& contentsSize, const IntPoint& scrollPosition)
-{
- bool visibleRectChanged = m_viewportSize != viewportSize;
-
m_viewportSize = viewportSize;
- m_nonCompositedContentHost->setScrollPosition(scrollPosition);
- m_nonCompositedContentHost->graphicsLayer()->setSize(contentsSize);
-
- if (visibleRectChanged)
- m_nonCompositedContentHost->invalidateEntireLayer();
-
setNeedsCommitAndRedraw();
}
@@ -279,7 +229,6 @@
if (visible)
m_proxy->setNeedsCommitAndRedraw();
else {
- m_nonCompositedContentHost->protectVisibleTileTextures();
m_contentsTextureManager->reduceMemoryToLimit(TextureManager::lowLimitBytes());
m_contentsTextureManager->unprotectAllTextures();
m_proxy->setNeedsCommit();
@@ -312,7 +261,7 @@
if (viewportSize().isEmpty())
return;
- updateLayers(rootLayer()->platformLayer());
+ updateLayers(rootLayer());
}
void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer)
@@ -395,7 +344,7 @@
if (layer->bounds().isEmpty())
continue;
- IntRect defaultContentRect = IntRect(rootLayer()->platformLayer()->scrollPosition(), viewportSize());
+ IntRect defaultContentRect = IntRect(rootLayer()->scrollPosition(), viewportSize());
IntRect targetSurfaceRect = layer->targetRenderSurface() ? layer->targetRenderSurface()->contentRect() : defaultContentRect;
if (layer->usesLayerScissor())
@@ -457,4 +406,14 @@
layer->updateCompositorResources(context);
}
+void CCLayerTreeHost::clearPendingUpdate()
+{
+ for (size_t surfaceIndex = 0; surfaceIndex < m_updateList.size(); ++surfaceIndex) {
+ LayerChromium* layer = m_updateList[surfaceIndex].get();
+ ASSERT(layer->renderSurface());
+ layer->clearRenderSurface();
+ }
+ m_updateList.clear();
}
+
+}
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (95151 => 95152)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h 2011-09-15 02:26:42 UTC (rev 95151)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h 2011-09-15 02:34:02 UTC (rev 95152)
@@ -44,8 +44,6 @@
class GraphicsContext3D;
class LayerChromium;
class LayerPainterChromium;
-class GraphicsLayer;
-class NonCompositedContentHost;
class TextureManager;
class CCLayerTreeHostClient {
@@ -93,7 +91,7 @@
class CCLayerTreeHost : public RefCounted<CCLayerTreeHost> {
public:
- static PassRefPtr<CCLayerTreeHost> create(CCLayerTreeHostClient*, const CCSettings&);
+ static PassRefPtr<CCLayerTreeHost> create(CCLayerTreeHostClient*, PassRefPtr<LayerChromium> rootLayer, const CCSettings&);
virtual ~CCLayerTreeHost();
// CCLayerTreeHost interface to CCProxy.
@@ -128,7 +126,6 @@
int frameNumber() const { return m_frameNumber; }
- void invalidateRootLayerRect(const IntRect& dirtyRect);
void setZoomAnimatorScale(double);
const LayerRendererCapabilities& layerRendererCapabilities() const;
@@ -139,27 +136,24 @@
void setNeedsCommitAndRedraw();
void setNeedsRedraw();
- void setRootLayer(GraphicsLayer*);
- GraphicsLayer* rootLayer() { return m_rootLayer.get(); }
- const GraphicsLayer* rootLayer() const { return m_rootLayer.get(); }
+ LayerChromium* rootLayer() { return m_rootLayer.get(); }
+ const LayerChromium* rootLayer() const { return m_rootLayer.get(); }
const CCSettings& settings() const { return m_settings; }
- void setViewport(const IntSize& viewportSize, const IntSize& contentsSize, const IntPoint& scrollPosition);
+ void setViewport(const IntSize& viewportSize);
const IntSize& viewportSize() const { return m_viewportSize; }
TextureManager* contentsTextureManager() const;
void setVisible(bool);
- NonCompositedContentHost* nonCompositedContentHost() const { return m_nonCompositedContentHost.get(); }
-
void updateLayers();
void deleteContentsTextures(GraphicsContext3D*);
protected:
- CCLayerTreeHost(CCLayerTreeHostClient*, const CCSettings&);
+ CCLayerTreeHost(CCLayerTreeHostClient*, PassRefPtr<LayerChromium> rootLayer, const CCSettings&);
private:
typedef Vector<RefPtr<LayerChromium> > LayerList;
@@ -168,9 +162,8 @@
void updateLayers(LayerChromium*);
void updateCompositorResources(const LayerList&, GraphicsContext3D*);
void updateCompositorResources(LayerChromium*, GraphicsContext3D*);
+ void clearPendingUpdate();
- void clearRenderSurfacesRecursive(LayerChromium*);
-
bool initialize();
bool m_animating;
@@ -181,8 +174,7 @@
OwnPtr<CCProxy> m_proxy;
- OwnPtr<GraphicsLayer> m_rootLayer;
- OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost;
+ RefPtr<LayerChromium> m_rootLayer;
OwnPtr<TextureManager> m_contentsTextureManager;
LayerList m_updateList;
Modified: trunk/Source/WebKit/chromium/ChangeLog (95151 => 95152)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-09-15 02:26:42 UTC (rev 95151)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-09-15 02:34:02 UTC (rev 95152)
@@ -1,3 +1,20 @@
+2011-09-14 Antoine Labour <[email protected]>
+
+ Remove the dependency on GraphicsLayer from CCLayerTreeHost.
+ Move root layer management into the NonCompositedContentHost.
+ Have WebViewImpl create a NonCompositedContentHost explicitly.
+ https://bugs.webkit.org/show_bug.cgi?id=67883
+
+ Reviewed by James Robinson.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setRootGraphicsLayer):
+ (WebKit::WebViewImpl::invalidateRootLayerRect):
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ (WebKit::WebViewImpl::updateLayerTreeViewport):
+ (WebKit::WebViewImpl::setVisibilityState):
+ * src/WebViewImpl.h:
+
2011-09-14 Nebojsa Ciric <[email protected]>
Changed WebKit.gyp to use the new grit version of the scripts that handle
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (95151 => 95152)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2011-09-15 02:26:42 UTC (rev 95151)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2011-09-15 02:34:02 UTC (rev 95152)
@@ -74,9 +74,11 @@
#include "InspectorController.h"
#include "KeyboardCodes.h"
#include "KeyboardEvent.h"
+#include "LayerChromium.h"
#include "LayerPainterChromium.h"
#include "MIMETypeRegistry.h"
#include "NodeRenderStyle.h"
+#include "NonCompositedContentHost.h"
#include "Page.h"
#include "PageGroup.h"
#include "PageGroupLoadDeferrer.h"
@@ -2549,8 +2551,8 @@
m_rootGraphicsLayer = layer;
setIsAcceleratedCompositingActive(layer);
- if (m_layerTreeHost)
- m_layerTreeHost->setRootLayer(layer);
+ if (m_nonCompositedContentHost)
+ m_nonCompositedContentHost->setRootLayer(layer);
IntRect damagedRect(0, 0, m_size.width, m_size.height);
if (!m_isAcceleratedCompositingActive)
@@ -2585,7 +2587,7 @@
FrameView* view = page()->mainFrame()->view();
IntRect dirtyRect = view->windowToContents(rect);
updateLayerTreeViewport();
- m_layerTreeHost->invalidateRootLayerRect(dirtyRect);
+ m_nonCompositedContentHost->invalidateRect(dirtyRect);
setRootLayerNeedsDisplay();
}
@@ -2654,7 +2656,8 @@
ccSettings.showFPSCounter = settings()->showFPSCounter();
ccSettings.showPlatformLayerTree = settings()->showPlatformLayerTree();
- m_layerTreeHost = CCLayerTreeHost::create(this, ccSettings);
+ m_nonCompositedContentHost = NonCompositedContentHost::create(WebViewImplContentPainter::create(this));
+ m_layerTreeHost = CCLayerTreeHost::create(this, m_nonCompositedContentHost->topLevelRootLayer()->platformLayer(), ccSettings);
if (m_layerTreeHost) {
updateLayerTreeViewport();
m_client->didActivateAcceleratedCompositing(true);
@@ -2738,7 +2741,8 @@
IntRect visibleRect = view->visibleContentRect(true /* include scrollbars */);
IntPoint scroll(view->scrollX(), view->scrollY());
- m_layerTreeHost->setViewport(visibleRect.size(), view->contentsSize(), scroll);
+ m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll);
+ m_layerTreeHost->setViewport(visibleRect.size());
}
WebGraphicsContext3D* WebViewImpl::graphicsContext3D()
@@ -2780,8 +2784,12 @@
#endif
#if USE(ACCELERATED_COMPOSITING)
- if (isAcceleratedCompositingActive())
- m_layerTreeHost->setVisible(visibilityState == WebPageVisibilityStateVisible);
+ if (isAcceleratedCompositingActive()) {
+ bool visible = visibilityState == WebPageVisibilityStateVisible;
+ if (!visible)
+ m_nonCompositedContentHost->protectVisibleTileTextures();
+ m_layerTreeHost->setVisible(visible);
+ }
#endif
}
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (95151 => 95152)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.h 2011-09-15 02:26:42 UTC (rev 95151)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h 2011-09-15 02:34:02 UTC (rev 95152)
@@ -60,6 +60,7 @@
class HistoryItem;
class HitTestResult;
class KeyboardEvent;
+class NonCompositedContentHost;
class Page;
class PlatformKeyboardEvent;
class PopupContainer;
@@ -572,6 +573,7 @@
#if USE(ACCELERATED_COMPOSITING)
WebCore::IntRect m_rootLayerScrollDamage;
+ OwnPtr<WebCore::NonCompositedContentHost> m_nonCompositedContentHost;
RefPtr<WebCore::CCLayerTreeHost> m_layerTreeHost;
WebCore::GraphicsLayer* m_rootGraphicsLayer;
bool m_isAcceleratedCompositingActive;