Chromium Code Reviews| Index: third_party/WebKit/Source/core/frame/FrameView.cpp |
| diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp |
| index 4457eaa45113268e55ad80b6e4065e8cd90fdb8e..cd0420a3d58bc9840fe78637220ba7edd2e6a250 100644 |
| --- a/third_party/WebKit/Source/core/frame/FrameView.cpp |
| +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp |
| @@ -28,6 +28,7 @@ |
| #include "core/HTMLNames.h" |
| #include "core/MediaTypeNames.h" |
| +#include "core/animation/DocumentAnimations.h" |
| #include "core/css/FontFaceSet.h" |
| #include "core/css/resolver/StyleResolver.h" |
| #include "core/dom/AXObjectCache.h" |
| @@ -71,6 +72,7 @@ |
| #include "core/layout/api/LayoutViewItem.h" |
| #include "core/layout/compositing/CompositedLayerMapping.h" |
| #include "core/layout/compositing/CompositedSelection.h" |
| +#include "core/layout/compositing/CompositingInputsUpdater.h" |
| #include "core/layout/compositing/PaintLayerCompositor.h" |
| #include "core/layout/svg/LayoutSVGRoot.h" |
| #include "core/loader/DocumentLoader.h" |
| @@ -2516,12 +2518,6 @@ void FrameView::updateAllLifecyclePhases() |
| frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLifecycle::PaintClean); |
| } |
| -// TODO(chrishtr): add a scrolling update lifecycle phase. |
| -void FrameView::updateLifecycleToCompositingCleanPlusScrolling() |
| -{ |
| - frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLifecycle::CompositingClean); |
| -} |
| - |
| void FrameView::updateAllLifecyclePhasesExceptPaint() |
| { |
| frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLifecycle::PrePaintClean); |
| @@ -2624,28 +2620,31 @@ void FrameView::updateLifecyclePhasesInternal(DocumentLifecycle::LifecycleState |
| { |
| TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUpdateLayerTreeEvent::data(m_frame.get())); |
| - // This was required for slimming paint v1 but is only temporarily |
| - // needed for slimming paint v2. |
| - view.compositor()->updateIfNeededRecursive(); |
| - scrollContentsIfNeededRecursive(); |
| + if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| + view.compositor()->updateIfNeededRecursive(); |
| + } else { |
| + DocumentAnimations::updateAnimations(layoutView()->document()); |
| - DCHECK(lifecycle().state() >= DocumentLifecycle::CompositingClean); |
| + forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.layoutView()->commitPendingSelection(); }); |
| + } |
| + |
| + scrollContentsIfNeededRecursive(); |
| + DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() || lifecycle().state() >= DocumentLifecycle::CompositingClean); |
| if (targetState >= DocumentLifecycle::PrePaintClean) { |
| if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
| invalidateTreeIfNeededRecursive(); |
| - |
| if (view.compositor()->inCompositingMode()) |
| scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); |
| - m_frame->document()->rootScrollerController()->didUpdateCompositing(); |
| + if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
|
Xianzhu
2016/09/14 00:35:53
slimmingPaintV2Enabled()
chrishtr
2016/09/14 19:43:24
Done.
|
| + m_frame->document()->rootScrollerController()->didUpdateCompositing(); |
| updateCompositedSelectionIfNeeded(); |
| } |
| } |
| if (targetState >= DocumentLifecycle::PrePaintClean) { |
| - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| - updatePaintProperties(); |
| + updatePaintProperties(); |
| } |
| if (targetState == DocumentLifecycle::PaintClean) { |
| @@ -2675,8 +2674,16 @@ void FrameView::updatePaintProperties() |
| ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| + if (!m_paintController) |
| + m_paintController = PaintController::create(); |
| + |
| forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle().advanceTo(DocumentLifecycle::InPrePaint); }); |
| - PrePaintTreeWalk().walk(*this); |
| + |
| + // TODO(chrishtr): merte these into the actual pre-paint tree walk. |
| + if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| + forAllNonThrottledFrameViews([](FrameView& frameView) { CompositingInputsUpdater(frameView.layoutView()->layer()).update(); }); |
| + PrePaintTreeWalk().walk(*this); |
| + } |
| forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle().advanceTo(DocumentLifecycle::PrePaintClean); }); |
| } |
| @@ -2691,24 +2698,32 @@ void FrameView::synchronizedPaint() |
| ASSERT(!view.isNull()); |
| forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle().advanceTo(DocumentLifecycle::InPaint); }); |
| - // A null graphics layer can occur for painting of SVG images that are not parented into the main frame tree, |
| - // or when the FrameView is the main frame view of a page overlay. The page overlay is in the layer tree of |
| - // the host page and will be painted during synchronized painting of the host page. |
| - if (GraphicsLayer* rootGraphicsLayer = view.compositor()->rootGraphicsLayer()) { |
| - synchronizedPaintRecursively(rootGraphicsLayer); |
| - } |
| - |
| - // TODO(sataya.m):Main frame doesn't create RootFrameViewport in some |
| - // webkit_unit_tests (http://crbug.com/644788). |
| - if (m_viewportScrollableArea) { |
| - if (GraphicsLayer* layerForHorizontalScrollbar = m_viewportScrollableArea->layerForHorizontalScrollbar()) { |
| - synchronizedPaintRecursively(layerForHorizontalScrollbar); |
| + if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| + if (layoutView()->layer()->needsRepaint()) { |
| + GraphicsContext graphicsContext(*m_paintController); |
| + FramePainter(*this).paint(graphicsContext, GlobalPaintNormalPhase, CullRect(LayoutRect::infiniteIntRect())); |
| + m_paintController->commitNewDisplayItems(LayoutSize()); |
| } |
| - if (GraphicsLayer* layerForVerticalScrollbar = m_viewportScrollableArea->layerForVerticalScrollbar()) { |
| - synchronizedPaintRecursively(layerForVerticalScrollbar); |
| + } else { |
| + // A null graphics layer can occur for painting of SVG images that are not parented into the main frame tree, |
| + // or when the FrameView is the main frame view of a page overlay. The page overlay is in the layer tree of |
| + // the host page and will be painted during synchronized painting of the host page. |
| + if (GraphicsLayer* rootGraphicsLayer = view.compositor()->rootGraphicsLayer()) { |
| + synchronizedPaintRecursively(rootGraphicsLayer); |
| } |
| - if (GraphicsLayer* layerForScrollCorner = m_viewportScrollableArea->layerForScrollCorner()) { |
| - synchronizedPaintRecursively(layerForScrollCorner); |
| + |
| + // TODO(sataya.m):Main frame doesn't create RootFrameViewport in some |
| + // webkit_unit_tests (http://crbug.com/644788). |
| + if (m_viewportScrollableArea) { |
| + if (GraphicsLayer* layerForHorizontalScrollbar = m_viewportScrollableArea->layerForHorizontalScrollbar()) { |
| + synchronizedPaintRecursively(layerForHorizontalScrollbar); |
| + } |
| + if (GraphicsLayer* layerForVerticalScrollbar = m_viewportScrollableArea->layerForVerticalScrollbar()) { |
| + synchronizedPaintRecursively(layerForVerticalScrollbar); |
| + } |
| + if (GraphicsLayer* layerForScrollCorner = m_viewportScrollableArea->layerForScrollCorner()) { |
| + synchronizedPaintRecursively(layerForScrollCorner); |
| + } |
| } |
| } |
| @@ -2744,18 +2759,7 @@ void FrameView::pushPaintArtifactToCompositor() |
| ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| - LayoutViewItem viewItem = layoutViewItem(); |
| - ASSERT(!viewItem.isNull()); |
| - |
| - // TODO(jbroman): Simplify the path to PaintController. |
| - PaintLayer* layer = viewItem.layer(); |
| - ASSERT(layer); |
| - if (!layer->hasCompositedLayerMapping()) |
| - return; |
| - GraphicsLayer* rootGraphicsLayer = layer->compositedLayerMapping()->mainGraphicsLayer(); |
| - if (!rootGraphicsLayer->drawsContent()) |
| - return; |
| - const PaintArtifact& paintArtifact = rootGraphicsLayer->getPaintController().paintArtifact(); |
| + const PaintArtifact& paintArtifact = m_paintController->paintArtifact(); |
| Page* page = frame().page(); |
| if (!page) |