| 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)
|
|
|