Index: third_party/WebKit/Source/web/WebViewImpl.cpp |
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp |
index 967783155d0b9540c390605a97edd23015b26b47..86809ad2ae6323269499cc70a24ceb52101d56c1 100644 |
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp |
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp |
@@ -2786,11 +2786,6 @@ void WebViewImpl::setTextDirection(WebTextDirection direction) |
bool WebViewImpl::isAcceleratedCompositingActive() const |
{ |
- // For SPv2, accelerated compositing is managed by the |
- // PaintArtifactCompositor. |
- if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
- return m_paintArtifactCompositor.rootLayer(); |
- |
return m_rootLayer; |
} |
@@ -2805,10 +2800,7 @@ void WebViewImpl::willCloseLayerTreeView() |
if (m_layerTreeView) |
page()->willCloseLayerTreeView(*m_layerTreeView); |
- if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
- detachPaintArtifactCompositor(); |
- else |
- setRootGraphicsLayer(nullptr); |
+ setRootLayer(nullptr); |
m_mutator = nullptr; |
m_layerTreeView = nullptr; |
@@ -4242,18 +4234,17 @@ void WebViewImpl::registerViewportLayersWithCompositor() |
layoutViewportWebLayer); |
} |
-void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) |
+void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* graphicsLayer) |
{ |
if (!m_layerTreeView) |
return; |
- // In SPv2, we attach layers via PaintArtifactCompositor, rather than |
- // supplying a root GraphicsLayer from PaintLayerCompositor. |
+ // In SPv2, setRootLayer is used instead. |
DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
VisualViewport& visualViewport = page()->frameHost().visualViewport(); |
- visualViewport.attachToLayerTree(layer); |
- if (layer) { |
+ visualViewport.attachToLayerTree(graphicsLayer); |
+ if (graphicsLayer) { |
m_rootGraphicsLayer = visualViewport.rootGraphicsLayer(); |
m_visualViewportContainerLayer = visualViewport.containerLayer(); |
m_rootLayer = m_rootGraphicsLayer->platformLayer(); |
@@ -4283,6 +4274,28 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) |
} |
} |
+void WebViewImpl::setRootLayer(WebLayer* layer) |
+{ |
+ if (!m_layerTreeView) |
+ return; |
+ |
+ if (layer) { |
+ m_rootLayer = layer; |
+ m_layerTreeView->setRootLayer(*m_rootLayer); |
+ m_layerTreeView->setVisible(page()->isPageVisible()); |
+ } else { |
+ m_rootLayer = nullptr; |
+ // This means that we're transitioning to a new page. Suppress |
+ // commits until Blink generates invalidations so we don't |
+ // attempt to paint too early in the next page load. |
+ m_layerTreeView->setDeferCommits(true); |
+ m_layerTreeView->clearRootLayer(); |
+ m_layerTreeView->clearViewportLayers(); |
+ if (WebDevToolsAgentImpl* devTools = mainFrameDevToolsAgentImpl()) |
+ devTools->rootLayerCleared(); |
+ } |
+} |
+ |
void WebViewImpl::invalidateRect(const IntRect& rect) |
{ |
if (m_layerTreeView) { |
@@ -4355,9 +4368,6 @@ void WebViewImpl::initializeLayerTreeView() |
m_linkHighlightsTimeline = CompositorAnimationTimeline::create(); |
attachCompositorAnimationTimeline(m_linkHighlightsTimeline.get()); |
} |
- |
- if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
- attachPaintArtifactCompositor(); |
} |
void WebViewImpl::applyViewportDeltas( |
@@ -4555,36 +4565,6 @@ void WebViewImpl::updatePageOverlays() |
} |
} |
-void WebViewImpl::attachPaintArtifactCompositor() |
-{ |
- if (!m_layerTreeView) |
- return; |
- |
- // Otherwise, PaintLayerCompositor is expected to supply a root |
- // GraphicsLayer via setRootGraphicsLayer. |
- DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
- |
- // TODO(jbroman): This should probably have hookups for overlays, visual |
- // viewport, etc. |
- |
- WebLayer* rootLayer = m_paintArtifactCompositor.getWebLayer(); |
- DCHECK(rootLayer); |
- m_layerTreeView->setRootLayer(*rootLayer); |
- |
- // TODO(jbroman): This is cargo-culted from setRootGraphicsLayer. Is it |
- // necessary? |
- m_layerTreeView->setVisible(page()->isPageVisible()); |
-} |
- |
-void WebViewImpl::detachPaintArtifactCompositor() |
-{ |
- if (!m_layerTreeView) |
- return; |
- |
- m_layerTreeView->setDeferCommits(true); |
- m_layerTreeView->clearRootLayer(); |
-} |
- |
float WebViewImpl::deviceScaleFactor() const |
{ |
// TODO(oshima): Investigate if this should return the ScreenInfo's scale factor rather than |