Modified: trunk/Source/WebCore/ChangeLog (223688 => 223689)
--- trunk/Source/WebCore/ChangeLog 2017-10-19 13:11:05 UTC (rev 223688)
+++ trunk/Source/WebCore/ChangeLog 2017-10-19 15:52:37 UTC (rev 223689)
@@ -1,3 +1,24 @@
+2017-10-19 Zalan Bujtas <[email protected]>
+
+ [FrameView::layout cleanup] Replace m_nestedLayoutCount with isLayoutNested()
+ https://bugs.webkit.org/show_bug.cgi?id=178503
+ <rdar://problem/35066561>
+
+ Reviewed by Antti Koivisto.
+
+ Covered by existing tests.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::reset):
+ (WebCore::FrameView::layout):
+ (WebCore::FrameView::updateLayerPositionsAfterScrolling):
+ (WebCore::FrameView::updateCompositingLayersAfterScrolling):
+ (WebCore::FrameView::updateEmbeddedObjects):
+ (WebCore::FrameView::flushPostLayoutTasksQueue):
+ (WebCore::FrameView::performPostLayoutTasks):
+ (WebCore::FrameView::startLayoutAtMainFrameViewIfNeeded):
+ * page/FrameView.h:
+
2017-10-19 Antti Koivisto <[email protected]>
Overlapping text on all CSS fonts specs
Modified: trunk/Source/WebCore/page/FrameView.cpp (223688 => 223689)
--- trunk/Source/WebCore/page/FrameView.cpp 2017-10-19 13:11:05 UTC (rev 223688)
+++ trunk/Source/WebCore/page/FrameView.cpp 2017-10-19 15:52:37 UTC (rev 223689)
@@ -343,7 +343,6 @@
m_layoutPhase = OutsideLayout;
m_inSynchronousPostLayout = false;
m_layoutCount = 0;
- m_nestedLayoutCount = 0;
m_postLayoutTasksTimer.stop();
m_updateEmbeddedObjectsTimer.stop();
m_firstLayout = true;
@@ -1362,7 +1361,6 @@
LOG(Layout, " in painting, bailing");
return;
}
-
ASSERT(frame().view() == this);
ASSERT(frame().document());
ASSERT(frame().document()->pageCacheState() == Document::NotInPageCache);
@@ -1372,6 +1370,7 @@
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout(frame());
AnimationUpdateBlock animationUpdateBlock(&frame().animation());
+ SetForScope<LayoutNestedState> nestedState(m_layoutNestedState, m_layoutNestedState == LayoutNestedState::NotInLayout ? LayoutNestedState::NotNested : LayoutNestedState::Nested);
// Many of the tasks performed during layout can cause this function to be re-entered,
// so save the layout phase now and restore it on exit.
SetForScope<LayoutPhase> layoutPhaseRestorer(m_layoutPhase, InPreLayout);
@@ -1397,7 +1396,7 @@
{
SetForScope<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false);
- if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_postLayoutTasksTimer.isActive() && !isInChildFrameWithFrameFlattening()) {
+ if (!isLayoutNested() && !m_inSynchronousPostLayout && m_postLayoutTasksTimer.isActive() && !isInChildFrameWithFrameFlattening()) {
// This is a new top-level layout. If there are any remaining tasks from the previous
// layout, finish them now.
SetForScope<bool> inSynchronousPostLayoutChange(m_inSynchronousPostLayout, true);
@@ -1426,8 +1425,6 @@
m_layoutPhase = InPreLayout;
- ++m_nestedLayoutCount;
-
autoSizeIfEnabled();
layoutRoot = m_subtreeLayoutRoot ? m_subtreeLayoutRoot : document.renderView();
@@ -1578,8 +1575,6 @@
InspectorInstrumentation::didLayout(cookie, *layoutRoot);
DebugPageOverlays::didLayout(frame());
-
- --m_nestedLayoutCount;
}
bool FrameView::shouldDeferScrollUpdateAfterContentSizeChange()
@@ -2630,7 +2625,7 @@
if (m_layoutPhase == InViewSizeAdjust)
return;
- if (m_nestedLayoutCount <= 1 && hasViewportConstrainedObjects()) {
+ if (!isLayoutNested() && hasViewportConstrainedObjects()) {
if (RenderView* renderView = this->renderView()) {
updateWidgetPositions();
renderView->layer()->updateLayerPositionsAfterDocumentScroll();
@@ -2672,7 +2667,7 @@
if (!shouldUpdateCompositingLayersAfterScrolling())
return;
- if (m_nestedLayoutCount <= 1 && hasViewportConstrainedObjects()) {
+ if (!isLayoutNested() && hasViewportConstrainedObjects()) {
if (RenderView* renderView = this->renderView())
renderView->compositor().updateCompositingLayers(CompositingUpdateType::OnScroll);
}
@@ -3449,7 +3444,7 @@
bool FrameView::updateEmbeddedObjects()
{
- if (m_nestedLayoutCount > 1 || !m_embeddedObjectsToUpdate || m_embeddedObjectsToUpdate->isEmpty())
+ if (isLayoutNested() || !m_embeddedObjectsToUpdate || m_embeddedObjectsToUpdate->isEmpty())
return true;
WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
@@ -3493,7 +3488,7 @@
void FrameView::flushPostLayoutTasksQueue()
{
- if (m_nestedLayoutCount > 1)
+ if (isLayoutNested())
return;
if (!m_postLayoutCallbackQueue.size())
@@ -3515,7 +3510,7 @@
flushPostLayoutTasksQueue();
- if (m_nestedLayoutCount <= 1 && frame().document()->documentElement())
+ if (!isLayoutNested() && frame().document()->documentElement())
fireLayoutRelatedMilestonesIfNeeded();
#if PLATFORM(IOS)
@@ -4280,7 +4275,7 @@
return;
// In the middle of parent layout, no need to restart from topmost.
- if (parentView->m_nestedLayoutCount)
+ if (parentView->isInLayout())
return;
// Parent tree is clean. Starting layout from it would have no effect.
Modified: trunk/Source/WebCore/page/FrameView.h (223688 => 223689)
--- trunk/Source/WebCore/page/FrameView.h 2017-10-19 13:11:05 UTC (rev 223688)
+++ trunk/Source/WebCore/page/FrameView.h 2017-10-19 15:52:37 UTC (rev 223689)
@@ -777,6 +777,8 @@
void convertSubtreeLayoutToFullLayout();
RenderElement* viewportRenderer() const;
+
+ bool isLayoutNested() const { return m_layoutNestedState == LayoutNestedState::Nested; }
HashSet<Widget*> m_widgetsInRenderTree;
@@ -805,7 +807,8 @@
bool m_layoutSchedulingEnabled;
bool m_inSynchronousPostLayout;
int m_layoutCount;
- unsigned m_nestedLayoutCount;
+ enum class LayoutNestedState { NotInLayout, NotNested, Nested };
+ LayoutNestedState m_layoutNestedState { LayoutNestedState::NotInLayout };
Timer m_postLayoutTasksTimer;
Timer m_updateEmbeddedObjectsTimer;
bool m_firstLayoutCallbackPending;