Fixing topembed bug 106105. Clear our document.body cache when resetting a document, and make sure the right things are flushed when position and size related properties are accessed. r=heikki@netscape.com, sr=vidur@netscape.com

git-svn-id: svn://10.0.0.236/trunk@106875 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%netscape.com
2001-10-31 23:52:52 +00:00
parent 86e1f7ce7b
commit 8d2569a64b
4 changed files with 89 additions and 17 deletions

View File

@@ -231,7 +231,6 @@ nsHTMLDocument::nsHTMLDocument()
mCSSLoader = nsnull;
mDocWriteDummyRequest = nsnull;
mBodyContent = nsnull;
mForms = nsnull;
mIsWriting = 0;
mWriteLevel = 0;
@@ -291,8 +290,6 @@ nsHTMLDocument::~nsHTMLDocument()
mCSSLoader->DropDocumentReference(); // release weak ref
}
NS_IF_RELEASE(mBodyContent);
if (--gRefCntRDFService == 0)
{
nsServiceManager::ReleaseService("@mozilla.org/rdf/rdf-service;1", gRDF);
@@ -337,6 +334,8 @@ nsHTMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup)
NS_IF_RELEASE(mAnchors);
NS_IF_RELEASE(mLayers);
mBodyContent = nsnull;
mImageMaps.Clear();
NS_IF_RELEASE(mForms);
@@ -1828,7 +1827,7 @@ nsHTMLDocument::SetBody(nsIDOMHTMLElement* aBody)
nsresult rv = root->ReplaceChild(aBody, child, getter_AddRefs(ret));
NS_IF_RELEASE(mBodyContent);
mBodyContent = nsnull;
return rv;
}
@@ -2603,7 +2602,7 @@ nsHTMLDocument::GetPixelDimensions(nsIPresShell* aShell,
// Find the <body> element: this is what we'll want to use for the
// document's width and height values.
if (mBodyContent == nsnull && PR_FALSE == GetBodyContent()) {
if (!mBodyContent && PR_FALSE == GetBodyContent()) {
return NS_OK;
}
@@ -2664,6 +2663,8 @@ nsHTMLDocument::GetWidth(PRInt32* aWidth)
{
NS_ENSURE_ARG_POINTER(aWidth);
FlushPendingNotifications();
nsCOMPtr<nsIPresShell> shell;
nsresult result = NS_OK;
@@ -2686,6 +2687,8 @@ nsHTMLDocument::GetHeight(PRInt32* aHeight)
{
NS_ENSURE_ARG_POINTER(aHeight);
FlushPendingNotifications();
nsCOMPtr<nsIPresShell> shell;
nsresult result = NS_OK;
@@ -3525,7 +3528,7 @@ nsHTMLDocument::GetBodyContent()
NS_IMETHODIMP
nsHTMLDocument::GetBodyElement(nsIDOMHTMLBodyElement** aBody)
{
if (mBodyContent == nsnull && PR_FALSE == GetBodyContent()) {
if (!mBodyContent && PR_FALSE == GetBodyContent()) {
return NS_ERROR_FAILURE;
}