mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 05:10:49 +00:00
Backing out changes for 80203 and 89626 to fix blocker 92325 and probably also blocker 92443.
This commit is contained in:
parent
2130944b0e
commit
0ab924e19b
@ -372,7 +372,30 @@ public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIContentViewer interface...
|
||||
NS_DECL_NSICONTENTVIEWER
|
||||
NS_IMETHOD Init(nsIWidget* aParentWidget,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
const nsRect& aBounds);
|
||||
NS_IMETHOD SetContainer(nsISupports* aContainer);
|
||||
NS_IMETHOD GetContainer(nsISupports** aContainerResult);
|
||||
NS_IMETHOD LoadStart(nsISupports* aDoc);
|
||||
NS_IMETHOD LoadComplete(nsresult aStatus);
|
||||
NS_IMETHOD Unload(void);
|
||||
NS_IMETHOD Destroy(void);
|
||||
NS_IMETHOD Stop(void);
|
||||
NS_IMETHOD GetDOMDocument(nsIDOMDocument **aResult);
|
||||
NS_IMETHOD SetDOMDocument(nsIDOMDocument *aDocument);
|
||||
NS_IMETHOD GetBounds(nsRect& aResult);
|
||||
NS_IMETHOD SetBounds(const nsRect& aBounds);
|
||||
|
||||
NS_IMETHOD GetPreviousViewer(nsIContentViewer** aResult);
|
||||
NS_IMETHOD SetPreviousViewer(nsIContentViewer* aViewer);
|
||||
|
||||
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
|
||||
NS_IMETHOD Show();
|
||||
NS_IMETHOD Hide();
|
||||
NS_IMETHOD Validate();
|
||||
NS_IMETHOD SetEnableRendering(PRBool aOn);
|
||||
NS_IMETHOD GetEnableRendering(PRBool* aResult);
|
||||
|
||||
// nsIDocumentViewer interface...
|
||||
NS_IMETHOD SetUAStyleSheet(nsIStyleSheet* aUAStyleSheet);
|
||||
@ -822,14 +845,6 @@ NS_IMPL_ISUPPORTS5(DocumentViewerImpl,
|
||||
|
||||
DocumentViewerImpl::~DocumentViewerImpl()
|
||||
{
|
||||
NS_ASSERTION(!mDocument, "User did not call nsIContentViewer::Close");
|
||||
if (mDocument)
|
||||
Close();
|
||||
|
||||
NS_ASSERTION(!mPresShell, "User did not call nsIContentViewer::Destroy");
|
||||
if (mPresShell)
|
||||
Destroy();
|
||||
|
||||
if (mPagePrintTimer != nsnull) {
|
||||
mPagePrintTimer->Stop();
|
||||
delete mPagePrintTimer;
|
||||
@ -839,8 +854,10 @@ DocumentViewerImpl::~DocumentViewerImpl()
|
||||
mPrt->OnEndPrinting(NS_ERROR_FAILURE);
|
||||
delete mPrt;
|
||||
}
|
||||
|
||||
// XXX(?) Revoke pending invalidate events
|
||||
// Revoke pending invalidate events
|
||||
NS_ASSERTION(!mDocument, "User did not call nsIContentViewer::Destroy");
|
||||
if (mDocument)
|
||||
Destroy();
|
||||
|
||||
// clear weak references before we go away
|
||||
if (mPresContext) {
|
||||
@ -853,6 +870,10 @@ DocumentViewerImpl::~DocumentViewerImpl()
|
||||
// stop everything but the chrome.
|
||||
mPresContext->Stop();
|
||||
}
|
||||
|
||||
// Avoid leaking the old viewer.
|
||||
if (mPreviousViewer)
|
||||
SetPreviousViewer(nsnull);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1145,19 +1166,13 @@ DocumentViewerImpl::Unload()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::Close()
|
||||
DocumentViewerImpl::Destroy()
|
||||
{
|
||||
// All callers are supposed to call close to break circular
|
||||
// All callers are supposed to call destroy to break circular
|
||||
// references. If we do this stuff in the destructor, the
|
||||
// destructor might never be called (especially if we're being
|
||||
// used from JS.
|
||||
|
||||
// Close is also needed to disable scripts during paint suppression,
|
||||
// since we transfer the existing global object to the new document
|
||||
// that is loaded. In the future, the global object may become a proxy
|
||||
// for an object that can be switched in and out so that we don't need
|
||||
// to disable scripts during paint suppression.
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (mDocument) {
|
||||
@ -1179,24 +1194,6 @@ DocumentViewerImpl::Close()
|
||||
}
|
||||
}
|
||||
|
||||
mDocument = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::Destroy()
|
||||
{
|
||||
// All callers are supposed to call destroy to break circular
|
||||
// references. If we do this stuff in the destructor, the
|
||||
// destructor might never be called (especially if we're being
|
||||
// used from JS.
|
||||
|
||||
// Avoid leaking the old viewer.
|
||||
if (mPreviousViewer) {
|
||||
mPreviousViewer->Destroy();
|
||||
mPreviousViewer = nsnull;
|
||||
}
|
||||
|
||||
if (mDeviceContext)
|
||||
mDeviceContext->FlushFontCache();
|
||||
|
||||
@ -1204,13 +1201,13 @@ DocumentViewerImpl::Destroy()
|
||||
// Break circular reference (or something)
|
||||
mPresShell->EndObservingDocument();
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
nsresult rv = GetDocumentSelection(getter_AddRefs(selection));
|
||||
rv = GetDocumentSelection(getter_AddRefs(selection));
|
||||
nsCOMPtr<nsISelectionPrivate> selPrivate(do_QueryInterface(selection));
|
||||
if (NS_SUCCEEDED(rv) && selPrivate && mSelectionListener)
|
||||
selPrivate->RemoveSelectionListener(mSelectionListener);
|
||||
mPresShell = nsnull;
|
||||
}
|
||||
|
||||
mDocument = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1373,13 +1370,17 @@ DocumentViewerImpl::GetPreviousViewer(nsIContentViewer** aViewer)
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::SetPreviousViewer(nsIContentViewer* aViewer)
|
||||
{
|
||||
// NOTE: |Show| sets |mPreviousViewer| to null without calling this
|
||||
// function.
|
||||
|
||||
if (aViewer) {
|
||||
NS_ASSERTION(!mPreviousViewer,
|
||||
"can't set previous viewer when there already is one");
|
||||
if (!aViewer) {
|
||||
// Clearing it out.
|
||||
mPreviousViewer = nsnull;
|
||||
|
||||
// Now we can show, but only if we aren't dead already (which
|
||||
// can occasionally happen when one page moves to another during the onload
|
||||
// handler.)
|
||||
if (mDocument)
|
||||
Show();
|
||||
}
|
||||
else {
|
||||
// In a multiple chaining situation (which occurs when running a thrashing
|
||||
// test like i-bench or jrgm's tests with no delay), we can build up a
|
||||
// whole chain of viewers. In order to avoid this, we always set our previous
|
||||
@ -1391,9 +1392,9 @@ DocumentViewerImpl::SetPreviousViewer(nsIContentViewer* aViewer)
|
||||
nsCOMPtr<nsIContentViewer> prevViewer;
|
||||
aViewer->GetPreviousViewer(getter_AddRefs(prevViewer));
|
||||
if (prevViewer) {
|
||||
aViewer->SetPreviousViewer(nsnull);
|
||||
aViewer->Destroy();
|
||||
return SetPreviousViewer(prevViewer);
|
||||
SetPreviousViewer(prevViewer);
|
||||
prevViewer->SetPreviousViewer(nsnull);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1431,17 +1432,6 @@ DocumentViewerImpl::Show(void)
|
||||
{
|
||||
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
|
||||
NS_PRECONDITION(mWindow, "null window");
|
||||
|
||||
// We don't need the previous viewer anymore since we're not
|
||||
// displaying it.
|
||||
if (mPreviousViewer) {
|
||||
// This little dance *may* only be to keep
|
||||
// PresShell::EndObservingDocument happy, but I'm not sure.
|
||||
nsCOMPtr<nsIContentViewer> prevViewer(mPreviousViewer);
|
||||
mPreviousViewer = nsnull;
|
||||
prevViewer->Destroy();
|
||||
}
|
||||
|
||||
if (mWindow) {
|
||||
mWindow->Show(PR_TRUE);
|
||||
}
|
||||
|
@ -2451,7 +2451,6 @@ nsDocShell::Destroy()
|
||||
docShellParentAsNode->RemoveChild(this);
|
||||
|
||||
if (mContentViewer) {
|
||||
mContentViewer->Close();
|
||||
mContentViewer->Destroy();
|
||||
mContentViewer = nsnull;
|
||||
}
|
||||
@ -4107,7 +4106,7 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer)
|
||||
}
|
||||
}
|
||||
|
||||
mContentViewer->Close();
|
||||
mContentViewer->Destroy();
|
||||
aNewViewer->SetPreviousViewer(mContentViewer);
|
||||
mContentViewer = nsnull;
|
||||
}
|
||||
|
@ -27,17 +27,7 @@ interface nsIContentViewer : nsISupports
|
||||
void loadComplete(in unsigned long aStatus);
|
||||
void unload();
|
||||
|
||||
/**
|
||||
* All users of a content viewer are responsible for calling both
|
||||
* close() and destroy(), in that order.
|
||||
*
|
||||
* close() should be called when the load of a new page for the next
|
||||
* content viewer begins, and destroy() should be called when the next
|
||||
* content viewer replaces this one.
|
||||
*/
|
||||
void close();
|
||||
void destroy();
|
||||
|
||||
void stop();
|
||||
|
||||
attribute nsIDOMDocument DOMDocument;
|
||||
@ -45,11 +35,8 @@ interface nsIContentViewer : nsISupports
|
||||
[noscript] void getBounds(in nsRectRef aBounds);
|
||||
[noscript] void setBounds([const] in nsRectRef aBounds);
|
||||
|
||||
/**
|
||||
* The previous content viewer, which has been |close|d but not
|
||||
* |destroy|ed.
|
||||
*/
|
||||
[noscript] attribute nsIContentViewer previousViewer;
|
||||
[noscript] void setPreviousViewer(in nsIContentViewer aViewer);
|
||||
[noscript] nsIContentViewer getPreviousViewer();
|
||||
|
||||
void move(in long aX, in long aY);
|
||||
|
||||
|
@ -372,7 +372,30 @@ public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIContentViewer interface...
|
||||
NS_DECL_NSICONTENTVIEWER
|
||||
NS_IMETHOD Init(nsIWidget* aParentWidget,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
const nsRect& aBounds);
|
||||
NS_IMETHOD SetContainer(nsISupports* aContainer);
|
||||
NS_IMETHOD GetContainer(nsISupports** aContainerResult);
|
||||
NS_IMETHOD LoadStart(nsISupports* aDoc);
|
||||
NS_IMETHOD LoadComplete(nsresult aStatus);
|
||||
NS_IMETHOD Unload(void);
|
||||
NS_IMETHOD Destroy(void);
|
||||
NS_IMETHOD Stop(void);
|
||||
NS_IMETHOD GetDOMDocument(nsIDOMDocument **aResult);
|
||||
NS_IMETHOD SetDOMDocument(nsIDOMDocument *aDocument);
|
||||
NS_IMETHOD GetBounds(nsRect& aResult);
|
||||
NS_IMETHOD SetBounds(const nsRect& aBounds);
|
||||
|
||||
NS_IMETHOD GetPreviousViewer(nsIContentViewer** aResult);
|
||||
NS_IMETHOD SetPreviousViewer(nsIContentViewer* aViewer);
|
||||
|
||||
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
|
||||
NS_IMETHOD Show();
|
||||
NS_IMETHOD Hide();
|
||||
NS_IMETHOD Validate();
|
||||
NS_IMETHOD SetEnableRendering(PRBool aOn);
|
||||
NS_IMETHOD GetEnableRendering(PRBool* aResult);
|
||||
|
||||
// nsIDocumentViewer interface...
|
||||
NS_IMETHOD SetUAStyleSheet(nsIStyleSheet* aUAStyleSheet);
|
||||
@ -822,14 +845,6 @@ NS_IMPL_ISUPPORTS5(DocumentViewerImpl,
|
||||
|
||||
DocumentViewerImpl::~DocumentViewerImpl()
|
||||
{
|
||||
NS_ASSERTION(!mDocument, "User did not call nsIContentViewer::Close");
|
||||
if (mDocument)
|
||||
Close();
|
||||
|
||||
NS_ASSERTION(!mPresShell, "User did not call nsIContentViewer::Destroy");
|
||||
if (mPresShell)
|
||||
Destroy();
|
||||
|
||||
if (mPagePrintTimer != nsnull) {
|
||||
mPagePrintTimer->Stop();
|
||||
delete mPagePrintTimer;
|
||||
@ -839,8 +854,10 @@ DocumentViewerImpl::~DocumentViewerImpl()
|
||||
mPrt->OnEndPrinting(NS_ERROR_FAILURE);
|
||||
delete mPrt;
|
||||
}
|
||||
|
||||
// XXX(?) Revoke pending invalidate events
|
||||
// Revoke pending invalidate events
|
||||
NS_ASSERTION(!mDocument, "User did not call nsIContentViewer::Destroy");
|
||||
if (mDocument)
|
||||
Destroy();
|
||||
|
||||
// clear weak references before we go away
|
||||
if (mPresContext) {
|
||||
@ -853,6 +870,10 @@ DocumentViewerImpl::~DocumentViewerImpl()
|
||||
// stop everything but the chrome.
|
||||
mPresContext->Stop();
|
||||
}
|
||||
|
||||
// Avoid leaking the old viewer.
|
||||
if (mPreviousViewer)
|
||||
SetPreviousViewer(nsnull);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1145,19 +1166,13 @@ DocumentViewerImpl::Unload()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::Close()
|
||||
DocumentViewerImpl::Destroy()
|
||||
{
|
||||
// All callers are supposed to call close to break circular
|
||||
// All callers are supposed to call destroy to break circular
|
||||
// references. If we do this stuff in the destructor, the
|
||||
// destructor might never be called (especially if we're being
|
||||
// used from JS.
|
||||
|
||||
// Close is also needed to disable scripts during paint suppression,
|
||||
// since we transfer the existing global object to the new document
|
||||
// that is loaded. In the future, the global object may become a proxy
|
||||
// for an object that can be switched in and out so that we don't need
|
||||
// to disable scripts during paint suppression.
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (mDocument) {
|
||||
@ -1179,24 +1194,6 @@ DocumentViewerImpl::Close()
|
||||
}
|
||||
}
|
||||
|
||||
mDocument = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::Destroy()
|
||||
{
|
||||
// All callers are supposed to call destroy to break circular
|
||||
// references. If we do this stuff in the destructor, the
|
||||
// destructor might never be called (especially if we're being
|
||||
// used from JS.
|
||||
|
||||
// Avoid leaking the old viewer.
|
||||
if (mPreviousViewer) {
|
||||
mPreviousViewer->Destroy();
|
||||
mPreviousViewer = nsnull;
|
||||
}
|
||||
|
||||
if (mDeviceContext)
|
||||
mDeviceContext->FlushFontCache();
|
||||
|
||||
@ -1204,13 +1201,13 @@ DocumentViewerImpl::Destroy()
|
||||
// Break circular reference (or something)
|
||||
mPresShell->EndObservingDocument();
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
nsresult rv = GetDocumentSelection(getter_AddRefs(selection));
|
||||
rv = GetDocumentSelection(getter_AddRefs(selection));
|
||||
nsCOMPtr<nsISelectionPrivate> selPrivate(do_QueryInterface(selection));
|
||||
if (NS_SUCCEEDED(rv) && selPrivate && mSelectionListener)
|
||||
selPrivate->RemoveSelectionListener(mSelectionListener);
|
||||
mPresShell = nsnull;
|
||||
}
|
||||
|
||||
mDocument = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1373,13 +1370,17 @@ DocumentViewerImpl::GetPreviousViewer(nsIContentViewer** aViewer)
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::SetPreviousViewer(nsIContentViewer* aViewer)
|
||||
{
|
||||
// NOTE: |Show| sets |mPreviousViewer| to null without calling this
|
||||
// function.
|
||||
|
||||
if (aViewer) {
|
||||
NS_ASSERTION(!mPreviousViewer,
|
||||
"can't set previous viewer when there already is one");
|
||||
if (!aViewer) {
|
||||
// Clearing it out.
|
||||
mPreviousViewer = nsnull;
|
||||
|
||||
// Now we can show, but only if we aren't dead already (which
|
||||
// can occasionally happen when one page moves to another during the onload
|
||||
// handler.)
|
||||
if (mDocument)
|
||||
Show();
|
||||
}
|
||||
else {
|
||||
// In a multiple chaining situation (which occurs when running a thrashing
|
||||
// test like i-bench or jrgm's tests with no delay), we can build up a
|
||||
// whole chain of viewers. In order to avoid this, we always set our previous
|
||||
@ -1391,9 +1392,9 @@ DocumentViewerImpl::SetPreviousViewer(nsIContentViewer* aViewer)
|
||||
nsCOMPtr<nsIContentViewer> prevViewer;
|
||||
aViewer->GetPreviousViewer(getter_AddRefs(prevViewer));
|
||||
if (prevViewer) {
|
||||
aViewer->SetPreviousViewer(nsnull);
|
||||
aViewer->Destroy();
|
||||
return SetPreviousViewer(prevViewer);
|
||||
SetPreviousViewer(prevViewer);
|
||||
prevViewer->SetPreviousViewer(nsnull);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1431,17 +1432,6 @@ DocumentViewerImpl::Show(void)
|
||||
{
|
||||
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
|
||||
NS_PRECONDITION(mWindow, "null window");
|
||||
|
||||
// We don't need the previous viewer anymore since we're not
|
||||
// displaying it.
|
||||
if (mPreviousViewer) {
|
||||
// This little dance *may* only be to keep
|
||||
// PresShell::EndObservingDocument happy, but I'm not sure.
|
||||
nsCOMPtr<nsIContentViewer> prevViewer(mPreviousViewer);
|
||||
mPreviousViewer = nsnull;
|
||||
prevViewer->Destroy();
|
||||
}
|
||||
|
||||
if (mWindow) {
|
||||
mWindow->Show(PR_TRUE);
|
||||
}
|
||||
|
@ -1482,6 +1482,104 @@ PresShell::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
|
||||
PresShell::~PresShell()
|
||||
{
|
||||
#ifdef MOZ_REFLOW_PERF
|
||||
DumpReflows();
|
||||
if (mReflowCountMgr) {
|
||||
delete mReflowCountMgr;
|
||||
mReflowCountMgr = nsnull;
|
||||
}
|
||||
#endif
|
||||
|
||||
// If our paint suppression timer is still active, kill it.
|
||||
if (mPaintSuppressionTimer) {
|
||||
mPaintSuppressionTimer->Cancel();
|
||||
mPaintSuppressionTimer = nsnull;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> container;
|
||||
mPresContext->GetContainer(getter_AddRefs(container));
|
||||
if (container) {
|
||||
nsCOMPtr<nsIDocShell> cvc(do_QueryInterface(container));
|
||||
if (cvc) {
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
cvc->GetContentViewer(getter_AddRefs(cv));
|
||||
if (cv)
|
||||
cv->SetPreviousViewer(nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
// release our pref style sheet, if we have one still
|
||||
ClearPreferenceStyleRules();
|
||||
|
||||
// if we allocated any stack memory free it.
|
||||
FreeDynamicStack();
|
||||
|
||||
// free our table of anonymous content
|
||||
ReleaseAnonymousContent();
|
||||
|
||||
mIsDestroying = PR_TRUE;
|
||||
|
||||
// Clobber weak leaks in case of re-entrancy during tear down
|
||||
mHistoryState = nsnull;
|
||||
|
||||
// kill subshell map, if any. It holds only weak references
|
||||
if (mSubShellMap)
|
||||
{
|
||||
delete mSubShellMap;
|
||||
mSubShellMap = nsnull;
|
||||
}
|
||||
|
||||
// release current event content and any content on event stack
|
||||
NS_IF_RELEASE(mCurrentEventContent);
|
||||
|
||||
PRInt32 i, count = mCurrentEventContentStack.Count();
|
||||
nsIContent* currentEventContent;
|
||||
for (i = 0; i < count; i++) {
|
||||
currentEventContent = (nsIContent*)mCurrentEventContentStack.ElementAt(i);
|
||||
NS_IF_RELEASE(currentEventContent);
|
||||
}
|
||||
|
||||
if (mViewManager) {
|
||||
// Disable paints during tear down of the frame tree
|
||||
mViewManager->DisableRefresh();
|
||||
mViewManager = nsnull;
|
||||
}
|
||||
|
||||
// This shell must be removed from the document before the frame
|
||||
// hierarchy is torn down to avoid finding deleted frames through
|
||||
// this presshell while the frames are being torn down
|
||||
if (mDocument) {
|
||||
mDocument->DeleteShell(this);
|
||||
}
|
||||
|
||||
// Destroy the frame manager. This will destroy the frame hierarchy
|
||||
if (mFrameManager) {
|
||||
mFrameManager->Destroy();
|
||||
NS_RELEASE(mFrameManager);
|
||||
}
|
||||
|
||||
// Let the style set do its cleanup.
|
||||
mStyleSet->Shutdown();
|
||||
|
||||
// We hold a reference to the pres context, and it holds a weak link back
|
||||
// to us. To avoid the pres context having a dangling reference, set its
|
||||
// pres shell to NULL
|
||||
if (mPresContext) {
|
||||
mPresContext->SetShell(nsnull);
|
||||
}
|
||||
|
||||
if (mViewEventListener) {
|
||||
mViewEventListener->SetPresShell((nsIPresShell*)nsnull);
|
||||
NS_RELEASE(mViewEventListener);
|
||||
}
|
||||
|
||||
// Revoke pending reflow events
|
||||
if (mPendingReflowEvent) {
|
||||
mPendingReflowEvent = PR_FALSE;
|
||||
mEventQueue->RevokeEvents(this);
|
||||
}
|
||||
|
||||
KillResizeEventTimer();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2349,113 +2447,6 @@ PresShell::EndObservingDocument()
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
mSelection->ShutDown();
|
||||
}
|
||||
|
||||
#ifdef MOZ_REFLOW_PERF
|
||||
DumpReflows();
|
||||
if (mReflowCountMgr) {
|
||||
delete mReflowCountMgr;
|
||||
mReflowCountMgr = nsnull;
|
||||
}
|
||||
#endif
|
||||
|
||||
// If our paint suppression timer is still active, kill it.
|
||||
if (mPaintSuppressionTimer) {
|
||||
mPaintSuppressionTimer->Cancel();
|
||||
mPaintSuppressionTimer = nsnull;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsISupports> container;
|
||||
mPresContext->GetContainer(getter_AddRefs(container));
|
||||
if (container) {
|
||||
nsCOMPtr<nsIDocShell> cvc(do_QueryInterface(container));
|
||||
if (cvc) {
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
cvc->GetContentViewer(getter_AddRefs(cv));
|
||||
if (cv) {
|
||||
nsCOMPtr<nsIContentViewer> prevViewer;
|
||||
cv->GetPreviousViewer(getter_AddRefs(prevViewer));
|
||||
NS_ASSERTION(!prevViewer, "still have a previous viewer!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// release our pref style sheet, if we have one still
|
||||
ClearPreferenceStyleRules();
|
||||
|
||||
// if we allocated any stack memory free it.
|
||||
FreeDynamicStack();
|
||||
|
||||
// free our table of anonymous content
|
||||
ReleaseAnonymousContent();
|
||||
|
||||
mIsDestroying = PR_TRUE;
|
||||
|
||||
// Clobber weak leaks in case of re-entrancy during tear down
|
||||
mHistoryState = nsnull;
|
||||
|
||||
// kill subshell map, if any. It holds only weak references
|
||||
if (mSubShellMap)
|
||||
{
|
||||
delete mSubShellMap;
|
||||
mSubShellMap = nsnull;
|
||||
}
|
||||
|
||||
// release current event content and any content on event stack
|
||||
NS_IF_RELEASE(mCurrentEventContent);
|
||||
|
||||
PRInt32 i, count = mCurrentEventContentStack.Count();
|
||||
nsIContent* currentEventContent;
|
||||
for (i = 0; i < count; i++) {
|
||||
currentEventContent = (nsIContent*)mCurrentEventContentStack.ElementAt(i);
|
||||
NS_IF_RELEASE(currentEventContent);
|
||||
}
|
||||
|
||||
if (mViewManager) {
|
||||
// Disable paints during tear down of the frame tree
|
||||
mViewManager->DisableRefresh();
|
||||
mViewManager = nsnull;
|
||||
}
|
||||
|
||||
// This shell must be removed from the document before the frame
|
||||
// hierarchy is torn down to avoid finding deleted frames through
|
||||
// this presshell while the frames are being torn down
|
||||
if (mDocument) {
|
||||
mDocument->DeleteShell(this);
|
||||
}
|
||||
|
||||
// Destroy the frame manager. This will destroy the frame hierarchy
|
||||
if (mFrameManager) {
|
||||
mFrameManager->Destroy();
|
||||
NS_RELEASE(mFrameManager);
|
||||
}
|
||||
|
||||
// Let the style set do its cleanup.
|
||||
mStyleSet->Shutdown();
|
||||
|
||||
// We hold a reference to the pres context, and it holds a weak link back
|
||||
// to us. To avoid the pres context having a dangling reference, set its
|
||||
// pres shell to NULL
|
||||
if (mPresContext) {
|
||||
mPresContext->SetShell(nsnull);
|
||||
}
|
||||
|
||||
if (mViewEventListener) {
|
||||
mViewEventListener->SetPresShell((nsIPresShell*)nsnull);
|
||||
NS_RELEASE(mViewEventListener);
|
||||
}
|
||||
|
||||
// Revoke pending reflow events
|
||||
if (mPendingReflowEvent) {
|
||||
mPendingReflowEvent = PR_FALSE;
|
||||
mEventQueue->RevokeEvents(this);
|
||||
}
|
||||
|
||||
KillResizeEventTimer();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -4588,17 +4579,23 @@ PresShell::UnsuppressAndInvalidate()
|
||||
focusController->SetSuppressFocus(PR_TRUE, "PresShell suppression on Web page loads");
|
||||
|
||||
nsCOMPtr<nsISupports> container;
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
nsCOMPtr<nsIDocumentViewer> dv;
|
||||
mPresContext->GetContainer(getter_AddRefs(container));
|
||||
if (container) {
|
||||
nsCOMPtr<nsIDocShell> cvc(do_QueryInterface(container));
|
||||
if (cvc) {
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
cvc->GetContentViewer(getter_AddRefs(cv));
|
||||
if (cv)
|
||||
cv->Show();
|
||||
dv = do_QueryInterface(cv);
|
||||
}
|
||||
}
|
||||
|
||||
if (dv)
|
||||
dv->Show();
|
||||
|
||||
if (cv)
|
||||
cv->SetPreviousViewer(nsnull);
|
||||
|
||||
mPaintingSuppressed = PR_FALSE;
|
||||
nsIFrame* rootFrame;
|
||||
mFrameManager->GetRootFrame(&rootFrame);
|
||||
|
@ -440,7 +440,7 @@ nsObjectFrame::Init(nsIPresContext* aPresContext,
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
cvc->GetContentViewer(getter_AddRefs(cv));
|
||||
if (cv)
|
||||
cv->Show();
|
||||
cv->SetPreviousViewer(nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -440,7 +440,7 @@ nsObjectFrame::Init(nsIPresContext* aPresContext,
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
cvc->GetContentViewer(getter_AddRefs(cv));
|
||||
if (cv)
|
||||
cv->Show();
|
||||
cv->SetPreviousViewer(nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1482,6 +1482,104 @@ PresShell::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
|
||||
PresShell::~PresShell()
|
||||
{
|
||||
#ifdef MOZ_REFLOW_PERF
|
||||
DumpReflows();
|
||||
if (mReflowCountMgr) {
|
||||
delete mReflowCountMgr;
|
||||
mReflowCountMgr = nsnull;
|
||||
}
|
||||
#endif
|
||||
|
||||
// If our paint suppression timer is still active, kill it.
|
||||
if (mPaintSuppressionTimer) {
|
||||
mPaintSuppressionTimer->Cancel();
|
||||
mPaintSuppressionTimer = nsnull;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> container;
|
||||
mPresContext->GetContainer(getter_AddRefs(container));
|
||||
if (container) {
|
||||
nsCOMPtr<nsIDocShell> cvc(do_QueryInterface(container));
|
||||
if (cvc) {
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
cvc->GetContentViewer(getter_AddRefs(cv));
|
||||
if (cv)
|
||||
cv->SetPreviousViewer(nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
// release our pref style sheet, if we have one still
|
||||
ClearPreferenceStyleRules();
|
||||
|
||||
// if we allocated any stack memory free it.
|
||||
FreeDynamicStack();
|
||||
|
||||
// free our table of anonymous content
|
||||
ReleaseAnonymousContent();
|
||||
|
||||
mIsDestroying = PR_TRUE;
|
||||
|
||||
// Clobber weak leaks in case of re-entrancy during tear down
|
||||
mHistoryState = nsnull;
|
||||
|
||||
// kill subshell map, if any. It holds only weak references
|
||||
if (mSubShellMap)
|
||||
{
|
||||
delete mSubShellMap;
|
||||
mSubShellMap = nsnull;
|
||||
}
|
||||
|
||||
// release current event content and any content on event stack
|
||||
NS_IF_RELEASE(mCurrentEventContent);
|
||||
|
||||
PRInt32 i, count = mCurrentEventContentStack.Count();
|
||||
nsIContent* currentEventContent;
|
||||
for (i = 0; i < count; i++) {
|
||||
currentEventContent = (nsIContent*)mCurrentEventContentStack.ElementAt(i);
|
||||
NS_IF_RELEASE(currentEventContent);
|
||||
}
|
||||
|
||||
if (mViewManager) {
|
||||
// Disable paints during tear down of the frame tree
|
||||
mViewManager->DisableRefresh();
|
||||
mViewManager = nsnull;
|
||||
}
|
||||
|
||||
// This shell must be removed from the document before the frame
|
||||
// hierarchy is torn down to avoid finding deleted frames through
|
||||
// this presshell while the frames are being torn down
|
||||
if (mDocument) {
|
||||
mDocument->DeleteShell(this);
|
||||
}
|
||||
|
||||
// Destroy the frame manager. This will destroy the frame hierarchy
|
||||
if (mFrameManager) {
|
||||
mFrameManager->Destroy();
|
||||
NS_RELEASE(mFrameManager);
|
||||
}
|
||||
|
||||
// Let the style set do its cleanup.
|
||||
mStyleSet->Shutdown();
|
||||
|
||||
// We hold a reference to the pres context, and it holds a weak link back
|
||||
// to us. To avoid the pres context having a dangling reference, set its
|
||||
// pres shell to NULL
|
||||
if (mPresContext) {
|
||||
mPresContext->SetShell(nsnull);
|
||||
}
|
||||
|
||||
if (mViewEventListener) {
|
||||
mViewEventListener->SetPresShell((nsIPresShell*)nsnull);
|
||||
NS_RELEASE(mViewEventListener);
|
||||
}
|
||||
|
||||
// Revoke pending reflow events
|
||||
if (mPendingReflowEvent) {
|
||||
mPendingReflowEvent = PR_FALSE;
|
||||
mEventQueue->RevokeEvents(this);
|
||||
}
|
||||
|
||||
KillResizeEventTimer();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2349,113 +2447,6 @@ PresShell::EndObservingDocument()
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
mSelection->ShutDown();
|
||||
}
|
||||
|
||||
#ifdef MOZ_REFLOW_PERF
|
||||
DumpReflows();
|
||||
if (mReflowCountMgr) {
|
||||
delete mReflowCountMgr;
|
||||
mReflowCountMgr = nsnull;
|
||||
}
|
||||
#endif
|
||||
|
||||
// If our paint suppression timer is still active, kill it.
|
||||
if (mPaintSuppressionTimer) {
|
||||
mPaintSuppressionTimer->Cancel();
|
||||
mPaintSuppressionTimer = nsnull;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsISupports> container;
|
||||
mPresContext->GetContainer(getter_AddRefs(container));
|
||||
if (container) {
|
||||
nsCOMPtr<nsIDocShell> cvc(do_QueryInterface(container));
|
||||
if (cvc) {
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
cvc->GetContentViewer(getter_AddRefs(cv));
|
||||
if (cv) {
|
||||
nsCOMPtr<nsIContentViewer> prevViewer;
|
||||
cv->GetPreviousViewer(getter_AddRefs(prevViewer));
|
||||
NS_ASSERTION(!prevViewer, "still have a previous viewer!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// release our pref style sheet, if we have one still
|
||||
ClearPreferenceStyleRules();
|
||||
|
||||
// if we allocated any stack memory free it.
|
||||
FreeDynamicStack();
|
||||
|
||||
// free our table of anonymous content
|
||||
ReleaseAnonymousContent();
|
||||
|
||||
mIsDestroying = PR_TRUE;
|
||||
|
||||
// Clobber weak leaks in case of re-entrancy during tear down
|
||||
mHistoryState = nsnull;
|
||||
|
||||
// kill subshell map, if any. It holds only weak references
|
||||
if (mSubShellMap)
|
||||
{
|
||||
delete mSubShellMap;
|
||||
mSubShellMap = nsnull;
|
||||
}
|
||||
|
||||
// release current event content and any content on event stack
|
||||
NS_IF_RELEASE(mCurrentEventContent);
|
||||
|
||||
PRInt32 i, count = mCurrentEventContentStack.Count();
|
||||
nsIContent* currentEventContent;
|
||||
for (i = 0; i < count; i++) {
|
||||
currentEventContent = (nsIContent*)mCurrentEventContentStack.ElementAt(i);
|
||||
NS_IF_RELEASE(currentEventContent);
|
||||
}
|
||||
|
||||
if (mViewManager) {
|
||||
// Disable paints during tear down of the frame tree
|
||||
mViewManager->DisableRefresh();
|
||||
mViewManager = nsnull;
|
||||
}
|
||||
|
||||
// This shell must be removed from the document before the frame
|
||||
// hierarchy is torn down to avoid finding deleted frames through
|
||||
// this presshell while the frames are being torn down
|
||||
if (mDocument) {
|
||||
mDocument->DeleteShell(this);
|
||||
}
|
||||
|
||||
// Destroy the frame manager. This will destroy the frame hierarchy
|
||||
if (mFrameManager) {
|
||||
mFrameManager->Destroy();
|
||||
NS_RELEASE(mFrameManager);
|
||||
}
|
||||
|
||||
// Let the style set do its cleanup.
|
||||
mStyleSet->Shutdown();
|
||||
|
||||
// We hold a reference to the pres context, and it holds a weak link back
|
||||
// to us. To avoid the pres context having a dangling reference, set its
|
||||
// pres shell to NULL
|
||||
if (mPresContext) {
|
||||
mPresContext->SetShell(nsnull);
|
||||
}
|
||||
|
||||
if (mViewEventListener) {
|
||||
mViewEventListener->SetPresShell((nsIPresShell*)nsnull);
|
||||
NS_RELEASE(mViewEventListener);
|
||||
}
|
||||
|
||||
// Revoke pending reflow events
|
||||
if (mPendingReflowEvent) {
|
||||
mPendingReflowEvent = PR_FALSE;
|
||||
mEventQueue->RevokeEvents(this);
|
||||
}
|
||||
|
||||
KillResizeEventTimer();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -4588,17 +4579,23 @@ PresShell::UnsuppressAndInvalidate()
|
||||
focusController->SetSuppressFocus(PR_TRUE, "PresShell suppression on Web page loads");
|
||||
|
||||
nsCOMPtr<nsISupports> container;
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
nsCOMPtr<nsIDocumentViewer> dv;
|
||||
mPresContext->GetContainer(getter_AddRefs(container));
|
||||
if (container) {
|
||||
nsCOMPtr<nsIDocShell> cvc(do_QueryInterface(container));
|
||||
if (cvc) {
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
cvc->GetContentViewer(getter_AddRefs(cv));
|
||||
if (cv)
|
||||
cv->Show();
|
||||
dv = do_QueryInterface(cv);
|
||||
}
|
||||
}
|
||||
|
||||
if (dv)
|
||||
dv->Show();
|
||||
|
||||
if (cv)
|
||||
cv->SetPreviousViewer(nsnull);
|
||||
|
||||
mPaintingSuppressed = PR_FALSE;
|
||||
nsIFrame* rootFrame;
|
||||
mFrameManager->GetRootFrame(&rootFrame);
|
||||
|
@ -169,7 +169,28 @@ public:
|
||||
NS_IMETHOD StartLoad(nsIRequest* request, nsIStreamListener*& aResult);
|
||||
|
||||
// nsIContentViewer
|
||||
NS_DECL_NSICONTENTVIEWER
|
||||
NS_IMETHOD Init(nsIWidget* aParentWidget,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
const nsRect& aBounds);
|
||||
NS_IMETHOD SetContainer(nsISupports* aContainer);
|
||||
NS_IMETHOD GetContainer(nsISupports** aContainerResult);
|
||||
NS_IMETHOD LoadStart(nsISupports* aDoc);
|
||||
NS_IMETHOD LoadComplete(nsresult aStatus);
|
||||
NS_IMETHOD Unload(void);
|
||||
NS_IMETHOD Destroy(void);
|
||||
NS_IMETHOD Stop(void);
|
||||
NS_IMETHOD GetDOMDocument(nsIDOMDocument **aResult);
|
||||
NS_IMETHOD SetDOMDocument(nsIDOMDocument *aDocument);
|
||||
NS_IMETHOD GetBounds(nsRect& aResult);
|
||||
NS_IMETHOD SetBounds(const nsRect& aBounds);
|
||||
NS_IMETHOD GetPreviousViewer(nsIContentViewer** aViewer);
|
||||
NS_IMETHOD SetPreviousViewer(nsIContentViewer* aViewer);
|
||||
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
|
||||
NS_IMETHOD Show();
|
||||
NS_IMETHOD Hide();
|
||||
NS_IMETHOD Validate();
|
||||
NS_IMETHOD SetEnableRendering(PRBool aOn);
|
||||
NS_IMETHOD GetEnableRendering(PRBool* aResult);
|
||||
|
||||
// nsIContentViewerEdit
|
||||
NS_DECL_NSICONTENTVIEWEREDIT
|
||||
@ -414,12 +435,6 @@ PluginViewerImpl::Unload(void)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PluginViewerImpl::Close(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PluginViewerImpl::Destroy(void)
|
||||
{
|
||||
@ -543,8 +558,6 @@ PluginViewerImpl::GetPreviousViewer(nsIContentViewer** aViewer)
|
||||
NS_IMETHODIMP
|
||||
PluginViewerImpl::SetPreviousViewer(nsIContentViewer* aViewer)
|
||||
{
|
||||
if (aViewer)
|
||||
aViewer->Destroy();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,28 @@ public:
|
||||
NS_IMETHOD StartLoad(nsIRequest* request, nsIStreamListener*& aResult);
|
||||
|
||||
// nsIContentViewer
|
||||
NS_DECL_NSICONTENTVIEWER
|
||||
NS_IMETHOD Init(nsIWidget* aParentWidget,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
const nsRect& aBounds);
|
||||
NS_IMETHOD SetContainer(nsISupports* aContainer);
|
||||
NS_IMETHOD GetContainer(nsISupports** aContainerResult);
|
||||
NS_IMETHOD LoadStart(nsISupports* aDoc);
|
||||
NS_IMETHOD LoadComplete(nsresult aStatus);
|
||||
NS_IMETHOD Unload(void);
|
||||
NS_IMETHOD Destroy(void);
|
||||
NS_IMETHOD Stop(void);
|
||||
NS_IMETHOD GetDOMDocument(nsIDOMDocument **aResult);
|
||||
NS_IMETHOD SetDOMDocument(nsIDOMDocument *aDocument);
|
||||
NS_IMETHOD GetBounds(nsRect& aResult);
|
||||
NS_IMETHOD SetBounds(const nsRect& aBounds);
|
||||
NS_IMETHOD GetPreviousViewer(nsIContentViewer** aViewer);
|
||||
NS_IMETHOD SetPreviousViewer(nsIContentViewer* aViewer);
|
||||
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
|
||||
NS_IMETHOD Show();
|
||||
NS_IMETHOD Hide();
|
||||
NS_IMETHOD Validate();
|
||||
NS_IMETHOD SetEnableRendering(PRBool aOn);
|
||||
NS_IMETHOD GetEnableRendering(PRBool* aResult);
|
||||
|
||||
// nsIContentViewerEdit
|
||||
NS_DECL_NSICONTENTVIEWEREDIT
|
||||
@ -414,12 +435,6 @@ PluginViewerImpl::Unload(void)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PluginViewerImpl::Close(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PluginViewerImpl::Destroy(void)
|
||||
{
|
||||
@ -543,8 +558,6 @@ PluginViewerImpl::GetPreviousViewer(nsIContentViewer** aViewer)
|
||||
NS_IMETHODIMP
|
||||
PluginViewerImpl::SetPreviousViewer(nsIContentViewer* aViewer)
|
||||
{
|
||||
if (aViewer)
|
||||
aViewer->Destroy();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user