Skip to content
Permalink
Browse files
[FrameView::layout cleanup] Replace m_nestedLayoutCount with isLayout…
…Nested()

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:


Canonical link: https://commits.webkit.org/194707@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas committed Oct 19, 2017
1 parent 588b9af commit 3f39f19cc837562bc37f03748031ab437a07ad7a
Showing with 33 additions and 14 deletions.
  1. +21 −0 Source/WebCore/ChangeLog
  2. +8 −13 Source/WebCore/page/FrameView.cpp
  3. +4 −1 Source/WebCore/page/FrameView.h
@@ -1,3 +1,24 @@
2017-10-19 Zalan Bujtas <zalan@apple.com>

[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 <antti@apple.com>

Overlapping text on all CSS fonts specs
@@ -343,7 +343,6 @@ void FrameView::reset()
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 @@ void FrameView::layout(bool allowSubtreeLayout)
LOG(Layout, " in painting, bailing");
return;
}

ASSERT(frame().view() == this);
ASSERT(frame().document());
ASSERT(frame().document()->pageCacheState() == Document::NotInPageCache);
@@ -1372,6 +1370,7 @@ void FrameView::layout(bool allowSubtreeLayout)
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 @@ void FrameView::layout(bool allowSubtreeLayout)
{
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 @@ void FrameView::layout(bool allowSubtreeLayout)

m_layoutPhase = InPreLayout;

++m_nestedLayoutCount;

autoSizeIfEnabled();

layoutRoot = m_subtreeLayoutRoot ? m_subtreeLayoutRoot : document.renderView();
@@ -1578,8 +1575,6 @@ void FrameView::layout(bool allowSubtreeLayout)

InspectorInstrumentation::didLayout(cookie, *layoutRoot);
DebugPageOverlays::didLayout(frame());

--m_nestedLayoutCount;
}

bool FrameView::shouldDeferScrollUpdateAfterContentSizeChange()
@@ -2630,7 +2625,7 @@ void FrameView::updateLayerPositionsAfterScrolling()
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 @@ void FrameView::updateCompositingLayersAfterScrolling()
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 @@ void FrameView::updateEmbeddedObject(RenderEmbeddedObject& embeddedObject)

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::queuePostLayoutCallback(Function<void()>&& callback)

void FrameView::flushPostLayoutTasksQueue()
{
if (m_nestedLayoutCount > 1)
if (isLayoutNested())
return;

if (!m_postLayoutCallbackQueue.size())
@@ -3515,7 +3510,7 @@ void FrameView::performPostLayoutTasks()

flushPostLayoutTasksQueue();

if (m_nestedLayoutCount <= 1 && frame().document()->documentElement())
if (!isLayoutNested() && frame().document()->documentElement())
fireLayoutRelatedMilestonesIfNeeded();

#if PLATFORM(IOS)
@@ -4280,7 +4275,7 @@ void FrameView::startLayoutAtMainFrameViewIfNeeded(bool allowSubtreeLayout)
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.
@@ -777,6 +777,8 @@ class FrameView final : public ScrollView {
void convertSubtreeLayoutToFullLayout();

RenderElement* viewportRenderer() const;

bool isLayoutNested() const { return m_layoutNestedState == LayoutNestedState::Nested; }

HashSet<Widget*> m_widgetsInRenderTree;

@@ -805,7 +807,8 @@ class FrameView final : public ScrollView {
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;

0 comments on commit 3f39f19

Please sign in to comment.