Chromium Code Reviews| Index: Source/core/page/FrameView.cpp |
| diff --git a/Source/core/page/FrameView.cpp b/Source/core/page/FrameView.cpp |
| index 7f2dee31eb9a88cfc60fc1249c137760f2dda08f..74f0a48b1634add63c589a22b6ea45a96e8f23ae 100644 |
| --- a/Source/core/page/FrameView.cpp |
| +++ b/Source/core/page/FrameView.cpp |
| @@ -179,6 +179,8 @@ FrameView::FrameView(Frame* frame) |
| , m_didRunAutosize(false) |
| , m_hasSoftwareFilters(false) |
| , m_visibleContentScaleFactor(1) |
| + , m_shouldStopPartialLayout(false) |
| + , m_stopLayoutAtRenderer(0) |
| { |
| init(); |
| @@ -848,6 +850,8 @@ void FrameView::layout(bool allowSubtree) |
| if (m_inLayout) |
| return; |
| + ASSERT(!shouldStopPartialLayout()); |
| + |
| TRACE_EVENT0("webkit", "FrameView::layout"); |
| TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout"); |
| @@ -985,6 +989,15 @@ void FrameView::layout(bool allowSubtree) |
| m_actionScheduler->pause(); |
| + // Text Autosizing requires two-pass layout which is incompatible with partial layout. If |
| + // enabled, only do partial layout for the second layout. |
| + // FIXME (crbug.com/256657): Do not do two layouts for text autosizing. |
| + RenderObject* delayPartialLayoutForRenderer = 0; |
| + if (m_frame->settings() && m_frame->settings()->textAutosizingEnabled()) { |
|
eseidel
2013/08/20 21:00:39
You don't need all this if you add a "m_disablePar
pdr.
2013/08/26 05:50:40
Done.
|
| + delayPartialLayoutForRenderer = m_stopLayoutAtRenderer; |
| + m_stopLayoutAtRenderer = 0; |
| + } |
| + |
| { |
| bool disableLayoutState = false; |
| if (inSubtreeLayout) { |
| @@ -999,6 +1012,11 @@ void FrameView::layout(bool allowSubtree) |
| forceLayoutParentViewIfNeeded(); |
| rootForThisLayout->layout(); |
| + // If text autosizing is enabled, do a partial layout for the second layout. |
| + if (delayPartialLayoutForRenderer) { |
| + ASSERT(!shouldStopPartialLayout()); |
| + m_stopLayoutAtRenderer = delayPartialLayoutForRenderer; |
| + } |
| bool autosized = document->textAutosizer()->processSubtree(rootForThisLayout); |
| if (autosized && rootForThisLayout->needsLayout()) { |
| TRACE_EVENT0("webkit", "2nd layout due to Text Autosizing"); |
| @@ -1014,6 +1032,13 @@ void FrameView::layout(bool allowSubtree) |
| m_layoutRoot = 0; |
| } // Reset m_layoutSchedulingEnabled to its previous value. |
| + // Reset partial layout state post-layout and exit here if a partial layout was done. |
| + if (shouldStopPartialLayout()) { |
| + resetPartialLayoutState(); |
| + return; |
| + } |
| + resetPartialLayoutState(); |
|
eseidel
2013/08/20 21:00:39
Shouldn't the original caller drive this?
pdr.
2013/08/26 05:50:40
Fixing this was enlightening. resetPartialLayoutSt
|
| + |
| bool neededFullRepaint = m_doFullRepaint; |
| if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->printing()) |
| @@ -1097,6 +1122,17 @@ void FrameView::layout(bool allowSubtree) |
| frame()->page()->chrome().client()->layoutUpdated(frame()); |
| } |
| +#ifndef NDEBUG |
| +void FrameView::checkPartialLayoutAllowed() |
| +{ |
| + RenderObject* renderer = m_stopLayoutAtRenderer; |
| + while (renderer) { |
|
esprehn
2013/08/23 20:47:27
This could be a for() loop :)
pdr.
2013/08/26 05:50:40
This function was useful for checking my logic in
|
| + ASSERT(renderer->supportsPartialLayout()); |
| + renderer = renderer->parent(); |
| + } |
| +} |
| +#endif |
| + |
| RenderBox* FrameView::embeddedContentBox() const |
| { |
| RenderView* renderView = this->renderView(); |