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

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 2431 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 } 2517 }
2516 2518
2517 void FrameView::updateAllLifecyclePhases() 2519 void FrameView::updateAllLifecyclePhases()
2518 { 2520 {
2519 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLife cycle::PaintClean); 2521 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLife cycle::PaintClean);
2520 } 2522 }
2521 2523
2522 // TODO(chrishtr): add a scrolling update lifecycle phase. 2524 // TODO(chrishtr): add a scrolling update lifecycle phase.
2523 void FrameView::updateLifecycleToCompositingCleanPlusScrolling() 2525 void FrameView::updateLifecycleToCompositingCleanPlusScrolling()
2524 { 2526 {
2525 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLife cycle::CompositingClean); 2527 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
2528 updateAllLifecyclePhasesExceptPaint();
2529 else
2530 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(Document Lifecycle::CompositingClean);
2526 } 2531 }
2527 2532
2528 void FrameView::updateAllLifecyclePhasesExceptPaint() 2533 void FrameView::updateAllLifecyclePhasesExceptPaint()
2529 { 2534 {
2530 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLife cycle::PrePaintClean); 2535 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLife cycle::PrePaintClean);
2531 } 2536 }
2532 2537
2533 void FrameView::updateLifecycleToLayoutClean() 2538 void FrameView::updateLifecycleToLayoutClean()
2534 { 2539 {
2535 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLife cycle::LayoutClean); 2540 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(DocumentLife cycle::LayoutClean);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2620 2625
2621 if (LayoutViewItem view = layoutViewItem()) { 2626 if (LayoutViewItem view = layoutViewItem()) {
2622 forAllNonThrottledFrameViews([](FrameView& frameView) { 2627 forAllNonThrottledFrameViews([](FrameView& frameView) {
2623 frameView.checkDoesNotNeedLayout(); 2628 frameView.checkDoesNotNeedLayout();
2624 frameView.m_allowsLayoutInvalidationAfterLayoutClean = false; 2629 frameView.m_allowsLayoutInvalidationAfterLayoutClean = false;
2625 }); 2630 });
2626 2631
2627 { 2632 {
2628 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get())); 2633 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get()));
2629 2634
2630 // This was required for slimming paint v1 but is only temporarily 2635 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
2631 // needed for slimming paint v2. 2636 view.compositor()->updateIfNeededRecursive();
2632 view.compositor()->updateIfNeededRecursive(); 2637 } else {
2638 DocumentAnimations::updateAnimations(layoutView()->document());
2639
2640 forAllNonThrottledFrameViews([](FrameView& frameView) { frameVie w.layoutView()->commitPendingSelection(); });
2641 }
2642
2633 scrollContentsIfNeededRecursive(); 2643 scrollContentsIfNeededRecursive();
2634 2644 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() || lifecycle().state() >= DocumentLifecycle::CompositingClean);
2635 DCHECK(lifecycle().state() >= DocumentLifecycle::CompositingClean);
2636 2645
2637 m_frame->host()->globalRootScrollerController().didUpdateCompositing (); 2646 m_frame->host()->globalRootScrollerController().didUpdateCompositing ();
2638 2647
2639 if (targetState >= DocumentLifecycle::PrePaintClean) { 2648 if (targetState >= DocumentLifecycle::PrePaintClean) {
2640 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) 2649 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
2641 invalidateTreeIfNeededRecursive(); 2650 invalidateTreeIfNeededRecursive();
2642
2643 if (view.compositor()->inCompositingMode()) 2651 if (view.compositor()->inCompositingMode())
2644 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded (); 2652 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded ();
2645 2653
2646 updateCompositedSelectionIfNeeded(); 2654 updateCompositedSelectionIfNeeded();
2647 } 2655 }
2648 } 2656 }
2649 2657
2650 if (targetState >= DocumentLifecycle::PrePaintClean) { 2658 if (targetState >= DocumentLifecycle::PrePaintClean) {
2651 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) 2659 updatePaintProperties();
2652 updatePaintProperties();
2653 } 2660 }
2654 2661
2655 if (targetState == DocumentLifecycle::PaintClean) { 2662 if (targetState == DocumentLifecycle::PaintClean) {
2656 if (!m_frame->document()->printing()) 2663 if (!m_frame->document()->printing())
2657 synchronizedPaint(); 2664 synchronizedPaint();
2658 2665
2659 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) 2666 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
2660 pushPaintArtifactToCompositor(); 2667 pushPaintArtifactToCompositor();
2661 2668
2662 DCHECK(!view.hasPendingSelection()); 2669 DCHECK(!view.hasPendingSelection());
2663 DCHECK((m_frame->document()->printing() && lifecycle().state() == Do cumentLifecycle::PaintInvalidationClean) 2670 DCHECK((m_frame->document()->printing() && lifecycle().state() == Do cumentLifecycle::PrePaintClean)
2664 || lifecycle().state() == DocumentLifecycle::PaintClean); 2671 || lifecycle().state() == DocumentLifecycle::PaintClean);
2665 } 2672 }
2666 2673
2667 forAllNonThrottledFrameViews([](FrameView& frameView) { 2674 forAllNonThrottledFrameViews([](FrameView& frameView) {
2668 frameView.checkDoesNotNeedLayout(); 2675 frameView.checkDoesNotNeedLayout();
2669 frameView.m_allowsLayoutInvalidationAfterLayoutClean = true; 2676 frameView.m_allowsLayoutInvalidationAfterLayoutClean = true;
2670 }); 2677 });
2671 } 2678 }
2672 2679
2673 updateViewportIntersectionsForSubtree(targetState); 2680 updateViewportIntersectionsForSubtree(targetState);
2674 } 2681 }
2675 2682
2676 void FrameView::updatePaintProperties() 2683 void FrameView::updatePaintProperties()
2677 { 2684 {
2678 TRACE_EVENT0("blink", "FrameView::updatePaintProperties"); 2685 TRACE_EVENT0("blink", "FrameView::updatePaintProperties");
2679 2686
2680 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); 2687 if (!m_paintController)
2688 m_paintController = PaintController::create();
2681 2689
2682 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InPrePaint); }); 2690 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InPrePaint); });
2683 PrePaintTreeWalk().walk(*this); 2691
2692 // TODO(chrishtr): merge this into the actual pre-paint tree walk.
2693 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
2694 forAllNonThrottledFrameViews([](FrameView& frameView) { CompositingInput sUpdater(frameView.layoutView()->layer()).update(); });
2695
2696 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
2697 PrePaintTreeWalk().walk(*this);
2698
2684 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::PrePaintClean); }); 2699 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::PrePaintClean); });
2685 } 2700 }
2686 2701
2687 void FrameView::synchronizedPaint() 2702 void FrameView::synchronizedPaint()
2688 { 2703 {
2689 TRACE_EVENT0("blink", "FrameView::synchronizedPaint"); 2704 TRACE_EVENT0("blink", "FrameView::synchronizedPaint");
2690 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime"); 2705 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime");
2691 2706
2692 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame())); 2707 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame()));
2693 2708
2694 LayoutViewItem view = layoutViewItem(); 2709 LayoutViewItem view = layoutViewItem();
2695 ASSERT(!view.isNull()); 2710 ASSERT(!view.isNull());
2696 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InPaint); }); 2711 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InPaint); });
2697 2712
2698 // A null graphics layer can occur for painting of SVG images that are not p arented into the main frame tree, 2713 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
2699 // or when the FrameView is the main frame view of a page overlay. The page overlay is in the layer tree of 2714 if (layoutView()->layer()->needsRepaint()) {
2700 // the host page and will be painted during synchronized painting of the hos t page. 2715 GraphicsContext graphicsContext(*m_paintController);
2701 if (GraphicsLayer* rootGraphicsLayer = view.compositor()->rootGraphicsLayer( )) { 2716 paint(graphicsContext, CullRect(LayoutRect::infiniteIntRect()));
2702 synchronizedPaintRecursively(rootGraphicsLayer); 2717 m_paintController->commitNewDisplayItems(LayoutSize());
2703 } 2718 }
2719 } else {
2720 // A null graphics layer can occur for painting of SVG images that are n ot parented into the main frame tree,
2721 // or when the FrameView is the main frame view of a page overlay. The p age overlay is in the layer tree of
2722 // the host page and will be painted during synchronized painting of the host page.
2723 if (GraphicsLayer* rootGraphicsLayer = view.compositor()->rootGraphicsLa yer()) {
2724 synchronizedPaintRecursively(rootGraphicsLayer);
2725 }
2704 2726
2705 // TODO(sataya.m):Main frame doesn't create RootFrameViewport in some 2727 // TODO(sataya.m):Main frame doesn't create RootFrameViewport in some
2706 // webkit_unit_tests (http://crbug.com/644788). 2728 // webkit_unit_tests (http://crbug.com/644788).
2707 if (m_viewportScrollableArea) { 2729 if (m_viewportScrollableArea) {
2708 if (GraphicsLayer* layerForHorizontalScrollbar = m_viewportScrollableAre a->layerForHorizontalScrollbar()) { 2730 if (GraphicsLayer* layerForHorizontalScrollbar = m_viewportScrollabl eArea->layerForHorizontalScrollbar()) {
2709 synchronizedPaintRecursively(layerForHorizontalScrollbar); 2731 synchronizedPaintRecursively(layerForHorizontalScrollbar);
2710 } 2732 }
2711 if (GraphicsLayer* layerForVerticalScrollbar = m_viewportScrollableArea- >layerForVerticalScrollbar()) { 2733 if (GraphicsLayer* layerForVerticalScrollbar = m_viewportScrollableA rea->layerForVerticalScrollbar()) {
2712 synchronizedPaintRecursively(layerForVerticalScrollbar); 2734 synchronizedPaintRecursively(layerForVerticalScrollbar);
2713 } 2735 }
2714 if (GraphicsLayer* layerForScrollCorner = m_viewportScrollableArea->laye rForScrollCorner()) { 2736 if (GraphicsLayer* layerForScrollCorner = m_viewportScrollableArea-> layerForScrollCorner()) {
2715 synchronizedPaintRecursively(layerForScrollCorner); 2737 synchronizedPaintRecursively(layerForScrollCorner);
2738 }
2716 } 2739 }
2717 } 2740 }
2718 2741
2719 forAllNonThrottledFrameViews([](FrameView& frameView) { 2742 forAllNonThrottledFrameViews([](FrameView& frameView) {
2720 frameView.lifecycle().advanceTo(DocumentLifecycle::PaintClean); 2743 frameView.lifecycle().advanceTo(DocumentLifecycle::PaintClean);
2721 LayoutViewItem layoutViewItem = frameView.layoutViewItem(); 2744 LayoutViewItem layoutViewItem = frameView.layoutViewItem();
2722 if (!layoutViewItem.isNull()) 2745 if (!layoutViewItem.isNull())
2723 layoutViewItem.layer()->clearNeedsRepaintRecursively(); 2746 layoutViewItem.layer()->clearNeedsRepaintRecursively();
2724 }); 2747 });
2725 } 2748 }
(...skipping 15 matching lines...) Expand all
2741 for (auto& child : graphicsLayer->children()) 2764 for (auto& child : graphicsLayer->children())
2742 synchronizedPaintRecursively(child); 2765 synchronizedPaintRecursively(child);
2743 } 2766 }
2744 2767
2745 void FrameView::pushPaintArtifactToCompositor() 2768 void FrameView::pushPaintArtifactToCompositor()
2746 { 2769 {
2747 TRACE_EVENT0("blink", "FrameView::pushPaintArtifactToCompositor"); 2770 TRACE_EVENT0("blink", "FrameView::pushPaintArtifactToCompositor");
2748 2771
2749 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 2772 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
2750 2773
2751 LayoutViewItem viewItem = layoutViewItem(); 2774 const PaintArtifact& paintArtifact = m_paintController->paintArtifact();
2752 ASSERT(!viewItem.isNull());
2753
2754 // TODO(jbroman): Simplify the path to PaintController.
2755 PaintLayer* layer = viewItem.layer();
2756 ASSERT(layer);
2757 if (!layer->hasCompositedLayerMapping())
2758 return;
2759 GraphicsLayer* rootGraphicsLayer = layer->compositedLayerMapping()->mainGrap hicsLayer();
2760 if (!rootGraphicsLayer->drawsContent())
2761 return;
2762 const PaintArtifact& paintArtifact = rootGraphicsLayer->getPaintController() .paintArtifact();
2763 2775
2764 Page* page = frame().page(); 2776 Page* page = frame().page();
2765 if (!page) 2777 if (!page)
2766 return; 2778 return;
2767 page->chromeClient().didPaint(paintArtifact); 2779 page->chromeClient().didPaint(paintArtifact);
2768 } 2780 }
2769 2781
2770 void FrameView::updateStyleAndLayoutIfNeededRecursive() 2782 void FrameView::updateStyleAndLayoutIfNeededRecursive()
2771 { 2783 {
2772 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.StyleAndLayout.UpdateTime"); 2784 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.StyleAndLayout.UpdateTime");
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after
4357 } 4369 }
4358 4370
4359 bool FrameView::canThrottleRendering() const 4371 bool FrameView::canThrottleRendering() const
4360 { 4372 {
4361 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4373 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4362 return false; 4374 return false;
4363 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); 4375 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling);
4364 } 4376 }
4365 4377
4366 } // namespace blink 4378 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698