Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Unified Diff: Source/core/dom/Document.cpp

Issue 146023008: Add layout states to DocumentLifecycle state machine (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Whitelist one more transition' Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/DocumentLifecycle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 3f9fe5d48f1c414e4c990c06de69b89036359ead..b6c9cfd3474f0602b2c1e1f176e2d751128616cf 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1549,15 +1549,31 @@ bool Document::shouldCallRecalcStyleForDocument()
return needsStyleRecalc() || childNeedsStyleRecalc() || childNeedsDistributionRecalc() || !m_useElementsNeedingUpdate.isEmpty() || childNeedsStyleInvalidation();
}
+bool Document::shouldScheduleStyleRecalc()
+{
+ if (!isActive())
+ return false;
+ if (hasPendingStyleRecalc())
+ return false;
+ if (inStyleRecalc())
+ return false;
+ // InPreLayout will recalc style itself. There's no reason to schedule another recalc.
+ if (m_lifecycle.state() == DocumentLifecycle::InPreLayout)
+ return false;
+ if (!shouldScheduleLayout())
+ return false;
+ return true;
+}
+
void Document::scheduleStyleRecalc()
{
- if (hasPendingStyleRecalc() || !isActive() || inStyleRecalc() || !shouldScheduleLayout())
+ if (!shouldScheduleStyleRecalc())
return;
ASSERT(shouldCallRecalcStyleForDocument());
view()->scheduleAnimation();
- m_lifecycle.rewindTo(DocumentLifecycle::StyleRecalcPending);
+ m_lifecycle.advanceTo(DocumentLifecycle::StyleRecalcPending);
InspectorInstrumentation::didScheduleStyleRecalculation(this);
}
@@ -1769,7 +1785,7 @@ void Document::recalcStyle(StyleRecalcChange change)
ASSERT(!needsStyleRecalc());
ASSERT(!childNeedsStyleRecalc());
ASSERT(inStyleRecalc());
- m_lifecycle.advanceTo(DocumentLifecycle::Clean);
+ m_lifecycle.advanceTo(DocumentLifecycle::StyleClean);
}
InspectorInstrumentation::didRecalculateStyle(cookie);
@@ -2049,7 +2065,7 @@ void Document::attach(const AttachContext& context)
ContainerNode::attach(context);
- m_lifecycle.advanceTo(DocumentLifecycle::Clean);
+ m_lifecycle.advanceTo(DocumentLifecycle::StyleClean);
}
void Document::detach(const AttachContext& context)
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/DocumentLifecycle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698