From 77631a27b2f75a359dcc6ec7e1d00a6f452b488a Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Wed, 19 Apr 2006 15:08:44 +0000 Subject: [PATCH] Remove the layout.reflow.async.duringDocLoad pref -- setting it to false just makes us buggy. Bug 334543, r+sr=dbaron --- layout/base/nsPresShell.cpp | 77 +++++++++++++++---------------------- 1 file changed, 30 insertions(+), 47 deletions(-) diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index e107634aceca..da29df65ae4f 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -406,10 +406,6 @@ protected: #define NS_MAX_REFLOW_TIME 1000000 static PRInt32 gMaxRCProcessingTime = -1; -// Set to true to enable async reflow during document load. -// This flag is initialized from the layout.reflow.async.duringDocLoad pref. -static PRBool gAsyncReflowDuringDocLoad = PR_FALSE; - // Largest chunk size we recycle static const size_t gMaxRecycledSize = 400; @@ -1780,10 +1776,6 @@ PresShell::Init(nsIDocument* aDocument, gMaxRCProcessingTime = nsContentUtils::GetIntPref("layout.reflow.timeslice", NS_MAX_REFLOW_TIME); - - gAsyncReflowDuringDocLoad = - nsContentUtils::GetBoolPref("layout.reflow.async.duringDocLoad", - PR_TRUE); } { @@ -3668,13 +3660,12 @@ PresShell::AppendReflowCommand(nsIFrame* aTargetFrame, delete command; } - // For async reflow during doc load, post a reflow event if we are not batching reflow commands. - // For sync reflow during doc load, post a reflow event if we are not batching reflow commands - // and the document is not loading. - if ((gAsyncReflowDuringDocLoad && !mBatchReflows) || - (!gAsyncReflowDuringDocLoad && !mBatchReflows && !mDocumentLoading)) { + // Post a reflow event if we are not batching reflow commands. + if (!mBatchReflows) { // If we're in the middle of a drag, process it right away (needed for mac, // might as well do it on all platforms just to keep the code paths the same). + // XXXbz but how does this actually "process it right away"? + // Isn't this more like "never process it"? if ( !IsDragInProgress() ) PostReflowEvent(); } @@ -6460,11 +6451,7 @@ PresShell::DidCauseReflow() if (--mChangeNestCount == 0) { // We may have had more reflow commands appended to the queue during // our reflow. Make sure these get processed at some point. - if (!gAsyncReflowDuringDocLoad && mDocumentLoading) { - FlushPendingNotifications(Flush_Layout); - } else { - PostReflowEvent(); - } + PostReflowEvent(); } return NS_OK; @@ -6649,34 +6636,32 @@ nsresult PresShell::ReflowCommandAdded(nsHTMLReflowCommand* aRC) { - if (gAsyncReflowDuringDocLoad) { - NS_PRECONDITION(mRCCreatedDuringLoad >= 0, "PresShell's reflow command queue is in a bad state."); - if (mDocumentLoading) { - aRC->AddFlagBits(NS_RC_CREATED_DURING_DOCUMENT_LOAD); - mRCCreatedDuringLoad++; + NS_PRECONDITION(mRCCreatedDuringLoad >= 0, "PresShell's reflow command queue is in a bad state."); + if (mDocumentLoading) { + aRC->AddFlagBits(NS_RC_CREATED_DURING_DOCUMENT_LOAD); + mRCCreatedDuringLoad++; #ifdef PR_LOGGING - if (PR_LOG_TEST(gLog, PR_LOG_DEBUG)) { - nsIFrame* target; - aRC->GetTarget(target); + if (PR_LOG_TEST(gLog, PR_LOG_DEBUG)) { + nsIFrame* target; + aRC->GetTarget(target); - nsIAtom* type = target->GetType(); - NS_ASSERTION(type, "frame didn't override GetType()"); + nsIAtom* type = target->GetType(); + NS_ASSERTION(type, "frame didn't override GetType()"); - nsAutoString typeStr(NS_LITERAL_STRING("unknown")); - if (type) - type->ToString(typeStr); + nsAutoString typeStr(NS_LITERAL_STRING("unknown")); + if (type) + type->ToString(typeStr); - PR_LOG(gLog, PR_LOG_DEBUG, - ("presshell=%p, ReflowCommandAdded(%p) target=%p[%s] mRCCreatedDuringLoad=%d\n", - this, aRC, target, NS_ConvertUTF16toUTF8(typeStr).get(), mRCCreatedDuringLoad)); - } + PR_LOG(gLog, PR_LOG_DEBUG, + ("presshell=%p, ReflowCommandAdded(%p) target=%p[%s] mRCCreatedDuringLoad=%d\n", + this, aRC, target, NS_ConvertUTF16toUTF8(typeStr).get(), mRCCreatedDuringLoad)); + } #endif - if (!mDocumentOnloadBlocked) { - mDocument->BlockOnload(); - mDocumentOnloadBlocked = PR_TRUE; - } + if (!mDocumentOnloadBlocked) { + mDocument->BlockOnload(); + mDocumentOnloadBlocked = PR_TRUE; } } return NS_OK; @@ -6689,15 +6674,13 @@ PresShell::ReflowCommandRemoved(nsHTMLReflowCommand* aRC) PL_DHashTableOperate(&mReflowCommandTable, aRC, PL_DHASH_REMOVE); - if (gAsyncReflowDuringDocLoad) { - NS_PRECONDITION(mRCCreatedDuringLoad >= 0, "PresShell's reflow command queue is in a bad state."); - if (aRC->GetFlagBits() & NS_RC_CREATED_DURING_DOCUMENT_LOAD) { - mRCCreatedDuringLoad--; + NS_PRECONDITION(mRCCreatedDuringLoad >= 0, "PresShell's reflow command queue is in a bad state."); + if (aRC->GetFlagBits() & NS_RC_CREATED_DURING_DOCUMENT_LOAD) { + mRCCreatedDuringLoad--; - PR_LOG(gLog, PR_LOG_DEBUG, - ("presshell=%p, ReflowCommandRemoved(%p) mRCCreatedDuringLoad=%d\n", - this, aRC, mRCCreatedDuringLoad)); - } + PR_LOG(gLog, PR_LOG_DEBUG, + ("presshell=%p, ReflowCommandRemoved(%p) mRCCreatedDuringLoad=%d\n", + this, aRC, mRCCreatedDuringLoad)); } return NS_OK; }