Chromium Code Reviews| Index: Source/core/frame/FrameView.cpp |
| diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp |
| index a89ffe2b63c98cc73973e47ea679af86463c81c0..e44e710d7010e7ddcda1117e3ace5cbe23ea5d64 100644 |
| --- a/Source/core/frame/FrameView.cpp |
| +++ b/Source/core/frame/FrameView.cpp |
| @@ -195,6 +195,7 @@ void FrameView::reset() |
| m_contentIsOpaque = false; |
| m_hasPendingLayout = false; |
| m_layoutSubtreeRoot = 0; |
| + m_paintInvalidationSubtreeRoots.clear(); |
| m_doFullPaintInvalidation = false; |
| m_layoutSchedulingEnabled = true; |
| m_inPerformLayout = false; |
| @@ -703,6 +704,20 @@ RenderObject* FrameView::layoutRoot(bool onlyDuringLayout) const |
| return onlyDuringLayout && layoutPending() ? 0 : m_layoutSubtreeRoot; |
| } |
| +void FrameView::rendererWillBeDestroyed(RenderObject* renderer) |
| +{ |
| + if (m_layoutSubtreeRoot == renderer) { |
| + if (!m_layoutSubtreeRoot->documentBeingDestroyed()) |
| + ASSERT_NOT_REACHED(); |
|
esprehn
2014/07/01 20:03:34
RELEASE_ASSERT(!m_layoutSubtreeRoot->documentBeing
|
| + // This indicates a failure to layout the child, which is why |
| + // the layout root is still set to |this|. Make sure to clear it |
| + // since we are getting destroyed. |
| + m_layoutSubtreeRoot = 0; |
| + } |
| + |
| + m_paintInvalidationSubtreeRoots.remove(renderer); |
| +} |
| + |
| inline void FrameView::forceLayoutParentViewIfNeeded() |
| { |
| RenderPart* ownerRenderer = m_frame->ownerRenderer(); |
| @@ -958,6 +973,8 @@ void FrameView::layout(bool allowSubtree) |
| performLayout(rootForThisLayout, inSubtreeLayout); |
| m_layoutSubtreeRoot = 0; |
| + if (rootForThisLayout) |
| + m_paintInvalidationSubtreeRoots.add(rootForThisLayout); |
| } // Reset m_layoutSchedulingEnabled to its previous value. |
| if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printing()) |
| @@ -990,10 +1007,6 @@ void FrameView::layout(bool allowSubtree) |
| if (m_nestedLayoutCount) |
| return; |
| - invalidateTree(rootForThisLayout); |
| - |
| - m_doFullPaintInvalidation = false; |
| - |
| #ifndef NDEBUG |
| // Post-layout assert that nobody was re-marked as needing layout during layout. |
| document->renderView()->assertSubtreeIsLaidOut(); |
| @@ -1013,29 +1026,29 @@ void FrameView::layout(bool allowSubtree) |
| // method would setNeedsRedraw on the GraphicsLayers with invalidations and |
| // let the compositor pick which to actually draw. |
| // See http://crbug.com/306706 |
| -void FrameView::invalidateTree(RenderObject* root) |
| +void FrameView::invalidateTreeIfNeeded() |
| { |
| - ASSERT(!root->needsLayout()); |
| - // We should only invalidate paints for the outer most layout. This works as |
| - // we continue to track paint invalidation rects until this function is called. |
| - ASSERT(!m_nestedLayoutCount); |
| + HashSet<RenderObject*>::const_iterator end = m_paintInvalidationSubtreeRoots.end(); |
| + for (HashSet<RenderObject*>::const_iterator it = m_paintInvalidationSubtreeRoots.begin(); it != end; ++it) { |
| + RenderObject* rootForPaintInvalidation = *it; |
| + ASSERT(!rootForPaintInvalidation->needsLayout()); |
| - TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", root->debugName().ascii()); |
| + TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInvalidation->debugName().ascii()); |
| - // FIXME: really, we're in the paint invalidation phase here, and the compositing queries are legal. |
| - // Until those states are fully fledged, I'll just disable the ASSERTS. |
| - DisableCompositingQueryAsserts compositingQueryAssertsDisabler; |
| + LayoutState rootLayoutState(*rootForPaintInvalidation); |
| - LayoutState rootLayoutState(*root); |
| + rootForPaintInvalidation->invalidateTreeAfterLayout(*rootForPaintInvalidation->containerForPaintInvalidation()); |
| - root->invalidateTreeAfterLayout(*root->containerForPaintInvalidation()); |
| + // Invalidate the paint of the frameviews scrollbars if needed |
| + if (hasVerticalBarDamage()) |
| + invalidateRect(verticalBarDamage()); |
| + if (hasHorizontalBarDamage()) |
| + invalidateRect(horizontalBarDamage()); |
| + resetScrollbarDamage(); |
| + } |
| - // Invalidate the paint of the frameviews scrollbars if needed |
| - if (hasVerticalBarDamage()) |
| - invalidateRect(verticalBarDamage()); |
| - if (hasHorizontalBarDamage()) |
| - invalidateRect(horizontalBarDamage()); |
| - resetScrollbarDamage(); |
| + m_paintInvalidationSubtreeRoots.clear(); |
| + m_doFullPaintInvalidation = false; |
| } |
| DocumentLifecycle& FrameView::lifecycle() const |
| @@ -2828,6 +2841,8 @@ void FrameView::updateLayoutAndStyleForPainting() |
| m_frame->page()->scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); |
| InspectorInstrumentation::didUpdateLayerTree(view->frame()); |
| + |
| + invalidateTreeIfNeededRecursive(); |
| } |
| scrollContentsIfNeededRecursive(); |
| @@ -2883,6 +2898,19 @@ void FrameView::updateLayoutAndStyleIfNeededRecursive() |
| } |
| +void FrameView::invalidateTreeIfNeededRecursive() |
| +{ |
| + // FIXME: We should be more aggressive cutting sub-branches tree traversals. |
| + invalidateTreeIfNeeded(); |
| + |
| + for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) { |
| + if (!child->isLocalFrame()) |
| + continue; |
| + |
| + toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive(); |
| + } |
| +} |
| + |
| void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const IntSize& maxSize) |
| { |
| ASSERT(!enable || !minSize.isEmpty()); |