From 14882c9d0c45c889a6b6c672a44daf5c4568790b Mon Sep 17 00:00:00 2001 From: "jst%netscape.com" Date: Wed, 26 Mar 2003 07:41:30 +0000 Subject: [PATCH] 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 --- accessible/src/base/nsAccessible.cpp | 2 +- accessible/src/base/nsRootAccessible.cpp | 4 +- content/base/public/nsIDocument.h | 26 +- content/base/src/nsContentUtils.cpp | 11 +- content/base/src/nsDocument.cpp | 1668 ++-- content/base/src/nsDocument.h | 167 +- content/base/src/nsDocumentViewer.cpp | 2 +- content/base/src/nsPrintEngine.cpp | 7 +- content/base/src/nsXMLContentSerializer.cpp | 1 - content/events/src/nsDOMEvent.cpp | 12 +- content/events/src/nsEventListenerManager.cpp | 26 - content/events/src/nsEventStateManager.cpp | 5 +- content/html/document/src/Makefile.in | 1 - content/html/document/src/nsHTMLDocument.cpp | 1410 ++- content/html/document/src/nsHTMLDocument.h | 90 +- .../src/nsHTMLFragmentContentSink.cpp | 2 +- content/html/document/src/nsIHTMLDocument.h | 2 - content/html/document/src/nsImageDocument.cpp | 98 +- .../html/document/src/nsMarkupDocument.cpp | 0 content/html/document/src/nsMarkupDocument.h | 0 .../html/document/src/nsPluginDocument.cpp | 29 +- content/macbuild/content.xml | 8160 ----------------- content/xbl/src/nsXBLPrototypeBinding.cpp | 2 +- content/xml/document/src/nsXMLContentSink.cpp | 21 +- content/xml/document/src/nsXMLDocument.cpp | 107 +- content/xml/document/src/nsXMLDocument.h | 49 +- content/xml/document/src/nsXPointer.cpp | 418 - content/xul/content/src/Makefile.in | 4 +- content/xul/content/src/nsXULElement.cpp | 4 +- .../xul/content/src/nsXULPopupListener.cpp | 12 +- content/xul/document/public/nsIXULDocument.h | 8 +- content/xul/document/src/Makefile.in | 4 +- content/xul/document/src/nsXULContentSink.cpp | 1 + content/xul/document/src/nsXULDocument.cpp | 3329 +------ content/xul/document/src/nsXULDocument.h | 373 +- .../templates/src/nsXULTemplateBuilder.cpp | 10 +- dom/public/coreEvents/MANIFEST | 22 - dom/public/coreEvents/Makefile.in | 1 - dom/public/coreEvents/nsIDOMEventCapturer.h | 0 dom/public/idl/xul/nsIDOMXULDocument.idl | 4 +- dom/src/base/nsDOMClassInfo.cpp | 1 + extensions/cookie/nsImgManager.cpp | 1 + .../xml/dom/mozImpl/MozillaDocument.cpp | 1 + .../source/xml/dom/mozImpl/MozillaNode.cpp | 1 + .../source/xpath/nsXPath1Scheme.cpp | 1 + .../xmlextras/pointers/src/nsXPointer.cpp | 4 +- intl/lwbrk/public/nsILineBreakerFactory.h | 2 +- intl/lwbrk/public/nsIWordBreakerFactory.h | 2 +- intl/lwbrk/src/nsLWBreakerFImp.cpp | 9 +- intl/lwbrk/src/nsLWBreakerFImp.h | 4 +- layout/base/nsDocumentViewer.cpp | 2 +- layout/build/nsLayoutModule.cpp | 7 - layout/html/tests/TestAttributes.cpp | 3 +- layout/printing/nsPrintEngine.cpp | 7 +- layout/xul/base/src/nsButtonBoxFrame.cpp | 2 +- layout/xul/base/src/nsMenuFrame.cpp | 9 +- layout/xul/base/src/nsXULTooltipListener.cpp | 10 +- mailnews/base/src/nsMsgStatusFeedback.cpp | 1 - rdf/base/idl/xulstubs.idl | 2 +- widget/src/cocoa/nsMenuBarX.cpp | 8 +- widget/src/cocoa/nsMenuX.cpp | 8 +- widget/src/mac/nsMenu.cpp | 17 +- widget/src/mac/nsMenuBar.cpp | 2 +- widget/src/mac/nsMenuBarX.cpp | 16 +- xpcom/base/IIDS.h | 6 - xpfe/appshell/src/nsXULWindow.cpp | 3 +- 66 files changed, 2506 insertions(+), 13715 deletions(-) delete mode 100644 content/html/document/src/nsMarkupDocument.cpp delete mode 100644 content/html/document/src/nsMarkupDocument.h delete mode 100644 dom/public/coreEvents/nsIDOMEventCapturer.h diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index 27805473658..b91a7777ff2 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -89,7 +89,7 @@ #include "nsIDOMNodeList.h" #include "nsIDOMXULButtonElement.h" #include "nsIDOMXULCheckboxElement.h" -#include "nsIDOMXULDocument.h" +#include "nsIDOMDocument.h" #include "nsIDOMXULElement.h" #include "nsIDOMXULLabelElement.h" #include "nsIDOMXULSelectCntrlEl.h" diff --git a/accessible/src/base/nsRootAccessible.cpp b/accessible/src/base/nsRootAccessible.cpp index 34aff08cf77..e505610b9a1 100644 --- a/accessible/src/base/nsRootAccessible.cpp +++ b/accessible/src/base/nsRootAccessible.cpp @@ -926,9 +926,7 @@ NS_IMETHODIMP nsDocAccessibleMixin::GetURL(nsAString& aURL) NS_IMETHODIMP nsDocAccessibleMixin::GetTitle(nsAString& aTitle) { - // This doesn't leak - we don't own the const pointer that's returned - aTitle = *(mDocument->GetDocumentTitle()); - return NS_OK; + return mDocument->GetDocumentTitle(aTitle); } NS_IMETHODIMP nsDocAccessibleMixin::GetMimeType(nsAString& aMimeType) diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 9883a19e54e..052a866b488 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -41,7 +41,6 @@ #include "nsISupports.h" #include "nsEvent.h" #include "nsAString.h" -#include "nsString.h" #include "nsChangeHint.h" #include "nsCOMArray.h" @@ -78,7 +77,6 @@ class nsIBindingManager; class nsIObserver; class nsISupportsArray; class nsIScriptLoader; -class nsString; class nsIContentSink; class nsIScriptEventManager; @@ -118,7 +116,7 @@ public: /** * Return the title of the document. May return null. */ - virtual const nsString* GetDocumentTitle() const = 0; + NS_IMETHOD GetDocumentTitle(nsAString& aTitle) const = 0; /** * Return the URL for the document. May return null. @@ -143,7 +141,8 @@ public: NS_IMETHOD GetDocumentLoadGroup(nsILoadGroup** aGroup) const = 0; /** - * Return the base URL for relative URLs in the document. May return null (or the document URL). + * Return the base URL for relative URLs in the document. May return + * null (or the document URL). */ NS_IMETHOD GetBaseURL(nsIURI*& aURL) const = 0; NS_IMETHOD SetBaseURL(nsIURI* aURL) = 0; @@ -155,8 +154,9 @@ public: NS_IMETHOD SetBaseTarget(const nsAString &aBaseTarget)=0; /** - * Return a standard name for the document's character set. This will - * trigger a startDocumentLoad if necessary to answer the question. + * Return a standard name for the document's character set. This + * will trigger a startDocumentLoad if necessary to answer the + * question. */ NS_IMETHOD GetDocumentCharacterSet(nsAString& oCharSetID) = 0; NS_IMETHOD SetDocumentCharacterSet(const nsAString& aCharSetID) = 0; @@ -188,8 +188,8 @@ public: */ NS_IMETHOD GetContentLanguage(nsAString& aContentLanguage) const = 0; - // The state BidiEnabled should persist across multiple views (screen, print) - // of the same document. + // The state BidiEnabled should persist across multiple views + // (screen, print) of the same document. /** * Check if the document contains bidi data. @@ -214,15 +214,15 @@ public: NS_IMETHOD SetWordBreaker(nsIWordBreaker* aWordBreaker) = 0; /** - * Access HTTP header data (this may also get set from other sources, like - * HTML META tags). + * Access HTTP header data (this may also get set from other + * sources, like HTML META tags). */ NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsAString& aData) const = 0; NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsAString& aData) = 0; /** - * Create a new presentation shell that will use aContext for - * it's presentation context (presentation context's must not be + * Create a new presentation shell that will use aContext for it's + * presentation context (presentation context's must not be * shared among multiple presentation shell's). */ NS_IMETHOD CreateShell(nsIPresContext* aContext, @@ -431,8 +431,6 @@ public: PRUint32 aFlags, nsEventStatus* aEventStatus) = 0; - NS_IMETHOD_(PRBool) EventCaptureRegistration(PRInt32 aCapturerIncrement) = 0; - NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows=PR_TRUE, PRBool aUpdateViews=PR_FALSE) = 0; diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index aa420df3b4e..ff7d4da849d 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -510,6 +510,7 @@ nsContentUtils::CheckSameOrigin(nsIDOMNode *aTrustedNode, #endif nsCOMPtr domDoc; aTrustedNode->GetOwnerDocument(getter_AddRefs(domDoc)); + if (!domDoc) { // In theory this should never happen. But since theory and reality are // different for XUL elements we'll try to get the principal from the @@ -530,8 +531,7 @@ nsContentUtils::CheckSameOrigin(nsIDOMNode *aTrustedNode, return NS_ERROR_UNEXPECTED; } - } - else { + } else { trustedDoc = do_QueryInterface(domDoc); NS_ASSERTION(trustedDoc, "QI to nsIDocument failed"); } @@ -560,13 +560,16 @@ nsContentUtils::CheckSameOrigin(nsIDOMNode *aTrustedNode, */ // If they are in the same document then everything is just fine - if (trustedDoc == unTrustedDoc && trustedDoc) + if (trustedDoc == unTrustedDoc && trustedDoc) { return NS_OK; + } if (!trustedPrincipal) { trustedDoc->GetPrincipal(getter_AddRefs(trustedPrincipal)); + if (!trustedPrincipal) { - // If the trusted node doesn't have a principal we can't check security against it + // If the trusted node doesn't have a principal we can't check + // security against it return NS_ERROR_DOM_SECURITY_ERR; } diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 51049b6c8c4..7f8f687a804 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -20,9 +20,10 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * L. David Baron - * Pierre Phaneuf - * Pete Collins + * Johnny Stenback + * L. David Baron + * Pierre Phaneuf + * Pete Collins * * * Alternatively, the contents of this file may be used under the terms of @@ -40,26 +41,11 @@ * ***** END LICENSE BLOCK ***** */ #include "plstr.h" -#include "nsCOMPtr.h" #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" #include "nsDocument.h" #include "nsIArena.h" -#include "nsIURL.h" -#include "nsILoadGroup.h" -#include "nsIChannel.h" -#include "nsString.h" #include "nsUnicharUtils.h" -#include "nsIContent.h" -#include "nsIStyleSet.h" -#include "nsIStyleSheet.h" -#include "nsIPresShell.h" -#include "nsIPresContext.h" -#include "nsIDocumentObserver.h" -#include "nsIEventListenerManager.h" -#include "nsIScriptGlobalObject.h" -#include "nsIScriptEventListener.h" -#include "nsIDOMEvent.h" #include "nsIPrivateDOMEvent.h" #include "nsIEventStateManager.h" #include "nsContentList.h" @@ -68,46 +54,31 @@ #include "nsIDocShell.h" #include "nsIDocShellTreeItem.h" -#include "nsIDOMEventListener.h" #include "nsGUIEvent.h" #include "nsIDOMStyleSheet.h" #include "nsDOMAttribute.h" -#include "nsDOMCID.h" #include "nsIDOMDOMImplementation.h" #include "nsIDOMDocumentView.h" #include "nsIDOMAbstractView.h" #include "nsIDOMDocumentXBL.h" -#include "nsIDOMNavigator.h" #include "nsGenericElement.h" #include "nsIDOMEventGroup.h" -#include "nsICSSStyleSheet.h" - -#include "nsITextContent.h" -#include "nsIDocumentEncoder.h" -#include "nsIHTMLContentSink.h" -#include "nsIParser.h" -#include "nsParserCIID.h" -#include "nsIFileStreams.h" - #include "nsRange.h" #include "nsIDOMText.h" #include "nsIDOMComment.h" #include "nsDOMDocumentType.h" #include "nsTreeWalker.h" -#include "nsINameSpaceManager.h" #include "nsIServiceManager.h" -#include "nsLayoutAtoms.h" #include "nsContentCID.h" -#include "nsLayoutCID.h" -#include "nsIDOMRange.h" -#include "nsIEnumerator.h" #include "nsDOMError.h" #include "nsIScrollableView.h" -#include "nsIFrame.h" +#include "nsIPresShell.h" +#include "nsIPresContext.h" +#include "nsIStyleSet.h" #include "nsContentUtils.h" #include "nsNodeInfoManager.h" #include "nsIXBLService.h" @@ -134,29 +105,50 @@ #include "nsBidiUtils.h" -static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID); static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID); #include "nsILineBreakerFactory.h" #include "nsIWordBreakerFactory.h" #include "nsLWBrkCIID.h" -#include "nsIHTMLDocument.h" #include "nsHTMLAtoms.h" -#include "nsIHttpChannel.h" #include "nsIPrefBranch.h" #include "nsIPrefService.h" #include "nsScriptEventManager.h" #include "nsIXPathEvaluatorInternal.h" +// Helper structs for the content->subdoc map + +class SubDocMapEntry : public PLDHashEntryHdr +{ +public: + // Both of these are strong references + nsIContent *mKey; // must be first, to look like PLDHashEntryStub + nsIDocument *mSubDocument; +}; + +struct FindContentData +{ + FindContentData(nsIDocument *aSubDoc) + : mSubDocument(aSubDoc), mResult(nsnull) + { + } + + nsISupports *mSubDocument; + nsIContent *mResult; +}; + + /** * A struct that holds all the information about a radio group. */ struct nsRadioGroupStruct { - /** A strong pointer to the currently selected radio button. */ + /** + * A strong pointer to the currently selected radio button. + */ nsCOMPtr mSelectedRadioButton; nsSmallVoidArray mRadioButtons; }; @@ -173,10 +165,9 @@ nsDOMStyleSheetList::nsDOMStyleSheetList(nsIDocument *aDocument) nsDOMStyleSheetList::~nsDOMStyleSheetList() { - if (nsnull != mDocument) { + if (mDocument) { mDocument->RemoveObserver(this); } - mDocument = nsnull; } @@ -194,16 +185,16 @@ NS_IMPL_ADDREF(nsDOMStyleSheetList) NS_IMPL_RELEASE(nsDOMStyleSheetList) -NS_IMETHODIMP +NS_IMETHODIMP nsDOMStyleSheetList::GetLength(PRUint32* aLength) { if (mDocument) { - // XXX Find the number and then cache it. We'll use the + // XXX Find the number and then cache it. We'll use the // observer notification to figure out if new ones have // been added or removed. if (-1 == mLength) { mDocument->GetNumberOfStyleSheets(PR_FALSE, &mLength); - + #ifdef DEBUG PRInt32 i; for (i = 0; i < mLength; i++) { @@ -219,11 +210,11 @@ nsDOMStyleSheetList::GetLength(PRUint32* aLength) else { *aLength = 0; } - + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDOMStyleSheetList::Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn) { *aReturn = nsnull; @@ -241,7 +232,7 @@ nsDOMStyleSheetList::Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDOMStyleSheetList::StyleSheetAdded(nsIDocument *aDocument, nsIStyleSheet* aStyleSheet) { @@ -251,11 +242,11 @@ nsDOMStyleSheetList::StyleSheetAdded(nsIDocument *aDocument, mLength++; } } - + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDOMStyleSheetList::StyleSheetRemoved(nsIDocument *aDocument, nsIStyleSheet* aStyleSheet) { @@ -265,7 +256,7 @@ nsDOMStyleSheetList::StyleSheetRemoved(nsIDocument *aDocument, mLength--; } } - return NS_OK; + return NS_OK; } NS_IMETHODIMP @@ -275,14 +266,10 @@ nsDOMStyleSheetList::DocumentWillBeDestroyed(nsIDocument *aDocument) aDocument->RemoveObserver(this); mDocument = nsnull; } - + return NS_OK; } -// ================================================================== -// = -// ================================================================== - class nsDOMImplementation : public nsIDOMDOMImplementation, public nsIPrivateDOMImplementation { @@ -291,22 +278,11 @@ public: virtual ~nsDOMImplementation(); NS_DECL_ISUPPORTS - + // nsIDOMDOMImplementation - NS_IMETHOD HasFeature(const nsAString& aFeature, - const nsAString& aVersion, - PRBool* aReturn); - NS_IMETHOD CreateDocumentType(const nsAString& aQualifiedName, - const nsAString& aPublicId, - const nsAString& aSystemId, - nsIDOMDocumentType** aReturn); + NS_DECL_NSIDOMDOMIMPLEMENTATION - NS_IMETHOD CreateDocument(const nsAString& aNamespaceURI, - const nsAString& aQualifiedName, - nsIDOMDocumentType* aDoctype, - nsIDOMDocument** aReturn); - - //nsIPrivateDOMImplementation + // nsIPrivateDOMImplementation NS_IMETHOD Init(nsIURI* aBaseURI); protected: @@ -317,12 +293,14 @@ protected: nsresult NS_NewDOMImplementation(nsIDOMDOMImplementation** aInstancePtrResult) { - nsDOMImplementation* domImpl = new nsDOMImplementation(); - if (!domImpl) { + *aInstancePtrResult = new nsDOMImplementation(); + if (!*aInstancePtrResult) { return NS_ERROR_OUT_OF_MEMORY; } - return CallQueryInterface(domImpl, aInstancePtrResult); + NS_ADDREF(*aInstancePtrResult); + + return NS_OK; } nsDOMImplementation::nsDOMImplementation(nsIURI* aBaseURI) @@ -347,9 +325,9 @@ NS_IMPL_ADDREF(nsDOMImplementation); NS_IMPL_RELEASE(nsDOMImplementation); -NS_IMETHODIMP -nsDOMImplementation::HasFeature(const nsAString& aFeature, - const nsAString& aVersion, +NS_IMETHODIMP +nsDOMImplementation::HasFeature(const nsAString& aFeature, + const nsAString& aVersion, PRBool* aReturn) { return nsGenericElement::InternalIsSupported(aFeature, aVersion, aReturn); @@ -357,8 +335,8 @@ nsDOMImplementation::HasFeature(const nsAString& aFeature, NS_IMETHODIMP nsDOMImplementation::CreateDocumentType(const nsAString& aQualifiedName, - const nsAString& aPublicId, - const nsAString& aSystemId, + const nsAString& aPublicId, + const nsAString& aSystemId, nsIDOMDocumentType** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -368,15 +346,15 @@ nsDOMImplementation::CreateDocumentType(const nsAString& aQualifiedName, } NS_IMETHODIMP -nsDOMImplementation::CreateDocument(const nsAString& aNamespaceURI, - const nsAString& aQualifiedName, - nsIDOMDocumentType* aDoctype, +nsDOMImplementation::CreateDocument(const nsAString& aNamespaceURI, + const nsAString& aQualifiedName, + nsIDOMDocumentType* aDoctype, nsIDOMDocument** aReturn) -{ +{ NS_ENSURE_ARG_POINTER(aReturn); - + *aReturn = nsnull; - + if (aDoctype) { nsCOMPtr owner; aDoctype->GetOwnerDocument(getter_AddRefs(owner)); @@ -387,6 +365,7 @@ nsDOMImplementation::CreateDocument(const nsAString& aNamespaceURI, nsresult rv = NS_NewDOMDocument(aReturn, aNamespaceURI, aQualifiedName, aDoctype, mBaseURI); + nsCOMPtr docShell; nsContentUtils::GetDocShellFromCaller(getter_AddRefs(docShell)); if (docShell) { @@ -433,36 +412,34 @@ nsDocumentChildNodes::~nsDocumentChildNodes() NS_IMETHODIMP nsDocumentChildNodes::GetLength(PRUint32* aLength) { - if (nsnull != mDocument) { - PRInt32 count; + PRInt32 count = 0; + + if (mDocument) { mDocument->GetChildCount(count); - *aLength = (PRUint32)count; } - else { - *aLength = 0; - } - + + *aLength = (PRUint32)count; + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocumentChildNodes::Item(PRUint32 aIndex, nsIDOMNode** aReturn) { *aReturn = nsnull; - nsresult result = NS_OK; if (mDocument) { nsCOMPtr content; - result = mDocument->ChildAt(aIndex, *getter_AddRefs(content)); - if (NS_SUCCEEDED(result) && content) { - result = CallQueryInterface(content, aReturn); + mDocument->ChildAt(aIndex, *getter_AddRefs(content)); + if (content) { + return CallQueryInterface(content, aReturn); } } - return result; + return NS_OK; } -void +void nsDocumentChildNodes::DropReference() { mDocument = nsnull; @@ -472,8 +449,8 @@ class nsXPathDocumentTearoff : public nsIDOMXPathEvaluator { public: nsXPathDocumentTearoff(nsIDOMXPathEvaluator* aEvaluator, - nsIDocument* aDocument) : mEvaluator(aEvaluator), - mDocument(aDocument) + nsIDocument* aDocument) + : mEvaluator(aEvaluator), mDocument(aDocument) { } virtual ~nsXPathDocumentTearoff() @@ -492,6 +469,7 @@ private: NS_INTERFACE_MAP_BEGIN(nsXPathDocumentTearoff) NS_INTERFACE_MAP_ENTRY(nsIDOMXPathEvaluator) NS_INTERFACE_MAP_END_AGGREGATED(mDocument) + NS_IMPL_ADDREF_USING_AGGREGATOR(nsXPathDocumentTearoff, mDocument) NS_IMPL_RELEASE_USING_AGGREGATOR(nsXPathDocumentTearoff, mDocument) @@ -500,38 +478,31 @@ NS_IMPL_RELEASE_USING_AGGREGATOR(nsXPathDocumentTearoff, mDocument) // = // ================================================================== -nsDocument::nsDocument() : mSubDocuments(nsnull), - mIsGoingAway(PR_FALSE), - mCSSLoader(nsnull), - mXPathDocument(nsnull) + // NOTE! nsDocument::operator new() zeroes out all members, so don't + // bother initializing members to 0. + +nsDocument::nsDocument() + : mCharacterSet(NS_LITERAL_STRING("ISO-8859-1")), + mNextContentID(NS_CONTENT_ID_COUNTER_BASE) { - mArena = nsnull; - mDocumentURL = nsnull; - mCharacterSet.Assign(NS_LITERAL_STRING("ISO-8859-1")); - mParentDocument = nsnull; - mRootContent = nsnull; - mListenerManager = nsnull; - mInDestructor = PR_FALSE; - mHeaderData = nsnull; - mChildNodes = nsnull; - mNextContentID = NS_CONTENT_ID_COUNTER_BASE; - mBoxObjectTable = nsnull; - mNumCapturers = 0; - mBidiEnabled = PR_FALSE; + // NOTE! nsDocument::operator new() zeroes out all members, so don't + // bother initializing members to 0. // Force initialization. mBindingManager = do_CreateInstance("@mozilla.org/xbl/binding-manager;1"); - nsCOMPtr observer(do_QueryInterface(mBindingManager)); - if (observer) // We must always be the first observer of the document. - mObservers.InsertElementAt(observer, 0); -} + nsCOMPtr observer(do_QueryInterface(mBindingManager)); + if (observer) { + // The binding manager must always be the first observer of the + // document. + + mObservers.InsertElementAt(observer, 0); + } +} nsDocument::~nsDocument() { - delete mXPathDocument; - mInDestructor = PR_TRUE; // XXX Inform any remaining observers that we are going away. @@ -544,13 +515,12 @@ nsDocument::~nsDocument() PRInt32 indx; for (indx = mObservers.Count() - 1; indx >= 0; --indx) { // XXX Should this be a kungfudeathgrip?!!!! - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers.ElementAt(indx); + nsIDocumentObserver* observer = + NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(indx)); + observer->DocumentWillBeDestroyed(this); } - mLoadFlags = nsIRequest::LOAD_NORMAL; // XXX maybe not required - mDocumentLoadGroup = nsnull; - mParentDocument = nsnull; // Kill the subdocument map, doing this will release its strong @@ -586,38 +556,29 @@ nsDocument::~nsDocument() mStyleSheets[indx]->SetOwningDocument(nsnull); } - if (nsnull != mChildNodes) { + if (mChildNodes) { mChildNodes->DropReference(); - NS_RELEASE(mChildNodes); } - NS_IF_RELEASE(mArena); - - if (mListenerManager != nsnull) { + if (mListenerManager) { mListenerManager->SetListenerTarget(nsnull); - NS_RELEASE(mListenerManager); } if (mScriptLoader) { mScriptLoader->DropDocumentReference(); } - mDOMStyleSheets = nsnull; // Release the stylesheets list. - - if (nsnull != mHeaderData) { - delete mHeaderData; - mHeaderData = nsnull; + if (mCSSLoader) { + mCSSLoader->DropDocumentReference(); } - delete mBoxObjectTable; - if (mNodeInfoManager) { mNodeInfoManager->DropDocumentReference(); } - // Do this after notifying the nodeinfo manager that we're going away since - // it will save our url before dropping the reference. - NS_IF_RELEASE(mDocumentURL); + delete mHeaderData; + delete mBoxObjectTable; + delete mXPathDocument; } PRBool gCheckedForXPathDOM = PR_FALSE; @@ -661,7 +622,7 @@ NS_INTERFACE_MAP_BEGIN(nsDocument) if (internal) { internal->SetDocument(this); } - + mXPathDocument = new nsXPathDocumentTearoff(evaluator, this); NS_ENSURE_TRUE(mXPathDocument, NS_ERROR_OUT_OF_MEMORY); } @@ -673,15 +634,14 @@ NS_INTERFACE_MAP_END NS_IMPL_ADDREF(nsDocument) NS_IMPL_RELEASE(nsDocument) -nsresult nsDocument::Init() +nsresult +nsDocument::Init() { if (mArena) { return NS_ERROR_ALREADY_INITIALIZED; } - nsresult rv; - - rv = NS_NewHeapArena(&mArena, nsnull); + nsresult rv = NS_NewHeapArena(getter_AddRefs(mArena), nsnull); NS_ENSURE_SUCCESS(rv, rv); mNodeInfoManager = new nsNodeInfoManager(); @@ -695,37 +655,35 @@ nsresult nsDocument::Init() NS_IMETHODIMP nsDocument::GetArena(nsIArena** aArena) { - NS_IF_ADDREF(*aArena = mArena); + *aArena = mArena; + NS_IF_ADDREF(*aArena); + return NS_OK; } NS_IMETHODIMP nsDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) { - nsresult rv = NS_OK; - nsCOMPtr uri; if (aChannel) { - aChannel->GetOriginalURI(getter_AddRefs(uri)); PRBool isChrome = PR_FALSE; PRBool isRes = PR_FALSE; - (void)uri->SchemeIs("chrome", &isChrome); - (void)uri->SchemeIs("resource", &isRes); + uri->SchemeIs("chrome", &isChrome); + uri->SchemeIs("resource", &isRes); if (!isChrome && !isRes) aChannel->GetURI(getter_AddRefs(uri)); } - rv = ResetToURI(uri, aLoadGroup); + nsresult rv = ResetToURI(uri, aLoadGroup); if (aChannel) { nsCOMPtr owner; aChannel->GetOwner(getter_AddRefs(owner)); - if (owner) - mPrincipal = do_QueryInterface(owner); - aChannel->GetLoadFlags(&mLoadFlags); + + mPrincipal = do_QueryInterface(owner); } return rv; @@ -736,9 +694,7 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup) { mDocumentTitle.Truncate(); - NS_IF_RELEASE(mDocumentURL); mPrincipal = nsnull; - mLoadFlags = nsIRequest::LOAD_NORMAL; mDocumentLoadGroup = nsnull; // Delete references to sub-documents and kill the subdocument map, @@ -771,18 +727,20 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup) if (applicable) { RemoveStyleSheetFromStyleSets(sheet); } - + // XXX Tell observers? } + // Release all the sheets mStyleSheets.Clear(); - NS_IF_RELEASE(mListenerManager); + // Release the listener manager + mListenerManager = nsnull; - mDOMStyleSheets = nsnull; // Release the stylesheets list. + // Release the stylesheets list. + mDOMStyleSheets = nsnull; mDocumentURL = aURI; - NS_IF_ADDREF(mDocumentURL); mDocumentBaseURL = mDocumentURL; if (aLoadGroup) { @@ -795,28 +753,25 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::SetDocumentURL(nsIURI* aURI) { - NS_IF_RELEASE(mDocumentURL); mDocumentURL = aURI; - NS_IF_ADDREF(mDocumentURL); return NS_OK; } NS_IMETHODIMP -nsDocument::StartDocumentLoad(const char* aCommand, - nsIChannel* aChannel, +nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup, nsISupports* aContainer, nsIStreamListener **aDocListener, - PRBool aReset, - nsIContentSink* aSink) + PRBool aReset, nsIContentSink* aSink) { nsresult rv = NS_OK; - if (aReset) + if (aReset) { rv = Reset(aChannel, aLoadGroup); + } nsCAutoString contentType; if (NS_SUCCEEDED(aChannel->GetContentType(contentType))) { @@ -828,24 +783,35 @@ nsDocument::StartDocumentLoad(const char* aCommand, FindCharInReadable(';', semicolon, end); CopyASCIItoUCS2(Substring(start, semicolon), mContentType); } - + PRBool have_contentLanguage = PR_FALSE; nsCOMPtr httpChannel = do_QueryInterface(aChannel); if (httpChannel) { nsCAutoString contentLanguage; - if (NS_SUCCEEDED(httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Language"), - contentLanguage))) { - CopyASCIItoUCS2(contentLanguage, mContentLanguage); // XXX what's wrong w/ ASCII? + rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Language"), + contentLanguage); + + if (NS_SUCCEEDED(rv)) { + // XXX what's wrong w/ ASCII? + CopyASCIItoUCS2(contentLanguage, mContentLanguage); + have_contentLanguage = PR_TRUE; } } + if (!have_contentLanguage) { - nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + nsCOMPtr prefBranch = + do_GetService(NS_PREFSERVICE_CONTRACTID); + if (prefBranch) { nsXPIDLCString prefLanguage; - if (NS_SUCCEEDED(prefBranch->GetCharPref("intl.accept_languages", - getter_Copies(prefLanguage)))) { + + rv = prefBranch->GetCharPref("intl.accept_languages", + getter_Copies(prefLanguage)); + + if (NS_SUCCEEDED(rv)) { mContentLanguage.AssignWithConversion(prefLanguage); + have_contentLanguage = PR_TRUE; } } @@ -854,44 +820,52 @@ nsDocument::StartDocumentLoad(const char* aCommand, return rv; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::StopDocumentLoad() { return NS_OK; } -const nsString* nsDocument::GetDocumentTitle() const +NS_IMETHODIMP +nsDocument::GetDocumentTitle(nsAString& aTitle) const { - return &mDocumentTitle; + aTitle = mDocumentTitle; + + return NS_OK; } NS_IMETHODIMP nsDocument::GetDocumentURL(nsIURI** aURI) const { - NS_IF_ADDREF(*aURI = mDocumentURL); + *aURI = mDocumentURL; + NS_IF_ADDREF(*aURI); + return NS_OK; } NS_IMETHODIMP nsDocument::GetPrincipal(nsIPrincipal **aPrincipal) { + *aPrincipal = nsnull; + if (!mPrincipal) { nsresult rv; - nsCOMPtr securityManager = + nsCOMPtr securityManager = do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); - if (NS_FAILED(rv)) + if (NS_FAILED(rv)) return rv; NS_WARN_IF_FALSE(mDocumentURL, "no URL!"); - if (NS_FAILED(rv = securityManager->GetCodebasePrincipal(mDocumentURL, - getter_AddRefs(mPrincipal)))) - return rv; + rv = securityManager->GetCodebasePrincipal(mDocumentURL, + getter_AddRefs(mPrincipal)); + + if (NS_FAILED(rv)) { + return rv; + } } - if(aPrincipal) - { - *aPrincipal = mPrincipal; - NS_ADDREF(*aPrincipal); - } + *aPrincipal = mPrincipal; + NS_ADDREF(*aPrincipal); + return NS_OK; } @@ -912,19 +886,21 @@ nsDocument::AddPrincipal(nsIPrincipal *aNewPrincipal) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetContentType(nsAString& aContentType) { aContentType = mContentType; + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::SetContentType(const nsAString& aContentType) { NS_ASSERTION(mContentType.IsEmpty() || mContentType.Equals(aContentType), "Do you really want to change the content-type?"); mContentType = aContentType; + return NS_OK; } @@ -932,6 +908,7 @@ NS_IMETHODIMP nsDocument::GetContentLanguage(nsAString& aContentLanguage) const { aContentLanguage = mContentLanguage; + return NS_OK; } @@ -942,14 +919,21 @@ nsDocument::GetDocumentLoadGroup(nsILoadGroup **aGroup) const *aGroup = group; NS_IF_ADDREF(*aGroup); + return NS_OK; } NS_IMETHODIMP nsDocument::GetBaseURL(nsIURI*& aURL) const { - aURL = mDocumentBaseURL.get(); + aURL = mDocumentBaseURL; + + if (!aURL) { + aURL = mDocumentURL; + } + NS_IF_ADDREF(aURL); + return NS_OK; } @@ -957,18 +941,19 @@ NS_IMETHODIMP nsDocument::SetBaseURL(nsIURI* aURL) { nsresult rv = NS_OK; + if (aURL) { - nsCOMPtr securityManager = + nsCOMPtr securityManager = do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); if (NS_SUCCEEDED(rv)) { - rv = securityManager->CheckLoadURI(mDocumentURL, aURL, nsIScriptSecurityManager::STANDARD); + rv = securityManager->CheckLoadURI(mDocumentURL, aURL, + nsIScriptSecurityManager::STANDARD); if (NS_SUCCEEDED(rv)) { mDocumentBaseURL = aURL; } } - } - else { - mDocumentBaseURL = aURL; + } else { + mDocumentBaseURL = nsnull; } return rv; @@ -978,6 +963,7 @@ NS_IMETHODIMP nsDocument::GetBaseTarget(nsAString &aBaseTarget) { aBaseTarget.Truncate(); + return NS_OK; } @@ -987,93 +973,123 @@ nsDocument::SetBaseTarget(const nsAString &aBaseTarget) return NS_OK; } -NS_IMETHODIMP nsDocument::GetDocumentCharacterSet(nsAString& oCharSetID) +NS_IMETHODIMP +nsDocument::GetDocumentCharacterSet(nsAString& aCharSetID) { - oCharSetID = mCharacterSet; + aCharSetID = mCharacterSet; + return NS_OK; } -NS_IMETHODIMP nsDocument::SetDocumentCharacterSet(const nsAString& aCharSetID) +NS_IMETHODIMP +nsDocument::SetDocumentCharacterSet(const nsAString& aCharSetID) { if (!mCharacterSet.Equals(aCharSetID)) { mCharacterSet = aCharSetID; + PRInt32 n = mCharSetObservers.Count(); + for (PRInt32 i = 0; i < n; i++) { - nsIObserver* observer = (nsIObserver*) mCharSetObservers.ElementAt(i); - observer->Observe((nsIDocument*) this, "charset", PromiseFlatString(aCharSetID).get()); + nsIObserver* observer = + NS_STATIC_CAST(nsIObserver *, mCharSetObservers.ElementAt(i)); + + observer->Observe(NS_STATIC_CAST(nsIDocument *, this), "charset", + PromiseFlatString(aCharSetID).get()); } } + return NS_OK; } -NS_IMETHODIMP nsDocument::GetDocumentCharacterSetSource(PRInt32* aCharsetSource) +NS_IMETHODIMP +nsDocument::GetDocumentCharacterSetSource(PRInt32* aCharsetSource) { *aCharsetSource = mCharacterSetSource; + return NS_OK; } -NS_IMETHODIMP nsDocument::SetDocumentCharacterSetSource(PRInt32 aCharsetSource) + +NS_IMETHODIMP +nsDocument::SetDocumentCharacterSetSource(PRInt32 aCharsetSource) { mCharacterSetSource = aCharsetSource; + return NS_OK; } -NS_IMETHODIMP nsDocument::AddCharSetObserver(nsIObserver* aObserver) +NS_IMETHODIMP +nsDocument::AddCharSetObserver(nsIObserver* aObserver) { NS_ENSURE_ARG_POINTER(aObserver); + NS_ENSURE_TRUE(mCharSetObservers.AppendElement(aObserver), NS_ERROR_FAILURE); + return NS_OK; } -NS_IMETHODIMP nsDocument::RemoveCharSetObserver(nsIObserver* aObserver) +NS_IMETHODIMP +nsDocument::RemoveCharSetObserver(nsIObserver* aObserver) { NS_ENSURE_ARG_POINTER(aObserver); + NS_ENSURE_TRUE(mCharSetObservers.RemoveElement(aObserver), NS_ERROR_FAILURE); + return NS_OK; } -NS_IMETHODIMP nsDocument::GetLineBreaker(nsILineBreaker** aResult) +NS_IMETHODIMP +nsDocument::GetLineBreaker(nsILineBreaker** aResult) { if (!mLineBreaker) { // no line breaker, find a default one - nsresult result; - nsCOMPtr lbf(do_GetService(NS_LWBRK_CONTRACTID, &result)); + nsresult rv; + nsCOMPtr lbf = + do_GetService(NS_LWBRK_CONTRACTID, &rv); + NS_ENSURE_SUCCESS(rv, rv); - if (NS_SUCCEEDED(result)) { - nsAutoString lbarg; - lbf->GetBreaker(lbarg, getter_AddRefs(mLineBreaker)); - } + lbf->GetBreaker(nsString(), getter_AddRefs(mLineBreaker)); + NS_ENSURE_TRUE(mLineBreaker, NS_ERROR_UNEXPECTED); } - *aResult = mLineBreaker; - NS_IF_ADDREF(*aResult); - return NS_OK; // XXX we should do error handling here -} -NS_IMETHODIMP nsDocument::SetLineBreaker(nsILineBreaker* aLineBreaker) -{ - mLineBreaker = aLineBreaker; + *aResult = mLineBreaker; + NS_ADDREF(*aResult); + return NS_OK; } -NS_IMETHODIMP nsDocument::GetWordBreaker(nsIWordBreaker** aResult) +NS_IMETHODIMP +nsDocument::SetLineBreaker(nsILineBreaker* aLineBreaker) +{ + mLineBreaker = aLineBreaker; + + return NS_OK; +} + +NS_IMETHODIMP +nsDocument::GetWordBreaker(nsIWordBreaker** aResult) { if (!mWordBreaker) { // no word breaker, find a default one - nsresult result; - nsCOMPtr wbf(do_GetService(NS_LWBRK_CONTRACTID, &result)); + nsresult rv; + nsCOMPtr wbf = + do_GetService(NS_LWBRK_CONTRACTID, &rv); + NS_ENSURE_SUCCESS(rv, rv); - if (NS_SUCCEEDED(result)) { - nsAutoString wbarg; - wbf->GetBreaker(wbarg, getter_AddRefs(mWordBreaker)); - } + wbf->GetBreaker(nsString(), getter_AddRefs(mWordBreaker)); + NS_ENSURE_TRUE(wbf, NS_ERROR_UNEXPECTED); } + *aResult = mWordBreaker; - NS_IF_ADDREF(*aResult); - return NS_OK; // XXX we should do error handling here + NS_ADDREF(*aResult); + + return NS_OK; } -NS_IMETHODIMP nsDocument::SetWordBreaker(nsIWordBreaker* aWordBreaker) +NS_IMETHODIMP +nsDocument::SetWordBreaker(nsIWordBreaker* aWordBreaker) { mWordBreaker = aWordBreaker; + return NS_OK; } @@ -1082,123 +1098,127 @@ nsDocument::GetHeaderData(nsIAtom* aHeaderField, nsAString& aData) const { aData.Truncate(); const nsDocHeaderData* data = mHeaderData; - while (nsnull != data) { + while (data) { if (data->mField == aHeaderField) { aData = data->mData; + break; } data = data->mNext; } + return NS_OK; } NS_IMETHODIMP nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsAString& aData) { - if (nsnull != aHeaderField) { - if (nsnull == mHeaderData) { - if (!aData.IsEmpty()) { // don't bother storing empty string - mHeaderData = new nsDocHeaderData(aHeaderField, aData); - } - } - else { - nsDocHeaderData* data = mHeaderData; - nsDocHeaderData** lastPtr = &mHeaderData; - PRBool found = PR_FALSE; - do { // look for existing and replace - if (data->mField == aHeaderField) { - if (!aData.IsEmpty()) { - data->mData.Assign(aData); - } - else { // don't store empty string - *lastPtr = data->mNext; - data->mNext = nsnull; - delete data; - } - found = PR_TRUE; - break; - } - lastPtr = &(data->mNext); - data = *lastPtr; - } while (data); + NS_ENSURE_ARG_POINTER(aHeaderField); - if (!aData.IsEmpty() && !found) { - // didn't find, append - *lastPtr = new nsDocHeaderData(aHeaderField, aData); - } + if (!mHeaderData) { + if (!aData.IsEmpty()) { // don't bother storing empty string + mHeaderData = new nsDocHeaderData(aHeaderField, aData); } - if (aHeaderField == nsHTMLAtoms::headerDefaultStyle) { - // switch alternate style sheets based on default - nsAutoString type; - nsAutoString title; - PRInt32 index; - - mCSSLoader->SetPreferredSheet(aData); - - PRInt32 count = mStyleSheets.Count(); - for (index = 0; index < count; index++) { - nsIStyleSheet* sheet = mStyleSheets[index]; - sheet->GetType(type); - if (!type.Equals(NS_LITERAL_STRING("text/html"))) { - sheet->GetTitle(title); - if (!title.IsEmpty()) { // if sheet has title - PRBool enabled = (!aData.IsEmpty() && - title.Equals(aData, - nsCaseInsensitiveStringComparator())); - sheet->SetEnabled(enabled); - } - } - } - } - return NS_OK; } - return NS_ERROR_NULL_POINTER; + else { + nsDocHeaderData* data = mHeaderData; + nsDocHeaderData** lastPtr = &mHeaderData; + PRBool found = PR_FALSE; + do { // look for existing and replace + if (data->mField == aHeaderField) { + if (!aData.IsEmpty()) { + data->mData.Assign(aData); + } + else { // don't store empty string + *lastPtr = data->mNext; + data->mNext = nsnull; + delete data; + } + found = PR_TRUE; + + break; + } + lastPtr = &(data->mNext); + data = *lastPtr; + } while (data); + + if (!aData.IsEmpty() && !found) { + // didn't find, append + *lastPtr = new nsDocHeaderData(aHeaderField, aData); + } + } + + if (aHeaderField == nsHTMLAtoms::headerDefaultStyle) { + // switch alternate style sheets based on default + nsAutoString type; + nsAutoString title; + PRInt32 index; + + mCSSLoader->SetPreferredSheet(aData); + + PRInt32 count = mStyleSheets.Count(); + for (index = 0; index < count; index++) { + nsIStyleSheet* sheet = mStyleSheets[index]; + sheet->GetType(type); + if (!type.Equals(NS_LITERAL_STRING("text/html"))) { + sheet->GetTitle(title); + if (!title.IsEmpty()) { // if sheet has title + PRBool enabled = + (!aData.IsEmpty() && + title.Equals(aData, nsCaseInsensitiveStringComparator())); + + sheet->SetEnabled(enabled); + } + } + } + } + + return NS_OK; } -#if 0 -// XXX Temp hack: moved to nsMarkupDocument NS_IMETHODIMP -nsDocument::CreateShell(nsIPresContext* aContext, - nsIViewManager* aViewManager, +nsDocument::CreateShell(nsIPresContext* aContext, nsIViewManager* aViewManager, nsIStyleSet* aStyleSet, nsIPresShell** aInstancePtrResult) { - NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); - if (nsnull == aInstancePtrResult) { - return NS_ERROR_NULL_POINTER; - } + // Don't add anything here. Add it to |doCreateShell| instead. + // This exists so that subclasses can pass other values for the 4th + // parameter some of the time. + return doCreateShell(aContext, aViewManager, aStyleSet, + eCompatibility_FullStandards, aInstancePtrResult); +} - nsresult rv; - nsCOMPtr shell(do_CreateInstance(kPresShellCID,&rv)); +nsresult +nsDocument::doCreateShell(nsIPresContext* aContext, + nsIViewManager* aViewManager, nsIStyleSet* aStyleSet, + nsCompatibility aCompatMode, + nsIPresShell** aInstancePtrResult) +{ + nsCOMPtr shell; + nsresult rv = NS_NewPresShell(getter_AddRefs(shell)); if (NS_FAILED(rv)) { return rv; } - rv = shell->Init(this, aContext, aViewManager, aStyleSet); - if (NS_FAILED(rv)) { - return rv; - } + rv = shell->Init(this, aContext, aViewManager, aStyleSet, aCompatMode); + NS_ENSURE_SUCCESS(rv, 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); - // tell the context the mode we want (always standard, which - // should be correct for everything except HTML) - // nsHTMLDocument overrides this method and sets it differently - aContext->SetCompatibilityMode(eCompatibility_Standard); - return NS_OK; } -#endif -PRBool nsDocument::DeleteShell(nsIPresShell* aShell) +PRBool +nsDocument::DeleteShell(nsIPresShell* aShell) { return mPresShells.RemoveElement(aShell); } -PRInt32 nsDocument::GetNumberOfShells() +PRInt32 +nsDocument::GetNumberOfShells() { return mPresShells.Count(); } @@ -1215,18 +1235,19 @@ nsDocument::GetShellAt(PRInt32 aIndex, nsIPresShell** aShell) NS_IMETHODIMP nsDocument::GetParentDocument(nsIDocument** aParent) { - NS_IF_ADDREF(*aParent = mParentDocument); + *aParent = mParentDocument; + NS_IF_ADDREF(*aParent); + return NS_OK; } -/** - * Note that we do *not* AddRef our parent because that would - * create a circular reference. - */ NS_IMETHODIMP nsDocument::SetParentDocument(nsIDocument* aParent) { + // Note that we do *not* AddRef our parent because that would create + // a circular reference. mParentDocument = aParent; + return NS_OK; } @@ -1382,7 +1403,10 @@ nsDocument::FindContentForSubDocument(nsIDocument *aDocument, NS_IMETHODIMP nsDocument::GetRootContent(nsIContent** aRoot) { - NS_IF_ADDREF(*aRoot = mRootContent); + *aRoot = mRootContent; + + NS_IF_ADDREF(*aRoot); + return NS_OK; } @@ -1404,7 +1428,7 @@ nsDocument::SetRootContent(nsIContent* aRoot) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::ChildAt(PRInt32 aIndex, nsIContent*& aResult) const { NS_PRECONDITION(aIndex >= 0, "Negative indices are bad"); @@ -1416,14 +1440,14 @@ nsDocument::ChildAt(PRInt32 aIndex, nsIContent*& aResult) const return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::IndexOf(nsIContent* aPossibleChild, PRInt32& aIndex) const { aIndex = mChildren.IndexOf(aPossibleChild); return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetChildCount(PRInt32& aCount) { aCount = mChildren.Count(); @@ -1433,10 +1457,10 @@ nsDocument::GetChildCount(PRInt32& aCount) PRInt32 nsDocument::InternalGetNumberOfStyleSheets() { - return mStyleSheets.Count(); + return mStyleSheets.Count(); } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetNumberOfStyleSheets(PRBool aIncludeSpecialSheets, PRInt32* aCount) { @@ -1451,17 +1475,18 @@ nsDocument::GetNumberOfStyleSheets(PRBool aIncludeSpecialSheets, already_AddRefed nsDocument::InternalGetStyleSheetAt(PRInt32 aIndex) { - if (aIndex >= 0 && aIndex < mStyleSheets.Count()) { - nsIStyleSheet* sheet = mStyleSheets[aIndex]; - NS_ADDREF(sheet); - return sheet; - } else { + if (aIndex < 0 || aIndex >= mStyleSheets.Count()) { NS_ERROR("Index out of range"); return nsnull; } + + nsIStyleSheet* sheet = mStyleSheets[aIndex]; + NS_ADDREF(sheet); + + return sheet; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetStyleSheetAt(PRInt32 aIndex, PRBool aIncludeSpecialSheets, nsIStyleSheet** aSheet) { @@ -1476,11 +1501,11 @@ nsDocument::GetStyleSheetAt(PRInt32 aIndex, PRBool aIncludeSpecialSheets, } else { *aSheet = InternalGetStyleSheetAt(aIndex).get(); } - + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetIndexOfStyleSheet(nsIStyleSheet* aSheet, PRInt32* aIndex) { *aIndex = mStyleSheets.IndexOf(aSheet); @@ -1488,17 +1513,19 @@ nsDocument::GetIndexOfStyleSheet(nsIStyleSheet* aSheet, PRInt32* aIndex) } // subclass hooks for sheet ordering -void nsDocument::InternalAddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags) +void +nsDocument::InternalAddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags) { mStyleSheets.AppendObject(aSheet); } -void nsDocument::AddStyleSheetToStyleSets(nsIStyleSheet* aSheet) +void +nsDocument::AddStyleSheetToStyleSets(nsIStyleSheet* aSheet) { PRInt32 count = mPresShells.Count(); PRInt32 indx; for (indx = 0; indx < count; ++indx) { - nsCOMPtr shell = (nsIPresShell*)mPresShells.ElementAt(indx); + nsCOMPtr shell = (nsIPresShell *)mPresShells.ElementAt(indx); nsCOMPtr set; if (NS_SUCCEEDED(shell->GetStyleSet(getter_AddRefs(set)))) { if (set) { @@ -1508,7 +1535,8 @@ void nsDocument::AddStyleSheetToStyleSets(nsIStyleSheet* aSheet) } } -void nsDocument::AddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags) +void +nsDocument::AddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags) { NS_PRECONDITION(aSheet, "null arg"); InternalAddStyleSheet(aSheet, aFlags); @@ -1516,7 +1544,7 @@ void nsDocument::AddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags) PRBool applicable; aSheet->GetApplicable(applicable); - + if (applicable) { AddStyleSheetToStyleSets(aSheet); } @@ -1524,36 +1552,40 @@ void nsDocument::AddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags) // if an observer removes itself, we're ok (not if it removes others though) PRInt32 i; for (i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers.ElementAt(i); + nsIDocumentObserver* observer = + NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(i)); + observer->StyleSheetAdded(this, aSheet); - } + } } -void nsDocument::RemoveStyleSheetFromStyleSets(nsIStyleSheet* aSheet) +void +nsDocument::RemoveStyleSheetFromStyleSets(nsIStyleSheet* aSheet) { PRInt32 count = mPresShells.Count(); PRInt32 indx; for (indx = 0; indx < count; ++indx) { - nsCOMPtr shell = (nsIPresShell*)mPresShells.ElementAt(indx); + nsCOMPtr shell = (nsIPresShell *)mPresShells.ElementAt(indx); nsCOMPtr set; - if (NS_SUCCEEDED(shell->GetStyleSet(getter_AddRefs(set)))) { - if (set) { - set->RemoveDocStyleSheet(aSheet); - } + shell->GetStyleSet(getter_AddRefs(set)); + + if (set) { + set->RemoveDocStyleSheet(aSheet); } } } -void nsDocument::RemoveStyleSheet(nsIStyleSheet* aSheet) +void +nsDocument::RemoveStyleSheet(nsIStyleSheet* aSheet) { NS_PRECONDITION(aSheet, "null arg"); nsCOMPtr sheet = aSheet; // hold ref so it won't die too soon - + if (!mStyleSheets.RemoveObject(aSheet)) { NS_NOTREACHED("stylesheet not found"); return; } - + if (!mIsGoingAway) { PRBool applicable = PR_TRUE; aSheet->GetApplicable(applicable); @@ -1561,9 +1593,13 @@ void nsDocument::RemoveStyleSheet(nsIStyleSheet* aSheet) RemoveStyleSheetFromStyleSets(aSheet); } - // if an observer removes itself, we're ok (not if it removes others though) + // if an observer removes itself, we're ok (not if it removes + // others though) + for (PRInt32 indx = mObservers.Count() - 1; indx >= 0; --indx) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers.ElementAt(indx); + nsIDocumentObserver *observer = + NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(indx)); + observer->StyleSheetRemoved(this, aSheet); } } @@ -1590,7 +1626,7 @@ nsDocument::UpdateStyleSheets(nsCOMArray& aOldSheets, PRInt32 oldIndex = mStyleSheets.IndexOf(oldSheet); NS_ASSERTION(oldIndex != -1, "stylesheet not found"); mStyleSheets.RemoveObjectAt(oldIndex); - + PRBool applicable = PR_TRUE; oldSheet->GetApplicable(applicable); if (applicable) { @@ -1623,19 +1659,21 @@ nsDocument::UpdateStyleSheets(nsCOMArray& aOldSheets, // others though) // XXXldb Hopefully the observer doesn't care which sheet you use. for (PRInt32 indx = mObservers.Count() - 1; indx >= 0; --indx) { - nsIDocumentObserver* observer = - (nsIDocumentObserver*)mObservers.ElementAt(indx); + nsIDocumentObserver *observer = + NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(indx)); + observer->StyleSheetRemoved(this, oldSheet); } } - + return NS_OK; } -void +void nsDocument::InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex) -{ // subclass hook for sheet ordering +{ + // subclass hook for sheet ordering mStyleSheets.InsertObjectAt(aSheet, aIndex); } @@ -1649,23 +1687,27 @@ nsDocument::InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex) PRBool applicable; aSheet->GetApplicable(applicable); - + if (applicable) { AddStyleSheetToStyleSets(aSheet); } - // if an observer removes itself, we're ok (not if it removes others though) + // if an observer removes itself, we're ok (not if it removes others + // though) PRInt32 i; for (i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers.ElementAt(i); + nsIDocumentObserver *observer = + NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(i)); + observer->StyleSheetAdded(this, aSheet); - } + } return NS_OK; } -void nsDocument::SetStyleSheetApplicableState(nsIStyleSheet* aSheet, - PRBool aApplicable) +void +nsDocument::SetStyleSheetApplicableState(nsIStyleSheet* aSheet, + PRBool aApplicable) { NS_PRECONDITION(aSheet, "null arg"); @@ -1681,17 +1723,17 @@ void nsDocument::SetStyleSheetApplicableState(nsIStyleSheet* aSheet, // We have to always notify, since this will be called for sheets // that are children of sheets in our style set, as well as some // sheets for nsHTMLEditor. - + PRInt32 indx; // if an observer removes itself, we're ok (not if it removes others though) for (indx = mObservers.Count() - 1; indx >= 0; --indx) { - nsIDocumentObserver* observer = + nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers.ElementAt(indx); observer->StyleSheetApplicableStateChanged(this, aSheet, aApplicable); } } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetScriptGlobalObject(nsIScriptGlobalObject** aScriptGlobalObject) { NS_ENSURE_ARG_POINTER(aScriptGlobalObject); @@ -1701,24 +1743,26 @@ nsDocument::GetScriptGlobalObject(nsIScriptGlobalObject** aScriptGlobalObject) // caller through our docshell. if (mIsGoingAway) { - nsCOMPtr requestor = do_QueryReferent(mDocumentContainer); + nsCOMPtr requestor = + do_QueryReferent(mDocumentContainer); if (requestor) return CallGetInterface(requestor.get(), aScriptGlobalObject); } *aScriptGlobalObject = mScriptGlobalObject; NS_IF_ADDREF(*aScriptGlobalObject); + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject) { // XXX HACK ALERT! If the script context owner is null, the document // will soon be going away. So tell our content that to lose its - // reference to the document. This has to be done before we - // actually set the script context owner to null so that the - // content elements can remove references to their script objects. + // reference to the document. This has to be done before we actually + // set the script context owner to null so that the content elements + // can remove references to their script objects. if (!aScriptGlobalObject) { PRInt32 count, indx; @@ -1753,11 +1797,12 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject) } mScriptGlobalObject = aScriptGlobalObject; + return NS_OK; } NS_IMETHODIMP -nsDocument::GetScriptLoader(nsIScriptLoader** aScriptLoader) +nsDocument::GetScriptLoader(nsIScriptLoader** aScriptLoader) { NS_ENSURE_ARG_POINTER(aScriptLoader); @@ -1778,7 +1823,8 @@ nsDocument::GetScriptLoader(nsIScriptLoader** aScriptLoader) // Note: We don't hold a reference to the document observer; we assume // that it has a live reference to the document. -void nsDocument::AddObserver(nsIDocumentObserver* aObserver) +void +nsDocument::AddObserver(nsIDocumentObserver* aObserver) { // XXX Make sure the observer isn't already in the list if (mObservers.IndexOf(aObserver) == -1) { @@ -1786,19 +1832,21 @@ void nsDocument::AddObserver(nsIDocumentObserver* aObserver) } } -PRBool nsDocument::RemoveObserver(nsIDocumentObserver* aObserver) +PRBool +nsDocument::RemoveObserver(nsIDocumentObserver* aObserver) { // If we're in the process of destroying the document (and we're // informing the observers of the destruction), don't remove the // observers from the list. This is not a big deal, since we // don't hold a live reference to the observers. - if (!mInDestructor) + if (!mInDestructor) { return mObservers.RemoveElement(aObserver); - else - return (mObservers.IndexOf(aObserver) != -1); + } + + return (mObservers.IndexOf(aObserver) != -1); } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::BeginUpdate() { PRInt32 i; @@ -1806,10 +1854,11 @@ nsDocument::BeginUpdate() nsIDocumentObserver* observer = (nsIDocumentObserver*) mObservers[i]; observer->BeginUpdate(this); } + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::EndUpdate() { PRInt32 i; @@ -1817,6 +1866,7 @@ nsDocument::EndUpdate() nsIDocumentObserver* observer = (nsIDocumentObserver*) mObservers[i]; observer->EndUpdate(this); } + return NS_OK; } @@ -1828,6 +1878,7 @@ nsDocument::BeginLoad() nsIDocumentObserver* observer = (nsIDocumentObserver*) mObservers[i]; observer->BeginLoad(this); } + return NS_OK; } @@ -1980,29 +2031,33 @@ nsDocument::EndLoad() } NS_IMETHODIMP -nsDocument::ContentChanged(nsIContent* aContent, - nsISupports* aSubContent) +nsDocument::ContentChanged(nsIContent* aContent, nsISupports* aSubContent) { NS_ABORT_IF_FALSE(aContent, "Null content!"); PRInt32 i; for (i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; + nsIDocumentObserver *observer = + NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(i)); + observer->ContentChanged(this, aContent, aSubContent); } + return NS_OK; } NS_IMETHODIMP -nsDocument::ContentStatesChanged(nsIContent* aContent1, - nsIContent* aContent2, +nsDocument::ContentStatesChanged(nsIContent* aContent1, nsIContent* aContent2, PRInt32 aStateMask) { PRInt32 i; for (i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; + nsIDocumentObserver *observer = + NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(i)); + observer->ContentStatesChanged(this, aContent1, aContent2, aStateMask); } + return NS_OK; } @@ -2017,11 +2072,14 @@ nsDocument::ContentAppended(nsIContent* aContainer, volatile #endif PRInt32 i; - // XXXdwh There is a hacky ordering dependency between the binding manager - // and the frame constructor that forces us to walk the observer list - // in a forward order + + // XXXdwh There is a hacky ordering dependency between the binding + // manager and the frame constructor that forces us to walk the + // observer list in a forward order for (i = 0; i < mObservers.Count(); i++) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; + nsIDocumentObserver *observer = + NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(i)); + observer->ContentAppended(this, aContainer, aNewIndexInContainer); // Make sure that the observer didn't remove itself during the // notification. If it did, update our index @@ -2030,22 +2088,24 @@ nsDocument::ContentAppended(nsIContent* aContainer, i--; } } + return NS_OK; } NS_IMETHODIMP -nsDocument::ContentInserted(nsIContent* aContainer, - nsIContent* aChild, +nsDocument::ContentInserted(nsIContent* aContainer, nsIContent* aChild, PRInt32 aIndexInContainer) { NS_ABORT_IF_FALSE(aChild, "Null child!"); PRInt32 i; - // XXXdwh There is a hacky ordering dependency between the binding manager - // and the frame constructor that forces us to walk the observer list + // XXXdwh There is a hacky ordering dependency between the binding manager + // and the frame constructor that forces us to walk the observer list // in a forward order for (i = 0; i < mObservers.Count(); i++) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; + nsIDocumentObserver *observer = + NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(i)); + observer->ContentInserted(this, aContainer, aChild, aIndexInContainer); // Make sure that the observer didn't remove itself during the // notification. If it did, update our index. @@ -2054,92 +2114,97 @@ nsDocument::ContentInserted(nsIContent* aContainer, i--; } } + return NS_OK; } NS_IMETHODIMP -nsDocument::ContentReplaced(nsIContent* aContainer, - nsIContent* aOldChild, - nsIContent* aNewChild, - PRInt32 aIndexInContainer) +nsDocument::ContentReplaced(nsIContent* aContainer, nsIContent* aOldChild, + nsIContent* aNewChild, PRInt32 aIndexInContainer) { NS_ABORT_IF_FALSE(aOldChild && aNewChild, "Null old or new child child!"); PRInt32 i; - // XXXdwh There is a hacky ordering dependency between the binding manager - // and the frame constructor that forces us to walk the observer list - // in a reverse order + // XXXdwh There is a hacky ordering dependency between the binding + // manager and the frame constructor that forces us to walk the + // observer list in a reverse order for (i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; + nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; observer->ContentReplaced(this, aContainer, aOldChild, aNewChild, aIndexInContainer); } + return NS_OK; } NS_IMETHODIMP -nsDocument::ContentRemoved(nsIContent* aContainer, - nsIContent* aChild, +nsDocument::ContentRemoved(nsIContent* aContainer, nsIContent* aChild, PRInt32 aIndexInContainer) { NS_ABORT_IF_FALSE(aChild, "Null child!"); PRInt32 i; - // XXXdwh There is a hacky ordering dependency between the binding manager - // and the frame constructor that forces us to walk the observer list - // in a reverse order + // XXXdwh There is a hacky ordering dependency between the binding + // manager and the frame constructor that forces us to walk the + // observer list in a reverse order for (i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; - observer->ContentRemoved(this, aContainer, + nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; + observer->ContentRemoved(this, aContainer, aChild, aIndexInContainer); } + return NS_OK; } NS_IMETHODIMP -nsDocument::AttributeWillChange(nsIContent* aChild, - PRInt32 aNameSpaceID, +nsDocument::AttributeWillChange(nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute) { - NS_ABORT_IF_FALSE(aChild, "Null child!"); + NS_ASSERTION(aChild, "Null child!"); return NS_OK; } NS_IMETHODIMP -nsDocument::AttributeChanged(nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType, +nsDocument::AttributeChanged(nsIContent* aChild, PRInt32 aNameSpaceID, + nsIAtom* aAttribute, PRInt32 aModType, nsChangeHint aHint) { NS_ABORT_IF_FALSE(aChild, "Null child!"); PRInt32 i; - nsresult result = NS_OK; + nsresult rv = NS_OK; for (i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; - nsresult rv = observer->AttributeChanged(this, aChild, aNameSpaceID, aAttribute, aModType, aHint); - if (NS_FAILED(rv) && NS_SUCCEEDED(result)) - result = rv; + nsIDocumentObserver *observer = + NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(i)); + + nsresult rv2 = observer->AttributeChanged(this, aChild, aNameSpaceID, + aAttribute, aModType, aHint); + if (NS_FAILED(rv2) && NS_SUCCEEDED(rv)) + rv = rv2; } - return result; + + return rv; } NS_IMETHODIMP -nsDocument::StyleRuleChanged(nsIStyleSheet* aStyleSheet, nsIStyleRule* aStyleRule, - nsChangeHint aHint) +nsDocument::StyleRuleChanged(nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule, nsChangeHint aHint) { PRInt32 i; - // Get new value of count for every iteration in case - // observers remove themselves during the loop. + + // Get new value of count for every iteration in case observers + // remove themselves during the loop. for (i = 0; i < mObservers.Count(); i++) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; + nsIDocumentObserver *observer = + NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(i)); + // XXXbz We should _not_ be calling BeginUpdate from in here! The // caller of StyleRuleChanged should do that! observer->BeginUpdate(this); observer->StyleRuleChanged(this, aStyleSheet, aStyleRule, aHint); + // Make sure that the observer didn't remove itself during the // notification. If it did, update our index and count. if (i < mObservers.Count() && @@ -2150,17 +2215,22 @@ nsDocument::StyleRuleChanged(nsIStyleSheet* aStyleSheet, nsIStyleRule* aStyleRul observer->EndUpdate(this); } } + return NS_OK; } NS_IMETHODIMP -nsDocument::StyleRuleAdded(nsIStyleSheet* aStyleSheet, nsIStyleRule* aStyleRule) +nsDocument::StyleRuleAdded(nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule) { PRInt32 i; + // Get new value of count for every iteration in case // observers remove themselves during the loop. for (i = 0; i < mObservers.Count(); i++) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; + nsIDocumentObserver *observer = + NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(i)); + // XXXbz We should _not_ be calling BeginUpdate from in here! The // caller of StyleRuleAdded should do that! observer->BeginUpdate(this); @@ -2175,21 +2245,27 @@ nsDocument::StyleRuleAdded(nsIStyleSheet* aStyleSheet, nsIStyleRule* aStyleRule) observer->EndUpdate(this); } } + return NS_OK; } NS_IMETHODIMP -nsDocument::StyleRuleRemoved(nsIStyleSheet* aStyleSheet, nsIStyleRule* aStyleRule) +nsDocument::StyleRuleRemoved(nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule) { PRInt32 i; + // Get new value of count for every iteration in case // observers remove themselves during the loop. for (i = 0; i < mObservers.Count(); i++) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; + nsIDocumentObserver *observer = + NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(i)); + // XXXbz We should _not_ be calling BeginUpdate from in here! The // caller of StyleRuleRemoved should do that! observer->BeginUpdate(this); observer->StyleRuleRemoved(this, aStyleSheet, aStyleRule); + // Make sure that the observer didn't remove itself during the // notification. If it did, update our index and count. if (i < mObservers.Count() && @@ -2200,6 +2276,7 @@ nsDocument::StyleRuleRemoved(nsIStyleSheet* aStyleSheet, nsIStyleRule* aStyleRul observer->EndUpdate(this); } } + return NS_OK; } @@ -2207,7 +2284,7 @@ nsDocument::StyleRuleRemoved(nsIStyleSheet* aStyleSheet, nsIStyleRule* aStyleRul // // nsIDOMDocument interface // -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetDoctype(nsIDOMDocumentType** aDoctype) { NS_ENSURE_ARG_POINTER(aDoctype); @@ -2215,7 +2292,7 @@ nsDocument::GetDoctype(nsIDOMDocumentType** aDoctype) *aDoctype = nsnull; PRInt32 i, count; count = mChildren.Count(); - nsCOMPtr rootContentNode( do_QueryInterface(mRootContent) ); + nsCOMPtr rootContentNode(do_QueryInterface(mRootContent) ); nsCOMPtr node; for (i = 0; i < count; i++) { @@ -2243,47 +2320,47 @@ nsDocument::GetDoctype(nsIDOMDocumentType** aDoctype) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetImplementation(nsIDOMDOMImplementation** aImplementation) { // For now, create a new implementation every time. This shouldn't // be a high bandwidth operation - nsDOMImplementation* impl = new nsDOMImplementation(mDocumentURL); - if (!impl) { + *aImplementation = new nsDOMImplementation(mDocumentURL); + if (!*aImplementation) { return NS_ERROR_OUT_OF_MEMORY; } - return CallQueryInterface(impl, aImplementation); + NS_ADDREF(*aImplementation); + + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetDocumentElement(nsIDOMElement** aDocumentElement) { - if (nsnull == aDocumentElement) { - return NS_ERROR_NULL_POINTER; - } + NS_ENSURE_ARG_POINTER(aDocumentElement); - nsresult res = NS_OK; + nsresult rv = NS_OK; if (mRootContent) { - res = CallQueryInterface(mRootContent, aDocumentElement); - NS_ASSERTION(NS_OK == res, "Must be a DOM Element"); + rv = CallQueryInterface(mRootContent, aDocumentElement); + NS_ASSERTION(NS_OK == rv, "Must be a DOM Element"); } else { *aDocumentElement = nsnull; } - - return res; + + return rv; } -NS_IMETHODIMP -nsDocument::CreateElement(const nsAString& aTagName, +NS_IMETHODIMP +nsDocument::CreateElement(const nsAString& aTagName, nsIDOMElement** aReturn) { // Should be implemented by subclass return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::CreateElementNS(const nsAString & namespaceURI, const nsAString & qualifiedName, nsIDOMElement **_retval) @@ -2308,15 +2385,17 @@ nsDocument::CreateTextNode(const nsAString& aData, nsIDOMText** aReturn) return rv; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::CreateDocumentFragment(nsIDOMDocumentFragment** aReturn) { return NS_NewDocumentFragment(aReturn, this); } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::CreateComment(const nsAString& aData, nsIDOMComment** aReturn) { + *aReturn = nsnull; + nsCOMPtr comment; nsresult rv = NS_NewCommentNode(getter_AddRefs(comment)); @@ -2328,24 +2407,25 @@ nsDocument::CreateComment(const nsAString& aData, nsIDOMComment** aReturn) return rv; } -NS_IMETHODIMP -nsDocument::CreateCDATASection(const nsAString& aData, nsIDOMCDATASection** aReturn) +NS_IMETHODIMP +nsDocument::CreateCDATASection(const nsAString& aData, + nsIDOMCDATASection** aReturn) { // Should be implemented by subclass return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP -nsDocument::CreateProcessingInstruction(const nsAString& aTarget, - const nsAString& aData, +NS_IMETHODIMP +nsDocument::CreateProcessingInstruction(const nsAString& aTarget, + const nsAString& aData, nsIDOMProcessingInstruction** aReturn) { // Should be implemented by subclass return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP -nsDocument::CreateAttribute(const nsAString& aName, +NS_IMETHODIMP +nsDocument::CreateAttribute(const nsAString& aName, nsIDOMAttr** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -2357,10 +2437,10 @@ nsDocument::CreateAttribute(const nsAString& aName, nsCOMPtr nodeInfo; nsresult rv = mNodeInfoManager->GetNodeInfo(aName, nsnull, kNameSpaceID_None, *getter_AddRefs(nodeInfo)); - NS_ENSURE_SUCCESS(rv, rv); - + NS_ENSURE_SUCCESS(rv, rv); + attribute = new nsDOMAttribute(nsnull, nodeInfo, value); - NS_ENSURE_TRUE(attribute, NS_ERROR_OUT_OF_MEMORY); + NS_ENSURE_TRUE(attribute, NS_ERROR_OUT_OF_MEMORY); return CallQueryInterface(attribute, aReturn); } @@ -2374,19 +2454,20 @@ nsDocument::CreateAttributeNS(const nsAString & namespaceURI, return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP -nsDocument::CreateEntityReference(const nsAString& aName, +NS_IMETHODIMP +nsDocument::CreateEntityReference(const nsAString& aName, nsIDOMEntityReference** aReturn) { // Should be implemented by subclass return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP -nsDocument::GetElementsByTagName(const nsAString& aTagname, +NS_IMETHODIMP +nsDocument::GetElementsByTagName(const nsAString& aTagname, nsIDOMNodeList** aReturn) { nsCOMPtr nameAtom = do_GetAtom(aTagname); + NS_ENSURE_TRUE(nameAtom, NS_ERROR_OUT_OF_MEMORY); nsCOMPtr list; NS_GetContentList(this, nameAtom, kNameSpaceID_Unknown, nsnull, @@ -2396,7 +2477,7 @@ nsDocument::GetElementsByTagName(const nsAString& aTagname, return CallQueryInterface(list, aReturn); } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetElementsByTagNameNS(const nsAString& aNamespaceURI, const nsAString& aLocalName, nsIDOMNodeList** aReturn) @@ -2420,7 +2501,7 @@ nsDocument::GetElementsByTagNameNS(const nsAString& aNamespaceURI, if (!list) { nsCOMPtr nameAtom = do_GetAtom(aLocalName); NS_ENSURE_TRUE(nameAtom, NS_ERROR_OUT_OF_MEMORY); - + NS_GetContentList(this, nameAtom, nameSpaceId, nsnull, getter_AddRefs(list)); NS_ENSURE_TRUE(list, NS_ERROR_OUT_OF_MEMORY); @@ -2429,7 +2510,7 @@ nsDocument::GetElementsByTagNameNS(const nsAString& aNamespaceURI, return CallQueryInterface(list, aReturn); } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetElementById(const nsAString & elementId, nsIDOMElement **_retval) { @@ -2478,7 +2559,7 @@ nsDocument::EvaluateXPointer(const nsAString& aExpression, return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets) { if (!mDOMStyleSheets) { @@ -2494,7 +2575,7 @@ nsDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetCharacterSet(nsAString& aCharacterSet) { return GetDocumentCharacterSet(aCharacterSet); @@ -2507,7 +2588,7 @@ nsDocument::ImportNode(nsIDOMNode* aImportedNode, { NS_ENSURE_ARG(aImportedNode); NS_ENSURE_ARG_POINTER(aReturn); - + nsresult rv = nsContentUtils::CheckSameOrigin(this, aImportedNode); if (NS_FAILED(rv)) { return rv; @@ -2548,18 +2629,21 @@ nsDocument::RemoveBinding(nsIDOMElement* aContent, const nsAString& aURL) } NS_IMETHODIMP -nsDocument::LoadBindingDocument(const nsAString& aURL, nsIDOMDocument** aResult) +nsDocument::LoadBindingDocument(const nsAString& aURL, + nsIDOMDocument** aResult) { - if (mBindingManager) { - nsCOMPtr doc; - mBindingManager->LoadBindingDocument(this, aURL, getter_AddRefs(doc)); - nsCOMPtr domDoc(do_QueryInterface(doc)); - *aResult = domDoc; - NS_IF_ADDREF(*aResult); - return NS_OK; + if (!mBindingManager) { + return NS_ERROR_FAILURE; } - return NS_ERROR_FAILURE; + nsCOMPtr doc; + mBindingManager->LoadBindingDocument(this, aURL, getter_AddRefs(doc)); + + nsCOMPtr domDoc(do_QueryInterface(doc)); + *aResult = domDoc; + NS_IF_ADDREF(*aResult); + + return NS_OK; } NS_IMETHODIMP @@ -2579,19 +2663,17 @@ nsDocument::GetBindingParent(nsIDOMNode* aNode, nsIDOMElement** aResult) } static nsresult -GetElementByAttribute(nsIContent* aContent, - nsIAtom* aAttrName, - const nsAString& aAttrValue, - PRBool aUniversalMatch, +GetElementByAttribute(nsIContent* aContent, nsIAtom* aAttrName, + const nsAString& aAttrValue, PRBool aUniversalMatch, nsIDOMElement** aResult) { nsAutoString value; nsresult rv = aContent->GetAttr(kNameSpaceID_None, aAttrName, value); - if (rv == NS_CONTENT_ATTR_HAS_VALUE) { - if (aUniversalMatch || value.Equals(aAttrValue)) - return CallQueryInterface(aContent, aResult); + if (rv == NS_CONTENT_ATTR_HAS_VALUE && + (aUniversalMatch || value.Equals(aAttrValue))) { + return CallQueryInterface(aContent, aResult); } - + PRInt32 childCount; aContent->ChildCount(childCount); @@ -2599,7 +2681,8 @@ GetElementByAttribute(nsIContent* aContent, nsCOMPtr current; aContent->ChildAt(i, *getter_AddRefs(current)); - GetElementByAttribute(current, aAttrName, aAttrValue, aUniversalMatch, aResult); + GetElementByAttribute(current, aAttrName, aAttrValue, aUniversalMatch, + aResult); if (*aResult) return NS_OK; @@ -2610,16 +2693,16 @@ GetElementByAttribute(nsIContent* aContent, NS_IMETHODIMP nsDocument::GetAnonymousElementByAttribute(nsIDOMElement* aElement, - const nsAString& aAttrName, - const nsAString& aAttrValue, + const nsAString& aAttrName, + const nsAString& aAttrValue, nsIDOMElement** aResult) { *aResult = nsnull; nsCOMPtr nodeList; GetAnonymousNodes(aElement, getter_AddRefs(nodeList)); - - if (!nodeList) + + if (!nodeList) return NS_OK; nsCOMPtr attribute = do_GetAtom(aAttrName); @@ -2632,10 +2715,11 @@ nsDocument::GetAnonymousElementByAttribute(nsIDOMElement* aElement, for (PRUint32 i = 0; i < length; ++i) { nsCOMPtr current; nodeList->Item(i, getter_AddRefs(current)); - + nsCOMPtr content(do_QueryInterface(current)); - GetElementByAttribute(content, attribute, aAttrValue, universalMatch, aResult); + GetElementByAttribute(content, attribute, aAttrValue, universalMatch, + aResult); if (*aResult) return NS_OK; } @@ -2649,20 +2733,21 @@ nsDocument::GetAnonymousNodes(nsIDOMElement* aElement, nsIDOMNodeList** aResult) { *aResult = nsnull; - if (mBindingManager) { - nsCOMPtr content(do_QueryInterface(aElement)); - return mBindingManager->GetAnonymousNodesFor(content, aResult); + if (!mBindingManager) { + return NS_OK; } - return NS_OK; + + nsCOMPtr content(do_QueryInterface(aElement)); + return mBindingManager->GetAnonymousNodesFor(content, aResult); } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::CreateRange(nsIDOMRange** aReturn) { return NS_NewRange(aReturn); } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::CreateNodeIterator(nsIDOMNode *aRoot, PRUint32 aWhatToShow, nsIDOMNodeFilter *aFilter, @@ -2672,7 +2757,7 @@ nsDocument::CreateNodeIterator(nsIDOMNode *aRoot, return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::CreateTreeWalker(nsIDOMNode *aRoot, PRUint32 aWhatToShow, nsIDOMNodeFilter *aFilter, @@ -2682,14 +2767,12 @@ nsDocument::CreateTreeWalker(nsIDOMNode *aRoot, *_retval = nsnull; nsresult rv = nsContentUtils::CheckSameOrigin(this, aRoot); - if(NS_FAILED(rv)) + if (NS_FAILED(rv)) { return rv; + } - return NS_NewTreeWalker(aRoot, - aWhatToShow, - aFilter, - aEntityReferenceExpansion, - _retval); + return NS_NewTreeWalker(aRoot, aWhatToShow, aFilter, + aEntityReferenceExpansion, _retval); } @@ -2728,11 +2811,11 @@ nsDocument::GetLocation(nsIDOMLocation **_retval) nsCOMPtr w(do_QueryInterface(mScriptGlobalObject)); - if(w) { - return w->GetLocation(_retval); + if (!w) { + return NS_OK; } - return NS_OK; + return w->GetLocation(_retval); } NS_IMETHODIMP @@ -2762,7 +2845,7 @@ nsDocument::SetTitle(const nsAString& aTitle) continue; nsCOMPtr docShellWin = do_QueryInterface(container); - if(!docShellWin) + if (!docShellWin) continue; rv = docShellWin->SetTitle(PromiseFlatString(aTitle).get()); @@ -2790,15 +2873,17 @@ nsDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult) *aResult = nsnull; - if (!mBoxObjectTable) + if (!mBoxObjectTable) { mBoxObjectTable = new nsSupportsHashtable; - else { + } else { nsISupportsKey key(aElement); - nsCOMPtr supports(dont_AddRef(NS_STATIC_CAST(nsISupports*, mBoxObjectTable->Get(&key)))); + nsCOMPtr supports = dont_AddRef(mBoxObjectTable->Get(&key)); + nsCOMPtr boxObject(do_QueryInterface(supports)); if (boxObject) { *aResult = boxObject; NS_ADDREF(*aResult); + return NS_OK; } } @@ -2810,40 +2895,44 @@ nsDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult) PRInt32 namespaceID; nsCOMPtr tag; - nsCOMPtr xblService = + nsCOMPtr xblService = do_GetService("@mozilla.org/xbl;1", &rv); nsCOMPtr content(do_QueryInterface(aElement)); xblService->ResolveTag(content, &namespaceID, getter_AddRefs(tag)); - + nsCAutoString contractID("@mozilla.org/layout/xul-boxobject"); if (namespaceID == kNameSpaceID_XUL) { - if (tag.get() == nsXULAtoms::browser) + if (tag == nsXULAtoms::browser) contractID += "-browser"; - else if (tag.get() == nsXULAtoms::editor) + else if (tag == nsXULAtoms::editor) contractID += "-editor"; - else if (tag.get() == nsXULAtoms::iframe) + else if (tag == nsXULAtoms::iframe) contractID += "-iframe"; - else if (tag.get() == nsXULAtoms::menu) + else if (tag == nsXULAtoms::menu) contractID += "-menu"; - else if (tag.get() == nsXULAtoms::popup || tag.get() == nsXULAtoms::menupopup || - tag.get() == nsXULAtoms::tooltip) + else if (tag == nsXULAtoms::popup || + tag == nsXULAtoms::menupopup || + tag == nsXULAtoms::tooltip) contractID += "-popup"; - else if (tag.get() == nsXULAtoms::tree) + else if (tag == nsXULAtoms::tree) contractID += "-tree"; - else if (tag.get() == nsXULAtoms::listbox) + else if (tag == nsXULAtoms::listbox) contractID += "-listbox"; - else if (tag.get() == nsXULAtoms::scrollbox) + else if (tag == nsXULAtoms::scrollbox) contractID += "-scrollbox"; } contractID += ";1"; - + nsCOMPtr boxObject(do_CreateInstance(contractID.get())); - if (!boxObject) + if (!boxObject) return NS_ERROR_FAILURE; nsCOMPtr privateBox(do_QueryInterface(boxObject)); - if (NS_FAILED(rv = privateBox->Init(content, shell))) + rv = privateBox->Init(content, shell); + + if (NS_FAILED(rv)) { return rv; + } SetBoxObjectFor(aElement, boxObject); @@ -2857,21 +2946,22 @@ NS_IMETHODIMP nsDocument::SetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject* aBoxObject) { if (!mBoxObjectTable) { - if (!aBoxObject) + if (!aBoxObject) return NS_OK; mBoxObjectTable = new nsSupportsHashtable(12); } nsISupportsKey key(aElement); - if (aBoxObject) + if (aBoxObject) { mBoxObjectTable->Put(&key, aBoxObject); - else { + } else { nsCOMPtr supp; mBoxObjectTable->Remove(&key, getter_AddRefs(supp)); nsCOMPtr boxObject(do_QueryInterface(supp)); - if (boxObject) + if (boxObject) { boxObject->SetDocument(nsnull); + } } return NS_OK; @@ -2881,6 +2971,7 @@ struct DirTable { const char* mName; PRUint8 mValue; }; + static const DirTable dirAttributes[] = { {"ltr", IBMBIDI_TEXTDIRECTION_LTR}, {"rtl", IBMBIDI_TEXTDIRECTION_RTL}, @@ -2888,9 +2979,9 @@ static const DirTable dirAttributes[] = { }; /** - * Retrieve the "direction" property of the document. + * Retrieve the "direction" property of the document. * - * @lina 01/09/2001 + * @lina 01/09/2001 */ NS_IMETHODIMP nsDocument::GetDir(nsAString& aDirection) @@ -2898,13 +2989,13 @@ nsDocument::GetDir(nsAString& aDirection) nsCOMPtr shell = (nsIPresShell*)mPresShells.SafeElementAt(0); if (shell) { nsCOMPtr context; - shell->GetPresContext(getter_AddRefs(context) ); + shell->GetPresContext(getter_AddRefs(context)); if (context) { PRUint32 options; context->GetBidi(&options); for (const DirTable* elt = dirAttributes; elt->mName; elt++) { if (GET_BIDI_OPTION_DIRECTION(options) == elt->mValue) { - aDirection.Assign(NS_ConvertASCIItoUCS2(elt->mName) ); + aDirection.Assign(NS_ConvertASCIItoUCS2(elt->mName)); break; } } @@ -2915,33 +3006,38 @@ nsDocument::GetDir(nsAString& aDirection) } /** - * Set the "direction" property of the document. + * Set the "direction" property of the document. * - * @lina 01/09/2001 + * @lina 01/09/2001 */ NS_IMETHODIMP nsDocument::SetDir(const nsAString& aDirection) { - if (mPresShells.Count() != 0) { - nsCOMPtr shell = (nsIPresShell*)mPresShells.ElementAt(0); - if (shell) { - nsCOMPtr context; - shell->GetPresContext(getter_AddRefs(context) ); - if (context) { - PRUint32 options; - context->GetBidi(&options); - for (const DirTable* elt = dirAttributes; elt->mName; elt++) { - if (aDirection == NS_ConvertASCIItoUCS2(elt->mName) ) { - if (GET_BIDI_OPTION_DIRECTION(options) != elt->mValue) { - SET_BIDI_OPTION_DIRECTION(options, elt->mValue); - context->SetBidi(options, PR_TRUE); - } - break; - } - } // for + nsIPresShell *shell = + NS_STATIC_CAST(nsIPresShell *, mPresShells.SafeElementAt(0)); + + if (!shell) { + return NS_OK; + } + + nsCOMPtr context; + shell->GetPresContext(getter_AddRefs(context)); + NS_ENSURE_TRUE(context, NS_ERROR_UNEXPECTED); + + PRUint32 options; + context->GetBidi(&options); + + for (const DirTable* elt = dirAttributes; elt->mName; elt++) { + if (aDirection == NS_ConvertASCIItoUCS2(elt->mName)) { + if (GET_BIDI_OPTION_DIRECTION(options) != elt->mValue) { + SET_BIDI_OPTION_DIRECTION(options, elt->mValue); + context->SetBidi(options, PR_TRUE); } + + break; } } + return NS_OK; } @@ -2949,14 +3045,15 @@ nsDocument::SetDir(const nsAString& aDirection) // // nsIDOMNode methods // -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetNodeName(nsAString& aNodeName) { aNodeName.Assign(NS_LITERAL_STRING("#document")); + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetNodeValue(nsAString& aNodeValue) { SetDOMStringToNull(aNodeValue); @@ -2964,27 +3061,29 @@ nsDocument::GetNodeValue(nsAString& aNodeValue) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::SetNodeValue(const nsAString& aNodeValue) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetNodeType(PRUint16* aNodeType) { *aNodeType = nsIDOMNode::DOCUMENT_NODE; + return NS_OK; } -NS_IMETHODIMP -nsDocument::GetParentNode(nsIDOMNode** aParentNode) +NS_IMETHODIMP +nsDocument::GetParentNode(nsIDOMNode** aParentNode) { *aParentNode = nsnull; + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetChildNodes(nsIDOMNodeList** aChildNodes) { if (!mChildNodes) { @@ -2992,13 +3091,12 @@ nsDocument::GetChildNodes(nsIDOMNodeList** aChildNodes) if (!mChildNodes) { return NS_ERROR_OUT_OF_MEMORY; } - NS_ADDREF(mChildNodes); } - return CallQueryInterface(mChildNodes, aChildNodes); + return CallQueryInterface(mChildNodes.get(), aChildNodes); } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::HasChildNodes(PRBool* aHasChildNodes) { NS_ENSURE_ARG(aHasChildNodes); @@ -3008,7 +3106,7 @@ nsDocument::HasChildNodes(PRBool* aHasChildNodes) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::HasAttributes(PRBool* aHasAttributes) { NS_ENSURE_ARG(aHasAttributes); @@ -3018,53 +3116,58 @@ nsDocument::HasAttributes(PRBool* aHasAttributes) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetFirstChild(nsIDOMNode** aFirstChild) { if (mChildren.Count()) { return CallQueryInterface(mChildren[0], aFirstChild); } - + *aFirstChild = nsnull; + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetLastChild(nsIDOMNode** aLastChild) { PRInt32 count = mChildren.Count(); if (count) { return CallQueryInterface(mChildren[count-1], aLastChild); } - + *aLastChild = nsnull; + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetPreviousSibling(nsIDOMNode** aPreviousSibling) { *aPreviousSibling = nsnull; + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetNextSibling(nsIDOMNode** aNextSibling) { *aNextSibling = nsnull; + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetAttributes(nsIDOMNamedNodeMap** aAttributes) { *aAttributes = nsnull; + return NS_OK; } NS_IMETHODIMP nsDocument::GetNamespaceURI(nsAString& aNamespaceURI) -{ +{ SetDOMStringToNull(aNamespaceURI); return NS_OK; @@ -3092,17 +3195,17 @@ nsDocument::GetLocalName(nsAString& aLocalName) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn) { - NS_ASSERTION(nsnull != aNewChild, "null ptr"); + NS_ASSERTION(aNewChild, "null ptr"); PRInt32 indx; PRUint16 nodeType; *aReturn = nsnull; // Do we need to do this? - if (nsnull == aNewChild) { + if (!aNewChild) { return NS_ERROR_NULL_POINTER; } @@ -3115,16 +3218,16 @@ nsDocument::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, // element and we already have a root (our addition to DOM spec), throw // HIERARCHY_REQUEST_ERR. aNewChild->GetNodeType(&nodeType); - if (((COMMENT_NODE != nodeType) && - (TEXT_NODE != nodeType) && - (PROCESSING_INSTRUCTION_NODE != nodeType) && - (DOCUMENT_TYPE_NODE != nodeType) && - (ELEMENT_NODE != nodeType)) || - ((ELEMENT_NODE == nodeType) && mRootContent)){ + if (((nodeType != COMMENT_NODE) && + (nodeType != TEXT_NODE) && + (nodeType != PROCESSING_INSTRUCTION_NODE) && + (nodeType != DOCUMENT_TYPE_NODE) && + (nodeType != ELEMENT_NODE)) || + ((nodeType == ELEMENT_NODE) && mRootContent)) { return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; } - nsCOMPtr content( do_QueryInterface(aNewChild) ); + nsCOMPtr content(do_QueryInterface(aNewChild)); if (!content) { return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; } @@ -3134,7 +3237,7 @@ nsDocument::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, mChildren.AppendObject(content); } else { - nsCOMPtr refContent( do_QueryInterface(aRefChild) ); + nsCOMPtr refContent(do_QueryInterface(aRefChild)); if (!refContent) { return NS_ERROR_DOM_NOT_FOUND_ERR; @@ -3151,8 +3254,9 @@ nsDocument::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, // If we get here, we've succesfully inserted content into the // index-th spot in mChildren. - if (ELEMENT_NODE == nodeType) + if (nodeType == ELEMENT_NODE) { mRootContent = content; + } content->SetDocument(this, PR_TRUE, PR_TRUE); @@ -3164,23 +3268,21 @@ nsDocument::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, return NS_OK; } -NS_IMETHODIMP -nsDocument::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn) +NS_IMETHODIMP +nsDocument::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, + nsIDOMNode** aReturn) { - NS_ASSERTION(((nsnull != aNewChild) && (nsnull != aOldChild)), "null ptr"); - nsresult result = NS_OK; + *aReturn = nsnull; + + NS_ENSURE_TRUE(aNewChild && aOldChild, NS_ERROR_NULL_POINTER); + + nsresult rv = NS_OK; PRInt32 indx; PRUint16 nodeType; - - *aReturn = nsnull; // is this necessary? - if ((nsnull == aNewChild) || (nsnull == aOldChild)) { - return NS_ERROR_NULL_POINTER; - } - - result = nsContentUtils::CheckSameOrigin(this, aNewChild); - if (NS_FAILED(result)) { - return result; + rv = nsContentUtils::CheckSameOrigin(this, aNewChild); + if (NS_FAILED(rv)) { + return rv; } aNewChild->GetNodeType(&nodeType); @@ -3193,22 +3295,20 @@ nsDocument::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNod return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; } - nsCOMPtr content( do_QueryInterface(aNewChild) ); - nsCOMPtr refContent( do_QueryInterface(aOldChild) ); + nsCOMPtr content(do_QueryInterface(aNewChild)); + nsCOMPtr refContent(do_QueryInterface(aOldChild)); if (!content || !refContent) { return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; } - if ((ELEMENT_NODE == nodeType) && - mRootContent && - (mRootContent != refContent.get())) - { + if (nodeType == ELEMENT_NODE && mRootContent && + mRootContent != refContent) { // Caller attempted to add a second element as a child. return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; } - + indx = mChildren.IndexOf(refContent); - if (-1 == indx) { + if (indx == -1) { // The reference child is not a child of the document. return NS_ERROR_DOM_NOT_FOUND_ERR; } @@ -3218,8 +3318,9 @@ nsDocument::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNod mChildren.ReplaceObjectAt(content, indx); // This is OK because we checked above. - if (ELEMENT_NODE == nodeType) + if (nodeType == ELEMENT_NODE) { mRootContent = content; + } content->SetDocument(this, PR_TRUE, PR_TRUE); ContentInserted(nsnull, content, indx); @@ -3227,27 +3328,23 @@ nsDocument::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNod *aReturn = aOldChild; NS_ADDREF(aOldChild); - return result; + return rv; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) { - NS_ASSERTION(nsnull != aOldChild, "null ptr"); - *aReturn = nsnull; // do we need to do this? - if (nsnull == aOldChild) { - return NS_ERROR_NULL_POINTER; - } + NS_ENSURE_TRUE(aOldChild, NS_ERROR_NULL_POINTER); - nsCOMPtr content( do_QueryInterface(aOldChild) ); + nsCOMPtr content(do_QueryInterface(aOldChild)); if (!content) { return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; } PRInt32 indx = mChildren.IndexOf(content); - if (-1 == indx) { + if (indx == -1) { return NS_ERROR_DOM_NOT_FOUND_ERR; } @@ -3261,21 +3358,22 @@ nsDocument::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) *aReturn = aOldChild; NS_ADDREF(aOldChild); - + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn) { return InsertBefore(aNewChild, nsnull, aReturn); } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) { // XXX should be implemented by subclass *aReturn = nsnull; + return NS_OK; } @@ -3291,12 +3389,12 @@ nsDocument::Normalize() return node->Normalize(); } } + return NS_OK; } NS_IMETHODIMP -nsDocument::IsSupported(const nsAString& aFeature, - const nsAString& aVersion, +nsDocument::IsSupported(const nsAString& aFeature, const nsAString& aVersion, PRBool* aReturn) { return nsGenericElement::InternalIsSupported(aFeature, aVersion, aReturn); @@ -3311,12 +3409,12 @@ nsDocument::GetBaseURI(nsAString &aURI) mDocumentBaseURL->GetSpec(spec); aURI = NS_ConvertUTF8toUCS2(spec); } + return NS_OK; } NS_IMETHODIMP -nsDocument::CompareDocumentPosition(nsIDOMNode* aOther, - PRUint16* aReturn) +nsDocument::CompareDocumentPosition(nsIDOMNode* aOther, PRUint16* aReturn) { NS_ENSURE_ARG_POINTER(aOther); NS_PRECONDITION(aReturn, "Must have an out parameter"); @@ -3383,12 +3481,12 @@ nsDocument::CompareDocumentPosition(nsIDOMNode* aOther, } *aReturn = mask; + return NS_OK; } NS_IMETHODIMP -nsDocument::IsSameNode(nsIDOMNode* aOther, - PRBool* aReturn) +nsDocument::IsSameNode(nsIDOMNode* aOther, PRBool* aReturn) { PRBool sameNode = PR_FALSE; @@ -3397,51 +3495,64 @@ nsDocument::IsSameNode(nsIDOMNode* aOther, } *aReturn = sameNode; + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::LookupNamespacePrefix(const nsAString& aNamespaceURI, - nsAString& aPrefix) + nsAString& aPrefix) { aPrefix.Truncate(); + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::LookupNamespaceURI(const nsAString& aNamespacePrefix, nsAString& aNamespaceURI) { aNamespaceURI.Truncate(); + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) { *aOwnerDocument = nsnull; + return NS_OK; } -nsresult nsDocument::GetListenerManager(nsIEventListenerManager **aInstancePtrResult) +nsresult +nsDocument::GetListenerManager(nsIEventListenerManager **aInstancePtrResult) { - if (nsnull != mListenerManager) { - return CallQueryInterface(mListenerManager, aInstancePtrResult); - } - if (NS_OK == NS_NewEventListenerManager(aInstancePtrResult)) { - mListenerManager = *aInstancePtrResult; - NS_ADDREF(mListenerManager); - mListenerManager->SetListenerTarget(NS_STATIC_CAST(nsIDocument*,this)); + if (mListenerManager) { + *aInstancePtrResult = mListenerManager; + NS_ADDREF(*aInstancePtrResult); + return NS_OK; } - return NS_ERROR_FAILURE; + + nsresult rv = NS_NewEventListenerManager(getter_AddRefs(mListenerManager)); + NS_ENSURE_SUCCESS(rv, rv); + + mListenerManager->SetListenerTarget(NS_STATIC_CAST(nsIDocument *,this)); + + *aInstancePtrResult = mListenerManager; + NS_ADDREF(*aInstancePtrResult); + + return NS_OK; } -nsresult nsDocument::HandleEvent(nsIDOMEvent *aEvent) +nsresult +nsDocument::HandleEvent(nsIDOMEvent *aEvent) { PRBool noDefault; + return DispatchEvent(aEvent, &noDefault); -} +} NS_IMETHODIMP nsDocument::GetSystemEventGroup(nsIDOMEventGroup **aGroup) @@ -3450,14 +3561,14 @@ nsDocument::GetSystemEventGroup(nsIDOMEventGroup **aGroup) if (NS_SUCCEEDED(GetListenerManager(getter_AddRefs(manager))) && manager) { return manager->GetSystemEventGroupLM(aGroup); } + return NS_ERROR_FAILURE; } -nsresult nsDocument::HandleDOMEvent(nsIPresContext* aPresContext, - nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, - PRUint32 aFlags, - nsEventStatus* aEventStatus) +nsresult +nsDocument::HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, PRUint32 aFlags, + nsEventStatus* aEventStatus) { nsresult mRet = NS_OK; PRBool externalDOMEvent = PR_FALSE; @@ -3467,7 +3578,7 @@ nsresult nsDocument::HandleDOMEvent(nsIPresContext* aPresContext, if (NS_EVENT_FLAG_INIT & aFlags) { if (aDOMEvent) { if (*aDOMEvent) { - externalDOMEvent = PR_TRUE; + externalDOMEvent = PR_TRUE; } } else { @@ -3477,37 +3588,48 @@ nsresult nsDocument::HandleDOMEvent(nsIPresContext* aPresContext, aFlags &= ~(NS_EVENT_FLAG_CANT_BUBBLE | NS_EVENT_FLAG_CANT_CANCEL); aFlags |= NS_EVENT_FLAG_BUBBLE | NS_EVENT_FLAG_CAPTURE; } - - //Capturing stage + + // Capturing stage if (NS_EVENT_FLAG_CAPTURE & aFlags && nsnull != mScriptGlobalObject) { - mScriptGlobalObject->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, aFlags & NS_EVENT_CAPTURE_MASK, aEventStatus); + mScriptGlobalObject->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags & NS_EVENT_CAPTURE_MASK, + aEventStatus); } - - //Local handling stage - //Check for null mDOMSlots or ELM, check if we're a non-bubbling event in the bubbling state (bubbling state - //is indicated by the presence of the NS_EVENT_FLAG_BUBBLE flag and not the NS_EVENT_FLAG_INIT). + + // Local handling stage + // Check for null mDOMSlots or ELM, check if we're a non-bubbling + // event in the bubbling state (bubbling state is indicated by the + // presence of the NS_EVENT_FLAG_BUBBLE flag and not the + // NS_EVENT_FLAG_INIT). if (mListenerManager && - !(NS_EVENT_FLAG_CANT_BUBBLE & aEvent->flags && NS_EVENT_FLAG_BUBBLE & aFlags && !(NS_EVENT_FLAG_INIT & aFlags))) { + !(NS_EVENT_FLAG_CANT_BUBBLE & aEvent->flags && + NS_EVENT_FLAG_BUBBLE & aFlags && !(NS_EVENT_FLAG_INIT & aFlags))) { aEvent->flags |= aFlags; - mListenerManager->HandleEvent(aPresContext, aEvent, aDOMEvent, this, aFlags, aEventStatus); + mListenerManager->HandleEvent(aPresContext, aEvent, aDOMEvent, this, + aFlags, aEventStatus); aEvent->flags &= ~aFlags; } - //Bubbling stage + // Bubbling stage if (NS_EVENT_FLAG_BUBBLE & aFlags && nsnull != mScriptGlobalObject) { - mScriptGlobalObject->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, aFlags & NS_EVENT_BUBBLE_MASK, aEventStatus); + mScriptGlobalObject->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags & NS_EVENT_BUBBLE_MASK, + aEventStatus); } if (NS_EVENT_FLAG_INIT & aFlags) { - // We're leaving the DOM event loop so if we created a DOM event, release here. + // We're leaving the DOM event loop so if we created a DOM event, + // release here. if (*aDOMEvent && !externalDOMEvent) { nsrefcnt rc; NS_RELEASE2(*aDOMEvent, rc); if (0 != rc) { - // Okay, so someone in the DOM loop (a listener, JS object) still has - // a ref to the DOM Event but the internal data hasn't been malloc'd. - // Force a copy of the data here so the DOM Event is still valid. - nsCOMPtr privateEvent = do_QueryInterface(*aDOMEvent); + // Okay, so someone in the DOM loop (a listener, JS object) + // still has a ref to the DOM Event but the internal data + // hasn't been malloc'd. Force a copy of the data here so the + // DOM Event is still valid. + nsCOMPtr privateEvent = + do_QueryInterface(*aDOMEvent); if (privateEvent) { privateEvent->DuplicatePrivateData(); } @@ -3519,15 +3641,9 @@ nsresult nsDocument::HandleDOMEvent(nsIPresContext* aPresContext, return mRet; } -NS_IMETHODIMP_(PRBool) -nsDocument::EventCaptureRegistration(PRInt32 aCapturerIncrement) -{ - mNumCapturers += aCapturerIncrement; - NS_WARN_IF_FALSE(mNumCapturers >= 0, "Number of capturers has become negative"); - return (mNumCapturers > 0 ? PR_TRUE : PR_FALSE); -} - -nsresult nsDocument::AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID) +nsresult +nsDocument::AddEventListenerByIID(nsIDOMEventListener *aListener, + const nsIID& aIID) { nsCOMPtr manager; @@ -3536,26 +3652,35 @@ nsresult nsDocument::AddEventListenerByIID(nsIDOMEventListener *aListener, const manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); return NS_OK; } + return NS_ERROR_FAILURE; } -nsresult nsDocument::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID) +nsresult +nsDocument::RemoveEventListenerByIID(nsIDOMEventListener *aListener, + const nsIID& aIID) { - if (nsnull != mListenerManager) { - mListenerManager->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); - return NS_OK; + if (!mListenerManager) { + return NS_ERROR_FAILURE; } - return NS_ERROR_FAILURE; + + mListenerManager->RemoveEventListenerByIID(aListener, aIID, + NS_EVENT_FLAG_BUBBLE); + return NS_OK; } -nsresult nsDocument::AddEventListener(const nsAString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) +nsresult +nsDocument::AddEventListener(const nsAString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) { return AddGroupedEventListener(aType, aListener, aUseCapture, nsnull); } -nsresult nsDocument::RemoveEventListener(const nsAString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) +nsresult +nsDocument::RemoveEventListener(const nsAString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) { return RemoveGroupedEventListener(aType, aListener, aUseCapture, nsnull); } @@ -3572,23 +3697,24 @@ nsDocument::DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval) GetShellAt(0, getter_AddRefs(shell)); if (!shell) return NS_ERROR_FAILURE; - + // Retrieve the context nsCOMPtr presContext; shell->GetPresContext(getter_AddRefs(presContext)); nsCOMPtr esm; - if (NS_SUCCEEDED(presContext->GetEventStateManager(getter_AddRefs(esm)))) { - return esm->DispatchNewEvent(NS_STATIC_CAST(nsIDOMDocument *, this), - aEvent, _retval); - } + nsresult rv = presContext->GetEventStateManager(getter_AddRefs(esm)); + NS_ENSURE_SUCCESS(rv, rv); - return NS_ERROR_FAILURE; + return esm->DispatchNewEvent(NS_STATIC_CAST(nsIDOMDocument *, this), aEvent, + _retval); } NS_IMETHODIMP -nsDocument::AddGroupedEventListener(const nsAString & aType, nsIDOMEventListener *aListener, - PRBool aUseCapture, nsIDOMEventGroup *aEvtGrp) +nsDocument::AddGroupedEventListener(const nsAString& aType, + nsIDOMEventListener *aListener, + PRBool aUseCapture, + nsIDOMEventGroup *aEvtGrp) { nsCOMPtr manager; @@ -3599,20 +3725,25 @@ nsDocument::AddGroupedEventListener(const nsAString & aType, nsIDOMEventListener manager->AddEventListenerByType(aListener, aType, flags, aEvtGrp); return NS_OK; } + return rv; } NS_IMETHODIMP -nsDocument::RemoveGroupedEventListener(const nsAString & aType, nsIDOMEventListener *aListener, - PRBool aUseCapture, nsIDOMEventGroup *aEvtGrp) +nsDocument::RemoveGroupedEventListener(const nsAString& aType, + nsIDOMEventListener *aListener, + PRBool aUseCapture, + nsIDOMEventGroup *aEvtGrp) { - if (mListenerManager) { - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - mListenerManager->RemoveEventListenerByType(aListener, aType, flags, aEvtGrp); - return NS_OK; + if (!mListenerManager) { + return NS_ERROR_FAILURE; } - return NS_ERROR_FAILURE; + + PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; + + mListenerManager->RemoveEventListenerByType(aListener, aType, flags, + aEvtGrp); + return NS_OK; } NS_IMETHODIMP @@ -3628,32 +3759,27 @@ nsDocument::IsRegisteredHere(const nsAString & type, PRBool *_retval) } NS_IMETHODIMP -nsDocument::CreateEvent(const nsAString& aEventType, - nsIDOMEvent** aReturn) +nsDocument::CreateEvent(const nsAString& aEventType, nsIDOMEvent** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = nsnull; // Obtain a presentation context - PRInt32 count = GetNumberOfShells(); - if (count == 0) - return NS_OK; nsCOMPtr shell; GetShellAt(0, getter_AddRefs(shell)); - if (!shell) - return NS_ERROR_FAILURE; - - // Retrieve the context - nsCOMPtr presContext; - shell->GetPresContext(getter_AddRefs(presContext)); - if (presContext) { - nsCOMPtr manager; - GetListenerManager(getter_AddRefs(manager)); - if (manager) { - return manager->CreateEvent(presContext, nsnull, aEventType, aReturn); - } + nsCOMPtr presContext; + + if (shell) { + // Retrieve the context + shell->GetPresContext(getter_AddRefs(presContext)); + } + + nsCOMPtr manager; + GetListenerManager(getter_AddRefs(manager)); + if (manager) { + return manager->CreateEvent(presContext, nsnull, aEventType, aReturn); } return NS_ERROR_FAILURE; @@ -3662,61 +3788,62 @@ nsDocument::CreateEvent(const nsAString& aEventType, NS_IMETHODIMP nsDocument::CreateEventGroup(nsIDOMEventGroup **aInstancePtrResult) { - nsresult result; - nsCOMPtr group(do_CreateInstance(kDOMEventGroupCID,&result)); - if (NS_FAILED(result)) - return result; + nsresult rv; + nsCOMPtr group(do_CreateInstance(kDOMEventGroupCID, &rv)); + NS_ENSURE_SUCCESS(rv, rv); - *aInstancePtrResult = group.get(); + *aInstancePtrResult = group; NS_ADDREF(*aInstancePtrResult); + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsDocument::FlushPendingNotifications(PRBool aFlushReflows, PRBool aUpdateViews) { - if (aFlushReflows && mScriptGlobalObject) { - // We should be able to replace all this nsIDocShell* code with - // code that uses mParentDocument, but mParentDocument is never - // set in the current code! + if (!aFlushReflows || !mScriptGlobalObject) { + return NS_OK; + } - nsCOMPtr docShell; - mScriptGlobalObject->GetDocShell(getter_AddRefs(docShell)); + // We should be able to replace all this nsIDocShell* code with code + // that uses mParentDocument, but mParentDocument is never set in + // the current code! - nsCOMPtr docShellAsItem = - do_QueryInterface(docShell); + nsCOMPtr docShell; + mScriptGlobalObject->GetDocShell(getter_AddRefs(docShell)); - if (docShellAsItem) { - nsCOMPtr docShellParent; - docShellAsItem->GetSameTypeParent(getter_AddRefs(docShellParent)); + nsCOMPtr docShellAsItem(do_QueryInterface(docShell)); - nsCOMPtr win(do_GetInterface(docShellParent)); + if (docShellAsItem) { + nsCOMPtr docShellParent; + docShellAsItem->GetSameTypeParent(getter_AddRefs(docShellParent)); - if (win) { - nsCOMPtr dom_doc; - win->GetDocument(getter_AddRefs(dom_doc)); + nsCOMPtr win(do_GetInterface(docShellParent)); - nsCOMPtr doc(do_QueryInterface(dom_doc)); + if (win) { + nsCOMPtr dom_doc; + win->GetDocument(getter_AddRefs(dom_doc)); - if (doc) { - // If we have a parent we must flush the parent too to ensure - // that our container is reflown if its size was changed. + nsCOMPtr doc(do_QueryInterface(dom_doc)); - doc->FlushPendingNotifications(aFlushReflows, aUpdateViews); - } + if (doc) { + // If we have a parent we must flush the parent too to ensure + // that our container is reflown if its size was changed. + + doc->FlushPendingNotifications(aFlushReflows, aUpdateViews); } } + } - PRInt32 i, count = mPresShells.Count(); + PRInt32 i, count = mPresShells.Count(); - for (i = 0; i < count; i++) { - nsCOMPtr shell = - NS_STATIC_CAST(nsIPresShell*, mPresShells[i]); + for (i = 0; i < count; i++) { + nsCOMPtr shell = + NS_STATIC_CAST(nsIPresShell*, mPresShells[i]); - if (shell) { - shell->FlushPendingNotifications(aUpdateViews); - } + if (shell) { + shell->FlushPendingNotifications(aUpdateViews); } } @@ -3727,6 +3854,7 @@ NS_IMETHODIMP nsDocument::GetAndIncrementContentID(PRInt32* aID) { *aID = mNextContentID++; + return NS_OK; } @@ -3735,6 +3863,7 @@ nsDocument::GetBindingManager(nsIBindingManager** aResult) { *aResult = mBindingManager; NS_IF_ADDREF(*aResult); + return NS_OK; } @@ -3809,13 +3938,15 @@ nsDocument::GetRadioGroup(const nsAString& aName, nsRadioGroupStruct **aRadioGroup) { nsStringKey key(aName); - nsRadioGroupStruct* radioGroup = (nsRadioGroupStruct*)mRadioGroups.Get(&key); - + nsRadioGroupStruct *radioGroup = + NS_STATIC_CAST(nsRadioGroupStruct *, mRadioGroups.Get(&key)); + if (!radioGroup) { radioGroup = new nsRadioGroupStruct(); NS_ENSURE_TRUE(radioGroup, NS_ERROR_OUT_OF_MEMORY); mRadioGroups.Put(&key, radioGroup); } + *aRadioGroup = radioGroup; return NS_OK; @@ -3830,6 +3961,7 @@ nsDocument::SetCurrentRadioButton(const nsAString& aName, if (radioGroup) { radioGroup->mSelectedRadioButton = aRadio; } + return NS_OK; } @@ -3843,6 +3975,7 @@ nsDocument::GetCurrentRadioButton(const nsAString& aName, *aRadio = radioGroup->mSelectedRadioButton; NS_IF_ADDREF(*aRadio); } + return NS_OK; } @@ -3856,6 +3989,7 @@ nsDocument::AddToRadioGroup(const nsAString& aName, radioGroup->mRadioButtons.AppendElement(aRadio); NS_IF_ADDREF(aRadio); } + return NS_OK; } @@ -3870,6 +4004,7 @@ nsDocument::RemoveFromRadioGroup(const nsAString& aName, NS_IF_RELEASE(aRadio); } } + return NS_OK; } @@ -3877,44 +4012,49 @@ NS_IMETHODIMP nsDocument::WalkRadioGroup(const nsAString& aName, nsIRadioVisitor* aVisitor) { - nsresult rv = NS_OK; nsRadioGroupStruct* radioGroup = nsnull; GetRadioGroup(aName, &radioGroup); - if (radioGroup) { - PRBool stop = PR_FALSE; - for (int i = 0; i < radioGroup->mRadioButtons.Count(); i++) { - aVisitor->Visit(NS_STATIC_CAST(nsIFormControl *, - radioGroup->mRadioButtons.ElementAt(i)), &stop); - if (stop) { - break; - } + if (!radioGroup) { + return NS_OK; + } + + PRBool stop = PR_FALSE; + for (int i = 0; i < radioGroup->mRadioButtons.Count(); i++) { + aVisitor->Visit(NS_STATIC_CAST(nsIFormControl *, + radioGroup->mRadioButtons.ElementAt(i)), + &stop); + if (stop) { + return NS_OK; } } - return rv; + + return NS_OK; } /** - * Check if bidi enabled (set depending on the presence of RTL - * characters). If enabled, we should apply the Unicode Bidi Algorithm + * Check if bidi enabled (set depending on the presence of RTL + * characters). If enabled, we should apply the Unicode Bidi Algorithm * - * @lina 07/12/2000 + * @lina 07/12/2000 */ NS_IMETHODIMP nsDocument::GetBidiEnabled(PRBool* aBidiEnabled) const { NS_ENSURE_ARG_POINTER(aBidiEnabled); *aBidiEnabled = mBidiEnabled; + return NS_OK; } /** - * Indicate the document contains RTL characters. + * Indicate the document contains RTL characters. * - * @lina 07/12/2000 + * @lina 07/12/2000 */ NS_IMETHODIMP nsDocument::SetBidiEnabled(PRBool aBidiEnabled) { mBidiEnabled = aBidiEnabled; + return NS_OK; } diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index 6b5f9055d2d..93bcbc2fe3b 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -38,9 +38,13 @@ #ifndef nsDocument_h___ #define nsDocument_h___ +#include "nsCOMPtr.h" +#include "nsAutoPtr.h" +#include "nsCRT.h" #include "nsIDocument.h" #include "nsWeakReference.h" #include "nsWeakPtr.h" +#include "nsIArena.h" #include "nsVoidArray.h" #include "nsIDOMXMLDocument.h" #include "nsIDOMDocumentView.h" @@ -56,6 +60,7 @@ #include "nsIScriptGlobalObject.h" #include "nsIDOMEventTarget.h" #include "nsIContent.h" +#include "nsIEventListenerManager.h" #include "nsGenericDOMNodeList.h" #include "nsIPrincipal.h" #include "nsIBindingManager.h" @@ -84,51 +89,25 @@ class nsIDTD; class nsXPathDocumentTearoff; class nsIRadioVisitor; class nsIFormControl; - struct nsRadioGroupStruct; -#if 0 -class nsPostData : public nsIPostData { -public: - nsPostData(PRBool aIsFile, char* aData); - - NS_DECL_ISUPPORTS - - virtual PRBool IsFile(); - virtual const char* GetData(); - virtual PRInt32 GetDataLength(); - -protected: - virtual ~nsPostData(); - - PRBool mIsFile; - char* mData; - PRInt32 mDataLen; -}; -#endif class nsDocHeaderData { public: nsDocHeaderData(nsIAtom* aField, const nsAString& aData) + : mField(aField), mData(aData), mNext(nsnull) { - mField = aField; - NS_IF_ADDREF(mField); - mData.Assign(aData); - mNext = nsnull; - } - ~nsDocHeaderData(void) - { - NS_IF_RELEASE(mField); - if (nsnull != mNext) { - delete mNext; - mNext = nsnull; - } } - nsIAtom* mField; - nsString mData; - nsDocHeaderData* mNext; + ~nsDocHeaderData(void) + { + delete mNext; + } + + nsCOMPtr mField; + nsString mData; + nsDocHeaderData* mNext; }; // Represents the children of a document (prolog, epilog and @@ -145,6 +124,8 @@ public: void DropReference(); protected: + nsDocumentChildNodes(); // Not implemented + nsIDocument* mDocument; }; @@ -159,7 +140,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIDOMSTYLESHEETLIST - + NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; } NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; } NS_IMETHOD BeginLoad(nsIDocument *aDocument) { return NS_OK; } @@ -167,7 +148,7 @@ public: NS_IMETHOD BeginReflow(nsIDocument *aDocument, nsIPresShell* aShell) { return NS_OK; } NS_IMETHOD EndReflow(nsIDocument *aDocument, - nsIPresShell* aShell) { return NS_OK; } + nsIPresShell* aShell) { return NS_OK; } NS_IMETHOD ContentChanged(nsIDocument *aDocument, nsIContent* aContent, nsISupports* aSubContent) { return NS_OK; } @@ -183,7 +164,7 @@ public: nsChangeHint aHint) { return NS_OK; } NS_IMETHOD ContentAppended(nsIDocument *aDocument, nsIContent* aContainer, - PRInt32 aNewIndexInContainer) + PRInt32 aNewIndexInContainer) { return NS_OK; } NS_IMETHOD ContentInserted(nsIDocument *aDocument, nsIContent* aContainer, @@ -224,28 +205,6 @@ protected: }; -// Helper structs for the content->subdoc map - -class SubDocMapEntry : public PLDHashEntryHdr -{ -public: - // Both of these are strong references - nsIContent *mKey; // must be first, to look like PLDHashEntryStub - nsIDocument *mSubDocument; -}; - -struct FindContentData -{ - FindContentData(nsIDocument *aSubDoc) - : mSubDocument(aSubDoc), mResult(nsnull) - { - } - - nsISupports *mSubDocument; - nsIContent *mResult; -}; - - // Base class for our document implementations. // // Note that this class *implements* nsIDOMXMLDocument, but it's not @@ -255,8 +214,8 @@ struct FindContentData // nsIDOMXMLDocument's. nsDocument's QI should *not* claim to support // nsIDOMXMLDocument unless someone writes a real implementation of // the interface. -class nsDocument : public nsIDocument, - public nsIDOMXMLDocument, // inherits nsIDOMDocument +class nsDocument : public nsIDocument, + public nsIDOMXMLDocument, // inherits nsIDOMDocument public nsIDOMNSDocument, public nsIDOMDocumentEvent, public nsIDOM3DocumentEvent, @@ -275,6 +234,8 @@ class nsDocument : public nsIDocument, public: NS_DECL_ISUPPORTS + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW + NS_IMETHOD GetArena(nsIArena** aArena); NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup); @@ -293,7 +254,7 @@ public: /** * Return the title of the document. May return null. */ - virtual const nsString* GetDocumentTitle() const; + NS_IMETHOD GetDocumentTitle(nsAString& aTitle) const; /** * Return the URL for the document. May return null. @@ -396,13 +357,10 @@ public: * it's presentation context (presentation context's must not be * shared among multiple presentation shell's). */ -#if 0 - // XXX Temp hack: moved to nsMarkupDocument NS_IMETHOD CreateShell(nsIPresContext* aContext, nsIViewManager* aViewManager, nsIStyleSet* aStyleSet, nsIPresShell** aInstancePtrResult); -#endif virtual PRBool DeleteShell(nsIPresShell* aShell); virtual PRInt32 GetNumberOfShells(); NS_IMETHOD GetShellAt(PRInt32 aIndex, nsIPresShell** aShell); @@ -425,7 +383,7 @@ public: NS_IMETHOD GetRootContent(nsIContent** aRoot); NS_IMETHOD SetRootContent(nsIContent* aRoot); - /** + /** * Get the direct children of the document - content in * the prolog, the root content and content in the epilog. */ @@ -444,7 +402,7 @@ public: NS_IMETHOD GetIndexOfStyleSheet(nsIStyleSheet* aSheet, PRInt32* aIndex); virtual void AddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags); virtual void RemoveStyleSheet(nsIStyleSheet* aSheet); - + NS_IMETHOD UpdateStyleSheets(nsCOMArray& aOldSheets, nsCOMArray& aNewSheets); virtual void AddStyleSheetToStyleSets(nsIStyleSheet* aSheet); @@ -456,7 +414,7 @@ public: /** * Set the object from which a document can get a script context. - * This is the context within which all scripts (during document + * This is the context within which all scripts (during document * creation and during event handling) will run. */ NS_IMETHOD GetScriptGlobalObject(nsIScriptGlobalObject** aGlobalObject); @@ -464,7 +422,7 @@ public: /** * Get the script loader for this document - */ + */ NS_IMETHOD GetScriptLoader(nsIScriptLoader** aScriptLoader); /** @@ -543,7 +501,7 @@ public: nsIFormControl* aRadio); NS_IMETHOD RemoveFromRadioGroup(const nsAString& aName, nsIFormControl* aRadio); - + // for radio group nsresult GetRadioGroup(const nsAString& aName, nsRadioGroupStruct **aRadioGroup); @@ -599,15 +557,10 @@ public: // nsIDOM3EventTarget NS_DECL_NSIDOM3EVENTTARGET - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, - nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, - PRUint32 aFlags, + NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, PRUint32 aFlags, nsEventStatus* aEventStatus); - NS_IMETHOD_(PRBool) EventCaptureRegistration(PRInt32 aCapturerIncrement); - - NS_IMETHOD SetDocumentURL(nsIURI* aURI); virtual nsresult Init(); @@ -621,56 +574,74 @@ protected: virtual already_AddRefed InternalGetStyleSheetAt(PRInt32 aIndex); virtual PRInt32 InternalGetNumberOfStyleSheets(); - nsDocument(); - virtual ~nsDocument(); + nsresult doCreateShell(nsIPresContext* aContext, + nsIViewManager* aViewManager, nsIStyleSet* aStyleSet, + nsCompatibility aCompatMode, + nsIPresShell** aInstancePtrResult); - nsIArena* mArena; + nsDocument(); + virtual ~nsDocument(); + + nsCOMPtr mArena; nsString mDocumentTitle; - nsIURI* mDocumentURL; + nsCOMPtr mDocumentURL; nsCOMPtr mDocumentBaseURL; nsCOMPtr mPrincipal; - PRUint32 mLoadFlags; // load flags of the document's channel + nsWeakPtr mDocumentLoadGroup; + nsWeakPtr mDocumentContainer; nsString mCharacterSet; PRInt32 mCharacterSetSource; - + nsVoidArray mCharSetObservers; nsIDocument* mParentDocument; PLDHashTable *mSubDocuments; - nsVoidArray mPresShells; - nsCOMArray mChildren; // contains owning references - nsIContent* mRootContent; // a weak reference to the only element in - // mChildren, or null if no such element exists. + nsSmallVoidArray mPresShells; + + // Array of owning references to all children + nsCOMArray mChildren; + + // A weak reference to the only element in mChildren, or null if no + // such element exists. + nsIContent* mRootContent; + nsCOMArray mStyleSheets; - nsAutoVoidArray mObservers; // basically always has at least 1 entry + + // Basically always has at least 1 entry + nsAutoVoidArray mObservers; nsCOMPtr mScriptGlobalObject; - nsIEventListenerManager* mListenerManager; - PRBool mInDestructor; + nsCOMPtr mListenerManager; nsCOMPtr mDOMStyleSheets; nsCOMPtr mScriptLoader; nsDocHeaderData* mHeaderData; nsCOMPtr mLineBreaker; nsCOMPtr mWordBreaker; - nsDocumentChildNodes* mChildNodes; - // A content ID counter used to give a monotonically increasing ID to the content - // objects in the document's content model + + nsRefPtr mChildNodes; + + // A content ID counter used to give a monotonically increasing ID + // to the content objects in the document's content model PRInt32 mNextContentID; nsHashtable mRadioGroups; - PRBool mBidiEnabled; - nsCOMPtr mBindingManager; nsCOMPtr mNodeInfoManager; - PRBool mIsGoingAway; // True if the document is being destroyed. + // True if the document is being destroyed. + PRPackedBool mIsGoingAway; + + // True if BIDI is enabled. + PRPackedBool mBidiEnabled; + + // True if the document is being destroyed. + PRPackedBool mInDestructor; nsSupportsHashtable* mBoxObjectTable; - PRInt32 mNumCapturers; //Number of capturing event handlers in doc. Used to optimize event delivery. nsSupportsHashtable mContentWrapperHash; diff --git a/content/base/src/nsDocumentViewer.cpp b/content/base/src/nsDocumentViewer.cpp index fe0a4835cef..a4f208ff357 100644 --- a/content/base/src/nsDocumentViewer.cpp +++ b/content/base/src/nsDocumentViewer.cpp @@ -1166,7 +1166,7 @@ NS_IMETHODIMP DocumentViewerImpl::GetDOMDocument(nsIDOMDocument **aResult) { NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE); - return CallQueryInterface(mDocument.get(), aResult); + return CallQueryInterface(mDocument, aResult); } NS_IMETHODIMP diff --git a/content/base/src/nsPrintEngine.cpp b/content/base/src/nsPrintEngine.cpp index 3aab73eb849..1d5bfbc6e98 100644 --- a/content/base/src/nsPrintEngine.cpp +++ b/content/base/src/nsPrintEngine.cpp @@ -1873,9 +1873,10 @@ nsPrintEngine::GetWebShellTitleAndURL(nsIWebShell* aWebShell, *aTitle = nsnull; *aURLStr = nsnull; - const nsString* docTitle = aDoc->GetDocumentTitle(); - if (docTitle && !docTitle->IsEmpty()) { - *aTitle = ToNewUnicode(*docTitle); + nsAutoString docTitle; + aDoc->GetDocumentTitle(docTitle); + if (!docTitle.IsEmpty()) { + *aTitle = ToNewUnicode(docTitle); } nsCOMPtr url; diff --git a/content/base/src/nsXMLContentSerializer.cpp b/content/base/src/nsXMLContentSerializer.cpp index 0a3d04cd092..f6b52fc9e3b 100644 --- a/content/base/src/nsXMLContentSerializer.cpp +++ b/content/base/src/nsXMLContentSerializer.cpp @@ -444,7 +444,6 @@ nsXMLContentSerializer::AppendElementStart(nsIDOMElement *aElement, *getter_AddRefs(attrPrefix)); if (namespaceID == kNameSpaceID_XMLNS) { - PRBool hasPrefix = attrPrefix ? PR_TRUE : PR_FALSE; content->GetAttr(namespaceID, attrName, uriStr); if (!attrPrefix) { diff --git a/content/events/src/nsDOMEvent.cpp b/content/events/src/nsDOMEvent.cpp index ebe844b0f6c..869cfee9dd4 100644 --- a/content/events/src/nsDOMEvent.cpp +++ b/content/events/src/nsDOMEvent.cpp @@ -1529,10 +1529,10 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType) return nsnull; } -nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult, - nsIPresContext* aPresContext, - const nsAString& aEventType, - nsEvent *aEvent) +nsresult +NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult, + nsIPresContext* aPresContext, const nsAString& aEventType, + nsEvent *aEvent) { nsDOMEvent* it = new nsDOMEvent(aPresContext, aEvent, aEventType); @@ -1543,7 +1543,9 @@ nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult, return CallQueryInterface(it, aInstancePtrResult); } -nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext* aPresContext, nsEvent *aEvent) +nsresult +NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext* aPresContext, + nsEvent *aEvent) { return NS_ERROR_FAILURE; } diff --git a/content/events/src/nsEventListenerManager.cpp b/content/events/src/nsEventListenerManager.cpp index 1d46ee775d2..b869e892f1c 100644 --- a/content/events/src/nsEventListenerManager.cpp +++ b/content/events/src/nsEventListenerManager.cpp @@ -493,19 +493,6 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener, listeners->AppendElement((void*)ls); NS_ADDREF(aListener); } - - if (aFlags & NS_EVENT_FLAG_CAPTURE) { - //If a capturer is set up on a content object it must register that with its doc - nsCOMPtr document; - nsCOMPtr content(do_QueryInterface(mTarget)); - if (content) { - content->GetDocument(*getter_AddRefs(document)); - if (document) { - //Increment capturers by 1 - document->EventCaptureRegistration(1); - } - } - } } return NS_OK; @@ -561,19 +548,6 @@ nsEventListenerManager::RemoveEventListener(nsIDOMEventListener *aListener, } } - if (listenerRemoved && aFlags & NS_EVENT_FLAG_CAPTURE) { - //If a capturer is set up on a content object it must register that with its doc - nsCOMPtr document; - nsCOMPtr content(do_QueryInterface(mTarget)); - if (content) { - content->GetDocument(*getter_AddRefs(document)); - if (document) { - //Decrement capturers by 1 - document->EventCaptureRegistration(-1); - } - } - } - return NS_OK; } diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 962b980ced4..aeb8626a50e 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -90,7 +90,7 @@ #include "nsXULAtoms.h" #include "nsIDOMXULElement.h" -#include "nsIDOMXULDocument.h" +#include "nsIDOMDocument.h" #include "nsIDOMKeyEvent.h" #include "nsIObserverService.h" #include "nsIDocShell.h" @@ -641,7 +641,6 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext, nsCOMPtr focusController; nsCOMPtr focusedElement; nsCOMPtr focusedWindow; - nsCOMPtr xulDoc = do_QueryInterface(mDocument); nsCOMPtr globalObj; mDocument->GetScriptGlobalObject(getter_AddRefs(globalObj)); @@ -4479,7 +4478,7 @@ nsEventStateManager::DispatchNewEvent(nsISupports* aTarget, nsIDOMEvent* aEvent, } } - *aPreventDefault = status == nsEventStatus_eConsumeNoDefault ? PR_FALSE : PR_TRUE; + *aPreventDefault = status != nsEventStatus_eConsumeNoDefault; } } diff --git a/content/html/document/src/Makefile.in b/content/html/document/src/Makefile.in index f48f82c13f8..98e93e4edf0 100644 --- a/content/html/document/src/Makefile.in +++ b/content/html/document/src/Makefile.in @@ -68,7 +68,6 @@ CPPSRCS = \ nsMediaDocument.cpp \ nsPluginDocument.cpp \ nsImageDocument.cpp \ - nsMarkupDocument.cpp \ nsWyciwygChannel.cpp \ nsWyciwygProtocolHandler.cpp \ $(NULL) diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index b07ab58f1c7..bfd3d88441a 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -54,14 +54,14 @@ #include "nsIStyleSet.h" #include "nsHTMLAtoms.h" #include "nsLayoutAtoms.h" -#include "nsIPresShell.h" -#include "nsIPresContext.h" +#include "nsIPresShell.h" +#include "nsIPresContext.h" #include "nsIHTMLContent.h" #include "nsIDOMNode.h" // for Find #include "nsIDOMNodeList.h" #include "nsIDOMElement.h" #include "nsIDOMText.h" -#include "nsIDOMComment.h" +#include "nsIDOMComment.h" #include "nsIDOMDOMImplementation.h" #include "nsIDOMDocumentType.h" #include "nsIDOMWindowInternal.h" @@ -130,7 +130,7 @@ #include "nsIWyciwygChannel.h" #include "nsIPrompt.h" -//AHMED 12-2 +//AHMED 12-2 #include "nsBidiUtils.h" #include "nsIEditingSession.h" @@ -169,25 +169,34 @@ nsrefcnt nsHTMLDocument::gRefCntRDFService = 0; static int PR_CALLBACK MyPrefChangedCallback(const char*aPrefName, void* instance_data) { - nsresult rv; - nsCOMPtr prefs = - do_GetService(NS_PREF_CONTRACTID, &rv); - PRUnichar* detector_name = nsnull; - if(NS_SUCCEEDED(rv) && NS_SUCCEEDED( - rv = prefs->GetLocalizedUnicharPref("intl.charset.detector", - &detector_name))) - { - if(detector_name && *detector_name) { - PL_strncpy(g_detector_contractid, NS_CHARSET_DETECTOR_CONTRACTID_BASE,DETECTOR_CONTRACTID_MAX); - PL_strncat(g_detector_contractid, NS_ConvertUCS2toUTF8(detector_name).get(),DETECTOR_CONTRACTID_MAX); - gPlugDetector = PR_TRUE; - } else { - g_detector_contractid[0]=0; - gPlugDetector = PR_FALSE; - } - PR_FREEIF(detector_name); - } - return 0; + nsresult rv; + nsCOMPtr prefs = + do_GetService("@mozilla.org/preferences;1", &rv); + if (NS_FAILED(rv)) { + return 0; + } + + nsXPIDLString detector_name; + + rv = prefs->GetLocalizedUnicharPref("intl.charset.detector", + getter_Copies(detector_name)); + if (NS_FAILED(rv)) { + return 0; + } + + if (detector_name.Length() > 0) { + PL_strncpy(g_detector_contractid, NS_CHARSET_DETECTOR_CONTRACTID_BASE, + DETECTOR_CONTRACTID_MAX); + PL_strncat(g_detector_contractid, + NS_ConvertUCS2toUTF8(detector_name).get(), + DETECTOR_CONTRACTID_MAX); + gPlugDetector = PR_TRUE; + } else { + g_detector_contractid[0]=0; + gPlugDetector = PR_FALSE; + } + + return 0; } // ================================================================== @@ -264,7 +273,7 @@ IdAndNameHashClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry) { IdAndNameMapEntry *e = NS_STATIC_CAST(IdAndNameMapEntry *, entry); - // An entry is being cleared, let the entry its own cleanup. + // An entry is being cleared, let the entry do its own cleanup. e->~IdAndNameMapEntry(); } @@ -278,34 +287,17 @@ IdAndNameHashInitEntry(PLDHashTable *table, PLDHashEntryHdr *entry, new (entry) IdAndNameMapEntry(*keyStr); } + // NOTE! nsDocument::operator new() zeroes out all members, so don't + // bother initializing members to 0. + nsHTMLDocument::nsHTMLDocument() - : nsMarkupDocument(), - mBaseURL(nsnull), - mBaseTarget(nsnull), - mLastModified(nsnull), - mReferrer(nsnull), - mNumForms(0), - mIsWriting(0), - mDomainWasSet(PR_FALSE), - mEditingIsOn(PR_FALSE) + : mCompatMode(eCompatibility_NavQuirks), + mTexttype(IBMBIDI_TEXTTYPE_LOGICAL) { - mImages = nsnull; - mApplets = nsnull; - mEmbeds = nsnull; - mLinks = nsnull; - mAnchors = nsnull; - mLayers = nsnull; - mParser = nsnull; - mCompatMode = eCompatibility_NavQuirks; - mCSSLoader = nsnull; - mForms = nsnull; - mIsWriting = 0; - mWriteLevel = 0; - mWyciwygSessionCnt = 0; + // NOTE! nsDocument::operator new() zeroes out all members, so don't + // bother initializing members to 0. - mTexttype = IBMBIDI_TEXTTYPE_LOGICAL; - if (gRefCntRDFService++ == 0) { CallGetService(kRDFServiceCID, &gRDF); @@ -314,43 +306,19 @@ nsHTMLDocument::nsHTMLDocument() nsHTMLDocument::~nsHTMLDocument() { - NS_IF_RELEASE(mImages); - NS_IF_RELEASE(mApplets); - NS_IF_RELEASE(mEmbeds); - NS_IF_RELEASE(mLinks); - NS_IF_RELEASE(mAnchors); - NS_IF_RELEASE(mLayers); if (mAttrStyleSheet) { mAttrStyleSheet->SetOwningDocument(nsnull); } + if (mStyleAttrStyleSheet) { mStyleAttrStyleSheet->SetOwningDocument(nsnull); } - NS_IF_RELEASE(mBaseURL); - if (nsnull != mBaseTarget) { - delete mBaseTarget; - mBaseTarget = nsnull; - } - if (nsnull != mLastModified) { - delete mLastModified; - mLastModified = nsnull; - } - if (nsnull != mReferrer) { - delete mReferrer; - mReferrer = nsnull; - } - NS_IF_RELEASE(mParser); - mImageMaps->Clear(); - NS_IF_RELEASE(mForms); - if (mCSSLoader) { - mCSSLoader->DropDocumentReference(); // release weak ref - } if (--gRefCntRDFService == 0) { NS_IF_RELEASE(gRDF); } - if (mIdAndNameHashIsLive) { + if (mIdAndNameHashTable.ops) { PL_DHashTableFinish(&mIdAndNameHashTable); } } @@ -375,9 +343,6 @@ nsHTMLDocument::Init() nsresult rv = nsDocument::Init(); NS_ENSURE_SUCCESS(rv, rv); - rv = NS_NewISupportsArray(getter_AddRefs(mImageMaps)); - NS_ENSURE_SUCCESS(rv, rv); - static PLDHashTableOps hash_table_ops = { PL_DHashAllocTable, @@ -391,10 +356,13 @@ nsHTMLDocument::Init() IdAndNameHashInitEntry }; - mIdAndNameHashIsLive = PL_DHashTableInit(&mIdAndNameHashTable, - &hash_table_ops, nsnull, - sizeof(IdAndNameMapEntry), 16); - NS_ENSURE_TRUE(mIdAndNameHashIsLive, NS_ERROR_OUT_OF_MEMORY); + PRBool ok = PL_DHashTableInit(&mIdAndNameHashTable, &hash_table_ops, nsnull, + sizeof(IdAndNameMapEntry), 16); + if (!ok) { + mIdAndNameHashTable.ops = nsnull; + + return NS_ERROR_OUT_OF_MEMORY; + } PrePopulateHashTables(); @@ -402,70 +370,82 @@ nsHTMLDocument::Init() } +NS_IMETHODIMP +nsHTMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) +{ + nsresult rv = nsDocument::Reset(aChannel, aLoadGroup); + + if (NS_SUCCEEDED(rv) && aChannel) { + aChannel->GetLoadFlags(&mLoadFlags); + } + + return rv; +} + NS_IMETHODIMP nsHTMLDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup) { - nsresult result = nsDocument::ResetToURI(aURI, aLoadGroup); + mLoadFlags = nsIRequest::LOAD_NORMAL; - if (NS_SUCCEEDED(result)) - result = BaseResetToURI(aURI); + nsresult rv = nsDocument::ResetToURI(aURI, aLoadGroup); + NS_ENSURE_SUCCESS(rv, rv); - return result; + return BaseResetToURI(aURI); } nsresult nsHTMLDocument::BaseResetToURI(nsIURI *aURL) { - nsresult result = NS_OK; + nsresult rv = NS_OK; InvalidateHashTables(); PrePopulateHashTables(); - NS_IF_RELEASE(mImages); - NS_IF_RELEASE(mApplets); - NS_IF_RELEASE(mEmbeds); - NS_IF_RELEASE(mLinks); - NS_IF_RELEASE(mAnchors); - NS_IF_RELEASE(mLayers); + mImages = nsnull; + mApplets = nsnull; + mEmbeds = nsnull; + mLinks = nsnull; + mAnchors = nsnull; mBodyContent = nsnull; - mImageMaps->Clear(); - NS_IF_RELEASE(mForms); + mImageMaps.Clear(); + mForms = nsnull; if (aURL) { if (!mAttrStyleSheet) { - result = NS_NewHTMLStyleSheet(getter_AddRefs(mAttrStyleSheet), aURL, - this); + rv = NS_NewHTMLStyleSheet(getter_AddRefs(mAttrStyleSheet), aURL, this); } else { - result = mAttrStyleSheet->Reset(aURL); + rv = mAttrStyleSheet->Reset(aURL); } - if (NS_SUCCEEDED(result)) { - AddStyleSheet(mAttrStyleSheet, 0); // tell the world about our new style sheet + if (NS_SUCCEEDED(rv)) { + // tell the world about our new style sheet + AddStyleSheet(mAttrStyleSheet, 0); if (!mStyleAttrStyleSheet) { - result = NS_NewHTMLCSSStyleSheet(getter_AddRefs(mStyleAttrStyleSheet), - aURL, this); + rv = NS_NewHTMLCSSStyleSheet(getter_AddRefs(mStyleAttrStyleSheet), + aURL, this); } else { - result = mStyleAttrStyleSheet->Reset(aURL); + rv = mStyleAttrStyleSheet->Reset(aURL); } - if (NS_SUCCEEDED(result)) { - AddStyleSheet(mStyleAttrStyleSheet, 0); // tell the world about our new style sheet + if (NS_SUCCEEDED(rv)) { + // tell the world about our new style sheet + AddStyleSheet(mStyleAttrStyleSheet, 0); } } } - NS_ASSERTION(mWyciwygChannel == nsnull, "nsHTMLDocument::Reset() - Wyciwyg Channel still exists!"); + NS_ASSERTION(!mWyciwygChannel, + "nsHTMLDocument::Reset() - Wyciwyg Channel still exists!"); + mWyciwygChannel = nsnull; - if (mBaseTarget) { - mBaseTarget->Truncate(); - } + mBaseTarget.Truncate(); - return result; + return rv; } @@ -475,34 +455,36 @@ nsHTMLDocument::CreateShell(nsIPresContext* aContext, nsIStyleSet* aStyleSet, nsIPresShell** aInstancePtrResult) { - return doCreateShell(aContext, aViewManager, aStyleSet, - mCompatMode, aInstancePtrResult); + return doCreateShell(aContext, aViewManager, aStyleSet, mCompatMode, + aInstancePtrResult); } -// The following Try*Charset will return PR_FALSE only if the charset source -// should be considered (ie. aCharsetSource < thisCharsetSource) but we failed -// to get the charset from this source. +// The following Try*Charset will return PR_FALSE only if the charset source +// should be considered (ie. aCharsetSource < thisCharsetSource) but we failed +// to get the charset from this source. -PRBool +PRBool nsHTMLDocument::TryHintCharset(nsIMarkupDocumentViewer* aMarkupDV, - PRInt32& aCharsetSource, - nsAString& aCharset) + PRInt32& aCharsetSource, nsAString& aCharset) { - PRInt32 requestCharsetSource; - nsresult rv; - if (aMarkupDV) { - rv = aMarkupDV->GetHintCharacterSetSource(&requestCharsetSource); + PRInt32 requestCharsetSource; + nsresult rv = aMarkupDV->GetHintCharacterSetSource(&requestCharsetSource); + if(NS_SUCCEEDED(rv) && kCharsetUninitialized != requestCharsetSource) { PRUnichar* requestCharset; rv = aMarkupDV->GetHintCharacterSet(&requestCharset); aMarkupDV->SetHintCharacterSetSource((PRInt32)(kCharsetUninitialized)); - if(requestCharsetSource <= aCharsetSource) + + if(requestCharsetSource <= aCharsetSource) return PR_TRUE; + if(NS_SUCCEEDED(rv)) { aCharsetSource = requestCharsetSource; aCharset = requestCharset; + Recycle(requestCharset); + return PR_TRUE; } } @@ -511,33 +493,33 @@ nsHTMLDocument::TryHintCharset(nsIMarkupDocumentViewer* aMarkupDV, } -PRBool +PRBool nsHTMLDocument::TryUserForcedCharset(nsIMarkupDocumentViewer* aMarkupDV, nsIDocumentCharsetInfo* aDocInfo, - PRInt32& aCharsetSource, + PRInt32& aCharsetSource, nsAString& aCharset) { nsresult rv = NS_OK; - if(kCharsetFromUserForced <= aCharsetSource) + if(kCharsetFromUserForced <= aCharsetSource) return PR_TRUE; PRUnichar* forceCharsetFromWebShell = nsnull; - if (aMarkupDV) + if (aMarkupDV) { rv = aMarkupDV->GetForceCharacterSet(&forceCharsetFromWebShell); + } - if(NS_SUCCEEDED(rv) && forceCharsetFromWebShell) - { + if(NS_SUCCEEDED(rv) && forceCharsetFromWebShell) { aCharset = forceCharsetFromWebShell; Recycle(forceCharsetFromWebShell); //TODO: we should define appropriate constant for force charset - aCharsetSource = kCharsetFromUserForced; + aCharsetSource = kCharsetFromUserForced; } else if (aDocInfo) { nsCOMPtr csAtom; aDocInfo->GetForcedCharset(getter_AddRefs(csAtom)); if (csAtom) { csAtom->ToString(aCharset); - aCharsetSource = kCharsetFromUserForced; + aCharsetSource = kCharsetFromUserForced; aDocInfo->SetForcedCharset(nsnull); return PR_TRUE; } @@ -546,15 +528,16 @@ nsHTMLDocument::TryUserForcedCharset(nsIMarkupDocumentViewer* aMarkupDV, return PR_FALSE; } -PRBool -nsHTMLDocument::TryCacheCharset(nsICacheEntryDescriptor* aCacheDescriptor, - PRInt32& aCharsetSource, +PRBool +nsHTMLDocument::TryCacheCharset(nsICacheEntryDescriptor* aCacheDescriptor, + PRInt32& aCharsetSource, nsAString& aCharset) { nsresult rv; - - if (kCharsetFromCache <= aCharsetSource) + + if (kCharsetFromCache <= aCharsetSource) { return PR_TRUE; + } nsXPIDLCString cachedCharset; rv = aCacheDescriptor->GetMetaDataElement("charset", @@ -563,42 +546,53 @@ nsHTMLDocument::TryCacheCharset(nsICacheEntryDescriptor* aCacheDescriptor, { aCharset.Assign(NS_ConvertASCIItoUCS2(cachedCharset)); aCharsetSource = kCharsetFromCache; + return PR_TRUE; } return PR_FALSE; } -PRBool +PRBool nsHTMLDocument::TryBookmarkCharset(nsAFlatCString* aUrlSpec, - PRInt32& aCharsetSource, + PRInt32& aCharsetSource, nsAString& aCharset) { - nsresult rv; - if (kCharsetFromBookmarks <= aCharsetSource) + if (kCharsetFromBookmarks <= aCharsetSource) { return PR_TRUE; + } + + if (!gRDF) { + return PR_FALSE; + } nsCOMPtr datasource; - if (gRDF && NS_SUCCEEDED(rv = gRDF->GetDataSource("rdf:bookmarks", getter_AddRefs(datasource)))) { - nsCOMPtr bookmarks = do_QueryInterface(datasource); - if (bookmarks) { - if (aUrlSpec) { - nsXPIDLString pBookmarkedCharset; - rv = bookmarks->GetLastCharset(aUrlSpec->get(), getter_Copies(pBookmarkedCharset)); - if (NS_SUCCEEDED(rv) && (rv != NS_RDF_NO_VALUE)) { - aCharset = pBookmarkedCharset; - aCharsetSource = kCharsetFromBookmarks; - return PR_TRUE; - } - } + nsresult rv = gRDF->GetDataSource("rdf:bookmarks", + getter_AddRefs(datasource)); + + if (NS_FAILED(rv)) { + return PR_FALSE; + } + + nsCOMPtr bookmarks(do_QueryInterface(datasource)); + if (bookmarks && aUrlSpec) { + nsXPIDLString pBookmarkedCharset; + rv = bookmarks->GetLastCharset(aUrlSpec->get(), + getter_Copies(pBookmarkedCharset)); + if (NS_SUCCEEDED(rv) && (rv != NS_RDF_NO_VALUE)) { + aCharset = pBookmarkedCharset; + aCharsetSource = kCharsetFromBookmarks; + + return PR_TRUE; } } + return PR_FALSE; } -PRBool +PRBool nsHTMLDocument::TryParentCharset(nsIDocumentCharsetInfo* aDocInfo, - PRInt32& aCharsetSource, + PRInt32& aCharsetSource, nsAString& aCharset) { if (aDocInfo) { @@ -613,7 +607,7 @@ nsHTMLDocument::TryParentCharset(nsIDocumentCharsetInfo* aDocInfo, source = kCharsetFromHintPrevDoc; else if (kCharsetFromCache <= parentSource) source = kCharsetFromParentFrame; - else + else return PR_FALSE; if (source < aCharsetSource) @@ -622,25 +616,27 @@ nsHTMLDocument::TryParentCharset(nsIDocumentCharsetInfo* aDocInfo, aDocInfo->GetParentCharset(getter_AddRefs(csAtom)); if (csAtom) { csAtom->ToString(aCharset); - aCharsetSource = source; + aCharsetSource = source; return PR_TRUE; } } return PR_FALSE; } -PRBool -nsHTMLDocument::UseWeakDocTypeDefault(PRInt32& aCharsetSource, +PRBool +nsHTMLDocument::UseWeakDocTypeDefault(PRInt32& aCharsetSource, nsAString& aCharset) { if (kCharsetFromWeakDocTypeDefault <= aCharsetSource) return PR_TRUE; - - aCharset.Assign(NS_LITERAL_STRING("ISO-8859-1")); // fallback value in case webShell return error + + // fallback value in case webShell return error + aCharset.Assign(NS_LITERAL_STRING("ISO-8859-1")); nsCOMPtr prefs(do_GetService(NS_PREF_CONTRACTID)); if (prefs) { nsXPIDLString defCharset; - nsresult rv = prefs->GetLocalizedUnicharPref("intl.charset.default", getter_Copies(defCharset)); + nsresult rv = prefs->GetLocalizedUnicharPref("intl.charset.default", + getter_Copies(defCharset)); if (NS_SUCCEEDED(rv) && !defCharset.IsEmpty()) { aCharset.Assign(defCharset); aCharsetSource = kCharsetFromWeakDocTypeDefault; @@ -649,44 +645,46 @@ nsHTMLDocument::UseWeakDocTypeDefault(PRInt32& aCharsetSource, return PR_TRUE; } -PRBool -nsHTMLDocument::TryChannelCharset(nsIChannel *aChannel, - PRInt32& aCharsetSource, - nsAString& aCharset) +PRBool +nsHTMLDocument::TryChannelCharset(nsIChannel *aChannel, + PRInt32& aCharsetSource, nsAString& aCharset) { - if(kCharsetFromChannel <= aCharsetSource) + if(kCharsetFromChannel <= aCharsetSource) { return PR_TRUE; + } if (aChannel) { nsCAutoString charsetVal; nsresult rv = aChannel->GetContentCharset(charsetVal); if (NS_SUCCEEDED(rv)) { - nsCOMPtr calias(do_CreateInstance(kCharsetAliasCID, &rv)); + nsCOMPtr calias(do_CreateInstance(kCharsetAliasCID)); if (calias) { nsAutoString preferred; - rv = calias->GetPreferred(NS_ConvertASCIItoUCS2(charsetVal), preferred); + rv = calias->GetPreferred(NS_ConvertASCIItoUCS2(charsetVal), + preferred); if(NS_SUCCEEDED(rv)) { aCharset = preferred; aCharsetSource = kCharsetFromChannel; return PR_TRUE; - } + } } - } + } } return PR_FALSE; } -PRBool +PRBool nsHTMLDocument::TryDefaultCharset( nsIMarkupDocumentViewer* aMarkupDV, - PRInt32& aCharsetSource, + PRInt32& aCharsetSource, nsAString& aCharset) { - if(kCharsetFromUserDefault <= aCharsetSource) + if(kCharsetFromUserDefault <= aCharsetSource) return PR_TRUE; PRUnichar* defaultCharsetFromWebShell = NULL; if (aMarkupDV) { - nsresult rv = aMarkupDV->GetDefaultCharacterSet(&defaultCharsetFromWebShell); + nsresult rv = + aMarkupDV->GetDefaultCharacterSet(&defaultCharsetFromWebShell); if(NS_SUCCEEDED(rv)) { aCharset = defaultCharsetFromWebShell; Recycle(defaultCharsetFromWebShell); @@ -697,9 +695,8 @@ nsHTMLDocument::TryDefaultCharset( nsIMarkupDocumentViewer* aMarkupDV, return PR_FALSE; } -void -nsHTMLDocument::StartAutodetection(nsIDocShell *aDocShell, - nsAString& aCharset, +void +nsHTMLDocument::StartAutodetection(nsIDocShell *aDocShell, nsAString& aCharset, const char* aCommand) { nsCOMPtr cdetflt; @@ -709,39 +706,47 @@ nsHTMLDocument::StartAutodetection(nsIDocShell *aDocShell, nsCOMPtr pref(do_GetService(NS_PREF_CONTRACTID)); if(pref) { PRUnichar* detector_name = nsnull; - rv_detect = pref->GetLocalizedUnicharPref("intl.charset.detector", &detector_name); + rv_detect = pref->GetLocalizedUnicharPref("intl.charset.detector", + &detector_name); if(NS_SUCCEEDED(rv_detect)) { - PL_strncpy(g_detector_contractid, NS_CHARSET_DETECTOR_CONTRACTID_BASE,DETECTOR_CONTRACTID_MAX); - PL_strncat(g_detector_contractid, NS_ConvertUCS2toUTF8(detector_name).get(),DETECTOR_CONTRACTID_MAX); + PL_strncpy(g_detector_contractid, NS_CHARSET_DETECTOR_CONTRACTID_BASE, + DETECTOR_CONTRACTID_MAX); + PL_strncat(g_detector_contractid, + NS_ConvertUCS2toUTF8(detector_name).get(), + DETECTOR_CONTRACTID_MAX); gPlugDetector = PR_TRUE; PR_FREEIF(detector_name); } - pref->RegisterCallback("intl.charset.detector", MyPrefChangedCallback, nsnull); + pref->RegisterCallback("intl.charset.detector", MyPrefChangedCallback, + nsnull); } gInitDetector = PR_TRUE; } if (gPlugDetector) { - nsCOMPtr cdet = do_CreateInstance(g_detector_contractid, &rv_detect); - if(NS_SUCCEEDED(rv_detect)) { - cdetflt = do_CreateInstance(NS_CHARSET_DETECTION_ADAPTOR_CONTRACTID, &rv_detect); - if(NS_SUCCEEDED(rv_detect)) { - nsCOMPtr adp = do_QueryInterface(cdetflt, &rv_detect); - if(cdetflt && NS_SUCCEEDED( rv_detect )) { - nsCOMPtr wss = do_QueryInterface(aDocShell, &rv_detect); - if( NS_SUCCEEDED( rv_detect )) { - rv_detect = adp->Init(wss, cdet, this, mParser, PromiseFlatString(aCharset).get(), aCommand); + nsCOMPtr cdet = + do_CreateInstance(g_detector_contractid, &rv_detect); + if (NS_SUCCEEDED(rv_detect)) { + cdetflt = do_CreateInstance(NS_CHARSET_DETECTION_ADAPTOR_CONTRACTID, + &rv_detect); - // The current implementation for SetParserFilter needs to - // be changed to be more XPCOM friendly. See bug #40149 - if (mParser) - nsCOMPtr oldFilter = getter_AddRefs(mParser->SetParserFilter(cdetflt)); - } + nsCOMPtr adp = do_QueryInterface(cdetflt); + if (adp) { + nsCOMPtr wss = do_QueryInterface(aDocShell); + if (wss) { + rv_detect = adp->Init(wss, cdet, this, mParser, + PromiseFlatString(aCharset).get(), aCommand); + + // The current implementation for SetParserFilter needs to + // be changed to be more XPCOM friendly. See bug #40149 + if (mParser) + nsCOMPtr oldFilter = + getter_AddRefs(mParser->SetParserFilter(cdetflt)); } } } else { - // IF we cannot create the detector, don't bother to + // IF we cannot create the detector, don't bother to // create one next time. gPlugDetector = PR_FALSE; } @@ -753,31 +758,22 @@ nsHTMLDocument::RetrieveRelevantHeaders(nsIChannel *aChannel) { nsAutoString lastModified; mHttpChannel = do_QueryInterface(aChannel); + nsresult rv; if (mHttpChannel) { nsCAutoString lastModHeader; - nsresult rv = mHttpChannel->GetResponseHeader(NS_LITERAL_CSTRING("last-modified"), - lastModHeader); + rv = mHttpChannel->GetResponseHeader(NS_LITERAL_CSTRING("last-modified"), + lastModHeader); if (NS_SUCCEEDED(rv)) { CopyASCIItoUCS2(lastModHeader, lastModified); SetLastModified(lastModified); } - - nsCAutoString referrerHeader; - // The misspelled key 'referer' is as per the HTTP spec - rv = mHttpChannel->GetRequestHeader(NS_LITERAL_CSTRING("referer"), - referrerHeader); - - if (NS_SUCCEEDED(rv)) { - SetReferrer(NS_ConvertASCIItoUCS2(referrerHeader)); - } } nsCOMPtr fileChannel = do_QueryInterface(aChannel); if (fileChannel) { PRTime modDate, usecs; - nsCOMPtr file; nsresult rv = fileChannel->GetFile(getter_AddRefs(file)); if (NS_SUCCEEDED(rv)) { @@ -811,7 +807,6 @@ nsHTMLDocument::RetrieveRelevantHeaders(nsIChannel *aChannel) } return NS_OK; - } NS_IMETHODIMP @@ -857,22 +852,24 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, } if (needsParser) { - rv = CallCreateInstance(kCParserCID, &mParser); - if (NS_FAILED(rv)) { return rv; } + mParser = do_CreateInstance(kCParserCID, &rv); + NS_ENSURE_SUCCESS(rv, rv); } nsCOMPtr sink; #ifdef rickgdebug - nsString outString; // added out. Redirect to stdout if desired -- gpk 04/01/99 + // added out. Redirect to stdout if desired -- gpk 04/01/99 + nsString outString; rv = NS_New_HTML_ContentSinkStream(getter_AddRefs(sink),&outString,0); if (NS_FAILED(rv)) return rv; NS_ASSERTION(sink, "null sink in debug code variant."); #else + NS_PRECONDITION(nsnull != aContainer, "No content viewer container"); nsCOMPtr docShell(do_QueryInterface(aContainer)); nsCOMPtr dcInfo; - docShell->GetDocumentCharsetInfo(getter_AddRefs(dcInfo)); + docShell->GetDocumentCharsetInfo(getter_AddRefs(dcInfo)); nsCOMPtr cx; docShell->GetPresContext(getter_AddRefs(cx)); if(cx){ @@ -887,13 +884,14 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, nsCOMPtr cv; docShell->GetContentViewer(getter_AddRefs(cv)); if (cv) { - muCV = do_QueryInterface(cv); + muCV = do_QueryInterface(cv); } else { // 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 + // but if we get a null pointer, that's perfectly legal for parent + // and parentContentViewer nsCOMPtr docShellAsItem(do_QueryInterface(docShell)); NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE); - + nsCOMPtr parentAsItem; docShellAsItem->GetSameTypeParent(getter_AddRefs(parentAsItem)); @@ -915,19 +913,20 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, aURL->GetSpec(urlSpec); PRInt32 charsetSource = kCharsetUninitialized; - nsAutoString charset; - - // The following charset resolving calls has implied knowledge about - // charset source priority order. Each try will return true if the + nsAutoString charset; + + // The following charset resolving calls has implied knowledge about + // charset source priority order. Each try will return true if the // source is higher or equal to the source as its name describes. Some - // try call might change charset source to multiple values, like - // TryHintCharset and TryParentCharset. It should be always safe to try more - // sources. - if (! TryUserForcedCharset(muCV, dcInfo, charsetSource, charset)) { + // try call might change charset source to multiple values, like + // TryHintCharset and TryParentCharset. It should be always safe to try more + // sources. + if (!TryUserForcedCharset(muCV, dcInfo, charsetSource, charset)) { TryHintCharset(muCV, charsetSource, charset); TryParentCharset(dcInfo, charsetSource, charset); if (TryChannelCharset(aChannel, charsetSource, charset)) { - // Use the channel's charset (e.g., charset from HTTP "Content-Type" header). + // Use the channel's charset (e.g., charset from HTTP + // "Content-Type" header). } else if (!scheme.Equals(NS_LITERAL_CSTRING("about")) && // don't try to access bookmarks for about:blank TryBookmarkCharset(&urlSpec, charsetSource, charset)) { @@ -948,8 +947,8 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, } PRBool isPostPage = PR_FALSE; - //check if current doc is from POST command - if (mHttpChannel) { + // check if current doc is from POST command + if (mHttpChannel) { nsCAutoString methodStr; rv = mHttpChannel->GetRequestMethod(methodStr); if (NS_SUCCEEDED(rv) && methodStr.Equals(NS_LITERAL_CSTRING("POST"))) @@ -968,20 +967,22 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, if(kCharsetFromAutoDetection > charsetSource && !isPostPage) { StartAutodetection(docShell, charset, aCommand); } -#endif +#endif // rickgdebug -//ahmed + // ahmed // Check if 864 but in Implicit mode ! - if( (mTexttype == IBMBIDI_TEXTTYPE_LOGICAL)&&(charset.EqualsIgnoreCase("ibm864")) ) + if ((mTexttype == IBMBIDI_TEXTTYPE_LOGICAL) && + (charset.EqualsIgnoreCase("ibm864"))) { charset.Assign(NS_LITERAL_STRING("IBM864i")); + } SetDocumentCharacterSet(charset); SetDocumentCharacterSetSource(charsetSource); - + // set doc charset to muCV for next document. if (muCV) muCV->SetPrevDocCharacterSet(charset.get()); - + if(cacheDescriptor) { rv = cacheDescriptor->SetMetaDataElement("charset", NS_ConvertUCS2toUTF8(charset).get()); @@ -995,20 +996,11 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, return rv; } - //The following lines were added by Rick. - //These perform "dynamic" DTD registration, allowing - //the caller total control over process, and decoupling - //parser from any given grammar. - -// nsCOMPtr theDTD; -// NS_NewNavHTMLDTD(getter_AddRefs(theDTD)); -// mParser->RegisterDTD(theDTD); - #ifdef DEBUG_charset - char* cCharset = ToNewCString(charset); - printf("set to parser charset = %s source %d\n", - cCharset, charsetSource); - Recycle(cCharset); + char* cCharset = ToNewCString(charset); + printf("set to parser charset = %s source %d\n", + cCharset, charsetSource); + Recycle(cCharset); #endif mParser->SetDocumentCharset( charset, charsetSource); mParser->SetCommand(aCommand); @@ -1018,12 +1010,16 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, if (aSink) sink = do_QueryInterface(aSink); else { - rv = NS_NewHTMLContentSink(getter_AddRefs(sink), this, aURL, webShell,aChannel); - if (NS_FAILED(rv)) { return rv; } - NS_ASSERTION(sink, "null sink with successful result from factory method"); + rv = NS_NewHTMLContentSink(getter_AddRefs(sink), this, aURL, webShell, + aChannel); + if (NS_FAILED(rv)) { + return rv; + } + NS_ASSERTION(sink, + "null sink with successful result from factory method"); } - mParser->SetContentSink(sink); + mParser->SetContentSink(sink); // parser the content of the URL mParser->Parse(aURL, nsnull, PR_FALSE, (void *)this); } @@ -1037,7 +1033,7 @@ nsHTMLDocument::StopDocumentLoad() if (mParser) { mParser->Terminate(); } - + return NS_OK; } @@ -1062,7 +1058,7 @@ nsHTMLDocument::DocumentWriteTerminationFunc(nsISupports *aRef) // Release the documents parser so that the call to EndLoad() // doesn't just return early and set the termination function again. - NS_IF_RELEASE(htmldoc->mParser); + htmldoc->mParser = nsnull; } htmldoc->EndLoad(); @@ -1108,7 +1104,7 @@ nsHTMLDocument::EndLoad() } } - NS_IF_RELEASE(mParser); + mParser = nsnull; return nsDocument::EndLoad(); } @@ -1122,26 +1118,26 @@ NS_IMETHODIMP nsHTMLDocument::AddImageMap(nsIDOMHTMLMapElement* aMap) { // XXX We should order the maps based on their order in the document. - // XXX Otherwise scripts that add/remove maps with duplicate names + // XXX Otherwise scripts that add/remove maps with duplicate names // XXX will cause problems NS_PRECONDITION(nsnull != aMap, "null ptr"); if (nsnull == aMap) { return NS_ERROR_NULL_POINTER; } - if (mImageMaps->AppendElement(aMap)) { + if (mImageMaps.AppendObject(aMap)) { return NS_OK; } return NS_ERROR_OUT_OF_MEMORY; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::RemoveImageMap(nsIDOMHTMLMapElement* aMap) { NS_PRECONDITION(nsnull != aMap, "null ptr"); if (nsnull == aMap) { return NS_ERROR_NULL_POINTER; } - mImageMaps->RemoveElement(aMap); + mImageMaps.RemoveObject(aMap); return NS_OK; } @@ -1155,11 +1151,10 @@ nsHTMLDocument::GetImageMap(const nsAString& aMapName, } nsAutoString name; - PRUint32 i, n; - mImageMaps->Count(&n); + PRUint32 i, n = mImageMaps.Count(); + for (i = 0; i < n; i++) { - nsCOMPtr map; - mImageMaps->QueryElementAt(i, NS_GET_IID(nsIDOMHTMLMapElement), getter_AddRefs(map)); + nsCOMPtr map = mImageMaps[i]; if (map && NS_SUCCEEDED(map->GetName(name))) { if (name.Equals(aMapName, nsCaseInsensitiveStringComparator())) { *aResult = map; @@ -1178,11 +1173,13 @@ nsHTMLDocument::GetAttributeStyleSheet(nsIHTMLStyleSheet** aResult) NS_ENSURE_ARG_POINTER(aResult); *aResult = mAttrStyleSheet; - if (!mAttrStyleSheet) { + + if (!*aResult) { return NS_ERROR_NOT_AVAILABLE; // probably not the right error... } NS_ADDREF(*aResult); + return NS_OK; } @@ -1192,11 +1189,13 @@ nsHTMLDocument::GetInlineStyleSheet(nsIHTMLCSSStyleSheet** aResult) NS_ENSURE_ARG_POINTER(aResult); *aResult = mStyleAttrStyleSheet; - if (!mStyleAttrStyleSheet) { + + if (!*aResult) { return NS_ERROR_NOT_AVAILABLE; // probably not the right error... } NS_ADDREF(*aResult); + return NS_OK; } @@ -1229,7 +1228,8 @@ nsHTMLDocument::InternalAddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags) } void -nsHTMLDocument::InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex) +nsHTMLDocument::InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, + PRInt32 aIndex) { NS_ASSERTION(0 <= aIndex && aIndex <= ( @@ -1244,7 +1244,8 @@ nsHTMLDocument::InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex ), "index out of bounds"); - mStyleSheets.InsertObjectAt(aSheet, aIndex + 1); // offset one for the attr style sheet + // offset one for the attr style sheet + mStyleSheets.InsertObjectAt(aSheet, aIndex + 1); } already_AddRefed @@ -1272,85 +1273,34 @@ nsHTMLDocument::InternalGetNumberOfStyleSheets() return count; } -NS_IMETHODIMP -nsHTMLDocument::GetBaseURL(nsIURI*& aURL) const -{ - if (mDocumentBaseURL) { - aURL = mDocumentBaseURL.get(); - NS_ADDREF(aURL); - } - else { - GetDocumentURL(&aURL); - } - return NS_OK; -} - NS_IMETHODIMP nsHTMLDocument::GetBaseTarget(nsAString& aTarget) { - if (nsnull != mBaseTarget) { - aTarget.Assign(*mBaseTarget); - } - else { - aTarget.Truncate(); - } + aTarget.Assign(mBaseTarget); + return NS_OK; } NS_IMETHODIMP nsHTMLDocument::SetBaseTarget(const nsAString& aTarget) { - if (!aTarget.IsEmpty()) { - if (nsnull != mBaseTarget) { - *mBaseTarget = aTarget; - } - else { - mBaseTarget = new nsString(aTarget); - } - } - else { - if (nsnull != mBaseTarget) { - delete mBaseTarget; - mBaseTarget = nsnull; - } - } + mBaseTarget = aTarget; + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::SetLastModified(const nsAString& aLastModified) { - if (!aLastModified.IsEmpty()) { - if (nsnull != mLastModified) { - *mLastModified = aLastModified; - } - else { - mLastModified = new nsString(aLastModified); - } - } - else if (nsnull != mLastModified) { - delete mLastModified; - mLastModified = nsnull; - } + mLastModified.Assign(aLastModified); return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::SetReferrer(const nsAString& aReferrer) { - if (!aReferrer.IsEmpty()) { - if (nsnull != mReferrer) { - *mReferrer = aReferrer; - } - else { - mReferrer = new nsString(aReferrer); - } - } - else if (nsnull != mReferrer) { - delete mReferrer; - mReferrer = nsnull; - } + mReferrer.Assign(aReferrer); return NS_OK; } @@ -1358,17 +1308,18 @@ nsHTMLDocument::SetReferrer(const nsAString& aReferrer) NS_IMETHODIMP nsHTMLDocument::GetCSSLoader(nsICSSLoader*& aLoader) { - nsresult result = NS_OK; - if (! mCSSLoader) { - result = NS_NewCSSLoader(this, getter_AddRefs(mCSSLoader)); - } - if (mCSSLoader) { - mCSSLoader->SetCaseSensitive(PR_FALSE); - mCSSLoader->SetCompatibilityMode(mCompatMode); + if (!mCSSLoader) { + nsresult rv = NS_NewCSSLoader(this, getter_AddRefs(mCSSLoader)); + NS_ENSURE_SUCCESS(rv, rv); } + + mCSSLoader->SetCaseSensitive(PR_FALSE); + mCSSLoader->SetCompatibilityMode(mCompatMode); + aLoader = mCSSLoader; - NS_IF_ADDREF(aLoader); - return result; + NS_ADDREF(aLoader); + + return NS_OK; } @@ -1398,7 +1349,7 @@ nsHTMLDocument::SetCompatibilityMode(nsCompatibility aMode) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::ContentAppended(nsIContent* aContainer, PRInt32 aNewIndexInContainer) { @@ -1413,14 +1364,14 @@ nsHTMLDocument::ContentAppended(nsIContent* aContainer, nsCOMPtr newChild; for (i = aNewIndexInContainer; i < count; ++i) { aContainer->ChildAt(i, *getter_AddRefs(newChild)); - if (newChild) + if (newChild) RegisterNamedItems(newChild); } return nsDocument::ContentAppended(aContainer, aNewIndexInContainer); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::ContentInserted(nsIContent* aContainer, nsIContent* aContent, PRInt32 aIndexInContainer) { @@ -1454,11 +1405,11 @@ nsHTMLDocument::ContentReplaced(nsIContent* aContainer, nsIContent* aOldChild, return rv; } - return nsDocument::ContentReplaced(aContainer, aOldChild, + return nsDocument::ContentReplaced(aContainer, aOldChild, aNewChild, aIndexInContainer); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::ContentRemoved(nsIContent* aContainer, nsIContent* aContent, PRInt32 aIndexInContainer) { @@ -1540,11 +1491,11 @@ nsHTMLDocument::AttributeChanged(nsIContent* aContent, PRInt32 aNameSpaceID, } } - return nsDocument::AttributeChanged(aContent, aNameSpaceID, aAttribute, aModType, - aHint); + return nsDocument::AttributeChanged(aContent, aNameSpaceID, aAttribute, + aModType, aHint); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::FlushPendingNotifications(PRBool aFlushReflows, PRBool aUpdateViews) { @@ -1566,7 +1517,7 @@ nsHTMLDocument::FlushPendingNotifications(PRBool aFlushReflows, if (isSafeToFlush && mParser) { nsCOMPtr sink; - + // XXX Ack! Parser doesn't addref sink before passing it back sink = mParser->GetContentSink(); if (sink) { @@ -1617,8 +1568,8 @@ nsHTMLDocument::CreateElementNS(const nsAString& aNamespaceURI, // // nsIDOMDocument interface implementation // -NS_IMETHODIMP -nsHTMLDocument::CreateElement(const nsAString& aTagName, +NS_IMETHODIMP +nsHTMLDocument::CreateElement(const nsAString& aTagName, nsIDOMElement** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1641,19 +1592,19 @@ nsHTMLDocument::CreateElement(const nsAString& aTagName, return rv; } -NS_IMETHODIMP -nsHTMLDocument::CreateProcessingInstruction(const nsAString& aTarget, - const nsAString& aData, +NS_IMETHODIMP +nsHTMLDocument::CreateProcessingInstruction(const nsAString& aTarget, + const nsAString& aData, nsIDOMProcessingInstruction** aReturn) { // There are no PIs for HTML *aReturn = nsnull; - + return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } -NS_IMETHODIMP -nsHTMLDocument::CreateCDATASection(const nsAString& aData, +NS_IMETHODIMP +nsHTMLDocument::CreateCDATASection(const nsAString& aData, nsIDOMCDATASection** aReturn) { // There are no CDATASections in HTML @@ -1661,9 +1612,9 @@ nsHTMLDocument::CreateCDATASection(const nsAString& aData, return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } - -NS_IMETHODIMP -nsHTMLDocument::CreateEntityReference(const nsAString& aName, + +NS_IMETHODIMP +nsHTMLDocument::CreateEntityReference(const nsAString& aName, nsIDOMEntityReference** aReturn) { // There are no EntityReferences in HTML @@ -1672,144 +1623,145 @@ nsHTMLDocument::CreateEntityReference(const nsAString& aName, return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetDoctype(nsIDOMDocumentType** aDocumentType) { - return nsDocument::GetDoctype(aDocumentType); + return nsDocument::GetDoctype(aDocumentType); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetImplementation(nsIDOMDOMImplementation** aImplementation) -{ - return nsDocument::GetImplementation(aImplementation); +{ + return nsDocument::GetImplementation(aImplementation); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetDocumentElement(nsIDOMElement** aDocumentElement) -{ - return nsDocument::GetDocumentElement(aDocumentElement); +{ + return nsDocument::GetDocumentElement(aDocumentElement); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::CreateDocumentFragment(nsIDOMDocumentFragment** aReturn) -{ - return nsDocument::CreateDocumentFragment(aReturn); +{ + return nsDocument::CreateDocumentFragment(aReturn); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::CreateComment(const nsAString& aData, nsIDOMComment** aReturn) -{ - return nsDocument::CreateComment(aData, aReturn); +{ + return nsDocument::CreateComment(aData, aReturn); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::CreateAttribute(const nsAString& aName, nsIDOMAttr** aReturn) -{ - return nsDocument::CreateAttribute(aName, aReturn); +{ + return nsDocument::CreateAttribute(aName, aReturn); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::CreateTextNode(const nsAString& aData, nsIDOMText** aReturn) -{ - return nsDocument::CreateTextNode(aData, aReturn); +{ + return nsDocument::CreateTextNode(aData, aReturn); } -NS_IMETHODIMP -nsHTMLDocument::GetElementsByTagName(const nsAString& aTagname, nsIDOMNodeList** aReturn) -{ +NS_IMETHODIMP +nsHTMLDocument::GetElementsByTagName(const nsAString& aTagname, + nsIDOMNodeList** aReturn) +{ nsAutoString tmp(aTagname); ToLowerCase(tmp); // HTML elements are lower case internally. - return nsDocument::GetElementsByTagName(tmp, aReturn); + return nsDocument::GetElementsByTagName(tmp, aReturn); } // // nsIDOMNode interface implementation // -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetChildNodes(nsIDOMNodeList** aChildNodes) { return nsDocument::GetChildNodes(aChildNodes); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetFirstChild(nsIDOMNode** aFirstChild) { return nsDocument::GetFirstChild(aFirstChild); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetLastChild(nsIDOMNode** aLastChild) { return nsDocument::GetLastChild(aLastChild); } -NS_IMETHODIMP -nsHTMLDocument::InsertBefore(nsIDOMNode* aNewChild, - nsIDOMNode* aRefChild, +NS_IMETHODIMP +nsHTMLDocument::InsertBefore(nsIDOMNode* aNewChild, + nsIDOMNode* aRefChild, nsIDOMNode** aReturn) { return nsDocument::InsertBefore(aNewChild, aRefChild, aReturn); } -NS_IMETHODIMP -nsHTMLDocument::ReplaceChild(nsIDOMNode* aNewChild, - nsIDOMNode* aOldChild, +NS_IMETHODIMP +nsHTMLDocument::ReplaceChild(nsIDOMNode* aNewChild, + nsIDOMNode* aOldChild, nsIDOMNode** aReturn) { return nsDocument::ReplaceChild(aNewChild, aOldChild, aReturn); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) { return nsDocument::RemoveChild(aOldChild, aReturn); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn) { return nsDocument::AppendChild(aNewChild, aReturn); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::HasChildNodes(PRBool* aReturn) { return nsDocument::HasChildNodes(aReturn); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::HasAttributes(PRBool* aReturn) { return nsDocument::HasAttributes(aReturn); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetNodeName(nsAString& aNodeName) -{ - return nsDocument::GetNodeName(aNodeName); +{ + return nsDocument::GetNodeName(aNodeName); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetNodeValue(nsAString& aNodeValue) -{ - return nsDocument::GetNodeValue(aNodeValue); +{ + return nsDocument::GetNodeValue(aNodeValue); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::SetNodeValue(const nsAString& aNodeValue) -{ - return nsDocument::SetNodeValue(aNodeValue); +{ + return nsDocument::SetNodeValue(aNodeValue); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetNodeType(PRUint16* aNodeType) -{ - return nsDocument::GetNodeType(aNodeType); +{ + return nsDocument::GetNodeType(aNodeType); } NS_IMETHODIMP nsHTMLDocument::GetNamespaceURI(nsAString& aNamespaceURI) -{ +{ return nsDocument::GetNamespaceURI(aNamespaceURI); } @@ -1831,39 +1783,39 @@ nsHTMLDocument::GetLocalName(nsAString& aLocalName) return nsDocument::GetLocalName(aLocalName); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetParentNode(nsIDOMNode** aParentNode) -{ - return nsDocument::GetParentNode(aParentNode); +{ + return nsDocument::GetParentNode(aParentNode); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetPreviousSibling(nsIDOMNode** aPreviousSibling) -{ - return nsDocument::GetPreviousSibling(aPreviousSibling); +{ + return nsDocument::GetPreviousSibling(aPreviousSibling); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetNextSibling(nsIDOMNode** aNextSibling) -{ - return nsDocument::GetNextSibling(aNextSibling); +{ + return nsDocument::GetNextSibling(aNextSibling); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetAttributes(nsIDOMNamedNodeMap** aAttributes) -{ - return nsDocument::GetAttributes(aAttributes); +{ + return nsDocument::GetAttributes(aAttributes); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) -{ - return nsDocument::GetOwnerDocument(aOwnerDocument); +{ + return nsDocument::GetOwnerDocument(aOwnerDocument); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) -{ +{ return nsDocument::CloneNode(aDeep, aReturn); } @@ -1885,12 +1837,20 @@ NS_IMETHODIMP nsHTMLDocument::GetBaseURI(nsAString &aURI) { aURI.Truncate(); - nsCOMPtr uri(do_QueryInterface(mBaseURL ? mBaseURL : mDocumentURL)); + nsIURI *uri = mDocumentBaseURL; // WEAK + + if (!uri) { + uri = mDocumentURL; + } + if (uri) { nsCAutoString spec; uri->GetSpec(spec); + + // XXX: CopyUTF8toUCS2()? aURI = NS_ConvertUTF8toUCS2(spec); } + return NS_OK; } @@ -1909,15 +1869,15 @@ nsHTMLDocument::IsSameNode(nsIDOMNode* aOther, } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::LookupNamespacePrefix(const nsAString& aNamespaceURI, - nsAString& aPrefix) + nsAString& aPrefix) { aPrefix.Truncate(); return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::LookupNamespaceURI(const nsAString& aNamespacePrefix, nsAString& aNamespaceURI) { @@ -1938,38 +1898,40 @@ nsHTMLDocument::GetTitle(nsAString& aTitle) return nsDocument::GetTitle(aTitle); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetReferrer(nsAString& aReferrer) { - if (nsnull != mReferrer) { - aReferrer.Assign(*mReferrer); - } - else { - aReferrer.Truncate(); - } + aReferrer.Assign(mReferrer); return NS_OK; } -NS_IMETHODIMP -nsHTMLDocument::GetDomainURI(nsIURI **uri) +void +nsHTMLDocument::GetDomainURI(nsIURI **aURI) { + *aURI = nsnull; + nsCOMPtr principal; if (NS_FAILED(GetPrincipal(getter_AddRefs(principal)))) - return NS_ERROR_FAILURE; + return; + nsCOMPtr codebase = do_QueryInterface(principal); if (!codebase) - return NS_ERROR_FAILURE; - return codebase->GetURI(uri); + return; + + codebase->GetURI(aURI); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetDomain(nsAString& aDomain) { nsCOMPtr uri; - if (NS_FAILED(GetDomainURI(getter_AddRefs(uri)))) + GetDomainURI(getter_AddRefs(uri)); + + if (!uri) { return NS_ERROR_FAILURE; + } nsCAutoString hostName; if (NS_FAILED(uri->GetHost(hostName))) @@ -1979,7 +1941,7 @@ nsHTMLDocument::GetDomain(nsAString& aDomain) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::SetDomain(const nsAString& aDomain) { // Check new domain - must be a superdomain of the current host @@ -2003,11 +1965,15 @@ nsHTMLDocument::SetDomain(const nsAString& aDomain) // Error: illegal domain return NS_ERROR_DOM_BAD_DOCUMENT_DOMAIN; } - + // Create new URI nsCOMPtr uri; - if (NS_FAILED(GetDomainURI(getter_AddRefs(uri)))) + GetDomainURI(getter_AddRefs(uri)); + + if (!uri) { return NS_ERROR_FAILURE; + } + nsCAutoString scheme; if (NS_FAILED(uri->GetScheme(scheme))) return NS_ERROR_FAILURE; @@ -2015,24 +1981,27 @@ nsHTMLDocument::SetDomain(const nsAString& aDomain) if (NS_FAILED(uri->GetPath(path))) return NS_ERROR_FAILURE; NS_ConvertUTF8toUCS2 newURIString(scheme); - newURIString += NS_LITERAL_STRING("://") + aDomain + NS_ConvertUTF8toUCS2(path); + newURIString.Append(NS_LITERAL_STRING("://") + aDomain + + NS_ConvertUTF8toUCS2(path)); + nsCOMPtr newURI; if (NS_FAILED(NS_NewURI(getter_AddRefs(newURI), newURIString))) return NS_ERROR_FAILURE; // Get codebase principal nsresult rv; - nsCOMPtr securityManager = + nsCOMPtr securityManager = do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); - if (NS_FAILED(rv)) + if (NS_FAILED(rv)) return NS_ERROR_FAILURE; nsCOMPtr newCodebase; - rv = securityManager->GetCodebasePrincipal(newURI, getter_AddRefs(newCodebase)); - if (NS_FAILED(rv)) + rv = securityManager->GetCodebasePrincipal(newURI, + getter_AddRefs(newCodebase)); + if (NS_FAILED(rv)) return NS_ERROR_FAILURE; nsCOMPtr agg = do_QueryInterface(mPrincipal, &rv); NS_ASSERTION(NS_SUCCEEDED(rv), "Principal not an aggregate."); - if (NS_FAILED(rv)) + if (NS_FAILED(rv)) return NS_ERROR_FAILURE; rv = agg->SetCodebase(newCodebase); @@ -2052,18 +2021,21 @@ nsHTMLDocument::WasDomainSet(PRBool* aDomainWasSet) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetURL(nsAString& aURL) { - if (nsnull != mDocumentURL) { + if (mDocumentURL) { nsCAutoString str; mDocumentURL->GetSpec(str); aURL.Assign(NS_ConvertUTF8toUCS2(str)); + } else { + aURL.Truncate(); } + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetBody(nsIDOMHTMLElement** aBody) { NS_ENSURE_ARG_POINTER(aBody); @@ -2098,7 +2070,7 @@ nsHTMLDocument::GetBody(nsIDOMHTMLElement** aBody) return element ? CallQueryInterface(element, aBody) : NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::SetBody(nsIDOMHTMLElement* aBody) { nsCOMPtr bodyElement(do_QueryInterface(aBody)); @@ -2111,7 +2083,7 @@ nsHTMLDocument::SetBody(nsIDOMHTMLElement* aBody) nsCOMPtr root; GetDocumentElement(getter_AddRefs(root)); - if (!root) { + if (!root) { return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; } @@ -2146,7 +2118,7 @@ nsHTMLDocument::SetBody(nsIDOMHTMLElement* aBody) return PR_FALSE; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetImages(nsIDOMHTMLCollection** aImages) { if (!mImages) { @@ -2154,16 +2126,15 @@ nsHTMLDocument::GetImages(nsIDOMHTMLCollection** aImages) if (!mImages) { return NS_ERROR_OUT_OF_MEMORY; } - NS_ADDREF(mImages); } - *aImages = (nsIDOMHTMLCollection *)mImages; + *aImages = mImages; NS_ADDREF(*aImages); return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetApplets(nsIDOMHTMLCollection** aApplets) { if (!mApplets) { @@ -2172,10 +2143,9 @@ nsHTMLDocument::GetApplets(nsIDOMHTMLCollection** aApplets) if (!mApplets) { return NS_ERROR_OUT_OF_MEMORY; } - NS_ADDREF(mApplets); } - *aApplets = (nsIDOMHTMLCollection *)mApplets; + *aApplets = mApplets; NS_ADDREF(*aApplets); return NS_OK; @@ -2194,19 +2164,18 @@ nsHTMLDocument::MatchLinks(nsIContent *aContent, nsString* aData) return PR_FALSE; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetLinks(nsIDOMHTMLCollection** aLinks) { - if (nsnull == mLinks) { + if (!mLinks) { mLinks = new nsContentList(this, MatchLinks, nsString()); - if (nsnull == mLinks) { + if (!mLinks) { return NS_ERROR_OUT_OF_MEMORY; } - NS_ADDREF(mLinks); } - *aLinks = (nsIDOMHTMLCollection *)mLinks; - NS_ADDREF(mLinks); + *aLinks = mLinks; + NS_ADDREF(*aLinks); return NS_OK; } @@ -2224,23 +2193,23 @@ nsHTMLDocument::MatchAnchors(nsIContent *aContent, nsString* aData) return PR_FALSE; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetAnchors(nsIDOMHTMLCollection** aAnchors) { if (!mAnchors) { mAnchors = new nsContentList(this, MatchAnchors, nsString()); - NS_ENSURE_TRUE(mAnchors, NS_ERROR_OUT_OF_MEMORY); - - NS_ADDREF(mAnchors); + if (!mAnchors) { + return NS_ERROR_OUT_OF_MEMORY; + } } - *aAnchors = (nsIDOMHTMLCollection *)mAnchors; + *aAnchors = mAnchors; NS_ADDREF(*aAnchors); return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetCookie(nsAString& aCookie) { aCookie.Truncate(); // clear current cookie in case service fails; @@ -2258,40 +2227,39 @@ nsHTMLDocument::GetCookie(nsAString& aCookie) } } - nsresult result = NS_OK; + nsresult rv = NS_OK; nsAutoString str; - nsCOMPtr service = do_GetService(kCookieServiceCID, &result); - if (NS_SUCCEEDED(result) && service) { - - // Get a URI from the document principal - // We use the original codebase in case the codebase was changed by SetDomain - nsCOMPtr agg(do_QueryInterface(mPrincipal, &result)); + nsCOMPtr service = do_GetService(kCookieServiceCID, &rv); + if (service) { + // Get a URI from the document principal. We use the original + // codebase in case the codebase was changed by SetDomain + nsCOMPtr agg(do_QueryInterface(mPrincipal, &rv)); // Document principal should always be an aggregate - NS_ENSURE_SUCCESS(result, result); + NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr originalPrincipal; - result = agg->GetOriginalCodebase(getter_AddRefs(originalPrincipal)); + rv = agg->GetOriginalCodebase(getter_AddRefs(originalPrincipal)); nsCOMPtr originalCodebase( - do_QueryInterface(originalPrincipal, &result)); - if (NS_FAILED(result)) { + do_QueryInterface(originalPrincipal, &rv)); + if (NS_FAILED(rv)) { // Document's principal is not a codebase, so can't get cookies - return NS_OK; + return NS_OK; } nsCOMPtr codebaseURI; - result = originalCodebase->GetURI(getter_AddRefs(codebaseURI)); - NS_ENSURE_SUCCESS(result, result); + rv = originalCodebase->GetURI(getter_AddRefs(codebaseURI)); + NS_ENSURE_SUCCESS(rv, rv); nsXPIDLCString cookie; - result = service->GetCookieString(codebaseURI, getter_Copies(cookie)); - if (NS_SUCCEEDED(result) && cookie) + rv = service->GetCookieString(codebaseURI, getter_Copies(cookie)); + if (NS_SUCCEEDED(rv) && cookie) CopyASCIItoUCS2(nsDependentCString(cookie), aCookie); } - return result; + return rv; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::SetCookie(const nsAString& aCookie) { // If caller is not chrome and dom.disable_cookie_get is true, @@ -2305,9 +2273,9 @@ nsHTMLDocument::SetCookie(const nsAString& aCookie) } } - nsresult result = NS_OK; - nsCOMPtr service = do_GetService(kCookieServiceCID, &result); - if (NS_SUCCEEDED(result) && service && mDocumentURL) { + nsresult rv = NS_OK; + nsCOMPtr service = do_GetService(kCookieServiceCID, &rv); + if (service && mDocumentURL) { nsCOMPtr globalObj; nsCOMPtr prompt; this->GetScriptGlobalObject(getter_AddRefs(globalObj)); @@ -2318,33 +2286,34 @@ nsHTMLDocument::SetCookie(const nsAString& aCookie) } } - // Get a URI from the document principal - // We use the original codebase in case the codebase was changed by SetDomain - nsCOMPtr agg(do_QueryInterface(mPrincipal, &result)); + // Get a URI from the document principal. We use the original + // codebase in case the codebase was changed by SetDomain + nsCOMPtr agg(do_QueryInterface(mPrincipal, &rv)); // Document principal should always be an aggregate - NS_ENSURE_SUCCESS(result, result); + NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr originalPrincipal; - result = agg->GetOriginalCodebase(getter_AddRefs(originalPrincipal)); + rv = agg->GetOriginalCodebase(getter_AddRefs(originalPrincipal)); nsCOMPtr originalCodebase( - do_QueryInterface(originalPrincipal, &result)); - if (NS_FAILED(result)) { + do_QueryInterface(originalPrincipal, &rv)); + if (NS_FAILED(rv)) { // Document's principal is not a codebase, so can't set cookies - return NS_OK; + return NS_OK; } nsCOMPtr codebaseURI; - result = originalCodebase->GetURI(getter_AddRefs(codebaseURI)); - NS_ENSURE_SUCCESS(result, result); + rv = originalCodebase->GetURI(getter_AddRefs(codebaseURI)); + NS_ENSURE_SUCCESS(rv, rv); - result = NS_ERROR_OUT_OF_MEMORY; + rv = NS_ERROR_OUT_OF_MEMORY; char* cookie = ToNewCString(aCookie); if (cookie) { - result = service->SetCookieString(codebaseURI, prompt, cookie, mHttpChannel); + rv = service->SetCookieString(codebaseURI, prompt, cookie, + mHttpChannel); nsCRT::free(cookie); } } - return result; + return rv; } // static @@ -2367,22 +2336,21 @@ nsHTMLDocument::GetSourceDocumentURL(nsIURI** sourceURL) return NS_OK; // No document in the window } - doc->GetDocumentURL(sourceURL); + doc->GetDocumentURL(sourceURL); - return sourceURL ? NS_OK : NS_ERROR_FAILURE; + return sourceURL ? NS_OK : NS_ERROR_FAILURE; } - // XXX TBI: accepting arguments to the open method. nsresult nsHTMLDocument::OpenCommon(nsIURI* aSourceURL) { - nsCOMPtr docshell; - // If we already have a parser we ignore the document.open call. if (mParser) return NS_OK; + nsCOMPtr docshell; + // Stop current loads targeted at the window this document is in. if (mScriptGlobalObject) { mScriptGlobalObject->GetDocShell(getter_AddRefs(docshell)); @@ -2393,30 +2361,33 @@ nsHTMLDocument::OpenCommon(nsIURI* aSourceURL) } } - nsresult result = NS_OK; + nsresult rv = NS_OK; // The open occurred after the document finished loading. // So we reset the document and create a new one. nsCOMPtr channel; nsCOMPtr group = do_QueryReferent(mDocumentLoadGroup); - result = NS_NewChannel(getter_AddRefs(channel), aSourceURL, nsnull, group); + rv = NS_NewChannel(getter_AddRefs(channel), aSourceURL, nsnull, group); - if (NS_FAILED(result)) return result; + if (NS_FAILED(rv)) { + return rv; + } - //Before we reset the doc notify the globalwindow of the change. + // Before we reset the doc notify the globalwindow of the change. if (mScriptGlobalObject) { - //Hold onto ourselves on the offchance that we're down to one ref + // Hold onto ourselves on the offchance that we're down to one ref nsCOMPtr kungFuDeathGrip = do_QueryInterface((nsIHTMLDocument*)this); - result = mScriptGlobalObject->SetNewDocument(kungFuDeathGrip, PR_FALSE, - PR_FALSE); + rv = mScriptGlobalObject->SetNewDocument(kungFuDeathGrip, PR_FALSE, + PR_FALSE); - if (NS_FAILED(result)) - return result; + if (NS_FAILED(rv)) { + return rv; + } } // XXX This is a nasty workaround for a scrollbar code bug @@ -2461,9 +2432,10 @@ nsHTMLDocument::OpenCommon(nsIURI* aSourceURL) // the anonymous content (i.e. scrollbar elements) is set to // null. - result = Reset(channel, group); - if (NS_FAILED(result)) - return result; + rv = Reset(channel, group); + if (NS_FAILED(rv)) { + return rv; + } if (root) { // Tear down the frames for the root element. @@ -2479,10 +2451,11 @@ nsHTMLDocument::OpenCommon(nsIURI* aSourceURL) mRootContent = root; } - result = CallCreateInstance(kCParserCID, &mParser); + mParser = do_CreateInstance(kCParserCID, &rv); + mIsWriting = 1; - if (NS_SUCCEEDED(result)) { + if (NS_SUCCEEDED(rv)) { nsCOMPtr sink; nsCOMPtr webShell; @@ -2499,16 +2472,16 @@ nsHTMLDocument::OpenCommon(nsIURI* aSourceURL) } } - result = NS_NewHTMLContentSink(getter_AddRefs(sink), this, aSourceURL, - webShell, channel); + rv = NS_NewHTMLContentSink(getter_AddRefs(sink), this, aSourceURL, + webShell, channel); - if (NS_OK == result) { + if (NS_OK == rv) { static NS_DEFINE_CID(kNavDTDCID, NS_CNAVDTD_CID); - nsCOMPtr theDTD(do_CreateInstance(kNavDTDCID, &result)); - if(NS_SUCCEEDED(result)) { + nsCOMPtr theDTD(do_CreateInstance(kNavDTDCID, &rv)); + if(NS_SUCCEEDED(rv)) { mParser->RegisterDTD(theDTD); } - mParser->SetContentSink(sink); + mParser->SetContentSink(sink); } } @@ -2527,17 +2500,17 @@ nsHTMLDocument::OpenCommon(nsIURI* aSourceURL) // Add a wyciwyg channel request into the document load group NS_ASSERTION(mWyciwygChannel == nsnull, "nsHTMLDocument::OpenCommon(): wyciwyg channel already exists!"); CreateAndAddWyciwygChannel(); - return result; + return rv; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::Open() { nsCOMPtr doc; return Open(getter_AddRefs(doc)); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::Open(nsIDOMDocument** aReturn) { // XXX The URL of the newly created document will match @@ -2545,46 +2518,44 @@ nsHTMLDocument::Open(nsIDOMDocument** aReturn) // XXX This will fail on non-DOM contexts :( nsCOMPtr sourceURL; - nsresult result = GetSourceDocumentURL(getter_AddRefs(sourceURL)); + nsresult rv = GetSourceDocumentURL(getter_AddRefs(sourceURL)); // Recover if we had a problem obtaining the source URL if (!sourceURL) { - result = NS_NewURI(getter_AddRefs(sourceURL), - NS_LITERAL_CSTRING("about:blank")); + rv = NS_NewURI(getter_AddRefs(sourceURL), + NS_LITERAL_CSTRING("about:blank")); } + NS_ENSURE_SUCCESS(rv, rv); - if (NS_SUCCEEDED(result)) { - result = OpenCommon(sourceURL); - } + rv = OpenCommon(sourceURL); + NS_ENSURE_SUCCESS(rv, rv); - CallQueryInterface(this, aReturn); - - return result; + return CallQueryInterface(this, aReturn); } #define NS_GENERATE_PARSER_KEY() (void*)((mIsWriting << 31) | (mWriteLevel & 0x7fffffff)) -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::Clear() { // This method has been deprecated return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::Close() { - nsresult result = NS_OK; + nsresult rv = NS_OK; if (mParser && mIsWriting) { mWriteLevel++; - result = mParser->Parse(NS_LITERAL_STRING(""), - NS_GENERATE_PARSER_KEY(), - NS_LITERAL_CSTRING("text/html"), PR_FALSE, - PR_TRUE); + rv = mParser->Parse(NS_LITERAL_STRING(""), + NS_GENERATE_PARSER_KEY(), + NS_LITERAL_CSTRING("text/html"), PR_FALSE, + PR_TRUE); mWriteLevel--; mIsWriting = 0; - NS_IF_RELEASE(mParser); + mParser = nsnull; // XXX Make sure that all the document.written content is // reflowed. We should remove this call once we change @@ -2608,9 +2579,9 @@ nsHTMLDocument::Close() // that we added in OpenCommon(). If all other requests between // document.open() and document.close() have completed, then this // method should cause the firing of an onload event. - NS_ASSERTION(mWyciwygChannel, "nsHTMLDocument::Close(): Trying to remove non-existent wyciwyg channel!"); + NS_ASSERTION(mWyciwygChannel, "nsHTMLDocument::Close(): Trying to remove non-existent wyciwyg channel!"); RemoveWyciwygChannel(); - NS_ASSERTION(mWyciwygChannel == nsnull, "nsHTMLDocument::Close(): nsIWyciwyg Channel could not be removed!"); + NS_ASSERTION(mWyciwygChannel == nsnull, "nsHTMLDocument::Close(): nsIWyciwyg Channel could not be removed!"); } return NS_OK; @@ -2640,7 +2611,7 @@ nsHTMLDocument::WriteCommon(const nsAString& aText, // Save the data in cache if (mWyciwygChannel) { mWyciwygChannel->WriteToCacheEntry(NS_ConvertUCS2toUTF8(text)); - } + } rv = mParser->Parse(text , NS_GENERATE_PARSER_KEY(), @@ -2658,7 +2629,7 @@ nsHTMLDocument::Write(const nsAString& aText) return WriteCommon(aText, PR_FALSE); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::Writeln(const nsAString& aText) { return WriteCommon(aText, PR_TRUE); @@ -2710,9 +2681,7 @@ nsHTMLDocument::ScriptWriteCommon(PRBool aNewlineTerminate) rv = codebase->GetURI(getter_AddRefs(subjectURI)); NS_ENSURE_SUCCESS(rv, rv); - NS_IF_RELEASE(mDocumentURL); mDocumentURL = subjectURI; - NS_ADDREF(mDocumentURL); mPrincipal = subject; } @@ -2803,12 +2772,12 @@ nsHTMLDocument::MatchId(nsIContent *aContent, const nsAString& aId) aContent->ChildAt(i, child); result = MatchId(child, aId); NS_RELEASE(child); - } + } return result; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetElementById(const nsAString& aElementId, nsIDOMElement** aReturn) { @@ -2877,7 +2846,7 @@ nsHTMLDocument::GetElementsByTagNameNS(const nsAString& aNamespaceURI, nsAutoString tmp(aLocalName); ToLowerCase(tmp); // HTML elements are lower case internally. return nsDocument::GetElementsByTagNameNS(aNamespaceURI, tmp, - aReturn); + aReturn); } PRBool @@ -2902,8 +2871,8 @@ nsHTMLDocument::MatchNameAttribute(nsIContent* aContent, nsString* aData) return PR_FALSE; } -NS_IMETHODIMP -nsHTMLDocument::GetElementsByName(const nsAString& aElementName, +NS_IMETHODIMP +nsHTMLDocument::GetElementsByName(const nsAString& aElementName, nsIDOMNodeList** aReturn) { nsContentList* elements = new nsContentList(this, MatchNameAttribute, @@ -2963,12 +2932,12 @@ nsHTMLDocument::GetPixelDimensions(nsIPresShell* aShell, { *aWidth = *aHeight = 0; - nsresult result = FlushPendingNotifications(); - NS_ENSURE_SUCCESS(result, result); + nsresult rv = FlushPendingNotifications(); + NS_ENSURE_SUCCESS(rv, rv); // Find the element: this is what we'll want to use for the // document's width and height values. - if (!mBodyContent && PR_FALSE == GetBodyContent()) { + if (!mBodyContent && !GetBodyContent()) { return NS_OK; } @@ -2976,15 +2945,15 @@ nsHTMLDocument::GetPixelDimensions(nsIPresShell* aShell, // Now grab its frame nsIFrame* frame; - result = aShell->GetPrimaryFrameFor(body, &frame); - if (NS_SUCCEEDED(result) && frame) { + rv = aShell->GetPrimaryFrameFor(body, &frame); + if (NS_SUCCEEDED(rv) && frame) { nsSize size; nsIView* view; nsCOMPtr presContext; aShell->GetPresContext(getter_AddRefs(presContext)); - result = frame->GetView(presContext, &view); - if (NS_SUCCEEDED(result)) { + rv = frame->GetView(presContext, &view); + if (NS_SUCCEEDED(rv)) { // If we have a view check if it's scrollable. If not, // just use the view size itself if (view) { @@ -2996,28 +2965,28 @@ nsHTMLDocument::GetPixelDimensions(nsIPresShell* aShell, } nsRect r; - result = view->GetBounds(r); - if (NS_SUCCEEDED(result)) { + rv = view->GetBounds(r); + if (NS_SUCCEEDED(rv)) { size.height = r.height; size.width = r.width; } } // If we don't have a view, use the frame size else { - result = frame->GetSize(size); + rv = frame->GetSize(size); } } // Convert from twips to pixels - if (NS_SUCCEEDED(result)) { + if (NS_SUCCEEDED(rv)) { nsCOMPtr context; - - result = aShell->GetPresContext(getter_AddRefs(context)); - - if (NS_SUCCEEDED(result)) { + + rv = aShell->GetPresContext(getter_AddRefs(context)); + + if (NS_SUCCEEDED(rv)) { float scale; context->GetTwipsToPixels(&scale); - + *aWidth = NSTwipsToIntPixels(size.width, scale); *aHeight = NSTwipsToIntPixels(size.height, scale); } @@ -3027,7 +2996,7 @@ nsHTMLDocument::GetPixelDimensions(nsIPresShell* aShell, return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetWidth(PRInt32* aWidth) { NS_ENSURE_ARG_POINTER(aWidth); @@ -3074,19 +3043,17 @@ nsHTMLDocument::GetHeight(PRInt32* aHeight) NS_IMETHODIMP nsHTMLDocument::GetAlinkColor(nsAString& aAlinkColor) { - nsresult result = NS_OK; - nsIDOMHTMLBodyElement* body; - aAlinkColor.Truncate(); - result = GetBodyElement(&body); - if (NS_OK == result) { - result = body->GetALink(aAlinkColor); - NS_RELEASE(body); - } - else if (mAttrStyleSheet) { + + nsCOMPtr body; + GetBodyElement(getter_AddRefs(body)); + + if (body) { + body->GetALink(aAlinkColor); + } else if (mAttrStyleSheet) { nscolor color; - result = mAttrStyleSheet->GetActiveLinkColor(color); - if (NS_OK == result) { + nsresult rv = mAttrStyleSheet->GetActiveLinkColor(color); + if (NS_SUCCEEDED(rv)) { nsHTMLValue value(color); value.ToString(aAlinkColor); } @@ -3098,41 +3065,35 @@ nsHTMLDocument::GetAlinkColor(nsAString& aAlinkColor) NS_IMETHODIMP nsHTMLDocument::SetAlinkColor(const nsAString& aAlinkColor) { - nsresult result = NS_OK; - nsIDOMHTMLBodyElement* body; + nsCOMPtr body; + GetBodyElement(getter_AddRefs(body)); - result = GetBodyElement(&body); - if (NS_OK == result) { - result = body->SetALink(aAlinkColor); - NS_RELEASE(body); - } - else if (mAttrStyleSheet) { + if (body) { + body->SetALink(aAlinkColor); + } else if (mAttrStyleSheet) { nsHTMLValue value; - if (value.ParseColor(aAlinkColor, this)) { mAttrStyleSheet->SetActiveLinkColor(value.GetColorValue()); } } - + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetLinkColor(nsAString& aLinkColor) { - nsresult result = NS_OK; - nsIDOMHTMLBodyElement* body; - aLinkColor.Truncate(); - result = GetBodyElement(&body); - if (NS_OK == result) { - result = body->GetLink(aLinkColor); - NS_RELEASE(body); - } - else if (mAttrStyleSheet) { + + nsCOMPtr body; + GetBodyElement(getter_AddRefs(body)); + + if (body) { + body->GetLink(aLinkColor); + } else if (mAttrStyleSheet) { nscolor color; - result = mAttrStyleSheet->GetLinkColor(color); - if (NS_OK == result) { + nsresult rv = mAttrStyleSheet->GetLinkColor(color); + if (NS_SUCCEEDED(rv)) { nsHTMLValue value(color); value.ToString(aLinkColor); } @@ -3141,43 +3102,38 @@ nsHTMLDocument::GetLinkColor(nsAString& aLinkColor) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::SetLinkColor(const nsAString& aLinkColor) { - nsresult result = NS_OK; - nsIDOMHTMLBodyElement* body; + nsCOMPtr body; + GetBodyElement(getter_AddRefs(body)); - result = GetBodyElement(&body); - if (NS_OK == result) { - result = body->SetLink(aLinkColor); - NS_RELEASE(body); - } - else if (mAttrStyleSheet) { + if (body) { + body->SetLink(aLinkColor); + } else if (mAttrStyleSheet) { nsHTMLValue value; if (value.ParseColor(aLinkColor, this)) { mAttrStyleSheet->SetLinkColor(value.GetColorValue()); } } - + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetVlinkColor(nsAString& aVlinkColor) { - nsresult result = NS_OK; - nsIDOMHTMLBodyElement* body; - aVlinkColor.Truncate(); - result = GetBodyElement(&body); - if (NS_OK == result) { - result = body->GetVLink(aVlinkColor); - NS_RELEASE(body); - } - else if (mAttrStyleSheet) { + + nsCOMPtr body; + GetBodyElement(getter_AddRefs(body)); + + if (body) { + body->GetVLink(aVlinkColor); + } else if (mAttrStyleSheet) { nscolor color; - result = mAttrStyleSheet->GetVisitedLinkColor(color); - if (NS_OK == result) { + nsresult rv = mAttrStyleSheet->GetVisitedLinkColor(color); + if (NS_SUCCEEDED(rv)) { nsHTMLValue value(color); value.ToString(aVlinkColor); } @@ -3186,98 +3142,88 @@ nsHTMLDocument::GetVlinkColor(nsAString& aVlinkColor) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::SetVlinkColor(const nsAString& aVlinkColor) { - nsresult result = NS_OK; - nsIDOMHTMLBodyElement* body; + nsCOMPtr body; + GetBodyElement(getter_AddRefs(body)); - result = GetBodyElement(&body); - if (NS_OK == result) { - result = body->SetVLink(aVlinkColor); - NS_RELEASE(body); - } - else if (mAttrStyleSheet) { + if (body) { + body->SetVLink(aVlinkColor); + } else if (mAttrStyleSheet) { nsHTMLValue value; if (value.ParseColor(aVlinkColor, this)) { mAttrStyleSheet->SetVisitedLinkColor(value.GetColorValue()); } } - + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetBgColor(nsAString& aBgColor) { - nsresult result = NS_OK; - nsIDOMHTMLBodyElement* body; - aBgColor.Truncate(); - result = GetBodyElement(&body); - if (NS_SUCCEEDED(result)) { - result = body->GetBgColor(aBgColor); - NS_RELEASE(body); + + nsCOMPtr body; + GetBodyElement(getter_AddRefs(body)); + + if (body) { + body->GetBgColor(aBgColor); } return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::SetBgColor(const nsAString& aBgColor) { - nsresult result = NS_OK; - nsIDOMHTMLBodyElement* body; + nsCOMPtr body; + GetBodyElement(getter_AddRefs(body)); - result = GetBodyElement(&body); - if (NS_SUCCEEDED(result)) { - result = body->SetBgColor(aBgColor); - NS_RELEASE(body); + if (body) { + body->SetBgColor(aBgColor); } // XXXldb And otherwise? - + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetFgColor(nsAString& aFgColor) { - nsresult result = NS_OK; - nsIDOMHTMLBodyElement* body; - aFgColor.Truncate(); - result = GetBodyElement(&body); - if (NS_SUCCEEDED(result)) { - result = body->GetText(aFgColor); - NS_RELEASE(body); + + nsCOMPtr body; + GetBodyElement(getter_AddRefs(body)); + + if (body) { + body->GetText(aFgColor); } return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::SetFgColor(const nsAString& aFgColor) { - nsresult result = NS_OK; - nsIDOMHTMLBodyElement* body; + nsCOMPtr body; + GetBodyElement(getter_AddRefs(body)); - result = GetBodyElement(&body); - if (NS_SUCCEEDED(result)) { - result = body->SetText(aFgColor); - NS_RELEASE(body); + if (body) { + body->SetText(aFgColor); } // XXXldb And otherwise? - + return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetLastModified(nsAString& aLastModified) { - if (nsnull != mLastModified) { - aLastModified.Assign(*mLastModified); - } - else { + if (!mLastModified.IsEmpty()) { + aLastModified.Assign(mLastModified); + } else { aLastModified.Assign(NS_LITERAL_STRING("January 1, 1970 GMT")); } @@ -3285,31 +3231,31 @@ nsHTMLDocument::GetLastModified(nsAString& aLastModified) } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetEmbeds(nsIDOMHTMLCollection** aEmbeds) { if (!mEmbeds) { mEmbeds = new nsContentList(this, nsHTMLAtoms::embed, kNameSpaceID_Unknown); - NS_ENSURE_TRUE(mEmbeds, NS_ERROR_OUT_OF_MEMORY); - - NS_ADDREF(mEmbeds); + if (!mEmbeds) { + return NS_ERROR_OUT_OF_MEMORY; + } } - *aEmbeds = (nsIDOMHTMLCollection *)mEmbeds; - NS_ADDREF(mEmbeds); + *aEmbeds = mEmbeds; + NS_ADDREF(*aEmbeds); return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetSelection(nsAString& aReturn) { aReturn.Truncate(); nsCOMPtr consoleService (do_GetService("@mozilla.org/consoleservice;1")); - + if (consoleService) { consoleService->LogStringMessage(NS_LITERAL_STRING("Deprecated method document.getSelection() called. Please use window.getSelection() instead.").get()); } @@ -3347,7 +3293,7 @@ nsHTMLDocument::GetSelection(nsAString& aReturn) return rv; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::CaptureEvents(PRInt32 aEventFlags) { nsIEventListenerManager *manager; @@ -3361,7 +3307,7 @@ nsHTMLDocument::CaptureEvents(PRInt32 aEventFlags) return NS_ERROR_FAILURE; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::ReleaseEvents(PRInt32 aEventFlags) { nsIEventListenerManager *manager; @@ -3375,7 +3321,7 @@ nsHTMLDocument::ReleaseEvents(PRInt32 aEventFlags) return NS_ERROR_FAILURE; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::RouteEvent(nsIDOMEvent* aEvt) { //XXX Not the best solution -joki @@ -3499,7 +3445,7 @@ static PRBool IsNamedItem(nsIContent* aContent, nsIAtom *aTag, nsAString& aName) { // Only the content types reflected in Level 0 with a NAME - // attribute are registered. Images, layers and forms always get + // attribute are registered. Images, layers and forms always get // reflected up to the document. Applets and embeds only go // to the closest container (which could be a form). if (aTag == nsHTMLAtoms::img || @@ -3910,7 +3856,7 @@ nsHTMLDocument::GetBodyContent() GetRootContent(getter_AddRefs(root)); - if (!root) { + if (!root) { return PR_FALSE; } @@ -3938,30 +3884,34 @@ nsHTMLDocument::GetBodyContent() return PR_FALSE; } -NS_IMETHODIMP +void nsHTMLDocument::GetBodyElement(nsIDOMHTMLBodyElement** aBody) { + *aBody = nsnull; + if (!mBodyContent && !GetBodyContent()) { - return NS_ERROR_FAILURE; + // No body in this document. + + return; } - return CallQueryInterface(mBodyContent, aBody); + CallQueryInterface(mBodyContent, aBody); } // forms related stuff -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLDocument::GetForms(nsIDOMHTMLCollection** aForms) { if (!mForms) { mForms = new nsContentList(this, nsHTMLAtoms::form, kNameSpaceID_Unknown); - NS_ENSURE_TRUE(mForms, NS_ERROR_OUT_OF_MEMORY); - - NS_ADDREF(mForms); + if (!mForms) { + return NS_ERROR_OUT_OF_MEMORY; + } } - *aForms = (nsIDOMHTMLCollection *)mForms; - NS_ADDREF(mForms); + *aForms = mForms; + NS_ADDREF(*aForms); return NS_OK; } @@ -3969,12 +3919,12 @@ nsHTMLDocument::GetForms(nsIDOMHTMLCollection** aForms) nsresult nsHTMLDocument::CreateAndAddWyciwygChannel(void) -{ +{ nsresult rv = NS_OK; nsCAutoString url, originalSpec; mDocumentURL->GetSpec(originalSpec); - + // Generate the wyciwyg url url = NS_LITERAL_CSTRING("wyciwyg://") + nsPrintfCString("%d", mWyciwygSessionCnt++) @@ -3984,36 +3934,35 @@ nsHTMLDocument::CreateAndAddWyciwygChannel(void) nsCOMPtr wcwgURI; NS_NewURI(getter_AddRefs(wcwgURI), url); - // Create the nsIWyciwygChannel to store - // out-of-band document.write() script to cache + // Create the nsIWyciwygChannel to store out-of-band + // document.write() script to cache nsCOMPtr channel; // Create a wyciwyg Channel rv = NS_NewChannel(getter_AddRefs(channel), wcwgURI); if (NS_SUCCEEDED(rv) && channel) { mWyciwygChannel = do_QueryInterface(channel); - // inherit load flags from the original document's channel + // Inherit load flags from the original document's channel channel->SetLoadFlags(mLoadFlags); } nsCOMPtr loadGroup; - rv = GetDocumentLoadGroup(getter_AddRefs(loadGroup)); - if (NS_FAILED(rv)) return rv; + NS_ENSURE_SUCCESS(rv, rv); // Use the Parent document's loadgroup to trigger load notifications if (loadGroup && channel) { rv = channel->SetLoadGroup(loadGroup); - if (NS_FAILED(rv)) return rv; + NS_ENSURE_SUCCESS(rv, rv); nsLoadFlags loadFlags = 0; channel->GetLoadFlags(&loadFlags); loadFlags |= nsIChannel::LOAD_DOCUMENT_URI; channel->SetLoadFlags(loadFlags); - + channel->SetOriginalURI(wcwgURI); rv = loadGroup->AddRequest(mWyciwygChannel, nsnull); - if (NS_FAILED(rv)) return rv; + NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to add request to load group."); } return rv; @@ -4026,15 +3975,16 @@ nsHTMLDocument::RemoveWyciwygChannel(void) nsCOMPtr loadGroup; rv = GetDocumentLoadGroup(getter_AddRefs(loadGroup)); - if (NS_FAILED(rv)) return rv; + NS_ENSURE_SUCCESS(rv, rv); // note there can be a write request without a load group if // this is a synchronously constructed about:blank document if (loadGroup && mWyciwygChannel) { mWyciwygChannel->CloseCacheEntry(NS_OK); rv = loadGroup->RemoveRequest(mWyciwygChannel, nsnull, NS_OK); - if (NS_FAILED(rv)) return rv; + NS_ENSURE_SUCCESS(rv, rv); } + mWyciwygChannel = nsnull; return rv; @@ -4073,7 +4023,7 @@ nsHTMLDocument::SetDesignMode(const nsAString & aDesignMode) if (!url.Equals("about:blank")) { // If we're 'about:blank' then we don't care who can edit us. // If we're not about:blank, then we need to check sameOrigin. - nsCOMPtr secMan = + nsCOMPtr secMan = do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); @@ -4083,10 +4033,10 @@ nsHTMLDocument::SetDesignMode(const nsAString & aDesignMode) } nsCOMPtr editSession = do_GetInterface(docshell); - if (!editSession) + if (!editSession) return NS_ERROR_FAILURE; - if (aDesignMode.Equals(NS_LITERAL_STRING("on"), + if (aDesignMode.Equals(NS_LITERAL_STRING("on"), nsCaseInsensitiveStringComparator())) { // go through hoops to get dom window (see nsHTMLDocument::GetSelection) nsCOMPtr shell = (nsIPresShell*)mPresShells.SafeElementAt(0); @@ -4145,6 +4095,7 @@ nsHTMLDocument::GetMidasCommandManager(nsICommandManager** aCmdMgr) return NS_ERROR_FAILURE; NS_ADDREF(*aCmdMgr = mMidasCommandManager); + return NS_OK; } @@ -4236,7 +4187,7 @@ static const struct MidasParam gMidasParamTable[] = { // outIsBoolean will determine whether to send param as a boolean or string // outBooleanParam will not be set unless outIsBoolean PRBool -nsHTMLDocument::ConvertToMidasInternalCommand(const nsAString & inCommandID, +nsHTMLDocument::ConvertToMidasInternalCommand(const nsAString & inCommandID, const nsAString & inParam, nsACString& outCommandID, nsACString& outParam, @@ -4270,7 +4221,7 @@ nsHTMLDocument::ConvertToMidasInternalCommand(const nsAString & inCommandID, if (outIsBoolean) { // if this is a boolean value and it's not explicitly false - // (e.g. no value) we default to "true" + // (e.g. no value) we default to "true" outBooleanValue = convertedParam.Equals("false", nsCaseInsensitiveCStringComparator()); outParam.SetLength(0); @@ -4300,7 +4251,7 @@ nsHTMLDocument::ConvertToMidasInternalCommand(const nsAString & inCommandID, outIsBoolean = PR_FALSE; } - return found; + return found; } jsval @@ -4333,7 +4284,7 @@ nsHTMLDocument::DoClipboardSecurityCheck(PRBool aPaste) nsHTMLDocument::sPasteInternal_id = STRING_TO_JSVAL(::JS_InternString(cx, "paste")); } - rv = secMan->CheckPropertyAccess(cx, nsnull, classNameStr.get(), + rv = secMan->CheckPropertyAccess(cx, nsnull, classNameStr.get(), nsHTMLDocument::sPasteInternal_id, nsIXPCSecurityManager::ACCESS_GET_PROPERTY); } else { @@ -4341,7 +4292,7 @@ nsHTMLDocument::DoClipboardSecurityCheck(PRBool aPaste) nsHTMLDocument::sCutCopyInternal_id = STRING_TO_JSVAL(::JS_InternString(cx, "cutcopy")); } - rv = secMan->CheckPropertyAccess(cx, nsnull, classNameStr.get(), + rv = secMan->CheckPropertyAccess(cx, nsnull, classNameStr.get(), nsHTMLDocument::sCutCopyInternal_id, nsIXPCSecurityManager::ACCESS_GET_PROPERTY); } @@ -4350,12 +4301,12 @@ nsHTMLDocument::DoClipboardSecurityCheck(PRBool aPaste) } /* TODO: don't let this call do anything if the page is not done loading */ -/* boolean execCommand(in DOMString commandID, in boolean doShowUI, +/* boolean execCommand(in DOMString commandID, in boolean doShowUI, in DOMString value); */ NS_IMETHODIMP -nsHTMLDocument::ExecCommand(const nsAString & commandID, - PRBool doShowUI, - const nsAString & value, +nsHTMLDocument::ExecCommand(const nsAString & commandID, + PRBool doShowUI, + const nsAString & value, PRBool *_retval) { NS_ENSURE_ARG_POINTER(_retval); @@ -4397,7 +4348,7 @@ nsHTMLDocument::ExecCommand(const nsAString & commandID, nsCAutoString cmdToDispatch, paramStr; PRBool isBool, boolVal; - if (!ConvertToMidasInternalCommand(commandID, value, + if (!ConvertToMidasInternalCommand(commandID, value, cmdToDispatch, paramStr, isBool, boolVal)) return NS_ERROR_NOT_IMPLEMENTED; @@ -4509,7 +4460,7 @@ nsHTMLDocument::QueryCommandState(const nsAString & commandID, PRBool *_retval) nsCAutoString cmdToDispatch, paramToCheck; PRBool dummy, dummy2; - if (!ConvertToMidasInternalCommand(commandID, commandID, + if (!ConvertToMidasInternalCommand(commandID, commandID, cmdToDispatch, paramToCheck, dummy, dummy2)) return NS_ERROR_NOT_IMPLEMENTED; @@ -4524,10 +4475,11 @@ nsHTMLDocument::QueryCommandState(const nsAString & commandID, PRBool *_retval) return rv; // handle alignment as a special case (possibly other commands too?) - // Alignment is special because the external api is individual commands - // but internally we use cmd_align with different parameters. When getting - // the state of this command, we need to return the boolean for this - // particular alignment rather than the string of 'which alignment is this?' + // Alignment is special because the external api is individual + // commands but internally we use cmd_align with different + // parameters. When getting the state of this command, we need to + // return the boolean for this particular alignment rather than the + // string of 'which alignment is this?' if (cmdToDispatch.Equals("cmd_align")) { char * actualAlignmentType = nsnull; rv = cmdParams->GetCStringValue("state_attribute", &actualAlignmentType); diff --git a/content/html/document/src/nsHTMLDocument.h b/content/html/document/src/nsHTMLDocument.h index 0d2fd2fb884..615ed1c45c9 100644 --- a/content/html/document/src/nsHTMLDocument.h +++ b/content/html/document/src/nsHTMLDocument.h @@ -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 mAttrStyleSheet; nsCOMPtr mStyleAttrStyleSheet; - nsIURI* mBaseURL; - nsString* mBaseTarget; - nsString* mLastModified; - nsString* mReferrer; - nsCOMPtr mHttpChannel; - nsCompatibility mCompatMode; - nsCOMPtr mImageMaps; - nsContentList *mImages; - nsContentList *mApplets; - nsContentList *mEmbeds; - nsContentList *mLinks; - nsContentList *mAnchors; - nsContentList *mForms; - nsContentList *mLayers; - - nsIParser *mParser; + nsString mBaseTarget; + nsString mLastModified; + nsString mReferrer; + + nsCOMPtr mHttpChannel; + + nsCompatibility mCompatMode; + + nsCOMArray mImageMaps; + + nsCOMPtr mImages; + nsCOMPtr mApplets; + nsCOMPtr mEmbeds; + nsCOMPtr mLinks; + nsCOMPtr mAnchors; + nsCOMPtr mForms; + + nsCOMPtr 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 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___ */ diff --git a/content/html/document/src/nsHTMLFragmentContentSink.cpp b/content/html/document/src/nsHTMLFragmentContentSink.cpp index e0dabf4427f..75e3c8676c8 100644 --- a/content/html/document/src/nsHTMLFragmentContentSink.cpp +++ b/content/html/document/src/nsHTMLFragmentContentSink.cpp @@ -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); } } } diff --git a/content/html/document/src/nsIHTMLDocument.h b/content/html/document/src/nsIHTMLDocument.h index 4591b33b989..fe237df45a8 100644 --- a/content/html/document/src/nsIHTMLDocument.h +++ b/content/html/document/src/nsIHTMLDocument.h @@ -107,8 +107,6 @@ public: */ NS_IMETHOD GetNumFormsSynchronous(PRInt32* aNumForms) = 0; - NS_IMETHOD GetBodyElement(nsIDOMHTMLBodyElement** aBody) = 0; - NS_IMETHOD_(PRBool) IsWriting() = 0; }; diff --git a/content/html/document/src/nsImageDocument.cpp b/content/html/document/src/nsImageDocument.cpp index 6a3177a6d1d..7c158de4302 100644 --- a/content/html/document/src/nsImageDocument.cpp +++ b/content/html/document/src/nsImageDocument.cpp @@ -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 content = do_QueryInterface(mBodyContent); - nsRefPtr styleContext = context->ResolveStyleContextFor(content, nsnull); + nsRefPtr 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 textToSubURI = do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv); + nsCOMPtr 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)); } } diff --git a/content/html/document/src/nsMarkupDocument.cpp b/content/html/document/src/nsMarkupDocument.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/content/html/document/src/nsMarkupDocument.h b/content/html/document/src/nsMarkupDocument.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/content/html/document/src/nsPluginDocument.cpp b/content/html/document/src/nsPluginDocument.cpp index 9020497a1ca..de21f9d9002 100644 --- a/content/html/document/src/nsPluginDocument.cpp +++ b/content/html/document/src/nsPluginDocument.cpp @@ -62,25 +62,34 @@ public: nsIContentSink* aSink = nsnull); protected: - nsresult CreateSyntheticDocument(nsACString &aMimeType); + nsresult CreateSyntheticPluginDocument(nsACString &aMimeType); nsCOMPtr mPluginContent; nsRefPtr 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 diff --git a/content/macbuild/content.xml b/content/macbuild/content.xml index e69e80d5b8c..e69de29bb2d 100644 --- a/content/macbuild/content.xml +++ b/content/macbuild/content.xml @@ -1,8160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -]> - - - - - content.o - - - - UserSourceTrees - - - AlwaysSearchUserPathsfalse - InterpretDOSAndUnixPathsfalse - RequireFrameworkStyleIncludesfalse - UserSearchPaths - - SearchPath - Path:: - PathFormatMacOS - PathRootProject - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - SearchPath - Path:::dist: - PathFormatMacOS - PathRootProject - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - SystemSearchPaths - - SearchPath - Path:MSL: - PathFormatMacOS - PathRootCodeWarrior - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - SearchPath - Path:MacOS Support: - PathFormatMacOS - PathRootCodeWarrior - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - - - MWRuntimeSettings_WorkingDirectory - MWRuntimeSettings_CommandLine - MWRuntimeSettings_HostApplication - Path - PathFormatGeneric - PathRootAbsolute - - MWRuntimeSettings_EnvVars - - - LinkerMacOS PPC Linker - PreLinker - PostLinker - Targetnamecontent.o - OutputDirectory - Path: - PathFormatMacOS - PathRootProject - - SaveEntriesUsingRelativePathsfalse - - - FileMappings - - FileTypeAPPL - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeAppl - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeMMLB - FileExtension - CompilerLib Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeMPLF - FileExtension - CompilerLib Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeMWCD - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeRSRC - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.c - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.c++ - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.cc - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.cp - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.cpp - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.exp - Compiler - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.h - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMaketrue - - - FileTypeTEXT - FileExtension.p - CompilerMW Pascal PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.pas - CompilerMW Pascal PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.pch - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompiletrue - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.pch++ - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompiletrue - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.ppu - CompilerMW Pascal PPC - EditLanguage - Precompiletrue - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.r - CompilerRez - EditLanguageRez - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.s - CompilerPPCAsm - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeXCOF - FileExtension - CompilerXCOFF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypedocu - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypersrc - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeshlb - FileExtension - CompilerPEF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypestub - FileExtension - CompilerPEF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileExtension.doc - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFilefalse - IgnoredByMaketrue - - - - - CacheModDatestrue - ActivateBrowsertrue - DumpBrowserInfofalse - CacheSubprojectstrue - UseThirdPartyDebuggerfalse - DebuggerAppPath - Path - PathFormatGeneric - PathRootAbsolute - - DebuggerCmdLineArgs - DebuggerWorkingDir - Path - PathFormatGeneric - PathRootAbsolute - - - - LogSystemMessagestrue - AutoTargetDLLsfalse - StopAtWatchpointstrue - PauseWhileRunningfalse - PauseInterval5 - PauseUIFlags0 - AltExePath - Path - PathFormatGeneric - PathRootAbsolute - - StopAtTempBPOnLaunchtrue - CacheSymbolicstrue - TempBPFunctionNamemain - TempBPType0 - - - Enabledfalse - ConnectionName - DownloadPath - LaunchRemoteAppfalse - RemoteAppPath - - - OtherExecutables - - - CustomColor1 - Red0 - Green32767 - Blue0 - - CustomColor2 - Red0 - Green32767 - Blue0 - - CustomColor3 - Red0 - Green32767 - Blue0 - - CustomColor4 - Red0 - Green32767 - Blue0 - - - - MWFrontEnd_C_cplusplus0 - MWFrontEnd_C_checkprotos1 - MWFrontEnd_C_arm0 - MWFrontEnd_C_trigraphs0 - MWFrontEnd_C_onlystdkeywords0 - MWFrontEnd_C_enumsalwaysint1 - MWFrontEnd_C_mpwpointerstyle0 - MWFrontEnd_C_prefixnamecontentSharedPrefix.h - MWFrontEnd_C_ansistrict0 - MWFrontEnd_C_mpwcnewline0 - MWFrontEnd_C_wchar_type1 - MWFrontEnd_C_enableexceptions1 - MWFrontEnd_C_dontreusestrings0 - MWFrontEnd_C_poolstrings0 - MWFrontEnd_C_dontinline0 - MWFrontEnd_C_useRTTI1 - MWFrontEnd_C_multibyteaware0 - MWFrontEnd_C_unsignedchars0 - MWFrontEnd_C_autoinline0 - MWFrontEnd_C_booltruefalse0 - MWFrontEnd_C_direct_to_som0 - MWFrontEnd_C_som_env_check0 - MWFrontEnd_C_alwaysinline0 - MWFrontEnd_C_inlinelevel0 - MWFrontEnd_C_ecplusplus0 - MWFrontEnd_C_objective_c0 - MWFrontEnd_C_defer_codegen0 - - - MWWarning_C_warn_illpragma1 - MWWarning_C_warn_emptydecl1 - MWWarning_C_warn_possunwant1 - MWWarning_C_warn_unusedvar1 - MWWarning_C_warn_unusedarg1 - MWWarning_C_warn_extracomma1 - MWWarning_C_pedantic1 - MWWarning_C_warningerrors0 - MWWarning_C_warn_hidevirtual1 - MWWarning_C_warn_implicitconv0 - MWWarning_C_warn_notinlined0 - MWWarning_C_warn_structclass0 - - - MWMerge_MacOS_projectTypeApplication - MWMerge_MacOS_outputNameMerge Out - MWMerge_MacOS_outputCreator???? - MWMerge_MacOS_outputTypeAPPL - MWMerge_MacOS_suppressWarning0 - MWMerge_MacOS_copyFragments1 - MWMerge_MacOS_copyResources1 - MWMerge_MacOS_flattenResource0 - MWMerge_MacOS_flatFileNamea.rsrc - MWMerge_MacOS_flatFileOutputPath - Path: - PathFormatMacOS - PathRootProject - - MWMerge_MacOS_skipResources - DLGX - ckid - Proj - WSPC - - - - FileLockedfalse - ResourcesMapIsReadOnlyfalse - PrinterDriverIsMultiFinderCompatiblefalse - Invisiblefalse - HasBundlefalse - NameLockedfalse - Stationeryfalse - HasCustomIconfalse - Sharedfalse - HasBeenInitedfalse - Label0 - Comments - - - MWMacOSPackager_UsePackager0 - MWMacOSPackager_FolderToPackage - Path: - PathFormatMacOS - PathRootProject - - MWMacOSPackager_CreateClassicAlias0 - MWMacOSPackager_ClassicAliasMethodUseTargetOutput - MWMacOSPackager_ClassicAliasPath - Path: - PathFormatMacOS - PathRootProject - - MWMacOSPackager_CreatePkgInfo0 - MWMacOSPackager_PkgCreatorType???? - MWMacOSPackager_PkgFileTypeAPPL - - - MWCodeGen_PPC_structalignmentPPC - MWCodeGen_PPC_tracebacktablesInline - MWCodeGen_PPC_processorGeneric - MWCodeGen_PPC_readonlystrings0 - MWCodeGen_PPC_tocdata1 - MWCodeGen_PPC_profiler0 - MWCodeGen_PPC_fpcontract1 - MWCodeGen_PPC_schedule1 - MWCodeGen_PPC_peephole1 - MWCodeGen_PPC_processorspecific0 - MWCodeGen_PPC_altivec0 - MWCodeGen_PPC_vectortocdata0 - MWCodeGen_PPC_vrsave0 - - - MWCodeGen_MachO_structalignmentPPC - MWCodeGen_MachO_tracebacktablesNone - MWCodeGen_MachO_processorGeneric - MWCodeGen_MachO_readonlystrings0 - MWCodeGen_MachO_profiler0 - MWCodeGen_MachO_fpcontract1 - MWCodeGen_MachO_schedule0 - MWCodeGen_MachO_peephole1 - MWCodeGen_MachO_processorspecific0 - MWCodeGen_MachO_altivec0 - MWCodeGen_MachO_vrsave1 - MWCodeGen_MachO_common0 - MWCodeGen_MachO_implicit_templates1 - - - MWDisassembler_PPC_showcode1 - MWDisassembler_PPC_extended1 - MWDisassembler_PPC_mix0 - MWDisassembler_PPC_nohex0 - MWDisassembler_PPC_showdata1 - MWDisassembler_PPC_showexceptions1 - MWDisassembler_PPC_showsym0 - MWDisassembler_PPC_shownames1 - - - GlobalOptimizer_PPC_optimizationlevelLevel0 - GlobalOptimizer_PPC_optforSpeed - - - MWLinker_PPC_linksym1 - MWLinker_PPC_symfullpath1 - MWLinker_PPC_linkmap0 - MWLinker_PPC_nolinkwarnings0 - MWLinker_PPC_dontdeadstripinitcode0 - MWLinker_PPC_permitmultdefs1 - MWLinker_PPC_linkmodeFast - MWLinker_PPC_initname__NSInitialize - MWLinker_PPC_mainname - MWLinker_PPC_termname__NSTerminate - - - MWLinker_MachO_exportsNone - MWLinker_MachO_mainnamestart - MWLinker_MachO_currentversion0 - MWLinker_MachO_compatibleversion0 - MWLinker_MachO_symfullpath0 - MWLinker_MachO_supresswarnings0 - MWLinker_MachO_multisymerror0 - MWLinker_MachO_prebind1 - MWLinker_MachO_deadstrip1 - MWLinker_MachO_objectivecsemantics0 - MWLinker_MachO_whichfileloaded0 - MWLinker_MachO_whyfileloaded0 - MWLinker_MachO_readonlyrelocsErrors - MWLinker_MachO_undefinedsymbolsErrors - MWLinker_MachO_twolevelnamespace1 - MWLinker_MachO_stripdebugsymbols0 - - - MWProject_MachO_typeExecutable - MWProject_MachO_outfilea.exe - MWProject_MachO_filecreator???? - MWProject_MachO_filetypeMEXE - MWProject_MachO_stacksize64 - MWProject_MachO_stackaddress0 - MWProject_MachO_flatrsrc1 - MWProject_MachO_flatrsrcfilenamea.rsrc - MWProject_MachO_flatrsrcoutputdir - Path: - PathFormatMacOS - PathRootProject - - MWProject_MachO_installpath./ - - - MWPEF_exportsPragma - MWPEF_libfolder0 - MWPEF_sortcodeNone - MWPEF_expandbss0 - MWPEF_sharedata0 - MWPEF_olddefversion0 - MWPEF_oldimpversion0 - MWPEF_currentversion0 - MWPEF_fragmentnameCONTENT_DLL - MWPEF_collapsereloads0 - - - MWProject_PPC_typeLibrary - MWProject_PPC_outfilecontent.o - MWProject_PPC_filecreator???? - MWProject_PPC_filetype???? - MWProject_PPC_size0 - MWProject_PPC_minsize0 - MWProject_PPC_stacksize0 - MWProject_PPC_flags0 - MWProject_PPC_symfilename - MWProject_PPC_rsrcname - MWProject_PPC_rsrcheaderNative - MWProject_PPC_rsrctype???? - MWProject_PPC_rsrcid0 - MWProject_PPC_rsrcflags0 - MWProject_PPC_rsrcstore0 - MWProject_PPC_rsrcmerge0 - MWProject_PPC_flatrsrc0 - MWProject_PPC_flatrsrcoutputdir - Path: - PathFormatMacOS - PathRootProject - - MWProject_PPC_flatrsrcfilename - - - MWAssembler_PPC_auxheader0 - MWAssembler_PPC_symmodeMac - MWAssembler_PPC_dialectPPC - MWAssembler_PPC_prefixfile - MWAssembler_PPC_typecheck0 - MWAssembler_PPC_warnings0 - MWAssembler_PPC_casesensitive0 - - - MWRez_Language_maxwidth80 - MWRez_Language_scriptRoman - MWRez_Language_alignmentAlign1 - MWRez_Language_filtermodeFilterSkip - MWRez_Language_suppresswarnings0 - MWRez_Language_escapecontrolchars1 - MWRez_Language_prefixname - MWRez_Language_filteredtypes'CODE' 'DATA' 'PICT' - xpidl Settings - 0001000101000000000000000000000000000000000000000000000000000000 - 0000000000000000 - - - - - Name - nsDocument.cpp - MacOS - Text - Debug - - - Name - nsStyleSet.cpp - MacOS - Text - Debug - - - Name - nsHTMLContentSink.cpp - MacOS - Text - Debug - - - Name - nsHTMLDocument.cpp - MacOS - Text - Debug - - - Name - nsCSSDeclaration.cpp - MacOS - Text - Debug - - - Name - nsCSSParser.cpp - MacOS - Text - Debug - - - Name - nsCSSScanner.cpp - MacOS - Text - Debug - - - Name - nsCSSStyleRule.cpp - MacOS - Text - Debug - - - Name - nsCSSStyleSheet.cpp - MacOS - Text - Debug - - - Name - nsHTMLAttributes.cpp - MacOS - Text - Debug - - - Name - nsHTMLStyleSheet.cpp - MacOS - Text - Debug - - - Name - nsHTMLCSSStyleSheet.cpp - MacOS - Text - Debug - - - Name - nsDOMEvent.cpp - MacOS - Text - Debug - - - Name - nsDOMEventGroup.cpp - MacOS - Text - Debug - - - Name - nsEventListenerManager.cpp - MacOS - Text - Debug - - - Name - nsEventStateManager.cpp - MacOS - Text - Debug - - - Name - nsContentList.cpp - MacOS - Text - Debug - - - Name - nsImageDocument.cpp - MacOS - Text - Debug - - - Name - nsMarkupDocument.cpp - MacOS - Text - Debug - - - Name - nsGenericHTMLElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLAnchorElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLAppletElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLAreaElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLBaseFontElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLBodyElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLBRElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLButtonElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLDelElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLDirectoryElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLDivElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLDListElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLFontElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLFormElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLFrameElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLFrameSetElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLHeadElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLHeadingElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLHRElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLHtmlElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLIFrameElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLImageElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLInputElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLInsElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLLabelElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLLegendElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLLIElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLLinkElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLMapElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLMenuElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLMetaElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLModElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLObjectElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLOListElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLOptGroupElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLOptionElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLParagraphElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLPreElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLQuoteElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLScriptElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLSelectElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLStyleElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLTableCaptionElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLTableCellElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLTableColElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLTableElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLTableRowElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLTableSectionElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLTextAreaElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLTitleElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLUListElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLSpanElement.cpp - MacOS - Text - Debug - - - Name - nsDOMCSSDeclaration.cpp - MacOS - Text - Debug - - - Name - nsCSSValue.cpp - MacOS - Text - Debug - - - Name - nsHTMLFieldSetElement.cpp - MacOS - Text - Debug - - - Name - nsGenericElement.cpp - MacOS - Text - Debug - - - Name - nsXMLContentSink.cpp - MacOS - Text - Debug - - - Name - nsXMLPrettyPrinter.cpp - MacOS - Text - Debug - - - Name - nsXMLDocument.cpp - MacOS - Text - Debug - - - Name - nsXMLElement.cpp - MacOS - Text - Debug - - - Name - NSRuntime.shlb - MacOS - Library - - - - Name - NSStdLib.shlb - MacOS - Library - - - - Name - InterfacesStubs - MacOS - Library - - - - Name - nsGenericDOMHTMLCollection.cpp - MacOS - Text - Debug - - - Name - GenericElementCollection.cpp - MacOS - Text - Debug - - - Name - xpcom.shlb - MacOS - Library - - - - Name - gfx.shlb - MacOS - Library - - - - Name - NSPR20.shlb - MacOS - Library - - - - Name - JavaScript.shlb - MacOS - Library - - - - Name - nsDocumentFragment.cpp - MacOS - Text - Debug - - - Name - nsRange.cpp - MacOS - Text - Debug - - - Name - nsNameSpaceManager.cpp - MacOS - Text - Debug - - - Name - nsContentIterator.cpp - MacOS - Text - Debug - - - Name - nsDOMAttribute.cpp - MacOS - Text - Debug - - - Name - nsDOMAttributeMap.cpp - MacOS - Text - Debug - - - Name - nsCommentNode.cpp - MacOS - Text - Debug - - - Name - nsGenericDOMDataNode.cpp - MacOS - Text - Debug - - - Name - nsTextNode.cpp - MacOS - Text - Debug - - - Name - nsGenericDOMNodeList.cpp - MacOS - Text - Debug - - - Name - nsXMLProcessingInstruction.cpp - MacOS - Text - Debug - - - Name - nsXMLCDATASection.cpp - MacOS - Text - Debug - - - Name - nsDocumentViewer.cpp - MacOS - Text - Debug - - - Name - nsPagePrintTimer.cpp - MacOS - Text - Debug - - - Name - nsPrintData.cpp - MacOS - Text - Debug - - - Name - nsPrintEngine.cpp - MacOS - Text - Debug - - - Name - nsPrintObject.cpp - MacOS - Text - Debug - - - Name - nsPrintPreviewListener.cpp - MacOS - Text - Debug - - - Name - nsCSSLoader.cpp - MacOS - Text - Debug - - - Name - nsHTMLFragmentContentSink.cpp - MacOS - Text - Debug - - - Name - nsDocumentEncoder.cpp - MacOS - Text - Debug - - - Name - nsCSSRule.cpp - MacOS - Text - Debug - - - Name - nsCSSRules.cpp - MacOS - Text - Debug - - - Name - nsPrivateTextRange.cpp - MacOS - Text - Debug - - - Name - nsAttributeContent.cpp - MacOS - Text - Debug - - - Name - nsXMLEntity.cpp - MacOS - Text - Debug - - - Name - nsXMLNotation.cpp - MacOS - Text - Debug - - - Name - nsXMLNamedNodeMap.cpp - MacOS - Text - Debug - - - Name - NSComponentStartup.o - MacOS - Library - Debug - - - Name - libutil.shlb - MacOS - Library - Debug - - - Name - nsTextContentChangeData.cpp - MacOS - Text - Debug - - - Name - nsXBLService.cpp - MacOS - Text - Debug - - - Name - nsXBLBinding.cpp - MacOS - Text - Debug - - - Name - nsXBLEventHandler.cpp - MacOS - Text - Debug - - - Name - nsSelection.cpp - MacOS - Text - Debug - - - Name - nsDOMDocumentType.cpp - MacOS - Text - Debug - - - Name - nsGeneratedIterator.cpp - MacOS - Text - Debug - - - Name - nsHTMLUnknownElement.cpp - MacOS - Text - Debug - - - Name - nsBindingManager.cpp - MacOS - Text - Debug - - - Name - nsNodeInfo.cpp - MacOS - Text - Debug - - - Name - nsNodeInfoManager.cpp - MacOS - Text - Debug - - - Name - nsContentPolicy.cpp - MacOS - Text - Debug - - - Name - nsComputedDOMStyle.cpp - MacOS - Text - Debug - - - Name - nsInspectorCSSUtils.cpp - MacOS - Text - Debug - - - Name - nsROCSSPrimitiveValue.cpp - MacOS - Text - Debug - - - Name - nsStyleUtil.cpp - MacOS - Text - Debug - - - Name - nsXBLPrototypeHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLDragHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLFocusHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLFormHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLKeyHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLLoadHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLMouseHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLMouseMotionHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLScrollHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLXULHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLWindowKeyHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLPrototypeBinding.cpp - MacOS - Text - Debug - - - Name - nsHTMLContentSerializer.cpp - MacOS - Text - Debug - - - Name - nsPlainTextSerializer.cpp - MacOS - Text - Debug - - - Name - nsXMLContentSerializer.cpp - MacOS - Text - Debug - - - Name - nsDOMMutationEvent.cpp - MacOS - Text - Debug - - - Name - nsXBLMutationHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLWindowHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLWindowDragHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLInsertionPoint.cpp - MacOS - Text - Debug - - - Name - nsContentUtils.cpp - MacOS - Text - Debug - - - Name - nsSyncLoadService.cpp - MacOS - Text - Debug - - - Name - nsStyleContext.cpp - MacOS - Text - Debug - - - Name - nsElementMap.cpp - MacOS - Text - Debug - - - Name - nsXULCommandDispatcher.cpp - MacOS - Text - Debug - - - Name - nsXULContentSink.cpp - MacOS - Text - Debug - - - Name - nsXULControllers.cpp - MacOS - Text - Debug - - - Name - nsXULDocument.cpp - MacOS - Text - Debug - - - Name - nsXULPrototypeCache.cpp - MacOS - Text - Debug - - - Name - nsXULPrototypeDocument.cpp - MacOS - Text - Debug - - - Name - nsRDFDOMNodeList.cpp - MacOS - Text - Debug - - - Name - nsXULAttributes.cpp - MacOS - Text - Debug - - - Name - nsXULAttributeValue.cpp - MacOS - Text - Debug - - - Name - nsXULPopupListener.cpp - MacOS - Text - Debug - - - Name - nsRuleNetwork.cpp - MacOS - Text - Debug - - - Name - nsXULContentUtils.cpp - MacOS - Text - Debug - - - Name - nsXULSortService.cpp - MacOS - Text - Debug - - - Name - nsXULTemplateBuilder.cpp - MacOS - Text - Debug - - - Name - nsXULElement.cpp - MacOS - Text - Debug - - - Name - nsParserUtils.cpp - MacOS - Text - Debug - - - Name - nsClusterKey.cpp - MacOS - Text - Debug - - - Name - nsClusterKeySet.cpp - MacOS - Text - Debug - - - Name - nsConflictSet.cpp - MacOS - Text - Debug - - - Name - nsContentSupportMap.cpp - MacOS - Text - Debug - - - Name - nsContentTagTestNode.cpp - MacOS - Text - Debug - - - Name - nsContentTestNode.cpp - MacOS - Text - Debug - - - Name - nsInstantiationNode.cpp - MacOS - Text - Debug - - - Name - nsTreeRows.cpp - MacOS - Text - Debug - - - Name - nsTreeRowTestNode.cpp - MacOS - Text - Debug - - - Name - nsRDFConInstanceTestNode.cpp - MacOS - Text - Debug - - - Name - nsRDFConMemberTestNode.cpp - MacOS - Text - Debug - - - Name - nsRDFPropertyTestNode.cpp - MacOS - Text - Debug - - - Name - nsResourceSet.cpp - MacOS - Text - Debug - - - Name - nsTemplateMatch.cpp - MacOS - Text - Debug - - - Name - nsTemplateMatchSet.cpp - MacOS - Text - Debug - - - Name - nsTemplateRule.cpp - MacOS - Text - Debug - - - Name - nsXULContentBuilder.cpp - MacOS - Text - Debug - - - Name - nsXULTreeBuilder.cpp - MacOS - Text - Debug - - - Name - nsXBLContextMenuHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLCustomHandler.cpp - MacOS - Text - Debug - - - Name - nsScriptLoader.cpp - MacOS - Text - Debug - - - Name - nsScriptEventManager.cpp - MacOS - Text - Debug - - - Name - nsImageLoadingContent.cpp - MacOS - Text - Debug - - - Name - nsStyleLinkElement.cpp - MacOS - Text - Debug - - - Name - nsTreeWalker.cpp - MacOS - Text - Debug - - - Name - nsRuleNode.cpp - MacOS - Text - Debug - - - Name - nsContentAreaDragDrop.cpp - MacOS - Text - Debug - - - Name - nsFrameLoader.cpp - MacOS - Text - Debug - - - Name - nsHTMLSharedLeafElement.cpp - MacOS - Text - Debug - - - Name - nsXBLContentSink.cpp - MacOS - Text - Debug - - - Name - nsXBLDocumentInfo.cpp - MacOS - Text - Debug - - - Name - nsFormSubmission.cpp - MacOS - Text - Debug - - - Name - nsDOMCSSAttrDeclaration.cpp - MacOS - Text - Debug - - - Name - nsCSSOMFactory.cpp - MacOS - Text - Debug - - - Name - nsXBLPrototypeResources.cpp - MacOS - Text - Debug - - - Name - nsXBLResourceLoader.cpp - MacOS - Text - Debug - - - Name - nsXBLProtoImpl.cpp - MacOS - Text - Debug - - - Name - nsXBLProtoImplField.cpp - MacOS - Text - Debug - - - Name - nsXBLProtoImplMethod.cpp - MacOS - Text - Debug - - - Name - nsXBLProtoImplProperty.cpp - MacOS - Text - Debug - - - Name - contentSVG.o - MacOS - Library - Debug - - - Name - nsFIXptr.cpp - MacOS - Text - Debug - - - Name - nsDOMCSSRect.cpp - MacOS - Text - Debug - - - Name - nsWyciwygChannel.cpp - MacOS - Text - Debug - - - Name - nsWyciwygProtocolHandler.cpp - MacOS - Text - Debug - - - Name - mozSanitizingSerializer.cpp - MacOS - Text - Debug - - - Name - nsDOMCSSRGBColor.cpp - MacOS - Text - Debug - - - Name - nsDOMCSSValueList.cpp - MacOS - Text - Debug - - - Name - nsXMLStylesheetPI.cpp - MacOS - Text - Debug - - - - - Name - NSComponentStartup.o - MacOS - - - Name - InterfacesStubs - MacOS - - - Name - nsDocument.cpp - MacOS - - - Name - nsStyleSet.cpp - MacOS - - - Name - nsHTMLContentSink.cpp - MacOS - - - Name - nsHTMLDocument.cpp - MacOS - - - Name - nsCSSDeclaration.cpp - MacOS - - - Name - nsCSSParser.cpp - MacOS - - - Name - nsCSSScanner.cpp - MacOS - - - Name - nsCSSStyleRule.cpp - MacOS - - - Name - nsCSSStyleSheet.cpp - MacOS - - - Name - nsHTMLAttributes.cpp - MacOS - - - Name - nsHTMLStyleSheet.cpp - MacOS - - - Name - nsHTMLCSSStyleSheet.cpp - MacOS - - - Name - nsDOMEvent.cpp - MacOS - - - Name - nsDOMEventGroup.cpp - MacOS - - - Name - nsEventListenerManager.cpp - MacOS - - - Name - nsEventStateManager.cpp - MacOS - - - Name - nsContentList.cpp - MacOS - - - Name - nsImageDocument.cpp - MacOS - - - Name - nsMarkupDocument.cpp - MacOS - - - Name - nsGenericHTMLElement.cpp - MacOS - - - Name - nsHTMLAnchorElement.cpp - MacOS - - - Name - nsHTMLAppletElement.cpp - MacOS - - - Name - nsHTMLAreaElement.cpp - MacOS - - - Name - nsHTMLBaseFontElement.cpp - MacOS - - - Name - nsHTMLBodyElement.cpp - MacOS - - - Name - nsHTMLBRElement.cpp - MacOS - - - Name - nsHTMLButtonElement.cpp - MacOS - - - Name - nsHTMLDelElement.cpp - MacOS - - - Name - nsHTMLDirectoryElement.cpp - MacOS - - - Name - nsHTMLDivElement.cpp - MacOS - - - Name - nsHTMLDListElement.cpp - MacOS - - - Name - nsHTMLFontElement.cpp - MacOS - - - Name - nsHTMLFormElement.cpp - MacOS - - - Name - nsHTMLFrameElement.cpp - MacOS - - - Name - nsHTMLFrameSetElement.cpp - MacOS - - - Name - nsHTMLHeadElement.cpp - MacOS - - - Name - nsHTMLHeadingElement.cpp - MacOS - - - Name - nsHTMLHRElement.cpp - MacOS - - - Name - nsHTMLHtmlElement.cpp - MacOS - - - Name - nsHTMLIFrameElement.cpp - MacOS - - - Name - nsHTMLImageElement.cpp - MacOS - - - Name - nsHTMLInputElement.cpp - MacOS - - - Name - nsHTMLInsElement.cpp - MacOS - - - Name - nsHTMLLabelElement.cpp - MacOS - - - Name - nsHTMLLegendElement.cpp - MacOS - - - Name - nsHTMLLIElement.cpp - MacOS - - - Name - nsHTMLLinkElement.cpp - MacOS - - - Name - nsHTMLMapElement.cpp - MacOS - - - Name - nsHTMLMenuElement.cpp - MacOS - - - Name - nsHTMLMetaElement.cpp - MacOS - - - Name - nsHTMLModElement.cpp - MacOS - - - Name - nsHTMLObjectElement.cpp - MacOS - - - Name - nsHTMLOListElement.cpp - MacOS - - - Name - nsHTMLOptGroupElement.cpp - MacOS - - - Name - nsHTMLOptionElement.cpp - MacOS - - - Name - nsHTMLParagraphElement.cpp - MacOS - - - Name - nsHTMLPreElement.cpp - MacOS - - - Name - nsHTMLQuoteElement.cpp - MacOS - - - Name - nsHTMLScriptElement.cpp - MacOS - - - Name - nsHTMLSelectElement.cpp - MacOS - - - Name - nsHTMLStyleElement.cpp - MacOS - - - Name - nsHTMLTableCaptionElement.cpp - MacOS - - - Name - nsHTMLTableCellElement.cpp - MacOS - - - Name - nsHTMLTableColElement.cpp - MacOS - - - Name - nsHTMLTableElement.cpp - MacOS - - - Name - nsHTMLTableRowElement.cpp - MacOS - - - Name - nsHTMLTableSectionElement.cpp - MacOS - - - Name - nsHTMLTextAreaElement.cpp - MacOS - - - Name - nsHTMLTitleElement.cpp - MacOS - - - Name - nsHTMLUListElement.cpp - MacOS - - - Name - nsHTMLSpanElement.cpp - MacOS - - - Name - nsDOMCSSDeclaration.cpp - MacOS - - - Name - nsCSSValue.cpp - MacOS - - - Name - nsHTMLFieldSetElement.cpp - MacOS - - - Name - nsGenericElement.cpp - MacOS - - - Name - nsXMLContentSink.cpp - MacOS - - - Name - nsXMLPrettyPrinter.cpp - MacOS - - - Name - nsXMLDocument.cpp - MacOS - - - Name - nsXMLElement.cpp - MacOS - - - Name - nsGenericDOMHTMLCollection.cpp - MacOS - - - Name - GenericElementCollection.cpp - MacOS - - - Name - nsDocumentFragment.cpp - MacOS - - - Name - gfx.shlb - MacOS - - - Name - JavaScript.shlb - MacOS - - - Name - NSPR20.shlb - MacOS - - - Name - NSRuntime.shlb - MacOS - - - Name - NSStdLib.shlb - MacOS - - - Name - xpcom.shlb - MacOS - - - Name - nsRange.cpp - MacOS - - - Name - nsNameSpaceManager.cpp - MacOS - - - Name - nsContentIterator.cpp - MacOS - - - Name - nsDOMAttribute.cpp - MacOS - - - Name - nsDOMAttributeMap.cpp - MacOS - - - Name - nsCommentNode.cpp - MacOS - - - Name - nsGenericDOMDataNode.cpp - MacOS - - - Name - nsTextNode.cpp - MacOS - - - Name - nsGenericDOMNodeList.cpp - MacOS - - - Name - nsXMLProcessingInstruction.cpp - MacOS - - - Name - nsXMLCDATASection.cpp - MacOS - - - Name - nsDocumentViewer.cpp - MacOS - - - Name - nsPagePrintTimer.cpp - MacOS - - - Name - nsPrintData.cpp - MacOS - - - Name - nsPrintEngine.cpp - MacOS - - - Name - nsPrintObject.cpp - MacOS - - - Name - nsPrintPreviewListener.cpp - MacOS - - - Name - nsCSSLoader.cpp - MacOS - - - Name - nsHTMLFragmentContentSink.cpp - MacOS - - - Name - nsDocumentEncoder.cpp - MacOS - - - Name - nsCSSRule.cpp - MacOS - - - Name - nsCSSRules.cpp - MacOS - - - Name - nsPrivateTextRange.cpp - MacOS - - - Name - nsAttributeContent.cpp - MacOS - - - Name - nsXMLEntity.cpp - MacOS - - - Name - nsXMLNotation.cpp - MacOS - - - Name - nsXMLNamedNodeMap.cpp - MacOS - - - Name - libutil.shlb - MacOS - - - Name - nsTextContentChangeData.cpp - MacOS - - - Name - nsXBLService.cpp - MacOS - - - Name - nsXBLBinding.cpp - MacOS - - - Name - nsXBLEventHandler.cpp - MacOS - - - Name - nsSelection.cpp - MacOS - - - Name - nsDOMDocumentType.cpp - MacOS - - - Name - nsGeneratedIterator.cpp - MacOS - - - Name - nsHTMLUnknownElement.cpp - MacOS - - - Name - nsBindingManager.cpp - MacOS - - - Name - nsNodeInfo.cpp - MacOS - - - Name - nsNodeInfoManager.cpp - MacOS - - - Name - nsContentPolicy.cpp - MacOS - - - Name - nsComputedDOMStyle.cpp - MacOS - - - Name - nsInspectorCSSUtils.cpp - MacOS - - - Name - nsROCSSPrimitiveValue.cpp - MacOS - - - Name - nsStyleUtil.cpp - MacOS - - - Name - nsXBLPrototypeHandler.cpp - MacOS - - - Name - nsXBLDragHandler.cpp - MacOS - - - Name - nsXBLFocusHandler.cpp - MacOS - - - Name - nsXBLFormHandler.cpp - MacOS - - - Name - nsXBLKeyHandler.cpp - MacOS - - - Name - nsXBLLoadHandler.cpp - MacOS - - - Name - nsXBLMouseHandler.cpp - MacOS - - - Name - nsXBLMouseMotionHandler.cpp - MacOS - - - Name - nsXBLScrollHandler.cpp - MacOS - - - Name - nsXBLXULHandler.cpp - MacOS - - - Name - nsXBLWindowKeyHandler.cpp - MacOS - - - Name - nsXBLPrototypeBinding.cpp - MacOS - - - Name - nsHTMLContentSerializer.cpp - MacOS - - - Name - nsPlainTextSerializer.cpp - MacOS - - - Name - nsXMLContentSerializer.cpp - MacOS - - - Name - nsDOMMutationEvent.cpp - MacOS - - - Name - nsXBLMutationHandler.cpp - MacOS - - - Name - nsXBLWindowHandler.cpp - MacOS - - - Name - nsXBLWindowDragHandler.cpp - MacOS - - - Name - nsXBLInsertionPoint.cpp - MacOS - - - Name - nsContentUtils.cpp - MacOS - - - Name - nsSyncLoadService.cpp - MacOS - - - Name - nsStyleContext.cpp - MacOS - - - Name - nsElementMap.cpp - MacOS - - - Name - nsXULCommandDispatcher.cpp - MacOS - - - Name - nsXULContentSink.cpp - MacOS - - - Name - nsXULControllers.cpp - MacOS - - - Name - nsXULDocument.cpp - MacOS - - - Name - nsXULPrototypeCache.cpp - MacOS - - - Name - nsXULPrototypeDocument.cpp - MacOS - - - Name - nsRDFDOMNodeList.cpp - MacOS - - - Name - nsXULAttributes.cpp - MacOS - - - Name - nsXULAttributeValue.cpp - MacOS - - - Name - nsXULPopupListener.cpp - MacOS - - - Name - nsRuleNetwork.cpp - MacOS - - - Name - nsXULContentUtils.cpp - MacOS - - - Name - nsXULSortService.cpp - MacOS - - - Name - nsXULTemplateBuilder.cpp - MacOS - - - Name - nsXULElement.cpp - MacOS - - - Name - nsParserUtils.cpp - MacOS - - - Name - nsClusterKey.cpp - MacOS - - - Name - nsClusterKeySet.cpp - MacOS - - - Name - nsConflictSet.cpp - MacOS - - - Name - nsContentSupportMap.cpp - MacOS - - - Name - nsContentTagTestNode.cpp - MacOS - - - Name - nsContentTestNode.cpp - MacOS - - - Name - nsInstantiationNode.cpp - MacOS - - - Name - nsTreeRows.cpp - MacOS - - - Name - nsTreeRowTestNode.cpp - MacOS - - - Name - nsRDFConInstanceTestNode.cpp - MacOS - - - Name - nsRDFConMemberTestNode.cpp - MacOS - - - Name - nsRDFPropertyTestNode.cpp - MacOS - - - Name - nsResourceSet.cpp - MacOS - - - Name - nsTemplateMatch.cpp - MacOS - - - Name - nsTemplateMatchSet.cpp - MacOS - - - Name - nsTemplateRule.cpp - MacOS - - - Name - nsXULContentBuilder.cpp - MacOS - - - Name - nsXULTreeBuilder.cpp - MacOS - - - Name - nsXBLContextMenuHandler.cpp - MacOS - - - Name - nsXBLCustomHandler.cpp - MacOS - - - Name - nsScriptLoader.cpp - MacOS - - - Name - nsScriptEventManager.cpp - MacOS - - - Name - nsImageLoadingContent.cpp - MacOS - - - Name - nsStyleLinkElement.cpp - MacOS - - - Name - nsTreeWalker.cpp - MacOS - - - Name - nsRuleNode.cpp - MacOS - - - Name - nsContentAreaDragDrop.cpp - MacOS - - - Name - nsFrameLoader.cpp - MacOS - - - Name - nsHTMLSharedLeafElement.cpp - MacOS - - - Name - nsXBLContentSink.cpp - MacOS - - - Name - nsXBLDocumentInfo.cpp - MacOS - - - Name - nsFormSubmission.cpp - MacOS - - - Name - nsDOMCSSAttrDeclaration.cpp - MacOS - - - Name - nsCSSOMFactory.cpp - MacOS - - - Name - nsXBLPrototypeResources.cpp - MacOS - - - Name - nsXBLResourceLoader.cpp - MacOS - - - Name - nsXBLProtoImpl.cpp - MacOS - - - Name - nsXBLProtoImplField.cpp - MacOS - - - Name - nsXBLProtoImplMethod.cpp - MacOS - - - Name - nsXBLProtoImplProperty.cpp - MacOS - - - Name - contentSVG.o - MacOS - - - Name - nsFIXptr.cpp - MacOS - - - Name - nsDOMCSSRect.cpp - MacOS - - - Name - nsWyciwygChannel.cpp - MacOS - - - Name - nsWyciwygProtocolHandler.cpp - MacOS - - - Name - mozSanitizingSerializer.cpp - MacOS - - - Name - nsDOMCSSRGBColor.cpp - MacOS - - - Name - nsDOMCSSValueList.cpp - MacOS - - - Name - nsXMLStylesheetPI.cpp - MacOS - - - - - contentDebug.o - - - - UserSourceTrees - - - AlwaysSearchUserPathsfalse - InterpretDOSAndUnixPathsfalse - RequireFrameworkStyleIncludesfalse - UserSearchPaths - - SearchPath - Path:: - PathFormatMacOS - PathRootProject - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - SearchPath - Path:::dist: - PathFormatMacOS - PathRootProject - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - SystemSearchPaths - - SearchPath - Path:MSL: - PathFormatMacOS - PathRootCodeWarrior - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - SearchPath - Path:MacOS Support: - PathFormatMacOS - PathRootCodeWarrior - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - - - MWRuntimeSettings_WorkingDirectory - MWRuntimeSettings_CommandLine - MWRuntimeSettings_HostApplication - Path - PathFormatGeneric - PathRootAbsolute - - MWRuntimeSettings_EnvVars - - - LinkerMacOS PPC Linker - PreLinker - PostLinker - TargetnamecontentDebug.o - OutputDirectory - Path: - PathFormatMacOS - PathRootProject - - SaveEntriesUsingRelativePathsfalse - - - FileMappings - - FileTypeAPPL - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeAppl - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeMMLB - FileExtension - CompilerLib Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeMPLF - FileExtension - CompilerLib Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeMWCD - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeRSRC - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.c - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.c++ - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.cc - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.cp - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.cpp - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.exp - Compiler - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.h - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMaketrue - - - FileTypeTEXT - FileExtension.p - CompilerMW Pascal PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.pas - CompilerMW Pascal PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.pch - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompiletrue - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.pch++ - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompiletrue - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.ppu - CompilerMW Pascal PPC - EditLanguage - Precompiletrue - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.r - CompilerRez - EditLanguageRez - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.s - CompilerPPCAsm - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeXCOF - FileExtension - CompilerXCOFF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypedocu - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypersrc - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeshlb - FileExtension - CompilerPEF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypestub - FileExtension - CompilerPEF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileExtension.doc - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFilefalse - IgnoredByMaketrue - - - - - CacheModDatestrue - ActivateBrowsertrue - DumpBrowserInfofalse - CacheSubprojectstrue - UseThirdPartyDebuggerfalse - DebuggerAppPath - Path - PathFormatGeneric - PathRootAbsolute - - DebuggerCmdLineArgs - DebuggerWorkingDir - Path - PathFormatGeneric - PathRootAbsolute - - - - LogSystemMessagestrue - AutoTargetDLLsfalse - StopAtWatchpointstrue - PauseWhileRunningfalse - PauseInterval5 - PauseUIFlags0 - AltExePath - Path - PathFormatGeneric - PathRootAbsolute - - StopAtTempBPOnLaunchtrue - CacheSymbolicstrue - TempBPFunctionNamemain - TempBPType0 - - - Enabledfalse - ConnectionName - DownloadPath - LaunchRemoteAppfalse - RemoteAppPath - - - OtherExecutables - - - CustomColor1 - Red0 - Green32767 - Blue0 - - CustomColor2 - Red0 - Green32767 - Blue0 - - CustomColor3 - Red0 - Green32767 - Blue0 - - CustomColor4 - Red0 - Green32767 - Blue0 - - - - MWFrontEnd_C_cplusplus0 - MWFrontEnd_C_checkprotos1 - MWFrontEnd_C_arm0 - MWFrontEnd_C_trigraphs0 - MWFrontEnd_C_onlystdkeywords0 - MWFrontEnd_C_enumsalwaysint1 - MWFrontEnd_C_mpwpointerstyle0 - MWFrontEnd_C_prefixnamecontentSharedPrefix_debug.h - MWFrontEnd_C_ansistrict0 - MWFrontEnd_C_mpwcnewline0 - MWFrontEnd_C_wchar_type1 - MWFrontEnd_C_enableexceptions1 - MWFrontEnd_C_dontreusestrings0 - MWFrontEnd_C_poolstrings0 - MWFrontEnd_C_dontinline0 - MWFrontEnd_C_useRTTI1 - MWFrontEnd_C_multibyteaware0 - MWFrontEnd_C_unsignedchars0 - MWFrontEnd_C_autoinline0 - MWFrontEnd_C_booltruefalse0 - MWFrontEnd_C_direct_to_som0 - MWFrontEnd_C_som_env_check0 - MWFrontEnd_C_alwaysinline0 - MWFrontEnd_C_inlinelevel0 - MWFrontEnd_C_ecplusplus0 - MWFrontEnd_C_objective_c0 - MWFrontEnd_C_defer_codegen0 - - - MWWarning_C_warn_illpragma1 - MWWarning_C_warn_emptydecl1 - MWWarning_C_warn_possunwant1 - MWWarning_C_warn_unusedvar1 - MWWarning_C_warn_unusedarg1 - MWWarning_C_warn_extracomma1 - MWWarning_C_pedantic1 - MWWarning_C_warningerrors0 - MWWarning_C_warn_hidevirtual1 - MWWarning_C_warn_implicitconv0 - MWWarning_C_warn_notinlined0 - MWWarning_C_warn_structclass0 - - - MWMerge_MacOS_projectTypeApplication - MWMerge_MacOS_outputNameMerge Out - MWMerge_MacOS_outputCreator???? - MWMerge_MacOS_outputTypeAPPL - MWMerge_MacOS_suppressWarning0 - MWMerge_MacOS_copyFragments1 - MWMerge_MacOS_copyResources1 - MWMerge_MacOS_flattenResource0 - MWMerge_MacOS_flatFileNamea.rsrc - MWMerge_MacOS_flatFileOutputPath - Path: - PathFormatMacOS - PathRootProject - - MWMerge_MacOS_skipResources - DLGX - ckid - Proj - WSPC - - - - FileLockedfalse - ResourcesMapIsReadOnlyfalse - PrinterDriverIsMultiFinderCompatiblefalse - Invisiblefalse - HasBundlefalse - NameLockedfalse - Stationeryfalse - HasCustomIconfalse - Sharedfalse - HasBeenInitedfalse - Label0 - Comments - - - MWMacOSPackager_UsePackager0 - MWMacOSPackager_FolderToPackage - Path: - PathFormatMacOS - PathRootProject - - MWMacOSPackager_CreateClassicAlias0 - MWMacOSPackager_ClassicAliasMethodUseTargetOutput - MWMacOSPackager_ClassicAliasPath - Path: - PathFormatMacOS - PathRootProject - - MWMacOSPackager_CreatePkgInfo0 - MWMacOSPackager_PkgCreatorType???? - MWMacOSPackager_PkgFileTypeAPPL - - - MWCodeGen_PPC_structalignmentPPC - MWCodeGen_PPC_tracebacktablesInline - MWCodeGen_PPC_processorGeneric - MWCodeGen_PPC_readonlystrings0 - MWCodeGen_PPC_tocdata1 - MWCodeGen_PPC_profiler0 - MWCodeGen_PPC_fpcontract1 - MWCodeGen_PPC_schedule1 - MWCodeGen_PPC_peephole1 - MWCodeGen_PPC_processorspecific0 - MWCodeGen_PPC_altivec0 - MWCodeGen_PPC_vectortocdata0 - MWCodeGen_PPC_vrsave0 - - - MWCodeGen_MachO_structalignmentPPC - MWCodeGen_MachO_tracebacktablesNone - MWCodeGen_MachO_processorGeneric - MWCodeGen_MachO_readonlystrings0 - MWCodeGen_MachO_profiler0 - MWCodeGen_MachO_fpcontract1 - MWCodeGen_MachO_schedule0 - MWCodeGen_MachO_peephole1 - MWCodeGen_MachO_processorspecific0 - MWCodeGen_MachO_altivec0 - MWCodeGen_MachO_vrsave1 - MWCodeGen_MachO_common0 - MWCodeGen_MachO_implicit_templates1 - - - MWDisassembler_PPC_showcode1 - MWDisassembler_PPC_extended1 - MWDisassembler_PPC_mix1 - MWDisassembler_PPC_nohex0 - MWDisassembler_PPC_showdata1 - MWDisassembler_PPC_showexceptions1 - MWDisassembler_PPC_showsym0 - MWDisassembler_PPC_shownames1 - - - GlobalOptimizer_PPC_optimizationlevelLevel0 - GlobalOptimizer_PPC_optforSpeed - - - MWLinker_PPC_linksym1 - MWLinker_PPC_symfullpath1 - MWLinker_PPC_linkmap0 - MWLinker_PPC_nolinkwarnings0 - MWLinker_PPC_dontdeadstripinitcode0 - MWLinker_PPC_permitmultdefs1 - MWLinker_PPC_linkmodeFast - MWLinker_PPC_initname__NSInitialize - MWLinker_PPC_mainname - MWLinker_PPC_termname__NSTerminate - - - MWLinker_MachO_exportsNone - MWLinker_MachO_mainnamestart - MWLinker_MachO_currentversion0 - MWLinker_MachO_compatibleversion0 - MWLinker_MachO_symfullpath0 - MWLinker_MachO_supresswarnings0 - MWLinker_MachO_multisymerror0 - MWLinker_MachO_prebind1 - MWLinker_MachO_deadstrip1 - MWLinker_MachO_objectivecsemantics0 - MWLinker_MachO_whichfileloaded0 - MWLinker_MachO_whyfileloaded0 - MWLinker_MachO_readonlyrelocsErrors - MWLinker_MachO_undefinedsymbolsErrors - MWLinker_MachO_twolevelnamespace1 - MWLinker_MachO_stripdebugsymbols0 - - - MWProject_MachO_typeExecutable - MWProject_MachO_outfilea.exe - MWProject_MachO_filecreator???? - MWProject_MachO_filetypeMEXE - MWProject_MachO_stacksize64 - MWProject_MachO_stackaddress0 - MWProject_MachO_flatrsrc1 - MWProject_MachO_flatrsrcfilenamea.rsrc - MWProject_MachO_flatrsrcoutputdir - Path: - PathFormatMacOS - PathRootProject - - MWProject_MachO_installpath./ - - - MWPEF_exportsPragma - MWPEF_libfolder0 - MWPEF_sortcodeNone - MWPEF_expandbss0 - MWPEF_sharedata0 - MWPEF_olddefversion0 - MWPEF_oldimpversion0 - MWPEF_currentversion0 - MWPEF_fragmentnameCONTENT_DLL - MWPEF_collapsereloads0 - - - MWProject_PPC_typeLibrary - MWProject_PPC_outfilecontentDebug.o - MWProject_PPC_filecreator???? - MWProject_PPC_filetype???? - MWProject_PPC_size0 - MWProject_PPC_minsize0 - MWProject_PPC_stacksize0 - MWProject_PPC_flags0 - MWProject_PPC_symfilename - MWProject_PPC_rsrcname - MWProject_PPC_rsrcheaderNative - MWProject_PPC_rsrctype???? - MWProject_PPC_rsrcid0 - MWProject_PPC_rsrcflags0 - MWProject_PPC_rsrcstore0 - MWProject_PPC_rsrcmerge0 - MWProject_PPC_flatrsrc0 - MWProject_PPC_flatrsrcoutputdir - Path: - PathFormatMacOS - PathRootProject - - MWProject_PPC_flatrsrcfilename - - - MWAssembler_PPC_auxheader0 - MWAssembler_PPC_symmodeMac - MWAssembler_PPC_dialectPPC - MWAssembler_PPC_prefixfile - MWAssembler_PPC_typecheck0 - MWAssembler_PPC_warnings0 - MWAssembler_PPC_casesensitive0 - - - MWRez_Language_maxwidth80 - MWRez_Language_scriptRoman - MWRez_Language_alignmentAlign1 - MWRez_Language_filtermodeFilterSkip - MWRez_Language_suppresswarnings0 - MWRez_Language_escapecontrolchars1 - MWRez_Language_prefixname - MWRez_Language_filteredtypes'CODE' 'DATA' 'PICT' - xpidl Settings - 0001000101000000000000000000000000000000000000000000000000000000 - 0000000000000000 - - - - - Name - nsDocument.cpp - MacOS - Text - Debug - - - Name - nsStyleSet.cpp - MacOS - Text - Debug - - - Name - nsHTMLContentSink.cpp - MacOS - Text - Debug - - - Name - nsHTMLDocument.cpp - MacOS - Text - Debug - - - Name - nsCSSDeclaration.cpp - MacOS - Text - Debug - - - Name - nsCSSParser.cpp - MacOS - Text - Debug - - - Name - nsCSSScanner.cpp - MacOS - Text - Debug - - - Name - nsCSSStyleRule.cpp - MacOS - Text - Debug - - - Name - nsCSSStyleSheet.cpp - MacOS - Text - Debug - - - Name - nsHTMLAttributes.cpp - MacOS - Text - Debug - - - Name - nsHTMLStyleSheet.cpp - MacOS - Text - Debug - - - Name - nsHTMLCSSStyleSheet.cpp - MacOS - Text - Debug - - - Name - nsDOMEvent.cpp - MacOS - Text - Debug - - - Name - nsDOMEventGroup.cpp - MacOS - Text - Debug - - - Name - nsEventListenerManager.cpp - MacOS - Text - Debug - - - Name - nsEventStateManager.cpp - MacOS - Text - Debug - - - Name - nsContentList.cpp - MacOS - Text - Debug - - - Name - nsImageDocument.cpp - MacOS - Text - Debug - - - Name - nsMarkupDocument.cpp - MacOS - Text - Debug - - - Name - nsGenericHTMLElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLAnchorElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLAppletElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLAreaElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLBaseFontElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLBodyElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLBRElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLButtonElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLDelElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLDirectoryElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLDivElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLDListElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLFontElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLFormElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLFrameElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLFrameSetElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLHeadElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLHeadingElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLHRElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLHtmlElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLIFrameElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLImageElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLInputElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLInsElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLLabelElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLLegendElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLLIElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLLinkElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLMapElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLMenuElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLMetaElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLModElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLObjectElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLOListElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLOptGroupElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLOptionElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLParagraphElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLPreElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLQuoteElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLScriptElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLSelectElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLStyleElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLTableCaptionElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLTableCellElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLTableColElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLTableElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLTableRowElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLTableSectionElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLTextAreaElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLTitleElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLUListElement.cpp - MacOS - Text - Debug - - - Name - nsHTMLSpanElement.cpp - MacOS - Text - Debug - - - Name - nsDOMCSSDeclaration.cpp - MacOS - Text - Debug - - - Name - nsCSSValue.cpp - MacOS - Text - Debug - - - Name - nsHTMLFieldSetElement.cpp - MacOS - Text - Debug - - - Name - nsGenericElement.cpp - MacOS - Text - Debug - - - Name - nsXMLContentSink.cpp - MacOS - Text - Debug - - - Name - nsXMLPrettyPrinter.cpp - MacOS - Text - Debug - - - Name - nsXMLDocument.cpp - MacOS - Text - Debug - - - Name - nsXMLElement.cpp - MacOS - Text - Debug - - - Name - NSRuntimeDebug.shlb - MacOS - Library - - - - Name - NSStdLibDebug.shlb - MacOS - Library - - - - Name - InterfacesStubs - MacOS - Library - - - - Name - nsGenericDOMHTMLCollection.cpp - MacOS - Text - Debug - - - Name - GenericElementCollection.cpp - MacOS - Text - Debug - - - Name - xpcomDebug.shlb - MacOS - Library - Debug - - - Name - gfxDebug.shlb - MacOS - Library - Debug - - - Name - NSPR20Debug.shlb - MacOS - Library - Debug - - - Name - JavaScriptDebug.shlb - MacOS - Library - Debug - - - Name - nsDocumentFragment.cpp - MacOS - Text - Debug - - - Name - nsRange.cpp - MacOS - Text - Debug - - - Name - nsNameSpaceManager.cpp - MacOS - Text - Debug - - - Name - nsContentIterator.cpp - MacOS - Text - Debug - - - Name - nsDOMAttribute.cpp - MacOS - Text - Debug - - - Name - nsDOMAttributeMap.cpp - MacOS - Text - Debug - - - Name - nsCommentNode.cpp - MacOS - Text - Debug - - - Name - nsGenericDOMDataNode.cpp - MacOS - Text - Debug - - - Name - nsTextNode.cpp - MacOS - Text - Debug - - - Name - nsGenericDOMNodeList.cpp - MacOS - Text - Debug - - - Name - nsXMLProcessingInstruction.cpp - MacOS - Text - Debug - - - Name - nsXMLCDATASection.cpp - MacOS - Text - Debug - - - Name - nsDocumentViewer.cpp - MacOS - Text - Debug - - - Name - nsPagePrintTimer.cpp - MacOS - Text - Debug - - - Name - nsPrintData.cpp - MacOS - Text - Debug - - - Name - nsPrintEngine.cpp - MacOS - Text - Debug - - - Name - nsPrintObject.cpp - MacOS - Text - Debug - - - Name - nsPrintPreviewListener.cpp - MacOS - Text - Debug - - - Name - nsCSSLoader.cpp - MacOS - Text - Debug - - - Name - nsHTMLFragmentContentSink.cpp - MacOS - Text - Debug - - - Name - nsDocumentEncoder.cpp - MacOS - Text - Debug - - - Name - nsCSSRule.cpp - MacOS - Text - Debug - - - Name - nsCSSRules.cpp - MacOS - Text - Debug - - - Name - nsPrivateTextRange.cpp - MacOS - Text - Debug - - - Name - nsAttributeContent.cpp - MacOS - Text - Debug - - - Name - nsXMLEntity.cpp - MacOS - Text - Debug - - - Name - nsXMLNotation.cpp - MacOS - Text - Debug - - - Name - nsXMLNamedNodeMap.cpp - MacOS - Text - Debug - - - Name - NSComponentStartup.o - MacOS - Library - Debug - - - Name - libutilDebug.shlb - MacOS - Library - Debug - - - Name - nsTextContentChangeData.cpp - MacOS - Text - Debug - - - Name - nsXBLService.cpp - MacOS - Text - Debug - - - Name - nsXBLBinding.cpp - MacOS - Text - Debug - - - Name - nsXBLEventHandler.cpp - MacOS - Text - Debug - - - Name - nsSelection.cpp - MacOS - Text - Debug - - - Name - nsDOMDocumentType.cpp - MacOS - Text - Debug - - - Name - nsGeneratedIterator.cpp - MacOS - Text - Debug - - - Name - nsHTMLUnknownElement.cpp - MacOS - Text - Debug - - - Name - nsBindingManager.cpp - MacOS - Text - Debug - - - Name - nsNodeInfo.cpp - MacOS - Text - Debug - - - Name - nsNodeInfoManager.cpp - MacOS - Text - Debug - - - Name - nsContentPolicy.cpp - MacOS - Text - Debug - - - Name - nsComputedDOMStyle.cpp - MacOS - Text - Debug - - - Name - nsInspectorCSSUtils.cpp - MacOS - Text - Debug - - - Name - nsROCSSPrimitiveValue.cpp - MacOS - Text - Debug - - - Name - nsStyleUtil.cpp - MacOS - Text - Debug - - - Name - nsXBLPrototypeHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLDragHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLFocusHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLFormHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLKeyHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLLoadHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLMouseHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLMouseMotionHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLScrollHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLXULHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLWindowKeyHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLPrototypeBinding.cpp - MacOS - Text - Debug - - - Name - nsHTMLContentSerializer.cpp - MacOS - Text - Debug - - - Name - nsPlainTextSerializer.cpp - MacOS - Text - Debug - - - Name - nsXMLContentSerializer.cpp - MacOS - Text - Debug - - - Name - nsDOMMutationEvent.cpp - MacOS - Text - Debug - - - Name - nsXBLMutationHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLWindowHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLWindowDragHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLInsertionPoint.cpp - MacOS - Text - Debug - - - Name - nsContentUtils.cpp - MacOS - Text - Debug - - - Name - nsSyncLoadService.cpp - MacOS - Text - Debug - - - Name - nsStyleContext.cpp - MacOS - Text - Debug - - - Name - nsElementMap.cpp - MacOS - Text - Debug - - - Name - nsXULCommandDispatcher.cpp - MacOS - Text - Debug - - - Name - nsXULContentSink.cpp - MacOS - Text - Debug - - - Name - nsXULControllers.cpp - MacOS - Text - Debug - - - Name - nsXULDocument.cpp - MacOS - Text - Debug - - - Name - nsXULPrototypeCache.cpp - MacOS - Text - Debug - - - Name - nsXULPrototypeDocument.cpp - MacOS - Text - Debug - - - Name - nsRDFDOMNodeList.cpp - MacOS - Text - Debug - - - Name - nsXULAttributes.cpp - MacOS - Text - Debug - - - Name - nsXULAttributeValue.cpp - MacOS - Text - Debug - - - Name - nsXULPopupListener.cpp - MacOS - Text - Debug - - - Name - nsRuleNetwork.cpp - MacOS - Text - Debug - - - Name - nsXULContentUtils.cpp - MacOS - Text - Debug - - - Name - nsXULSortService.cpp - MacOS - Text - Debug - - - Name - nsXULTemplateBuilder.cpp - MacOS - Text - Debug - - - Name - nsXULElement.cpp - MacOS - Text - Debug - - - Name - nsParserUtils.cpp - MacOS - Text - Debug - - - Name - nsClusterKey.cpp - MacOS - Text - Debug - - - Name - nsClusterKeySet.cpp - MacOS - Text - Debug - - - Name - nsConflictSet.cpp - MacOS - Text - Debug - - - Name - nsContentSupportMap.cpp - MacOS - Text - Debug - - - Name - nsContentTagTestNode.cpp - MacOS - Text - Debug - - - Name - nsContentTestNode.cpp - MacOS - Text - Debug - - - Name - nsInstantiationNode.cpp - MacOS - Text - Debug - - - Name - nsTreeRows.cpp - MacOS - Text - Debug - - - Name - nsTreeRowTestNode.cpp - MacOS - Text - Debug - - - Name - nsRDFConInstanceTestNode.cpp - MacOS - Text - Debug - - - Name - nsRDFConMemberTestNode.cpp - MacOS - Text - Debug - - - Name - nsRDFPropertyTestNode.cpp - MacOS - Text - Debug - - - Name - nsResourceSet.cpp - MacOS - Text - Debug - - - Name - nsTemplateMatch.cpp - MacOS - Text - Debug - - - Name - nsTemplateMatchSet.cpp - MacOS - Text - Debug - - - Name - nsTemplateRule.cpp - MacOS - Text - Debug - - - Name - nsXULContentBuilder.cpp - MacOS - Text - Debug - - - Name - nsXULTreeBuilder.cpp - MacOS - Text - Debug - - - Name - nsXBLContextMenuHandler.cpp - MacOS - Text - Debug - - - Name - nsXBLCustomHandler.cpp - MacOS - Text - Debug - - - Name - nsScriptLoader.cpp - MacOS - Text - Debug - - - Name - nsScriptEventManager.cpp - MacOS - Text - Debug - - - Name - nsImageLoadingContent.cpp - MacOS - Text - Debug - - - Name - nsStyleLinkElement.cpp - MacOS - Text - Debug - - - Name - nsTreeWalker.cpp - MacOS - Text - Debug - - - Name - nsRuleNode.cpp - MacOS - Text - Debug - - - Name - nsContentAreaDragDrop.cpp - MacOS - Text - Debug - - - Name - nsFrameLoader.cpp - MacOS - Text - Debug - - - Name - nsHTMLSharedLeafElement.cpp - MacOS - Text - Debug - - - Name - nsXBLContentSink.cpp - MacOS - Text - Debug - - - Name - nsXBLDocumentInfo.cpp - MacOS - Text - Debug - - - Name - nsFormSubmission.cpp - MacOS - Text - Debug - - - Name - nsDOMCSSAttrDeclaration.cpp - MacOS - Text - Debug - - - Name - nsCSSOMFactory.cpp - MacOS - Text - Debug - - - Name - nsXBLPrototypeResources.cpp - MacOS - Text - Debug - - - Name - nsXBLResourceLoader.cpp - MacOS - Text - Debug - - - Name - nsXBLProtoImpl.cpp - MacOS - Text - Debug - - - Name - nsXBLProtoImplField.cpp - MacOS - Text - Debug - - - Name - nsXBLProtoImplMethod.cpp - MacOS - Text - Debug - - - Name - nsXBLProtoImplProperty.cpp - MacOS - Text - Debug - - - Name - contentSVGDebug.o - MacOS - Library - Debug - - - Name - nsFIXptr.cpp - MacOS - Text - Debug - - - Name - nsDOMCSSRect.cpp - MacOS - Text - Debug - - - Name - nsWyciwygChannel.cpp - MacOS - Text - Debug - - - Name - nsWyciwygProtocolHandler.cpp - MacOS - Text - Debug - - - Name - mozSanitizingSerializer.cpp - MacOS - Text - Debug - - - Name - nsDOMCSSRGBColor.cpp - MacOS - Text - Debug - - - Name - nsDOMCSSValueList.cpp - MacOS - Text - Debug - - - Name - nsXMLStylesheetPI.cpp - MacOS - Text - Debug - - - - - Name - NSComponentStartup.o - MacOS - - - Name - InterfacesStubs - MacOS - - - Name - NSRuntimeDebug.shlb - MacOS - - - Name - NSStdLibDebug.shlb - MacOS - - - Name - nsNameSpaceManager.cpp - MacOS - - - Name - nsContentIterator.cpp - MacOS - - - Name - nsDOMAttribute.cpp - MacOS - - - Name - nsDOMAttributeMap.cpp - MacOS - - - Name - nsCommentNode.cpp - MacOS - - - Name - nsGenericDOMDataNode.cpp - MacOS - - - Name - nsTextNode.cpp - MacOS - - - Name - nsDocument.cpp - MacOS - - - Name - nsStyleSet.cpp - MacOS - - - Name - nsHTMLContentSink.cpp - MacOS - - - Name - nsHTMLDocument.cpp - MacOS - - - Name - nsCSSDeclaration.cpp - MacOS - - - Name - nsCSSParser.cpp - MacOS - - - Name - nsCSSScanner.cpp - MacOS - - - Name - nsCSSStyleRule.cpp - MacOS - - - Name - nsCSSStyleSheet.cpp - MacOS - - - Name - nsHTMLAttributes.cpp - MacOS - - - Name - nsHTMLStyleSheet.cpp - MacOS - - - Name - nsHTMLCSSStyleSheet.cpp - MacOS - - - Name - nsDOMEvent.cpp - MacOS - - - Name - nsDOMEventGroup.cpp - MacOS - - - Name - nsEventListenerManager.cpp - MacOS - - - Name - nsEventStateManager.cpp - MacOS - - - Name - nsContentList.cpp - MacOS - - - Name - nsImageDocument.cpp - MacOS - - - Name - nsMarkupDocument.cpp - MacOS - - - Name - nsGenericHTMLElement.cpp - MacOS - - - Name - nsHTMLAnchorElement.cpp - MacOS - - - Name - nsHTMLAppletElement.cpp - MacOS - - - Name - nsHTMLAreaElement.cpp - MacOS - - - Name - nsHTMLBaseFontElement.cpp - MacOS - - - Name - nsHTMLBodyElement.cpp - MacOS - - - Name - nsHTMLBRElement.cpp - MacOS - - - Name - nsHTMLButtonElement.cpp - MacOS - - - Name - nsHTMLDelElement.cpp - MacOS - - - Name - nsHTMLDirectoryElement.cpp - MacOS - - - Name - nsHTMLDivElement.cpp - MacOS - - - Name - nsHTMLDListElement.cpp - MacOS - - - Name - nsHTMLFontElement.cpp - MacOS - - - Name - nsHTMLFormElement.cpp - MacOS - - - Name - nsHTMLFrameElement.cpp - MacOS - - - Name - nsHTMLFrameSetElement.cpp - MacOS - - - Name - nsHTMLHeadElement.cpp - MacOS - - - Name - nsHTMLHeadingElement.cpp - MacOS - - - Name - nsHTMLHRElement.cpp - MacOS - - - Name - nsHTMLHtmlElement.cpp - MacOS - - - Name - nsHTMLIFrameElement.cpp - MacOS - - - Name - nsHTMLImageElement.cpp - MacOS - - - Name - nsHTMLInputElement.cpp - MacOS - - - Name - nsHTMLInsElement.cpp - MacOS - - - Name - nsHTMLLabelElement.cpp - MacOS - - - Name - nsHTMLLegendElement.cpp - MacOS - - - Name - nsHTMLLIElement.cpp - MacOS - - - Name - nsHTMLLinkElement.cpp - MacOS - - - Name - nsHTMLMapElement.cpp - MacOS - - - Name - nsHTMLMenuElement.cpp - MacOS - - - Name - nsHTMLMetaElement.cpp - MacOS - - - Name - nsHTMLModElement.cpp - MacOS - - - Name - nsHTMLObjectElement.cpp - MacOS - - - Name - nsHTMLOListElement.cpp - MacOS - - - Name - nsHTMLOptGroupElement.cpp - MacOS - - - Name - nsHTMLOptionElement.cpp - MacOS - - - Name - nsHTMLParagraphElement.cpp - MacOS - - - Name - nsHTMLPreElement.cpp - MacOS - - - Name - nsHTMLQuoteElement.cpp - MacOS - - - Name - nsHTMLScriptElement.cpp - MacOS - - - Name - nsHTMLSelectElement.cpp - MacOS - - - Name - nsHTMLStyleElement.cpp - MacOS - - - Name - nsHTMLTableCaptionElement.cpp - MacOS - - - Name - nsHTMLTableCellElement.cpp - MacOS - - - Name - nsHTMLTableColElement.cpp - MacOS - - - Name - nsHTMLTableElement.cpp - MacOS - - - Name - nsHTMLTableRowElement.cpp - MacOS - - - Name - nsHTMLTableSectionElement.cpp - MacOS - - - Name - nsHTMLTextAreaElement.cpp - MacOS - - - Name - nsHTMLTitleElement.cpp - MacOS - - - Name - nsHTMLUListElement.cpp - MacOS - - - Name - nsHTMLSpanElement.cpp - MacOS - - - Name - nsDOMCSSDeclaration.cpp - MacOS - - - Name - nsCSSValue.cpp - MacOS - - - Name - nsHTMLFieldSetElement.cpp - MacOS - - - Name - nsGenericElement.cpp - MacOS - - - Name - nsXMLContentSink.cpp - MacOS - - - Name - nsXMLPrettyPrinter.cpp - MacOS - - - Name - nsXMLDocument.cpp - MacOS - - - Name - nsXMLElement.cpp - MacOS - - - Name - nsGenericDOMHTMLCollection.cpp - MacOS - - - Name - GenericElementCollection.cpp - MacOS - - - Name - nsDocumentFragment.cpp - MacOS - - - Name - nsRange.cpp - MacOS - - - Name - gfxDebug.shlb - MacOS - - - Name - JavaScriptDebug.shlb - MacOS - - - Name - NSPR20Debug.shlb - MacOS - - - Name - xpcomDebug.shlb - MacOS - - - Name - nsGenericDOMNodeList.cpp - MacOS - - - Name - nsXMLProcessingInstruction.cpp - MacOS - - - Name - nsXMLCDATASection.cpp - MacOS - - - Name - nsDocumentViewer.cpp - MacOS - - - Name - nsPagePrintTimer.cpp - MacOS - - - Name - nsPrintData.cpp - MacOS - - - Name - nsPrintEngine.cpp - MacOS - - - Name - nsPrintObject.cpp - MacOS - - - Name - nsPrintPreviewListener.cpp - MacOS - - - Name - nsCSSLoader.cpp - MacOS - - - Name - nsHTMLFragmentContentSink.cpp - MacOS - - - Name - nsDocumentEncoder.cpp - MacOS - - - Name - nsCSSRule.cpp - MacOS - - - Name - nsCSSRules.cpp - MacOS - - - Name - nsPrivateTextRange.cpp - MacOS - - - Name - nsAttributeContent.cpp - MacOS - - - Name - nsXMLEntity.cpp - MacOS - - - Name - nsXMLNotation.cpp - MacOS - - - Name - nsXMLNamedNodeMap.cpp - MacOS - - - Name - libutilDebug.shlb - MacOS - - - Name - nsTextContentChangeData.cpp - MacOS - - - Name - nsXBLService.cpp - MacOS - - - Name - nsXBLBinding.cpp - MacOS - - - Name - nsXBLEventHandler.cpp - MacOS - - - Name - nsSelection.cpp - MacOS - - - Name - nsDOMDocumentType.cpp - MacOS - - - Name - nsGeneratedIterator.cpp - MacOS - - - Name - nsHTMLUnknownElement.cpp - MacOS - - - Name - nsBindingManager.cpp - MacOS - - - Name - nsNodeInfo.cpp - MacOS - - - Name - nsNodeInfoManager.cpp - MacOS - - - Name - nsContentPolicy.cpp - MacOS - - - Name - nsComputedDOMStyle.cpp - MacOS - - - Name - nsInspectorCSSUtils.cpp - MacOS - - - Name - nsROCSSPrimitiveValue.cpp - MacOS - - - Name - nsStyleUtil.cpp - MacOS - - - Name - nsXBLPrototypeHandler.cpp - MacOS - - - Name - nsXBLDragHandler.cpp - MacOS - - - Name - nsXBLFocusHandler.cpp - MacOS - - - Name - nsXBLFormHandler.cpp - MacOS - - - Name - nsXBLKeyHandler.cpp - MacOS - - - Name - nsXBLLoadHandler.cpp - MacOS - - - Name - nsXBLMouseHandler.cpp - MacOS - - - Name - nsXBLMouseMotionHandler.cpp - MacOS - - - Name - nsXBLScrollHandler.cpp - MacOS - - - Name - nsXBLXULHandler.cpp - MacOS - - - Name - nsXBLWindowKeyHandler.cpp - MacOS - - - Name - nsXBLPrototypeBinding.cpp - MacOS - - - Name - nsHTMLContentSerializer.cpp - MacOS - - - Name - nsPlainTextSerializer.cpp - MacOS - - - Name - nsXMLContentSerializer.cpp - MacOS - - - Name - nsDOMMutationEvent.cpp - MacOS - - - Name - nsXBLMutationHandler.cpp - MacOS - - - Name - nsXBLWindowHandler.cpp - MacOS - - - Name - nsXBLWindowDragHandler.cpp - MacOS - - - Name - nsXBLInsertionPoint.cpp - MacOS - - - Name - nsContentUtils.cpp - MacOS - - - Name - nsSyncLoadService.cpp - MacOS - - - Name - nsStyleContext.cpp - MacOS - - - Name - nsElementMap.cpp - MacOS - - - Name - nsXULCommandDispatcher.cpp - MacOS - - - Name - nsXULContentSink.cpp - MacOS - - - Name - nsXULControllers.cpp - MacOS - - - Name - nsXULDocument.cpp - MacOS - - - Name - nsXULPrototypeCache.cpp - MacOS - - - Name - nsXULPrototypeDocument.cpp - MacOS - - - Name - nsRDFDOMNodeList.cpp - MacOS - - - Name - nsXULAttributes.cpp - MacOS - - - Name - nsXULAttributeValue.cpp - MacOS - - - Name - nsXULPopupListener.cpp - MacOS - - - Name - nsRuleNetwork.cpp - MacOS - - - Name - nsXULContentUtils.cpp - MacOS - - - Name - nsXULSortService.cpp - MacOS - - - Name - nsXULTemplateBuilder.cpp - MacOS - - - Name - nsXULElement.cpp - MacOS - - - Name - nsParserUtils.cpp - MacOS - - - Name - nsClusterKey.cpp - MacOS - - - Name - nsClusterKeySet.cpp - MacOS - - - Name - nsConflictSet.cpp - MacOS - - - Name - nsContentSupportMap.cpp - MacOS - - - Name - nsContentTagTestNode.cpp - MacOS - - - Name - nsContentTestNode.cpp - MacOS - - - Name - nsInstantiationNode.cpp - MacOS - - - Name - nsTreeRows.cpp - MacOS - - - Name - nsTreeRowTestNode.cpp - MacOS - - - Name - nsRDFConInstanceTestNode.cpp - MacOS - - - Name - nsRDFConMemberTestNode.cpp - MacOS - - - Name - nsRDFPropertyTestNode.cpp - MacOS - - - Name - nsResourceSet.cpp - MacOS - - - Name - nsTemplateMatch.cpp - MacOS - - - Name - nsTemplateMatchSet.cpp - MacOS - - - Name - nsTemplateRule.cpp - MacOS - - - Name - nsXULContentBuilder.cpp - MacOS - - - Name - nsXULTreeBuilder.cpp - MacOS - - - Name - nsXBLContextMenuHandler.cpp - MacOS - - - Name - nsXBLCustomHandler.cpp - MacOS - - - Name - nsScriptLoader.cpp - MacOS - - - Name - nsScriptEventManager.cpp - MacOS - - - Name - nsImageLoadingContent.cpp - MacOS - - - Name - nsStyleLinkElement.cpp - MacOS - - - Name - nsTreeWalker.cpp - MacOS - - - Name - nsRuleNode.cpp - MacOS - - - Name - nsContentAreaDragDrop.cpp - MacOS - - - Name - nsFrameLoader.cpp - MacOS - - - Name - nsHTMLSharedLeafElement.cpp - MacOS - - - Name - nsXBLContentSink.cpp - MacOS - - - Name - nsXBLDocumentInfo.cpp - MacOS - - - Name - nsFormSubmission.cpp - MacOS - - - Name - nsDOMCSSAttrDeclaration.cpp - MacOS - - - Name - nsCSSOMFactory.cpp - MacOS - - - Name - nsXBLPrototypeResources.cpp - MacOS - - - Name - nsXBLResourceLoader.cpp - MacOS - - - Name - nsXBLProtoImpl.cpp - MacOS - - - Name - nsXBLProtoImplField.cpp - MacOS - - - Name - nsXBLProtoImplMethod.cpp - MacOS - - - Name - nsXBLProtoImplProperty.cpp - MacOS - - - Name - contentSVGDebug.o - MacOS - - - Name - nsFIXptr.cpp - MacOS - - - Name - nsDOMCSSRect.cpp - MacOS - - - Name - nsWyciwygChannel.cpp - MacOS - - - Name - nsWyciwygProtocolHandler.cpp - MacOS - - - Name - mozSanitizingSerializer.cpp - MacOS - - - Name - nsDOMCSSRGBColor.cpp - MacOS - - - Name - nsDOMCSSValueList.cpp - MacOS - - - Name - nsXMLStylesheetPI.cpp - MacOS - - - - - - - content.o - contentDebug.o - - - - base - - content.o - Name - nsCommentNode.cpp - MacOS - - - content.o - Name - nsContentIterator.cpp - MacOS - - - content.o - Name - nsContentList.cpp - MacOS - - - content.o - Name - nsContentPolicy.cpp - MacOS - - - content.o - Name - nsContentUtils.cpp - MacOS - - - content.o - Name - nsSyncLoadService.cpp - MacOS - - - content.o - Name - nsDocument.cpp - MacOS - - - content.o - Name - nsDocumentEncoder.cpp - MacOS - - - content.o - Name - nsDocumentFragment.cpp - MacOS - - - content.o - Name - nsDocumentViewer.cpp - MacOS - - - content.o - Name - nsPagePrintTimer.cpp - MacOS - - - content.o - Name - nsPrintData.cpp - MacOS - - - content.o - Name - nsPrintEngine.cpp - MacOS - - - content.o - Name - nsPrintObject.cpp - MacOS - - - content.o - Name - nsPrintPreviewListener.cpp - MacOS - - - content.o - Name - nsDOMAttribute.cpp - MacOS - - - content.o - Name - nsDOMAttributeMap.cpp - MacOS - - - content.o - Name - nsDOMDocumentType.cpp - MacOS - - - content.o - Name - nsGeneratedIterator.cpp - MacOS - - - content.o - Name - nsGenericDOMDataNode.cpp - MacOS - - - content.o - Name - nsGenericDOMNodeList.cpp - MacOS - - - content.o - Name - nsGenericElement.cpp - MacOS - - - content.o - Name - nsHTMLContentSerializer.cpp - MacOS - - - content.o - Name - nsNameSpaceManager.cpp - MacOS - - - content.o - Name - nsNodeInfo.cpp - MacOS - - - content.o - Name - nsNodeInfoManager.cpp - MacOS - - - content.o - Name - nsPlainTextSerializer.cpp - MacOS - - - content.o - Name - nsRange.cpp - MacOS - - - content.o - Name - nsSelection.cpp - MacOS - - - content.o - Name - nsStyleContext.cpp - MacOS - - - content.o - Name - nsStyleLinkElement.cpp - MacOS - - - content.o - Name - nsStyleSet.cpp - MacOS - - - content.o - Name - nsTextContentChangeData.cpp - MacOS - - - content.o - Name - nsTextNode.cpp - MacOS - - - content.o - Name - nsTreeWalker.cpp - MacOS - - - content.o - Name - nsXMLContentSerializer.cpp - MacOS - - - content.o - Name - nsParserUtils.cpp - MacOS - - - content.o - Name - nsScriptLoader.cpp - MacOS - - - content.o - Name - nsScriptEventManager.cpp - MacOS - - - content.o - Name - nsImageLoadingContent.cpp - MacOS - - - content.o - Name - nsRuleNode.cpp - MacOS - - - content.o - Name - nsContentAreaDragDrop.cpp - MacOS - - - content.o - Name - nsFrameLoader.cpp - MacOS - - - content.o - Name - mozSanitizingSerializer.cpp - MacOS - - - events - - content.o - Name - nsDOMEvent.cpp - MacOS - - - content.o - Name - nsDOMEventGroup.cpp - MacOS - - - content.o - Name - nsDOMMutationEvent.cpp - MacOS - - - content.o - Name - nsEventListenerManager.cpp - MacOS - - - content.o - Name - nsEventStateManager.cpp - MacOS - - - content.o - Name - nsPrivateTextRange.cpp - MacOS - - - html/content - - content.o - Name - GenericElementCollection.cpp - MacOS - - - content.o - Name - nsAttributeContent.cpp - MacOS - - - content.o - Name - nsFormSubmission.cpp - MacOS - - - content.o - Name - nsGenericDOMHTMLCollection.cpp - MacOS - - - content.o - Name - nsGenericHTMLElement.cpp - MacOS - - - content.o - Name - nsHTMLAnchorElement.cpp - MacOS - - - content.o - Name - nsHTMLAppletElement.cpp - MacOS - - - content.o - Name - nsHTMLAreaElement.cpp - MacOS - - - content.o - Name - nsHTMLBaseFontElement.cpp - MacOS - - - content.o - Name - nsHTMLBodyElement.cpp - MacOS - - - content.o - Name - nsHTMLBRElement.cpp - MacOS - - - content.o - Name - nsHTMLButtonElement.cpp - MacOS - - - content.o - Name - nsHTMLDelElement.cpp - MacOS - - - content.o - Name - nsHTMLDirectoryElement.cpp - MacOS - - - content.o - Name - nsHTMLDivElement.cpp - MacOS - - - content.o - Name - nsHTMLDListElement.cpp - MacOS - - - content.o - Name - nsHTMLFieldSetElement.cpp - MacOS - - - content.o - Name - nsHTMLFontElement.cpp - MacOS - - - content.o - Name - nsHTMLFormElement.cpp - MacOS - - - content.o - Name - nsHTMLFrameElement.cpp - MacOS - - - content.o - Name - nsHTMLFrameSetElement.cpp - MacOS - - - content.o - Name - nsHTMLHeadElement.cpp - MacOS - - - content.o - Name - nsHTMLHeadingElement.cpp - MacOS - - - content.o - Name - nsHTMLHRElement.cpp - MacOS - - - content.o - Name - nsHTMLHtmlElement.cpp - MacOS - - - content.o - Name - nsHTMLIFrameElement.cpp - MacOS - - - content.o - Name - nsHTMLImageElement.cpp - MacOS - - - content.o - Name - nsHTMLInputElement.cpp - MacOS - - - content.o - Name - nsHTMLInsElement.cpp - MacOS - - - content.o - Name - nsHTMLLabelElement.cpp - MacOS - - - content.o - Name - nsHTMLLegendElement.cpp - MacOS - - - content.o - Name - nsHTMLLIElement.cpp - MacOS - - - content.o - Name - nsHTMLLinkElement.cpp - MacOS - - - content.o - Name - nsHTMLMapElement.cpp - MacOS - - - content.o - Name - nsHTMLMenuElement.cpp - MacOS - - - content.o - Name - nsHTMLMetaElement.cpp - MacOS - - - content.o - Name - nsHTMLModElement.cpp - MacOS - - - content.o - Name - nsHTMLObjectElement.cpp - MacOS - - - content.o - Name - nsHTMLOListElement.cpp - MacOS - - - content.o - Name - nsHTMLOptGroupElement.cpp - MacOS - - - content.o - Name - nsHTMLOptionElement.cpp - MacOS - - - content.o - Name - nsHTMLParagraphElement.cpp - MacOS - - - content.o - Name - nsHTMLPreElement.cpp - MacOS - - - content.o - Name - nsHTMLQuoteElement.cpp - MacOS - - - content.o - Name - nsHTMLScriptElement.cpp - MacOS - - - content.o - Name - nsHTMLSelectElement.cpp - MacOS - - - content.o - Name - nsHTMLSharedLeafElement.cpp - MacOS - - - content.o - Name - nsHTMLSpanElement.cpp - MacOS - - - content.o - Name - nsHTMLStyleElement.cpp - MacOS - - - content.o - Name - nsHTMLTableCaptionElement.cpp - MacOS - - - content.o - Name - nsHTMLTableCellElement.cpp - MacOS - - - content.o - Name - nsHTMLTableColElement.cpp - MacOS - - - content.o - Name - nsHTMLTableElement.cpp - MacOS - - - content.o - Name - nsHTMLTableRowElement.cpp - MacOS - - - content.o - Name - nsHTMLTableSectionElement.cpp - MacOS - - - content.o - Name - nsHTMLTextAreaElement.cpp - MacOS - - - content.o - Name - nsHTMLTitleElement.cpp - MacOS - - - content.o - Name - nsHTMLUListElement.cpp - MacOS - - - content.o - Name - nsHTMLUnknownElement.cpp - MacOS - - - html/document - - content.o - Name - nsHTMLContentSink.cpp - MacOS - - - content.o - Name - nsHTMLDocument.cpp - MacOS - - - content.o - Name - nsHTMLFragmentContentSink.cpp - MacOS - - - content.o - Name - nsImageDocument.cpp - MacOS - - - content.o - Name - nsMarkupDocument.cpp - MacOS - - - content.o - Name - nsWyciwygChannel.cpp - MacOS - - - content.o - Name - nsWyciwygProtocolHandler.cpp - MacOS - - - html/style - - content.o - Name - nsComputedDOMStyle.cpp - MacOS - - - content.o - Name - nsCSSDeclaration.cpp - MacOS - - - content.o - Name - nsCSSLoader.cpp - MacOS - - - content.o - Name - nsCSSOMFactory.cpp - MacOS - - - content.o - Name - nsCSSParser.cpp - MacOS - - - content.o - Name - nsDOMCSSRect.cpp - MacOS - - - content.o - Name - nsCSSRule.cpp - MacOS - - - content.o - Name - nsCSSRules.cpp - MacOS - - - content.o - Name - nsCSSScanner.cpp - MacOS - - - content.o - Name - nsCSSStyleRule.cpp - MacOS - - - content.o - Name - nsCSSStyleSheet.cpp - MacOS - - - content.o - Name - nsCSSValue.cpp - MacOS - - - content.o - Name - nsDOMCSSAttrDeclaration.cpp - MacOS - - - content.o - Name - nsDOMCSSDeclaration.cpp - MacOS - - - content.o - Name - nsHTMLAttributes.cpp - MacOS - - - content.o - Name - nsHTMLCSSStyleSheet.cpp - MacOS - - - content.o - Name - nsHTMLStyleSheet.cpp - MacOS - - - content.o - Name - nsInspectorCSSUtils.cpp - MacOS - - - content.o - Name - nsROCSSPrimitiveValue.cpp - MacOS - - - content.o - Name - nsStyleUtil.cpp - MacOS - - - content.o - Name - nsDOMCSSRGBColor.cpp - MacOS - - - content.o - Name - nsDOMCSSValueList.cpp - MacOS - - - xbl - - content.o - Name - nsBindingManager.cpp - MacOS - - - content.o - Name - nsXBLBinding.cpp - MacOS - - - content.o - Name - nsXBLContextMenuHandler.cpp - MacOS - - - content.o - Name - nsXBLCustomHandler.cpp - MacOS - - - content.o - Name - nsXBLContentSink.cpp - MacOS - - - content.o - Name - nsXBLDocumentInfo.cpp - MacOS - - - content.o - Name - nsXBLDragHandler.cpp - MacOS - - - content.o - Name - nsXBLEventHandler.cpp - MacOS - - - content.o - Name - nsXBLFocusHandler.cpp - MacOS - - - content.o - Name - nsXBLFormHandler.cpp - MacOS - - - content.o - Name - nsXBLInsertionPoint.cpp - MacOS - - - content.o - Name - nsXBLKeyHandler.cpp - MacOS - - - content.o - Name - nsXBLLoadHandler.cpp - MacOS - - - content.o - Name - nsXBLMouseHandler.cpp - MacOS - - - content.o - Name - nsXBLMouseMotionHandler.cpp - MacOS - - - content.o - Name - nsXBLMutationHandler.cpp - MacOS - - - content.o - Name - nsXBLProtoImpl.cpp - MacOS - - - content.o - Name - nsXBLProtoImplField.cpp - MacOS - - - content.o - Name - nsXBLProtoImplMethod.cpp - MacOS - - - content.o - Name - nsXBLProtoImplProperty.cpp - MacOS - - - content.o - Name - nsXBLPrototypeBinding.cpp - MacOS - - - content.o - Name - nsXBLPrototypeHandler.cpp - MacOS - - - content.o - Name - nsXBLPrototypeResources.cpp - MacOS - - - content.o - Name - nsXBLResourceLoader.cpp - MacOS - - - content.o - Name - nsXBLScrollHandler.cpp - MacOS - - - content.o - Name - nsXBLService.cpp - MacOS - - - content.o - Name - nsXBLWindowDragHandler.cpp - MacOS - - - content.o - Name - nsXBLWindowHandler.cpp - MacOS - - - content.o - Name - nsXBLWindowKeyHandler.cpp - MacOS - - - content.o - Name - nsXBLXULHandler.cpp - MacOS - - - xml/content - - content.o - Name - nsXMLCDATASection.cpp - MacOS - - - content.o - Name - nsXMLElement.cpp - MacOS - - - content.o - Name - nsXMLEntity.cpp - MacOS - - - content.o - Name - nsXMLNamedNodeMap.cpp - MacOS - - - content.o - Name - nsXMLNotation.cpp - MacOS - - - content.o - Name - nsXMLProcessingInstruction.cpp - MacOS - - - content.o - Name - nsXMLStylesheetPI.cpp - MacOS - - - xml/document - - content.o - Name - nsXMLContentSink.cpp - MacOS - - - content.o - Name - nsXMLPrettyPrinter.cpp - MacOS - - - content.o - Name - nsXMLDocument.cpp - MacOS - - - content.o - Name - nsFIXptr.cpp - MacOS - - - xul/content - - content.o - Name - nsRDFDOMNodeList.cpp - MacOS - - - content.o - Name - nsXULAttributes.cpp - MacOS - - - content.o - Name - nsXULAttributeValue.cpp - MacOS - - - content.o - Name - nsXULPopupListener.cpp - MacOS - - - content.o - Name - nsXULElement.cpp - MacOS - - - xul/document - - content.o - Name - nsElementMap.cpp - MacOS - - - content.o - Name - nsXULCommandDispatcher.cpp - MacOS - - - content.o - Name - nsXULContentSink.cpp - MacOS - - - content.o - Name - nsXULControllers.cpp - MacOS - - - content.o - Name - nsXULDocument.cpp - MacOS - - - content.o - Name - nsXULPrototypeCache.cpp - MacOS - - - content.o - Name - nsXULPrototypeDocument.cpp - MacOS - - - xul/templates - - content.o - Name - nsRuleNetwork.cpp - MacOS - - - content.o - Name - nsXULContentUtils.cpp - MacOS - - - content.o - Name - nsXULSortService.cpp - MacOS - - - content.o - Name - nsXULTemplateBuilder.cpp - MacOS - - - content.o - Name - nsClusterKey.cpp - MacOS - - - content.o - Name - nsClusterKeySet.cpp - MacOS - - - content.o - Name - nsConflictSet.cpp - MacOS - - - content.o - Name - nsContentSupportMap.cpp - MacOS - - - content.o - Name - nsContentTagTestNode.cpp - MacOS - - - content.o - Name - nsContentTestNode.cpp - MacOS - - - content.o - Name - nsInstantiationNode.cpp - MacOS - - - content.o - Name - nsTreeRows.cpp - MacOS - - - content.o - Name - nsTreeRowTestNode.cpp - MacOS - - - content.o - Name - nsRDFConInstanceTestNode.cpp - MacOS - - - content.o - Name - nsRDFConMemberTestNode.cpp - MacOS - - - content.o - Name - nsRDFPropertyTestNode.cpp - MacOS - - - content.o - Name - nsResourceSet.cpp - MacOS - - - content.o - Name - nsTemplateMatch.cpp - MacOS - - - content.o - Name - nsTemplateMatchSet.cpp - MacOS - - - content.o - Name - nsTemplateRule.cpp - MacOS - - - content.o - Name - nsXULContentBuilder.cpp - MacOS - - - content.o - Name - nsXULTreeBuilder.cpp - MacOS - - - Options - Debug - - contentDebug.o - Name - contentSVGDebug.o - MacOS - - - Optimized - - content.o - Name - contentSVG.o - MacOS - - - - NS Libraries - Optimized - - content.o - Name - gfx.shlb - MacOS - - - content.o - Name - JavaScript.shlb - MacOS - - - content.o - Name - libutil.shlb - MacOS - - - content.o - Name - NSPR20.shlb - MacOS - - - content.o - Name - NSRuntime.shlb - MacOS - - - content.o - Name - NSStdLib.shlb - MacOS - - - content.o - Name - xpcom.shlb - MacOS - - - Debug - - contentDebug.o - Name - gfxDebug.shlb - MacOS - - - contentDebug.o - Name - JavaScriptDebug.shlb - MacOS - - - contentDebug.o - Name - libutilDebug.shlb - MacOS - - - contentDebug.o - Name - NSPR20Debug.shlb - MacOS - - - contentDebug.o - Name - NSRuntimeDebug.shlb - MacOS - - - contentDebug.o - Name - NSStdLibDebug.shlb - MacOS - - - contentDebug.o - Name - xpcomDebug.shlb - MacOS - - - - System Libraries - - content.o - Name - InterfacesStubs - MacOS - - - content.o - Name - NSComponentStartup.o - MacOS - - - - - diff --git a/content/xbl/src/nsXBLPrototypeBinding.cpp b/content/xbl/src/nsXBLPrototypeBinding.cpp index 89d225e4dbd..ef9e4ad57fe 100644 --- a/content/xbl/src/nsXBLPrototypeBinding.cpp +++ b/content/xbl/src/nsXBLPrototypeBinding.cpp @@ -792,7 +792,7 @@ nsXBLPrototypeBinding::InitClass(const nsCString& aClassName, nsIScriptContext * aContext, void * aScriptObject, void ** aClassObject) { - NS_ENSURE_ARG_POINTER (aClassObject); + NS_ENSURE_ARG_POINTER(aClassObject); *aClassObject = nsnull; diff --git a/content/xml/document/src/nsXMLContentSink.cpp b/content/xml/document/src/nsXMLContentSink.cpp index e419c6a6c3f..0dfb157ddc3 100644 --- a/content/xml/document/src/nsXMLContentSink.cpp +++ b/content/xml/document/src/nsXMLContentSink.cpp @@ -1266,22 +1266,23 @@ nsXMLContentSink::FlushText(PRBool aCreateTextNode, PRBool* aDidFlush) PRBool didFlush = PR_FALSE; if (0 != mTextLength) { if (aCreateTextNode) { - nsCOMPtr content; - rv = NS_NewTextNode(getter_AddRefs(content)); - if (NS_OK == rv) { - // Set the content's document - content->SetDocument(mDocument, PR_FALSE, PR_TRUE); + nsCOMPtr textContent; + rv = NS_NewTextNode(getter_AddRefs(textContent)); + NS_ENSURE_SUCCESS(rv, rv); - // Set the text in the text node - content->SetText(mText, mTextLength, PR_FALSE); + // Set the content's document + textContent->SetDocument(mDocument, PR_FALSE, PR_TRUE); - // Add text to its parent - AddContentAsLeaf(content); - } + // Set the text in the text node + textContent->SetText(mText, mTextLength, PR_FALSE); + + // Add text to its parent + AddContentAsLeaf(textContent); } mTextLength = 0; didFlush = PR_TRUE; } + if (nsnull != aDidFlush) { *aDidFlush = didFlush; } diff --git a/content/xml/document/src/nsXMLDocument.cpp b/content/xml/document/src/nsXMLDocument.cpp index 1285022551e..01ff2564849 100644 --- a/content/xml/document/src/nsXMLDocument.cpp +++ b/content/xml/document/src/nsXMLDocument.cpp @@ -183,12 +183,15 @@ NS_NewXMLDocument(nsIDocument** aInstancePtrResult) return NS_OK; } + // NOTE! nsDocument::operator new() zeroes out all members, so don't + // bother initializing members to 0. + nsXMLDocument::nsXMLDocument() - : mCountCatalogSheets(0), mCrossSiteAccessEnabled(PR_FALSE), - mLoadedAsData(PR_FALSE), mAsync(PR_TRUE), - mLoopingForSyncLoad(PR_FALSE), mXMLDeclarationBits(0) + : mAsync(PR_TRUE) { - mEventQService = do_GetService(kEventQueueServiceCID); + + // NOTE! nsDocument::operator new() zeroes out all members, so don't + // bother initializing members to 0. } nsXMLDocument::~nsXMLDocument() @@ -223,6 +226,17 @@ NS_IMPL_ADDREF_INHERITED(nsXMLDocument, nsDocument) NS_IMPL_RELEASE_INHERITED(nsXMLDocument, nsDocument) +nsresult +nsXMLDocument::Init() +{ + nsresult rv = nsDocument::Init(); + NS_ENSURE_SUCCESS(rv, rv); + + mEventQService = do_GetService(kEventQueueServiceCID, &rv); + + return rv; +} + NS_IMETHODIMP nsXMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) { @@ -390,19 +404,20 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn) // Partial Reset, need to restore principal for security reasons and // event listener manager so that load listeners etc. will remain. - nsCOMPtr principal = mPrincipal; - nsCOMPtr elm = mListenerManager; + + nsCOMPtr principal(mPrincipal); + nsCOMPtr elm(mListenerManager); Reset(nsnull, nsnull); mPrincipal = principal; mListenerManager = elm; - NS_IF_ADDREF(mListenerManager); SetDocumentURL(uri); SetBaseURL(uri); - // Store script context, if any, in case we encounter redirect (because we need it there) + // Store script context, if any, in case we encounter redirect + // (because we need it there) nsCOMPtr stack = do_GetService("@mozilla.org/js/xpc/ContextStack;1"); if (stack) { @@ -415,10 +430,11 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn) } } - // Find out if UniversalBrowserRead privileges are enabled - we will need this - // in case of a redirect + // Find out if UniversalBrowserRead privileges are enabled - we will + // need this in case of a redirect PRBool crossSiteAccessEnabled; - rv = secMan->IsCapabilityEnabled("UniversalBrowserRead", &crossSiteAccessEnabled); + rv = secMan->IsCapabilityEnabled("UniversalBrowserRead", + &crossSiteAccessEnabled); if (NS_FAILED(rv)) return rv; mCrossSiteAccessEnabled = crossSiteAccessEnabled; @@ -428,15 +444,15 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn) if (NS_FAILED(rv)) return rv; // Set a principal for this document - mPrincipal = nsnull; nsCOMPtr channelOwner; rv = channel->GetOwner(getter_AddRefs(channelOwner)); - if (NS_SUCCEEDED(rv) && channelOwner) { - mPrincipal = do_QueryInterface(channelOwner, &rv); - } - if (NS_FAILED(rv) || !channelOwner) - { + // We don't care if GetOwner() succeeded here, if it failed, + // channelOwner will be null, which is what we want in that case. + + mPrincipal = do_QueryInterface(channelOwner); + + if (NS_FAILED(rv) || !mPrincipal) { rv = secMan->GetCodebasePrincipal(uri, getter_AddRefs(mPrincipal)); NS_ENSURE_TRUE(mPrincipal, rv); } @@ -661,19 +677,20 @@ nsXMLDocument::GetInlineStyleSheet(nsIHTMLCSSStyleSheet** aResult) } // subclass hook for sheet ordering -void nsXMLDocument::InternalAddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags) +void +nsXMLDocument::InternalAddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags) { // XXXbz this catalog stuff should be in the UA level in the cascade! if (aFlags & NS_STYLESHEET_FROM_CATALOG) { // always after other catalog sheets - mStyleSheets.InsertObjectAt(aSheet, mCountCatalogSheets); - ++mCountCatalogSheets; + mStyleSheets.InsertObjectAt(aSheet, mCatalogSheetCount); + ++mCatalogSheetCount; } else if (aSheet == mAttrStyleSheet) { // always after catalog sheets NS_ASSERTION(mStyleSheets.Count() == 0 || mAttrStyleSheet != mStyleSheets[0], "Adding attr sheet twice!"); - mStyleSheets.InsertObjectAt(aSheet, mCountCatalogSheets); + mStyleSheets.InsertObjectAt(aSheet, mCatalogSheetCount); } else if (aSheet == mInlineStyleSheet) { // always last NS_ASSERTION(mStyleSheets.Count() == 0 || @@ -702,13 +719,13 @@ nsXMLDocument::InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex) /* Don't count Attribute stylesheet */ - 1 /* Don't count catalog sheets */ - - mCountCatalogSheets + - mCatalogSheetCount /* No insertion allowed after StyleAttr stylesheet */ - (mInlineStyleSheet ? 1: 0) ), "index out of bounds"); // offset w.r.t. catalog style sheets and the attr style sheet - mStyleSheets.InsertObjectAt(aSheet, aIndex + mCountCatalogSheets + 1); + mStyleSheets.InsertObjectAt(aSheet, aIndex + mCatalogSheetCount + 1); } already_AddRefed @@ -717,7 +734,7 @@ nsXMLDocument::InternalGetStyleSheetAt(PRInt32 aIndex) PRInt32 count = InternalGetNumberOfStyleSheets(); if (aIndex >= 0 && aIndex < count) { - nsIStyleSheet* sheet = mStyleSheets[aIndex + mCountCatalogSheets + 1]; + nsIStyleSheet* sheet = mStyleSheets[aIndex + mCatalogSheetCount + 1]; NS_ADDREF(sheet); return sheet; } else { @@ -730,10 +747,21 @@ PRInt32 nsXMLDocument::InternalGetNumberOfStyleSheets() { PRInt32 count = mStyleSheets.Count(); - if (count != 0 && mInlineStyleSheet == mStyleSheets[count - 1]) + + if (count != 0 && mInlineStyleSheet == mStyleSheets[count - 1]) { + // subtract the inline style sheet --count; - count -= (mCountCatalogSheets + 1); // +1 for the attr sheet - NS_ASSERTION(count >= 0, "Why did we end up with a negative count?"); + } + + if (count != 0 && mAttrStyleSheet == mStyleSheets[mCatalogSheetCount]) { + // subtract the attr sheet + --count; + } + + count -= mCatalogSheetCount; + + NS_ASSERTION(count >= 0, "How did we get a negative count?"); + return count; } @@ -745,7 +773,8 @@ nsXMLDocument::GetDoctype(nsIDOMDocumentType** aDocumentType) } NS_IMETHODIMP -nsXMLDocument::CreateCDATASection(const nsAString& aData, nsIDOMCDATASection** aReturn) +nsXMLDocument::CreateCDATASection(const nsAString& aData, + nsIDOMCDATASection** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = nsnull; @@ -769,7 +798,8 @@ nsXMLDocument::CreateCDATASection(const nsAString& aData, nsIDOMCDATASection** a } NS_IMETHODIMP -nsXMLDocument::CreateEntityReference(const nsAString& aName, nsIDOMEntityReference** aReturn) +nsXMLDocument::CreateEntityReference(const nsAString& aName, + nsIDOMEntityReference** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1085,18 +1115,19 @@ nsXMLDocument::GetBaseTarget(nsAString &aBaseTarget) NS_IMETHODIMP nsXMLDocument::GetCSSLoader(nsICSSLoader*& aLoader) { - nsresult result = NS_OK; - if (! mCSSLoader) { - result = NS_NewCSSLoader(this, getter_AddRefs(mCSSLoader)); - if (mCSSLoader) { - mCSSLoader->SetCaseSensitive(PR_TRUE); - // No quirks in XML - mCSSLoader->SetCompatibilityMode(eCompatibility_FullStandards); - } + if (!mCSSLoader) { + nsresult rv = NS_NewCSSLoader(this, getter_AddRefs(mCSSLoader)); + NS_ENSURE_SUCCESS(rv, rv); + + mCSSLoader->SetCaseSensitive(PR_TRUE); + // no quirks in XML + mCSSLoader->SetCompatibilityMode(eCompatibility_FullStandards); } + aLoader = mCSSLoader; NS_IF_ADDREF(aLoader); - return result; + + return NS_OK; } nsresult diff --git a/content/xml/document/src/nsXMLDocument.h b/content/xml/document/src/nsXMLDocument.h index 8c927723633..b159014fe1d 100644 --- a/content/xml/document/src/nsXMLDocument.h +++ b/content/xml/document/src/nsXMLDocument.h @@ -39,7 +39,7 @@ #ifndef nsXMLDocument_h___ #define nsXMLDocument_h___ -#include "nsMarkupDocument.h" +#include "nsDocument.h" #include "nsIXMLDocument.h" #include "nsIHTMLContentContainer.h" #include "nsIInterfaceRequestor.h" @@ -61,7 +61,7 @@ class nsIURI; #define XML_DECLARATION_BITS_STANDALONE_EXISTS 4 #define XML_DECLARATION_BITS_STANDALONE_YES 8 -class nsXMLDocument : public nsMarkupDocument, +class nsXMLDocument : public nsDocument, public nsIXMLDocument, public nsIHTMLContentContainer, public nsIInterfaceRequestor, @@ -78,8 +78,7 @@ public: NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup); - NS_IMETHOD StartDocumentLoad(const char* aCommand, - nsIChannel* channel, + NS_IMETHOD StartDocumentLoad(const char* aCommand, nsIChannel* channel, nsILoadGroup* aLoadGroup, nsISupports* aContainer, nsIStreamListener **aDocListener, @@ -95,23 +94,25 @@ public: NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); // nsIDOMDocument interface - NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDocumentType); - NS_IMETHOD CreateCDATASection(const nsAString& aData, nsIDOMCDATASection** aReturn); - NS_IMETHOD CreateEntityReference(const nsAString& aName, nsIDOMEntityReference** aReturn); - NS_IMETHOD CreateProcessingInstruction(const nsAString& aTarget, const nsAString& aData, nsIDOMProcessingInstruction** aReturn); - NS_IMETHOD CreateElement(const nsAString& aTagName, - nsIDOMElement** aReturn); - NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode, - PRBool aDeep, - nsIDOMNode** aReturn); - NS_IMETHOD CreateElementNS(const nsAString& aNamespaceURI, + NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDocumentType); + NS_IMETHOD CreateCDATASection(const nsAString& aData, + nsIDOMCDATASection** aReturn); + NS_IMETHOD CreateEntityReference(const nsAString& aName, + nsIDOMEntityReference** aReturn); + NS_IMETHOD CreateProcessingInstruction(const nsAString& aTarget, + const nsAString& aData, + nsIDOMProcessingInstruction** aReturn); + NS_IMETHOD CreateElement(const nsAString& aTagName, nsIDOMElement** aReturn); + NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode, PRBool aDeep, + nsIDOMNode** aReturn); + NS_IMETHOD CreateElementNS(const nsAString& aNamespaceURI, + const nsAString& aQualifiedName, + nsIDOMElement** aReturn); + NS_IMETHOD CreateAttributeNS(const nsAString& aNamespaceURI, const nsAString& aQualifiedName, - nsIDOMElement** aReturn); - NS_IMETHOD CreateAttributeNS(const nsAString& aNamespaceURI, - const nsAString& aQualifiedName, - nsIDOMAttr** aReturn); - NS_IMETHOD GetElementById(const nsAString& aElementId, - nsIDOMElement** aReturn); + nsIDOMAttr** aReturn); + NS_IMETHOD GetElementById(const nsAString& aElementId, + nsIDOMElement** aReturn); // nsIXMLDocument interface NS_IMETHOD SetDefaultStylesheets(nsIURI* aUrl); @@ -128,7 +129,7 @@ public: NS_IMETHOD GetCSSLoader(nsICSSLoader*& aLoader); // nsIInterfaceRequestor - NS_IMETHOD GetInterface(const nsIID& aIID, void** aSink); + NS_DECL_NSIINTERFACEREQUESTOR // nsIHTTPEventSink NS_DECL_NSIHTTPEVENTSINK @@ -136,6 +137,8 @@ public: // nsIDOMXMLDocument NS_DECL_NSIDOMXMLDOCUMENT + virtual nsresult Init(); + protected: // subclass hooks for sheet ordering virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags); @@ -144,7 +147,7 @@ protected: virtual PRInt32 InternalGetNumberOfStyleSheets(); nsresult CreateElement(nsINodeInfo *aNodeInfo, nsIDOMElement** aResult); - + // For HTML elements in our content model // XXX This is not clean, but is there a better way? nsCOMPtr mAttrStyleSheet; @@ -152,7 +155,7 @@ protected: // For additional catalog sheets (if any) needed to layout the XML vocabulary // of the document. Catalog sheets are kept at the beginning of our array of // style sheets and this counter is used as an offset to distinguish them - PRInt32 mCountCatalogSheets; + PRInt32 mCatalogSheetCount; nsString mBaseTarget; nsCOMPtr mEventQService; diff --git a/content/xml/document/src/nsXPointer.cpp b/content/xml/document/src/nsXPointer.cpp index 646efc14210..e69de29bb2d 100755 --- a/content/xml/document/src/nsXPointer.cpp +++ b/content/xml/document/src/nsXPointer.cpp @@ -1,418 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- -*/ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla 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/MPL/ - * - * 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) 2003 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Heikki Toivonen (original author) - * - * 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 MPL, 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 MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/** - * Implementation for the XPointer family of specifications, practically the - * XPointer Processor. The processor can call optional modules that implement - * some XPointer schemes that were not implemented in this file. Please note - * that implementation of the xmlns scheme is left to the optional scheme - * implementations - all the information they need will be passed in. - * - * The framework: - * http://www.w3.org/TR/xptr-framework/ - * The element scheme: - * http://www.w3.org/TR/xptr-element/ - * - * Additionally this module implements 'fixptr' scheme for the FIXptr - * W3C proposal: - * http://lists.w3.org/Archives/Public/www-xml-linking-comments/2001AprJun/att-0074/01-NOTE-FIXptr-20010425.htm - */ - -// TODO: -// - xpointer scheme - - -#include "nsIDOMNode.h" -#include "nsIDOMNodeList.h" -#include "nsIDOMRange.h" -#include "nsIDOMElement.h" -#include "nsIDOMDocument.h" -#include "nsCOMPtr.h" -#include "nsXPointer.h" -#include "nsIModifyableXPointer.h" -#include "nsISupports.h" -#include "nsISupportsUtils.h" -#include "nsIXPointer.h" -#include "nsFIXptr.h" -#include "nsCOMArray.h" -#include "nsIServiceManager.h" -#include "nsContentUtils.h" - -#include "nsContentCID.h" -static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID); - -class nsXPointerResult : public nsIModifyableXPointerResult { -public: - nsXPointerResult(); - virtual ~nsXPointerResult(); - - NS_DECL_ISUPPORTS - - NS_DECL_NSIXPOINTERRESULT - NS_DECL_NSIMODIFYABLEXPOINTERRESULT - -private: - nsCOMArray mArray; -}; - -nsXPointerResult::nsXPointerResult() -{ -} - -nsXPointerResult::~nsXPointerResult() -{ -} - -NS_INTERFACE_MAP_BEGIN(nsXPointerResult) - NS_INTERFACE_MAP_ENTRY(nsIXPointerResult) - NS_INTERFACE_MAP_ENTRY(nsIModifyableXPointerResult) - NS_INTERFACE_MAP_ENTRY(nsISupports) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XPointerResult) -NS_INTERFACE_MAP_END - -NS_IMPL_ADDREF(nsXPointerResult) -NS_IMPL_RELEASE(nsXPointerResult) - -NS_IMETHODIMP -nsXPointerResult::AppendRange(nsIDOMRange* aRange) -{ - NS_ENSURE_ARG(aRange); - - if (!mArray.AppendObject(aRange)) { - return NS_ERROR_OUT_OF_MEMORY; - } - - return NS_OK; -} - -NS_IMETHODIMP -nsXPointerResult::Item(PRUint32 aIndex, nsIDOMRange** aReturn) -{ - NS_ENSURE_ARG_POINTER(aReturn); - - if (aIndex >= mArray.Count()) { - return NS_ERROR_FAILURE; - } - - *aReturn = mArray.ObjectAt(aIndex); - NS_IF_ADDREF(*aReturn); - - return NS_OK; -} - -NS_IMETHODIMP -nsXPointerResult::GetLength(PRUint32* aLength) -{ - NS_ENSURE_ARG_POINTER(aLength); - - *aLength = mArray.Count(); - - return NS_OK; -} - -nsresult NS_NewXPointerResult(nsIXPointerResult **aResult) -{ - NS_ENSURE_ARG_POINTER(aResult); - - *aResult = new nsXPointerResult(); - if (!*aResult) { - return NS_ERROR_OUT_OF_MEMORY; - } - - NS_ADDREF(*aResult); - - return NS_OK; -} - -static nsresult NS_NewXPointerResult(nsIDOMRange *aRange, - nsIXPointerResult **aResult) -{ - NS_ENSURE_ARG(aRange); - NS_ENSURE_ARG_POINTER(aResult); - - nsCOMPtr result(new nsXPointerResult()); - if (!result) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult rv = result->AppendRange(aRange); - if (NS_FAILED(rv)) { - return rv; - } - - *aResult = result.get(); - NS_ADDREF(*aResult); - - return NS_OK; -} - -static nsresult NS_NewXPointerResult(nsIDOMNode *aNode, - nsIXPointerResult **aResult) -{ - NS_ENSURE_ARG(aNode); - NS_ENSURE_ARG_POINTER(aResult); - - nsCOMPtr range(do_CreateInstance(kRangeCID)); - if (!range) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult rv = range->SelectNode(aNode); - if (NS_FAILED(rv)) { - return rv; - } - - return NS_NewXPointerResult(range, aResult); -} - - -// nsXPointerSchemeContext - -class nsXPointerSchemeContext : public nsIXPointerSchemeContext -{ -public: - nsXPointerSchemeContext() {}; - virtual ~nsXPointerSchemeContext() {}; - - NS_DECL_ISUPPORTS - NS_DECL_NSIXPOINTERSCHEMECONTEXT - - nsresult Append(const nsAString &aScheme, const nsAString &aData); - -private: - nsStringArray mSchemes; - nsStringArray mDatas; -}; - -NS_IMPL_ISUPPORTS1(nsXPointerSchemeContext, nsIXPointerSchemeContext) - -NS_IMETHODIMP -nsXPointerSchemeContext::GetCount(PRUint32 *aCount) -{ - NS_ENSURE_ARG_POINTER(aCount); - - *aCount = mSchemes.Count(); - - return NS_OK; -} - - -nsresult -nsXPointerSchemeContext::Append(const nsAString &aScheme, - const nsAString &aData) -{ - if (!mSchemes.AppendString(aScheme)) { - return NS_ERROR_OUT_OF_MEMORY; - } - - if (!mDatas.AppendString(aData)) { - // Keep mDatas and mSchemes in sync - mSchemes.RemoveStringAt(mSchemes.Count() - 1); - return NS_ERROR_OUT_OF_MEMORY; - } - - return NS_OK; -} - -NS_IMETHODIMP -nsXPointerSchemeContext::GetSchemeData(PRUint32 aIndex, - nsAString &aScheme, - nsAString &aData) -{ - if (aIndex >= mSchemes.Count()) { - aScheme.Truncate(); - aData.Truncate(); - - return NS_ERROR_FAILURE; - } - - mSchemes.StringAt(aIndex, aScheme); - mDatas.StringAt(aIndex, aData); - - return NS_OK; -} - -// XPointer - -nsXPointer::nsXPointer() -{ -} - -nsXPointer::~nsXPointer() -{ -} - -static nsresult GetNextSchemeNameAndData(nsString& aExpression, - nsString &aScheme, - nsString& aData) -{ - aScheme.Truncate(); - aData.Truncate(); - - PRInt32 lp = aExpression.FindChar('('); - if (lp < 1) { - return NS_ERROR_FAILURE; // format |scheme + '(' [ + data + ] + ')'| required - } - - PRInt32 i = lp + 1, len = aExpression.Length(); - if (i >= len) { - return NS_ERROR_FAILURE; // format |scheme + '(' [ + data + ] + ')'| required - } - - aScheme = Substring(aExpression, 0, lp); - aScheme.CompressWhitespace(PR_TRUE, PR_FALSE); - if (aScheme.FindCharInSet(" \t\r\n") > 0) { - return NS_ERROR_FAILURE; // scheme name can't contain ws (we'd really need to check a lot more...) - } - - // XXX perf: Switch to string iterators - PRBool escapeOn = PR_FALSE; - PRInt32 balance = 1; - for (; i < len; ++i) { - // Circumflex is the escape character that can precede ^, ( and ) only - if (aExpression[i] == '^') { - if (!escapeOn) { - escapeOn = PR_TRUE; - continue; - } - } else if (escapeOn) { - if ((aExpression[i] != '(') && (aExpression[i] != ')')) { - return NS_ERROR_FAILURE; // illegal use of ^ - } - } else if (aExpression[i] == '(') { - ++balance; - } else if (aExpression[i] == ')') { - if (--balance == 0) { - aExpression.Cut(0, i + 1); - break; - } - } - - aData.Append(aExpression[i]); - escapeOn = PR_FALSE; - } - - if (balance != 0) { - return NS_ERROR_FAILURE; // format |scheme + '(' [ + data + ] + ')'| required - } - - return NS_OK; -} - - -nsresult -nsXPointer::Evaluate(nsIDOMDocument *aDocument, - const nsAString& aExpression, - nsIXPointerResult **aResult) -{ - NS_ENSURE_ARG_POINTER(aDocument); - NS_ENSURE_ARG_POINTER(aResult); - *aResult = nsnull; - - nsresult rv = NS_OK; - - if (aExpression.FindChar('(') < 0) { - // Must be shorthand, i.e. plain id - nsCOMPtr element; - aDocument->GetElementById(aExpression, getter_AddRefs(element)); - if (element) { - rv = NS_NewXPointerResult(element, aResult); - } - return rv; - } - - nsAutoString expression(aExpression), scheme, data; - - NS_NAMED_LITERAL_STRING(element, "element"); - NS_NAMED_LITERAL_STRING(fixptr, "fixptr"); - NS_NAMED_LITERAL_CSTRING(baseSchemeProgID, NS_XPOINTER_SCHEME_PROCESSOR_BASE); - nsCOMPtr contextSchemeDataArray(new nsXPointerSchemeContext()); - if (!contextSchemeDataArray) { - return NS_ERROR_OUT_OF_MEMORY; - } - - // Keep trying the schemes from left to right until one finds a subresource - while (!expression.IsEmpty()) { - rv = GetNextSchemeNameAndData(expression, scheme, data); - if (NS_FAILED(rv)) - break; - - // Built in schemes - if (scheme.Equals(element)) { - // We implement element scheme by using the FIXptr processor. - // Check there are no parenthesis (legal in FIXptr data). - if (data.FindChar('(') < 0) { - nsCOMPtr range; - rv = nsFIXptr::Evaluate(aDocument, data, getter_AddRefs(range)); - if (NS_FAILED(rv)) - break; - if (range) { - return NS_NewXPointerResult(range, aResult); - } - } - } else if (scheme.Equals(fixptr)) { - nsCOMPtr range; - rv = nsFIXptr::Evaluate(aDocument, data, getter_AddRefs(range)); - if (NS_FAILED(rv)) - break; - if (range) { - return NS_NewXPointerResult(range, aResult); - } - } else { - // Add-on schemes - nsCAutoString progid(baseSchemeProgID + NS_ConvertUCS2toUTF8(scheme)); - nsCOMPtr p(do_CreateInstance(progid.get())); - if (p) { - rv = p->Evaluate(aDocument, contextSchemeDataArray, data, aResult); - if (NS_FAILED(rv)) - break; - if (*aResult) - return NS_OK; - } - } - - rv = contextSchemeDataArray->Append(scheme, data); - if (NS_FAILED(rv)) - break; - - } - - return rv; -} - diff --git a/content/xul/content/src/Makefile.in b/content/xul/content/src/Makefile.in index 876005cbb20..21f47092e1b 100644 --- a/content/xul/content/src/Makefile.in +++ b/content/xul/content/src/Makefile.in @@ -57,7 +57,8 @@ CPPSRCS = \ nsXULPopupListener.cpp \ $(NULL) -# we don't want the shared lib, but we want to force the creation of a static lib. +# we don't want the shared lib, but we want to force the creation of a +# static lib. FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/rules.mk @@ -67,5 +68,6 @@ LOCAL_INCLUDES = \ -I$(srcdir)/../../document/src \ -I$(srcdir)/../../../xml/content/src \ -I$(srcdir)/../../../base/src \ + -I$(srcdir)/../../../xml/document/src \ $(NULL) diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 09508ebc1f1..12aa51b8bde 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -2850,7 +2850,7 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, if (xuldoc) { // Do a getElementById to retrieve the broadcaster nsCOMPtr broadcaster; - nsCOMPtr domDoc = do_QueryInterface(mDocument); + nsCOMPtr domDoc = do_QueryInterface(mDocument); domDoc->GetElementById(oldValue, getter_AddRefs(broadcaster)); if (broadcaster) { xuldoc->RemoveBroadcastListenerFor(broadcaster, @@ -4498,6 +4498,8 @@ nsXULElement::EnsureSlots() return NS_OK; NS_ASSERTION(mPrototype->mNodeInfo, "prototype has null nodeinfo!"); + // XXX this is broken, we need to get a new nodeinfo from the + // document's nodeinfo manager!!! mSlots->mNodeInfo = mPrototype->mNodeInfo; return NS_OK; diff --git a/content/xul/content/src/nsXULPopupListener.cpp b/content/xul/content/src/nsXULPopupListener.cpp index dceb1920779..9d01ab46391 100644 --- a/content/xul/content/src/nsXULPopupListener.cpp +++ b/content/xul/content/src/nsXULPopupListener.cpp @@ -50,6 +50,7 @@ #include "nsIDOMElement.h" #include "nsIDOMXULElement.h" #include "nsIDOMNodeList.h" +#include "nsIDOMDocument.h" #include "nsIDOMDocumentXBL.h" #include "nsIXULPopupListener.h" #include "nsIDOMMouseListener.h" @@ -520,9 +521,9 @@ XULPopupListenerImpl::LaunchPopup(PRInt32 aClientX, PRInt32 aClientY) return rv; } - // Turn the document into a XUL document so we can use getElementById - nsCOMPtr xulDocument = do_QueryInterface(document); - if (xulDocument == nsnull) { + // Turn the document into a DOM document so we can use getElementById + nsCOMPtr domDocument = do_QueryInterface(document); + if (!domDocument) { NS_ERROR("Popup attached to an element that isn't in XUL!"); return NS_ERROR_FAILURE; } @@ -539,7 +540,7 @@ XULPopupListenerImpl::LaunchPopup(PRInt32 aClientX, PRInt32 aClientY) if (popup) popupContent = do_QueryInterface(popup); else { - nsCOMPtr nsDoc(do_QueryInterface(xulDocument)); + nsCOMPtr nsDoc(do_QueryInterface(domDocument)); nsCOMPtr list; nsDoc->GetAnonymousNodes(mElement, getter_AddRefs(list)); if (list) { @@ -559,7 +560,8 @@ XULPopupListenerImpl::LaunchPopup(PRInt32 aClientX, PRInt32 aClientY) } } } - else if (NS_FAILED(rv = xulDocument->GetElementById(identifier, getter_AddRefs(popupContent)))) { + else if (NS_FAILED(rv = domDocument->GetElementById(identifier, + getter_AddRefs(popupContent)))) { // Use getElementById to obtain the popup content and gracefully fail if // we didn't find any popup content in the document. NS_ERROR("GetElementById had some kind of spasm."); diff --git a/content/xul/document/public/nsIXULDocument.h b/content/xul/document/public/nsIXULDocument.h index ed90240928b..210da0be6f9 100644 --- a/content/xul/document/public/nsIXULDocument.h +++ b/content/xul/document/public/nsIXULDocument.h @@ -51,7 +51,7 @@ class nsIContent; // XXX nsIXMLDocument.h is bad and doesn't declare this class... -#include "nsIXMLDocument.h" +#include "nsISupports.h" #include "nsString.h" class nsForwardReference; @@ -65,7 +65,7 @@ class nsIXULTemplateBuilder; class nsIURI; // {954F0811-81DC-11d2-B52A-000000000000} -#define NS_IRDFDOCUMENT_IID \ +#define NS_IXULDOCUMENT_IID \ { 0x954f0811, 0x81dc, 0x11d2, { 0xb5, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } } /** @@ -75,10 +75,10 @@ class nsIURI; class nsIRDFDataSource; class nsIXULPrototypeDocument; -class nsIXULDocument : public nsIXMLDocument +class nsIXULDocument : public nsISupports { public: - NS_DEFINE_STATIC_IID_ACCESSOR(NS_IRDFDOCUMENT_IID) + NS_DEFINE_STATIC_IID_ACCESSOR(NS_IXULDOCUMENT_IID) // The resource-to-element map is a one-to-many mapping of RDF // resources to content elements. diff --git a/content/xul/document/src/Makefile.in b/content/xul/document/src/Makefile.in index e788dab5c94..ffd130f1abb 100644 --- a/content/xul/document/src/Makefile.in +++ b/content/xul/document/src/Makefile.in @@ -66,7 +66,8 @@ CPPSRCS = \ nsXULPrototypeDocument.cpp \ $(NULL) -# we don't want the shared lib, but we want to force the creation of a static lib. +# we don't want the shared lib, but we want to force the creation of a +# static lib. FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/rules.mk @@ -74,5 +75,6 @@ include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES = -I$(srcdir)/../../../base/src \ -I$(srcdir)/../../content/src \ -I$(srcdir)/../../templates/src \ + -I$(srcdir)/../../../xml/document/src \ $(NULL) diff --git a/content/xul/document/src/nsXULContentSink.cpp b/content/xul/document/src/nsXULContentSink.cpp index f8b96dd603c..52430e35b68 100644 --- a/content/xul/document/src/nsXULContentSink.cpp +++ b/content/xul/document/src/nsXULContentSink.cpp @@ -66,6 +66,7 @@ #include "nsIFormControl.h" #include "nsIHTMLContent.h" #include "nsIHTMLContentContainer.h" +#include "nsIHTMLStyleSheet.h" #include "nsINameSpace.h" #include "nsINameSpaceManager.h" #include "nsINodeInfo.h" diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index d807ef9a394..342c84dae51 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: NPL 1.1/GPL 2.0/LGPL 2.1 * @@ -24,6 +24,7 @@ * Ben Goodger * Pete Collins * Dan Rosen + * Johnny Stenback * * * Alternatively, the contents of this file may be used under the terms of @@ -63,68 +64,30 @@ // Note the ALPHABETICAL ORDERING #include "nsXULDocument.h" -#include "nsDocument.h" -#include "nsDOMCID.h" #include "nsDOMError.h" #include "nsIBoxObject.h" -#include "nsIChannel.h" #include "nsIChromeRegistry.h" -#include "nsIComponentManager.h" #include "nsICodebasePrincipal.h" #include "nsIContentSink.h" // for NS_CONTENT_ID_COUNTER_BASE #include "nsIScrollableView.h" #include "nsIContentViewer.h" -#include "nsICSSStyleSheet.h" -#include "nsIDOMComment.h" -#include "nsIDOMEvent.h" -#include "nsIDOMEventListener.h" -#include "nsIDOMEventReceiver.h" #include "nsGUIEvent.h" -#include "nsIDOMRange.h" -#include "nsIDOMScriptObjectFactory.h" -#include "nsIDOMText.h" #include "nsIDOMXULElement.h" -#include "nsIDOMAbstractView.h" -#include "nsIDTD.h" -#include "nsIDocumentObserver.h" -#include "nsIFormControl.h" -#include "nsIHTMLContent.h" -#include "nsHTMLAtoms.h" #include "nsIElementFactory.h" -#include "nsIEventStateManager.h" -#include "nsIInputStream.h" -#include "nsILoadGroup.h" -#include "nsINameSpace.h" -#include "nsIObserver.h" -#include "nsIParser.h" -#include "nsIPresContext.h" -#include "nsIPresShell.h" -#include "nsIPrincipal.h" #include "nsIPrivateDOMEvent.h" -#include "nsIRDFCompositeDataSource.h" -#include "nsIRDFContainerUtils.h" #include "nsIRDFNode.h" #include "nsIRDFRemoteDataSource.h" #include "nsIRDFService.h" -#include "nsIServiceManager.h" #include "nsIStreamListener.h" -#include "nsIStyleSet.h" -#include "nsIStyleSheet.h" #include "nsITextContent.h" #include "nsITimer.h" -#include "nsIURL.h" #include "nsIDocShell.h" -#include "nsIBaseWindow.h" #include "nsXULAtoms.h" -#include "nsIXMLContent.h" #include "nsIXULContent.h" #include "nsIXULContentSink.h" #include "nsXULContentUtils.h" #include "nsIXULPrototypeCache.h" -#include "nsLWBrkCIID.h" -#include "nsLayoutCID.h" -#include "nsContentCID.h" #include "nsNetUtil.h" #include "nsParserCIID.h" #include "nsPIBoxObject.h" @@ -132,29 +95,17 @@ #include "nsILocalStore.h" #include "nsRDFDOMNodeList.h" #include "nsXPIDLString.h" -#include "nsIDOMWindowInternal.h" #include "nsPIDOMWindow.h" #include "nsXULCommandDispatcher.h" -#include "nsTreeWalker.h" #include "nsXULDocument.h" #include "nsXULElement.h" -#include "plstr.h" #include "prlog.h" #include "rdf.h" #include "nsIFrame.h" -#include "nsIPrivateDOMImplementation.h" -#include "nsIDOMDOMImplementation.h" -#include "nsINodeInfo.h" -#include "nsIDOMDocumentType.h" -#include "nsIDOMProcessingInstruction.h" #include "nsIXBLService.h" -#include "nsReadableUtils.h" #include "nsCExternalHandlerService.h" #include "nsIMIMEService.h" -#include "nsNetUtil.h" #include "nsMimeTypes.h" -#include "nsISelectionController.h" -#include "nsContentUtils.h" #include "nsIFastLoadService.h" #include "nsIObjectInputStream.h" #include "nsIObjectOutputStream.h" @@ -167,24 +118,12 @@ // CIDs // -static NS_DEFINE_CID(kCSSLoaderCID, NS_CSS_LOADER_CID); -static NS_DEFINE_CID(kEventListenerManagerCID, NS_EVENTLISTENERMANAGER_CID); -static NS_DEFINE_CID(kHTMLCSSStyleSheetCID, NS_HTML_CSS_STYLESHEET_CID); static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID); -static NS_DEFINE_CID(kHTMLStyleSheetCID, NS_HTMLSTYLESHEET_CID); -static NS_DEFINE_CID(kLWBrkCID, NS_LWBRK_CID); static NS_DEFINE_CID(kLocalStoreCID, NS_LOCALSTORE_CID); static NS_DEFINE_CID(kParserCID, NS_PARSER_CID); -static NS_DEFINE_CID(kPresShellCID, NS_PRESSHELL_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); -static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID); static NS_DEFINE_CID(kXMLElementFactoryCID, NS_XML_ELEMENT_FACTORY_CID); -static NS_DEFINE_CID(kXULContentSinkCID, NS_XULCONTENTSINK_CID); static NS_DEFINE_CID(kXULPrototypeCacheCID, NS_XULPROTOTYPECACHE_CID); -static NS_DEFINE_CID(kDOMImplementationCID, NS_DOM_IMPLEMENTATION_CID); -static NS_DEFINE_CID(kRangeCID, NS_RANGE_CID); - -static NS_DEFINE_IID(kIParserIID, NS_IPARSER_IID); static PRBool IsChromeURI(nsIURI* aURI) { @@ -229,61 +168,69 @@ PRLogModuleInfo* nsXULDocument::gXULLog; class nsProxyLoadStream : public nsIInputStream { private: - const char* mBuffer; - PRUint32 mSize; - PRUint32 mIndex; + const char* mBuffer; + PRUint32 mSize; + PRUint32 mIndex; public: - nsProxyLoadStream(void) : mBuffer(nsnull) - { - } + nsProxyLoadStream(void) : mBuffer(nsnull) + { + } - virtual ~nsProxyLoadStream(void) { - } + virtual ~nsProxyLoadStream(void) + { + } - // nsISupports - NS_DECL_ISUPPORTS + // nsISupports + NS_DECL_ISUPPORTS - // nsIBaseStream - NS_IMETHOD Close(void) { - return NS_OK; - } + // nsIBaseStream + NS_IMETHOD Close(void) + { + return NS_OK; + } - // nsIInputStream - NS_IMETHOD Available(PRUint32 *aLength) { - *aLength = mSize - mIndex; - return NS_OK; - } + // nsIInputStream + NS_IMETHOD Available(PRUint32 *aLength) + { + *aLength = mSize - mIndex; + return NS_OK; + } - NS_IMETHOD Read(char* aBuf, PRUint32 aCount, PRUint32 *aReadCount) { - PRUint32 readCount = 0; - while (mIndex < mSize && aCount > 0) { - *aBuf = mBuffer[mIndex]; - aBuf++; - mIndex++; - readCount++; - aCount--; - } - *aReadCount = readCount; - return NS_OK; - } + NS_IMETHOD Read(char* aBuf, PRUint32 aCount, PRUint32 *aReadCount) + { + PRUint32 readCount = 0; + while (mIndex < mSize && aCount > 0) { + *aBuf = mBuffer[mIndex]; + ++aBuf; + ++mIndex; + readCount++; + --aCount; + } + *aReadCount = readCount; + return NS_OK; + } - NS_IMETHOD ReadSegments(nsWriteSegmentFun writer, void * closure, PRUint32 count, PRUint32 *_retval) { - NS_NOTREACHED("ReadSegments"); - return NS_ERROR_NOT_IMPLEMENTED; - } + NS_IMETHOD ReadSegments(nsWriteSegmentFun writer, void * closure, + PRUint32 count, PRUint32 *_retval) + { + NS_NOTREACHED("ReadSegments"); + return NS_ERROR_NOT_IMPLEMENTED; + } - NS_IMETHOD IsNonBlocking(PRBool *aNonBlocking) { - *aNonBlocking = PR_TRUE; - return NS_OK; - } + NS_IMETHOD IsNonBlocking(PRBool *aNonBlocking) + { + *aNonBlocking = PR_TRUE; + return NS_OK; + } - // Implementation - void SetBuffer(const char* aBuffer, PRUint32 aSize) { - mBuffer = aBuffer; - mSize = aSize; - mIndex = 0; - } + // Implementation + void SetBuffer(const char* aBuffer, PRUint32 aSize) + { + mBuffer = aBuffer; + mSize = aSize; + mIndex = 0; + } }; NS_IMPL_ISUPPORTS1(nsProxyLoadStream, nsIInputStream); @@ -347,7 +294,6 @@ public: NS_IMETHOD SetContentCharset(const nsACString &aContentCharset) { return NS_OK; } NS_IMETHOD GetContentLength(PRInt32 *aContentLength) { return NS_OK; } NS_IMETHOD SetContentLength(PRInt32 aContentLength) { return NS_OK; } - }; PRInt32 PlaceHolderRequest::gRefCnt; @@ -396,8 +342,8 @@ struct BroadcasterMapEntry : public PLDHashEntryHdr { }; struct BroadcastListener { - nsIDOMElement* mListener; // [WEAK] XXXwaterson crash waiting to happen! - nsCOMPtr mAttribute; + nsIDOMElement* mListener; // [WEAK] XXXwaterson crash waiting to happen! + nsCOMPtr mAttribute; }; //---------------------------------------------------------------------- @@ -405,33 +351,19 @@ struct BroadcastListener { // ctors & dtors // + // NOTE! nsDocument::operator new() zeroes out all members, so + // don't bother initializing members to 0. + nsXULDocument::nsXULDocument(void) - : mParentDocument(nsnull), - mScriptGlobalObject(nsnull), - mNextSrcLoadWaiter(nsnull), - mDisplaySelection(PR_FALSE), - mIsPopup(PR_FALSE), - mApplyingPersistedAttrs(PR_FALSE), - mIsWritingFastLoad(PR_FALSE), - mBoxObjectTable(nsnull), - mTemplateBuilderTable(nsnull), - mResolutionPhase(nsForwardReference::eStart), - mNextContentID(NS_CONTENT_ID_COUNTER_BASE), - mNumCapturers(0), - mState(eState_Master), - mCurrentScriptProto(nsnull), - mBroadcasterMap(nsnull) + : mResolutionPhase(nsForwardReference::eStart), + mState(eState_Master) { - mCharSetID.Assign(NS_LITERAL_STRING("UTF-8")); - // Force initialization. - mBindingManager = do_CreateInstance("@mozilla.org/xbl/binding-manager;1"); - nsCOMPtr observer(do_QueryInterface(mBindingManager)); - if (observer) // We must always be the first observer of the document. - mObservers.InsertElementAt(observer, 0); - mBidiEnabled = PR_FALSE; + // NOTE! nsDocument::operator new() zeroes out all members, so don't + // bother initializing members to 0. - mSubDocuments = nsnull; + // Override the default in nsDocument + mCharacterSet.Assign(NS_LITERAL_STRING("UTF-8")); } nsXULDocument::~nsXULDocument() @@ -439,62 +371,38 @@ nsXULDocument::~nsXULDocument() NS_ASSERTION(mNextSrcLoadWaiter == nsnull, "unreferenced document still waiting for script source to load?"); + // Notify our observers here, we can't let the nsDocument + // destructor do that for us since some of the observers are + // deleted by the time we get there. + + PRInt32 i; + for (i = mObservers.Count() - 1; i >= 0; --i) { + // XXX Should this be a kungfudeathgrip?!!!! + nsIDocumentObserver* observer = + NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(i)); + + observer->DocumentWillBeDestroyed(this); + } + + mObservers.Clear(); + // In case we failed somewhere early on and the forward observer // decls never got resolved. DestroyForwardReferences(); // Destroy our broadcaster map. - if (mBroadcasterMap) + if (mBroadcasterMap) { PL_DHashTableDestroy(mBroadcasterMap); - - // Notify observer that we're about to go away - // if an observer removes itself, we're ok (not if it removes others though) - PRInt32 i; - for (i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers.ElementAt(i); - observer->DocumentWillBeDestroyed(this); - } - - // Delete references to sub-documents and kill the subdocument map, - // if any. It holds strong references - if (mSubDocuments) { - PL_DHashTableDestroy(mSubDocuments); - mSubDocuments = nsnull; - } - - // Delete references to style sheets but only if we aren't a popup document. - if (!mIsPopup) { - i = mStyleSheets.Count(); - while (--i >= 0) { - nsIStyleSheet* sheet = (nsIStyleSheet*) mStyleSheets.ElementAt(i); - sheet->SetOwningDocument(nsnull); - NS_RELEASE(sheet); - } } if (mLocalStore) { - nsCOMPtr remote = do_QueryInterface(mLocalStore); + nsCOMPtr remote = + do_QueryInterface(mLocalStore); if (remote) remote->Flush(); } - if (mCSSLoader) { - mCSSLoader->DropDocumentReference(); - } - - if (mScriptLoader) { - mScriptLoader->DropDocumentReference(); - } - - if (mNodeInfoManager) { - mNodeInfoManager->DropDocumentReference(); - } - delete mTemplateBuilderTable; - delete mBoxObjectTable; - - if (mListenerManager) - mListenerManager->SetListenerTarget(nsnull); if (--gRefCnt == 0) { NS_IF_RELEASE(gRDFService); @@ -507,9 +415,9 @@ nsXULDocument::~nsXULDocument() NS_IF_RELEASE(gXMLElementFactory); if (gXULCache) { - // Remove the current document here from the FastLoad table in - // case the document did not make it past StartLayout in - // ResumeWalk. The FastLoad table must be clear of entries so + // Remove the current document here from the FastLoad table in + // case the document did not make it past StartLayout in + // ResumeWalk. The FastLoad table must be clear of entries so // that the FastLoad file footer can be properly written. if (mDocumentURL) gXULCache->RemoveFromFastLoadSet(mDocumentURL); @@ -517,8 +425,23 @@ nsXULDocument::~nsXULDocument() NS_RELEASE(gXULCache); } } -} + // The destructor of nsDocument will delete references to style + // sheets, but we don't want that if we're a popup document, so + // then we'll clear the stylesheets array here to prevent that + // from happening. + if (mIsPopup) { + mStyleSheets.Clear(); + } + + // This is done in nsDocument::~nsDocument() too, but since this + // call ends up calling back into the document through virtual + // methods (nsIDocument::GetPrincipal()) we must do it here before + // we go out of nsXULDocument's destructor. + if (mNodeInfoManager) { + mNodeInfoManager->DropDocumentReference(); + } +} nsresult NS_NewXULDocument(nsIXULDocument** result) @@ -549,36 +472,19 @@ NS_NewXULDocument(nsIXULDocument** result) // nsISupports interface // -NS_IMPL_ADDREF(nsXULDocument) -NS_IMPL_RELEASE(nsXULDocument) +NS_IMPL_ADDREF_INHERITED(nsXULDocument, nsXMLDocument) +NS_IMPL_RELEASE_INHERITED(nsXULDocument, nsXMLDocument) -// QueryInterface implementation for nsHTMLAnchorElement +// QueryInterface implementation for nsXULDocument NS_INTERFACE_MAP_BEGIN(nsXULDocument) - NS_INTERFACE_MAP_ENTRY(nsIDocument) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDocument) NS_INTERFACE_MAP_ENTRY(nsIXULDocument) NS_INTERFACE_MAP_ENTRY(nsIXMLDocument) NS_INTERFACE_MAP_ENTRY(nsIDOMXULDocument) - NS_INTERFACE_MAP_ENTRY(nsIDOMDocument) - NS_INTERFACE_MAP_ENTRY(nsIDOMNode) - NS_INTERFACE_MAP_ENTRY(nsIDOM3Node) - NS_INTERFACE_MAP_ENTRY(nsIDOMNSDocument) - NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentEvent) - NS_INTERFACE_MAP_ENTRY(nsIDOM3DocumentEvent) - NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentView) - NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentXBL) - NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentStyle) - NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentRange) - NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentTraversal) NS_INTERFACE_MAP_ENTRY(nsIHTMLContentContainer) - NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver) - NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget) - NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget) - NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_ENTRY(nsIStreamLoaderObserver) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XULDocument) -NS_INTERFACE_MAP_END +NS_INTERFACE_MAP_END_INHERITING(nsXMLDocument) //---------------------------------------------------------------------- @@ -600,13 +506,6 @@ nsXULDocument::ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup) return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP -nsXULDocument::GetArena(nsIArena** aArena) -{ - NS_IF_ADDREF(*aArena = mArena); - return NS_OK; -} - // Override the nsDocument.cpp method to keep from returning the // "cached XUL" type which is completely internal and may confuse // people @@ -627,13 +526,6 @@ nsXULDocument::SetContentType(const nsAString& aContentType) return NS_OK; } -NS_IMETHODIMP -nsXULDocument::GetContentLanguage(nsAString& aContentLanguage) const -{ - aContentLanguage.Truncate(); - return NS_OK; -} - NS_IMETHODIMP nsXULDocument::PrepareStyleSheets(nsIURI* anURL) { @@ -642,9 +534,7 @@ nsXULDocument::PrepareStyleSheets(nsIURI* anURL) // Delete references to style sheets - this should be done in superclass... PRInt32 i = mStyleSheets.Count(); while (--i >= 0) { - nsIStyleSheet* sheet = (nsIStyleSheet*) mStyleSheets.ElementAt(i); - sheet->SetOwningDocument(nsnull); - NS_RELEASE(sheet); + mStyleSheets.ObjectAt(i)->SetOwningDocument(nsnull); } mStyleSheets.Clear(); @@ -659,7 +549,8 @@ nsXULDocument::PrepareStyleSheets(nsIURI* anURL) // Create an inline style sheet for inline content that contains a style // attribute. - rv = NS_NewHTMLCSSStyleSheet(getter_AddRefs(mInlineStyleSheet), anURL, this); + rv = NS_NewHTMLCSSStyleSheet(getter_AddRefs(mInlineStyleSheet), anURL, + this); if (NS_FAILED(rv)) { NS_ERROR("unable to add inline style sheet"); return rv; @@ -671,28 +562,17 @@ nsXULDocument::PrepareStyleSheets(nsIURI* anURL) } NS_IMETHODIMP -nsXULDocument::SetDocumentURL(nsIURI* anURL) -{ - mDocumentURL = dont_QueryInterface(anURL); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::StartDocumentLoad(const char* aCommand, - nsIChannel* aChannel, +nsXULDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup, nsISupports* aContainer, nsIStreamListener **aDocListener, - PRBool aReset, - nsIContentSink* aSink) + PRBool aReset, nsIContentSink* aSink) { - nsresult rv; - mDocumentLoadGroup = getter_AddRefs(NS_GetWeakReference(aLoadGroup)); mDocumentTitle.Truncate(); - rv = aChannel->GetOriginalURI(getter_AddRefs(mDocumentURL)); + nsresult rv = aChannel->GetOriginalURI(getter_AddRefs(mDocumentURL)); if (NS_FAILED(rv)) return rv; rv = PrepareStyleSheets(mDocumentURL); @@ -704,7 +584,7 @@ nsXULDocument::StartDocumentLoad(const char* aCommand, if (IsChromeURI(mDocumentURL)) gXULCache->GetPrototype(mDocumentURL, getter_AddRefs(proto)); - // Same comment as nsChromeProtocolHandler::NewChannel and + // Same comment as nsChromeProtocolHandler::NewChannel and // nsXULDocument::ResumeWalk // - Ben Goodger // @@ -713,13 +593,13 @@ nsXULDocument::StartDocumentLoad(const char* aCommand, // to trigger the fail-safe parse-from-disk solution. Example failure cases // (for reference) include: // - // NS_ERROR_NOT_AVAILABLE: the URI cannot be found in the FastLoad cache, + // NS_ERROR_NOT_AVAILABLE: the URI cannot be found in the FastLoad cache, // parse from disk // other: the FastLoad cache file, XUL.mfl, could not be found, probably // due to being accessed before a profile has been selected (e.g. - // loading chrome for the profile manager itself). This must be - // parsed from disk. - + // loading chrome for the profile manager itself). This must be + // parsed from disk. + if (proto) { // If we're racing with another document to load proto, wait till the // load has finished loading before trying to add cloned style sheets. @@ -758,7 +638,8 @@ nsXULDocument::StartDocumentLoad(const char* aCommand, // with the stream n' stuff. nsCOMPtr parser; - rv = PrepareToLoad(aContainer, aCommand, aChannel, aLoadGroup, getter_AddRefs(parser)); + rv = PrepareToLoad(aContainer, aCommand, aChannel, aLoadGroup, + getter_AddRefs(parser)); if (NS_FAILED(rv)) return rv; mIsWritingFastLoad = PR_TRUE; @@ -785,25 +666,6 @@ nsXULDocument::StartDocumentLoad(const char* aCommand, return NS_OK; } -NS_IMETHODIMP -nsXULDocument::StopDocumentLoad() -{ - return NS_OK; -} - -const nsString* -nsXULDocument::GetDocumentTitle() const -{ - return &mDocumentTitle; -} - -NS_IMETHODIMP -nsXULDocument::GetDocumentURL(nsIURI** aURI) const -{ - NS_IF_ADDREF(*aURI = mDocumentURL); - return NS_OK; -} - NS_IMETHODIMP nsXULDocument::GetPrincipal(nsIPrincipal **aPrincipal) { @@ -821,855 +683,6 @@ nsXULDocument::AddPrincipal(nsIPrincipal *aPrincipal) return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP -nsXULDocument::GetDocumentLoadGroup(nsILoadGroup **aGroup) const -{ - nsCOMPtr group = do_QueryReferent(mDocumentLoadGroup); - - *aGroup = group; - NS_IF_ADDREF(*aGroup); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetBaseURL(nsIURI*& aURL) const -{ - if (mDocumentBaseURL) { - aURL = mDocumentBaseURL.get(); - NS_ADDREF(aURL); - } - else { - GetDocumentURL(&aURL); - } - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::SetBaseURL(nsIURI* aURL) -{ - nsresult rv; - nsCOMPtr securityManager(do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv)); - if (NS_SUCCEEDED(rv)) { - rv = securityManager->CheckLoadURI(mDocumentURL, aURL, nsIScriptSecurityManager::STANDARD); - if (NS_SUCCEEDED(rv)) { - mDocumentBaseURL = aURL; - } - } - - return rv; -} - -NS_IMETHODIMP -nsXULDocument::GetBaseTarget(nsAString &aBaseTarget) -{ - aBaseTarget.Truncate(); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::SetBaseTarget(const nsAString &aBaseTarget) -{ - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets) -{ - if (!mDOMStyleSheets) { - mDOMStyleSheets = new nsDOMStyleSheetList(this); - if (!mDOMStyleSheets) { - return NS_ERROR_OUT_OF_MEMORY; - } - } - - *aStyleSheets = mDOMStyleSheets; - NS_ADDREF(*aStyleSheets); - - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetDocumentCharacterSet(nsAString& oCharSetID) -{ - oCharSetID.Assign(mCharSetID); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::SetDocumentCharacterSet(const nsAString& aCharSetID) -{ - if (!mCharSetID.Equals(aCharSetID)) { - mCharSetID.Assign(aCharSetID); - PRInt32 n = mCharSetObservers.Count(); - // if an observer removes itself, we're NOT ok - for (PRInt32 i = 0; i < n; i++) { - nsIObserver* observer = (nsIObserver*) mCharSetObservers.ElementAt(i); - observer->Observe((nsIDocument*) this, "charset", - PromiseFlatString(aCharSetID).get()); - } - } - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetDocumentCharacterSetSource(PRInt32* aCharsetSource) -{ - *aCharsetSource = mCharacterSetSource; - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::SetDocumentCharacterSetSource(PRInt32 aCharsetSource) -{ - mCharacterSetSource = aCharsetSource; - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::AddCharSetObserver(nsIObserver* aObserver) -{ - NS_ENSURE_ARG_POINTER(aObserver); - NS_ENSURE_TRUE(mCharSetObservers.AppendElement(aObserver), NS_ERROR_FAILURE); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::RemoveCharSetObserver(nsIObserver* aObserver) -{ - NS_ENSURE_ARG_POINTER(aObserver); - NS_ENSURE_TRUE(mCharSetObservers.RemoveElement(aObserver), NS_ERROR_FAILURE); - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::GetLineBreaker(nsILineBreaker** aResult) -{ - if (!mLineBreaker) { - // no line breaker, find a default one - nsresult rv; - nsCOMPtr lf = do_GetService(kLWBrkCID, &rv); - if (lf) { - nsAutoString lbarg; - lf->GetBreaker(lbarg, getter_AddRefs(mLineBreaker)); - } - } - - *aResult = mLineBreaker; - NS_IF_ADDREF(*aResult); - - return NS_OK; // XXX we should do error handling here -} - -NS_IMETHODIMP -nsXULDocument::SetLineBreaker(nsILineBreaker* aLineBreaker) -{ - mLineBreaker = dont_QueryInterface(aLineBreaker); - return NS_OK; -} -NS_IMETHODIMP -nsXULDocument::GetWordBreaker(nsIWordBreaker** aResult) -{ - if (!mWordBreaker) { - // no line breaker, find a default one - nsresult rv; - nsCOMPtr lf = do_GetService(kLWBrkCID, &rv); - if (lf) { - nsAutoString lbarg; - rv = lf->GetBreaker(lbarg, getter_AddRefs(mWordBreaker)); - } - } - - *aResult = mWordBreaker; - NS_IF_ADDREF(*aResult); - - return NS_OK; // XXX we should do error handling here -} - -NS_IMETHODIMP -nsXULDocument::SetWordBreaker(nsIWordBreaker* aWordBreaker) -{ - mWordBreaker = dont_QueryInterface(aWordBreaker); - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::GetHeaderData(nsIAtom* aHeaderField, - nsAString& aData) const -{ - aData.Truncate(); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument:: SetHeaderData(nsIAtom* aHeaderField, - const nsAString& aData) -{ - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::CreateShell(nsIPresContext* aContext, - nsIViewManager* aViewManager, - nsIStyleSet* aStyleSet, - nsIPresShell** aInstancePtrResult) -{ - NS_PRECONDITION(aInstancePtrResult, "null ptr"); - - nsIPresShell* shell; - nsresult rv = CallCreateInstance(kPresShellCID, &shell); - if (NS_FAILED(rv)) - return rv; - - rv = shell->Init(this, aContext, aViewManager, aStyleSet, - eCompatibility_FullStandards); - if (NS_FAILED(rv)) { - NS_RELEASE(shell); - return rv; - } - - mPresShells.AppendElement(shell); - *aInstancePtrResult = shell; // addref implicit in CreateInstance() - - return NS_OK; -} - -PRBool -nsXULDocument::DeleteShell(nsIPresShell* aShell) -{ - return mPresShells.RemoveElement(aShell); -} - -PRInt32 -nsXULDocument::GetNumberOfShells() -{ - return mPresShells.Count(); -} - -NS_IMETHODIMP -nsXULDocument::GetShellAt(PRInt32 aIndex, nsIPresShell** aShell) -{ - *aShell = NS_STATIC_CAST(nsIPresShell*, mPresShells.SafeElementAt(aIndex)); - NS_IF_ADDREF(*aShell); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetParentDocument(nsIDocument** aParent) -{ - NS_IF_ADDREF(*aParent = mParentDocument); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::SetParentDocument(nsIDocument* aParent) -{ - // Note that we do *not* AddRef our parent because that would - // create a circular reference. - mParentDocument = aParent; - return NS_OK; -} - -PR_STATIC_CALLBACK(void) -SubDocClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry) -{ - SubDocMapEntry *e = NS_STATIC_CAST(SubDocMapEntry *, entry); - - NS_RELEASE(e->mKey); - NS_IF_RELEASE(e->mSubDocument); -} - -PR_STATIC_CALLBACK(void) -SubDocInitEntry(PLDHashTable *table, PLDHashEntryHdr *entry, const void *key) -{ - SubDocMapEntry *e = - NS_CONST_CAST(SubDocMapEntry *, - NS_STATIC_CAST(const SubDocMapEntry *, entry)); - - e->mKey = NS_CONST_CAST(nsIContent *, - NS_STATIC_CAST(const nsIContent *, key)); - NS_ADDREF(e->mKey); - - e->mSubDocument = nsnull; -} - -NS_IMETHODIMP -nsXULDocument::SetSubDocumentFor(nsIContent *aContent, nsIDocument* aSubDoc) -{ - NS_ENSURE_TRUE(aContent, NS_ERROR_UNEXPECTED); - - if (!aSubDoc) { - // aSubDoc is nsnull, remove the mapping - - if (mSubDocuments) { - SubDocMapEntry *entry = - NS_STATIC_CAST(SubDocMapEntry*, - PL_DHashTableOperate(mSubDocuments, aContent, - PL_DHASH_LOOKUP)); - - if (PL_DHASH_ENTRY_IS_LIVE(entry)) { - entry->mSubDocument->SetParentDocument(nsnull); - - PL_DHashTableRawRemove(mSubDocuments, entry); - } - } - } else { - if (!mSubDocuments) { - // Create a new hashtable - - static PLDHashTableOps hash_table_ops = - { - PL_DHashAllocTable, - PL_DHashFreeTable, - PL_DHashGetKeyStub, - PL_DHashVoidPtrKeyStub, - PL_DHashMatchEntryStub, - PL_DHashMoveEntryStub, - SubDocClearEntry, - PL_DHashFinalizeStub, - SubDocInitEntry - }; - - mSubDocuments = PL_NewDHashTable(&hash_table_ops, nsnull, - sizeof(SubDocMapEntry), 16); - if (!mSubDocuments) { - return NS_ERROR_OUT_OF_MEMORY; - } - } - - // Add a mapping to the hash table - SubDocMapEntry *entry = - NS_STATIC_CAST(SubDocMapEntry*, - PL_DHashTableOperate(mSubDocuments, aContent, - PL_DHASH_ADD)); - - if (!entry) { - return NS_ERROR_OUT_OF_MEMORY; - } - - if (entry->mSubDocument) { - entry->mSubDocument->SetParentDocument(nsnull); - - // Release the old sub document - NS_RELEASE(entry->mSubDocument); - } - - entry->mSubDocument = aSubDoc; - NS_ADDREF(entry->mSubDocument); - - aSubDoc->SetParentDocument(this); - } - - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetSubDocumentFor(nsIContent *aContent, nsIDocument** aSubDoc) -{ - *aSubDoc = nsnull; - - if (mSubDocuments) { - SubDocMapEntry *entry = - NS_STATIC_CAST(SubDocMapEntry*, - PL_DHashTableOperate(mSubDocuments, aContent, - PL_DHASH_LOOKUP)); - - if (PL_DHASH_ENTRY_IS_BUSY(entry)) { - *aSubDoc = entry->mSubDocument; - NS_ADDREF(*aSubDoc); - } - } - - return NS_OK; -} - -PR_STATIC_CALLBACK(PLDHashOperator) -FindContentEnumerator(PLDHashTable *table, PLDHashEntryHdr *hdr, - PRUint32 number, void *arg) -{ - SubDocMapEntry *entry = NS_STATIC_CAST(SubDocMapEntry*, hdr); - FindContentData *data = NS_STATIC_CAST(FindContentData*, arg); - - if (entry->mSubDocument == data->mSubDocument) { - data->mResult = NS_CONST_CAST(nsIContent *, entry->mKey); - - return PL_DHASH_STOP; - } - - return PL_DHASH_NEXT; -} - -NS_IMETHODIMP -nsXULDocument::FindContentForSubDocument(nsIDocument *aDocument, - nsIContent **aContent) -{ - NS_ENSURE_ARG_POINTER(aDocument); - - if (!mSubDocuments) { - *aContent = nsnull; - - return NS_OK; - } - - FindContentData data(aDocument); - PL_DHashTableEnumerate(mSubDocuments, FindContentEnumerator, &data); - - *aContent = data.mResult; - NS_IF_ADDREF(*aContent); - - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetRootContent(nsIContent** aRoot) -{ - NS_IF_ADDREF(*aRoot = mRootContent); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::SetRootContent(nsIContent* aRoot) -{ - if (mRootContent) { - mRootContent->SetDocument(nsnull, PR_TRUE, PR_TRUE); - } - mRootContent = aRoot; - if (mRootContent) { - mRootContent->SetDocument(this, PR_TRUE, PR_TRUE); - } - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::ChildAt(PRInt32 aIndex, nsIContent*& aResult) const -{ - if (aIndex != 0 || !mRootContent) { - aResult = nsnull; - return NS_ERROR_FAILURE; - } - NS_ADDREF(aResult = mRootContent); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::IndexOf(nsIContent* aPossibleChild, PRInt32& aIndex) const -{ - aIndex = (aPossibleChild == mRootContent && mRootContent)? 0 : -1; - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetChildCount(PRInt32& aCount) -{ - aCount = (mRootContent != nsnull); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetNumberOfStyleSheets(PRBool aIncludeSpecialSheets, - PRInt32 *aCount) -{ - PRInt32 count = mStyleSheets.Count(); - if (aIncludeSpecialSheets) { - *aCount = count; - return NS_OK; - } - - if (count != 0 && - (nsIHTMLCSSStyleSheet*)mInlineStyleSheet == mStyleSheets.ElementAt(count - 1)) { - // subtract the inline style sheet - --count; - } - - if (count != 0 && - (nsIHTMLStyleSheet*)mAttrStyleSheet == mStyleSheets.ElementAt(0)) { - // subtract the attr sheet - --count; - } - - NS_ASSERTION(count >= 0, "How did we get a negative count?"); - - *aCount = count; - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetStyleSheetAt(PRInt32 aIndex, PRBool aIncludeSpecialSheets, - nsIStyleSheet** aSheet) -{ - if (!aIncludeSpecialSheets) { - ++aIndex; // adjust for the attr sheet - } - *aSheet = NS_STATIC_CAST(nsIStyleSheet*, mStyleSheets[aIndex]); - NS_IF_ADDREF(*aSheet); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetIndexOfStyleSheet(nsIStyleSheet* aSheet, PRInt32* aIndex) -{ - *aIndex = mStyleSheets.IndexOf(aSheet); - return NS_OK; -} - -void -nsXULDocument::AddStyleSheetToStyleSets(nsIStyleSheet* aSheet) -{ - PRInt32 count = mPresShells.Count(); - PRInt32 indx; - for (indx = 0; indx < count; indx++) { - nsCOMPtr shell = (nsIPresShell*)mPresShells.ElementAt(indx); - nsCOMPtr set; - if (NS_SUCCEEDED(shell->GetStyleSet(getter_AddRefs(set)))) { - if (set) { - set->AddDocStyleSheet(aSheet, this); - } - } - } -} - -void -nsXULDocument::AddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags) -{ - NS_PRECONDITION(aSheet, "null arg"); - if (!aSheet) - return; - - if (aSheet == mAttrStyleSheet) { // always first - mStyleSheets.InsertElementAt(aSheet, 0); - } - else if (aSheet == (nsIHTMLCSSStyleSheet*)mInlineStyleSheet) { // always last - mStyleSheets.AppendElement(aSheet); - } - else { - PRInt32 count = mStyleSheets.Count(); - if (count != 0 && - (nsIHTMLCSSStyleSheet*)mInlineStyleSheet == mStyleSheets.ElementAt(count - 1)) { - // keep attr sheet last - mStyleSheets.InsertElementAt(aSheet, count - 1); - } - else { - mStyleSheets.AppendElement(aSheet); - } - } - NS_ADDREF(aSheet); - - aSheet->SetOwningDocument(this); - - PRBool applicable; - aSheet->GetApplicable(applicable); - - if (applicable) { - AddStyleSheetToStyleSets(aSheet); - } - - // if an observer removes itself, we're ok (not if it removes - // others though) - PRInt32 i; - for (i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers.ElementAt(i); - observer->StyleSheetAdded(this, aSheet); - } -} - -NS_IMETHODIMP -nsXULDocument::UpdateStyleSheets(nsCOMArray& aOldSheets, - nsCOMArray& aNewSheets) -{ - // XXX Need to set the sheet on the ownernode if any - NS_PRECONDITION(aOldSheets.Count() == aNewSheets.Count(), - "The lists must be the same length!"); - PRInt32 count = aOldSheets.Count(); - - nsCOMPtr oldSheet; - PRInt32 i; - for (i = 0; i < count; ++i) { - oldSheet = aOldSheets[i]; - - // First remove the old sheet. - NS_ASSERTION(oldSheet, "None of the old sheets should be null"); - PRInt32 oldIndex = mStyleSheets.IndexOf((void*)oldSheet); - NS_ASSERTION(oldIndex != -1, "stylesheet not found"); - mStyleSheets.RemoveElementAt(oldIndex); - - PRBool applicable = PR_TRUE; - oldSheet->GetApplicable(applicable); - if (applicable) { - RemoveStyleSheetFromStyleSets(oldSheet); - } - // XXX we should really notify here, but right now that would - // force things like a full reframe on every sheet. We really - // need a way to batch this sucker... - - oldSheet->SetOwningDocument(nsnull); - nsIStyleSheet* sheetPtr = oldSheet.get(); - NS_RELEASE(sheetPtr); - - // Now put the new one in its place. If it's null, just ignore it. - nsIStyleSheet* newSheet = aNewSheets[i]; - if (newSheet) { - mStyleSheets.InsertElementAt((void*)newSheet, oldIndex); - nsIStyleSheet* sheetPtr = newSheet; - NS_ADDREF(sheetPtr); - newSheet->SetOwningDocument(this); - PRBool applicable = PR_TRUE; - newSheet->GetApplicable(applicable); - if (applicable) { - AddStyleSheetToStyleSets(newSheet); - } - - // XXX we should be notifying here too. - } - } - - // Now notify so _something_ happens, assuming we did anything - if (oldSheet) { - // if an observer removes itself, we're ok (not if it removes - // others though) - // XXXldb Hopefully the observer doesn't care which sheet you use. - for (PRInt32 indx = mObservers.Count() - 1; indx >= 0; --indx) { - nsIDocumentObserver* observer = - (nsIDocumentObserver*)mObservers.ElementAt(indx); - observer->StyleSheetRemoved(this, oldSheet); - } - } - - return NS_OK; -} - -void -nsXULDocument::RemoveStyleSheetFromStyleSets(nsIStyleSheet* aSheet) -{ - PRInt32 count = mPresShells.Count(); - PRInt32 indx; - for (indx = 0; indx < count; indx++) { - nsCOMPtr shell = (nsIPresShell*)mPresShells.ElementAt(indx); - nsCOMPtr set; - if (NS_SUCCEEDED(shell->GetStyleSet(getter_AddRefs(set)))) { - if (set) { - set->RemoveDocStyleSheet(aSheet); - } - } - } -} - -void -nsXULDocument::RemoveStyleSheet(nsIStyleSheet* aSheet) -{ - NS_PRECONDITION(nsnull != aSheet, "null arg"); - mStyleSheets.RemoveElement(aSheet); - - PRBool applicable = PR_TRUE; - aSheet->GetApplicable(applicable); - if (applicable) { - RemoveStyleSheetFromStyleSets(aSheet); - } - - // if an observer removes itself, we're ok (not if it removes others though) - for (PRInt32 indx = mObservers.Count() - 1; indx >= 0; --indx) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers.ElementAt(indx); - observer->StyleSheetRemoved(this, aSheet); - } - - aSheet->SetOwningDocument(nsnull); - NS_RELEASE(aSheet); -} - -NS_IMETHODIMP -nsXULDocument::InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex) -{ - NS_PRECONDITION(nsnull != aSheet, "null ptr"); - - mStyleSheets.InsertElementAt(aSheet, aIndex + 1); // offset by one for attribute sheet - - NS_ADDREF(aSheet); - aSheet->SetOwningDocument(this); - - PRBool applicable; - aSheet->GetApplicable(applicable); - - if (applicable) { - AddStyleSheetToStyleSets(aSheet); - } - - // if an observer removes itself, we're ok (not if it removes - // others though) - PRInt32 i; - for (i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers.ElementAt(i); - observer->StyleSheetAdded(this, aSheet); - } - return NS_OK; -} - -void -nsXULDocument::SetStyleSheetApplicableState(nsIStyleSheet* aSheet, - PRBool aApplicable) -{ - NS_PRECONDITION(nsnull != aSheet, "null arg"); - - // If we're actually in the document style sheet list - if (-1 != mStyleSheets.IndexOf((void *)aSheet)) { - if (aApplicable) { - AddStyleSheetToStyleSets(aSheet); - } else { - RemoveStyleSheetFromStyleSets(aSheet); - } - } - - - // We have to always notify, since this will be called for sheets - // that are children of sheets in our style set, as well as some - // sheets for nsHTMLEditor. - - PRInt32 i; - // if an observer removes itself, we're ok (not if it removes others though) - for (i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = - (nsIDocumentObserver*)mObservers.ElementAt(i); - observer->StyleSheetApplicableStateChanged(this, aSheet, aApplicable); - } -} - -NS_IMETHODIMP -nsXULDocument::GetCSSLoader(nsICSSLoader*& aLoader) -{ - nsresult result = NS_OK; - if (!mCSSLoader) { - mCSSLoader = do_CreateInstance(kCSSLoaderCID, &result); - if (NS_SUCCEEDED(result)) { - result = mCSSLoader->Init(this); - mCSSLoader->SetCaseSensitive(PR_TRUE); - // no quirks in XUL - mCSSLoader->SetCompatibilityMode(eCompatibility_FullStandards); - } - } - aLoader = mCSSLoader; - NS_IF_ADDREF(aLoader); - return result; -} - -NS_IMETHODIMP -nsXULDocument::GetScriptLoader(nsIScriptLoader** aLoader) -{ - NS_ENSURE_ARG_POINTER(aLoader); - nsresult result = NS_OK; - if (!mScriptLoader) { - nsScriptLoader* loader = new nsScriptLoader(); - if (!loader) { - return NS_ERROR_OUT_OF_MEMORY; - } - mScriptLoader = loader; - mScriptLoader->Init(this); - } - - *aLoader = mScriptLoader; - NS_IF_ADDREF(*aLoader); - - return result; -} - -NS_IMETHODIMP -nsXULDocument::GetScriptGlobalObject(nsIScriptGlobalObject** aScriptGlobalObject) -{ - *aScriptGlobalObject = mScriptGlobalObject; - NS_IF_ADDREF(*aScriptGlobalObject); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject) -{ - if (!aScriptGlobalObject) { - // XXX HACK ALERT! If the script context owner is null, the - // document will soon be going away. So tell our content that - // to lose its reference to the document. This has to be done - // before we actually set the script context owner to null so - // that the content elements can remove references to their - // script objects. - - if (mRootContent) - mRootContent->SetDocument(nsnull, PR_TRUE, PR_TRUE); - - // Propagate the out-of-band notification to each PresShell's - // anonymous content as well. This ensures that there aren't - // any accidental script references left in anonymous content - // keeping the document alive. (While not strictly necessary - // -- the PresShell owns us -- it's tidy.) - for (PRInt32 count = mPresShells.Count() - 1; count >= 0; --count) { - nsCOMPtr shell = - NS_STATIC_CAST(nsIPresShell*, mPresShells[count]); - - if (!shell) - continue; - - shell->ReleaseAnonymousContent(); - } - -#ifdef DEBUG_jst - printf ("Content wrapper hash had %d entries.\n", - mContentWrapperHash.Count()); -#endif - - mContentWrapperHash.Reset(); - } - - mScriptGlobalObject = aScriptGlobalObject; - return NS_OK; -} - -// Note: We don't hold a reference to the document observer; we assume -// that it has a live reference to the document. -void -nsXULDocument::AddObserver(nsIDocumentObserver* aObserver) -{ - // XXX Make sure the observer isn't already in the list - if (mObservers.IndexOf(aObserver) == -1) { - mObservers.AppendElement(aObserver); - } -} - -PRBool -nsXULDocument::RemoveObserver(nsIDocumentObserver* aObserver) -{ - return mObservers.RemoveElement(aObserver); -} - -NS_IMETHODIMP -nsXULDocument::BeginUpdate() -{ - // XXX Never called. Does this matter? - for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*) mObservers[i]; - observer->BeginUpdate(this); - } - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::EndUpdate() -{ - // XXX Never called. Does this matter? - for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*) mObservers[i]; - observer->EndUpdate(this); - } - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::BeginLoad() -{ - // XXX Never called. Does this matter? - for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*) mObservers[i]; - observer->BeginLoad(this); - } - return NS_OK; -} - NS_IMETHODIMP nsXULDocument::EndLoad() { @@ -1686,10 +699,10 @@ nsXULDocument::EndLoad() PRBool useXULCache; gXULCache->GetEnabled(&useXULCache); - // If the current prototype is an overlay document (non-master prototype) - // and we're filling the FastLoad disk cache, tell the cache we're done - // loading it, and write the prototype. - if (useXULCache && mIsWritingFastLoad && + // If the current prototype is an overlay document (non-master prototype) + // and we're filling the FastLoad disk cache, tell the cache we're done + // loading it, and write the prototype. + if (useXULCache && mIsWritingFastLoad && mMasterPrototype != mCurrentPrototype && IsChromeURI(uri)) gXULCache->WritePrototype(mCurrentPrototype); @@ -1701,14 +714,14 @@ nsXULDocument::EndLoad() nsCOMPtr sheets; reg->GetStyleSheets(uri, getter_AddRefs(sheets)); - // Walk the sheets and add them to the prototype. Also put them into the document. + // Walk the sheets and add them to the prototype. Also put them + // into the document. if (sheets) { nsCOMPtr sheet; PRUint32 count; sheets->Count(&count); - for (PRUint32 i = 0; i < count; i++) { - sheets->QueryElementAt(i, NS_GET_IID(nsICSSStyleSheet), - getter_AddRefs(sheet)); + for (PRUint32 i = 0; i < count; ++i) { + sheet = do_QueryElementAt(sheets, i); if (sheet) { nsCOMPtr sheetURL; sheet->GetURL(*getter_AddRefs(sheetURL)); @@ -1737,7 +750,6 @@ nsXULDocument::EndLoad() return ResumeWalk(); } - // Called back from nsXULPrototypeDocument::NotifyLoadDone for each XUL // document that raced to start the same prototype document load, lost // the race, but hit the XUL prototype cache because the winner filled @@ -1772,7 +784,7 @@ ClearPresentationStuff(nsHashKey *aKey, void *aData, void* aClosure) nsCOMPtr boxObject(do_QueryInterface(supp)); if (boxObject) { - boxObject->InvalidatePresentationStuff(); + boxObject->InvalidatePresentationStuff(); } return PR_TRUE; @@ -1788,12 +800,12 @@ nsXULDocument::OnHide() return NS_OK; } -static void PR_CALLBACK +PR_STATIC_CALLBACK(void) ClearBroadcasterMapEntry(PLDHashTable* aTable, PLDHashEntryHdr* aEntry) { BroadcasterMapEntry* entry = NS_STATIC_CAST(BroadcasterMapEntry*, aEntry); - for (PRInt32 i = entry->mListeners.Count()-1; i>= 0; --i) { + for (PRInt32 i = entry->mListeners.Count() - 1; i >= 0; --i) { delete (BroadcastListener*)entry->mListeners[i]; } @@ -1883,16 +895,19 @@ nsXULDocument::AddBroadcastListenerFor(nsIDOMElement* aBroadcaster, nsIDOMElement* aListener, const nsAString& aAttr) { - nsresult rv = nsContentUtils::CheckSameOrigin(this, aBroadcaster); + nsresult rv = + nsContentUtils::CheckSameOrigin(NS_STATIC_CAST(nsDocument *, this), + aBroadcaster); if (NS_FAILED(rv)) { - return rv; + return rv; } - rv = nsContentUtils::CheckSameOrigin(this, aListener); + rv = nsContentUtils::CheckSameOrigin(NS_STATIC_CAST(nsDocument *, this), + aListener); if (NS_FAILED(rv)) { - return rv; + return rv; } static PLDHashTableOps gOps = { @@ -1999,29 +1014,6 @@ nsXULDocument::RemoveBroadcastListenerFor(nsIDOMElement* aBroadcaster, return NS_OK; } -NS_IMETHODIMP -nsXULDocument::ContentChanged(nsIContent* aContent, - nsISupports* aSubContent) -{ - for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; - observer->ContentChanged(this, aContent, aSubContent); - } - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::ContentStatesChanged(nsIContent* aContent1, - nsIContent* aContent2, - PRInt32 aStateMask) -{ - for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; - observer->ContentStatesChanged(this, aContent1, aContent2, aStateMask); - } - return NS_OK; -} - nsresult nsXULDocument::ExecuteOnBroadcastHandlerFor(nsIContent* aBroadcaster, nsIDOMElement* aListener, @@ -2093,10 +1085,8 @@ nsXULDocument::ExecuteOnBroadcastHandlerFor(nsIContent* aBroadcaster, } NS_IMETHODIMP -nsXULDocument::AttributeChanged(nsIContent* aElement, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType, +nsXULDocument::AttributeChanged(nsIContent* aElement, PRInt32 aNameSpaceID, + nsIAtom* aAttribute, PRInt32 aModType, nsChangeHint aHint) { nsresult rv; @@ -2124,8 +1114,7 @@ nsXULDocument::AttributeChanged(nsIContent* aElement, if (PL_DHASH_ENTRY_IS_BUSY(entry)) { // We've got listeners: push the value. nsAutoString value; - rv = aElement->GetAttr(kNameSpaceID_None, aAttribute, - value); + rv = aElement->GetAttr(kNameSpaceID_None, aAttribute, value); for (PRInt32 i = entry->mListeners.Count() - 1; i >= 0; --i) { BroadcastListener* bl = @@ -2138,8 +1127,8 @@ nsXULDocument::AttributeChanged(nsIContent* aElement, if (rv == NS_CONTENT_ATTR_NO_VALUE || rv == NS_CONTENT_ATTR_HAS_VALUE) { - listener->SetAttr(kNameSpaceID_None, aAttribute, - value, PR_TRUE); + listener->SetAttr(kNameSpaceID_None, aAttribute, value, + PR_TRUE); } else { listener->UnsetAttr(kNameSpaceID_None, aAttribute, @@ -2156,7 +1145,8 @@ nsXULDocument::AttributeChanged(nsIContent* aElement, // Now notify external observers for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) { nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; - observer->AttributeChanged(this, aElement, aNameSpaceID, aAttribute, aModType, aHint); + observer->AttributeChanged(this, aElement, aNameSpaceID, aAttribute, + aModType, aHint); } // See if there is anything we need to persist in the localstore. @@ -2182,362 +1172,68 @@ nsXULDocument::AttributeChanged(nsIContent* aElement, NS_IMETHODIMP nsXULDocument::ContentAppended(nsIContent* aContainer, - PRInt32 aNewIndexInContainer) + PRInt32 aNewIndexInContainer) { // First update our element map - { - nsresult rv; + nsresult rv; - PRInt32 count; - rv = aContainer->ChildCount(count); + PRInt32 count; + rv = aContainer->ChildCount(count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = aNewIndexInContainer; i < count; ++i) { + nsCOMPtr child; + rv = aContainer->ChildAt(i, *getter_AddRefs(child)); if (NS_FAILED(rv)) return rv; - for (PRInt32 i = aNewIndexInContainer; i < count; ++i) { - nsCOMPtr child; - rv = aContainer->ChildAt(i, *getter_AddRefs(child)); - if (NS_FAILED(rv)) return rv; - - rv = AddSubtreeToDocument(child); - if (NS_FAILED(rv)) return rv; - } + rv = AddSubtreeToDocument(child); + if (NS_FAILED(rv)) return rv; } - // Now notify external observers - // XXXdwh There is a hacky ordering dependency between the binding manager - // and the frame constructor that forces us to walk the observer list - // in a forward order - for (PRInt32 i = 0; i < mObservers.Count(); i++) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; - observer->ContentAppended(this, aContainer, aNewIndexInContainer); - // Make sure that the observer didn't remove itself during the - // notification. If it did, update our index - if (i < mObservers.Count() && - observer != (nsIDocumentObserver*)mObservers[i]) { - i--; - } - } - return NS_OK; + return nsXMLDocument::ContentAppended(aContainer, aNewIndexInContainer); } NS_IMETHODIMP nsXULDocument::ContentInserted(nsIContent* aContainer, - nsIContent* aChild, - PRInt32 aIndexInContainer) + nsIContent* aChild, + PRInt32 aIndexInContainer) { - { - nsresult rv; - rv = AddSubtreeToDocument(aChild); - if (NS_FAILED(rv)) return rv; - } + nsresult rv; + rv = AddSubtreeToDocument(aChild); + if (NS_FAILED(rv)) return rv; - // Now notify external observers - // XXXdwh There is a hacky ordering dependency between the binding manager - // and the frame constructor that forces us to walk the observer list - // in a forward order - for (PRInt32 i = 0; i < mObservers.Count(); i++) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; - observer->ContentInserted(this, aContainer, aChild, aIndexInContainer); - // Make sure that the observer didn't remove itself during the - // notification. If it did, update our index. - if (i < mObservers.Count() && - observer != (nsIDocumentObserver*)mObservers[i]) { - i--; - } - } - return NS_OK; + return nsXMLDocument::ContentInserted(aContainer, aChild, + aIndexInContainer); } NS_IMETHODIMP nsXULDocument::ContentReplaced(nsIContent* aContainer, - nsIContent* aOldChild, - nsIContent* aNewChild, - PRInt32 aIndexInContainer) + nsIContent* aOldChild, + nsIContent* aNewChild, + PRInt32 aIndexInContainer) { - { - nsresult rv; - rv = RemoveSubtreeFromDocument(aOldChild); - if (NS_FAILED(rv)) return rv; + nsresult rv; + rv = RemoveSubtreeFromDocument(aOldChild); + if (NS_FAILED(rv)) return rv; - rv = AddSubtreeToDocument(aNewChild); - if (NS_FAILED(rv)) return rv; - } + rv = AddSubtreeToDocument(aNewChild); + if (NS_FAILED(rv)) return rv; - // Now notify external observers - // XXXdwh There is a hacky ordering dependency between the binding manager - // and the frame constructor that forces us to walk the observer list - // in a reverse order - for (PRInt32 i = mObservers.Count() - 1; i >=0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; - observer->ContentReplaced(this, aContainer, aOldChild, aNewChild, - aIndexInContainer); - - } - return NS_OK; + return nsXMLDocument::ContentReplaced(aContainer, aOldChild, aNewChild, + aIndexInContainer); } NS_IMETHODIMP nsXULDocument::ContentRemoved(nsIContent* aContainer, - nsIContent* aChild, - PRInt32 aIndexInContainer) + nsIContent* aChild, + PRInt32 aIndexInContainer) { - { - nsresult rv; - rv = RemoveSubtreeFromDocument(aChild); - if (NS_FAILED(rv)) return rv; - } + nsresult rv; + rv = RemoveSubtreeFromDocument(aChild); + if (NS_FAILED(rv)) return rv; - // Now notify external observers - // XXXdwh There is a hacky ordering dependency between the binding manager - // and the frame constructor that forces us to walk the observer list - // in a reverse order - for (PRInt32 i = mObservers.Count() - 1; i >=0; i--) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; - observer->ContentRemoved(this, aContainer, - aChild, aIndexInContainer); - } - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::AttributeWillChange(nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute) -{ - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::StyleRuleChanged(nsIStyleSheet* aStyleSheet, - nsIStyleRule* aStyleRule, - nsChangeHint aHint) -{ - for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; - observer->StyleRuleChanged(this, aStyleSheet, aStyleRule, aHint); - } - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::StyleRuleAdded(nsIStyleSheet* aStyleSheet, - nsIStyleRule* aStyleRule) -{ - for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; - observer->StyleRuleAdded(this, aStyleSheet, aStyleRule); - } - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::StyleRuleRemoved(nsIStyleSheet* aStyleSheet, - nsIStyleRule* aStyleRule) -{ - for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) { - nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; - observer->StyleRuleRemoved(this, aStyleSheet, aStyleRule); - } - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetSelection(nsISelection** aSelection) -{ - if (!mSelection) { - NS_ASSERTION(0,"not initialized"); - *aSelection = nsnull; - return NS_ERROR_NOT_INITIALIZED; - } - *aSelection = mSelection; - NS_ADDREF(*aSelection); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::SelectAll() -{ - - nsIContent * start = nsnull; - nsIContent * end = nsnull; - nsIContent * body = nsnull; - - PRInt32 i, n; - mRootContent->ChildCount(n); - for (i=0;iChildAt(i, child); - nsCOMPtr atom; - child->GetTag(*getter_AddRefs(atom)); - - nsAutoString atomValue; - atom->ToString(atomValue); - - ToUpperCase(atomValue); - if (NS_LITERAL_STRING("BODY").Equals(atomValue)) { - body = child; - break; - } - - NS_RELEASE(child); - } - - if (body == nsnull) { - return NS_ERROR_FAILURE; - } - - start = body; - // Find Very first Piece of Content - for (;;) { - start->ChildCount(n); - if (n <= 0) { - break; - } - nsIContent * child = start; - child->ChildAt(0, start); - NS_RELEASE(child); - } - - end = body; - // Last piece of Content - for (;;) { - end->ChildCount(n); - if (n <= 0) { - break; - } - nsIContent * child = end; - child->ChildAt(n-1, end); - NS_RELEASE(child); - } - - //NS_RELEASE(start); - //NS_RELEASE(end); - -#if 0 // XXX nsSelectionRange is in another DLL - nsSelectionRange * range = mSelection->GetRange(); - nsSelectionPoint * startPnt = range->GetStartPoint(); - nsSelectionPoint * endPnt = range->GetEndPoint(); - startPnt->SetPoint(start, -1, PR_TRUE); - endPnt->SetPoint(end, -1, PR_FALSE); -#endif - SetDisplaySelection(nsISelectionController::SELECTION_ON); - - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::FindNext(const nsAString &aSearchStr, - PRBool aMatchCase, PRBool aSearchDown, - PRBool &aIsFound) -{ - aIsFound = PR_FALSE; - return NS_ERROR_FAILURE; -} - - -NS_IMETHODIMP -nsXULDocument::FlushPendingNotifications(PRBool aFlushReflows, PRBool aUpdateViews) -{ - if (aFlushReflows) { - - PRInt32 i, count = mPresShells.Count(); - - for (i = 0; i < count; i++) { - nsCOMPtr shell = - NS_STATIC_CAST(nsIPresShell*, mPresShells[i]); - - if (shell) { - shell->FlushPendingNotifications(aUpdateViews); - } - } - } - - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetAndIncrementContentID(PRInt32* aID) -{ - *aID = mNextContentID++; - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetBindingManager(nsIBindingManager** aResult) -{ - *aResult = mBindingManager; - NS_IF_ADDREF(*aResult); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetNodeInfoManager(class nsINodeInfoManager *&aNodeInfoManager) -{ - NS_ENSURE_TRUE(mNodeInfoManager, NS_ERROR_NOT_INITIALIZED); - - aNodeInfoManager = mNodeInfoManager; - NS_ADDREF(aNodeInfoManager); - - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::AddReference(void *aKey, nsISupports *aReference) -{ - nsVoidKey key(aKey); - - if (mScriptGlobalObject) { - mContentWrapperHash.Put(&key, aReference); - } - - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::RemoveReference(void *aKey, nsISupports **aOldReference) -{ - nsVoidKey key(aKey); - - mContentWrapperHash.Remove(&key, aOldReference); - - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::SetContainer(nsISupports *aContainer) -{ - mDocumentContainer = dont_AddRef(NS_GetWeakReference(aContainer)); - - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetContainer(nsISupports **aContainer) -{ - nsCOMPtr container = do_QueryReferent(mDocumentContainer); - - *aContainer = container; - NS_IF_ADDREF(*aContainer); - - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetScriptEventManager(nsIScriptEventManager **aResult) -{ - *aResult = nsnull; - return NS_ERROR_NOT_IMPLEMENTED; -} - -void -nsXULDocument::SetDisplaySelection(PRInt8 aToggle) -{ - mDisplaySelection = aToggle; -} - -PRInt8 -nsXULDocument::GetDisplaySelection() const -{ - return mDisplaySelection; + return nsXMLDocument::ContentRemoved(aContainer, aChild, + aIndexInContainer); } NS_IMETHODIMP @@ -2547,68 +1243,69 @@ nsXULDocument::HandleDOMEvent(nsIPresContext* aPresContext, PRUint32 aFlags, nsEventStatus* aEventStatus) { - nsresult ret = NS_OK; - nsIDOMEvent* domEvent = nsnull; - PRBool externalDOMEvent = PR_FALSE; + nsresult ret = NS_OK; + nsIDOMEvent* domEvent = nsnull; + PRBool externalDOMEvent = PR_FALSE; - if (NS_EVENT_FLAG_INIT & aFlags) { - if (aDOMEvent) { - if (*aDOMEvent) { - externalDOMEvent = PR_TRUE; - } - } - else { - aDOMEvent = &domEvent; - } - aEvent->flags |= aFlags; - aFlags &= ~(NS_EVENT_FLAG_CANT_BUBBLE | NS_EVENT_FLAG_CANT_CANCEL); - aFlags |= NS_EVENT_FLAG_BUBBLE | NS_EVENT_FLAG_CAPTURE; - } - - //Capturing stage - if (NS_EVENT_FLAG_CAPTURE & aFlags && mScriptGlobalObject) { - mScriptGlobalObject->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, aFlags & NS_EVENT_CAPTURE_MASK, aEventStatus); - } - - //Local handling stage - if (mListenerManager) { - aEvent->flags |= aFlags; - mListenerManager->HandleEvent(aPresContext, aEvent, aDOMEvent, this, aFlags, aEventStatus); - aEvent->flags &= ~aFlags; - } - - //Bubbling stage - if (NS_EVENT_FLAG_BUBBLE & aFlags && mScriptGlobalObject) { - mScriptGlobalObject->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, aFlags & NS_EVENT_BUBBLE_MASK, aEventStatus); - } - - if (NS_EVENT_FLAG_INIT & aFlags) { - // We're leaving the DOM event loop so if we created a DOM event, release here. - if (nsnull != *aDOMEvent && !externalDOMEvent) { - nsrefcnt rc; - NS_RELEASE2(*aDOMEvent, rc); - if (0 != rc) { - // Okay, so someone in the DOM loop (a listener, JS object) still has - // a ref to the DOM Event but the internal data hasn't been malloc'd. - // Force a copy of the data here so the DOM Event is still valid. - nsCOMPtr privateEvent = do_QueryInterface(*aDOMEvent); - if (privateEvent) { - privateEvent->DuplicatePrivateData(); + if (NS_EVENT_FLAG_INIT & aFlags) { + if (aDOMEvent) { + if (*aDOMEvent) { + externalDOMEvent = PR_TRUE; + } } - } + else { + aDOMEvent = &domEvent; + } + aEvent->flags |= aFlags; + aFlags &= ~(NS_EVENT_FLAG_CANT_BUBBLE | NS_EVENT_FLAG_CANT_CANCEL); + aFlags |= NS_EVENT_FLAG_BUBBLE | NS_EVENT_FLAG_CAPTURE; } - aDOMEvent = nsnull; - } - return ret; -} + // Capturing stage + if (NS_EVENT_FLAG_CAPTURE & aFlags && mScriptGlobalObject) { + mScriptGlobalObject->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags & NS_EVENT_CAPTURE_MASK, + aEventStatus); + } -NS_IMETHODIMP_(PRBool) -nsXULDocument::EventCaptureRegistration(PRInt32 aCapturerIncrement) -{ - mNumCapturers += aCapturerIncrement; - NS_ASSERTION(mNumCapturers >= 0, "Number of capturers has become negative"); - return (mNumCapturers > 0 ? PR_TRUE : PR_FALSE); + // Local handling stage + if (mListenerManager) { + aEvent->flags |= aFlags; + mListenerManager->HandleEvent(aPresContext, aEvent, aDOMEvent, + this, aFlags, aEventStatus); + aEvent->flags &= ~aFlags; + } + + // Bubbling stage + if (NS_EVENT_FLAG_BUBBLE & aFlags && mScriptGlobalObject) { + mScriptGlobalObject->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags & NS_EVENT_BUBBLE_MASK, + aEventStatus); + } + + if (NS_EVENT_FLAG_INIT & aFlags) { + // We're leaving the DOM event loop so if we created a DOM + // event, release here. + if (*aDOMEvent && !externalDOMEvent) { + nsrefcnt rc; + NS_RELEASE2(*aDOMEvent, rc); + if (0 != rc) { + // Okay, so someone in the DOM loop (a listener, JS + // object) still has a ref to the DOM Event but the + // internal data hasn't been malloc'd. Force a copy + // of the data here so the DOM Event is still valid. + nsCOMPtr privateEvent = + do_QueryInterface(*aDOMEvent); + + if (privateEvent) { + privateEvent->DuplicatePrivateData(); + } + } + } + aDOMEvent = nsnull; + } + + return ret; } //---------------------------------------------------------------------- @@ -2624,18 +1321,12 @@ nsXULDocument::SetDefaultStylesheets(nsIURI* aUrl) return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP -nsXULDocument::SetTitle(const PRUnichar *aTitle) -{ - return SetTitle(nsDependentString(aTitle)); -} - NS_IMETHODIMP nsXULDocument::SetXMLDeclaration(const nsAString& aVersion, const nsAString& aEncoding, const nsAString& aStandalone) { - return NS_OK; + return NS_OK; } NS_IMETHODIMP @@ -2643,10 +1334,10 @@ nsXULDocument::GetXMLDeclaration(nsAString& aVersion, nsAString& aEncoding, nsAString& aStandalone) { - aVersion.Truncate(); - aEncoding.Truncate(); - aStandalone.Truncate(); - return NS_OK; + aVersion.Truncate(); + aEncoding.Truncate(); + aStandalone.Truncate(); + return NS_OK; } @@ -2680,7 +1371,8 @@ nsXULDocument::RemoveElementForID(const nsAString& aID, nsIContent* aElement) } NS_IMETHODIMP -nsXULDocument::GetElementsForID(const nsAString& aID, nsISupportsArray* aElements) +nsXULDocument::GetElementsForID(const nsAString& aID, + nsISupportsArray* aElements) { NS_PRECONDITION(aElements != nsnull, "null ptr"); if (! aElements) @@ -2757,23 +1449,23 @@ nsXULDocument::ResolveForwardReferences() NS_IMETHODIMP nsXULDocument::SetMasterPrototype(nsIXULPrototypeDocument* aDocument) { - mMasterPrototype = aDocument; - return NS_OK; + mMasterPrototype = aDocument; + return NS_OK; } NS_IMETHODIMP nsXULDocument::GetMasterPrototype(nsIXULPrototypeDocument** aDocument) { - *aDocument = mMasterPrototype; - NS_IF_ADDREF(*aDocument); - return NS_OK; + *aDocument = mMasterPrototype; + NS_IF_ADDREF(*aDocument); + return NS_OK; } NS_IMETHODIMP nsXULDocument::SetCurrentPrototype(nsIXULPrototypeDocument* aDocument) { - mCurrentPrototype = aDocument; - return NS_OK; + mCurrentPrototype = aDocument; + return NS_OK; } //---------------------------------------------------------------------- @@ -2781,46 +1473,6 @@ nsXULDocument::SetCurrentPrototype(nsIXULPrototypeDocument* aDocument) // nsIDOMDocument interface // -NS_IMETHODIMP -nsXULDocument::GetDoctype(nsIDOMDocumentType** aDoctype) -{ - NS_NOTREACHED("nsXULDocument::GetDoctype"); - NS_ENSURE_ARG_POINTER(aDoctype); - *aDoctype = nsnull; - return NS_ERROR_NOT_IMPLEMENTED; -} - - -NS_IMETHODIMP -nsXULDocument::GetImplementation(nsIDOMDOMImplementation** aImplementation) -{ - nsresult rv; - rv = CallCreateInstance(kDOMImplementationCID, aImplementation); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr impl = do_QueryInterface(*aImplementation, &rv); - if (NS_FAILED(rv)) return rv; - - rv = impl->Init(mDocumentURL); - return rv; -} - -NS_IMETHODIMP -nsXULDocument::GetDocumentElement(nsIDOMElement** aDocumentElement) -{ - NS_ENSURE_ARG_POINTER(aDocumentElement); - - if (mRootContent) { - return CallQueryInterface(mRootContent, aDocumentElement); - } - - *aDocumentElement = nsnull; - - return NS_OK; -} - - - NS_IMETHODIMP nsXULDocument::CreateElement(const nsAString& aTagName, nsIDOMElement** aReturn) @@ -2868,116 +1520,6 @@ nsXULDocument::CreateElement(const nsAString& aTagName, } -NS_IMETHODIMP -nsXULDocument::CreateDocumentFragment(nsIDOMDocumentFragment** aReturn) -{ - NS_NOTREACHED("nsXULDocument::CreateDocumentFragment"); - return NS_ERROR_NOT_IMPLEMENTED; -} - - -NS_IMETHODIMP -nsXULDocument::CreateTextNode(const nsAString& aData, - nsIDOMText** aReturn) -{ - NS_PRECONDITION(aReturn != nsnull, "null ptr"); - if (! aReturn) - return NS_ERROR_NULL_POINTER; - - nsresult rv; - - nsCOMPtr text = do_CreateInstance(kTextNodeCID, &rv); - if (NS_FAILED(rv)) return rv; - - rv = text->SetText(aData, PR_FALSE); - if (NS_FAILED(rv)) return rv; - - rv = CallQueryInterface(text, aReturn); - NS_ASSERTION(NS_SUCCEEDED(rv), "not a DOMText"); - if (NS_FAILED(rv)) return rv; - - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::CreateComment(const nsAString& aData, - nsIDOMComment** aReturn) -{ - nsCOMPtr comment; - nsresult rv = NS_NewCommentNode(getter_AddRefs(comment)); - - if (NS_SUCCEEDED(rv)) { - rv = CallQueryInterface(comment, aReturn); - (*aReturn)->AppendData(aData); - } - - return rv; -} - - -NS_IMETHODIMP -nsXULDocument::CreateCDATASection(const nsAString& aData, - nsIDOMCDATASection** aReturn) -{ - NS_NOTREACHED("nsXULDocument::CreateCDATASection"); - return NS_ERROR_NOT_IMPLEMENTED; -} - - -NS_IMETHODIMP -nsXULDocument::CreateProcessingInstruction(const nsAString& aTarget, - const nsAString& aData, - nsIDOMProcessingInstruction** aReturn) -{ - NS_ENSURE_ARG_POINTER(aReturn); - *aReturn = nsnull; - - nsCOMPtr content; - nsresult rv = NS_NewXMLProcessingInstruction(getter_AddRefs(content), - aTarget, aData); - - if (NS_FAILED(rv)) { - return rv; - } - - return CallQueryInterface(content, aReturn); -} - - -NS_IMETHODIMP -nsXULDocument::CreateAttribute(const nsAString& aName, - nsIDOMAttr** aReturn) -{ - NS_NOTREACHED("nsXULDocument::CreateAttribute"); - return NS_ERROR_NOT_IMPLEMENTED; -} - - -NS_IMETHODIMP -nsXULDocument::CreateEntityReference(const nsAString& aName, - nsIDOMEntityReference** aReturn) -{ - NS_NOTREACHED("nsXULDocument::CreateEntityReference"); - return NS_ERROR_NOT_IMPLEMENTED; -} - - -NS_IMETHODIMP -nsXULDocument::GetElementsByTagName(const nsAString& aTagname, - nsIDOMNodeList** aReturn) -{ - nsCOMPtr nameAtom = do_GetAtom(aTagname); - NS_ENSURE_TRUE(nameAtom, NS_ERROR_OUT_OF_MEMORY); - - nsCOMPtr list; - NS_GetContentList(this, nameAtom, kNameSpaceID_Unknown, nsnull, - getter_AddRefs(list)); - NS_ENSURE_TRUE(list, NS_ERROR_OUT_OF_MEMORY); - - return CallQueryInterface(list, aReturn); -} - NS_IMETHODIMP nsXULDocument::GetElementsByAttribute(const nsAString& aAttribute, const nsAString& aValue, @@ -3146,7 +1688,8 @@ nsresult nsXULDocument::DestroyForwardReferences() { for (PRInt32 i = mForwardReferences.Count() - 1; i >= 0; --i) { - nsForwardReference* fwdref = NS_REINTERPRET_CAST(nsForwardReference*, mForwardReferences[i]); + nsForwardReference* fwdref = + NS_REINTERPRET_CAST(nsForwardReference*, mForwardReferences[i]); delete fwdref; } @@ -3155,80 +1698,8 @@ nsXULDocument::DestroyForwardReferences() } -//---------------------------------------------------------------------- -// -// nsIDOMNSDocument interface -// - -NS_IMETHODIMP -nsXULDocument::GetCharacterSet(nsAString& aCharacterSet) -{ - return GetDocumentCharacterSet(aCharacterSet); -} - -NS_IMETHODIMP -nsXULDocument::CreateRange(nsIDOMRange** aRange) -{ - return CallCreateInstance(kRangeCID, aRange); -} - -NS_IMETHODIMP -nsXULDocument::CreateNodeIterator(nsIDOMNode *aRoot, - PRUint32 aWhatToShow, - nsIDOMNodeFilter *aFilter, - PRBool aEntityReferenceExpansion, - nsIDOMNodeIterator **_retval) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsXULDocument::CreateTreeWalker(nsIDOMNode *aRoot, - PRUint32 aWhatToShow, - nsIDOMNodeFilter *aFilter, - PRBool aEntityReferenceExpansion, - nsIDOMTreeWalker **_retval) -{ - *_retval = nsnull; - - nsresult rv = nsContentUtils::CheckSameOrigin(this, aRoot); - if(NS_FAILED(rv)) - return rv; - - return NS_NewTreeWalker(aRoot, - aWhatToShow, - aFilter, - aEntityReferenceExpansion, - _retval); -} - -NS_IMETHODIMP -nsXULDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView) -{ - NS_ENSURE_ARG_POINTER(aDefaultView); - *aDefaultView = nsnull; - - nsCOMPtr shell = NS_STATIC_CAST(nsIPresShell *, - mPresShells.SafeElementAt(0)); - NS_ENSURE_TRUE(shell, NS_OK); - - nsCOMPtr ctx; - nsresult rv = shell->GetPresContext(getter_AddRefs(ctx)); - NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && ctx, rv); - - nsCOMPtr container; - rv = ctx->GetContainer(getter_AddRefs(container)); - NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && container, rv); - - nsCOMPtr window = do_GetInterface(container); - NS_ENSURE_TRUE(window, NS_OK); - - return CallQueryInterface(window, aDefaultView); -} - nsresult -nsXULDocument::GetPixelDimensions(nsIPresShell* aShell, - PRInt32* aWidth, +nsXULDocument::GetPixelDimensions(nsIPresShell* aShell, PRInt32* aWidth, PRInt32* aHeight) { nsresult result = NS_OK; @@ -3291,7 +1762,6 @@ nsXULDocument::GetPixelDimensions(nsIPresShell* aShell, } return result; - } NS_IMETHODIMP @@ -3338,65 +1808,6 @@ nsXULDocument::GetHeight(PRInt32* aHeight) return result; } -NS_IMETHODIMP -nsXULDocument::AddBinding(nsIDOMElement* aContent, - const nsAString& aURL) -{ - nsresult rv = nsContentUtils::CheckSameOrigin(this, aContent); - if (NS_FAILED(rv)) { - return rv; - } - - nsCOMPtr bm; - GetBindingManager(getter_AddRefs(bm)); - nsCOMPtr content(do_QueryInterface(aContent)); - - return bm->AddLayeredBinding(content, aURL); -} - -NS_IMETHODIMP -nsXULDocument::RemoveBinding(nsIDOMElement* aContent, - const nsAString& aURL) -{ - if (mBindingManager) { - nsCOMPtr content(do_QueryInterface(aContent)); - return mBindingManager->RemoveLayeredBinding(content, aURL); - } - - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP -nsXULDocument::LoadBindingDocument(const nsAString& aURL, nsIDOMDocument** aResult) -{ - if (mBindingManager) { - nsCOMPtr doc; - mBindingManager->LoadBindingDocument(this, aURL, getter_AddRefs(doc)); - nsCOMPtr domDoc(do_QueryInterface(doc)); - *aResult = domDoc; - NS_IF_ADDREF(*aResult); - return NS_OK; - } - - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP -nsXULDocument::GetBindingParent(nsIDOMNode* aNode, nsIDOMElement** aResult) -{ - *aResult = nsnull; - nsCOMPtr content(do_QueryInterface(aNode)); - if (!content) - return NS_ERROR_FAILURE; - - nsCOMPtr result; - content->GetBindingParent(getter_AddRefs(result)); - nsCOMPtr elt(do_QueryInterface(result)); - *aResult = elt; - NS_IF_ADDREF(*aResult); - return NS_OK; -} - static nsresult GetElementByAttribute(nsIContent* aContent, nsIAtom* aAttrName, @@ -3404,150 +1815,30 @@ GetElementByAttribute(nsIContent* aContent, PRBool aUniversalMatch, nsIDOMElement** aResult) { - nsAutoString value; - nsresult rv = aContent->GetAttr(kNameSpaceID_None, aAttrName, value); - if (rv == NS_CONTENT_ATTR_HAS_VALUE) { - if (aUniversalMatch || value.Equals(aAttrValue)) - return CallQueryInterface(aContent, aResult); - } - - - PRInt32 childCount; - aContent->ChildCount(childCount); - - for (PRInt32 i = 0; i < childCount; ++i) { - nsCOMPtr current; - aContent->ChildAt(i, *getter_AddRefs(current)); - - GetElementByAttribute(current, aAttrName, aAttrValue, aUniversalMatch, aResult); - - if (*aResult) - return NS_OK; - } - - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::GetAnonymousElementByAttribute(nsIDOMElement* aElement, - const nsAString& aAttrName, - const nsAString& aAttrValue, - nsIDOMElement** aResult) -{ - *aResult = nsnull; - - nsCOMPtr nodeList; - GetAnonymousNodes(aElement, getter_AddRefs(nodeList)); - - if (!nodeList) - return NS_OK; - - nsCOMPtr attribute = do_GetAtom(aAttrName); - - PRUint32 length; - nodeList->GetLength(&length); - - PRBool universalMatch = aAttrValue.Equals(NS_LITERAL_STRING("*")); - - for (PRUint32 i = 0; i < length; ++i) { - nsCOMPtr current; - nodeList->Item(i, getter_AddRefs(current)); - - nsCOMPtr content(do_QueryInterface(current)); - - GetElementByAttribute(content, attribute, aAttrValue, universalMatch, aResult); - if (*aResult) - return NS_OK; - } - - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetAnonymousNodes(nsIDOMElement* aElement, - nsIDOMNodeList** aResult) -{ - *aResult = nsnull; - if (mBindingManager) { - nsCOMPtr content(do_QueryInterface(aElement)); - return mBindingManager->GetAnonymousNodesFor(content, aResult); - } - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetLocation(nsIDOMLocation** aLocation) -{ - if (mScriptGlobalObject) { - nsCOMPtr window(do_QueryInterface(mScriptGlobalObject)); - if(window) { - return window->GetLocation(aLocation); + nsAutoString value; + nsresult rv = aContent->GetAttr(kNameSpaceID_None, aAttrName, value); + if (rv == NS_CONTENT_ATTR_HAS_VALUE) { + if (aUniversalMatch || value.Equals(aAttrValue)) + return CallQueryInterface(aContent, aResult); } - } - return NS_OK; -} -NS_IMETHODIMP -nsXULDocument::GetTitle(nsAString& aTitle) -{ - aTitle.Assign(mDocumentTitle); + PRInt32 childCount; + aContent->ChildCount(childCount); + + for (PRInt32 i = 0; i < childCount; ++i) { + nsCOMPtr current; + aContent->ChildAt(i, *getter_AddRefs(current)); + + GetElementByAttribute(current, aAttrName, aAttrValue, aUniversalMatch, + aResult); + + if (*aResult) + return NS_OK; + } return NS_OK; } -NS_IMETHODIMP -nsXULDocument::SetTitle(const nsAString& aTitle) -{ - for (PRInt32 i = mPresShells.Count() - 1; i >= 0; --i) { - nsCOMPtr shell = - NS_STATIC_CAST(nsIPresShell*, mPresShells[i]); - - nsCOMPtr context; - nsresult rv = shell->GetPresContext(getter_AddRefs(context)); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr container; - rv = context->GetContainer(getter_AddRefs(container)); - NS_ENSURE_SUCCESS(rv, rv); - - if (!container) - continue; - - nsCOMPtr docShellWin = do_QueryInterface(container); - if(!docShellWin) - continue; - - rv = docShellWin->SetTitle(PromiseFlatString(aTitle).get()); - NS_ENSURE_SUCCESS(rv, rv); - } - - mDocumentTitle.Assign(aTitle); - - // Fire a DOM event for the title change. - nsCOMPtr event; - CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event)); - if (event) { - event->InitEvent(NS_LITERAL_STRING("DOMTitleChanged"), PR_TRUE, PR_TRUE); - PRBool noDefault; - DispatchEvent(event, &noDefault); - } - - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::GetDir(nsAString& aDirection) -{ - aDirection.Assign(NS_LITERAL_STRING("ltr")); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::SetDir(const nsAString& aDirection) -{ - return NS_OK; -} //---------------------------------------------------------------------- // @@ -3603,89 +1894,11 @@ nsXULDocument::SetTooltipNode(nsIDOMNode* aNode) NS_IMETHODIMP nsXULDocument::GetCommandDispatcher(nsIDOMXULCommandDispatcher** aTracker) { - *aTracker = mCommandDispatcher; - NS_IF_ADDREF(*aTracker); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::ImportNode(nsIDOMNode* aImportedNode, - PRBool aDeep, - nsIDOMNode** aReturn) -{ - NS_NOTYETIMPLEMENTED("write me"); - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsXULDocument::CreateElementNS(const nsAString& aNamespaceURI, - const nsAString& aQualifiedName, - nsIDOMElement** aReturn) -{ - NS_ENSURE_ARG_POINTER(aReturn); - - nsresult rv; - -#ifdef PR_LOGGING - if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) { - char* namespaceCStr = ToNewCString(aNamespaceURI); - char* tagCStr = ToNewCString(aQualifiedName); - - PR_LOG(gXULLog, PR_LOG_DEBUG, - ("xul[CreateElementNS] [%s]:%s", namespaceCStr, tagCStr)); - - nsCRT::free(tagCStr); - nsCRT::free(namespaceCStr); - } -#endif - - nsCOMPtr name, prefix; - - // parse the user-provided string into a tag name and prefix - rv = ParseTagString(aQualifiedName, *getter_AddRefs(name), - *getter_AddRefs(prefix)); - if (NS_FAILED(rv)) { -#ifdef PR_LOGGING - char* tagNameStr = ToNewCString(aQualifiedName); - PR_LOG(gXULLog, PR_LOG_ERROR, - ("xul[CreateElement] unable to parse tag '%s'; no such namespace.", tagNameStr)); - nsCRT::free(tagNameStr); -#endif - return rv; - } - - // Get The real namespace ID - PRInt32 nameSpaceID; - rv = nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI, - nameSpaceID); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr ni; - // XXX This whole method is deprecated! - mNodeInfoManager->GetNodeInfo(name, prefix, nameSpaceID, - *getter_AddRefs(ni)); - - nsCOMPtr result; - rv = CreateElement(ni, getter_AddRefs(result)); - if (NS_FAILED(rv)) return rv; - - // get the DOM interface - rv = CallQueryInterface(result, aReturn); - NS_ASSERTION(NS_SUCCEEDED(rv), "not a DOM element"); - if (NS_FAILED(rv)) return rv; - + *aTracker = mCommandDispatcher; + NS_IF_ADDREF(*aTracker); return NS_OK; } -NS_IMETHODIMP -nsXULDocument::CreateAttributeNS(const nsAString& aNamespaceURI, - const nsAString& aQualifiedName, - nsIDOMAttr** aReturn) -{ - NS_NOTYETIMPLEMENTED("write me"); - return NS_ERROR_NOT_IMPLEMENTED; -} - NS_IMETHODIMP nsXULDocument::GetElementById(const nsAString& aId, nsIDOMElement** aReturn) @@ -3710,39 +1923,6 @@ nsXULDocument::GetElementById(const nsAString& aId, return rv; } -NS_IMETHODIMP -nsXULDocument::GetElementsByTagNameNS(const nsAString& aNamespaceURI, - const nsAString& aLocalName, - nsIDOMNodeList** aReturn) -{ - PRInt32 nameSpaceId = kNameSpaceID_Unknown; - - nsCOMPtr list; - - if (!aNamespaceURI.Equals(NS_LITERAL_STRING("*"))) { - nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI, - nameSpaceId); - - if (nameSpaceId == kNameSpaceID_Unknown) { - // Unknown namespace means no matches, we create an empty list... - NS_GetContentList(this, nsnull, kNameSpaceID_None, nsnull, - getter_AddRefs(list)); - NS_ENSURE_TRUE(list, NS_ERROR_OUT_OF_MEMORY); - } - } - - if (!list) { - nsCOMPtr nameAtom = do_GetAtom(aLocalName); - NS_ENSURE_TRUE(nameAtom, NS_ERROR_OUT_OF_MEMORY); - - NS_GetContentList(this, nameAtom, nameSpaceId, nsnull, - getter_AddRefs(list)); - NS_ENSURE_TRUE(list, NS_ERROR_OUT_OF_MEMORY); - } - - return CallQueryInterface(list, aReturn); -} - nsresult nsXULDocument::AddElementToDocumentPre(nsIContent* aElement) { @@ -3758,8 +1938,10 @@ nsXULDocument::AddElementToDocumentPre(nsIContent* aElement) // "commandupdater='true'" attribute), then add the element to the // document's command dispatcher nsAutoString value; - rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::commandupdater, value); - if ((rv == NS_CONTENT_ATTR_HAS_VALUE) && value == NS_LITERAL_STRING("true")) { + rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::commandupdater, + value); + if (rv == NS_CONTENT_ATTR_HAS_VALUE && + value == NS_LITERAL_STRING("true")) { rv = nsXULContentUtils::SetCommandUpdater(this, aElement); if (NS_FAILED(rv)) return rv; } @@ -3787,14 +1969,12 @@ nsXULDocument::AddElementToDocumentPre(nsIContent* aElement) nsresult nsXULDocument::AddElementToDocumentPost(nsIContent* aElement) { - nsresult rv; - // We need to pay special attention to the keyset tag to set up a listener nsCOMPtr tag; aElement->GetTag(*getter_AddRefs(tag)); - if (tag.get() == nsXULAtoms::keyset) { + if (tag == nsXULAtoms::keyset) { // Create our XUL key listener and hook it up. - nsCOMPtr xblService(do_GetService("@mozilla.org/xbl;1", &rv)); + nsCOMPtr xblService(do_GetService("@mozilla.org/xbl;1")); if (xblService) { nsCOMPtr rec(do_QueryInterface(aElement)); xblService->AttachGlobalKeyHandler(rec); @@ -3862,8 +2042,10 @@ nsXULDocument::RemoveSubtreeFromDocument(nsIContent* aElement) // 3. If the element is a 'command updater', then remove the // element from the document's command dispatcher. nsAutoString value; - rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::commandupdater, value); - if ((rv == NS_CONTENT_ATTR_HAS_VALUE) && value == NS_LITERAL_STRING("true")) { + rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::commandupdater, + value); + if (rv == NS_CONTENT_ATTR_HAS_VALUE && + value == NS_LITERAL_STRING("true")) { nsCOMPtr domelement = do_QueryInterface(aElement); NS_ASSERTION(domelement != nsnull, "not a DOM element"); if (! domelement) @@ -3878,17 +2060,16 @@ nsXULDocument::RemoveSubtreeFromDocument(nsIContent* aElement) // Do a getElementById to retrieve the broadcaster nsCOMPtr broadcaster; nsAutoString observesVal; - + if (aElement->HasAttr(kNameSpaceID_None, nsXULAtoms::observes)) { aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::observes, observesVal); if (!observesVal.IsEmpty()) { GetElementById(observesVal, getter_AddRefs(broadcaster)); if (broadcaster) { nsCOMPtr elt(do_QueryInterface(aElement)); - RemoveBroadcastListenerFor(broadcaster, - elt, + RemoveBroadcastListenerFor(broadcaster, elt, NS_LITERAL_STRING("*")); - } + } } } @@ -3898,52 +2079,59 @@ nsXULDocument::RemoveSubtreeFromDocument(nsIContent* aElement) GetElementById(observesVal, getter_AddRefs(broadcaster)); if (broadcaster) { nsCOMPtr elt(do_QueryInterface(aElement)); - RemoveBroadcastListenerFor(broadcaster, - elt, + RemoveBroadcastListenerFor(broadcaster, elt, NS_LITERAL_STRING("*")); - } + } } } return NS_OK; } NS_IMETHODIMP -nsXULDocument::SetTemplateBuilderFor(nsIContent* aContent, nsIXULTemplateBuilder* aBuilder) +nsXULDocument::SetTemplateBuilderFor(nsIContent* aContent, + nsIXULTemplateBuilder* aBuilder) { - if (! mTemplateBuilderTable) { - mTemplateBuilderTable = new nsSupportsHashtable(); - if (! mTemplateBuilderTable) - return NS_ERROR_OUT_OF_MEMORY; - } + if (! mTemplateBuilderTable) { + mTemplateBuilderTable = new nsSupportsHashtable(); + if (! mTemplateBuilderTable) + return NS_ERROR_OUT_OF_MEMORY; + } - nsISupportsKey key(aContent); + nsISupportsKey key(aContent); - if (aContent) { - mTemplateBuilderTable->Put(&key, aBuilder); - } - else { - mTemplateBuilderTable->Remove(&key); - } + if (aContent) { + mTemplateBuilderTable->Put(&key, aBuilder); + } + else { + mTemplateBuilderTable->Remove(&key); + } - return NS_OK; + return NS_OK; } NS_IMETHODIMP -nsXULDocument::GetTemplateBuilderFor(nsIContent* aContent, nsIXULTemplateBuilder** aResult) +nsXULDocument::GetTemplateBuilderFor(nsIContent* aContent, + nsIXULTemplateBuilder** aResult) { - if (mTemplateBuilderTable) { - nsISupportsKey key(aContent); - *aResult = NS_STATIC_CAST(nsIXULTemplateBuilder*, mTemplateBuilderTable->Get(&key)); - } - else - *aResult = nsnull; + if (mTemplateBuilderTable) { + nsISupportsKey key(aContent); + *aResult = NS_STATIC_CAST(nsIXULTemplateBuilder*, + mTemplateBuilderTable->Get(&key)); + } + else + *aResult = nsnull; - return NS_OK; + return NS_OK; } // Attributes that are used with getElementById() and the // resource-to-element map. -nsIAtom** nsXULDocument::kIdentityAttrs[] = { &nsXULAtoms::id, &nsXULAtoms::ref, nsnull }; +nsIAtom** nsXULDocument::kIdentityAttrs[] = +{ + &nsXULAtoms::id, + &nsXULAtoms::ref, + nsnull +}; nsresult nsXULDocument::AddElementToMap(nsIContent* aElement) @@ -4006,334 +2194,15 @@ nsXULDocument::RemoveElementsFromMapByContent(const PRUnichar* aID, // nsIDOMNode interface // -NS_IMETHODIMP -nsXULDocument::GetNodeName(nsAString& aNodeName) -{ - aNodeName.Assign(NS_LITERAL_STRING("#document")); - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::GetNodeValue(nsAString& aNodeValue) -{ - SetDOMStringToNull(aNodeValue); - - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::SetNodeValue(const nsAString& aNodeValue) -{ - return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; -} - - -NS_IMETHODIMP -nsXULDocument::GetNodeType(PRUint16* aNodeType) -{ - *aNodeType = nsIDOMNode::DOCUMENT_NODE; - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::GetParentNode(nsIDOMNode** aParentNode) -{ - *aParentNode = nsnull; - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::GetChildNodes(nsIDOMNodeList** aChildNodes) -{ - NS_PRECONDITION(aChildNodes != nsnull, "null ptr"); - if (! aChildNodes) - return NS_ERROR_NULL_POINTER; - - if (mRootContent) { - nsresult rv; - - *aChildNodes = nsnull; - - nsRDFDOMNodeList* children; - rv = nsRDFDOMNodeList::Create(&children); - - if (NS_SUCCEEDED(rv)) { - nsCOMPtr domNode = do_QueryInterface(mRootContent); - NS_ASSERTION(domNode, "root content is not a DOM node"); - - if (domNode) { - rv = children->AppendNode(domNode); - - *aChildNodes = children; - return NS_OK; - } - } - - // If we get here, something bad happened. - NS_RELEASE(children); - return rv; - } - - *aChildNodes = nsnull; - - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::HasChildNodes(PRBool* aHasChildNodes) -{ - NS_PRECONDITION(aHasChildNodes != nsnull, "null ptr"); - if (! aHasChildNodes) - return NS_ERROR_NULL_POINTER; - - if (mRootContent) { - *aHasChildNodes = PR_TRUE; - } - else { - *aHasChildNodes = PR_FALSE; - } - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::HasAttributes(PRBool* aHasAttributes) -{ - NS_ENSURE_ARG_POINTER(aHasAttributes); - - *aHasAttributes = PR_FALSE; - - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::GetFirstChild(nsIDOMNode** aFirstChild) -{ - NS_ENSURE_ARG_POINTER(aFirstChild); - - if (mRootContent) { - return CallQueryInterface(mRootContent, aFirstChild); - } - - *aFirstChild = nsnull; - - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::GetLastChild(nsIDOMNode** aLastChild) -{ - NS_ENSURE_ARG_POINTER(aLastChild); - - if (mRootContent) { - return CallQueryInterface(mRootContent, aLastChild); - } - - *aLastChild = nsnull; - - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::GetPreviousSibling(nsIDOMNode** aPreviousSibling) -{ - NS_PRECONDITION(aPreviousSibling != nsnull, "null ptr"); - if (! aPreviousSibling) - return NS_ERROR_NULL_POINTER; - - *aPreviousSibling = nsnull; - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::GetNextSibling(nsIDOMNode** aNextSibling) -{ - NS_PRECONDITION(aNextSibling != nsnull, "null ptr"); - if (! aNextSibling) - return NS_ERROR_NULL_POINTER; - - *aNextSibling = nsnull; - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::GetAttributes(nsIDOMNamedNodeMap** aAttributes) -{ - NS_PRECONDITION(aAttributes != nsnull, "null ptr"); - if (! aAttributes) - return NS_ERROR_NULL_POINTER; - - *aAttributes = nsnull; - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) -{ - NS_PRECONDITION(aOwnerDocument != nsnull, "null ptr"); - if (! aOwnerDocument) - return NS_ERROR_NULL_POINTER; - - *aOwnerDocument = nsnull; - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::GetNamespaceURI(nsAString& aNamespaceURI) -{ - SetDOMStringToNull(aNamespaceURI); - - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::GetPrefix(nsAString& aPrefix) -{ - SetDOMStringToNull(aPrefix); - - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::SetPrefix(const nsAString& aPrefix) -{ - return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; -} - - -NS_IMETHODIMP -nsXULDocument::GetLocalName(nsAString& aLocalName) -{ - SetDOMStringToNull(aLocalName); - - return NS_OK; -} - - -NS_IMETHODIMP -nsXULDocument::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, - nsIDOMNode** aReturn) -{ - NS_NOTREACHED("nsXULDocument::InsertBefore"); - return NS_ERROR_NOT_IMPLEMENTED; -} - - -NS_IMETHODIMP -nsXULDocument::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, - nsIDOMNode** aReturn) -{ - NS_NOTREACHED("nsXULDocument::ReplaceChild"); - return NS_ERROR_NOT_IMPLEMENTED; -} - - -NS_IMETHODIMP -nsXULDocument::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) -{ - NS_NOTREACHED("nsXULDocument::RemoveChild"); - return NS_ERROR_NOT_IMPLEMENTED; -} - - -NS_IMETHODIMP -nsXULDocument::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn) -{ - NS_NOTREACHED("nsXULDocument::AppendChild"); - return NS_ERROR_NOT_IMPLEMENTED; -} - - NS_IMETHODIMP nsXULDocument::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) { // We don't allow cloning of a document *aReturn = nsnull; - return NS_OK; + return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } -NS_IMETHODIMP -nsXULDocument::Normalize() -{ - NS_NOTYETIMPLEMENTED("write me"); - return NS_ERROR_NOT_IMPLEMENTED; -} - - -NS_IMETHODIMP -nsXULDocument::IsSupported(const nsAString& aFeature, - const nsAString& aVersion, - PRBool* aReturn) -{ - NS_NOTYETIMPLEMENTED("write me"); - return NS_ERROR_NOT_IMPLEMENTED; -} - -//---------------------------------------------------------------------- -// -// nsIDOM3Node interface -// - -NS_IMETHODIMP -nsXULDocument::GetBaseURI(nsAString &aURI) -{ - aURI.Truncate(); - if (mDocumentBaseURL) { - nsCAutoString spec; - mDocumentBaseURL->GetSpec(spec); - aURI = NS_ConvertUTF8toUCS2(spec); - } - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::CompareDocumentPosition(nsIDOMNode* aOther, - PRUint16* aReturn) -{ - NS_NOTYETIMPLEMENTED("write me"); - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsXULDocument::IsSameNode(nsIDOMNode* aOther, - PRBool* aReturn) -{ - NS_NOTYETIMPLEMENTED("write me"); - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsXULDocument::LookupNamespacePrefix(const nsAString& aNamespaceURI, - nsAString& aPrefix) -{ - NS_NOTYETIMPLEMENTED("write me"); - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsXULDocument::LookupNamespaceURI(const nsAString& aNamespacePrefix, - nsAString& aNamespaceURI) -{ - NS_NOTYETIMPLEMENTED("write me"); - return NS_ERROR_NOT_IMPLEMENTED; -} - -//---------------------------------------------------------------------- // // nsIHTMLContentContainer interface // @@ -4357,16 +2226,16 @@ NS_IMETHODIMP nsXULDocument::GetInlineStyleSheet(nsIHTMLCSSStyleSheet** aResult) { NS_PRECONDITION(nsnull != aResult, "null ptr"); - if (nsnull == aResult) { + if (!aResult) { return NS_ERROR_NULL_POINTER; } *aResult = mInlineStyleSheet; if (!mInlineStyleSheet) { return NS_ERROR_NOT_AVAILABLE; // probably not the right error... } - else { - NS_ADDREF(*aResult); - } + + NS_ADDREF(*aResult); + return NS_OK; } @@ -4378,18 +2247,12 @@ nsXULDocument::GetInlineStyleSheet(nsIHTMLCSSStyleSheet** aResult) nsresult nsXULDocument::Init() { - nsresult rv; - - rv = NS_NewHeapArena(getter_AddRefs(mArena), nsnull); - if (NS_FAILED(rv)) return rv; - - mNodeInfoManager = do_CreateInstance(NS_NODEINFOMANAGER_CONTRACTID, &rv); - if (NS_FAILED(rv)) return rv; - - mNodeInfoManager->Init(this); + nsresult rv = nsXMLDocument::Init(); + NS_ENSURE_SUCCESS(rv, rv); // Create our command dispatcher and hook it up. - rv = nsXULCommandDispatcher::Create(this, getter_AddRefs(mCommandDispatcher)); + rv = nsXULCommandDispatcher::Create(this, + getter_AddRefs(mCommandDispatcher)); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create a focus tracker"); if (NS_FAILED(rv)) return rv; @@ -4402,13 +2265,6 @@ nsXULDocument::Init() rv = NS_NewISupportsArray(getter_AddRefs(mUnloadedOverlays)); if (NS_FAILED(rv)) return rv; - // Create a new nsISupportsArray that will hold owning references - // to each of the prototype documents used to construct this - // document. That will ensure that prototype elements will remain - // alive. - rv = NS_NewISupportsArray(getter_AddRefs(mPrototypes)); - if (NS_FAILED(rv)) return rv; - if (gRefCnt++ == 0) { // Keep the RDF service cached in a member variable to make using // it a bit less painful @@ -4447,7 +2303,7 @@ nsXULDocument::Init() nsresult nsXULDocument::StartLayout(void) { - if (! mRootContent) { + if (!mRootContent) { #ifdef PR_LOGGING nsCAutoString urlspec; mDocumentURL->GetSpec(urlspec); @@ -4459,62 +2315,65 @@ nsXULDocument::StartLayout(void) } PRInt32 count = GetNumberOfShells(); - for (PRInt32 i = 0; i < count; i++) { - nsCOMPtr shell; - GetShellAt(i, getter_AddRefs(shell)); - if (nsnull == shell) - continue; + for (PRInt32 i = 0; i < count; ++i) { + nsCOMPtr shell; + GetShellAt(i, getter_AddRefs(shell)); + if (nsnull == shell) + continue; - // Resize-reflow this time - nsCOMPtr cx; - shell->GetPresContext(getter_AddRefs(cx)); - NS_ASSERTION(cx != nsnull, "no pres context"); - if (! cx) - return NS_ERROR_UNEXPECTED; + // Resize-reflow this time + nsCOMPtr cx; + shell->GetPresContext(getter_AddRefs(cx)); + NS_ASSERTION(cx != nsnull, "no pres context"); + if (! cx) + return NS_ERROR_UNEXPECTED; + nsCOMPtr container; + cx->GetContainer(getter_AddRefs(container)); + NS_ASSERTION(container != nsnull, "pres context has no container"); + if (! container) + return NS_ERROR_UNEXPECTED; - nsCOMPtr container; - cx->GetContainer(getter_AddRefs(container)); - NS_ASSERTION(container != nsnull, "pres context has no container"); - if (! container) - return NS_ERROR_UNEXPECTED; + nsCOMPtr docShell(do_QueryInterface(container)); + NS_ASSERTION(docShell != nsnull, "container is not a docshell"); + if (! docShell) + return NS_ERROR_UNEXPECTED; - nsCOMPtr docShell(do_QueryInterface(container)); - NS_ASSERTION(docShell != nsnull, "container is not a docshell"); - if (! docShell) - return NS_ERROR_UNEXPECTED; + nsRect r; + cx->GetVisibleArea(r); - nsRect r; - cx->GetVisibleArea(r); - - // Trigger a refresh before the call to InitialReflow(), because - // the view manager's UpdateView() function is dropping dirty rects if - // refresh is disabled rather than accumulating them until refresh is - // enabled and then triggering a repaint... - nsCOMPtr vm; - shell->GetViewManager(getter_AddRefs(vm)); - if (vm) { - nsCOMPtr contentViewer; - nsresult rv = docShell->GetContentViewer(getter_AddRefs(contentViewer)); - if (NS_SUCCEEDED(rv) && (contentViewer != nsnull)) { - PRBool enabled; - contentViewer->GetEnableRendering(&enabled); - if (enabled) { - vm->EnableRefresh(NS_VMREFRESH_IMMEDIATE); - } + // Trigger a refresh before the call to InitialReflow(), + // because the view manager's UpdateView() function is + // dropping dirty rects if refresh is disabled rather than + // accumulating them until refresh is enabled and then + // triggering a repaint... + nsCOMPtr vm; + shell->GetViewManager(getter_AddRefs(vm)); + if (vm) { + nsCOMPtr contentViewer; + nsresult rv = docShell->GetContentViewer(getter_AddRefs(contentViewer)); + if (NS_SUCCEEDED(rv) && (contentViewer != nsnull)) { + PRBool enabled; + contentViewer->GetEnableRendering(&enabled); + if (enabled) { + vm->EnableRefresh(NS_VMREFRESH_IMMEDIATE); + } + } } - } - shell->InitialReflow(r.width, r.height); - FlushPendingNotifications(); // This is done because iframes don't load their subdocs until - // they get reflowed. If we reflow asynchronously, our onload - // will fire too early. -- hyatt + shell->InitialReflow(r.width, r.height); - // Start observing the document _after_ we do the initial - // reflow. Otherwise, we'll get into an trouble trying to - // create kids before the root frame is established. - shell->BeginObservingDocument(); + // This is done because iframes don't load their subdocs until + // they get reflowed. If we reflow asynchronously, our onload + // will fire too early. -- hyatt + FlushPendingNotifications(); + + // Start observing the document _after_ we do the initial + // reflow. Otherwise, we'll get into an trouble trying to + // create kids before the root frame is established. + shell->BeginObservingDocument(); } + return NS_OK; } @@ -4538,7 +2397,8 @@ nsXULDocument::GetElementsByAttribute(nsIDOMNode* aNode, return rv; } - if ((attrValue.Equals(aValue)) || (!attrValue.IsEmpty() && aValue.Equals(NS_LITERAL_STRING("*")))) { + if ((attrValue.Equals(aValue)) || + (!attrValue.IsEmpty() && aValue.Equals(NS_LITERAL_STRING("*")))) { if (NS_FAILED(rv = aElements->AppendNode(aNode))) { NS_ERROR("unable to append element to node list"); return rv; @@ -4568,7 +2428,8 @@ nsXULDocument::GetElementsByAttribute(nsIDOMNode* aNode, return rv; } - if (NS_FAILED(rv = GetElementsByAttribute(child, aAttribute, aValue, aElements))) { + if (NS_FAILED(rv = GetElementsByAttribute(child, aAttribute, aValue, + aElements))) { NS_ERROR("unable to recursively get elements by attribute"); return rv; } @@ -4578,206 +2439,6 @@ nsXULDocument::GetElementsByAttribute(nsIDOMNode* aNode, } - -nsresult -nsXULDocument::ParseTagString(const nsAString& aTagName, nsIAtom*& aName, - nsIAtom*& aPrefix) -{ - // Parse the tag into a name and prefix - - static char kNameSpaceSeparator = ':'; - - nsAutoString prefix; - nsAutoString name(aTagName); - PRInt32 nsoffset = name.FindChar(kNameSpaceSeparator); - if (-1 != nsoffset) { - name.Left(prefix, nsoffset); - name.Cut(0, nsoffset+1); - } - - if (!prefix.IsEmpty()) - aPrefix = NS_NewAtom(prefix); - - aName = NS_NewAtom(name); - - return NS_OK; -} - - -// nsIDOMEventReceiver Interface Implementations - -NS_IMETHODIMP -nsXULDocument::AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID) -{ - nsIEventListenerManager *manager; - - if (NS_OK == GetListenerManager(&manager)) { - manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); - NS_RELEASE(manager); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP -nsXULDocument::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID) -{ - if (mListenerManager) { - mListenerManager->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP -nsXULDocument::AddEventListener(const nsAString& aType, - nsIDOMEventListener* aListener, - PRBool aUseCapture) -{ - return AddGroupedEventListener(aType, aListener, aUseCapture, nsnull); -} - -NS_IMETHODIMP -nsXULDocument::RemoveEventListener(const nsAString& aType, - nsIDOMEventListener* aListener, - PRBool aUseCapture) -{ - return RemoveGroupedEventListener(aType, aListener, aUseCapture, nsnull); -} - -NS_IMETHODIMP -nsXULDocument::DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval) -{ - // Obtain a presentation context - PRInt32 count = GetNumberOfShells(); - if (count == 0) - return NS_OK; - - nsCOMPtr shell; - GetShellAt(0, getter_AddRefs(shell)); - - if (shell) { - // Retrieve the context - nsCOMPtr presContext; - shell->GetPresContext(getter_AddRefs(presContext)); - - nsCOMPtr esm; - if (presContext && - NS_SUCCEEDED(presContext->GetEventStateManager(getter_AddRefs(esm)))) { - return esm->DispatchNewEvent(NS_STATIC_CAST(nsIDocument*, this), aEvent, _retval); - } - } - - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP -nsXULDocument::AddGroupedEventListener(const nsAString & aType, nsIDOMEventListener *aListener, - PRBool aUseCapture, nsIDOMEventGroup *aEvtGrp) -{ - nsCOMPtr manager; - - nsresult rv = GetListenerManager(getter_AddRefs(manager)); - if (NS_SUCCEEDED(rv) && manager) { - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - manager->AddEventListenerByType(aListener, aType, flags, aEvtGrp); - return NS_OK; - } - return rv; -} - -NS_IMETHODIMP -nsXULDocument::RemoveGroupedEventListener(const nsAString & aType, nsIDOMEventListener *aListener, - PRBool aUseCapture, nsIDOMEventGroup *aEvtGrp) -{ - if (mListenerManager) { - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - mListenerManager->RemoveEventListenerByType(aListener, aType, flags, aEvtGrp); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP -nsXULDocument::CanTrigger(const nsAString & type, PRBool *_retval) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsXULDocument::IsRegisteredHere(const nsAString & type, PRBool *_retval) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsXULDocument::CreateEvent(const nsAString& aEventType, - nsIDOMEvent** aReturn) -{ - // Obtain a presentation context - PRInt32 count = GetNumberOfShells(); - if (count == 0) - return NS_OK; - - nsCOMPtr shell; - GetShellAt(0, getter_AddRefs(shell)); - - if (shell) { - // Retrieve the context - nsCOMPtr presContext; - shell->GetPresContext(getter_AddRefs(presContext)); - - if (presContext) { - nsCOMPtr lm; - if (NS_SUCCEEDED(GetListenerManager(getter_AddRefs(lm)))) { - return lm->CreateEvent(presContext, nsnull, aEventType, aReturn); - } - } - } - - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP -nsXULDocument::CreateEventGroup(nsIDOMEventGroup **_retval) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsXULDocument::GetListenerManager(nsIEventListenerManager** aResult) -{ - if (!mListenerManager) { - nsresult rv; - mListenerManager = do_CreateInstance(kEventListenerManagerCID, &rv); - if (NS_FAILED(rv)) return rv; - - mListenerManager->SetListenerTarget(NS_STATIC_CAST(nsIDocument*,this)); - } - *aResult = mListenerManager; - NS_ADDREF(*aResult); - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::HandleEvent(nsIDOMEvent *aEvent) -{ - PRBool noDefault; - return DispatchEvent(aEvent, &noDefault); -} - -NS_IMETHODIMP -nsXULDocument::GetSystemEventGroup(nsIDOMEventGroup **aGroup) -{ - nsCOMPtr manager; - if (NS_SUCCEEDED(GetListenerManager(getter_AddRefs(manager))) && manager) { - return manager->GetSystemEventGroupLM(aGroup); - } - return NS_ERROR_FAILURE; -} - nsresult nsXULDocument::CreateElement(nsINodeInfo *aNodeInfo, nsIContent** aResult) { @@ -4858,8 +2519,8 @@ nsXULDocument::PrepareToLoadPrototype(nsIURI* aURI, const char* aCommand, // Create a XUL content sink, a parser, and kick off a load for // the overlay. - nsCOMPtr sink = do_CreateInstance(kXULContentSinkCID, - &rv); + nsCOMPtr sink; + rv = NS_NewXULContentSink(getter_AddRefs(sink)); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create XUL content sink"); if (NS_FAILED(rv)) return rv; @@ -4872,7 +2533,7 @@ nsXULDocument::PrepareToLoadPrototype(nsIURI* aURI, const char* aCommand, if (NS_FAILED(rv)) return rv; parser->SetCommand(nsCRT::strcmp(aCommand, "view-source") ? eViewNormal : - eViewSource); + eViewSource); parser->SetDocumentCharset(NS_LITERAL_STRING("UTF-8"), kCharsetFromDocTypeDefault); @@ -4949,7 +2610,8 @@ nsXULDocument::ApplyPersistentAttributes() nsresult -nsXULDocument::ApplyPersistentAttributesToElements(nsIRDFResource* aResource, nsISupportsArray* aElements) +nsXULDocument::ApplyPersistentAttributesToElements(nsIRDFResource* aResource, + nsISupportsArray* aElements) { nsresult rv; @@ -4986,7 +2648,8 @@ nsXULDocument::ApplyPersistentAttributesToElements(nsIRDFResource* aResource, ns // XXX could hang namespace off here, as well... nsCOMPtr node; - rv = mLocalStore->GetTarget(aResource, property, PR_TRUE, getter_AddRefs(node)); + rv = mLocalStore->GetTarget(aResource, property, PR_TRUE, + getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; nsCOMPtr literal = do_QueryInterface(node); @@ -5045,7 +2708,8 @@ nsXULDocument::ContextStack::~ContextStack() } nsresult -nsXULDocument::ContextStack::Push(nsXULPrototypeElement* aPrototype, nsIContent* aElement) +nsXULDocument::ContextStack::Push(nsXULPrototypeElement* aPrototype, + nsIContent* aElement) { Entry* entry = new Entry; if (! entry) @@ -5144,7 +2808,7 @@ nsXULDocument::PrepareToWalk() // Keep an owning reference to the prototype document so that its // elements aren't yanked from beneath us. - mPrototypes->AppendElement(mCurrentPrototype); + mPrototypes.AppendObject(mCurrentPrototype); // Push the overlay references onto our overlay processing // stack. GetOverlayReferences() will return an ordered array of @@ -5280,7 +2944,7 @@ nsXULDocument::AddChromeOverlays() reg->IsOverlayAllowed(uri, &allowed); if (allowed) mUnloadedOverlays->AppendElement(uri); - + oe->HasMoreElements(&moreElements); } @@ -5421,11 +3085,12 @@ nsXULDocument::ResumeWalk() // overlay, and far enough down into the overlay's // content that we can simply build the delegates // and attach them to the parent node. - NS_ASSERTION(element != nsnull, "no element on context stack"); + NS_ASSERTION(element, "no element on context stack"); + + nsCOMPtr text; + rv = NS_NewTextNode(getter_AddRefs(text)); + NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr text = - do_CreateInstance(kTextNodeCID, &rv); - if (NS_FAILED(rv)) return rv; nsXULPrototypeText* textproto = NS_REINTERPRET_CAST(nsXULPrototypeText*, childproto); rv = text->SetText(textproto->mValue.get(), @@ -5443,7 +3108,7 @@ nsXULDocument::ResumeWalk() } } break; - } + } } // Once we get here, the context stack will have been @@ -5479,7 +3144,7 @@ nsXULDocument::ResumeWalk() if (IsChromeURI(uri)) gXULCache->GetPrototype(uri, getter_AddRefs(mCurrentPrototype)); - // Same comment as nsChromeProtocolHandler::NewChannel and + // Same comment as nsChromeProtocolHandler::NewChannel and // nsXULDocument::StartDocumentLoad // - Ben Goodger // @@ -5488,13 +3153,13 @@ nsXULDocument::ResumeWalk() // to trigger the fail-safe parse-from-disk solution. Example failure cases // (for reference) include: // - // NS_ERROR_NOT_AVAILABLE: the URI cannot be found in the FastLoad cache, + // NS_ERROR_NOT_AVAILABLE: the URI cannot be found in the FastLoad cache, // parse from disk // other: the FastLoad cache file, XUL.mfl, could not be found, probably // due to being accessed before a profile has been selected (e.g. - // loading chrome for the profile manager itself). This must be - // parsed from disk. - + // loading chrome for the profile manager itself). This must be + // parsed from disk. + PRBool cache; gXULCache->GetEnabled(&cache); @@ -5605,7 +3270,7 @@ nsXULDocument::ResumeWalk() mPlaceHolderRequest = nsnull; } } - + return rv; } @@ -5771,7 +3436,7 @@ nsXULDocument::OnStreamComplete(nsIStreamLoader* aLoader, // If the XUL cache is enabled, save the script object there in // case different XUL documents source the same script. - // + // // But don't save the script in the cache unless the master XUL // document URL is a chrome: URL. It is valid for a URL such as // about:config to translate into a master document URL, whose @@ -5941,7 +3606,8 @@ nsXULDocument::CreateElement(nsXULPrototypeElement* aPrototype, nsIContent** aRe } nsresult -nsXULDocument::CreateOverlayElement(nsXULPrototypeElement* aPrototype, nsIContent** aResult) +nsXULDocument::CreateOverlayElement(nsXULPrototypeElement* aPrototype, + nsIContent** aResult) { nsresult rv; @@ -5949,10 +3615,12 @@ nsXULDocument::CreateOverlayElement(nsXULPrototypeElement* aPrototype, nsIConten // element. I'd use an XML element, but it gets its knickers in a // knot with DOM ranges when you try to remove its children. nsCOMPtr element; - rv = nsXULElement::Create(aPrototype, this, PR_FALSE, getter_AddRefs(element)); + rv = nsXULElement::Create(aPrototype, this, PR_FALSE, + getter_AddRefs(element)); if (NS_FAILED(rv)) return rv; - - OverlayForwardReference* fwdref = new OverlayForwardReference(this, element); + + OverlayForwardReference* fwdref = + new OverlayForwardReference(this, element); if (! fwdref) return NS_ERROR_OUT_OF_MEMORY; @@ -5966,7 +3634,8 @@ nsXULDocument::CreateOverlayElement(nsXULPrototypeElement* aPrototype, nsIConten } nsresult -nsXULDocument::AddAttributes(nsXULPrototypeElement* aPrototype, nsIContent* aElement) +nsXULDocument::AddAttributes(nsXULPrototypeElement* aPrototype, + nsIContent* aElement) { nsresult rv; @@ -6006,7 +3675,8 @@ nsXULDocument::CheckTemplateBuilder(nsIContent* aElement) } nsAutoString datasources; - rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::datasources, datasources); + rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::datasources, + datasources); if (NS_FAILED(rv)) return rv; if (rv != NS_CONTENT_ATTR_HAS_VALUE) @@ -6294,7 +3964,7 @@ nsXULDocument::OverlayForwardReference::Merge(nsIContent* aTargetNode, rv = aOverlayNode->ChildCount(childCount); if (NS_FAILED(rv)) return rv; - for (i = 0; i < childCount; i++) { + for (i = 0; i < childCount; ++i) { nsCOMPtr currContent; rv = aOverlayNode->ChildAt(0, *getter_AddRefs(currContent)); if (NS_FAILED(rv)) return rv; @@ -6608,7 +4278,8 @@ nsXULDocument::InsertElement(nsIContent* aParent, nsIContent* aChild) PRBool isInsertAfter = PR_TRUE; if (rv != NS_CONTENT_ATTR_HAS_VALUE) { - rv = aChild->GetAttr(kNameSpaceID_None, nsXULAtoms::insertbefore, posStr); + rv = aChild->GetAttr(kNameSpaceID_None, nsXULAtoms::insertbefore, + posStr); if (NS_FAILED(rv)) return rv; isInsertAfter = PR_FALSE; } @@ -6618,7 +4289,7 @@ nsXULDocument::InsertElement(nsIContent* aParent, nsIContent* aChild) rv = aParent->GetDocument(*getter_AddRefs(document)); if (NS_FAILED(rv)) return rv; - nsCOMPtr xulDocument(do_QueryInterface(document)); + nsCOMPtr domDocument(do_QueryInterface(document)); nsCOMPtr domElement; char* str = ToNewCString(posStr); @@ -6626,13 +4297,16 @@ nsXULDocument::InsertElement(nsIContent* aParent, nsIContent* aChild) char* token = nsCRT::strtok(str, ", ", &rest); while (token) { - rv = xulDocument->GetElementById(NS_ConvertASCIItoUCS2(token), getter_AddRefs(domElement)); - if (domElement) break; + rv = domDocument->GetElementById(NS_ConvertASCIItoUCS2(token), + getter_AddRefs(domElement)); + if (domElement) + break; token = nsCRT::strtok(rest, ", ", &rest); } nsMemory::Free(str); - if (NS_FAILED(rv)) return rv; + if (NS_FAILED(rv)) + return rv; if (domElement) { nsCOMPtr content(do_QueryInterface(domElement)); @@ -6646,7 +4320,8 @@ nsXULDocument::InsertElement(nsIContent* aParent, nsIContent* aChild) if (pos != -1) { pos = isInsertAfter ? pos + 1 : pos; rv = aParent->InsertChildAt(aChild, pos, PR_FALSE, PR_TRUE); - if (NS_FAILED(rv)) return rv; + if (NS_FAILED(rv)) + return rv; wasInserted = PR_TRUE; } @@ -6662,12 +4337,14 @@ nsXULDocument::InsertElement(nsIContent* aParent, nsIContent* aChild) // Positions are one-indexed. PRInt32 pos = posStr.ToInteger(NS_REINTERPRET_CAST(PRInt32*, &rv)); if (NS_SUCCEEDED(rv)) { - rv = aParent->InsertChildAt(aChild, pos - 1, PR_FALSE, PR_TRUE); + rv = aParent->InsertChildAt(aChild, pos - 1, PR_FALSE, + PR_TRUE); if (NS_SUCCEEDED(rv)) wasInserted = PR_TRUE; - // If the insertion fails, then we should still attempt an append. - // Thus, rather than returning rv immediately, we fall through - // to the final "catch-all" case that just does an AppendChildTo. + // If the insertion fails, then we should still + // attempt an append. Thus, rather than returning rv + // immediately, we fall through to the final + // "catch-all" case that just does an AppendChildTo. } } } @@ -6694,7 +4371,7 @@ nsXULDocument::RemoveElement(nsIContent* aParent, nsIContent* aChild) return NS_OK; } -void +void nsXULDocument::GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory** aResult) { @@ -6709,101 +4386,6 @@ nsXULDocument::GetElementFactory(PRInt32 aNameSpaceID, } } -NS_IMETHODIMP -nsXULDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult) -{ - nsresult rv; - - *aResult = nsnull; - - if (!mBoxObjectTable) - mBoxObjectTable = new nsSupportsHashtable; - else { - nsISupportsKey key(aElement); - nsCOMPtr supports = - getter_AddRefs(NS_STATIC_CAST(nsISupports*, mBoxObjectTable->Get(&key))); - nsCOMPtr boxObject(do_QueryInterface(supports)); - if (boxObject) { - *aResult = boxObject; - NS_ADDREF(*aResult); - return NS_OK; - } - } - - nsCOMPtr shell; - GetShellAt(0, getter_AddRefs(shell)); - if (!shell) - return NS_ERROR_FAILURE; - - PRInt32 namespaceID; - nsCOMPtr tag; - nsCOMPtr xblService = - do_GetService("@mozilla.org/xbl;1", &rv); - nsCOMPtr content(do_QueryInterface(aElement)); - xblService->ResolveTag(content, &namespaceID, getter_AddRefs(tag)); - - nsCAutoString contractID("@mozilla.org/layout/xul-boxobject"); - if (namespaceID == kNameSpaceID_XUL) { - if (tag.get() == nsXULAtoms::browser) - contractID += "-browser"; - else if (tag.get() == nsXULAtoms::editor) - contractID += "-editor"; - else if (tag.get() == nsXULAtoms::iframe) - contractID += "-iframe"; - else if (tag.get() == nsXULAtoms::menu) - contractID += "-menu"; - else if (tag.get() == nsXULAtoms::popup || tag.get() == nsXULAtoms::menupopup || - tag.get() == nsXULAtoms::tooltip) - contractID += "-popup"; - else if (tag.get() == nsXULAtoms::tree) - contractID += "-tree"; - else if (tag.get() == nsXULAtoms::listbox) - contractID += "-listbox"; - else if (tag.get() == nsXULAtoms::scrollbox) - contractID += "-scrollbox"; - } - contractID += ";1"; - - nsCOMPtr boxObject(do_CreateInstance(contractID.get())); - if (!boxObject) - return NS_ERROR_FAILURE; - - nsCOMPtr privateBox(do_QueryInterface(boxObject)); - if (NS_FAILED(rv = privateBox->Init(content, shell))) - return rv; - - SetBoxObjectFor(aElement, boxObject); - - *aResult = boxObject; - NS_ADDREF(*aResult); - - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::SetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject* aBoxObject) -{ - if (!mBoxObjectTable) { - if (!aBoxObject) - return NS_OK; - mBoxObjectTable = new nsSupportsHashtable; - } - - nsISupportsKey key(aElement); - - if (aBoxObject) - mBoxObjectTable->Put(&key, aBoxObject); - else { - nsCOMPtr supp; - mBoxObjectTable->Remove(&key, getter_AddRefs(supp)); - nsCOMPtr boxObject(do_QueryInterface(supp)); - if (boxObject) - boxObject->SetDocument(nsnull); - } - - return NS_OK; -} - //---------------------------------------------------------------------- // // CachedChromeStreamListener @@ -6823,10 +4405,12 @@ nsXULDocument::CachedChromeStreamListener::~CachedChromeStreamListener() } -NS_IMPL_ISUPPORTS2(nsXULDocument::CachedChromeStreamListener, nsIRequestObserver, nsIStreamListener); +NS_IMPL_ISUPPORTS2(nsXULDocument::CachedChromeStreamListener, + nsIRequestObserver, nsIStreamListener); NS_IMETHODIMP -nsXULDocument::CachedChromeStreamListener::OnStartRequest(nsIRequest *request, nsISupports* acontext) +nsXULDocument::CachedChromeStreamListener::OnStartRequest(nsIRequest *request, + nsISupports* acontext) { return NS_OK; } @@ -6932,31 +4516,6 @@ nsXULDocument::GetFocusController(nsIFocusController** aFocusController) *aFocusController = nsnull; } -/** - * Retrieve and get bidi state of the document - * set depending on presence of bidi data. - * (see nsIDocument.h) - */ - -NS_IMETHODIMP -nsXULDocument::GetBidiEnabled(PRBool* aBidiEnabled) const -{ - NS_ENSURE_ARG_POINTER(aBidiEnabled); - *aBidiEnabled = mBidiEnabled; - return NS_OK; -} - -NS_IMETHODIMP -nsXULDocument::SetBidiEnabled(PRBool aBidiEnabled) -{ - NS_ASSERTION(aBidiEnabled, "cannot disable bidi once enabled"); - if (aBidiEnabled) { - mBidiEnabled = PR_TRUE; - } - return NS_OK; -} - - //---------------------------------------------------------------------- // // The XUL element factory diff --git a/content/xul/document/src/nsXULDocument.h b/content/xul/document/src/nsXULDocument.h index d79638e94d2..20950b43ffc 100644 --- a/content/xul/document/src/nsXULDocument.h +++ b/content/xul/document/src/nsXULDocument.h @@ -42,61 +42,22 @@ #define nsXULDocument_h__ #include "nsCOMPtr.h" +#include "nsXMLDocument.h" #include "nsElementMap.h" #include "nsForwardReference.h" -#include "nsIArena.h" -#include "nsICSSLoader.h" #include "nsIContent.h" #include "nsIDOMEventReceiver.h" -#include "nsIDOM3EventTarget.h" -#include "nsIDOMNSDocument.h" -#include "nsIDOMDocumentStyle.h" -#include "nsIDOMDocumentView.h" -#include "nsIDOMDocumentXBL.h" -#include "nsIDOMDocumentRange.h" -#include "nsIDOMDocumentTraversal.h" -#include "nsIDOMStyleSheetList.h" -#include "nsISelection.h" #include "nsIDOMXULCommandDispatcher.h" #include "nsIDOMXULDocument.h" -#include "nsIDocument.h" -#include "nsIEventListenerManager.h" -#include "nsIHTMLCSSStyleSheet.h" -#include "nsIHTMLContentContainer.h" -#include "nsIHTMLStyleSheet.h" -#include "nsILineBreakerFactory.h" -#include "nsIParser.h" -#include "nsIPrincipal.h" -#include "nsIRDFDataSource.h" -#include "nsIScriptGlobalObject.h" -#include "nsIScriptSecurityManager.h" #include "nsISupportsArray.h" #include "nsCOMArray.h" #include "nsIURI.h" -#include "nsIWordBreakerFactory.h" #include "nsIXULDocument.h" #include "nsIXULPrototypeDocument.h" -#include "nsRDFDOMNodeList.h" -#include "nsTime.h" -#include "nsVoidArray.h" -#include "nsWeakPtr.h" -#include "nsWeakReference.h" -#include "nsIStreamLoader.h" -#include "nsIBindingManager.h" -#include "nsINodeInfo.h" -#include "nsIDOMDocumentEvent.h" -#include "nsIDOM3DocumentEvent.h" #include "nsScriptLoader.h" -#include "pldhash.h" -class nsIAtom; -class nsIElementFactory; -class nsIFile; -class nsILoadGroup; class nsIRDFResource; class nsIRDFService; -class nsITimer; -class nsIXULContentUtils; class nsIXULPrototypeCache; class nsIFocusController; #if 0 // XXXbe save me, scc (need NSCAP_FORWARD_DECL(nsXULPrototypeScript)) @@ -117,35 +78,20 @@ struct PRLogModuleInfo; /** * The XUL document class */ -class nsXULDocument : public nsIDocument, +class nsXULDocument : public nsXMLDocument, public nsIXULDocument, public nsIDOMXULDocument, - public nsIDOMDocumentEvent, - public nsIDOM3DocumentEvent, - public nsIDOMDocumentView, - public nsIDOMDocumentXBL, - public nsIDOMDocumentRange, - public nsIDOMDocumentTraversal, - public nsIDOMNSDocument, - public nsIDOM3Node, - public nsIDOMDocumentStyle, - public nsIDOMEventReceiver, - public nsIDOM3EventTarget, - public nsIHTMLContentContainer, - public nsIStreamLoaderObserver, - public nsSupportsWeakReference + public nsIStreamLoaderObserver { public: nsXULDocument(); virtual ~nsXULDocument(); // nsISupports interface - NS_DECL_ISUPPORTS + NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSISTREAMLOADEROBSERVER // nsIDocument interface - NS_IMETHOD GetArena(nsIArena** aArena); - NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup); NS_IMETHOD ResetToURI(nsIURI *aURI, nsILoadGroup* aLoadGroup); @@ -157,144 +103,14 @@ public: PRBool aReset = PR_TRUE, nsIContentSink* aSink = nsnull); - NS_IMETHOD StopDocumentLoad(); - - virtual const nsString* GetDocumentTitle() const; - - NS_IMETHOD GetDocumentURL(nsIURI** aURI) const; - NS_IMETHOD GetPrincipal(nsIPrincipal **aPrincipal); NS_IMETHOD AddPrincipal(nsIPrincipal *aPrincipal); - NS_IMETHOD GetDocumentLoadGroup(nsILoadGroup **aGroup) const; - - NS_IMETHOD GetBaseURL(nsIURI*& aURL) const; - - NS_IMETHOD SetBaseURL(nsIURI *aURI); - - NS_IMETHOD GetBaseTarget(nsAString &aBaseTarget); - - NS_IMETHOD SetBaseTarget(const nsAString &aBaseTarget); - - NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets); - - NS_IMETHOD GetDocumentCharacterSet(nsAString& oCharSetID); - - NS_IMETHOD SetDocumentCharacterSet(const nsAString& aCharSetID); - - NS_IMETHOD GetDocumentCharacterSetSource(PRInt32* aCharsetSource); - - NS_IMETHOD SetDocumentCharacterSetSource(PRInt32 aCharsetSource); - - // NS_IMETHOD GetContentType(nsAString& aContentType); - // Already declared in nsIDOMNSDocument - NS_IMETHOD SetContentType(const nsAString& aContentType); - NS_IMETHOD GetContentLanguage(nsAString& aContentLanguage) const; - - /** - * Retrieve and get bidi state of the document - * (set depending on presence of bidi data). - */ - NS_IMETHOD GetBidiEnabled(PRBool* aBidiEnabled) const; - NS_IMETHOD SetBidiEnabled(PRBool aBidiEnabled); - - NS_IMETHOD AddCharSetObserver(nsIObserver* aObserver); - NS_IMETHOD RemoveCharSetObserver(nsIObserver* aObserver); - - NS_IMETHOD GetLineBreaker(nsILineBreaker** aResult) ; - NS_IMETHOD SetLineBreaker(nsILineBreaker* aLineBreaker) ; - NS_IMETHOD GetWordBreaker(nsIWordBreaker** aResult) ; - NS_IMETHOD SetWordBreaker(nsIWordBreaker* aWordBreaker) ; - - NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, - nsAString& aData) const; - NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, - const nsAString& aData); - - NS_IMETHOD CreateShell(nsIPresContext* aContext, - nsIViewManager* aViewManager, - nsIStyleSet* aStyleSet, - nsIPresShell** aInstancePtrResult); - - virtual PRBool DeleteShell(nsIPresShell* aShell); - - virtual PRInt32 GetNumberOfShells(); - - NS_IMETHOD GetShellAt(PRInt32 aIndex, nsIPresShell** aShell); - - NS_IMETHOD GetParentDocument(nsIDocument** aParent); - - NS_IMETHOD SetParentDocument(nsIDocument* aParent); - - NS_IMETHOD SetSubDocumentFor(nsIContent *aContent, nsIDocument* aSubDoc); - - NS_IMETHOD GetSubDocumentFor(nsIContent *aContent, nsIDocument** aSubDoc); - - NS_IMETHOD FindContentForSubDocument(nsIDocument *aDocument, - nsIContent **aContent); - - NS_IMETHOD GetRootContent(nsIContent** aRoot); - - NS_IMETHOD SetRootContent(nsIContent* aRoot); - - NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const; - NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aIndex) const; - NS_IMETHOD GetChildCount(PRInt32& aCount); - - NS_IMETHOD GetNumberOfStyleSheets(PRBool aIncludeSpecialSheets, - PRInt32* aCount); - NS_IMETHOD GetStyleSheetAt(PRInt32 aIndex, PRBool aIncludeSpecialSheets, - nsIStyleSheet** aSheet); - NS_IMETHOD GetIndexOfStyleSheet(nsIStyleSheet* aSheet, PRInt32* aIndex); - - virtual void AddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags); - virtual void RemoveStyleSheet(nsIStyleSheet* aSheet); - NS_IMETHOD UpdateStyleSheets(nsCOMArray& aOldSheets, - nsCOMArray& aNewSheets); - void AddStyleSheetToStyleSets(nsIStyleSheet* aSheet); - void RemoveStyleSheetFromStyleSets(nsIStyleSheet* aSheet); - - NS_IMETHOD InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex); - - virtual void SetStyleSheetApplicableState(nsIStyleSheet* aSheet, - PRBool aApplicable); - - NS_IMETHOD GetCSSLoader(nsICSSLoader*& aLoader); - - NS_IMETHOD GetScriptGlobalObject(nsIScriptGlobalObject** aScriptGlobalObject); - - NS_IMETHOD SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject); - - NS_IMETHOD GetScriptLoader(nsIScriptLoader** aScriptLoader); - - virtual void AddObserver(nsIDocumentObserver* aObserver); - - virtual PRBool RemoveObserver(nsIDocumentObserver* aObserver); - - NS_IMETHOD BeginUpdate(); - - NS_IMETHOD EndUpdate(); - - NS_IMETHOD BeginLoad(); - NS_IMETHOD EndLoad(); - NS_IMETHOD ContentChanged(nsIContent* aContent, - nsISupports* aSubContent); - - NS_IMETHOD ContentStatesChanged(nsIContent* aContent1, - nsIContent* aContent2, - PRInt32 aStateMask); - - NS_IMETHOD AttributeChanged(nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint); - NS_IMETHOD ContentAppended(nsIContent* aContainer, PRInt32 aNewIndexInContainer); @@ -310,54 +126,19 @@ public: NS_IMETHOD ContentRemoved(nsIContent* aContainer, nsIContent* aChild, PRInt32 aIndexInContainer); - NS_IMETHOD AttributeWillChange(nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute); - NS_IMETHOD StyleRuleChanged(nsIStyleSheet* aStyleSheet, - nsIStyleRule* aStyleRule, + NS_IMETHOD AttributeChanged(nsIContent* aElement, PRInt32 aNameSpaceID, + nsIAtom* aAttribute, PRInt32 aModType, nsChangeHint aHint); - NS_IMETHOD StyleRuleAdded(nsIStyleSheet* aStyleSheet, - nsIStyleRule* aStyleRule); - - NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet, - nsIStyleRule* aStyleRule); - - NS_IMETHOD GetSelection(nsISelection** aSelection); - - NS_IMETHOD SelectAll(); - - NS_IMETHOD FindNext(const nsAString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound); - - NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows = PR_TRUE, PRBool aUpdateViews = PR_FALSE); - - NS_IMETHOD GetAndIncrementContentID(PRInt32* aID); - - NS_IMETHOD GetBindingManager(nsIBindingManager** aResult); - - NS_IMETHOD GetNodeInfoManager(class nsINodeInfoManager *&aNodeInfoManager); - - NS_IMETHOD AddReference(void *aKey, nsISupports *aReference); - NS_IMETHOD RemoveReference(void *aKey, nsISupports **aOldReference); - NS_IMETHOD SetContainer(nsISupports *aContainer); - NS_IMETHOD GetContainer(nsISupports **aContainer); - NS_IMETHOD GetScriptEventManager(nsIScriptEventManager **aResult); - - virtual void SetDisplaySelection(PRInt8 aToggle); - - virtual PRInt8 GetDisplaySelection() const; - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, PRUint32 aFlags, nsEventStatus* aEventStatus); - NS_IMETHOD_(PRBool) EventCaptureRegistration(PRInt32 aCapturerIncrement); // nsIXMLDocument interface NS_IMETHOD SetDefaultStylesheets(nsIURI* aUrl); - NS_IMETHOD SetTitle(const PRUnichar *aTitle); NS_IMETHOD SetXMLDeclaration(const nsAString& aVersion, const nsAString& aEncoding, const nsAString& Standalone); @@ -368,66 +149,37 @@ public: // nsIXULDocument interface NS_IMETHOD AddElementForID(const nsAString& aID, nsIContent* aElement); NS_IMETHOD RemoveElementForID(const nsAString& aID, nsIContent* aElement); - NS_IMETHOD GetElementsForID(const nsAString& aID, nsISupportsArray* aElements); + NS_IMETHOD GetElementsForID(const nsAString& aID, + nsISupportsArray* aElements); NS_IMETHOD AddForwardReference(nsForwardReference* aRef); NS_IMETHOD ResolveForwardReferences(); NS_IMETHOD SetMasterPrototype(nsIXULPrototypeDocument* aDocument); NS_IMETHOD GetMasterPrototype(nsIXULPrototypeDocument** aDocument); NS_IMETHOD SetCurrentPrototype(nsIXULPrototypeDocument* aDocument); - NS_IMETHOD SetDocumentURL(nsIURI* anURL); NS_IMETHOD PrepareStyleSheets(nsIURI* anURL); NS_IMETHOD AddSubtreeToDocument(nsIContent* aElement); NS_IMETHOD RemoveSubtreeFromDocument(nsIContent* aElement); - NS_IMETHOD SetTemplateBuilderFor(nsIContent* aContent, nsIXULTemplateBuilder* aBuilder); - NS_IMETHOD GetTemplateBuilderFor(nsIContent* aContent, nsIXULTemplateBuilder** aResult); + NS_IMETHOD SetTemplateBuilderFor(nsIContent* aContent, + nsIXULTemplateBuilder* aBuilder); + NS_IMETHOD GetTemplateBuilderFor(nsIContent* aContent, + nsIXULTemplateBuilder** aResult); NS_IMETHOD OnPrototypeLoadDone(); NS_IMETHOD OnHide(); - // nsIDOMEventReceiver interface - NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID); - NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID); - NS_IMETHOD GetListenerManager(nsIEventListenerManager** aInstancePtrResult); - NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent); - NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup); + // nsIDOMNode interface overrides + NS_IMETHOD CloneNode(PRBool deep, nsIDOMNode **_retval); - // nsIDOMEventTarget interface - NS_DECL_NSIDOMEVENTTARGET - - // nsIDOM3EventTarget interface - NS_DECL_NSIDOM3EVENTTARGET - - // nsIDOMDocument interface - NS_DECL_NSIDOMDOCUMENT - - // nsIDOMDocumentEvent interface - NS_DECL_NSIDOMDOCUMENTEVENT - - // nsIDOM3DocumentEvent interface - NS_DECL_NSIDOM3DOCUMENTEVENT - - // nsIDOMDocumentView interface - NS_DECL_NSIDOMDOCUMENTVIEW - - // nsIDOMDocumentXBL interface - NS_DECL_NSIDOMDOCUMENTXBL - - // nsIDOMDocumentRange interface - NS_DECL_NSIDOMDOCUMENTRANGE - - // nsIDOMDocumentTraversal interface - NS_DECL_NSIDOMDOCUMENTTRAVERSAL - - // nsIDOMNSDocument interface - NS_DECL_NSIDOMNSDOCUMENT + // nsIDOMDocument interface overrides + NS_IMETHOD CreateElement(const nsAString & tagName, + nsIDOMElement **_retval); + NS_IMETHOD GetElementById(const nsAString & elementId, + nsIDOMElement **_retval); // nsIDOMXULDocument interface NS_DECL_NSIDOMXULDOCUMENT - // nsIDOMNode interface - NS_DECL_NSIDOMNODE - - // nsIDOM3Node interface - NS_DECL_NSIDOM3NODE + // nsIDOMNSDocument + NS_IMETHOD GetContentType(nsAString& aContentType); // nsIHTMLContentContainer interface NS_IMETHOD GetAttributeStyleSheet(nsIHTMLStyleSheet** aResult); @@ -461,10 +213,6 @@ protected: const nsAString& aValue, nsRDFDOMNodeList* aElements); - nsresult - ParseTagString(const nsAString& aTagName, nsIAtom*& aName, - nsIAtom*& aPrefix); - void SetIsPopup(PRBool isPopup) { mIsPopup = isPopup; }; nsresult CreateElement(nsINodeInfo *aNodeInfo, nsIContent** aResult); @@ -482,7 +230,8 @@ protected: nsIParser** aResult); nsresult ApplyPersistentAttributes(); - nsresult ApplyPersistentAttributesToElements(nsIRDFResource* aResource, nsISupportsArray* aElements); + nsresult ApplyPersistentAttributesToElements(nsIRDFResource* aResource, + nsISupportsArray* aElements); nsresult AddElementToDocumentPre(nsIContent* aElement); @@ -511,12 +260,12 @@ protected: static nsIElementFactory* gHTMLElementFactory; static nsIElementFactory* gXMLElementFactory; - static nsIXULContentUtils* gXULUtils; static nsIXULPrototypeCache* gXULCache; static PRLogModuleInfo* gXULLog; - static void GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory** aResult); + static void GetElementFactory(PRInt32 aNameSpaceID, + nsIElementFactory** aResult); nsresult Persist(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aAttribute); @@ -524,67 +273,30 @@ protected: nsresult DestroyForwardReferences(); - // IMPORTANT: The ownership implicit in the following member variables has been - // explicitly checked and set using nsCOMPtr for owning pointers and raw COM interface - // pointers for weak (ie, non owning) references. If you add any members to this + // IMPORTANT: The ownership implicit in the following member + // variables has been explicitly checked and set using nsCOMPtr + // for owning pointers and raw COM interface pointers for weak + // (ie, non owning) references. If you add any members to this // class, please make the ownership explicit (pinkerton, scc). - // NOTE, THIS IS STILL IN PROGRESS, TALK TO PINK OR SCC BEFORE CHANGING + // NOTE, THIS IS STILL IN PROGRESS, TALK TO PINK OR SCC BEFORE + // CHANGING - nsCOMPtr mArena; - // This always has at least one observer - nsAutoVoidArray mObservers; - nsString mDocumentTitle; - nsCOMPtr mDocumentURL; // [OWNER] ??? compare with loader - nsCOMPtr mDocumentBaseURL; - nsWeakPtr mDocumentLoadGroup; // [WEAK] leads to loader - nsWeakPtr mDocumentContainer; // [WEAK] leads to container - nsCOMPtr mDocumentPrincipal; // [OWNER] - nsCOMPtr mRootContent; // [OWNER] - nsIDocument* mParentDocument; // [WEAK] - nsCOMPtr mDOMStyleSheets; // [OWNER] - nsIScriptGlobalObject* mScriptGlobalObject; // [WEAK] nsXULDocument* mNextSrcLoadWaiter; // [OWNER] but not COMPtr - nsString mCharSetID; - PRInt32 mCharacterSetSource; - // This is set in nsPresContext::Init, which calls SetShell. - // Since I think this is almost always done, take the 32-byte hit for - // an nsAutoVoidArray instead of having it be a separate allocation. - nsAutoVoidArray mCharSetObservers; - nsVoidArray mStyleSheets; - nsCOMPtr mSelection; // [OWNER] - PRInt8 mDisplaySelection; - // if we're attached to a DocumentViewImpl, we have a presshell - nsAutoVoidArray mPresShells; - nsCOMPtr mListenerManager; // [OWNER] - nsCOMPtr mAttrStyleSheet; // [OWNER] - nsCOMPtr mInlineStyleSheet; // [OWNER] - nsCOMPtr mCSSLoader; // [OWNER] - nsCOMPtr mScriptLoader; // [OWNER] nsElementMap mElementMap; - nsCOMPtr mLocalStore; - nsCOMPtr mLineBreaker; // [OWNER] - nsCOMPtr mWordBreaker; // [OWNER] - PLDHashTable *mSubDocuments; // [OWNER] of subelements + nsCOMPtr mLocalStore; PRPackedBool mIsPopup; PRPackedBool mIsFastLoad; PRPackedBool mApplyingPersistedAttrs; PRPackedBool mIsWritingFastLoad; nsCOMPtr mCommandDispatcher; // [OWNER] of the focus tracker - nsCOMPtr mBindingManager; // [OWNER] of all bindings - nsSupportsHashtable* mBoxObjectTable; // Box objects for content nodes. - // Maintains the template builders that have been attached to // content elements nsSupportsHashtable* mTemplateBuilderTable; nsVoidArray mForwardReferences; nsForwardReference::Phase mResolutionPhase; - PRInt32 mNextContentID; - PRInt32 mNumCapturers; //Number of capturing event handlers in doc. Used to optimize event delivery. - - PRBool mBidiEnabled; /* * XXX dr @@ -604,7 +316,6 @@ protected: */ nsCOMPtr mTooltipNode; // [OWNER] element triggering the tooltip - nsCOMPtr mNodeInfoManager; // [OWNER] list of names in the document /** * Context stack, which maintains the state of the Builder and allows @@ -722,10 +433,13 @@ protected: PRBool mResolved; public: - BroadcasterHookup(nsXULDocument* aDocument, nsIContent* aObservesElement) : - mDocument(aDocument), - mObservesElement(aObservesElement), - mResolved(PR_FALSE) {} + BroadcasterHookup(nsXULDocument* aDocument, + nsIContent* aObservesElement) + : mDocument(aDocument), + mObservesElement(aObservesElement), + mResolved(PR_FALSE) + { + } virtual ~BroadcasterHookup(); @@ -797,7 +511,7 @@ protected: * Owning references to all of the prototype documents that were * used to construct this document. */ - nsCOMPtr mPrototypes; + nsCOMArray mPrototypes; /** * Prepare to walk the current prototype. @@ -829,7 +543,8 @@ protected: virtual ~CachedChromeStreamListener(); public: - CachedChromeStreamListener(nsXULDocument* aDocument, PRBool aProtoLoaded); + CachedChromeStreamListener(nsXULDocument* aDocument, + PRBool aProtoLoaded); NS_DECL_ISUPPORTS NS_DECL_NSIREQUESTOBSERVER @@ -853,8 +568,6 @@ protected: friend class ParserObserver; - nsSupportsHashtable mContentWrapperHash; - /** * A map from a broadcaster element to a list of listener elements. */ @@ -865,6 +578,4 @@ private: }; - - #endif // nsXULDocument_h__ diff --git a/content/xul/templates/src/nsXULTemplateBuilder.cpp b/content/xul/templates/src/nsXULTemplateBuilder.cpp index bdd7d625b37..96393e8c531 100644 --- a/content/xul/templates/src/nsXULTemplateBuilder.cpp +++ b/content/xul/templates/src/nsXULTemplateBuilder.cpp @@ -69,7 +69,7 @@ #include "nsIContent.h" #include "nsIDOMElement.h" #include "nsIDOMNode.h" -#include "nsIDOMXULDocument.h" +#include "nsIDOMDocument.h" #include "nsIDOMXULElement.h" #include "nsIDocument.h" #include "nsIBindingManager.h" @@ -1408,13 +1408,13 @@ nsXULTemplateBuilder::GetTemplateRoot(nsIContent** aResult) if (! doc) return NS_ERROR_FAILURE; - nsCOMPtr xulDoc = do_QueryInterface(doc); - NS_ASSERTION(xulDoc != nsnull, "expected a XUL document"); - if (! xulDoc) + nsCOMPtr domDoc = do_QueryInterface(doc); + NS_ASSERTION(domDoc, "expected a XUL document"); + if (! domDoc) return NS_ERROR_FAILURE; nsCOMPtr domElement; - xulDoc->GetElementById(templateID, getter_AddRefs(domElement)); + domDoc->GetElementById(templateID, getter_AddRefs(domElement)); if (domElement) return CallQueryInterface(domElement, aResult); diff --git a/dom/public/coreEvents/MANIFEST b/dom/public/coreEvents/MANIFEST index a226681057c..e69de29bb2d 100644 --- a/dom/public/coreEvents/MANIFEST +++ b/dom/public/coreEvents/MANIFEST @@ -1,22 +0,0 @@ -# -# This is a list of local files which get copied to the mozilla:dist:dom directory -# - -nsIDOMEventCapturer.h -nsIDOMEventReceiver.h -nsIDOMFocusListener.h -nsIDOMFormListener.h -nsIDOMKeyListener.h -nsIDOMLoadListener.h -nsIDOMMouseListener.h -nsIDOMMouseMotionListener.h -nsIDOMMutationListener.h -nsIDOMDragListener.h -nsIDOMPaintListener.h -nsIDOMTextListener.h -nsIDOMCompositionListener.h -nsIDOMXULListener.h -nsIDOMScrollListener.h -nsIDOMContextMenuListener.h - - diff --git a/dom/public/coreEvents/Makefile.in b/dom/public/coreEvents/Makefile.in index 973e46478d9..45b9a3cd79a 100644 --- a/dom/public/coreEvents/Makefile.in +++ b/dom/public/coreEvents/Makefile.in @@ -29,7 +29,6 @@ include $(DEPTH)/config/autoconf.mk MODULE = dom EXPORTS = \ - nsIDOMEventCapturer.h \ nsIDOMEventReceiver.h \ nsIDOMFocusListener.h \ nsIDOMFormListener.h \ diff --git a/dom/public/coreEvents/nsIDOMEventCapturer.h b/dom/public/coreEvents/nsIDOMEventCapturer.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/dom/public/idl/xul/nsIDOMXULDocument.idl b/dom/public/idl/xul/nsIDOMXULDocument.idl index 441b5e50eb0..50a7ce5dc27 100644 --- a/dom/public/idl/xul/nsIDOMXULDocument.idl +++ b/dom/public/idl/xul/nsIDOMXULDocument.idl @@ -38,13 +38,13 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMDocument.idl" +#include "domstubs.idl" interface nsIDOMXULCommandDispatcher; [scriptable, uuid(17ddd8c0-c5f8-11d2-a6ae-00104bde6048)] -interface nsIDOMXULDocument : nsIDOMDocument +interface nsIDOMXULDocument : nsISupports { attribute nsIDOMNode popupNode; attribute nsIDOMNode tooltipNode; diff --git a/dom/src/base/nsDOMClassInfo.cpp b/dom/src/base/nsDOMClassInfo.cpp index b7bac4f0467..eccd77d95ca 100644 --- a/dom/src/base/nsDOMClassInfo.cpp +++ b/dom/src/base/nsDOMClassInfo.cpp @@ -1892,6 +1892,7 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(XULDocument, nsIDOMXULDocument) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument) DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULDocument) DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocument) DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentEvent) diff --git a/extensions/cookie/nsImgManager.cpp b/extensions/cookie/nsImgManager.cpp index 6b624e5fe6c..397fc0ea325 100644 --- a/extensions/cookie/nsImgManager.cpp +++ b/extensions/cookie/nsImgManager.cpp @@ -50,6 +50,7 @@ #include "nsCRT.h" #include "nsIPrefBranchInternal.h" #include "nsIObserverService.h" +#include "nsString.h" static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); diff --git a/extensions/transformiix/source/xml/dom/mozImpl/MozillaDocument.cpp b/extensions/transformiix/source/xml/dom/mozImpl/MozillaDocument.cpp index 05cb901a4d2..992e5608ada 100644 --- a/extensions/transformiix/source/xml/dom/mozImpl/MozillaDocument.cpp +++ b/extensions/transformiix/source/xml/dom/mozImpl/MozillaDocument.cpp @@ -38,6 +38,7 @@ #include "nsIDOMProcessingInstruction.h" #include "nsIDOMElement.h" #include "nsIDOMText.h" +#include "nsString.h" // Need to determine if these are well-chosen. #define WRAPPER_INITIAL_SIZE 256 diff --git a/extensions/transformiix/source/xml/dom/mozImpl/MozillaNode.cpp b/extensions/transformiix/source/xml/dom/mozImpl/MozillaNode.cpp index 288f7fbaaff..1abbd73a4a5 100644 --- a/extensions/transformiix/source/xml/dom/mozImpl/MozillaNode.cpp +++ b/extensions/transformiix/source/xml/dom/mozImpl/MozillaNode.cpp @@ -36,6 +36,7 @@ #include "nsIDOMNode.h" #include "nsIDOMNodeList.h" #include "txAtoms.h" +#include "nsString.h" MOZ_DECL_CTOR_COUNTER(Node) diff --git a/extensions/transformiix/source/xpath/nsXPath1Scheme.cpp b/extensions/transformiix/source/xpath/nsXPath1Scheme.cpp index c2ebb9c3cf8..31e816dedc5 100755 --- a/extensions/transformiix/source/xpath/nsXPath1Scheme.cpp +++ b/extensions/transformiix/source/xpath/nsXPath1Scheme.cpp @@ -52,6 +52,7 @@ #include "nsIDOMRange.h" #include "nsIModifyableXPointer.h" #include "nsAutoPtr.h" +#include "nsString.h" #include "nsContentCID.h" static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID); diff --git a/extensions/xmlextras/pointers/src/nsXPointer.cpp b/extensions/xmlextras/pointers/src/nsXPointer.cpp index 646efc14210..d00c9a535b9 100755 --- a/extensions/xmlextras/pointers/src/nsXPointer.cpp +++ b/extensions/xmlextras/pointers/src/nsXPointer.cpp @@ -126,7 +126,7 @@ nsXPointerResult::Item(PRUint32 aIndex, nsIDOMRange** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); - if (aIndex >= mArray.Count()) { + if (aIndex >= (PRUint32)mArray.Count()) { return NS_ERROR_FAILURE; } @@ -255,7 +255,7 @@ nsXPointerSchemeContext::GetSchemeData(PRUint32 aIndex, nsAString &aScheme, nsAString &aData) { - if (aIndex >= mSchemes.Count()) { + if (aIndex >= (PRUint32)mSchemes.Count()) { aScheme.Truncate(); aData.Truncate(); diff --git a/intl/lwbrk/public/nsILineBreakerFactory.h b/intl/lwbrk/public/nsILineBreakerFactory.h index f0e10ad1680..048a5a8e78c 100644 --- a/intl/lwbrk/public/nsILineBreakerFactory.h +++ b/intl/lwbrk/public/nsILineBreakerFactory.h @@ -56,7 +56,7 @@ class nsILineBreakerFactory : public nsISupports public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILINEBREAKERFACTORY_IID) - NS_IMETHOD GetBreaker(nsString& aParam, nsILineBreaker** breaker) = 0; + NS_IMETHOD GetBreaker(const nsAString& aParam, nsILineBreaker** breaker) = 0; }; diff --git a/intl/lwbrk/public/nsIWordBreakerFactory.h b/intl/lwbrk/public/nsIWordBreakerFactory.h index af78d955e33..c9e3c80e6d5 100644 --- a/intl/lwbrk/public/nsIWordBreakerFactory.h +++ b/intl/lwbrk/public/nsIWordBreakerFactory.h @@ -56,7 +56,7 @@ class nsIWordBreakerFactory : public nsISupports public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_IWORDBREAKERFACTORY_IID) - NS_IMETHOD GetBreaker(nsString& aParam, nsIWordBreaker** breaker) = 0; + NS_IMETHOD GetBreaker(const nsAString& aParam, nsIWordBreaker** breaker) = 0; }; diff --git a/intl/lwbrk/src/nsLWBreakerFImp.cpp b/intl/lwbrk/src/nsLWBreakerFImp.cpp index 50b997c4f1f..4ee78d24c92 100644 --- a/intl/lwbrk/src/nsLWBreakerFImp.cpp +++ b/intl/lwbrk/src/nsLWBreakerFImp.cpp @@ -60,7 +60,8 @@ NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); NS_IMPL_ADDREF ( nsLWBreakerFImp ); NS_IMPL_RELEASE ( nsLWBreakerFImp ); -nsresult nsLWBreakerFImp::QueryInterface(REFNSIID aIID, void** aInstancePtr) +nsresult +nsLWBreakerFImp::QueryInterface(REFNSIID aIID, void** aInstancePtr) { if( NULL == aInstancePtr) { @@ -119,7 +120,8 @@ static const PRUnichar gCnNoEnd[] = { 0xfffd // to be changed }; -nsresult nsLWBreakerFImp::GetBreaker(nsString& aParam, nsILineBreaker** oResult) +nsresult +nsLWBreakerFImp::GetBreaker(const nsAString& aParam, nsILineBreaker** oResult) { if( NULL == oResult) { return NS_ERROR_NULL_POINTER; @@ -158,7 +160,8 @@ nsresult nsLWBreakerFImp::GetBreaker(nsString& aParam, nsILineBreaker** oResult) return NS_OK; } -nsresult nsLWBreakerFImp::GetBreaker(nsString& aParam, nsIWordBreaker** oResult) +nsresult +nsLWBreakerFImp::GetBreaker(const nsAString& aParam, nsIWordBreaker** oResult) { if( NULL == oResult) { return NS_ERROR_NULL_POINTER; diff --git a/intl/lwbrk/src/nsLWBreakerFImp.h b/intl/lwbrk/src/nsLWBreakerFImp.h index b159096cf5e..7baeb87a45b 100644 --- a/intl/lwbrk/src/nsLWBreakerFImp.h +++ b/intl/lwbrk/src/nsLWBreakerFImp.h @@ -58,8 +58,8 @@ public: nsLWBreakerFImp(); virtual ~nsLWBreakerFImp(); - NS_IMETHOD GetBreaker(nsString& aParam, nsILineBreaker** breaker); - NS_IMETHOD GetBreaker(nsString& aParam, nsIWordBreaker** breaker); + NS_IMETHOD GetBreaker(const nsAString& aParam, nsILineBreaker** breaker); + NS_IMETHOD GetBreaker(const nsAString& aParam, nsIWordBreaker** breaker); }; diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index fe0a4835cef..a4f208ff357 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -1166,7 +1166,7 @@ NS_IMETHODIMP DocumentViewerImpl::GetDOMDocument(nsIDOMDocument **aResult) { NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE); - return CallQueryInterface(mDocument.get(), aResult); + return CallQueryInterface(mDocument, aResult); } NS_IMETHODIMP diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index 433b2569c9e..23d4df4625f 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -155,7 +155,6 @@ class nsIDocumentLoaderFactory; #ifdef MOZ_XUL -#include "nsIXULContentSink.h" #include "nsIXULDocument.h" #include "nsIXULPopupListener.h" #include "nsIXULPrototypeCache.h" @@ -521,7 +520,6 @@ MAKE_CTOR(CreateComputedDOMStyle, nsIComputedDOMStyle, NS_NewCom MAKE_CTOR(CreateXULSortService, nsIXULSortService, NS_NewXULSortService) // NS_NewXULContentBuilder // NS_NewXULTreeBuilder -MAKE_CTOR(CreateXULContentSink, nsIXULContentSink, NS_NewXULContentSink) MAKE_CTOR(CreateXULDocument, nsIXULDocument, NS_NewXULDocument) MAKE_CTOR(CreateXULPopupListener, nsIXULPopupListener, NS_NewXULPopupListener) // NS_NewXULControllers @@ -1129,11 +1127,6 @@ static const nsModuleComponentInfo gComponents[] = { "@mozilla.org/xul/xul-tree-builder;1", NS_NewXULTreeBuilder }, - { "XUL Content Sink", - NS_XULCONTENTSINK_CID, - "@mozilla.org/xul/xul-content-sink;1", - CreateXULContentSink }, - { "XUL Document", NS_XULDOCUMENT_CID, "@mozilla.org/xul/xul-document;1", diff --git a/layout/html/tests/TestAttributes.cpp b/layout/html/tests/TestAttributes.cpp index bee25a15cda..4a335d28217 100644 --- a/layout/html/tests/TestAttributes.cpp +++ b/layout/html/tests/TestAttributes.cpp @@ -45,7 +45,6 @@ #include "nsIDocument.h" #include "nsISupportsArray.h" #include "nsDocument.h" -#include "nsMarkupDocument.h" #include "nsIURL.h" #include "nsIDOMText.h" #include "nsINameSpaceManager.h" @@ -188,7 +187,7 @@ void testStrings(nsIDocument* aDoc) { printf("string tests complete\n"); } -class MyDocument : public nsMarkupDocument { +class MyDocument : public nsDocument { public: MyDocument(); NS_IMETHOD StartDocumentLoad(const char* aCommand, diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index 3aab73eb849..1d5bfbc6e98 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -1873,9 +1873,10 @@ nsPrintEngine::GetWebShellTitleAndURL(nsIWebShell* aWebShell, *aTitle = nsnull; *aURLStr = nsnull; - const nsString* docTitle = aDoc->GetDocumentTitle(); - if (docTitle && !docTitle->IsEmpty()) { - *aTitle = ToNewUnicode(*docTitle); + nsAutoString docTitle; + aDoc->GetDocumentTitle(docTitle); + if (!docTitle.IsEmpty()) { + *aTitle = ToNewUnicode(docTitle); } nsCOMPtr url; diff --git a/layout/xul/base/src/nsButtonBoxFrame.cpp b/layout/xul/base/src/nsButtonBoxFrame.cpp index 9582582d812..9e9f88a6f6e 100644 --- a/layout/xul/base/src/nsButtonBoxFrame.cpp +++ b/layout/xul/base/src/nsButtonBoxFrame.cpp @@ -40,7 +40,7 @@ #include "nsButtonBoxFrame.h" #include "nsIContent.h" #include "nsIDocument.h" -#include "nsIDOMXULDocument.h" +#include "nsIDOMDocument.h" #include "nsIDOMNodeList.h" #include "nsHTMLAtoms.h" #include "nsINameSpaceManager.h" diff --git a/layout/xul/base/src/nsMenuFrame.cpp b/layout/xul/base/src/nsMenuFrame.cpp index 6834c30f019..97f3ce0a455 100644 --- a/layout/xul/base/src/nsMenuFrame.cpp +++ b/layout/xul/base/src/nsMenuFrame.cpp @@ -60,7 +60,6 @@ #include "nsIDocument.h" #include "nsIDOMNSDocument.h" #include "nsIDOMDocument.h" -#include "nsIDOMXULDocument.h" #include "nsIDOMElement.h" #include "nsISupportsArray.h" #include "nsIDOMText.h" @@ -1523,13 +1522,13 @@ nsMenuFrame::BuildAcceleratorText() nsCOMPtr document; mContent->GetDocument(*getter_AddRefs(document)); - // Turn the document into a XUL document so we can use getElementById - nsCOMPtr xulDocument(do_QueryInterface(document)); - if (!xulDocument) + // Turn the document into a DOM document so we can use getElementById + nsCOMPtr domDocument(do_QueryInterface(document)); + if (!domDocument) return; nsCOMPtr keyDOMElement; - xulDocument->GetElementById(keyValue, getter_AddRefs(keyDOMElement)); + domDocument->GetElementById(keyValue, getter_AddRefs(keyDOMElement)); if (!keyDOMElement) return; diff --git a/layout/xul/base/src/nsXULTooltipListener.cpp b/layout/xul/base/src/nsXULTooltipListener.cpp index 75680d31421..699165d5f66 100644 --- a/layout/xul/base/src/nsXULTooltipListener.cpp +++ b/layout/xul/base/src/nsXULTooltipListener.cpp @@ -39,6 +39,7 @@ #include "nsIDOMMouseEvent.h" #include "nsIDOMEventTarget.h" +#include "nsIDOMDocument.h" #include "nsIDOMXULDocument.h" #include "nsIDOMXULElement.h" #include "nsIDocument.h" @@ -579,14 +580,15 @@ nsXULTooltipListener::GetTooltipFor(nsIContent* aTarget, nsIContent** aTooltip) } else { if (!tooltipId.IsEmpty()) { // tooltip must be an id, use getElementById to find it - nsCOMPtr xulDocument = do_QueryInterface(document); - if (!xulDocument) { - NS_ERROR("tooltip attached to an element that isn't in XUL!"); + nsCOMPtr domDocument = + do_QueryInterface(document); + if (!domDocument) { return NS_ERROR_FAILURE; } nsCOMPtr tooltipEl; - xulDocument->GetElementById(tooltipId, getter_AddRefs(tooltipEl)); + domDocument->GetElementById(tooltipId, + getter_AddRefs(tooltipEl)); if (tooltipEl) { mNeedTitletip = PR_FALSE; diff --git a/mailnews/base/src/nsMsgStatusFeedback.cpp b/mailnews/base/src/nsMsgStatusFeedback.cpp index fe5488c9f08..6119be8c6fe 100644 --- a/mailnews/base/src/nsMsgStatusFeedback.cpp +++ b/mailnews/base/src/nsMsgStatusFeedback.cpp @@ -48,7 +48,6 @@ #include "nsIDocumentViewer.h" #include "nsIDocument.h" #include "nsIDOMElement.h" -#include "nsIDOMXULDocument.h" #include "nsIDocShell.h" #include "nsIDocShellTreeItem.h" #include "nsIChannel.h" diff --git a/rdf/base/idl/xulstubs.idl b/rdf/base/idl/xulstubs.idl index 5b24e017900..e2e74e6e68a 100644 --- a/rdf/base/idl/xulstubs.idl +++ b/rdf/base/idl/xulstubs.idl @@ -56,7 +56,7 @@ interface nsIDOMXULTreeElement : nsIDOMXULElement {}; interface nsIDOMXULCommandDispatcher : nsISupports {}; [scriptable, uuid(17ddd8c0-c5f8-11d2-a6ae-00104bde6048)] -interface nsIDOMXULDocument : nsIDOMDocument {}; +interface nsIDOMXULDocument : nsISupports {}; %{C++ #endif diff --git a/widget/src/cocoa/nsMenuBarX.cpp b/widget/src/cocoa/nsMenuBarX.cpp index 726eb7c3d37..b683b8ec926 100644 --- a/widget/src/cocoa/nsMenuBarX.cpp +++ b/widget/src/cocoa/nsMenuBarX.cpp @@ -55,7 +55,7 @@ #include "nsIDocumentViewer.h" #include "nsIDocumentObserver.h" -#include "nsIDOMXULDocument.h" +#include "nsIDOMDocument.h" #include "nsWidgetAtoms.h" #include @@ -337,10 +337,10 @@ nsMenuBarX :: CommandEventHandler ( EventHandlerCallRef inHandlerChain, EventRef // the 'about' command is special because we don't have a nsIMenu or nsIMenuItem // for the apple menu. Grovel for the content node with an id of "aboutName" // and call it directly. - nsCOMPtr xulDoc = do_QueryInterface(self->mDocument); - if ( xulDoc ) { + nsCOMPtr domDoc = do_QueryInterface(self->mDocument); + if ( domDoc ) { nsCOMPtr domElement; - xulDoc->GetElementById(NS_LITERAL_STRING("aboutName"), getter_AddRefs(domElement)); + domDoc->GetElementById(NS_LITERAL_STRING("aboutName"), getter_AddRefs(domElement)); nsCOMPtr aboutContent ( do_QueryInterface(domElement) ); self->ExecuteCommand(aboutContent); } diff --git a/widget/src/cocoa/nsMenuX.cpp b/widget/src/cocoa/nsMenuX.cpp index 2f0ec57d12f..4931f749092 100644 --- a/widget/src/cocoa/nsMenuX.cpp +++ b/widget/src/cocoa/nsMenuX.cpp @@ -38,7 +38,7 @@ #include "nsCOMPtr.h" #include "nsIDocument.h" #include "nsIContent.h" -#include "nsIDOMXULDocument.h" +#include "nsIDOMDocument.h" #include "nsIDocumentViewer.h" #include "nsIDocumentObserver.h" #include "nsIComponentManager.h" @@ -875,13 +875,13 @@ void nsMenuX::LoadMenuItem( nsIMenu* inParentMenu, nsIContent* inMenuItemContent inMenuItemContent->GetDocument(*getter_AddRefs(document)); if ( !document ) return; - nsCOMPtr xulDocument = do_QueryInterface(document); - if ( !xulDocument ) + nsCOMPtr domDocument = do_QueryInterface(document); + if ( !domDocument ) return; nsCOMPtr keyElement; if (!keyValue.IsEmpty()) - xulDocument->GetElementById(keyValue, getter_AddRefs(keyElement)); + domDocument->GetElementById(keyValue, getter_AddRefs(keyElement)); if ( keyElement ) { nsCOMPtr keyContent ( do_QueryInterface(keyElement) ); nsAutoString keyChar(NS_LITERAL_STRING(" ")); diff --git a/widget/src/mac/nsMenu.cpp b/widget/src/mac/nsMenu.cpp index 17c40cc809a..14bfc9bd909 100644 --- a/widget/src/mac/nsMenu.cpp +++ b/widget/src/mac/nsMenu.cpp @@ -38,7 +38,7 @@ #include "nsCOMPtr.h" #include "nsIDocument.h" #include "nsIContent.h" -#include "nsIDOMXULDocument.h" +#include "nsIDOMDocument.h" #include "nsIDocumentViewer.h" #include "nsIDocumentObserver.h" #include "nsIComponentManager.h" @@ -559,9 +559,9 @@ nsEventStatus nsMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent) mMenuContent->GetDocument(*getter_AddRefs(doc)); if (!doc) return nsEventStatus_eConsumeNoDefault; - nsCOMPtr xulDoc = do_QueryInterface(doc); - if (!xulDoc) { - NS_ERROR("nsIDOMDocument to nsIDOMXULDocument QI failed."); + nsCOMPtr domDoc = do_QueryInterface(doc); + if (!domDoc) { + NS_ERROR("nsIDocument to nsIDOMDocument QI failed."); return nsEventStatus_eConsumeNoDefault; } @@ -569,7 +569,8 @@ nsEventStatus nsMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent) // . This is the glue code which causes any script code // in the to be executed. nsCOMPtr domElement; - xulDoc->GetElementById(NS_LITERAL_STRING("aboutName"), getter_AddRefs(domElement)); + domDoc->GetElementById(NS_LITERAL_STRING("aboutName"), + getter_AddRefs(domElement)); if (!domElement) return nsEventStatus_eConsumeNoDefault; @@ -1067,13 +1068,13 @@ nsMenu::LoadMenuItem( nsIMenu* inParentMenu, nsIContent* inMenuItemContent ) inMenuItemContent->GetDocument(*getter_AddRefs(document)); if ( !document ) return; - nsCOMPtr xulDocument = do_QueryInterface(document); - if ( !xulDocument ) + nsCOMPtr domDocument = do_QueryInterface(document); + if ( !domDocument ) return; nsCOMPtr keyElement; if (!keyValue.IsEmpty()) - xulDocument->GetElementById(keyValue, getter_AddRefs(keyElement)); + domDocument->GetElementById(keyValue, getter_AddRefs(keyElement)); if ( keyElement ) { nsCOMPtr keyContent ( do_QueryInterface(keyElement) ); nsAutoString keyChar(NS_LITERAL_STRING(" ")); diff --git a/widget/src/mac/nsMenuBar.cpp b/widget/src/mac/nsMenuBar.cpp index 97418906a76..40ce5eb5d26 100644 --- a/widget/src/mac/nsMenuBar.cpp +++ b/widget/src/mac/nsMenuBar.cpp @@ -57,7 +57,7 @@ #include "nsWidgetAtoms.h" -#include "nsIDOMXULDocument.h" +#include "nsIDOMDocument.h" #include #include diff --git a/widget/src/mac/nsMenuBarX.cpp b/widget/src/mac/nsMenuBarX.cpp index 81e838e11d1..33e3cb7a537 100644 --- a/widget/src/mac/nsMenuBarX.cpp +++ b/widget/src/mac/nsMenuBarX.cpp @@ -56,7 +56,7 @@ #include "nsIDocumentViewer.h" #include "nsIDocumentObserver.h" -#include "nsIDOMXULDocument.h" +#include "nsIDOMDocument.h" #include "nsWidgetAtoms.h" #include @@ -339,13 +339,15 @@ nsMenuBarX :: CommandEventHandler ( EventHandlerCallRef inHandlerChain, EventRef case kHICommandAbout: { - // the 'about' command is special because we don't have a nsIMenu or nsIMenuItem - // for the apple menu. Grovel for the content node with an id of "aboutName" - // and call it directly. - nsCOMPtr xulDoc = do_QueryInterface(self->mDocument); - if ( xulDoc ) { + // the 'about' command is special because we don't have a + // nsIMenu or nsIMenuItem for the apple menu. Grovel for the + // content node with an id of "aboutName" and call it + // directly. + nsCOMPtr domDoc = do_QueryInterface(self->mDocument); + if ( domDoc ) { nsCOMPtr domElement; - xulDoc->GetElementById(NS_LITERAL_STRING("aboutName"), getter_AddRefs(domElement)); + domDoc->GetElementById(NS_LITERAL_STRING("aboutName"), + getter_AddRefs(domElement)); nsCOMPtr aboutContent ( do_QueryInterface(domElement) ); self->ExecuteCommand(aboutContent); } diff --git a/xpcom/base/IIDS.h b/xpcom/base/IIDS.h index aa668ac874d..cb66b48f6cd 100644 --- a/xpcom/base/IIDS.h +++ b/xpcom/base/IIDS.h @@ -197,12 +197,6 @@ nsIDOMWindow = { /* a6cf906b-15b3-11d2-932e-00805f8add32 */ 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }; -nsIDOMEventCapturer = { /* a6cf906c-15b3-11d2-932e-00805f8add32 */ - 0xa6cf906c, - 0x15b3, - 0x11d2, - {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} - }; nsIDOMLocation = { /* a6cf906d-15b3-11d2-932e-00805f8add32 */ 0xa6cf906d, 0x15b3, diff --git a/xpfe/appshell/src/nsXULWindow.cpp b/xpfe/appshell/src/nsXULWindow.cpp index 0faee9d6460..38fd3c51be2 100644 --- a/xpfe/appshell/src/nsXULWindow.cpp +++ b/xpfe/appshell/src/nsXULWindow.cpp @@ -43,7 +43,6 @@ #include "nsIDOMElement.h" #include "nsIDOMWindowInternal.h" #include "nsIDOMScreen.h" -#include "nsIDOMXULDocument.h" #include "nsIEmbeddingSiteWindow.h" #include "nsIEmbeddingSiteWindow2.h" #include "nsIInterfaceRequestor.h" @@ -1414,7 +1413,7 @@ NS_IMETHODIMP nsXULWindow::GetDOMElementById(char* aID, nsIDOMElement** aDOMElem nsCOMPtr doc; docv->GetDocument(*getter_AddRefs(doc)); - nsCOMPtr domdoc(do_QueryInterface(doc)); + nsCOMPtr domdoc(do_QueryInterface(doc)); if(!domdoc) return NS_ERROR_FAILURE;