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

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

Issue 1774193002: New paint invalidation using paint property tree walk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #include "core/loader/FrameLoader.h" 74 #include "core/loader/FrameLoader.h"
75 #include "core/loader/FrameLoaderClient.h" 75 #include "core/loader/FrameLoaderClient.h"
76 #include "core/page/AutoscrollController.h" 76 #include "core/page/AutoscrollController.h"
77 #include "core/page/ChromeClient.h" 77 #include "core/page/ChromeClient.h"
78 #include "core/page/FocusController.h" 78 #include "core/page/FocusController.h"
79 #include "core/page/FrameTree.h" 79 #include "core/page/FrameTree.h"
80 #include "core/page/Page.h" 80 #include "core/page/Page.h"
81 #include "core/page/scrolling/ScrollingCoordinator.h" 81 #include "core/page/scrolling/ScrollingCoordinator.h"
82 #include "core/paint/FramePainter.h" 82 #include "core/paint/FramePainter.h"
83 #include "core/paint/PaintLayer.h" 83 #include "core/paint/PaintLayer.h"
84 #include "core/paint/PaintPropertyTreeBuilder.h" 84 #include "core/paint/PrePaintTreeWalk.h"
85 #include "core/plugins/PluginView.h" 85 #include "core/plugins/PluginView.h"
86 #include "core/style/ComputedStyle.h" 86 #include "core/style/ComputedStyle.h"
87 #include "core/svg/SVGDocumentExtensions.h" 87 #include "core/svg/SVGDocumentExtensions.h"
88 #include "core/svg/SVGSVGElement.h" 88 #include "core/svg/SVGSVGElement.h"
89 #include "platform/HostWindow.h" 89 #include "platform/HostWindow.h"
90 #include "platform/RuntimeEnabledFeatures.h" 90 #include "platform/RuntimeEnabledFeatures.h"
91 #include "platform/ScriptForbiddenScope.h" 91 #include "platform/ScriptForbiddenScope.h"
92 #include "platform/TraceEvent.h" 92 #include "platform/TraceEvent.h"
93 #include "platform/TracedValue.h" 93 #include "platform/TracedValue.h"
94 #include "platform/fonts/FontCache.h" 94 #include "platform/fonts/FontCache.h"
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 #if ENABLE(ASSERT) 1073 #if ENABLE(ASSERT)
1074 // Post-layout assert that nobody was re-marked as needing layout during lay out. 1074 // Post-layout assert that nobody was re-marked as needing layout during lay out.
1075 layoutView()->assertSubtreeIsLaidOut(); 1075 layoutView()->assertSubtreeIsLaidOut();
1076 #endif 1076 #endif
1077 1077
1078 frame().document()->layoutUpdated(); 1078 frame().document()->layoutUpdated();
1079 } 1079 }
1080 1080
1081 void FrameView::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidation State) 1081 void FrameView::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidation State)
1082 { 1082 {
1083 ASSERT(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
1084
1083 if (shouldThrottleRendering()) 1085 if (shouldThrottleRendering())
1084 return; 1086 return;
1085 1087
1086 lifecycle().advanceTo(DocumentLifecycle::InPaintInvalidation); 1088 lifecycle().advanceTo(DocumentLifecycle::InPaintInvalidation);
1087 1089
1088 RELEASE_ASSERT(layoutView()); 1090 RELEASE_ASSERT(layoutView());
1089 LayoutView& rootForPaintInvalidation = *layoutView(); 1091 LayoutView& rootForPaintInvalidation = *layoutView();
1090 ASSERT(!rootForPaintInvalidation.needsLayout()); 1092 ASSERT(!rootForPaintInvalidation.needsLayout());
1091 1093
1092 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation.debugName().ascii()); 1094 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation.debugName().ascii());
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 } 2391 }
2390 2392
2391 void FrameView::updateLifecycleToLayoutClean() 2393 void FrameView::updateLifecycleToLayoutClean()
2392 { 2394 {
2393 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(OnlyUpToLayo utClean); 2395 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(OnlyUpToLayo utClean);
2394 } 2396 }
2395 2397
2396 void FrameView::scheduleVisualUpdateForPaintInvalidationIfNeeded() 2398 void FrameView::scheduleVisualUpdateForPaintInvalidationIfNeeded()
2397 { 2399 {
2398 LocalFrame* localFrameRoot = frame().localFrameRoot(); 2400 LocalFrame* localFrameRoot = frame().localFrameRoot();
2399 if (!localFrameRoot->view()->m_isUpdatingAllLifecyclePhases || lifecycle().s tate() >= DocumentLifecycle::PaintInvalidationClean) { 2401 if (!localFrameRoot->view()->m_isUpdatingAllLifecyclePhases
2402 || (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && lifec ycle().state() >= DocumentLifecycle::PaintInvalidationClean)
2403 || lifecycle().state() >= DocumentLifecycle::PrePaintTreeWalkClean) {
2400 // Schedule visual update to process the paint invalidation in the next cycle. 2404 // Schedule visual update to process the paint invalidation in the next cycle.
2401 localFrameRoot->scheduleVisualUpdateUnlessThrottled(); 2405 localFrameRoot->scheduleVisualUpdateUnlessThrottled();
2402 } 2406 }
2403 // Otherwise the paint invalidation will be handled in paint invalidation ph ase of this cycle. 2407 // Otherwise the paint invalidation will be handled in paint invalidation ph ase of this cycle.
2404 } 2408 }
2405 2409
2406 // TODO(leviw): We don't assert lifecycle information from documents in child Pl uginViews. 2410 // TODO(leviw): We don't assert lifecycle information from documents in child Pl uginViews.
2407 void FrameView::updateLifecyclePhasesInternal(LifeCycleUpdateOption phases) 2411 void FrameView::updateLifecyclePhasesInternal(LifeCycleUpdateOption phases)
2408 { 2412 {
2409 Optional<TemporaryChange<bool>> isUpdatingAllLifecyclePhasesScope; 2413 Optional<TemporaryChange<bool>> isUpdatingAllLifecyclePhasesScope;
(...skipping 25 matching lines...) Expand all
2435 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get())); 2439 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get()));
2436 2440
2437 // This was required for slimming paint v1 but is only temporarily 2441 // This was required for slimming paint v1 but is only temporarily
2438 // needed for slimming paint v2. 2442 // needed for slimming paint v2.
2439 view->compositor()->updateIfNeededRecursive(); 2443 view->compositor()->updateIfNeededRecursive();
2440 scrollContentsIfNeededRecursive(); 2444 scrollContentsIfNeededRecursive();
2441 2445
2442 ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean); 2446 ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean);
2443 2447
2444 if (phases == AllPhases) { 2448 if (phases == AllPhases) {
2445 invalidateTreeIfNeededRecursive(); 2449 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
2450 invalidateTreeIfNeededRecursive();
2446 2451
2447 if (view->compositor()->inCompositingMode()) 2452 if (view->compositor()->inCompositingMode())
2448 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded (); 2453 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded ();
2449 2454
2450 updateCompositedSelectionIfNeeded(); 2455 updateCompositedSelectionIfNeeded();
2451 } 2456 }
2452 } 2457 }
2453 2458
2454 if (phases == AllPhases) { 2459 if (phases == AllPhases) {
2455 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) 2460 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() || RuntimeEnabl edFeatures::slimmingPaintInvalidationEnabled())
2456 updatePaintProperties(); 2461 updatePaintProperties();
2457 2462
2458 if (!m_frame->document()->printing()) 2463 if (!m_frame->document()->printing())
2459 synchronizedPaint(); 2464 synchronizedPaint();
2460 2465
2461 if (RuntimeEnabledFeatures::frameTimingSupportEnabled()) 2466 if (RuntimeEnabledFeatures::frameTimingSupportEnabled())
2462 updateFrameTimingRequestsIfNeeded(); 2467 updateFrameTimingRequestsIfNeeded();
2463 2468
2464 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) 2469 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
2465 pushPaintArtifactToCompositor(); 2470 pushPaintArtifactToCompositor();
2466 2471
2467 ASSERT(!view->hasPendingSelection()); 2472 ASSERT(!view->hasPendingSelection());
2468 ASSERT((m_frame->document()->printing() && lifecycle().state() == Do cumentLifecycle::PaintInvalidationClean) 2473 ASSERT((m_frame->document()->printing() && lifecycle().state() == Do cumentLifecycle::PaintInvalidationClean)
2469 || lifecycle().state() == DocumentLifecycle::PaintClean); 2474 || lifecycle().state() == DocumentLifecycle::PaintClean);
2470 } 2475 }
2471 } 2476 }
2472 2477
2473 updateViewportIntersectionsForSubtree(phases); 2478 updateViewportIntersectionsForSubtree(phases);
2474 } 2479 }
2475 2480
2476 void FrameView::updatePaintProperties() 2481 void FrameView::updatePaintProperties()
2477 { 2482 {
2478 TRACE_EVENT0("blink", "FrameView::updatePaintProperties"); 2483 TRACE_EVENT0("blink", "FrameView::updatePaintProperties");
2479 2484
2480 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 2485 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled() || RuntimeEnabledFea tures::slimmingPaintInvalidationEnabled());
2481 2486
2482 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InUpdatePaintProperties); }); 2487 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InPrePaintTreeWalk); });
2483 PaintPropertyTreeBuilder().buildPropertyTrees(*this); 2488 PrePaintTreeWalk builder;
2484 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::UpdatePaintPropertiesClean); }); 2489 builder.buildPropertyTreesAndInvalidatePaint(*this);
2490 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::PrePaintTreeWalkClean); });
2491
2492 // Process objects needing paint invalidation on the next frame. See the def inition of PaintInvalidationDelayedFull for more details.
2493 for (auto& target : builder.pendingDelayedPaintInvalidations())
2494 target->setShouldDoFullPaintInvalidation(PaintInvalidationDelayedFull);
2485 } 2495 }
2486 2496
2487 void FrameView::synchronizedPaint() 2497 void FrameView::synchronizedPaint()
2488 { 2498 {
2489 TRACE_EVENT0("blink", "FrameView::synchronizedPaint"); 2499 TRACE_EVENT0("blink", "FrameView::synchronizedPaint");
2490 2500
2491 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame())); 2501 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame()));
2492 2502
2493 LayoutView* view = layoutView(); 2503 LayoutView* view = layoutView();
2494 ASSERT(view); 2504 ASSERT(view);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2643 lifecycle().advanceTo(DocumentLifecycle::LayoutClean); 2653 lifecycle().advanceTo(DocumentLifecycle::LayoutClean);
2644 2654
2645 // Ensure that we become visually non-empty eventually. 2655 // Ensure that we become visually non-empty eventually.
2646 // TODO(esprehn): This should check isRenderingReady() instead. 2656 // TODO(esprehn): This should check isRenderingReady() instead.
2647 if (frame().document()->hasFinishedParsing() && frame().loader().stateMachin e()->committedFirstRealDocumentLoad()) 2657 if (frame().document()->hasFinishedParsing() && frame().loader().stateMachin e()->committedFirstRealDocumentLoad())
2648 m_isVisuallyNonEmpty = true; 2658 m_isVisuallyNonEmpty = true;
2649 } 2659 }
2650 2660
2651 void FrameView::invalidateTreeIfNeededRecursive() 2661 void FrameView::invalidateTreeIfNeededRecursive()
2652 { 2662 {
2663 ASSERT(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
2653 RELEASE_ASSERT(layoutView()); 2664 RELEASE_ASSERT(layoutView());
2654 2665
2655 // We need to stop recursing here since a child frame view might not be thro ttled 2666 // We need to stop recursing here since a child frame view might not be thro ttled
2656 // even though we are (e.g., it didn't compute its visibility yet). 2667 // even though we are (e.g., it didn't compute its visibility yet).
2657 if (shouldThrottleRendering()) 2668 if (shouldThrottleRendering())
2658 return; 2669 return;
2659 TRACE_EVENT1("blink", "FrameView::invalidateTreeIfNeededRecursive", "root", layoutView()->debugName().ascii()); 2670 TRACE_EVENT1("blink", "FrameView::invalidateTreeIfNeededRecursive", "root", layoutView()->debugName().ascii());
2660 2671
2661 Vector<LayoutObject*> pendingDelayedPaintInvalidations; 2672 Vector<LayoutObject*> pendingDelayedPaintInvalidations;
2662 PaintInvalidationState rootPaintInvalidationState(*layoutView(), pendingDela yedPaintInvalidations); 2673 PaintInvalidationState rootPaintInvalidationState(*layoutView(), pendingDela yedPaintInvalidations);
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after
4110 return m_hiddenForThrottling && m_crossOriginForThrottling; 4121 return m_hiddenForThrottling && m_crossOriginForThrottling;
4111 } 4122 }
4112 4123
4113 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const 4124 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
4114 { 4125 {
4115 ASSERT(layoutView()); 4126 ASSERT(layoutView());
4116 return *layoutView(); 4127 return *layoutView();
4117 } 4128 }
4118 4129
4119 } // namespace blink 4130 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698