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..c6cd996e6ee2a4e60a0af23cb5ade37a8e82d696 100644 |
| --- a/Source/core/frame/FrameView.cpp |
| +++ b/Source/core/frame/FrameView.cpp |
| @@ -1102,21 +1102,21 @@ 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) |
| { |
| + 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 +1131,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 +2592,33 @@ 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(); |
| + FrameView* childFrameView = toLocalFrame(child)->view(); |
| + if (childFrameView->layoutView()->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState()) { |
| + // This is a detached frame which is not reached during the above invalidateTreeIfNeeded(). |
| + PaintInvalidationState childPaintInvalidationState(*childFrameView->layoutView(), pendingDelayedPaintInvalidations); |
| + childFrameView->invalidateTreeIfNeeded(childPaintInvalidationState); |
|
Xianzhu
2015/06/30 00:02:13
This is a new complication. Covered by unit tests.
|
| + } else { |
| + DocumentLifecycle& childLifecycle = childFrameView->lifecycle(); |
| + if (childLifecycle.state() < DocumentLifecycle::PaintInvalidationClean) { |
| + // The frame didn't need paint invalidation. We still need to advance the lifecycle of it. |
| + 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); |