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

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

Issue 232013002: Rewind the DocumentLifecycle when dirtying state (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address Ojan's comments Created 6 years, 8 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
Index: Source/core/dom/DocumentLifecycle.cpp
diff --git a/Source/core/dom/DocumentLifecycle.cpp b/Source/core/dom/DocumentLifecycle.cpp
index e1451fcc6a2c9c830c80487530c316387d7a708e..0e5e715b6f2424cd68cb4505cf77bcc4b726ff4d 100644
--- a/Source/core/dom/DocumentLifecycle.cpp
+++ b/Source/core/dom/DocumentLifecycle.cpp
@@ -74,9 +74,6 @@ DocumentLifecycle::~DocumentLifecycle()
bool DocumentLifecycle::canAdvanceTo(State state) const
{
- // This transition is bogus, but we've whitelisted it anyway.
- if (s_deprecatedTransitionStack && m_state == s_deprecatedTransitionStack->from() && state == s_deprecatedTransitionStack->to())
- return true;
if (state > m_state)
return true;
if (m_state == Disposed) {
@@ -85,8 +82,6 @@ bool DocumentLifecycle::canAdvanceTo(State state) const
return state == Disposed;
}
if (m_state == StyleClean) {
- if (state == StyleRecalcPending)
- return true;
// We can synchronously recalc style.
if (state == InStyleRecalc)
return true;
@@ -119,8 +114,6 @@ bool DocumentLifecycle::canAdvanceTo(State state) const
return false;
}
if (m_state == LayoutClean) {
- if (state == StyleRecalcPending)
- return true;
// We can synchronously recalc style.
if (state == InStyleRecalc)
return true;
@@ -138,8 +131,6 @@ bool DocumentLifecycle::canAdvanceTo(State state) const
return false;
}
if (m_state == CompositingClean) {
- if (state == StyleRecalcPending)
- return true;
if (state == InStyleRecalc)
return true;
if (state == InPreLayout)
@@ -151,6 +142,14 @@ bool DocumentLifecycle::canAdvanceTo(State state) const
return false;
}
+bool DocumentLifecycle::canRewindTo(State state) const
+{
+ // This transition is bogus, but we've whitelisted it anyway.
+ if (s_deprecatedTransitionStack && m_state == s_deprecatedTransitionStack->from() && state == s_deprecatedTransitionStack->to())
+ return true;
+ return m_state == StyleClean || m_state == AfterPerformLayout || m_state == LayoutClean || m_state == CompositingClean;
+}
+
#endif
void DocumentLifecycle::advanceTo(State state)
@@ -159,4 +158,13 @@ void DocumentLifecycle::advanceTo(State state)
m_state = state;
}
+void DocumentLifecycle::ensureStateAtMost(State state)
+{
+ ASSERT(state == VisualUpdatePending || state == StyleClean || state == LayoutClean);
+ if (m_state <= state)
+ return;
+ ASSERT(canRewindTo(state));
+ m_state = state;
+}
+
}
« no previous file with comments | « Source/core/dom/DocumentLifecycle.h ('k') | Source/core/frame/DeprecatedScheduleStyleRecalcDuringCompositingUpdate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698