Index: third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp |
diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp |
index aa5ef52254f60256d7d8963d211e8db862c0cab8..9086bc31c3632a87a71e5c147d906fddb75d37d1 100644 |
--- a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp |
+++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp |
@@ -354,6 +354,14 @@ static void forceRecomputeVisualRectsIncludingNonCompositingDescendants( |
} |
} |
+GraphicsLayer* PaintLayerCompositor::parentForContentLayers() const { |
+ if (m_rootContentLayer) |
+ return m_rootContentLayer.get(); |
+ // Iframe content layers will be connected by the parent frame using |
+ // attachFrameContentLayersToIframeLayer. |
+ return isMainFrame() ? visualViewport().scrollLayer() : nullptr; |
bokan
2017/03/06 15:42:30
Is it true that !rootContentLayer implies rootLaye
skobes
2017/03/06 23:00:25
Done.
|
+} |
+ |
void PaintLayerCompositor::updateIfNeeded() { |
CompositingUpdateType updateType = m_pendingUpdateType; |
m_pendingUpdateType = CompositingUpdateNone; |
@@ -444,9 +452,10 @@ void PaintLayerCompositor::updateIfNeeded() { |
GraphicsLayerTreeBuilder().rebuild(*updateRoot, childList); |
} |
- if (!childList.isEmpty()) { |
- CHECK(m_rootContentLayer && m_compositing); |
- m_rootContentLayer->setChildren(childList); |
+ GraphicsLayer* contentParent = parentForContentLayers(); |
+ if (contentParent && !childList.isEmpty()) { |
+ CHECK(m_compositing); |
+ contentParent->setChildren(childList); |
} |
applyOverlayFullscreenVideoAdjustmentIfNeeded(); |
@@ -692,7 +701,7 @@ void PaintLayerCompositor::frameViewScrollbarsExistenceDidChange() { |
} |
void PaintLayerCompositor::rootFixedBackgroundsChanged() { |
- if (!supportsFixedRootBackgroundCompositing()) |
+ if (!supportsFixedRootBackgroundCompositing() || !m_containerLayer) |
return; |
// To avoid having to make the fixed root background layer fixed positioned to |
@@ -724,13 +733,16 @@ std::unique_ptr<JSONObject> PaintLayerCompositor::layerTreeAsJSON( |
ASSERT(lifecycle().state() >= DocumentLifecycle::PaintInvalidationClean || |
m_layoutView.frameView()->shouldThrottleRendering()); |
- if (!m_rootContentLayer) |
- return nullptr; |
- |
// We skip dumping the scroll and clip layers to keep layerTreeAsText output |
// similar between platforms (unless we explicitly request dumping from the |
// root. |
GraphicsLayer* rootLayer = m_rootContentLayer.get(); |
+ if (!rootLayer) |
+ rootLayer = rootGraphicsLayer(); |
+ |
+ if (!rootLayer) |
+ return nullptr; |
+ |
if (flags & LayerTreeIncludesRootLayer) { |
if (isMainFrame()) { |
while (rootLayer->parent()) |
@@ -768,6 +780,7 @@ bool PaintLayerCompositor::attachFrameContentLayersToIframeLayer( |
if (!layer->hasCompositedLayerMapping()) |
return false; |
+ DisableCompositingQueryAsserts disabler; |
layer->compositedLayerMapping()->setSublayers( |
GraphicsLayerVector(1, innerCompositor->rootGraphicsLayer())); |
return true; |
@@ -796,11 +809,11 @@ PaintLayer* PaintLayerCompositor::rootLayer() const { |
} |
GraphicsLayer* PaintLayerCompositor::rootGraphicsLayer() const { |
- return m_overflowControlsHostLayer.get(); |
-} |
- |
-GraphicsLayer* PaintLayerCompositor::frameScrollLayer() const { |
- return m_scrollLayer.get(); |
+ if (m_overflowControlsHostLayer) |
+ return m_overflowControlsHostLayer.get(); |
+ if (CompositedLayerMapping* clm = rootLayer()->compositedLayerMapping()) |
+ return clm->childForSuperlayers(); |
+ return nullptr; |
} |
GraphicsLayer* PaintLayerCompositor::scrollLayer() const { |
@@ -810,14 +823,6 @@ GraphicsLayer* PaintLayerCompositor::scrollLayer() const { |
return nullptr; |
} |
-GraphicsLayer* PaintLayerCompositor::containerLayer() const { |
- return m_containerLayer.get(); |
-} |
- |
-GraphicsLayer* PaintLayerCompositor::rootContentLayer() const { |
- return m_rootContentLayer.get(); |
-} |
- |
void PaintLayerCompositor::setIsInWindow(bool isInWindow) { |
if (!staleInCompositingMode()) |
return; |
@@ -1128,7 +1133,11 @@ void PaintLayerCompositor::ensureRootLayer() { |
if (isMainFrame()) |
visualViewport().createLayerTree(); |
- if (!m_rootContentLayer) { |
+ // When RLS is enabled, none of the PLC GraphicsLayers exist. |
+ bool shouldCreateOwnLayers = |
+ !RuntimeEnabledFeatures::rootLayerScrollingEnabled(); |
+ |
+ if (shouldCreateOwnLayers && !m_rootContentLayer) { |
m_rootContentLayer = GraphicsLayer::create(this); |
IntRect overflowRect = m_layoutView.pixelSnappedLayoutOverflowRect(); |
m_rootContentLayer->setSize( |
@@ -1138,7 +1147,7 @@ void PaintLayerCompositor::ensureRootLayer() { |
DOMNodeIds::idForNode(m_layoutView.node())); |
} |
- if (!m_overflowControlsHostLayer) { |
+ if (shouldCreateOwnLayers && !m_overflowControlsHostLayer) { |
ASSERT(!m_scrollLayer); |
ASSERT(!m_containerLayer); |
@@ -1183,9 +1192,6 @@ void PaintLayerCompositor::ensureRootLayer() { |
} |
void PaintLayerCompositor::destroyRootLayer() { |
- if (!m_rootContentLayer) |
bokan
2017/03/06 15:42:30
It seems like the existence of rootContentLayer wa
skobes
2017/03/06 23:00:25
PLC still tracks its state in m_rootLayerAttachmen
|
- return; |
- |
detachRootLayer(); |
if (m_layerForHorizontalScrollbar) { |
@@ -1225,8 +1231,7 @@ void PaintLayerCompositor::destroyRootLayer() { |
} |
void PaintLayerCompositor::attachRootLayer(RootLayerAttachment attachment) { |
- if (!m_rootContentLayer) |
- return; |
+ DisableCompositingQueryAsserts disabler; |
szager1
2017/03/06 22:07:47
Why is this now necessary?
skobes
2017/03/06 23:00:25
Done.
|
// In Slimming Paint v2, PaintArtifactCompositor is responsible for the root |
// layer. |
@@ -1256,7 +1261,7 @@ void PaintLayerCompositor::attachRootLayer(RootLayerAttachment attachment) { |
} |
void PaintLayerCompositor::detachRootLayer() { |
- if (!m_rootContentLayer || m_rootLayerAttachment == RootLayerUnattached) |
+ if (m_rootLayerAttachment == RootLayerUnattached) |
return; |
switch (m_rootLayerAttachment) { |
@@ -1266,7 +1271,7 @@ void PaintLayerCompositor::detachRootLayer() { |
// frame's layoutObject in the parent document. |
if (m_overflowControlsHostLayer) |
m_overflowControlsHostLayer->removeFromParent(); |
- else |
+ else if (m_rootContentLayer) |
bokan
2017/03/06 15:42:29
Just some questions for my own benefit: how does t
skobes
2017/03/06 23:00:25
Good question. It looks like this branch is a his
|
m_rootContentLayer->removeFromParent(); |
if (HTMLFrameOwnerElement* ownerElement = |