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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2322073006: Turn off the old compositing path for SPv2. (Closed)
Patch Set: none Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 10 matching lines...) Expand all
21 * You should have received a copy of the GNU Library General Public License 21 * You should have received a copy of the GNU Library General Public License
22 * along with this library; see the file COPYING.LIB. If not, write to 22 * along with this library; see the file COPYING.LIB. If not, write to
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301, USA. 24 * Boston, MA 02110-1301, USA.
25 */ 25 */
26 26
27 #include "core/frame/FrameView.h" 27 #include "core/frame/FrameView.h"
28 28
29 #include "core/HTMLNames.h" 29 #include "core/HTMLNames.h"
30 #include "core/MediaTypeNames.h" 30 #include "core/MediaTypeNames.h"
31 #include "core/animation/DocumentAnimations.h"
31 #include "core/css/FontFaceSet.h" 32 #include "core/css/FontFaceSet.h"
32 #include "core/css/resolver/StyleResolver.h" 33 #include "core/css/resolver/StyleResolver.h"
33 #include "core/dom/AXObjectCache.h" 34 #include "core/dom/AXObjectCache.h"
34 #include "core/dom/DOMNodeIds.h" 35 #include "core/dom/DOMNodeIds.h"
35 #include "core/dom/Fullscreen.h" 36 #include "core/dom/Fullscreen.h"
36 #include "core/dom/IntersectionObserverController.h" 37 #include "core/dom/IntersectionObserverController.h"
37 #include "core/editing/EditingUtilities.h" 38 #include "core/editing/EditingUtilities.h"
38 #include "core/editing/FrameSelection.h" 39 #include "core/editing/FrameSelection.h"
39 #include "core/editing/RenderedPosition.h" 40 #include "core/editing/RenderedPosition.h"
40 #include "core/editing/markers/DocumentMarkerController.h" 41 #include "core/editing/markers/DocumentMarkerController.h"
(...skipping 23 matching lines...) Expand all
64 #include "core/layout/LayoutView.h" 65 #include "core/layout/LayoutView.h"
65 #include "core/layout/ScrollAlignment.h" 66 #include "core/layout/ScrollAlignment.h"
66 #include "core/layout/TextAutosizer.h" 67 #include "core/layout/TextAutosizer.h"
67 #include "core/layout/TracedLayoutObject.h" 68 #include "core/layout/TracedLayoutObject.h"
68 #include "core/layout/api/LayoutBoxModel.h" 69 #include "core/layout/api/LayoutBoxModel.h"
69 #include "core/layout/api/LayoutItem.h" 70 #include "core/layout/api/LayoutItem.h"
70 #include "core/layout/api/LayoutPartItem.h" 71 #include "core/layout/api/LayoutPartItem.h"
71 #include "core/layout/api/LayoutViewItem.h" 72 #include "core/layout/api/LayoutViewItem.h"
72 #include "core/layout/compositing/CompositedLayerMapping.h" 73 #include "core/layout/compositing/CompositedLayerMapping.h"
73 #include "core/layout/compositing/CompositedSelection.h" 74 #include "core/layout/compositing/CompositedSelection.h"
75 #include "core/layout/compositing/CompositingInputsUpdater.h"
74 #include "core/layout/compositing/PaintLayerCompositor.h" 76 #include "core/layout/compositing/PaintLayerCompositor.h"
75 #include "core/layout/svg/LayoutSVGRoot.h" 77 #include "core/layout/svg/LayoutSVGRoot.h"
76 #include "core/loader/DocumentLoader.h" 78 #include "core/loader/DocumentLoader.h"
77 #include "core/loader/FrameLoader.h" 79 #include "core/loader/FrameLoader.h"
78 #include "core/loader/FrameLoaderClient.h" 80 #include "core/loader/FrameLoaderClient.h"
79 #include "core/observer/ResizeObserverController.h" 81 #include "core/observer/ResizeObserverController.h"
80 #include "core/page/AutoscrollController.h" 82 #include "core/page/AutoscrollController.h"
81 #include "core/page/ChromeClient.h" 83 #include "core/page/ChromeClient.h"
82 #include "core/page/FocusController.h" 84 #include "core/page/FocusController.h"
83 #include "core/page/FrameTree.h" 85 #include "core/page/FrameTree.h"
(...skipping 2425 matching lines...) Expand 10 before | Expand all | Expand 10 after
2509 m_needsUpdateWidgetGeometries = false; 2511 m_needsUpdateWidgetGeometries = false;
2510 2512
2511 updateWidgetGeometries(); 2513 updateWidgetGeometries();
2512 } 2514 }
2513 2515
2514 void FrameView::updateAllLifecyclePhases() 2516 void FrameView::updateAllLifecyclePhases()
2515 { 2517 {
2516 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLife cycle::PaintClean); 2518 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLife cycle::PaintClean);
2517 } 2519 }
2518 2520
2519 // TODO(chrishtr): add a scrolling update lifecycle phase.
2520 void FrameView::updateLifecycleToCompositingCleanPlusScrolling()
2521 {
2522 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLife cycle::CompositingClean);
2523 }
2524
2525 void FrameView::updateAllLifecyclePhasesExceptPaint() 2521 void FrameView::updateAllLifecyclePhasesExceptPaint()
2526 { 2522 {
2527 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLife cycle::PrePaintClean); 2523 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLife cycle::PrePaintClean);
2528 } 2524 }
2529 2525
2530 void FrameView::updateLifecycleToLayoutClean() 2526 void FrameView::updateLifecycleToLayoutClean()
2531 { 2527 {
2532 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLife cycle::LayoutClean); 2528 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLife cycle::LayoutClean);
2533 } 2529 }
2534 2530
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
2617 2613
2618 if (LayoutViewItem view = layoutViewItem()) { 2614 if (LayoutViewItem view = layoutViewItem()) {
2619 forAllNonThrottledFrameViews([](FrameView& frameView) { 2615 forAllNonThrottledFrameViews([](FrameView& frameView) {
2620 frameView.checkDoesNotNeedLayout(); 2616 frameView.checkDoesNotNeedLayout();
2621 frameView.m_allowsLayoutInvalidationAfterLayoutClean = false; 2617 frameView.m_allowsLayoutInvalidationAfterLayoutClean = false;
2622 }); 2618 });
2623 2619
2624 { 2620 {
2625 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get())); 2621 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get()));
2626 2622
2627 // This was required for slimming paint v1 but is only temporarily 2623 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
2628 // needed for slimming paint v2. 2624 view.compositor()->updateIfNeededRecursive();
2629 view.compositor()->updateIfNeededRecursive(); 2625 } else {
2626 DocumentAnimations::updateAnimations(layoutView()->document());
2627
2628 forAllNonThrottledFrameViews([](FrameView& frameView) { frameVie w.layoutView()->commitPendingSelection(); });
2629 }
2630
2630 scrollContentsIfNeededRecursive(); 2631 scrollContentsIfNeededRecursive();
2631 2632 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() || lifecycle().state() >= DocumentLifecycle::CompositingClean);
2632 DCHECK(lifecycle().state() >= DocumentLifecycle::CompositingClean);
2633 2633
2634 if (targetState >= DocumentLifecycle::PrePaintClean) { 2634 if (targetState >= DocumentLifecycle::PrePaintClean) {
2635 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) 2635 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
2636 invalidateTreeIfNeededRecursive(); 2636 invalidateTreeIfNeededRecursive();
2637
2638 if (view.compositor()->inCompositingMode()) 2637 if (view.compositor()->inCompositingMode())
2639 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded (); 2638 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded ();
2640 2639
2641 m_frame->document()->rootScrollerController()->didUpdateComposit ing(); 2640 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
Xianzhu 2016/09/14 00:35:53 slimmingPaintV2Enabled()
chrishtr 2016/09/14 19:43:24 Done.
2641 m_frame->document()->rootScrollerController()->didUpdateComp ositing();
2642 updateCompositedSelectionIfNeeded(); 2642 updateCompositedSelectionIfNeeded();
2643 } 2643 }
2644 } 2644 }
2645 2645
2646 if (targetState >= DocumentLifecycle::PrePaintClean) { 2646 if (targetState >= DocumentLifecycle::PrePaintClean) {
2647 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) 2647 updatePaintProperties();
2648 updatePaintProperties();
2649 } 2648 }
2650 2649
2651 if (targetState == DocumentLifecycle::PaintClean) { 2650 if (targetState == DocumentLifecycle::PaintClean) {
2652 if (!m_frame->document()->printing()) 2651 if (!m_frame->document()->printing())
2653 synchronizedPaint(); 2652 synchronizedPaint();
2654 2653
2655 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) 2654 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
2656 pushPaintArtifactToCompositor(); 2655 pushPaintArtifactToCompositor();
2657 2656
2658 DCHECK(!view.hasPendingSelection()); 2657 DCHECK(!view.hasPendingSelection());
2659 DCHECK((m_frame->document()->printing() && lifecycle().state() == Do cumentLifecycle::PaintInvalidationClean) 2658 DCHECK((m_frame->document()->printing() && lifecycle().state() == Do cumentLifecycle::PaintInvalidationClean)
2660 || lifecycle().state() == DocumentLifecycle::PaintClean); 2659 || lifecycle().state() == DocumentLifecycle::PaintClean);
2661 } 2660 }
2662 2661
2663 forAllNonThrottledFrameViews([](FrameView& frameView) { 2662 forAllNonThrottledFrameViews([](FrameView& frameView) {
2664 frameView.checkDoesNotNeedLayout(); 2663 frameView.checkDoesNotNeedLayout();
2665 frameView.m_allowsLayoutInvalidationAfterLayoutClean = true; 2664 frameView.m_allowsLayoutInvalidationAfterLayoutClean = true;
2666 }); 2665 });
2667 } 2666 }
2668 2667
2669 updateViewportIntersectionsForSubtree(targetState); 2668 updateViewportIntersectionsForSubtree(targetState);
2670 } 2669 }
2671 2670
2672 void FrameView::updatePaintProperties() 2671 void FrameView::updatePaintProperties()
2673 { 2672 {
2674 TRACE_EVENT0("blink", "FrameView::updatePaintProperties"); 2673 TRACE_EVENT0("blink", "FrameView::updatePaintProperties");
2675 2674
2676 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 2675 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
2677 2676
2677 if (!m_paintController)
2678 m_paintController = PaintController::create();
2679
2678 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InPrePaint); }); 2680 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InPrePaint); });
2679 PrePaintTreeWalk().walk(*this); 2681
2682 // TODO(chrishtr): merte these into the actual pre-paint tree walk.
2683 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
2684 forAllNonThrottledFrameViews([](FrameView& frameView) { CompositingInput sUpdater(frameView.layoutView()->layer()).update(); });
2685 PrePaintTreeWalk().walk(*this);
2686 }
2680 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::PrePaintClean); }); 2687 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::PrePaintClean); });
2681 } 2688 }
2682 2689
2683 void FrameView::synchronizedPaint() 2690 void FrameView::synchronizedPaint()
2684 { 2691 {
2685 TRACE_EVENT0("blink", "FrameView::synchronizedPaint"); 2692 TRACE_EVENT0("blink", "FrameView::synchronizedPaint");
2686 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime"); 2693 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime");
2687 2694
2688 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame())); 2695 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame()));
2689 2696
2690 LayoutViewItem view = layoutViewItem(); 2697 LayoutViewItem view = layoutViewItem();
2691 ASSERT(!view.isNull()); 2698 ASSERT(!view.isNull());
2692 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InPaint); }); 2699 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InPaint); });
2693 2700
2694 // A null graphics layer can occur for painting of SVG images that are not p arented into the main frame tree, 2701 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
2695 // or when the FrameView is the main frame view of a page overlay. The page overlay is in the layer tree of 2702 if (layoutView()->layer()->needsRepaint()) {
2696 // the host page and will be painted during synchronized painting of the hos t page. 2703 GraphicsContext graphicsContext(*m_paintController);
2697 if (GraphicsLayer* rootGraphicsLayer = view.compositor()->rootGraphicsLayer( )) { 2704 FramePainter(*this).paint(graphicsContext, GlobalPaintNormalPhase, C ullRect(LayoutRect::infiniteIntRect()));
2698 synchronizedPaintRecursively(rootGraphicsLayer); 2705 m_paintController->commitNewDisplayItems(LayoutSize());
2699 } 2706 }
2707 } else {
2708 // A null graphics layer can occur for painting of SVG images that are n ot parented into the main frame tree,
2709 // or when the FrameView is the main frame view of a page overlay. The p age overlay is in the layer tree of
2710 // the host page and will be painted during synchronized painting of the host page.
2711 if (GraphicsLayer* rootGraphicsLayer = view.compositor()->rootGraphicsLa yer()) {
2712 synchronizedPaintRecursively(rootGraphicsLayer);
2713 }
2700 2714
2701 // TODO(sataya.m):Main frame doesn't create RootFrameViewport in some 2715 // TODO(sataya.m):Main frame doesn't create RootFrameViewport in some
2702 // webkit_unit_tests (http://crbug.com/644788). 2716 // webkit_unit_tests (http://crbug.com/644788).
2703 if (m_viewportScrollableArea) { 2717 if (m_viewportScrollableArea) {
2704 if (GraphicsLayer* layerForHorizontalScrollbar = m_viewportScrollableAre a->layerForHorizontalScrollbar()) { 2718 if (GraphicsLayer* layerForHorizontalScrollbar = m_viewportScrollabl eArea->layerForHorizontalScrollbar()) {
2705 synchronizedPaintRecursively(layerForHorizontalScrollbar); 2719 synchronizedPaintRecursively(layerForHorizontalScrollbar);
2706 } 2720 }
2707 if (GraphicsLayer* layerForVerticalScrollbar = m_viewportScrollableArea- >layerForVerticalScrollbar()) { 2721 if (GraphicsLayer* layerForVerticalScrollbar = m_viewportScrollableA rea->layerForVerticalScrollbar()) {
2708 synchronizedPaintRecursively(layerForVerticalScrollbar); 2722 synchronizedPaintRecursively(layerForVerticalScrollbar);
2709 } 2723 }
2710 if (GraphicsLayer* layerForScrollCorner = m_viewportScrollableArea->laye rForScrollCorner()) { 2724 if (GraphicsLayer* layerForScrollCorner = m_viewportScrollableArea-> layerForScrollCorner()) {
2711 synchronizedPaintRecursively(layerForScrollCorner); 2725 synchronizedPaintRecursively(layerForScrollCorner);
2726 }
2712 } 2727 }
2713 } 2728 }
2714 2729
2715 forAllNonThrottledFrameViews([](FrameView& frameView) { 2730 forAllNonThrottledFrameViews([](FrameView& frameView) {
2716 frameView.lifecycle().advanceTo(DocumentLifecycle::PaintClean); 2731 frameView.lifecycle().advanceTo(DocumentLifecycle::PaintClean);
2717 LayoutViewItem layoutViewItem = frameView.layoutViewItem(); 2732 LayoutViewItem layoutViewItem = frameView.layoutViewItem();
2718 if (!layoutViewItem.isNull()) 2733 if (!layoutViewItem.isNull())
2719 layoutViewItem.layer()->clearNeedsRepaintRecursively(); 2734 layoutViewItem.layer()->clearNeedsRepaintRecursively();
2720 }); 2735 });
2721 } 2736 }
(...skipping 15 matching lines...) Expand all
2737 for (auto& child : graphicsLayer->children()) 2752 for (auto& child : graphicsLayer->children())
2738 synchronizedPaintRecursively(child); 2753 synchronizedPaintRecursively(child);
2739 } 2754 }
2740 2755
2741 void FrameView::pushPaintArtifactToCompositor() 2756 void FrameView::pushPaintArtifactToCompositor()
2742 { 2757 {
2743 TRACE_EVENT0("blink", "FrameView::pushPaintArtifactToCompositor"); 2758 TRACE_EVENT0("blink", "FrameView::pushPaintArtifactToCompositor");
2744 2759
2745 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 2760 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
2746 2761
2747 LayoutViewItem viewItem = layoutViewItem(); 2762 const PaintArtifact& paintArtifact = m_paintController->paintArtifact();
2748 ASSERT(!viewItem.isNull());
2749
2750 // TODO(jbroman): Simplify the path to PaintController.
2751 PaintLayer* layer = viewItem.layer();
2752 ASSERT(layer);
2753 if (!layer->hasCompositedLayerMapping())
2754 return;
2755 GraphicsLayer* rootGraphicsLayer = layer->compositedLayerMapping()->mainGrap hicsLayer();
2756 if (!rootGraphicsLayer->drawsContent())
2757 return;
2758 const PaintArtifact& paintArtifact = rootGraphicsLayer->getPaintController() .paintArtifact();
2759 2763
2760 Page* page = frame().page(); 2764 Page* page = frame().page();
2761 if (!page) 2765 if (!page)
2762 return; 2766 return;
2763 page->chromeClient().didPaint(paintArtifact); 2767 page->chromeClient().didPaint(paintArtifact);
2764 } 2768 }
2765 2769
2766 void FrameView::updateStyleAndLayoutIfNeededRecursive() 2770 void FrameView::updateStyleAndLayoutIfNeededRecursive()
2767 { 2771 {
2768 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.StyleAndLayout.UpdateTime"); 2772 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.StyleAndLayout.UpdateTime");
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after
4350 } 4354 }
4351 4355
4352 bool FrameView::canThrottleRendering() const 4356 bool FrameView::canThrottleRendering() const
4353 { 4357 {
4354 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4358 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4355 return false; 4359 return false;
4356 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); 4360 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling);
4357 } 4361 }
4358 4362
4359 } // namespace blink 4363 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698