Fixing bug 124412. Making nsXULDocument inherit nsXMLDocument to avoid the need to duplicate a large amount of code in nsXULDocument. Also removing nsMarkupDocument and nsIDOMEventCapturer that are no longer needed. Changing the inheritance of nsIDOMXULDocument to avoid ~60 or so forwarding methods, and doing a *lot* of code cleanup. r=bugmail@sicking.cc, sr=peterv@netscape.com

git-svn-id: svn://10.0.0.236/trunk@140344 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%netscape.com
2003-03-26 07:41:30 +00:00
parent 273eed5e17
commit 08e9d026e0
66 changed files with 2508 additions and 5398 deletions

View File

@@ -68,7 +68,6 @@ CPPSRCS = \
nsMediaDocument.cpp \
nsPluginDocument.cpp \
nsImageDocument.cpp \
nsMarkupDocument.cpp \
nsWyciwygChannel.cpp \
nsWyciwygProtocolHandler.cpp \
$(NULL)

File diff suppressed because it is too large Load Diff

View File

@@ -39,12 +39,14 @@
#define nsHTMLDocument_h___
#include "nsDocument.h"
#include "nsMarkupDocument.h"
#include "nsIHTMLDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMNSHTMLDocument.h"
#include "nsIDOMHTMLBodyElement.h"
#include "nsIDOMHTMLMapElement.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIHTMLContentContainer.h"
#include "nsIParser.h"
#include "jsapi.h"
#include "rdf.h"
#include "nsRDFCID.h"
@@ -61,8 +63,6 @@
#include "nsICommandManager.h"
class nsBaseContentList;
class nsContentList;
class nsIParser;
class nsICSSLoader;
class nsIURI;
@@ -70,7 +70,7 @@ class nsIMarkupDocumentViewer;
class nsIDocumentCharsetInfo;
class nsICacheEntryDescriptor;
class nsHTMLDocument : public nsMarkupDocument,
class nsHTMLDocument : public nsDocument,
public nsIHTMLDocument,
public nsIDOMHTMLDocument,
public nsIDOMNSHTMLDocument,
@@ -86,6 +86,7 @@ public:
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
NS_IMETHOD ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup);
NS_IMETHOD CreateShell(nsIPresContext* aContext,
@@ -116,7 +117,6 @@ public:
NS_IMETHOD GetInlineStyleSheet(nsIHTMLCSSStyleSheet** aStyleSheet);
NS_IMETHOD GetCSSLoader(nsICSSLoader*& aLoader);
NS_IMETHOD GetBaseURL(nsIURI*& aURL) const;
NS_IMETHOD GetBaseTarget(nsAString& aTarget);
NS_IMETHOD SetBaseTarget(const nsAString& aTarget);
@@ -143,7 +143,7 @@ public:
NS_IMETHOD AttributeChanged(nsIContent* aChild,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType,
PRInt32 aModType,
nsChangeHint aHint);
NS_IMETHOD AttributeWillChange(nsIContent* aChild,
PRInt32 aNameSpaceID,
@@ -180,7 +180,7 @@ public:
NS_IMETHOD Write(const nsAString & text);
NS_IMETHOD Writeln(const nsAString & text);
NS_IMETHOD GetElementsByName(const nsAString & elementName,
nsIDOMNodeList **_retval);
nsIDOMNodeList **_retval);
// nsIDOMNSHTMLDocument interface
NS_DECL_NSIDOMNSHTMLDOCUMENT
@@ -236,9 +236,9 @@ protected:
static void DocumentWriteTerminationFunc(nsISupports *aRef);
PRBool GetBodyContent();
NS_IMETHOD GetBodyElement(nsIDOMHTMLBodyElement** aBody);
void GetBodyElement(nsIDOMHTMLBodyElement** aBody);
NS_IMETHOD GetDomainURI(nsIURI **uri);
void GetDomainURI(nsIURI **uri);
nsresult WriteCommon(const nsAString& aText,
PRBool aNewlineTerminate);
@@ -254,73 +254,75 @@ protected:
nsCOMPtr<nsIHTMLStyleSheet> mAttrStyleSheet;
nsCOMPtr<nsIHTMLCSSStyleSheet> mStyleAttrStyleSheet;
nsIURI* mBaseURL;
nsString* mBaseTarget;
nsString* mLastModified;
nsString* mReferrer;
nsCOMPtr<nsIHttpChannel> mHttpChannel;
nsCompatibility mCompatMode;
nsCOMPtr<nsISupportsArray> mImageMaps;
nsContentList *mImages;
nsContentList *mApplets;
nsContentList *mEmbeds;
nsContentList *mLinks;
nsContentList *mAnchors;
nsContentList *mForms;
nsContentList *mLayers;
nsIParser *mParser;
nsString mBaseTarget;
nsString mLastModified;
nsString mReferrer;
nsCOMPtr<nsIHttpChannel> mHttpChannel;
nsCompatibility mCompatMode;
nsCOMArray<nsIDOMHTMLMapElement> mImageMaps;
nsCOMPtr<nsIDOMHTMLCollection> mImages;
nsCOMPtr<nsIDOMHTMLCollection> mApplets;
nsCOMPtr<nsIDOMHTMLCollection> mEmbeds;
nsCOMPtr<nsIDOMHTMLCollection> mLinks;
nsCOMPtr<nsIDOMHTMLCollection> mAnchors;
nsCOMPtr<nsIDOMHTMLCollection> mForms;
nsCOMPtr<nsIParser> mParser;
/** # of forms in the document, synchronously set */
PRInt32 mNumForms;
//ahmed 12-2
// ahmed 12-2
PRInt32 mTexttype;
static nsrefcnt gRefCntRDFService;
static nsIRDFService* gRDF;
static PRBool TryHintCharset(nsIMarkupDocumentViewer* aMarkupDV,
PRInt32& aCharsetSource,
PRInt32& aCharsetSource,
nsAString& aCharset);
static PRBool TryUserForcedCharset(nsIMarkupDocumentViewer* aMarkupDV,
nsIDocumentCharsetInfo* aDocInfo,
PRInt32& aCharsetSource,
PRInt32& aCharsetSource,
nsAString& aCharset);
static PRBool TryCacheCharset(nsICacheEntryDescriptor* aCacheDescriptor,
PRInt32& aCharsetSource,
static PRBool TryCacheCharset(nsICacheEntryDescriptor* aCacheDescriptor,
PRInt32& aCharsetSource,
nsAString& aCharset);
static PRBool TryBookmarkCharset(nsAFlatCString* aUrlSpec,
PRInt32& aCharsetSource,
PRInt32& aCharsetSource,
nsAString& aCharset);
static PRBool TryParentCharset(nsIDocumentCharsetInfo* aDocInfo,
PRInt32& charsetSource,
nsAString& aCharset);
static PRBool UseWeakDocTypeDefault(PRInt32& aCharsetSource,
PRInt32& charsetSource, nsAString& aCharset);
static PRBool UseWeakDocTypeDefault(PRInt32& aCharsetSource,
nsAString& aCharset);
static PRBool TryChannelCharset(nsIChannel *aChannel,
PRInt32& aCharsetSource,
static PRBool TryChannelCharset(nsIChannel *aChannel,
PRInt32& aCharsetSource,
nsAString& aCharset);
static PRBool TryDefaultCharset(nsIMarkupDocumentViewer* aMarkupDV,
PRInt32& aCharsetSource,
nsAString& aCharset);
PRInt32& aCharsetSource,
nsAString& aCharset);
void StartAutodetection(nsIDocShell *aDocShell,
nsAString& aCharset,
void StartAutodetection(nsIDocShell *aDocShell, nsAString& aCharset,
const char* aCommand);
PRUint32 mIsWriting : 1;
PRUint32 mWriteLevel : 31;
PRUint32 mWyciwygSessionCnt;
// Load flags of the document's channel
PRUint32 mLoadFlags;
nsCOMPtr<nsIDOMNode> mBodyContent;
/*
* Bug 13871: Frameset spoofing - find out if document.domain was set
*/
PRPackedBool mDomainWasSet;
PRPackedBool mIdAndNameHashIsLive;
PLDHashTable mIdAndNameHashTable;
@@ -339,7 +341,7 @@ protected:
nsresult DoClipboardSecurityCheck(PRBool aPaste);
static jsval sCutCopyInternal_id;
static jsval sPasteInternal_id;
static jsval sPasteInternal_id;
};
#endif /* nsHTMLDocument_h___ */

View File

@@ -832,7 +832,7 @@ nsHTMLFragmentContentSink::AddTextToContent(nsIHTMLContent* aContent,const nsStr
if (NS_SUCCEEDED(result)) {
text->SetText(aText, PR_TRUE);
result=aContent->AppendChildTo(text, PR_FALSE, PR_FALSE);
result = aContent->AppendChildTo(text, PR_FALSE, PR_FALSE);
}
}
}

View File

@@ -107,8 +107,6 @@ public:
*/
NS_IMETHOD GetNumFormsSynchronous(PRInt32* aNumForms) = 0;
NS_IMETHOD GetBodyElement(nsIDOMHTMLBodyElement** aBody) = 0;
NS_IMETHOD_(PRBool) IsWriting() = 0;
};

View File

@@ -180,15 +180,16 @@ ImageListener::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
return nsMediaDocumentStreamListener::OnStopRequest(request, ctxt, status);
}
// NOTE! nsDocument::operator new() zeroes out all members, so don't
// bother initializing members to 0.
nsImageDocument::nsImageDocument()
: mVisibleWidth(0),
mVisibleHeight(0),
mImageWidth(0),
mImageHeight(0),
mImageResizingEnabled(PR_FALSE),
mImageIsOverflowing(PR_FALSE),
mImageIsResized(PR_FALSE)
{
// NOTE! nsDocument::operator new() zeroes out all members, so don't
// bother initializing members to 0.
}
nsImageDocument::~nsImageDocument()
@@ -198,8 +199,8 @@ nsImageDocument::~nsImageDocument()
}
}
NS_IMPL_ADDREF_INHERITED(nsImageDocument, nsHTMLDocument)
NS_IMPL_RELEASE_INHERITED(nsImageDocument, nsHTMLDocument)
NS_IMPL_ADDREF_INHERITED(nsImageDocument, nsMediaDocument)
NS_IMPL_RELEASE_INHERITED(nsImageDocument, nsMediaDocument)
NS_INTERFACE_MAP_BEGIN(nsImageDocument)
NS_INTERFACE_MAP_ENTRY(nsIImageDocument)
@@ -207,7 +208,7 @@ NS_INTERFACE_MAP_BEGIN(nsImageDocument)
NS_INTERFACE_MAP_ENTRY(imgIContainerObserver)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(ImageDocument)
NS_INTERFACE_MAP_END_INHERITING(nsHTMLDocument)
NS_INTERFACE_MAP_END_INHERITING(nsMediaDocument)
nsresult
@@ -243,9 +244,10 @@ nsImageDocument::StartDocumentLoad(const char* aCommand,
PRBool aReset,
nsIContentSink* aSink)
{
nsresult rv = nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
aContainer, aDocListener, aReset,
aSink);
nsresult rv =
nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
aContainer, aDocListener, aReset,
aSink);
if (NS_FAILED(rv)) {
return rv;
}
@@ -278,7 +280,8 @@ nsImageDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObjec
target = do_QueryInterface(mScriptGlobalObject);
target->RemoveEventListener(NS_LITERAL_STRING("resize"), this, PR_FALSE);
target->RemoveEventListener(NS_LITERAL_STRING("keypress"), this, PR_FALSE);
target->RemoveEventListener(NS_LITERAL_STRING("keypress"), this,
PR_FALSE);
}
}
@@ -288,7 +291,7 @@ nsImageDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObjec
if (NS_FAILED(rv)) {
return rv;
}
if (aScriptGlobalObject) {
// Create synthetic document
rv = CreateSyntheticDocument();
@@ -512,8 +515,9 @@ nsImageDocument::CreateSyntheticDocument()
if (mStringBundle) {
const PRUnichar* formatString[1] = { srcString.get() };
nsXPIDLString errorMsg;
rv = mStringBundle->FormatStringFromName(NS_LITERAL_STRING("InvalidImage").get(),
formatString, 1, getter_Copies(errorMsg));
NS_NAMED_LITERAL_STRING(str, "InvalidImage");
mStringBundle->FormatStringFromName(str.get(), formatString, 1,
getter_Copies(errorMsg));
image->SetAttr(kNameSpaceID_None, nsHTMLAtoms::alt, errorMsg, PR_FALSE);
}
@@ -539,7 +543,8 @@ nsImageDocument::CheckOverflowing()
context->GetVisibleArea(visibleArea);
nsCOMPtr<nsIContent> content = do_QueryInterface(mBodyContent);
nsRefPtr<nsStyleContext> styleContext = context->ResolveStyleContextFor(content, nsnull);
nsRefPtr<nsStyleContext> styleContext =
context->ResolveStyleContextFor(content, nsnull);
const nsStyleMargin* marginData =
(const nsStyleMargin*)styleContext->GetStyleData(eStyleStruct_Margin);
@@ -557,7 +562,8 @@ nsImageDocument::CheckOverflowing()
mVisibleWidth = NSTwipsToIntPixels(visibleArea.width, t2p);
mVisibleHeight = NSTwipsToIntPixels(visibleArea.height, t2p);
mImageIsOverflowing = mImageWidth > mVisibleWidth || mImageHeight > mVisibleHeight;
mImageIsOverflowing =
mImageWidth > mVisibleWidth || mImageHeight > mVisibleHeight;
if (mImageIsOverflowing) {
ShrinkToFit();
@@ -569,8 +575,8 @@ nsImageDocument::CheckOverflowing()
return NS_OK;
}
nsresult nsImageDocument::UpdateTitle()
nsresult
nsImageDocument::UpdateTitle()
{
if (mStringBundle) {
nsXPIDLString fileStr;
@@ -584,12 +590,13 @@ nsresult nsImageDocument::UpdateTitle()
nsresult rv;
nsCAutoString fileName;
url->GetFileName(fileName);
nsCOMPtr<nsITextToSubURI> textToSubURI = do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv);
nsCOMPtr<nsITextToSubURI> textToSubURI =
do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
{
nsCAutoString originCharset;
rv = url->GetOriginCharset(originCharset);
if (NS_SUCCEEDED(rv))
if (NS_SUCCEEDED(rv))
rv = textToSubURI->UnEscapeURIForUI(originCharset, fileName, fileStr);
}
if (NS_FAILED(rv))
@@ -607,7 +614,8 @@ nsresult nsImageDocument::UpdateTitle()
mimeType.BeginReading(start);
mimeType.EndReading(end);
nsXPIDLCString::const_iterator iter = end;
if (FindInReadable(NS_LITERAL_CSTRING("IMAGE/"), start, iter) && iter != end) {
if (FindInReadable(NS_LITERAL_CSTRING("IMAGE/"), start, iter) &&
iter != end) {
// strip out "X-" if any
if (*iter == 'X') {
++iter;
@@ -631,20 +639,46 @@ nsresult nsImageDocument::UpdateTitle()
if (!fileStr.IsEmpty()) {
// if we got a valid size (sometimes we do not) then display it
if (mImageWidth != 0 && mImageHeight != 0){
const PRUnichar *formatStrings[4] = {fileStr.get(), typeStr.get(), widthStr.get(), heightStr.get()};
mStringBundle->FormatStringFromName(NS_LITERAL_STRING("ImageTitleWithDimensionsAndFile").get(), formatStrings, 4, getter_Copies(valUni));
const PRUnichar *formatStrings[4] =
{
fileStr.get(),
typeStr.get(),
widthStr.get(),
heightStr.get()
};
NS_NAMED_LITERAL_STRING(str, "ImageTitleWithDimensionsAndFile");
mStringBundle->FormatStringFromName(str.get(), formatStrings, 4,
getter_Copies(valUni));
} else {
const PRUnichar *formatStrings[2] = {fileStr.get(), typeStr.get()};
mStringBundle->FormatStringFromName(NS_LITERAL_STRING("ImageTitleWithoutDimensions").get(), formatStrings, 2, getter_Copies(valUni));
const PRUnichar *formatStrings[2] =
{
fileStr.get(),
typeStr.get()
};
NS_NAMED_LITERAL_STRING(str, "ImageTitleWithoutDimensions");
mStringBundle->FormatStringFromName(str.get(), formatStrings, 2,
getter_Copies(valUni));
}
} else {
// if we got a valid size (sometimes we do not) then display it
if (mImageWidth != 0 && mImageHeight != 0){
const PRUnichar *formatStrings[3] = {typeStr.get(), widthStr.get(), heightStr.get()};
mStringBundle->FormatStringFromName(NS_LITERAL_STRING("ImageTitleWithDimensions").get(), formatStrings, 3, getter_Copies(valUni));
const PRUnichar *formatStrings[3] =
{
typeStr.get(),
widthStr.get(),
heightStr.get()
};
NS_NAMED_LITERAL_STRING(str, "ImageTitleWithDimensions");
mStringBundle->FormatStringFromName(str.get(), formatStrings, 3,
getter_Copies(valUni));
} else {
const PRUnichar *formatStrings[1] = {typeStr.get()};
mStringBundle->FormatStringFromName(NS_LITERAL_STRING("ImageTitleWithNeitherDimensionsNorFile").get(), formatStrings, 1, getter_Copies(valUni));
const PRUnichar *formatStrings[1] =
{
typeStr.get()
};
NS_NAMED_LITERAL_STRING(str, "ImageTitleWithNeitherDimensionsNorFile");
mStringBundle->FormatStringFromName(str.get(), formatStrings, 1,
getter_Copies(valUni));
}
}

View File

@@ -1,99 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsMarkupDocument.h"
#include "nsLayoutCID.h"
#include "nsIPresShell.h"
#include "nsIPresContext.h"
static NS_DEFINE_CID(kPresShellCID, NS_PRESSHELL_CID);
nsMarkupDocument::nsMarkupDocument() : nsDocument()
{
}
nsMarkupDocument::~nsMarkupDocument()
{
}
// XXX Temp hack: moved from nsDocument to fix circular linkage problem...
NS_IMETHODIMP
nsMarkupDocument::CreateShell(nsIPresContext* aContext,
nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsIPresShell** aInstancePtrResult)
{
// Don't add anything here. Add it to |doCreateShell| instead. This
// exists so nsHTMLDocument can pass other values for the 4th parameter
// some of the time.
return doCreateShell(aContext, aViewManager, aStyleSet,
eCompatibility_FullStandards, aInstancePtrResult);
}
nsresult
nsMarkupDocument::doCreateShell(nsIPresContext* aContext,
nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsCompatibility aCompatMode,
nsIPresShell** aInstancePtrResult)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
nsresult rv;
nsCOMPtr<nsIPresShell> shell(do_CreateInstance(kPresShellCID,&rv));
if (NS_FAILED(rv)) {
return rv;
}
rv = shell->Init(this, aContext, aViewManager, aStyleSet, aCompatMode);
if (NS_FAILED(rv)) {
return rv;
}
// Note: we don't hold a ref to the shell (it holds a ref to us)
mPresShells.AppendElement(shell);
*aInstancePtrResult = shell.get();
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}

View File

@@ -1,77 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsMarkupDocument_h___
#define nsMarkupDocument_h___
#include "nsDocument.h"
#include "nsCompatibility.h"
/**
* MODULE NOTES:
* @update gpk 7/17/98
*
* This class is designed to sit between nsDocument and
* classes like nsHTMLDocument. It contains methods which
* are outside the scope of nsDocument but might be used
* by both HTML and XML documents.
*
*/
class nsMarkupDocument : public nsDocument {
public:
nsMarkupDocument();
virtual ~nsMarkupDocument();
// XXX Temp hack: moved from nsDocument
NS_IMETHOD CreateShell(nsIPresContext* aContext,
nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsIPresShell** aInstancePtrResult);
protected:
// To allow different implementations to choose the quirks mode
// differently for their |CreateShell| without overriding the whole
// thing.
nsresult doCreateShell(nsIPresContext* aContext,
nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsCompatibility aCompatMode,
nsIPresShell** aInstancePtrResult);
};
#endif /* nsMarkupDocument_h___ */

View File

@@ -62,25 +62,34 @@ public:
nsIContentSink* aSink = nsnull);
protected:
nsresult CreateSyntheticDocument(nsACString &aMimeType);
nsresult CreateSyntheticPluginDocument(nsACString &aMimeType);
nsCOMPtr<nsIHTMLContent> mPluginContent;
nsRefPtr<nsMediaDocumentStreamListener> mStreamListener;
};
// NOTE! nsDocument::operator new() zeroes out all members, so don't
// bother initializing members to 0.
nsPluginDocument::nsPluginDocument()
{
// NOTE! nsDocument::operator new() zeroes out all members, so don't
// bother initializing members to 0.
}
nsPluginDocument::~nsPluginDocument()
{
}
NS_IMPL_ADDREF_INHERITED(nsPluginDocument, nsHTMLDocument)
NS_IMPL_RELEASE_INHERITED(nsPluginDocument, nsHTMLDocument)
NS_IMPL_ADDREF_INHERITED(nsPluginDocument, nsMediaDocument)
NS_IMPL_RELEASE_INHERITED(nsPluginDocument, nsMediaDocument)
NS_INTERFACE_MAP_BEGIN(nsPluginDocument)
NS_INTERFACE_MAP_ENTRY(nsIPluginDocument)
NS_INTERFACE_MAP_END_INHERITING(nsHTMLDocument)
NS_INTERFACE_MAP_END_INHERITING(nsMediaDocument)
NS_IMETHODIMP
@@ -92,9 +101,10 @@ nsPluginDocument::StartDocumentLoad(const char* aCommand,
PRBool aReset,
nsIContentSink* aSink)
{
nsresult rv = nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
aContainer, aDocListener, aReset,
aSink);
nsresult rv =
nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
aContainer, aDocListener, aReset,
aSink);
if (NS_FAILED(rv)) {
return rv;
}
@@ -106,7 +116,7 @@ nsPluginDocument::StartDocumentLoad(const char* aCommand,
}
// Create synthetic document
rv = CreateSyntheticDocument(mimeType);
rv = CreateSyntheticPluginDocument(mimeType);
if (NS_FAILED(rv)) {
return rv;
}
@@ -120,7 +130,8 @@ nsPluginDocument::StartDocumentLoad(const char* aCommand,
return rv;
}
nsresult nsPluginDocument::CreateSyntheticDocument(nsACString &aMimeType)
nsresult
nsPluginDocument::CreateSyntheticPluginDocument(nsACString &aMimeType)
{
// do not allow message panes to host full-page plugins
// returning an error causes helper apps to take over