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

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

Issue 1209133002: Traverse into child LayoutViews during invalidateTreeIfNeeded (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address chrishtr's comments; Fix unit tests Created 5 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/layout/LayoutObject.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 if (frame().page()) 1095 if (frame().page())
1096 frame().page()->chromeClient().layoutUpdated(m_frame.get()); 1096 frame().page()->chromeClient().layoutUpdated(m_frame.get());
1097 1097
1098 frame().document()->markers().updateRenderedRectsForMarkers(); 1098 frame().document()->markers().updateRenderedRectsForMarkers();
1099 } 1099 }
1100 1100
1101 // The plan is to move to compositor-queried paint invalidation, in which case t his 1101 // The plan is to move to compositor-queried paint invalidation, in which case t his
1102 // method would setNeedsRedraw on the GraphicsLayers with invalidations and 1102 // method would setNeedsRedraw on the GraphicsLayers with invalidations and
1103 // let the compositor pick which to actually draw. 1103 // let the compositor pick which to actually draw.
1104 // See http://crbug.com/306706 1104 // See http://crbug.com/306706
1105 void FrameView::invalidateTreeIfNeeded(Vector<LayoutObject*>& pendingDelayedPain tInvalidations) 1105 void FrameView::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidation State)
1106 { 1106 {
1107 lifecycle().advanceTo(DocumentLifecycle::InPaintInvalidation);
1108
1107 ASSERT(layoutView()); 1109 ASSERT(layoutView());
1108 LayoutView& rootForPaintInvalidation = *layoutView(); 1110 LayoutView& rootForPaintInvalidation = *layoutView();
1109 ASSERT(!rootForPaintInvalidation.needsLayout()); 1111 ASSERT(!rootForPaintInvalidation.needsLayout());
1110 1112
1111 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation.debugName().ascii()); 1113 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation.debugName().ascii());
1112 1114
1113 PaintInvalidationState rootPaintInvalidationState(rootForPaintInvalidation, pendingDelayedPaintInvalidations);
1114
1115 // In slimming paint mode we do per-object invalidation. 1115 // In slimming paint mode we do per-object invalidation.
1116 if (m_doFullPaintInvalidation && !RuntimeEnabledFeatures::slimmingPaintEnabl ed()) 1116 if (m_doFullPaintInvalidation && !RuntimeEnabledFeatures::slimmingPaintEnabl ed())
1117 layoutView()->compositor()->fullyInvalidatePaint(); 1117 layoutView()->compositor()->fullyInvalidatePaint();
1118 1118
1119 rootForPaintInvalidation.invalidateTreeIfNeeded(rootPaintInvalidationState); 1119 rootForPaintInvalidation.invalidateTreeIfNeeded(paintInvalidationState);
1120 1120
1121 // Invalidate the paint of the frameviews scrollbars if needed 1121 // Invalidate the paint of the frameviews scrollbars if needed
1122 if (hasVerticalBarDamage()) 1122 if (hasVerticalBarDamage())
1123 invalidateRect(verticalBarDamage()); 1123 invalidateRect(verticalBarDamage());
1124 if (hasHorizontalBarDamage()) 1124 if (hasHorizontalBarDamage())
1125 invalidateRect(horizontalBarDamage()); 1125 invalidateRect(horizontalBarDamage());
1126 resetScrollbarDamage(); 1126 resetScrollbarDamage();
1127 1127
1128 #if ENABLE(ASSERT) 1128 #if ENABLE(ASSERT)
1129 layoutView()->assertSubtreeClearedPaintInvalidationState(); 1129 layoutView()->assertSubtreeClearedPaintInvalidationState();
1130 #endif 1130 #endif
1131 1131
1132 if (m_frame->selection().isCaretBoundsDirty()) 1132 if (m_frame->selection().isCaretBoundsDirty())
1133 m_frame->selection().invalidateCaretRect(); 1133 m_frame->selection().invalidateCaretRect();
1134
1135 m_doFullPaintInvalidation = false;
1136 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean);
1134 } 1137 }
1135 1138
1136 DocumentLifecycle& FrameView::lifecycle() const 1139 DocumentLifecycle& FrameView::lifecycle() const
1137 { 1140 {
1138 return m_frame->document()->lifecycle(); 1141 return m_frame->document()->lifecycle();
1139 } 1142 }
1140 1143
1141 LayoutBox* FrameView::embeddedContentBox() const 1144 LayoutBox* FrameView::embeddedContentBox() const
1142 { 1145 {
1143 LayoutView* layoutView = this->layoutView(); 1146 LayoutView* layoutView = this->layoutView();
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after
2582 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); 2585 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate());
2583 #if ENABLE(ASSERT) 2586 #if ENABLE(ASSERT)
2584 m_frame->document()->layoutView()->assertLaidOut(); 2587 m_frame->document()->layoutView()->assertLaidOut();
2585 #endif 2588 #endif
2586 2589
2587 updateWidgetPositionsIfNeeded(); 2590 updateWidgetPositionsIfNeeded();
2588 } 2591 }
2589 2592
2590 void FrameView::invalidateTreeIfNeededRecursive() 2593 void FrameView::invalidateTreeIfNeededRecursive()
2591 { 2594 {
2592 // FIXME: We should be more aggressive at cutting tree traversals. 2595 ASSERT(layoutView());
2593 lifecycle().advanceTo(DocumentLifecycle::InPaintInvalidation); 2596 TRACE_EVENT1("blink", "FrameView::invalidateTreeIfNeededRecursive", "root", layoutView()->debugName().ascii());
2594 2597
2595 Vector<LayoutObject*> pendingDelayedPaintInvalidations; 2598 Vector<LayoutObject*> pendingDelayedPaintInvalidations;
2599 PaintInvalidationState rootPaintInvalidationState(*layoutView(), pendingDela yedPaintInvalidations);
2596 2600
2597 invalidateTreeIfNeeded(pendingDelayedPaintInvalidations); 2601 invalidateTreeIfNeeded(rootPaintInvalidationState);
2598 2602
2599 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { 2603 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
2600 if (!child->isLocalFrame()) 2604 if (!child->isLocalFrame())
2601 continue; 2605 continue;
2602 2606
2603 toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive(); 2607 FrameView* childFrameView = toLocalFrame(child)->view();
2608 if (childFrameView->layoutView()->shouldCheckForPaintInvalidationRegardl essOfPaintInvalidationState()) {
2609 // This is a detached frame which is not reached during the above in validateTreeIfNeeded().
2610 PaintInvalidationState childPaintInvalidationState(*childFrameView-> layoutView(), pendingDelayedPaintInvalidations);
2611 childFrameView->invalidateTreeIfNeeded(childPaintInvalidationState);
Xianzhu 2015/06/30 00:02:13 This is a new complication. Covered by unit tests.
2612 } else {
2613 DocumentLifecycle& childLifecycle = childFrameView->lifecycle();
2614 if (childLifecycle.state() < DocumentLifecycle::PaintInvalidationCle an) {
2615 // The frame didn't need paint invalidation. We still need to ad vance the lifecycle of it.
2616 childLifecycle.advanceTo(DocumentLifecycle::InPaintInvalidation) ;
2617 childLifecycle.advanceTo(DocumentLifecycle::PaintInvalidationCle an);
2618 }
2619 }
2604 } 2620 }
2605 2621
2606 m_doFullPaintInvalidation = false;
2607 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean);
2608
2609 // Process objects needing paint invalidation on the next frame. See the def inition of PaintInvalidationDelayedFull for more details. 2622 // Process objects needing paint invalidation on the next frame. See the def inition of PaintInvalidationDelayedFull for more details.
2610 for (auto& target : pendingDelayedPaintInvalidations) 2623 for (auto& target : pendingDelayedPaintInvalidations)
2611 target->setShouldDoFullPaintInvalidation(PaintInvalidationDelayedFull); 2624 target->setShouldDoFullPaintInvalidation(PaintInvalidationDelayedFull);
2612 } 2625 }
2613 2626
2614 void FrameView::enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSiz e) 2627 void FrameView::enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSiz e)
2615 { 2628 {
2616 if (!m_autoSizeInfo) 2629 if (!m_autoSizeInfo)
2617 m_autoSizeInfo = FrameViewAutoSizeInfo::create(this); 2630 m_autoSizeInfo = FrameViewAutoSizeInfo::create(this);
2618 2631
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after
3972 3985
3973 if (!graphicsLayer) 3986 if (!graphicsLayer)
3974 return; 3987 return;
3975 3988
3976 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect); 3989 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect);
3977 3990
3978 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect))); 3991 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect)));
3979 } 3992 }
3980 3993
3981 } // namespace blink 3994 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698