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

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

Issue 145133006: Remove the recalc style timer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Moar raf Created 6 years, 11 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/web/tests/ScrollingCoordinatorChromiumTest.cpp » ('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 e3199112cca649bf8ae7e40a0ba871602fad2a2f..1a5fb6f160673299c9902dca9aed78a119d4564c 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -420,7 +420,7 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
, m_visuallyOrdered(false)
, m_readyState(Complete)
, m_bParsing(false)
- , m_styleRecalcTimer(this, &Document::styleRecalcTimerFired)
+ , m_hasPendingStyleRecalc(false)
, m_inStyleRecalc(false)
, m_gotoAnchorNeededAfterStylesheetsLoad(false)
, m_containsValidityStyleRules(false)
@@ -1536,12 +1536,13 @@ void Document::scheduleStyleRecalc()
if (!isActive())
return;
- if (m_styleRecalcTimer.isActive() || !shouldScheduleLayout())
+ if (m_hasPendingStyleRecalc || !shouldScheduleLayout())
return;
ASSERT(shouldCallRecalcStyleForDocument());
- m_styleRecalcTimer.startOneShot(0);
+ view()->scheduleAnimation();
+ m_hasPendingStyleRecalc = true;
InspectorInstrumentation::didScheduleStyleRecalculation(this);
}
@@ -1549,17 +1550,12 @@ void Document::scheduleStyleRecalc()
void Document::unscheduleStyleRecalc()
{
ASSERT(!isActive() || (!needsStyleRecalc() && !childNeedsStyleRecalc()));
- m_styleRecalcTimer.stop();
+ m_hasPendingStyleRecalc = false;
}
bool Document::hasPendingForcedStyleRecalc() const
{
- return m_styleRecalcTimer.isActive() && !m_inStyleRecalc && styleChangeType() >= SubtreeStyleChange;
-}
-
-void Document::styleRecalcTimerFired(Timer<Document>*)
-{
- updateStyleIfNeeded();
+ return m_hasPendingStyleRecalc && !m_inStyleRecalc && styleChangeType() >= SubtreeStyleChange;
}
void Document::updateDistributionIfNeeded()
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/web/tests/ScrollingCoordinatorChromiumTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698