Chromium Code Reviews| Index: Source/core/dom/Document.cpp |
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
| index ece8a2ac9a896f8e2eb1aa89f1f38b4d198fd404..65c5bc1d531beb7e85dd9e5a9a8ae06f2df92783 100644 |
| --- a/Source/core/dom/Document.cpp |
| +++ b/Source/core/dom/Document.cpp |
| @@ -465,7 +465,6 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC |
| , m_cssTarget(0) |
| , m_loadEventProgress(LoadEventNotRun) |
| , m_startTime(currentTime()) |
| - , m_overMinimumLayoutThreshold(false) |
|
ojan
2014/02/06 05:11:39
Should probably remove this in a separate pre-patc
abarth-chromium
2014/02/06 05:31:15
Yep!
|
| , m_scriptRunner(ScriptRunner::create(this)) |
| , m_xmlVersion("1.0") |
| , m_xmlStandalone(StandaloneUnspecified) |
| @@ -1579,9 +1578,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()); |
| @@ -1799,7 +1812,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); |
| @@ -2071,7 +2084,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) |
| @@ -2454,14 +2467,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(); |
| @@ -2607,19 +2618,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 |