Index: Source/core/frame/FrameView.cpp |
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp |
index 0db15c40762f84fa5451a111e168b3d83a401395..92aa2a82c1e4ec7c7de5c27508221abf0020251f 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" |
@@ -92,6 +93,7 @@ |
#include "platform/graphics/GraphicsContext.h" |
#include "platform/graphics/GraphicsLayer.h" |
#include "platform/graphics/GraphicsLayerDebugInfo.h" |
+#include "platform/graphics/paint/DisplayItemList.h" |
#include "platform/scroll/ScrollAnimator.h" |
#include "platform/text/TextStream.h" |
#include "wtf/CurrentTime.h" |
@@ -2439,15 +2441,21 @@ void FrameView::updateAllLifecyclePhases() |
frame().localFrameRoot()->view()->updateAllLifecyclePhasesInternal(); |
} |
-// TODO(chrishtr): add a scrolling update lifecycle phase, after compositing and before invalidation. |
+// TODO(chrishtr): add a scrolling update lifecycle phase. |
void FrameView::updateLifecycleToCompositingCleanPlusScrolling() |
{ |
frame().localFrameRoot()->view()->updateStyleAndLayoutIfNeededRecursive(); |
LayoutView* view = layoutView(); |
- if (view) |
+ if (view) { |
+ // For SlimmingPaintV2, we still need this to set up the root layer(s). |
view->compositor()->updateIfNeededRecursive(); |
+ } |
+ |
scrollContentsIfNeededRecursive(); |
+ if (view && RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
+ paintAndComposite(); |
+ |
ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean); |
} |
@@ -2465,15 +2473,47 @@ void FrameView::updateAllLifecyclePhasesInternal() |
if (view) { |
TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUpdateLayerTreeEvent::data(m_frame.get())); |
+ // For SlimmingPaintV2, we still need this to set up the root layer(s). |
view->compositor()->updateIfNeededRecursive(); |
scrollContentsIfNeededRecursive(); |
invalidateTreeIfNeededRecursive(); |
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
+ paintAndComposite(); |
updatePostLifecycleData(); |
ASSERT(!view->hasPendingSelection()); |
} |
- ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); |
+ ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean |
+ || (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && 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; |
+ |
+ // TODO: Update callers to pass in the interest rect. |
+ IntRect interestRect = LayoutRect::infiniteIntRect(); |
+ GraphicsContext context(rootGraphicsLayer->displayItemList()); |
+ rootGraphicsLayer->paint(context, interestRect); |
+ |
+ 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() |