Index: Source/core/frame/FrameView.cpp |
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp |
index a888a3fd49e9334fa99d2a09efe43bb3046620d7..5d89907195b4213ad8fa3db5a9ed23391833f9f1 100644 |
--- a/Source/core/frame/FrameView.cpp |
+++ b/Source/core/frame/FrameView.cpp |
@@ -29,6 +29,7 @@ |
#include "core/HTMLNames.h" |
#include "core/MediaTypeNames.h" |
+#include "core/compositing/DisplayListCompositingBuilder.h" |
#include "core/css/FontFaceSet.h" |
#include "core/css/resolver/StyleResolver.h" |
#include "core/dom/AXObjectCache.h" |
@@ -2462,9 +2463,16 @@ void FrameView::updateLifecycleToCompositingCleanPlusScrolling() |
{ |
frame().localFrameRoot()->view()->updateStyleAndLayoutIfNeededRecursive(); |
LayoutView* view = layoutView(); |
- if (view) |
+ if (view) { |
+ // If SlimmingPaintCompositorLayerizationEnabled is on, we still need this to set up the root layer(s). |
view->compositor()->updateIfNeededRecursive(); |
- scrollContentsIfNeededRecursive(); |
+ |
+ if (RuntimeEnabledFeatures::slimmingPaintCompositorLayerizationEnabled()) { |
+ invalidateTreeIfNeededRecursive(); |
+ paintAndComposite(); |
+ } |
+ scrollContentsIfNeededRecursive(); |
+ } |
ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean); |
} |
@@ -2482,16 +2490,45 @@ void FrameView::updateAllLifecyclePhasesInternal() |
LayoutView* view = layoutView(); |
if (view) { |
TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUpdateLayerTreeEvent::data(m_frame.get())); |
- |
+ // If SlimmingPaintCompositorLayerizationEnabled is on, we still need this to set up the root layer(s). |
view->compositor()->updateIfNeededRecursive(); |
+ |
+ if (RuntimeEnabledFeatures::slimmingPaintCompositorLayerizationEnabled()) { |
+ invalidateTreeIfNeededRecursive(); |
+ paintAndComposite(); |
+ } |
scrollContentsIfNeededRecursive(); |
- invalidateTreeIfNeededRecursive(); |
updatePostLifecycleData(); |
ASSERT(!view->hasPendingSelection()); |
} |
- ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); |
+ ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean |
+ || (RuntimeEnabledFeatures::slimmingPaintCompositorLayerizationEnabled() && lifecycle().state() == DocumentLifecycle::CompositingClean)); |
+} |
+ |
+void FrameView::paintAndComposite() |
+{ |
+ ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalFrame())); |
+ LayoutView* view = layoutView(); |
+ ASSERT(view); |
+ GraphicsLayer* rootGraphicsLayer = view->layer()->graphicsLayerBacking(); |
+ // Detached frames can have no root graphics layer. |
+ if (!rootGraphicsLayer) |
+ return; |
+ |
+ GraphicsContext context(rootGraphicsLayer->displayItemList()); |
+ rootGraphicsLayer->paint(context); |
+ |
+ DisplayListDiff displayListDiff; |
+ rootGraphicsLayer->displayItemList()->commitNewDisplayItems(&displayListDiff); |
+ |
+ lifecycle().advanceTo(DocumentLifecycle::InCompositingUpdate); |
+ |
+ DisplayListCompositingBuilder compositingBuilder(*rootGraphicsLayer->displayItemList(), displayListDiff, *rootGraphicsLayer); |
+ compositingBuilder.build(); |
+ |
+ lifecycle().advanceTo(DocumentLifecycle::CompositingClean); |
} |
void FrameView::updatePostLifecycleData() |