Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Unified Diff: third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp

Issue 2735543002: Separate VisualViewport layer tree creation from attachment. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 b80b4bacc2b14934db7a6f20c78d15a570706e3b..960e797a567a0e278c8e0bfb066efd0e17373b59 100644
--- a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
@@ -462,7 +462,7 @@ void PaintLayerCompositor::updateIfNeeded() {
}
// Inform the inspector that the layer tree has changed.
- if (m_layoutView.frame()->isMainFrame())
+ if (isMainFrame())
probe::layerTreeDidChange(m_layoutView.frame());
}
@@ -723,7 +723,7 @@ std::unique_ptr<JSONObject> PaintLayerCompositor::layerTreeAsJSON(
// root.
GraphicsLayer* rootLayer = m_rootContentLayer.get();
if (flags & LayerTreeIncludesRootLayer) {
- if (m_layoutView.frame()->isMainFrame()) {
+ if (isMainFrame()) {
while (rootLayer->parent())
rootLayer = rootLayer->parent();
} else {
@@ -1046,11 +1046,8 @@ void PaintLayerCompositor::updateOverflowControlsLayers() {
// Main frame scrollbars should always be stuck to the sides of the screen (in
// overscroll and in pinch-zoom), so make the parent for the scrollbars be the
// viewport container layer.
- if (m_layoutView.frame()->isMainFrame()) {
- VisualViewport& visualViewport =
- m_layoutView.frameView()->page()->frameHost().visualViewport();
- controlsParent = visualViewport.containerLayer();
- }
+ if (isMainFrame())
+ controlsParent = visualViewport().containerLayer();
if (requiresHorizontalScrollbarLayer()) {
if (!m_layerForHorizontalScrollbar) {
@@ -1119,6 +1116,9 @@ void PaintLayerCompositor::ensureRootLayer() {
if (expectedAttachment == m_rootLayerAttachment)
return;
+ if (isMainFrame())
+ visualViewport().createLayerTree();
+
if (!m_rootContentLayer) {
m_rootContentLayer = GraphicsLayer::create(this);
IntRect overflowRect = m_layoutView.pixelSnappedLayoutOverflowRect();
@@ -1330,6 +1330,14 @@ DocumentLifecycle& PaintLayerCompositor::lifecycle() const {
return m_layoutView.document().lifecycle();
}
+bool PaintLayerCompositor::isMainFrame() const {
+ return m_layoutView.frame()->isMainFrame();
+}
+
+VisualViewport& PaintLayerCompositor::visualViewport() const {
+ return m_layoutView.frameView()->page()->frameHost().visualViewport();
+}
+
String PaintLayerCompositor::debugName(
const GraphicsLayer* graphicsLayer) const {
String name;

Powered by Google App Engine
This is Rietveld 408576698