Bug 20315: Copy charset info from parent down into child content viewer r=buster

This commit is contained in:
pollmann%netscape.com 2000-01-18 02:43:22 +00:00
parent 572e8726ef
commit 89ea13c2bd
2 changed files with 48 additions and 2 deletions

View File

@ -808,16 +808,39 @@ nsWebShell::Embed(nsIContentViewer* aContentViewer,
("nsWebShell::Embed: this=%p aDocViewer=%p aCommand=%s aExtraInfo=%p",
this, aContentViewer, aCommand ? aCommand : "", aExtraInfo));
//
// The following logic is mirrored in nsHTMLDocument::StartDocumentLoad!
//
nsCOMPtr<nsIMarkupDocumentViewer> oldMUDV;
if (mContentViewer) // && (eCharsetReloadInit!=mCharsetReloadState))
{ // get any interesting state from the old content viewer
// XXX: it would be far better to just reuse the document viewer ,
// since we know we're just displaying the same document as before
oldMUDV = do_QueryInterface(mContentViewer);
}
else
{ // If we don't have an old content viewer, get state from our parent
// in this block of code, if we get an error result, we return it
// but if we get a null pointer, that's perfectly legal for parent and parentContentViewer
nsCOMPtr<nsIWebShell> parent;
rv = GetParent(*getter_AddRefs(parent));
if (NS_FAILED(rv)) { return rv; }
if (parent) {
nsCOMPtr<nsIContentViewer> parentContentViewer;
rv = parent->GetContentViewer(getter_AddRefs(parentContentViewer));
if (NS_FAILED(rv)) { return rv; }
if (parentContentViewer) {
oldMUDV = do_QueryInterface(parentContentViewer);
}
}
}
if (oldMUDV) {
PRUnichar *defaultCharset=nsnull;
PRUnichar *forceCharset=nsnull;
PRUnichar *hintCharset=nsnull;
PRInt32 hintCharsetSource;
nsCOMPtr<nsIMarkupDocumentViewer> oldMUDV = do_QueryInterface(mContentViewer);
nsCOMPtr<nsIMarkupDocumentViewer> newMUDV = do_QueryInterface(aContentViewer);
if (oldMUDV && newMUDV)
{

View File

@ -808,16 +808,39 @@ nsWebShell::Embed(nsIContentViewer* aContentViewer,
("nsWebShell::Embed: this=%p aDocViewer=%p aCommand=%s aExtraInfo=%p",
this, aContentViewer, aCommand ? aCommand : "", aExtraInfo));
//
// The following logic is mirrored in nsHTMLDocument::StartDocumentLoad!
//
nsCOMPtr<nsIMarkupDocumentViewer> oldMUDV;
if (mContentViewer) // && (eCharsetReloadInit!=mCharsetReloadState))
{ // get any interesting state from the old content viewer
// XXX: it would be far better to just reuse the document viewer ,
// since we know we're just displaying the same document as before
oldMUDV = do_QueryInterface(mContentViewer);
}
else
{ // If we don't have an old content viewer, get state from our parent
// in this block of code, if we get an error result, we return it
// but if we get a null pointer, that's perfectly legal for parent and parentContentViewer
nsCOMPtr<nsIWebShell> parent;
rv = GetParent(*getter_AddRefs(parent));
if (NS_FAILED(rv)) { return rv; }
if (parent) {
nsCOMPtr<nsIContentViewer> parentContentViewer;
rv = parent->GetContentViewer(getter_AddRefs(parentContentViewer));
if (NS_FAILED(rv)) { return rv; }
if (parentContentViewer) {
oldMUDV = do_QueryInterface(parentContentViewer);
}
}
}
if (oldMUDV) {
PRUnichar *defaultCharset=nsnull;
PRUnichar *forceCharset=nsnull;
PRUnichar *hintCharset=nsnull;
PRInt32 hintCharsetSource;
nsCOMPtr<nsIMarkupDocumentViewer> oldMUDV = do_QueryInterface(mContentViewer);
nsCOMPtr<nsIMarkupDocumentViewer> newMUDV = do_QueryInterface(aContentViewer);
if (oldMUDV && newMUDV)
{