| Index: Source/core/dom/Document.cpp
|
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
|
| index b4e3993c274ca1c784bec08c5c1de641e2402c42..48b75b5f0e3f35baec0baf4df883a2f1603f30ce 100644
|
| --- a/Source/core/dom/Document.cpp
|
| +++ b/Source/core/dom/Document.cpp
|
| @@ -435,7 +435,6 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
|
| , m_cssTarget(0)
|
| , m_loadEventProgress(LoadEventNotRun)
|
| , m_startTime(currentTime())
|
| - , m_overMinimumLayoutThreshold(false)
|
| , m_scriptRunner(ScriptRunner::create(this))
|
| , m_xmlVersion("1.0")
|
| , m_xmlStandalone(StandaloneUnspecified)
|
| @@ -1549,9 +1548,23 @@ 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;
|
| + return true;
|
| +}
|
| +
|
| void Document::scheduleStyleRecalc()
|
| {
|
| - if (hasPendingStyleRecalc() || !isActive() || inStyleRecalc() || !shouldScheduleLayout())
|
| + if (!shouldScheduleStyleRecalc() || !shouldScheduleLayout())
|
| return;
|
|
|
| ASSERT(shouldCallRecalcStyleForDocument());
|
| @@ -1769,7 +1782,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 +2062,7 @@ void Document::attach(const AttachContext& context)
|
|
|
| ContainerNode::attach(context);
|
|
|
| - m_lifecycle.advanceTo(DocumentLifecycle::Clean);
|
| + m_lifecycle.advanceTo(DocumentLifecycle::LayoutClean);
|
| }
|
|
|
| void Document::detach(const AttachContext& context)
|
| @@ -2432,14 +2445,12 @@ void Document::implicitClose()
|
| // Just bail out. Before or during the onload we were shifted to another page.
|
| // The old i-Bench suite does this. When this happens don't bother painting or laying out.
|
| m_loadEventProgress = LoadEventCompleted;
|
| - view()->unscheduleRelayout();
|
| return;
|
| }
|
|
|
| // We used to force a synchronous display and flush here. This really isn't
|
| // necessary and can in fact be actively harmful if pages are loading at a rate of > 60fps
|
| // (if your platform is syncing flushes and limiting them to 60fps).
|
| - m_overMinimumLayoutThreshold = true;
|
| if (!ownerElement() || (ownerElement()->renderer() && !ownerElement()->renderer()->needsLayout())) {
|
| updateStyleIfNeeded();
|
|
|
| @@ -2585,19 +2596,7 @@ bool Document::shouldScheduleLayout()
|
|
|
| bool Document::shouldParserYieldAgressivelyBeforeScriptExecution()
|
| {
|
| - return view() && view()->layoutPending() && !minimumLayoutDelay();
|
| -}
|
| -
|
| -int Document::minimumLayoutDelay()
|
| -{
|
| - if (m_overMinimumLayoutThreshold)
|
| - return 0;
|
| -
|
| - int elapsed = elapsedTime();
|
| - m_overMinimumLayoutThreshold = elapsed > cLayoutScheduleThreshold;
|
| -
|
| - // We'll want to schedule the timer to fire at the minimum layout threshold.
|
| - return max(0, cLayoutScheduleThreshold - elapsed);
|
| + return view() && view()->layoutPending();
|
| }
|
|
|
| int Document::elapsedTime() const
|
|
|