Chromium Code Reviews| Index: Source/core/page/FrameView.cpp |
| diff --git a/Source/core/page/FrameView.cpp b/Source/core/page/FrameView.cpp |
| index a6bb610babb780280fcf39cf137b8ba0ac760691..1389af419b410bb57c0d971105d06dfa71e3bb13 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(); |
| @@ -846,6 +848,8 @@ void FrameView::layout(bool allowSubtree) |
| if (m_inLayout) |
| return; |
| + ASSERT(!shouldStopPartialLayout()); |
| + |
| TRACE_EVENT0("webkit", "FrameView::layout"); |
| TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout"); |
| @@ -983,6 +987,14 @@ void FrameView::layout(bool allowSubtree) |
| m_actionScheduler->pause(); |
| + // Text Autosizing requires two-pass layout which is incompatible with partial layout. If |
|
esprehn
2013/08/18 03:43:15
This should be a FIXME for text autosizing not to
pdr.
2013/08/20 06:19:10
Added fixme and a reference to crbug.com/256657.
|
| + // enabled, only do partial layout for the second layout. |
| + RenderObject* delayPartialLayoutForRenderer = 0; |
| + if (m_frame && m_frame->settings() && m_frame->settings()->textAutosizingEnabled()) { |
|
esprehn
2013/08/18 03:43:15
m_frame cannot be null here. I'm pretty sure that'
pdr.
2013/08/20 06:19:10
Done.
|
| + delayPartialLayoutForRenderer = m_stopLayoutAtRenderer; |
| + m_stopLayoutAtRenderer = 0; |
| + } |
| + |
| { |
| bool disableLayoutState = false; |
| if (inSubtreeLayout) { |
| @@ -997,6 +1009,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"); |
| @@ -1012,6 +1029,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(); |
| + |
| bool neededFullRepaint = m_doFullRepaint; |
| if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->printing()) |
| @@ -1095,6 +1119,19 @@ void FrameView::layout(bool allowSubtree) |
| frame()->page()->chrome().client()->layoutUpdated(frame()); |
| } |
| +void FrameView::checkPartialLayoutComplete(RenderObject* renderer) |
|
esprehn
2013/08/18 03:43:15
This check should be inline.
pdr.
2013/08/20 06:19:10
Done.
|
| +{ |
| + ASSERT(renderer); |
| + if (renderer == m_stopLayoutAtRenderer) { |
| + // Make sure a partial layout was allowed. |
| + do { |
| + ASSERT(renderer->supportsPartialLayout()); |
| + } while ((renderer = renderer->parent())); |
|
esprehn
2013/08/18 03:43:15
Why do you need to check this twice? Doing it eith
pdr.
2013/08/20 06:19:10
The supportsPartialLayout loop was intended to jus
|
| + |
| + m_shouldStopPartialLayout = true; |
| + } |
| +} |
| + |
| RenderBox* FrameView::embeddedContentBox() const |
| { |
| RenderView* renderView = this->renderView(); |