Chromium Code Reviews| Index: Source/core/frame/FrameView.cpp |
| diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp |
| index d9edbb76623d1463cc760542d39dca5bbfa64672..6d8aac84d58d7f7910c909c8261d5099ec333aeb 100644 |
| --- a/Source/core/frame/FrameView.cpp |
| +++ b/Source/core/frame/FrameView.cpp |
| @@ -1102,21 +1102,22 @@ void FrameView::layout() |
| // method would setNeedsRedraw on the GraphicsLayers with invalidations and |
| // let the compositor pick which to actually draw. |
| // See http://crbug.com/306706 |
| -void FrameView::invalidateTreeIfNeeded(Vector<LayoutObject*>& pendingDelayedPaintInvalidations) |
| +void FrameView::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidationState) |
|
chrishtr
2015/06/29 23:32:22
Do you need to clean out some of these fields if i
Xianzhu
2015/06/30 00:02:12
No. This paintInvalidationState should be just for
|
| { |
| + // FIXME: We should be more aggressive at cutting tree traversals. |
|
chrishtr
2015/06/29 23:32:22
Change to TODO(wangxianzhu)
Xianzhu
2015/06/30 00:02:12
This is moved from invalidateTreeIfNeededRecursive
|
| + lifecycle().advanceTo(DocumentLifecycle::InPaintInvalidation); |
| + |
| ASSERT(layoutView()); |
| LayoutView& rootForPaintInvalidation = *layoutView(); |
| ASSERT(!rootForPaintInvalidation.needsLayout()); |
| TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInvalidation.debugName().ascii()); |
| - PaintInvalidationState rootPaintInvalidationState(rootForPaintInvalidation, pendingDelayedPaintInvalidations); |
| - |
| // In slimming paint mode we do per-object invalidation. |
| if (m_doFullPaintInvalidation && !RuntimeEnabledFeatures::slimmingPaintEnabled()) |
| layoutView()->compositor()->fullyInvalidatePaint(); |
| - rootForPaintInvalidation.invalidateTreeIfNeeded(rootPaintInvalidationState); |
| + rootForPaintInvalidation.invalidateTreeIfNeeded(paintInvalidationState); |
| // Invalidate the paint of the frameviews scrollbars if needed |
| if (hasVerticalBarDamage()) |
| @@ -1131,6 +1132,9 @@ void FrameView::invalidateTreeIfNeeded(Vector<LayoutObject*>& pendingDelayedPain |
| if (m_frame->selection().isCaretBoundsDirty()) |
| m_frame->selection().invalidateCaretRect(); |
| + |
| + m_doFullPaintInvalidation = false; |
| + lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); |
| } |
| DocumentLifecycle& FrameView::lifecycle() const |
| @@ -2589,23 +2593,29 @@ void FrameView::updateLayoutAndStyleIfNeededRecursive() |
| void FrameView::invalidateTreeIfNeededRecursive() |
| { |
| - // FIXME: We should be more aggressive at cutting tree traversals. |
| - lifecycle().advanceTo(DocumentLifecycle::InPaintInvalidation); |
| + ASSERT(layoutView()); |
| + TRACE_EVENT1("blink", "FrameView::invalidateTreeIfNeededRecursive", "root", layoutView()->debugName().ascii()); |
| Vector<LayoutObject*> pendingDelayedPaintInvalidations; |
| + PaintInvalidationState rootPaintInvalidationState(*layoutView(), pendingDelayedPaintInvalidations); |
| - invalidateTreeIfNeeded(pendingDelayedPaintInvalidations); |
| + invalidateTreeIfNeeded(rootPaintInvalidationState); |
| for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) { |
| if (!child->isLocalFrame()) |
| continue; |
| - toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive(); |
| + // The child frame should either has done paint invalidation via the containing LayoutPart, |
| + // or need to advance the lifecycle here because it didn't need and do paint invalidation. |
| + FrameView* childFrameView = toLocalFrame(child)->view(); |
| + ASSERT(!childFrameView->layoutView()->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState()); |
| + DocumentLifecycle& childLifecycle = childFrameView->lifecycle(); |
| + if (childLifecycle.state() < DocumentLifecycle::PaintInvalidationClean) { |
| + childLifecycle.advanceTo(DocumentLifecycle::InPaintInvalidation); |
| + childLifecycle.advanceTo(DocumentLifecycle::PaintInvalidationClean); |
| + } |
| } |
| - m_doFullPaintInvalidation = false; |
| - lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); |
| - |
| // Process objects needing paint invalidation on the next frame. See the definition of PaintInvalidationDelayedFull for more details. |
| for (auto& target : pendingDelayedPaintInvalidations) |
| target->setShouldDoFullPaintInvalidation(PaintInvalidationDelayedFull); |