Bug 53956. Unconditionally remove dummy layout request when no reflows pending. Also, add NSPR logging code. r=nisheeth, sr=jst

This commit is contained in:
waterson%netscape.com 2001-04-11 03:07:50 +00:00
parent 26a2d9444e
commit a173065d6e
2 changed files with 38 additions and 18 deletions

View File

@ -1030,6 +1030,10 @@ public:
#endif #endif
#ifdef PR_LOGGING
static PRLogModuleInfo* gLog;
#endif
protected: protected:
virtual ~PresShell(); virtual ~PresShell();
@ -1181,6 +1185,10 @@ private:
nsresult HandleEventInternal(nsEvent* aEvent, nsIView* aView, PRUint32 aFlags, nsEventStatus *aStatus); nsresult HandleEventInternal(nsEvent* aEvent, nsIView* aView, PRUint32 aFlags, nsEventStatus *aStatus);
}; };
#ifdef PR_LOGGING
PRLogModuleInfo* PresShell::gLog;
#endif
#ifdef NS_DEBUG #ifdef NS_DEBUG
static void static void
VerifyStyleTree(nsIPresContext* aPresContext, nsIFrameManager* aFrameManager) VerifyStyleTree(nsIPresContext* aPresContext, nsIFrameManager* aFrameManager)
@ -1312,6 +1320,10 @@ PresShell::PresShell():mAnonymousContentTable(nsnull),
#ifdef IBMBIDI #ifdef IBMBIDI
mBidiLevel = BIDI_LEVEL_UNDEFINED; mBidiLevel = BIDI_LEVEL_UNDEFINED;
#endif #endif
#ifdef PR_LOGGING
if (! gLog)
gLog = PR_NewLogModule("PresShell");
#endif
} }
NS_IMPL_ADDREF(PresShell) NS_IMPL_ADDREF(PresShell)
@ -5663,7 +5675,7 @@ PresShell::ReflowCommandRemoved(nsIReflowCommand* aRC)
void void
PresShell::DoneRemovingReflowCommands() PresShell::DoneRemovingReflowCommands()
{ {
if (mRCCreatedDuringLoad == 0 && !mDocumentLoading && mDummyLayoutRequest) { if (mRCCreatedDuringLoad == 0 && mDummyLayoutRequest) {
RemoveDummyLayoutRequest(); RemoveDummyLayoutRequest();
} }
} }
@ -5689,11 +5701,10 @@ PresShell::AddDummyLayoutRequest(void)
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
rv = loadGroup->AddRequest(mDummyLayoutRequest, nsnull); rv = loadGroup->AddRequest(mDummyLayoutRequest, nsnull);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
}
#ifdef DEBUG_nisheeth PR_LOG(gLog, PR_LOG_ALWAYS,
printf("presshell=%p, Added dummy layout request.\n", this); ("presshell=%p, Added dummy layout request %p", this, mDummyLayoutRequest.get()));
#endif }
} }
return rv; return rv;
} }
@ -5714,12 +5725,11 @@ PresShell::RemoveDummyLayoutRequest(void)
rv = loadGroup->RemoveRequest(mDummyLayoutRequest, nsnull, NS_OK); rv = loadGroup->RemoveRequest(mDummyLayoutRequest, nsnull, NS_OK);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
PR_LOG(gLog, PR_LOG_ALWAYS,
("presshell=%p, Removed dummy layout request %p", this, mDummyLayoutRequest.get()));
mDummyLayoutRequest = nsnull; mDummyLayoutRequest = nsnull;
} }
#ifdef DEBUG_nisheeth
printf("presshell=%p, Removed dummy layout request.\n", this);
#endif
} }
return rv; return rv;
} }

View File

@ -1030,6 +1030,10 @@ public:
#endif #endif
#ifdef PR_LOGGING
static PRLogModuleInfo* gLog;
#endif
protected: protected:
virtual ~PresShell(); virtual ~PresShell();
@ -1181,6 +1185,10 @@ private:
nsresult HandleEventInternal(nsEvent* aEvent, nsIView* aView, PRUint32 aFlags, nsEventStatus *aStatus); nsresult HandleEventInternal(nsEvent* aEvent, nsIView* aView, PRUint32 aFlags, nsEventStatus *aStatus);
}; };
#ifdef PR_LOGGING
PRLogModuleInfo* PresShell::gLog;
#endif
#ifdef NS_DEBUG #ifdef NS_DEBUG
static void static void
VerifyStyleTree(nsIPresContext* aPresContext, nsIFrameManager* aFrameManager) VerifyStyleTree(nsIPresContext* aPresContext, nsIFrameManager* aFrameManager)
@ -1312,6 +1320,10 @@ PresShell::PresShell():mAnonymousContentTable(nsnull),
#ifdef IBMBIDI #ifdef IBMBIDI
mBidiLevel = BIDI_LEVEL_UNDEFINED; mBidiLevel = BIDI_LEVEL_UNDEFINED;
#endif #endif
#ifdef PR_LOGGING
if (! gLog)
gLog = PR_NewLogModule("PresShell");
#endif
} }
NS_IMPL_ADDREF(PresShell) NS_IMPL_ADDREF(PresShell)
@ -5663,7 +5675,7 @@ PresShell::ReflowCommandRemoved(nsIReflowCommand* aRC)
void void
PresShell::DoneRemovingReflowCommands() PresShell::DoneRemovingReflowCommands()
{ {
if (mRCCreatedDuringLoad == 0 && !mDocumentLoading && mDummyLayoutRequest) { if (mRCCreatedDuringLoad == 0 && mDummyLayoutRequest) {
RemoveDummyLayoutRequest(); RemoveDummyLayoutRequest();
} }
} }
@ -5689,11 +5701,10 @@ PresShell::AddDummyLayoutRequest(void)
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
rv = loadGroup->AddRequest(mDummyLayoutRequest, nsnull); rv = loadGroup->AddRequest(mDummyLayoutRequest, nsnull);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
}
#ifdef DEBUG_nisheeth PR_LOG(gLog, PR_LOG_ALWAYS,
printf("presshell=%p, Added dummy layout request.\n", this); ("presshell=%p, Added dummy layout request %p", this, mDummyLayoutRequest.get()));
#endif }
} }
return rv; return rv;
} }
@ -5714,12 +5725,11 @@ PresShell::RemoveDummyLayoutRequest(void)
rv = loadGroup->RemoveRequest(mDummyLayoutRequest, nsnull, NS_OK); rv = loadGroup->RemoveRequest(mDummyLayoutRequest, nsnull, NS_OK);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
PR_LOG(gLog, PR_LOG_ALWAYS,
("presshell=%p, Removed dummy layout request %p", this, mDummyLayoutRequest.get()));
mDummyLayoutRequest = nsnull; mDummyLayoutRequest = nsnull;
} }
#ifdef DEBUG_nisheeth
printf("presshell=%p, Removed dummy layout request.\n", this);
#endif
} }
return rv; return rv;
} }