diff --git a/mozilla/accessible/src/base/nsAccessible.cpp b/mozilla/accessible/src/base/nsAccessible.cpp index 2e19b7d32a4..c7d475d082a 100644 --- a/mozilla/accessible/src/base/nsAccessible.cpp +++ b/mozilla/accessible/src/base/nsAccessible.cpp @@ -958,7 +958,9 @@ NS_IMETHODIMP nsAccessible::TakeFocus() if (!content) { return NS_ERROR_FAILURE; } - return content->SetFocus(nsCOMPtr(GetPresContext())); + content->SetFocus(nsCOMPtr(GetPresContext())); + + return NS_OK; } NS_IMETHODIMP nsAccessible::AppendStringWithSpaces(nsAString *aFlatString, const nsAString& textEquivalent) diff --git a/mozilla/content/base/public/nsIContent.h b/mozilla/content/base/public/nsIContent.h index bbe8e199d4a..5c160d4e3c0 100644 --- a/mozilla/content/base/public/nsIContent.h +++ b/mozilla/content/base/public/nsIContent.h @@ -88,11 +88,10 @@ public: * @param aCompileEventHandlers whether to initialize the event handlers in * the document (used by nsXULElement) */ - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers) + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers) { mDocument = aDocument; - return NS_OK; } /** @@ -110,7 +109,7 @@ public: * pointer, so subclasses which use those bits should override this. * @param aParent the new parent content to set (could be null) */ - NS_IMETHOD_(void) SetParent(nsIContent* aParent) + virtual void SetParent(nsIContent* aParent) { mParentPtrBits = NS_REINTERPRET_CAST(PtrBits, aParent); } @@ -120,20 +119,20 @@ public: * @see nsIAnonymousContentCreator * @return whether this content is anonymous */ - NS_IMETHOD_(PRBool) IsNativeAnonymous() const = 0; + virtual PRBool IsNativeAnonymous() const = 0; /** * Set whether this content is anonymous * @see nsIAnonymousContentCreator * @param aAnonymous whether this content is anonymous */ - NS_IMETHOD_(void) SetNativeAnonymous(PRBool aAnonymous) = 0; + virtual void SetNativeAnonymous(PRBool aAnonymous) = 0; /** * Get the namespace that this element's tag is defined in * @param aResult the namespace [OUT] */ - NS_IMETHOD GetNameSpaceID(PRInt32* aResult) const = 0; + virtual void GetNameSpaceID(PRInt32* aResult) const = 0; /** * Get the tag for this element. This will always return a non-null @@ -143,35 +142,36 @@ public: /** * Get the NodeInfo for this element - * @param aResult the tag [OUT] + * @return the nodes node info */ - NS_IMETHOD_(nsINodeInfo *) GetNodeInfo() const = 0; + virtual nsINodeInfo * GetNodeInfo() const = 0; /** * Tell whether this element can contain children - * @param aResult whether this element can contain children [OUT] + * @return whether this element can contain children */ - NS_IMETHOD_(PRBool) CanContainChildren() const = 0; + virtual PRBool CanContainChildren() const = 0; /** * Get the number of children - * @param aResult the number of children [OUT] + * @return the number of children */ - NS_IMETHOD_(PRUint32) GetChildCount() const = 0; + virtual PRUint32 GetChildCount() const = 0; /** * Get a child by index - * @param aIndex the index of the child to get, or null if index out of bounds - * @param aResult the child [OUT] + * @param aIndex the index of the child to get, or null if index out + * of bounds + * @return the child */ - NS_IMETHOD_(nsIContent *) GetChildAt(PRUint32 aIndex) const = 0; + virtual nsIContent *GetChildAt(PRUint32 aIndex) const = 0; /** * Get the index of a child within this content * @param aPossibleChild the child to get the index - * @param aIndex the index of the child, or -1 if not a child [OUT] + * @return the index of the child, or -1 if not a child */ - NS_IMETHOD_(PRInt32) IndexOf(nsIContent* aPossibleChild) const = 0; + virtual PRInt32 IndexOf(nsIContent* aPossibleChild) const = 0; /** * Insert a content node at a particular index. @@ -183,8 +183,8 @@ public: * occurred * @param aDeepSetDocument whether to set document on all children of aKid */ - NS_IMETHOD InsertChildAt(nsIContent* aKid, PRUint32 aIndex, - PRBool aNotify, PRBool aDeepSetDocument) = 0; + virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument) = 0; /** * Remove a child and replace it with another. @@ -195,8 +195,8 @@ public: * occurred * @param aDeepSetDocument whether to set document on all children of aKid */ - NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, - PRBool aNotify, PRBool aDeepSetDocument) = 0; + virtual nsresult ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument) = 0; /** * Append a content node to the end of the child list. @@ -206,8 +206,8 @@ public: * occurred * @param aDeepSetDocument whether to set document on all children of aKid */ - NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify, - PRBool aDeepSetDocument) = 0; + virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument) = 0; /** * Remove a child from this content node. @@ -216,21 +216,21 @@ public: * @param aNotify whether to notify the document that the replace has * occurred */ - NS_IMETHOD RemoveChildAt(PRUint32 aIndex, PRBool aNotify) = 0; + virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify) = 0; /** * Returns an atom holding the name of the attribute of type ID on * this content node (if applicable). Returns null for non-element * content nodes. */ - NS_IMETHOD_(nsIAtom*) GetIDAttributeName() const = 0; + virtual nsIAtom *GetIDAttributeName() const = 0; /** * Returns an atom holding the name of the "class" attribute on this * content node (if applicable). Returns null for non-element * content nodes. */ - NS_IMETHOD_(nsIAtom*) GetClassAttributeName() const = 0; + virtual nsIAtom *GetClassAttributeName() const = 0; /** * Normalizes an attribute name and returns it as a nodeinfo if an attribute @@ -242,7 +242,7 @@ public: * @param aStr the unparsed attribute string * @return the node info. May be nsnull. */ - NS_IMETHOD_(already_AddRefed) GetExistingAttrNameFromQName(const nsAString& aStr) = 0; + virtual already_AddRefed GetExistingAttrNameFromQName(const nsAString& aStr) const = 0; /** * Set attribute values. All attribute values are assumed to have a @@ -257,8 +257,8 @@ public: * @param aNotify specifies how whether or not the document should be * notified of the attribute change. */ - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, PRBool aNotify) = 0; + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify) = 0; /** * Set attribute values. All attribute values are assumed to have a @@ -273,8 +273,8 @@ public: * @param aNotify specifies whether or not the document should be * notified of the attribute change. */ - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, - PRBool aNotify) = 0; + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify) = 0; /** * Get the current value of the attribute. This returns a form that is @@ -289,8 +289,8 @@ public: * @throws NS_CONTENT_ATTR_HAS_VALUE if the attribute exists and has a * non-empty value (==NS_OK) */ - NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsAString& aResult) const = 0; + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsAString& aResult) const = 0; /** * Get the current value and prefix of the attribute. This returns a form @@ -306,8 +306,8 @@ public: * @throws NS_CONTENT_ATTR_HAS_VALUE if the attribute exists and has a * non-empty value (==NS_OK) */ - NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom** aPrefix, nsAString& aResult) const = 0; + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsIAtom** aPrefix, nsAString& aResult) const = 0; /** * Determine if an attribute has been set (empty string or otherwise). @@ -316,7 +316,7 @@ public: * @param aAttr the attribute name * @return whether an attribute exists */ - NS_IMETHOD_(PRBool) HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const = 0; + virtual PRBool HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const = 0; /** * Remove an attribute so that it is no longer explicitly specified. @@ -326,8 +326,8 @@ public: * @param aNotify specifies whether or not the document should be * notified of the attribute change */ - NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttr, - PRBool aNotify) = 0; + virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttr, + PRBool aNotify) = 0; /** @@ -339,17 +339,15 @@ public: * @param aPrefix the attribute prefix [OUT] * */ - NS_IMETHOD GetAttrNameAt(PRUint32 aIndex, - PRInt32* aNameSpaceID, - nsIAtom** aName, - nsIAtom** aPrefix) const = 0; + virtual nsresult GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, + nsIAtom** aName, nsIAtom** aPrefix) const = 0; /** * Get the number of all specified attributes. * - * @returns the number of attributes + * @return the number of attributes */ - NS_IMETHOD_(PRUint32) GetAttrCount() const = 0; + virtual PRUint32 GetAttrCount() const = 0; /** * Inform content of range ownership changes. This allows content @@ -363,16 +361,18 @@ public: * Inform content that it owns one or both range endpoints * @param aRange the range the content owns */ - NS_IMETHOD RangeAdd(nsIDOMRange* aRange) = 0; + virtual nsresult RangeAdd(nsIDOMRange* aRange) = 0; + /** * Inform content that it no longer owns either range endpoint * @param aRange the range the content no longer owns */ - NS_IMETHOD RangeRemove(nsIDOMRange* aRange) = 0; + virtual void RangeRemove(nsIDOMRange* aRange) = 0; + /** * Get the list of ranges that have either endpoint in this content * item. - * @returns the list of ranges owned partially by this content. The + * @return the list of ranges owned partially by this content. The * nsVoidArray is owned by the content object and its lifetime is * controlled completely by the content object. */ @@ -410,11 +410,10 @@ public: * @param aEventStatus the status returned from the function. Generally * nsEventStatus_eIgnore */ - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, - nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, - PRUint32 aFlags, - nsEventStatus* aEventStatus) = 0; + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus) = 0; /** * Get a unique ID for this piece of content. @@ -433,7 +432,9 @@ public: * Set the unique content ID for this content. * @param aID the ID to set */ - NS_IMETHOD SetContentID(PRUint32 aID) = 0; + virtual void SetContentID(PRUint32 aID) + { + } /** * Set the focus on this content. This is generally something for the event @@ -446,7 +447,10 @@ public: * @param aPresContext the pres context * @see nsGenericHTMLElement::SetElementFocus() */ - NS_IMETHOD SetFocus(nsIPresContext* aPresContext) = 0; + virtual void SetFocus(nsIPresContext* aPresContext) + { + } + /** * Remove the focus on this content. This is generally something for the * event state manager to do, not ordinary people. Ordinary people should do @@ -458,7 +462,9 @@ public: * @param aPresContext the pres context * @see nsGenericHTMLElement::SetElementFocus() */ - NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext) = 0; + virtual void RemoveFocus(nsIPresContext* aPresContext) + { + } /** * Sets content node with the binding responsible for our construction (and @@ -467,7 +473,8 @@ public: * * @param aContent the new binding parent */ - NS_IMETHOD SetBindingParent(nsIContent* aContent) = 0; + virtual nsresult SetBindingParent(nsIContent* aContent) = 0; + /** * Gets content node with the binding responsible for our construction (and * existence). Used by anonymous content (XBL-generated). null for all @@ -475,7 +482,7 @@ public: * * @return the binding parent */ - NS_IMETHOD_(nsIContent*) GetBindingParent() const = 0; + virtual nsIContent *GetBindingParent() const = 0; /** * Bit-flags to pass (or'ed together) to IsContentOfType() @@ -504,14 +511,14 @@ public: * eHTML, eHTML_FORM_CONTROL, eXUL) * @return whether the content matches ALL flags passed in */ - NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags) = 0; + virtual PRBool IsContentOfType(PRUint32 aFlags) const = 0; /** * Get the event listener manager, the guy you talk to to register for events * on this element. * @param aResult the event listener manager [OUT] */ - NS_IMETHOD GetListenerManager(nsIEventListenerManager** aResult) = 0; + virtual nsresult GetListenerManager(nsIEventListenerManager** aResult) = 0; /** * Get the base URL for any relative URLs within this piece @@ -519,9 +526,9 @@ public: * but certain content carries a local base for backward * compatibility. * - * @param aBaseURL the base URL [OUT] + * @return the base URI */ - NS_IMETHOD GetBaseURL(nsIURI** aBaseURL) const = 0; + virtual already_AddRefed GetBaseURI() const = 0; /** * This method is called when the parser finishes creating the element. This @@ -550,7 +557,9 @@ public: * element and then call setAttribute() directly, at which point * DoneCreatingElement() has already been called and is out of the picture). */ - NS_IMETHOD DoneCreatingElement() = 0; + virtual void DoneCreatingElement() + { + } #ifdef DEBUG /** @@ -558,14 +567,15 @@ public: * file stream. Use aIndent as the base indent during formatting. * Returns NS_OK unless a file error occurs. */ - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0; /** * Dump the content (and anything it contains) out to the given * file stream. Use aIndent as the base indent during formatting. * Returns NS_OK unless a file error occurs. */ - NS_IMETHOD DumpContent(FILE* out = stdout, PRInt32 aIndent = 0,PRBool aDumpAll=PR_TRUE) const = 0; + virtual void DumpContent(FILE* out = stdout, PRInt32 aIndent = 0, + PRBool aDumpAll = PR_TRUE) const = 0; #endif protected: diff --git a/mozilla/content/base/public/nsIDocument.h b/mozilla/content/base/public/nsIDocument.h index 74ac4b104b6..e87890c4da4 100644 --- a/mozilla/content/base/public/nsIDocument.h +++ b/mozilla/content/base/public/nsIDocument.h @@ -103,7 +103,8 @@ class nsIScriptEventManager; //---------------------------------------------------------------------- // Document interface -class nsIDocument : public nsISupports { +class nsIDocument : public nsISupports +{ public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_IID) NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW @@ -114,26 +115,35 @@ public: virtual ~nsIDocument() { } - NS_IMETHOD StartDocumentLoad(const char* aCommand, - nsIChannel* aChannel, - nsILoadGroup* aLoadGroup, - nsISupports* aContainer, - nsIStreamListener **aDocListener, - PRBool aReset, - nsIContentSink* aSink = nsnull) = 0; + virtual nsresult StartDocumentLoad(const char* aCommand, + nsIChannel* aChannel, + nsILoadGroup* aLoadGroup, + nsISupports* aContainer, + nsIStreamListener **aDocListener, + PRBool aReset, + nsIContentSink* aSink = nsnull) = 0; - NS_IMETHOD StopDocumentLoad() = 0; + virtual void StopDocumentLoad() = 0; /** * Return the title of the document. May return null. */ - const nsAString& GetDocumentTitle() const { return mDocumentTitle; } + const nsAFlatString& GetDocumentTitle() const + { + return mDocumentTitle; + } /** - * Return the URL for the document. May return null. + * Return the URI for the document. May return null. */ - nsIURI* GetDocumentURL() const { return mDocumentURL; } - void SetDocumentURL(nsIURI* aURL) { mDocumentURL = aURL; } + nsIURI* GetDocumentURI() const + { + return mDocumentURI; + } + void SetDocumentURI(nsIURI* aURI) + { + mDocumentURI = aURI; + } /** * Return the principal responsible for this document. @@ -143,25 +153,30 @@ public: /** * Set the principal responsible for this document. */ - NS_IMETHOD SetPrincipal(nsIPrincipal *aPrincipal) = 0; - + virtual void SetPrincipal(nsIPrincipal *aPrincipal) = 0; + /** * Return the LoadGroup for the document. May return null. */ - already_AddRefed GetDocumentLoadGroup() const { + already_AddRefed GetDocumentLoadGroup() const + { nsILoadGroup *group = nsnull; if (mDocumentLoadGroup) CallQueryReferent(mDocumentLoadGroup.get(), &group); + return group; } /** - * Return the base URL for relative URLs in the document (the document url - * unless it's overridden by SetBaseURL, HTML tags, etc.). The - * returned URL could be null if there is no document URL. + * Return the base URI for relative URIs in the document (the document uri + * unless it's overridden by SetBaseURI, HTML tags, etc.). The + * returned URI could be null if there is no document URI. */ - nsIURI* GetBaseURL() const { return mDocumentBaseURL ? mDocumentBaseURL : mDocumentURL; } - NS_IMETHOD SetBaseURL(nsIURI* aURL) = 0; + nsIURI* GetBaseURI() const + { + return mDocumentBaseURI ? mDocumentBaseURI : mDocumentURI; + } + virtual nsresult SetBaseURI(nsIURI* aURI) = 0; /** * Get/Set the base target of a link in a document. @@ -174,7 +189,10 @@ public: * will trigger a startDocumentLoad if necessary to answer the * question. */ - const nsACString& GetDocumentCharacterSet() const { return mCharacterSet; } + const nsAFlatCString& GetDocumentCharacterSet() const + { + return mCharacterSet; + } /** * Set the document's character encoding. |aCharSetID| should be canonical. @@ -182,18 +200,25 @@ public: */ virtual void SetDocumentCharacterSet(const nsACString& aCharSetID) = 0; - PRInt32 GetDocumentCharacterSetSource() const { return mCharacterSetSource; } - void SetDocumentCharacterSetSource(PRInt32 aCharsetSource) { mCharacterSetSource = aCharsetSource; } + PRInt32 GetDocumentCharacterSetSource() const + { + return mCharacterSetSource; + } + + void SetDocumentCharacterSetSource(PRInt32 aCharsetSource) + { + mCharacterSetSource = aCharsetSource; + } /** * Add an observer that gets notified whenever the charset changes. */ - NS_IMETHOD AddCharSetObserver(nsIObserver* aObserver) = 0; + virtual nsresult AddCharSetObserver(nsIObserver* aObserver) = 0; /** * Remove a charset observer. */ - NS_IMETHOD RemoveCharSetObserver(nsIObserver* aObserver) = 0; + virtual void RemoveCharSetObserver(nsIObserver* aObserver) = 0; /** * Get the Content-Type of this document. @@ -210,7 +235,8 @@ public: /** * Return the language of this document. */ - void GetContentLanguage(nsAString& aContentLanguage) const { + void GetContentLanguage(nsAString& aContentLanguage) const + { CopyASCIItoUCS2(mContentLanguage, aContentLanguage); } @@ -221,7 +247,10 @@ public: * Check if the document contains bidi data. * If so, we have to apply the Unicode Bidi Algorithm. */ - PRBool GetBidiEnabled() const { return mBidiEnabled; } + PRBool GetBidiEnabled() const + { + return mBidiEnabled; + } /** * Indicate the document contains bidi data. @@ -229,7 +258,10 @@ public: * it affects a frame model irreversibly, and plays even though * the document no longer contains bidi data. */ - void SetBidiEnabled(PRBool aBidiEnabled) { mBidiEnabled = aBidiEnabled; } + void SetBidiEnabled(PRBool aBidiEnabled) + { + mBidiEnabled = aBidiEnabled; + } /** * Return the Line Breaker for the document @@ -251,54 +283,64 @@ public: * presentation context (presentation contexts must not be * shared among multiple presentation shells). */ - NS_IMETHOD CreateShell(nsIPresContext* aContext, - nsIViewManager* aViewManager, - nsStyleSet* aStyleSet, - nsIPresShell** aInstancePtrResult) = 0; - NS_IMETHOD_(PRBool) DeleteShell(nsIPresShell* aShell) = 0; - NS_IMETHOD_(PRUint32) GetNumberOfShells() const = 0; - NS_IMETHOD_(nsIPresShell *) GetShellAt(PRUint32 aIndex) const = 0; + virtual nsresult CreateShell(nsIPresContext* aContext, + nsIViewManager* aViewManager, + nsStyleSet* aStyleSet, + nsIPresShell** aInstancePtrResult) = 0; + virtual PRBool DeleteShell(nsIPresShell* aShell) = 0; + virtual PRUint32 GetNumberOfShells() const = 0; + virtual nsIPresShell *GetShellAt(PRUint32 aIndex) const = 0; /** * Return the parent document of this document. Will return null * unless this document is within a compound document and has a * parent. Note that this parent chain may cross chrome boundaries. */ - nsIDocument* GetParentDocument() const { return mParentDocument; } + nsIDocument *GetParentDocument() const + { + return mParentDocument; + } /** * Set the parent document of this document. */ - void SetParentDocument(nsIDocument* aParent) { mParentDocument = aParent; } + void SetParentDocument(nsIDocument* aParent) + { + mParentDocument = aParent; + } /** * Set the sub document for aContent to aSubDoc. */ - NS_IMETHOD SetSubDocumentFor(nsIContent *aContent, nsIDocument* aSubDoc) = 0; + virtual nsresult SetSubDocumentFor(nsIContent *aContent, + nsIDocument* aSubDoc) = 0; /** * Get the sub document for aContent */ - virtual nsIDocument* GetSubDocumentFor(nsIContent *aContent) const = 0; + virtual nsIDocument *GetSubDocumentFor(nsIContent *aContent) const = 0; /** * Find the content node for which aDocument is a sub document. */ - virtual nsIContent* FindContentForSubDocument(nsIDocument *aDocument) const = 0; + virtual nsIContent *FindContentForSubDocument(nsIDocument *aDocument) const = 0; /** * Return the root content object for this document. */ - nsIContent* GetRootContent() const { return mRootContent; } + nsIContent *GetRootContent() const + { + return mRootContent; + } virtual void SetRootContent(nsIContent* aRoot) = 0; /** * Get the direct children of the document - content in * the prolog, the root content and content in the epilog. */ - NS_IMETHOD_(nsIContent *) GetChildAt(PRUint32 aIndex) const = 0; - NS_IMETHOD_(PRInt32) IndexOf(nsIContent* aPossibleChild) const = 0; - NS_IMETHOD_(PRUint32) GetChildCount() const = 0; + virtual nsIContent *GetChildAt(PRUint32 aIndex) const = 0; + virtual PRInt32 IndexOf(nsIContent* aPossibleChild) const = 0; + virtual PRUint32 GetChildCount() const = 0; /** * Accessors to the collection of stylesheets owned by this document. @@ -335,8 +377,7 @@ public: * adjusted for the "special" sheets. * @throws no exceptions */ - NS_IMETHOD InsertStyleSheetAt(nsIStyleSheet* aSheet, - PRInt32 aIndex) = 0; + virtual void InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex) = 0; /** * Get the index of a particular stylesheet. This will _always_ @@ -449,20 +490,28 @@ public: virtual void StyleRuleRemoved(nsIStyleSheet* aStyleSheet, nsIStyleRule* aStyleRule) = 0; - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, - nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, - PRUint32 aFlags, - nsEventStatus* aEventStatus) = 0; + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus) = 0; virtual void FlushPendingNotifications(PRBool aFlushReflows=PR_TRUE, PRBool aUpdateViews=PR_FALSE) = 0; - PRInt32 GetAndIncrementContentID() { return mNextContentID++; } + PRInt32 GetAndIncrementContentID() + { + return mNextContentID++; + } - nsIBindingManager* GetBindingManager() const { return mBindingManager; } + nsIBindingManager* GetBindingManager() const + { + return mBindingManager; + } - nsINodeInfoManager* GetNodeInfoManager() const { return mNodeInfoManager; } + nsINodeInfoManager* GetNodeInfoManager() const + { + return mNodeInfoManager; + } virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) = 0; virtual void ResetToURI(nsIURI *aURI, nsILoadGroup* aLoadGroup) = 0; @@ -473,17 +522,20 @@ public: /** * Set the container (docshell) for this document. */ - void SetContainer(nsISupports *aContainer) { + void SetContainer(nsISupports *aContainer) + { mDocumentContainer = do_GetWeakReference(aContainer); } /** * Get the container (docshell) for this document. */ - already_AddRefed GetContainer() const { + already_AddRefed GetContainer() const + { nsISupports* container = nsnull; if (mDocumentContainer) CallQueryReferent(mDocumentContainer.get(), &container); + return container; } @@ -500,14 +552,17 @@ public: nsAString& aEncoding, nsAString& Standalone) = 0; - NS_IMETHOD_(PRBool) IsCaseSensitive() = 0; + virtual PRBool IsCaseSensitive() + { + return PR_TRUE; + } - NS_IMETHOD_(PRBool) IsScriptEnabled() = 0; + virtual PRBool IsScriptEnabled() = 0; protected: nsString mDocumentTitle; - nsCOMPtr mDocumentURL; - nsCOMPtr mDocumentBaseURL; + nsCOMPtr mDocumentURI; + nsCOMPtr mDocumentBaseURI; nsWeakPtr mDocumentLoadGroup; diff --git a/mozilla/content/base/src/nsCommentNode.cpp b/mozilla/content/base/src/nsCommentNode.cpp index f337b30e174..75da06cdbfd 100644 --- a/mozilla/content/base/src/nsCommentNode.cpp +++ b/mozilla/content/base/src/nsCommentNode.cpp @@ -66,11 +66,11 @@ public: virtual nsIAtom *Tag() const; #ifdef DEBUG - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; - NS_IMETHOD DumpContent(FILE* out = stdout, PRInt32 aIndent = 0, - PRBool aDumpAll = PR_TRUE) const + virtual void List(FILE* out, PRInt32 aIndent) const; + virtual void DumpContent(FILE* out = stdout, PRInt32 aIndent = 0, + PRBool aDumpAll = PR_TRUE) const { - return NS_OK; + return; } #endif @@ -173,7 +173,7 @@ nsCommentNode::CloneContent(PRBool aCloneText, nsITextContent** aReturn) } #ifdef DEBUG -NS_IMETHODIMP +void nsCommentNode::List(FILE* out, PRInt32 aIndent) const { NS_PRECONDITION(mDocument, "bad content"); @@ -188,6 +188,5 @@ nsCommentNode::List(FILE* out, PRInt32 aIndent) const fputs(NS_LossyConvertUCS2toASCII(tmp).get(), out); fputs("-->\n", out); - return NS_OK; } #endif diff --git a/mozilla/content/base/src/nsContentAreaDragDrop.cpp b/mozilla/content/base/src/nsContentAreaDragDrop.cpp index 36263d3637c..60fac2fb78d 100644 --- a/mozilla/content/base/src/nsContentAreaDragDrop.cpp +++ b/mozilla/content/base/src/nsContentAreaDragDrop.cpp @@ -996,8 +996,7 @@ nsTransferableFactory::GetAnchorURL(nsIDOMNode* inNode, nsAString& outURL) if (value.Equals(NS_LITERAL_STRING("simple"))) { content->GetAttr(kNameSpaceID_XLink, nsHTMLAtoms::href, value); if (!value.IsEmpty()) { - nsCOMPtr baseURI; - content->GetBaseURL(getter_AddRefs(baseURI)); + nsCOMPtr baseURI = content->GetBaseURI(); if (baseURI) { nsCAutoString absoluteSpec; baseURI->Resolve(NS_ConvertUCS2toUTF8(value), absoluteSpec); diff --git a/mozilla/content/base/src/nsContentSink.cpp b/mozilla/content/base/src/nsContentSink.cpp index 4e2ac235d06..3b992cadd17 100644 --- a/mozilla/content/base/src/nsContentSink.cpp +++ b/mozilla/content/base/src/nsContentSink.cpp @@ -150,21 +150,21 @@ nsContentSink::~nsContentSink() nsresult nsContentSink::Init(nsIDocument* aDoc, - nsIURI* aURL, + nsIURI* aURI, nsISupports* aContainer, nsIChannel* aChannel) { NS_PRECONDITION(aDoc, "null ptr"); - NS_PRECONDITION(aURL, "null ptr"); + NS_PRECONDITION(aURI, "null ptr"); - if (!aDoc || !aURL) { + if (!aDoc || !aURI) { return NS_ERROR_NULL_POINTER; } mDocument = aDoc; - mDocumentURL = aURL; - mDocumentBaseURL = aURL; + mDocumentURI = aURI; + mDocumentBaseURI = aURI; mDocShell = do_QueryInterface(aContainer); // use this to avoid a circular reference sink->document->scriptloader->sink @@ -404,11 +404,11 @@ nsContentSink::ProcessHeaderData(nsIAtom* aHeader, const nsAString& aValue, } else if (aHeader == nsHTMLAtoms::contentLocation) { nsCOMPtr newBase; - rv = NS_NewURI(getter_AddRefs(newBase), aValue, nsnull, mDocumentBaseURL); + rv = NS_NewURI(getter_AddRefs(newBase), aValue, nsnull, mDocumentBaseURI); if (NS_SUCCEEDED(rv)) { - rv = mDocument->SetBaseURL(newBase); // does security check + rv = mDocument->SetBaseURI(newBase); // does security check if (NS_SUCCEEDED(rv)) { - mDocumentBaseURL = mDocument->GetBaseURL(); + mDocumentBaseURI = mDocument->GetBaseURI(); } } } @@ -669,10 +669,10 @@ nsContentSink::ProcessStyleLink(nsIContent* aElement, } nsCOMPtr url; - nsresult rv = NS_NewURI(getter_AddRefs(url), aHref, nsnull, mDocumentBaseURL); + nsresult rv = NS_NewURI(getter_AddRefs(url), aHref, nsnull, mDocumentBaseURI); if (NS_FAILED(rv)) { - // The URL is bad, move along, don't propagate the error (for now) + // The URI is bad, move along, don't propagate the error (for now) return NS_OK; } @@ -760,9 +760,9 @@ nsContentSink::PrefetchHref(const nsAString &aHref, PRBool aExplicit) nsCOMPtr uri; NS_NewURI(getter_AddRefs(uri), aHref, charset.IsEmpty() ? nsnull : PromiseFlatCString(charset).get(), - mDocumentBaseURL); + mDocumentBaseURI); if (uri) { - prefetchService->PrefetchURI(uri, mDocumentURL, aExplicit); + prefetchService->PrefetchURI(uri, mDocumentURI, aExplicit); } } } @@ -855,7 +855,7 @@ nsContentSink::ScrollToRef(PRBool aReallyScroll) rv = NS_ERROR_FAILURE; } - // If UTF-8 URL failed then try to assume the string as a + // If UTF-8 URI failed then try to assume the string as a // document's charset. if (NS_FAILED(rv)) { diff --git a/mozilla/content/base/src/nsContentSink.h b/mozilla/content/base/src/nsContentSink.h index b3e91fcbf84..52930ff8e32 100644 --- a/mozilla/content/base/src/nsContentSink.h +++ b/mozilla/content/base/src/nsContentSink.h @@ -73,7 +73,7 @@ protected: nsContentSink(); virtual ~nsContentSink(); - nsresult Init(nsIDocument* aDoc, nsIURI* aURL, + nsresult Init(nsIDocument* aDoc, nsIURI* aURI, nsISupports* aContainer, nsIChannel* aChannel); nsresult ProcessHTTPHeaders(nsIChannel* aChannel); @@ -103,8 +103,8 @@ protected: nsCOMPtr mDocument; nsCOMPtr mParser; - nsCOMPtr mDocumentURL; - nsCOMPtr mDocumentBaseURL; + nsCOMPtr mDocumentURI; + nsCOMPtr mDocumentBaseURI; nsCOMPtr mDocShell; nsCOMPtr mCSSLoader; nsCOMPtr mNodeInfoManager; diff --git a/mozilla/content/base/src/nsDocument.cpp b/mozilla/content/base/src/nsDocument.cpp index 4957c8352ed..8bb2b7db753 100644 --- a/mozilla/content/base/src/nsDocument.cpp +++ b/mozilla/content/base/src/nsDocument.cpp @@ -722,8 +722,8 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup) // Release the stylesheets list. mDOMStyleSheets = nsnull; - mDocumentURL = aURI; - mDocumentBaseURL = mDocumentURL; + mDocumentURI = aURI; + mDocumentBaseURI = mDocumentURI; if (aLoadGroup) { mDocumentLoadGroup = do_GetWeakReference(aLoadGroup); @@ -739,7 +739,7 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup) mXMLDeclarationBits = 0; } -NS_IMETHODIMP +nsresult nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup, nsISupports* aContainer, @@ -766,10 +766,9 @@ nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, return NS_OK; } -NS_IMETHODIMP +void nsDocument::StopDocumentLoad() { - return NS_OK; } NS_IMETHODIMP @@ -795,8 +794,8 @@ nsDocument::GetPrincipal() do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); if (NS_FAILED(rv)) return nsnull; - NS_WARN_IF_FALSE(mDocumentURL, "no URL!"); - rv = securityManager->GetCodebasePrincipal(mDocumentURL, + NS_WARN_IF_FALSE(mDocumentURI, "no URI!"); + rv = securityManager->GetCodebasePrincipal(mDocumentURI, getter_AddRefs(mPrincipal)); if (NS_FAILED(rv)) { @@ -815,12 +814,10 @@ nsDocument::GetPrincipal(nsIPrincipal **aPrincipal) return *aPrincipal ? NS_OK : NS_ERROR_FAILURE; } -NS_IMETHODIMP +void nsDocument::SetPrincipal(nsIPrincipal *aNewPrincipal) { mPrincipal = aNewPrincipal; - - return NS_OK; } NS_IMETHODIMP @@ -841,21 +838,21 @@ nsDocument::SetContentType(const nsAString& aContentType) CopyUTF16toUTF8(aContentType, mContentType); } -NS_IMETHODIMP -nsDocument::SetBaseURL(nsIURI* aURL) +nsresult +nsDocument::SetBaseURI(nsIURI* aURI) { nsresult rv = NS_OK; - if (aURL) { + if (aURI) { nsIScriptSecurityManager* securityManager = nsContentUtils::GetSecurityManager(); - rv = securityManager->CheckLoadURI(mDocumentURL, aURL, + rv = securityManager->CheckLoadURI(mDocumentURI, aURI, nsIScriptSecurityManager::STANDARD); if (NS_SUCCEEDED(rv)) { - mDocumentBaseURL = aURL; + mDocumentBaseURI = aURI; } } else { - mDocumentBaseURL = nsnull; + mDocumentBaseURI = nsnull; } return rv; @@ -900,7 +897,7 @@ nsDocument::SetDocumentCharacterSet(const nsACString& aCharSetID) } } -NS_IMETHODIMP +nsresult nsDocument::AddCharSetObserver(nsIObserver* aObserver) { NS_ENSURE_ARG_POINTER(aObserver); @@ -910,14 +907,10 @@ nsDocument::AddCharSetObserver(nsIObserver* aObserver) return NS_OK; } -NS_IMETHODIMP +void nsDocument::RemoveCharSetObserver(nsIObserver* aObserver) { - NS_ENSURE_ARG_POINTER(aObserver); - - NS_ENSURE_TRUE(mCharSetObservers.RemoveElement(aObserver), NS_ERROR_FAILURE); - - return NS_OK; + mCharSetObservers.RemoveElement(aObserver); } nsILineBreaker* @@ -1048,7 +1041,7 @@ nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsAString& aData) } } -NS_IMETHODIMP +nsresult nsDocument::CreateShell(nsIPresContext* aContext, nsIViewManager* aViewManager, nsStyleSet* aStyleSet, nsIPresShell** aInstancePtrResult) @@ -1089,13 +1082,13 @@ nsDocument::DeleteShell(nsIPresShell* aShell) return mPresShells.RemoveElement(aShell); } -NS_IMETHODIMP_(PRUint32) +PRUint32 nsDocument::GetNumberOfShells() const { return mPresShells.Count(); } -NS_IMETHODIMP_(nsIPresShell *) +nsIPresShell * nsDocument::GetShellAt(PRUint32 aIndex) const { return (nsIPresShell*)mPresShells.SafeElementAt(aIndex); @@ -1125,7 +1118,7 @@ SubDocInitEntry(PLDHashTable *table, PLDHashEntryHdr *entry, const void *key) return PR_TRUE; } -NS_IMETHODIMP +nsresult nsDocument::SetSubDocumentFor(nsIContent *aContent, nsIDocument* aSubDoc) { NS_ENSURE_TRUE(aContent, NS_ERROR_UNEXPECTED); @@ -1260,7 +1253,7 @@ nsDocument::SetRootContent(nsIContent* aRoot) mRootContent = aRoot; } -NS_IMETHODIMP_(nsIContent *) +nsIContent * nsDocument::GetChildAt(PRUint32 aIndex) const { if (aIndex >= (PRUint32)mChildren.Count()) { @@ -1270,13 +1263,13 @@ nsDocument::GetChildAt(PRUint32 aIndex) const return mChildren[aIndex]; } -NS_IMETHODIMP_(PRInt32) +PRInt32 nsDocument::IndexOf(nsIContent* aPossibleChild) const { return mChildren.IndexOf(aPossibleChild); } -NS_IMETHODIMP_(PRUint32) +PRUint32 nsDocument::GetChildCount() const { return mChildren.Count(); @@ -1476,7 +1469,7 @@ nsDocument::InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex) mStyleSheets.InsertObjectAt(aSheet, aIndex); } -NS_IMETHODIMP +void nsDocument::InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex) { NS_PRECONDITION(aSheet, "null ptr"); @@ -1500,7 +1493,6 @@ nsDocument::InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex) observer->StyleSheetAdded(this, aSheet); } - return NS_OK; } @@ -2041,7 +2033,7 @@ nsDocument::GetImplementation(nsIDOMDOMImplementation** aImplementation) { // For now, create a new implementation every time. This shouldn't // be a high bandwidth operation - *aImplementation = new nsDOMImplementation(mDocumentURL); + *aImplementation = new nsDOMImplementation(mDocumentURI); if (!*aImplementation) { return NS_ERROR_OUT_OF_MEMORY; } @@ -2326,7 +2318,7 @@ nsDocument::ImportNode(nsIDOMNode* aImportedNode, } NS_IMETHODIMP -nsDocument::AddBinding(nsIDOMElement* aContent, const nsAString& aURL) +nsDocument::AddBinding(nsIDOMElement* aContent, const nsAString& aURI) { nsresult rv = nsContentUtils::CheckSameOrigin(this, aContent); if (NS_FAILED(rv)) { @@ -2336,12 +2328,12 @@ nsDocument::AddBinding(nsIDOMElement* aContent, const nsAString& aURL) nsCOMPtr content(do_QueryInterface(aContent)); nsCOMPtr uri; - NS_NewURI(getter_AddRefs(uri), aURL); + NS_NewURI(getter_AddRefs(uri), aURI); return mBindingManager->AddLayeredBinding(content, uri); } NS_IMETHODIMP -nsDocument::RemoveBinding(nsIDOMElement* aContent, const nsAString& aURL) +nsDocument::RemoveBinding(nsIDOMElement* aContent, const nsAString& aURI) { nsresult rv = nsContentUtils::CheckSameOrigin(this, aContent); if (NS_FAILED(rv)) { @@ -2351,7 +2343,7 @@ nsDocument::RemoveBinding(nsIDOMElement* aContent, const nsAString& aURL) if (mBindingManager) { nsCOMPtr content(do_QueryInterface(aContent)); nsCOMPtr uri; - NS_NewURI(getter_AddRefs(uri), aURL); + NS_NewURI(getter_AddRefs(uri), aURI); return mBindingManager->RemoveLayeredBinding(content, uri); } @@ -2359,7 +2351,7 @@ nsDocument::RemoveBinding(nsIDOMElement* aContent, const nsAString& aURL) } NS_IMETHODIMP -nsDocument::LoadBindingDocument(const nsAString& aURL, +nsDocument::LoadBindingDocument(const nsAString& aURI, nsIDOMDocument** aResult) { if (!mBindingManager) { @@ -2367,8 +2359,9 @@ nsDocument::LoadBindingDocument(const nsAString& aURL, } nsCOMPtr uri; - nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL, - mCharacterSet.get(), GetBaseURL()); + nsresult rv = NS_NewURI(getter_AddRefs(uri), aURI, + mCharacterSet.get(), + NS_STATIC_CAST(nsIDocument *, this)->GetBaseURI()); NS_ENSURE_SUCCESS(rv, rv); @@ -3166,8 +3159,8 @@ NS_IMETHODIMP nsDocument::GetBaseURI(nsAString &aURI) { nsCAutoString spec; - if (mDocumentBaseURL) { - mDocumentBaseURL->GetSpec(spec); + if (mDocumentBaseURI) { + mDocumentBaseURI->GetSpec(spec); } CopyUTF8toUTF16(spec, aURI); @@ -3413,9 +3406,9 @@ nsDocument::SetStrictErrorChecking(PRBool aStrictErrorChecking) NS_IMETHODIMP nsDocument::GetDocumentURI(nsAString& aDocumentURI) { - if (mDocumentURL) { + if (mDocumentURI) { nsCAutoString uri; - mDocumentURL->GetSpec(uri); + mDocumentURI->GetSpec(uri); CopyUTF8toUTF16(uri, aDocumentURI); } else { SetDOMStringToNull(aDocumentURI); @@ -3428,7 +3421,7 @@ NS_IMETHODIMP nsDocument::SetDocumentURI(const nsAString& aDocumentURI) { // Not allowing this yet, need to think about security ramifications first. - // We use mDocumentURL to get principals for this document. + // We use mDocumentURI to get principals for this document. return NS_ERROR_NOT_IMPLEMENTED; } @@ -3885,13 +3878,7 @@ nsDocument::GetXMLDeclaration(nsAString& aVersion, nsAString& aEncoding, } } -NS_IMETHODIMP_(PRBool) -nsDocument::IsCaseSensitive() -{ - return PR_TRUE; -} - -NS_IMETHODIMP_(PRBool) +PRBool nsDocument::IsScriptEnabled() { nsCOMPtr sm(do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID)); diff --git a/mozilla/content/base/src/nsDocument.h b/mozilla/content/base/src/nsDocument.h index dbdcf470cea..d5aa0550711 100644 --- a/mozilla/content/base/src/nsDocument.h +++ b/mozilla/content/base/src/nsDocument.h @@ -249,15 +249,15 @@ public: virtual void Reset(nsIChannel *aChannel, nsILoadGroup *aLoadGroup); virtual void ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup); - NS_IMETHOD StartDocumentLoad(const char* aCommand, - nsIChannel* aChannel, - nsILoadGroup* aLoadGroup, - nsISupports* aContainer, - nsIStreamListener **aDocListener, - PRBool aReset = PR_TRUE, - nsIContentSink* aContentSink = nsnull); + virtual nsresult StartDocumentLoad(const char* aCommand, + nsIChannel* aChannel, + nsILoadGroup* aLoadGroup, + nsISupports* aContainer, + nsIStreamListener **aDocListener, + PRBool aReset = PR_TRUE, + nsIContentSink* aContentSink = nsnull); - NS_IMETHOD StopDocumentLoad(); + virtual void StopDocumentLoad(); /** * Return the principal responsible for this document. @@ -267,7 +267,7 @@ public: /** * Set the principal responsible for this document. */ - NS_IMETHOD SetPrincipal(nsIPrincipal *aPrincipal); + virtual void SetPrincipal(nsIPrincipal *aPrincipal); /** * Get the Content-Type of this document. @@ -280,10 +280,7 @@ public: */ virtual void SetContentType(const nsAString& aContentType); - /** - * Return the base URL for relative URLs in the document. May return null (or the document URL). - */ - NS_IMETHOD SetBaseURL(nsIURI* aURL); + virtual nsresult SetBaseURI(nsIURI* aURI); /** * Get/Set the base target of a link in a document. @@ -300,12 +297,12 @@ public: /** * Add an observer that gets notified whenever the charset changes. */ - NS_IMETHOD AddCharSetObserver(nsIObserver* aObserver); + virtual nsresult AddCharSetObserver(nsIObserver* aObserver); /** * Remove a charset observer. */ - NS_IMETHOD RemoveCharSetObserver(nsIObserver* aObserver); + virtual void RemoveCharSetObserver(nsIObserver* aObserver); /** * Return the Line Breaker for the document @@ -328,15 +325,16 @@ public: * it's presentation context (presentation context's must not be * shared among multiple presentation shell's). */ - NS_IMETHOD CreateShell(nsIPresContext* aContext, - nsIViewManager* aViewManager, - nsStyleSet* aStyleSet, - nsIPresShell** aInstancePtrResult); - NS_IMETHOD_(PRBool) DeleteShell(nsIPresShell* aShell); - NS_IMETHOD_(PRUint32) GetNumberOfShells() const; - NS_IMETHOD_(nsIPresShell *) GetShellAt(PRUint32 aIndex) const; + virtual nsresult CreateShell(nsIPresContext* aContext, + nsIViewManager* aViewManager, + nsStyleSet* aStyleSet, + nsIPresShell** aInstancePtrResult); + virtual PRBool DeleteShell(nsIPresShell* aShell); + virtual PRUint32 GetNumberOfShells() const; + virtual nsIPresShell *GetShellAt(PRUint32 aIndex) const; - NS_IMETHOD SetSubDocumentFor(nsIContent *aContent, nsIDocument* aSubDoc); + virtual nsresult SetSubDocumentFor(nsIContent *aContent, + nsIDocument* aSubDoc); virtual nsIDocument* GetSubDocumentFor(nsIContent *aContent) const; virtual nsIContent* FindContentForSubDocument(nsIDocument *aDocument) const; @@ -346,9 +344,9 @@ public: * Get the direct children of the document - content in * the prolog, the root content and content in the epilog. */ - NS_IMETHOD_(nsIContent *) GetChildAt(PRUint32 aIndex) const; - NS_IMETHOD_(PRInt32) IndexOf(nsIContent* aPossibleChild) const; - NS_IMETHOD_(PRUint32) GetChildCount() const; + virtual nsIContent *GetChildAt(PRUint32 aIndex) const; + virtual PRInt32 IndexOf(nsIContent* aPossibleChild) const; + virtual PRUint32 GetChildCount() const; /** * Get the style sheets owned by this document. @@ -366,7 +364,7 @@ public: virtual void AddStyleSheetToStyleSets(nsIStyleSheet* aSheet); virtual void RemoveStyleSheetFromStyleSets(nsIStyleSheet* aSheet); - NS_IMETHOD InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex); + virtual void InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex); virtual void SetStyleSheetApplicableState(nsIStyleSheet* aSheet, PRBool aApplicable); @@ -447,8 +445,12 @@ public: virtual void GetXMLDeclaration(nsAString& aVersion, nsAString& aEncoding, nsAString& Standalone); - NS_IMETHOD_(PRBool) IsCaseSensitive(); - NS_IMETHOD_(PRBool) IsScriptEnabled(); + virtual PRBool IsScriptEnabled(); + + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus); // nsIRadioGroupContainer NS_IMETHOD WalkRadioGroup(const nsAString& aName, @@ -523,10 +525,6 @@ public: // nsIScriptObjectPrincipal NS_IMETHOD GetPrincipal(nsIPrincipal **aPrincipal); - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, PRUint32 aFlags, - nsEventStatus* aEventStatus); - virtual nsresult Init(); protected: diff --git a/mozilla/content/base/src/nsDocumentFragment.cpp b/mozilla/content/base/src/nsDocumentFragment.cpp index 995e1220a2e..368d27135c9 100644 --- a/mozilla/content/base/src/nsDocumentFragment.cpp +++ b/mozilla/content/base/src/nsDocumentFragment.cpp @@ -127,44 +127,49 @@ public: NS_DECL_NSIDOM3NODE // nsIContent - NS_IMETHOD_(void) SetParent(nsIContent* aParent) { } - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, - PRBool aNotify) - { return NS_OK; } - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, - const nsAString& aValue, - PRBool aNotify) - { return NS_OK; } - NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsAString& aResult) const - { return NS_CONTENT_ATTR_NOT_THERE; } - NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom** aPrefix, nsAString& aResult) const - { return NS_CONTENT_ATTR_NOT_THERE; } - NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRBool aNotify) - { return NS_OK; } - NS_IMETHOD GetAttrNameAt(PRUint32 aIndex, - PRInt32* aNameSpaceID, - nsIAtom** aName, - nsIAtom** aPrefix) const - { - *aNameSpaceID = kNameSpaceID_None; - *aName = nsnull; - *aPrefix = nsnull; - return NS_ERROR_ILLEGAL_VALUE; - } - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, - nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, - PRUint32 aFlags, - nsEventStatus* aEventStatus) - { - NS_ENSURE_ARG_POINTER(aEventStatus); - *aEventStatus = nsEventStatus_eIgnore; - return NS_OK; - } + virtual void SetParent(nsIContent* aParent) { } + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, + PRBool aNotify) + { + return NS_OK; + } + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify) + { + return NS_OK; + } + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsAString& aResult) const + { + return NS_CONTENT_ATTR_NOT_THERE; + } + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsIAtom** aPrefix, nsAString& aResult) const + { + return NS_CONTENT_ATTR_NOT_THERE; + } + virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify) + { + return NS_OK; + } + virtual nsresult GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, + nsIAtom** aName, nsIAtom** aPrefix) const + { + *aNameSpaceID = kNameSpaceID_None; + *aName = nsnull; + *aPrefix = nsnull; + return NS_ERROR_ILLEGAL_VALUE; + } + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, nsEventStatus* aEventStatus) + { + NS_ENSURE_ARG_POINTER(aEventStatus); + *aEventStatus = nsEventStatus_eIgnore; + return NS_OK; + } protected: nsCOMPtr mOwnerDocument; diff --git a/mozilla/content/base/src/nsFrameLoader.cpp b/mozilla/content/base/src/nsFrameLoader.cpp index 9ce1a0e918a..93c32bc54a1 100644 --- a/mozilla/content/base/src/nsFrameLoader.cpp +++ b/mozilla/content/base/src/nsFrameLoader.cpp @@ -173,7 +173,7 @@ nsFrameLoader::LoadFrame() } // Make an absolute URI - nsIURI *base_uri = doc->GetBaseURL(); + nsIURI *base_uri = doc->GetBaseURI(); const nsACString &doc_charset = doc->GetDocumentCharacterSet(); diff --git a/mozilla/content/base/src/nsGenericDOMDataNode.cpp b/mozilla/content/base/src/nsGenericDOMDataNode.cpp index 8f59c2f43b2..2fc51c78a64 100644 --- a/mozilla/content/base/src/nsGenericDOMDataNode.cpp +++ b/mozilla/content/base/src/nsGenericDOMDataNode.cpp @@ -278,16 +278,16 @@ nsGenericDOMDataNode::IsSupported(const nsAString& aFeature, nsresult nsGenericDOMDataNode::GetBaseURI(nsAString& aURI) { - nsCOMPtr baseURI; - nsresult rv = GetBaseURL(getter_AddRefs(baseURI)); - + nsCOMPtr baseURI = GetBaseURI(); nsCAutoString spec; - if (NS_SUCCEEDED(rv) && baseURI) { + + if (baseURI) { baseURI->GetSpec(spec); } + CopyUTF8toUTF16(spec, aURI); - return rv; + return NS_OK; } nsresult @@ -524,8 +524,8 @@ nsGenericDOMDataNode::ReplaceData(PRUint32 aOffset, PRUint32 aCount, //---------------------------------------------------------------------- -NS_IMETHODIMP -nsGenericDOMDataNode::GetListenerManager(nsIEventListenerManager** aResult) +nsresult +nsGenericDOMDataNode::GetListenerManager(nsIEventListenerManager **aResult) { nsCOMPtr listener_manager; LookupListenerManager(getter_AddRefs(listener_manager)); @@ -561,11 +561,6 @@ nsGenericDOMDataNode::GetListenerManager(nsIEventListenerManager** aResult) return NS_OK; } -NS_IMETHODIMP -nsGenericDOMDataNode::DoneCreatingElement() -{ - return NS_OK; -} //---------------------------------------------------------------------- // Implementation of nsIContent @@ -619,7 +614,7 @@ nsGenericDOMDataNode::ToCString(nsAString& aBuf, PRInt32 aOffset, } #endif -NS_IMETHODIMP +void nsGenericDOMDataNode::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) { @@ -628,11 +623,9 @@ nsGenericDOMDataNode::SetDocument(nsIDocument* aDocument, PRBool aDeep, if (mDocument && mText.IsBidi()) { mDocument->SetBidiEnabled(PR_TRUE); } - - return NS_OK; } -NS_IMETHODIMP_(void) +void nsGenericDOMDataNode::SetParent(nsIContent* aParent) { PtrBits new_bits = NS_REINTERPRET_CAST(PtrBits, aParent); @@ -642,66 +635,65 @@ nsGenericDOMDataNode::SetParent(nsIContent* aParent) mParentPtrBits = new_bits; } -NS_IMETHODIMP_(PRBool) +PRBool nsGenericDOMDataNode::IsNativeAnonymous() const { nsIContent* parent = GetParent(); return parent && parent->IsNativeAnonymous(); } -NS_IMETHODIMP_(void) +void nsGenericDOMDataNode::SetNativeAnonymous(PRBool aAnonymous) { // XXX Need to fix this to do something - bug 165110 } -NS_IMETHODIMP +void nsGenericDOMDataNode::GetNameSpaceID(PRInt32* aID) const { *aID = kNameSpaceID_None; - return NS_OK; } -NS_IMETHODIMP_(nsIAtom*) +nsIAtom * nsGenericDOMDataNode::GetIDAttributeName() const { return nsnull; } -NS_IMETHODIMP_(nsIAtom*) +nsIAtom * nsGenericDOMDataNode::GetClassAttributeName() const { return nsnull; } -NS_IMETHODIMP_(already_AddRefed) -nsGenericDOMDataNode::GetExistingAttrNameFromQName(const nsAString& aStr) +already_AddRefed +nsGenericDOMDataNode::GetExistingAttrNameFromQName(const nsAString& aStr) const { return nsnull; } -NS_IMETHODIMP +nsresult nsGenericDOMDataNode::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttr, const nsAString& aValue, PRBool aNotify) { return NS_OK; } -NS_IMETHODIMP +nsresult nsGenericDOMDataNode::SetAttr(nsINodeInfo *aNodeInfo, const nsAString& aValue, PRBool aNotify) { return NS_OK; } -NS_IMETHODIMP +nsresult nsGenericDOMDataNode::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttr, PRBool aNotify) { return NS_OK; } -NS_IMETHODIMP +nsresult nsGenericDOMDataNode::GetAttr(PRInt32 aNameSpaceID, nsIAtom *aAttr, nsAString& aResult) const { @@ -710,7 +702,7 @@ nsGenericDOMDataNode::GetAttr(PRInt32 aNameSpaceID, nsIAtom *aAttr, return NS_CONTENT_ATTR_NOT_THERE; } -NS_IMETHODIMP +nsresult nsGenericDOMDataNode::GetAttr(PRInt32 aNameSpaceID, nsIAtom *aAttr, nsIAtom** aPrefix, nsAString& aResult) const @@ -721,13 +713,13 @@ nsGenericDOMDataNode::GetAttr(PRInt32 aNameSpaceID, nsIAtom *aAttr, return NS_CONTENT_ATTR_NOT_THERE; } -NS_IMETHODIMP_(PRBool) +PRBool nsGenericDOMDataNode::HasAttr(PRInt32 aNameSpaceID, nsIAtom *aAttribute) const { return PR_FALSE; } -NS_IMETHODIMP +nsresult nsGenericDOMDataNode::GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, nsIAtom** aName, nsIAtom** aPrefix) const { @@ -738,13 +730,13 @@ nsGenericDOMDataNode::GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, return NS_ERROR_ILLEGAL_VALUE; } -NS_IMETHODIMP_(PRUint32) +PRUint32 nsGenericDOMDataNode::GetAttrCount() const { return 0; } -NS_IMETHODIMP +nsresult nsGenericDOMDataNode::HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, PRUint32 aFlags, @@ -835,70 +827,64 @@ nsGenericDOMDataNode::ContentID() const return 0; } -NS_IMETHODIMP -nsGenericDOMDataNode::SetContentID(PRUint32 aID) -{ - return NS_OK; -} - -NS_IMETHODIMP_(nsINodeInfo *) +nsINodeInfo * nsGenericDOMDataNode::GetNodeInfo() const { return nsnull; } -NS_IMETHODIMP_(PRBool) +PRBool nsGenericDOMDataNode::CanContainChildren() const { return PR_FALSE; } -NS_IMETHODIMP_(PRUint32) +PRUint32 nsGenericDOMDataNode::GetChildCount() const { return 0; } -NS_IMETHODIMP_(nsIContent *) +nsIContent * nsGenericDOMDataNode::GetChildAt(PRUint32 aIndex) const { return nsnull; } -NS_IMETHODIMP_(PRInt32) +PRInt32 nsGenericDOMDataNode::IndexOf(nsIContent* aPossibleChild) const { return -1; } -NS_IMETHODIMP +nsresult nsGenericDOMDataNode::InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, PRBool aDeepSetDocument) { return NS_OK; } -NS_IMETHODIMP +nsresult nsGenericDOMDataNode::ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, PRBool aDeepSetDocument) { return NS_OK; } -NS_IMETHODIMP +nsresult nsGenericDOMDataNode::AppendChildTo(nsIContent* aKid, PRBool aNotify, PRBool aDeepSetDocument) { return NS_OK; } -NS_IMETHODIMP +nsresult nsGenericDOMDataNode::RemoveChildAt(PRUint32 aIndex, PRBool aNotify) { return NS_OK; } -NS_IMETHODIMP +nsresult nsGenericDOMDataNode::RangeAdd(nsIDOMRange* aRange) { // lazy allocation of range list @@ -950,7 +936,7 @@ nsGenericDOMDataNode::RangeAdd(nsIDOMRange* aRange) } -NS_IMETHODIMP +void nsGenericDOMDataNode::RangeRemove(nsIDOMRange* aRange) { RangeListMapEntry *entry = nsnull; @@ -973,12 +959,8 @@ nsGenericDOMDataNode::RangeRemove(nsIDOMRange* aRange) SetHasRangeList(PR_FALSE); } - - return NS_OK; } } - - return NS_ERROR_FAILURE; } const nsVoidArray * @@ -987,68 +969,55 @@ nsGenericDOMDataNode::GetRangeList() const return LookupRangeList(); } -NS_IMETHODIMP -nsGenericDOMDataNode::SetFocus(nsIPresContext* aPresContext) -{ - return NS_OK; -} - -NS_IMETHODIMP -nsGenericDOMDataNode::RemoveFocus(nsIPresContext* aPresContext) -{ - return NS_OK; -} - -NS_IMETHODIMP_(nsIContent*) +nsIContent * nsGenericDOMDataNode::GetBindingParent() const { nsIContent* parent = GetParent(); return parent ? parent->GetBindingParent() : nsnull; } -NS_IMETHODIMP +nsresult nsGenericDOMDataNode::SetBindingParent(nsIContent* aParent) { return NS_OK; } -NS_IMETHODIMP_(PRBool) -nsGenericDOMDataNode::IsContentOfType(PRUint32 aFlags) +PRBool +nsGenericDOMDataNode::IsContentOfType(PRUint32 aFlags) const { return PR_FALSE; } #ifdef DEBUG -NS_IMETHODIMP +void nsGenericDOMDataNode::List(FILE* out, PRInt32 aIndent) const { - return NS_OK; } -NS_IMETHODIMP +void nsGenericDOMDataNode::DumpContent(FILE* out, PRInt32 aIndent, PRBool aDumpAll) const { - return NS_OK; } #endif -NS_IMETHODIMP -nsGenericDOMDataNode::GetBaseURL(nsIURI** aURI) const +already_AddRefed +nsGenericDOMDataNode::GetBaseURI() const { // DOM Data Node inherits the base from its parent element/document nsIContent* parent_weak = GetParent(); if (parent_weak) { - return parent_weak->GetBaseURL(aURI); + return parent_weak->GetBaseURI(); } + nsIURI *uri; if (mDocument) { - NS_IF_ADDREF(*aURI = mDocument->GetBaseURL()); + NS_IF_ADDREF(uri = mDocument->GetBaseURI()); } else { - *aURI = nsnull; + uri = nsnull; } - return NS_OK; + return uri; } //---------------------------------------------------------------------- diff --git a/mozilla/content/base/src/nsGenericDOMDataNode.h b/mozilla/content/base/src/nsGenericDOMDataNode.h index ae437816af6..34893e29fd0 100644 --- a/mozilla/content/base/src/nsGenericDOMDataNode.h +++ b/mozilla/content/base/src/nsGenericDOMDataNode.h @@ -167,64 +167,61 @@ public: const nsAString& aArg); // Implementation for nsIContent - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers); - NS_IMETHOD_(void) SetParent(nsIContent* aParent); - NS_IMETHOD_(PRBool) IsNativeAnonymous() const; - NS_IMETHOD_(void) SetNativeAnonymous(PRBool aAnonymous); - NS_IMETHOD GetNameSpaceID(PRInt32* aID) const; - NS_IMETHOD_(nsIAtom*) GetIDAttributeName() const; - NS_IMETHOD_(nsIAtom*) GetClassAttributeName() const; - NS_IMETHOD_(already_AddRefed) GetExistingAttrNameFromQName(const nsAString& aStr); - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - const nsAString& aValue, PRBool aNotify); - NS_IMETHOD SetAttr(nsINodeInfo *aNodeInfo, - const nsAString& aValue, PRBool aNotify); - NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRBool aNotify); - NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom *aAttribute, - nsAString& aResult) const; - NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom *aAttribute, - nsIAtom** aPrefix, nsAString& aResult) const; - NS_IMETHOD_(PRBool) HasAttr(PRInt32 aNameSpaceID, nsIAtom *aAttribute) const; - NS_IMETHOD GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, - nsIAtom** aName, nsIAtom** aPrefix) const; - NS_IMETHOD_(PRUint32) GetAttrCount() const; + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); + virtual void SetParent(nsIContent* aParent); + virtual PRBool IsNativeAnonymous() const; + virtual void SetNativeAnonymous(PRBool aAnonymous); + virtual void GetNameSpaceID(PRInt32* aID) const; + virtual nsIAtom *GetIDAttributeName() const; + virtual nsIAtom *GetClassAttributeName() const; + virtual already_AddRefed GetExistingAttrNameFromQName(const nsAString& aStr) const; + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + const nsAString& aValue, PRBool aNotify); + virtual nsresult SetAttr(nsINodeInfo *aNodeInfo, const nsAString& aValue, + PRBool aNotify); + virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify); + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom *aAttribute, + nsAString& aResult) const; + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom *aAttribute, + nsIAtom** aPrefix, nsAString& aResult) const; + virtual PRBool HasAttr(PRInt32 aNameSpaceID, nsIAtom *aAttribute) const; + virtual nsresult GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, + nsIAtom** aName, nsIAtom** aPrefix) const; + virtual PRUint32 GetAttrCount() const; #ifdef DEBUG - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; - NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent, PRBool aDumpAll) const; + virtual void List(FILE* out, PRInt32 aIndent) const; + virtual void DumpContent(FILE* out, PRInt32 aIndent, PRBool aDumpAll) const; #endif - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, PRUint32 aFlags, - nsEventStatus* aEventStatus); + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus); virtual PRUint32 ContentID() const; - NS_IMETHOD SetContentID(PRUint32 aID); - NS_IMETHOD RangeAdd(nsIDOMRange* aRange); - NS_IMETHOD RangeRemove(nsIDOMRange* aRange); + virtual nsresult RangeAdd(nsIDOMRange* aRange); + virtual void RangeRemove(nsIDOMRange* aRange); virtual const nsVoidArray *GetRangeList() const; - NS_IMETHOD SetFocus(nsIPresContext *aPresContext); - NS_IMETHOD RemoveFocus(nsIPresContext *aPresContext); - NS_IMETHOD_(nsIContent*) GetBindingParent() const; - NS_IMETHOD SetBindingParent(nsIContent* aParent); - NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags); + virtual nsIContent *GetBindingParent() const; + virtual nsresult SetBindingParent(nsIContent* aParent); + virtual PRBool IsContentOfType(PRUint32 aFlags) const; - NS_IMETHOD GetListenerManager(nsIEventListenerManager** aInstancePtrResult); - NS_IMETHOD GetBaseURL(nsIURI** aURI) const; - NS_IMETHOD DoneCreatingElement(); + virtual nsresult GetListenerManager(nsIEventListenerManager **aResult); + virtual already_AddRefed GetBaseURI() const; - NS_IMETHOD_(nsINodeInfo *) GetNodeInfo() const; - NS_IMETHOD_(PRBool) CanContainChildren() const; - NS_IMETHOD_(PRUint32) GetChildCount() const; - NS_IMETHOD_(nsIContent *) GetChildAt(PRUint32 aIndex) const; - NS_IMETHOD_(PRInt32) IndexOf(nsIContent* aPossibleChild) const; - NS_IMETHOD InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD RemoveChildAt(PRUint32 aIndex, PRBool aNotify); + virtual nsINodeInfo *GetNodeInfo() const; + virtual PRBool CanContainChildren() const; + virtual PRUint32 GetChildCount() const; + virtual nsIContent *GetChildAt(PRUint32 aIndex) const; + virtual PRInt32 IndexOf(nsIContent* aPossibleChild) const; + virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument); + virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify); // nsITextContent NS_IMETHOD SplitText(PRUint32 aOffset, nsIDOMText** aReturn); diff --git a/mozilla/content/base/src/nsGenericElement.cpp b/mozilla/content/base/src/nsGenericElement.cpp index 74b6651fc37..f78e1c2d621 100644 --- a/mozilla/content/base/src/nsGenericElement.cpp +++ b/mozilla/content/base/src/nsGenericElement.cpp @@ -174,14 +174,11 @@ NS_IMPL_RELEASE(nsNode3Tearoff) NS_IMETHODIMP nsNode3Tearoff::GetBaseURI(nsAString& aURI) { - nsCOMPtr uri; - - mContent->GetBaseURL(getter_AddRefs(uri)); - + nsCOMPtr baseURI = mContent->GetBaseURI(); nsCAutoString spec; - if (uri) { - uri->GetSpec(spec); + if (baseURI) { + baseURI->GetSpec(spec); } CopyUTF8toUTF16(spec, aURI); @@ -1643,7 +1640,7 @@ nsGenericElement::SetDocumentInChildrenOf(nsIContent* aContent, } } -nsresult +void nsGenericElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) { @@ -1695,12 +1692,10 @@ nsGenericElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, if (aDeep) { SetDocumentInChildrenOf(this, aDocument, aCompileEventHandlers); } - - return NS_OK; } -NS_IMETHODIMP_(void) +void nsGenericElement::SetParent(nsIContent* aParent) { nsIContent::SetParent(aParent); @@ -1711,13 +1706,13 @@ nsGenericElement::SetParent(nsIContent* aParent) } } -NS_IMETHODIMP_(PRBool) +PRBool nsGenericElement::IsNativeAnonymous() const { return !!(GetFlags() & GENERIC_ELEMENT_IS_ANONYMOUS); } -NS_IMETHODIMP_(void) +void nsGenericElement::SetNativeAnonymous(PRBool aAnonymous) { if (aAnonymous) { @@ -1727,12 +1722,10 @@ nsGenericElement::SetNativeAnonymous(PRBool aAnonymous) } } -nsresult +void nsGenericElement::GetNameSpaceID(PRInt32* aNameSpaceID) const { *aNameSpaceID = mNodeInfo->NamespaceID(); - - return NS_OK; } nsIAtom * @@ -1741,7 +1734,7 @@ nsGenericElement::Tag() const return mNodeInfo->NameAtom(); } -NS_IMETHODIMP_(nsINodeInfo *) +nsINodeInfo * nsGenericElement::GetNodeInfo() const { return mNodeInfo; @@ -1998,23 +1991,21 @@ nsGenericElement::ContentID() const return flags >> GENERIC_ELEMENT_CONTENT_ID_BITS_OFFSET; } -NS_IMETHODIMP +void nsGenericElement::SetContentID(PRUint32 aID) { + // This should be in the constructor!!! + if (HasDOMSlots() || aID > GENERIC_ELEMENT_CONTENT_ID_MAX_VALUE) { nsDOMSlots *slots = GetDOMSlots(); - if (!slots) { - return NS_ERROR_OUT_OF_MEMORY; + if (slots) { + slots->mContentID = aID; } - - slots->mContentID = aID; } else { UnsetFlags(GENERIC_ELEMENT_CONTENT_ID_MASK); SetFlags(aID << GENERIC_ELEMENT_CONTENT_ID_BITS_OFFSET); } - - return NS_OK; } NS_IMETHODIMP @@ -2080,13 +2071,13 @@ nsGenericElement::GetAttributeChangeHint(const nsIAtom* aAttribute, return NS_OK; } -NS_IMETHODIMP_(nsIAtom*) +nsIAtom * nsGenericElement::GetIDAttributeName() const { return mNodeInfo->GetIDAttributeAtom(); } -NS_IMETHODIMP_(nsIAtom*) +nsIAtom * nsGenericElement::GetClassAttributeName() const { return nsnull; @@ -2135,20 +2126,22 @@ nsGenericElement::StringToAttribute(nsIAtom* aAttribute, return NS_CONTENT_ATTR_NOT_THERE; } -NS_IMETHODIMP -nsGenericElement::GetBaseURL(nsIURI** aBaseURL) const +already_AddRefed +nsGenericElement::GetBaseURI() const { nsIDocument* doc = GetOwnerDocument(); // Our base URL depends on whether we have an xml:base attribute, as // well as on whether any of our ancestors do. nsCOMPtr parentBase; - if (GetParent()) { - GetParent()->GetBaseURL(getter_AddRefs(parentBase)); + + nsIContent *parent = GetParent(); + if (parent) { + parentBase = parent->GetBaseURI(); } else if (doc) { // No parent, so just use the document (we must be the root or not in the // tree). - parentBase = doc->GetBaseURL(); + parentBase = doc->GetBaseURI(); } // Now check for an xml:base attr @@ -2156,8 +2149,10 @@ nsGenericElement::GetBaseURL(nsIURI** aBaseURL) const nsresult rv = GetAttr(kNameSpaceID_XML, nsHTMLAtoms::base, value); if (rv != NS_CONTENT_ATTR_HAS_VALUE) { // No xml:base, so we just use the parent's base URL - NS_IF_ADDREF(*aBaseURL = parentBase); - return NS_OK; + nsIURI *base = parentBase; + NS_IF_ADDREF(base); + + return base; } nsCAutoString charset; @@ -2169,21 +2164,20 @@ nsGenericElement::GetBaseURL(nsIURI** aBaseURL) const rv = NS_NewURI(getter_AddRefs(ourBase), value, charset.get(), parentBase); if (NS_SUCCEEDED(rv)) { // do a security check, almost the same as nsDocument::SetBaseURL() - nsCOMPtr securityManager = - do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); - if (securityManager) { - rv = securityManager->CheckLoadURI(parentBase, ourBase, - nsIScriptSecurityManager::STANDARD); - } + rv = nsContentUtils::GetSecurityManager()-> + CheckLoadURI(parentBase, ourBase, nsIScriptSecurityManager::STANDARD); } - + + nsIURI *base; if (NS_FAILED(rv)) { - NS_IF_ADDREF(*aBaseURL = parentBase); + base = parentBase; } else { - NS_IF_ADDREF(*aBaseURL = ourBase); + base = ourBase; } - - return NS_OK; + + NS_IF_ADDREF(base); + + return base; } NS_IMETHODIMP @@ -2251,11 +2245,11 @@ nsGenericElement::RangeAdd(nsIDOMRange* aRange) } -nsresult +void nsGenericElement::RangeRemove(nsIDOMRange* aRange) { if (!HasRangeList()) { - return NS_ERROR_UNEXPECTED; + return; } RangeListMapEntry *entry = @@ -2267,26 +2261,21 @@ nsGenericElement::RangeRemove(nsIDOMRange* aRange) NS_ERROR("Huh, our bit says we have a range list, but there's nothing " "in the hash!?!!"); - return NS_ERROR_UNEXPECTED; + return; } if (!entry->mRangeList) { - return NS_ERROR_UNEXPECTED; + return; } // dont need to release - this call is made by the range object itself - PRBool rv = entry->mRangeList->RemoveElement(aRange); - if (!rv) { - return NS_ERROR_FAILURE; - } + entry->mRangeList->RemoveElement(aRange); if (entry->mRangeList->Count() == 0) { PL_DHashTableRawRemove(&sRangeListsHash, entry); UnsetFlags(GENERIC_ELEMENT_HAS_RANGELIST); } - - return NS_OK; } const nsVoidArray * @@ -2311,11 +2300,11 @@ nsGenericElement::GetRangeList() const return entry->mRangeList; } -nsresult +void nsGenericElement::SetFocus(nsIPresContext* aPresContext) { if (HasAttr(kNameSpaceID_None, nsHTMLAtoms::disabled)) { - return NS_OK; + return; } nsCOMPtr esm; @@ -2324,14 +2313,6 @@ nsGenericElement::SetFocus(nsIPresContext* aPresContext) if (esm) { esm->SetContentState(this, NS_EVENT_STATE_FOCUS); } - - return NS_OK; -} - -nsresult -nsGenericElement::RemoveFocus(nsIPresContext* aPresContext) -{ - return NS_OK; } nsIContent* @@ -2356,19 +2337,21 @@ nsGenericElement::SetBindingParent(nsIContent* aParent) slots->mBindingParent = aParent; // Weak, so no addref happens. + nsresult rv = NS_OK; + if (aParent) { PRUint32 count = GetChildCount(); for (PRUint32 i = 0; i < count; ++i) { - GetChildAt(i)->SetBindingParent(aParent); + rv |= GetChildAt(i)->SetBindingParent(aParent); } } - return NS_OK; + return rv; } -NS_IMETHODIMP_(PRBool) -nsGenericElement::IsContentOfType(PRUint32 aFlags) +PRBool +nsGenericElement::IsContentOfType(PRUint32 aFlags) const { return !(aFlags & ~eELEMENT); } @@ -2376,7 +2359,7 @@ nsGenericElement::IsContentOfType(PRUint32 aFlags) //---------------------------------------------------------------------- nsresult -nsGenericElement::GetListenerManager(nsIEventListenerManager** aResult) +nsGenericElement::GetListenerManager(nsIEventListenerManager **aResult) { *aResult = nsnull; @@ -2418,13 +2401,7 @@ nsGenericElement::GetListenerManager(nsIEventListenerManager** aResult) return NS_OK; } -NS_IMETHODIMP -nsGenericElement::DoneCreatingElement() -{ - return NS_OK; -} - -NS_IMETHODIMP +nsresult nsGenericElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, @@ -2460,7 +2437,7 @@ nsGenericElement::InsertChildAt(nsIContent* aKid, return NS_OK; } -NS_IMETHODIMP +nsresult nsGenericElement::ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, @@ -2504,7 +2481,7 @@ nsGenericElement::ReplaceChildAt(nsIContent* aKid, return NS_OK; } -NS_IMETHODIMP +nsresult nsGenericElement::AppendChildTo(nsIContent* aKid, PRBool aNotify, PRBool aDeepSetDocument) { @@ -2538,7 +2515,7 @@ nsGenericElement::AppendChildTo(nsIContent* aKid, PRBool aNotify, return NS_OK; } -NS_IMETHODIMP +nsresult nsGenericElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify) { nsIContent* oldKid = GetChildAt(aIndex); @@ -3245,8 +3222,8 @@ nsGenericContainerElement::~nsGenericContainerElement() } } -NS_IMETHODIMP_(already_AddRefed) -nsGenericContainerElement::GetExistingAttrNameFromQName(const nsAString& aStr) +already_AddRefed +nsGenericContainerElement::GetExistingAttrNameFromQName(const nsAString& aStr) const { if (mAttributes) { NS_ConvertUCS2toUTF8 utf8String(aStr); @@ -3372,8 +3349,7 @@ nsGenericContainerElement::GetLastChild(nsIDOMNode** aNode) nsresult nsGenericContainerElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, - PRBool aNotify) + const nsAString& aValue, PRBool aNotify) { nsCOMPtr ni; nsresult rv = mNodeInfo->NodeInfoManager()->GetNodeInfo(aName, nsnull, @@ -3386,8 +3362,8 @@ nsGenericContainerElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, // Static helper method -PRBool nsGenericElement::HasMutationListeners(nsIContent* aContent, - PRUint32 aType) +PRBool +nsGenericElement::HasMutationListeners(nsIContent* aContent, PRUint32 aType) { nsIDocument* doc = aContent->GetDocument(); if (!doc) @@ -3450,8 +3426,7 @@ PRBool nsGenericElement::HasMutationListeners(nsIContent* aContent, nsresult nsGenericContainerElement::SetAttr(nsINodeInfo* aNodeInfo, - const nsAString& aValue, - PRBool aNotify) + const nsAString& aValue, PRBool aNotify) { NS_ENSURE_ARG_POINTER(aNodeInfo); @@ -3561,8 +3536,7 @@ nsGenericContainerElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsresult nsGenericContainerElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom** aPrefix, - nsAString& aResult) const + nsIAtom** aPrefix, nsAString& aResult) const { NS_ASSERTION(nsnull != aName, "must have attribute name"); NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, @@ -3605,24 +3579,25 @@ nsGenericContainerElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, return rv; } -NS_IMETHODIMP_(PRBool) +PRBool nsGenericContainerElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const { NS_ASSERTION(nsnull != aName, "must have attribute name"); NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, "must have a real namespace ID!"); - if (nsnull == aName) + if (!aName) return PR_FALSE; - if (nsnull != mAttributes) { + if (mAttributes) { PRInt32 count = mAttributes->Count(); PRInt32 index; for (index = 0; index < count; index++) { - const nsGenericAttribute* attr = (const nsGenericAttribute*)mAttributes->ElementAt(index); - if ((aNameSpaceID == kNameSpaceID_Unknown || - attr->mNodeInfo->NamespaceEquals(aNameSpaceID)) && - (attr->mNodeInfo->Equals(aName))) { + const nsGenericAttribute* attr = + (const nsGenericAttribute*)mAttributes->ElementAt(index); + if (attr->mNodeInfo->Equals(aName) && + (aNameSpaceID == kNameSpaceID_Unknown || + attr->mNodeInfo->NamespaceEquals(aNameSpaceID))) { return PR_TRUE; } } @@ -3636,9 +3611,6 @@ nsGenericContainerElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify) { NS_ASSERTION(nsnull != aName, "must have attribute name"); - if (nsnull == aName) { - return NS_ERROR_NULL_POINTER; - } if (nsnull != mAttributes) { PRInt32 count = mAttributes->Count(); @@ -3730,7 +3702,7 @@ nsGenericContainerElement::GetAttrNameAt(PRUint32 aIndex, return NS_ERROR_ILLEGAL_VALUE; } -NS_IMETHODIMP_(PRUint32) +PRUint32 nsGenericContainerElement::GetAttrCount() const { if (mAttributes) { @@ -3764,7 +3736,7 @@ nsGenericContainerElement::ListAttributes(FILE* out) const } } -nsresult +void nsGenericContainerElement::List(FILE* out, PRInt32 aIndent) const { NS_PRECONDITION(nsnull != mDocument, "bad content"); @@ -3851,36 +3823,34 @@ nsGenericContainerElement::List(FILE* out, PRInt32 aIndent) const } } } - - return NS_OK; } -nsresult +void nsGenericContainerElement::DumpContent(FILE* out, PRInt32 aIndent, - PRBool aDumpAll) const { - return NS_OK; + PRBool aDumpAll) const +{ } #endif -NS_IMETHODIMP_(PRBool) +PRBool nsGenericContainerElement::CanContainChildren() const { return PR_TRUE; } -NS_IMETHODIMP_(PRUint32) +PRUint32 nsGenericContainerElement::GetChildCount() const { return (PRUint32)mChildren.Count(); } -NS_IMETHODIMP_(nsIContent *) +nsIContent * nsGenericContainerElement::GetChildAt(PRUint32 aIndex) const { return (nsIContent *)mChildren.SafeElementAt(aIndex); } -NS_IMETHODIMP_(PRInt32) +PRInt32 nsGenericContainerElement::IndexOf(nsIContent* aPossibleChild) const { NS_PRECONDITION(nsnull != aPossibleChild, "null ptr"); diff --git a/mozilla/content/base/src/nsGenericElement.h b/mozilla/content/base/src/nsGenericElement.h index bc104b622b0..70baef909ee 100644 --- a/mozilla/content/base/src/nsGenericElement.h +++ b/mozilla/content/base/src/nsGenericElement.h @@ -350,7 +350,7 @@ public: * Initialize this element given a NodeInfo object * @param aNodeInfo information about this type of node */ - nsresult Init(nsINodeInfo *aNodeInfo); + virtual nsresult Init(nsINodeInfo *aNodeInfo); /** * Called during QueryInterface to give the binding manager a chance to @@ -362,44 +362,42 @@ public: static void Shutdown(); // nsIContent interface methods - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers); - NS_IMETHOD_(void) SetParent(nsIContent* aParent); - NS_IMETHOD_(PRBool) IsNativeAnonymous() const; - NS_IMETHOD_(void) SetNativeAnonymous(PRBool aAnonymous); - NS_IMETHOD GetNameSpaceID(PRInt32* aNameSpaceID) const; + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); + virtual void SetParent(nsIContent* aParent); + virtual PRBool IsNativeAnonymous() const; + virtual void SetNativeAnonymous(PRBool aAnonymous); + virtual void GetNameSpaceID(PRInt32* aNameSpaceID) const; virtual nsIAtom *Tag() const; - NS_IMETHOD_(nsINodeInfo *) GetNodeInfo() const; - NS_IMETHOD_(nsIAtom*) GetIDAttributeName() const; - NS_IMETHOD_(nsIAtom*) GetClassAttributeName() const; - NS_IMETHOD RangeAdd(nsIDOMRange* aRange); - NS_IMETHOD RangeRemove(nsIDOMRange* aRange); + virtual nsINodeInfo *GetNodeInfo() const; + virtual nsIAtom *GetIDAttributeName() const; + virtual nsIAtom *GetClassAttributeName() const; + virtual nsresult RangeAdd(nsIDOMRange* aRange); + virtual void RangeRemove(nsIDOMRange* aRange); virtual const nsVoidArray *GetRangeList() const; - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, PRUint32 aFlags, nsEventStatus* aEventStatus); virtual PRUint32 ContentID() const; - NS_IMETHOD SetContentID(PRUint32 aID); - NS_IMETHOD SetFocus(nsIPresContext* aContext); - NS_IMETHOD RemoveFocus(nsIPresContext* aContext); - NS_IMETHOD_(nsIContent*) GetBindingParent() const; - NS_IMETHOD SetBindingParent(nsIContent* aParent); - NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags); - NS_IMETHOD GetListenerManager(nsIEventListenerManager** aInstancePtrResult); - NS_IMETHOD GetBaseURL(nsIURI** aBaseURL) const; - NS_IMETHOD DoneCreatingElement(); + virtual void SetContentID(PRUint32 aID); + virtual void SetFocus(nsIPresContext* aContext); + virtual nsIContent *GetBindingParent() const; + virtual nsresult SetBindingParent(nsIContent* aParent); + virtual PRBool IsContentOfType(PRUint32 aFlags) const; + virtual nsresult GetListenerManager(nsIEventListenerManager** aResult); + virtual already_AddRefed GetBaseURI() const; // Declare these here so we can consolidate the implementations. // Subclasses that don't want to implement these should override. - NS_IMETHOD InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD RemoveChildAt(PRUint32 aIndex, PRBool aNotify); + virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument); + virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify); // nsIStyledContent interface methods @@ -782,33 +780,29 @@ public: } // Remainder of nsIContent - NS_IMETHOD_(already_AddRefed) GetExistingAttrNameFromQName(const nsAString& aStr); - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, - PRBool aNotify); - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, - const nsAString& aValue, - PRBool aNotify); - NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsAString& aResult) const; - NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom** aPrefix, nsAString& aResult) const; - NS_IMETHOD_(PRBool) HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const; - NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRBool aNotify); - NS_IMETHOD GetAttrNameAt(PRUint32 aIndex, - PRInt32* aNameSpaceID, - nsIAtom** aName, - nsIAtom** aPrefix) const; - NS_IMETHOD_(PRUint32) GetAttrCount() const; + virtual already_AddRefed GetExistingAttrNameFromQName(const nsAString& aStr) const; + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify); + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify); + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsAString& aResult) const; + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsIAtom** aPrefix, nsAString& aResult) const; + virtual PRBool HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const; + virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify); + virtual nsresult GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, + nsIAtom** aName, nsIAtom** aPrefix) const; + virtual PRUint32 GetAttrCount() const; #ifdef DEBUG - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; - NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const; + virtual void List(FILE* out, PRInt32 aIndent) const; + virtual void DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const; #endif - NS_IMETHOD_(PRBool) CanContainChildren() const; - NS_IMETHOD_(PRUint32) GetChildCount() const; - NS_IMETHOD_(nsIContent *) GetChildAt(PRUint32 aIndex) const; - NS_IMETHOD_(PRInt32) IndexOf(nsIContent* aPossibleChild) const; + virtual PRBool CanContainChildren() const; + virtual PRUint32 GetChildCount() const; + virtual nsIContent *GetChildAt(PRUint32 aIndex) const; + virtual PRInt32 IndexOf(nsIContent* aPossibleChild) const; // Child list modification hooks virtual PRBool InternalInsertChildAt(nsIContent* aKid, PRUint32 aIndex) { diff --git a/mozilla/content/base/src/nsHTMLContentSerializer.cpp b/mozilla/content/base/src/nsHTMLContentSerializer.cpp index bdaef60d464..2126bce56ba 100644 --- a/mozilla/content/base/src/nsHTMLContentSerializer.cpp +++ b/mozilla/content/base/src/nsHTMLContentSerializer.cpp @@ -623,8 +623,7 @@ nsHTMLContentSerializer::SerializeAttributes(nsIContent* aContent, // but that gets more complicated since we have to // search the tag list for CODEBASE as well. // For now, just leave them relative. - nsCOMPtr uri; - aContent->GetBaseURL(getter_AddRefs(uri)); + nsCOMPtr uri = aContent->GetBaseURI(); if (uri) { nsAutoString absURI; rv = NS_MakeAbsoluteURI(absURI, valueStr, uri); diff --git a/mozilla/content/base/src/nsImageLoadingContent.cpp b/mozilla/content/base/src/nsImageLoadingContent.cpp index 2798fe8e2c6..f9ef176106c 100644 --- a/mozilla/content/base/src/nsImageLoadingContent.cpp +++ b/mozilla/content/base/src/nsImageLoadingContent.cpp @@ -425,7 +425,7 @@ nsImageLoadingContent::ImageURIChanged(const nsACString& aNewURI) nsCOMPtr loadGroup = doc->GetDocumentLoadGroup(); NS_WARN_IF_FALSE(loadGroup, "Could not get loadgroup; onload may fire too early"); - nsIURI *documentURI = doc->GetDocumentURL(); + nsIURI *documentURI = doc->GetDocumentURI(); nsCOMPtr & req = mCurrentRequest ? mPendingRequest : mCurrentRequest; @@ -573,14 +573,10 @@ nsImageLoadingContent::StringToURI(const nsACString& aSpec, NS_PRECONDITION(aDocument, "Must have a document"); NS_PRECONDITION(aURI, "Null out param"); - nsresult rv; - // (1) Get the base URI - nsCOMPtr baseURL; nsCOMPtr thisContent = do_QueryInterface(this); NS_ASSERTION(thisContent, "An image loading content must be an nsIContent"); - rv = thisContent->GetBaseURL(getter_AddRefs(baseURL)); - NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr baseURL = thisContent->GetBaseURI(); // (2) Get the charset const nsACString &charset = aDocument->GetDocumentCharacterSet(); diff --git a/mozilla/content/base/src/nsNodeInfoManager.cpp b/mozilla/content/base/src/nsNodeInfoManager.cpp index 268c99366b3..71e5da2dd63 100644 --- a/mozilla/content/base/src/nsNodeInfoManager.cpp +++ b/mozilla/content/base/src/nsNodeInfoManager.cpp @@ -177,7 +177,7 @@ nsNodeInfoManager::DropDocumentReference() // that we're creating a principal without having a uri. // This happens in a few cases where a document is created and then // immediately dropped without ever getting a URI. - if (mDocument->GetDocumentURL()) { + if (mDocument->GetDocumentURI()) { mPrincipal = mDocument->GetPrincipal(); } } @@ -294,7 +294,7 @@ nsNodeInfoManager::GetDocumentPrincipal(nsIPrincipal** aPrincipal) if (mDocument) { // If the document has a uri we'll ask for it's principal. Otherwise we'll // consider this document 'anonymous' - if (!mDocument->GetDocumentURL()) { + if (!mDocument->GetDocumentURI()) { *aPrincipal = nsnull; return NS_OK; } diff --git a/mozilla/content/base/src/nsPrintEngine.cpp b/mozilla/content/base/src/nsPrintEngine.cpp index 894076d92fa..1290e43583c 100644 --- a/mozilla/content/base/src/nsPrintEngine.cpp +++ b/mozilla/content/base/src/nsPrintEngine.cpp @@ -1852,7 +1852,7 @@ nsPrintEngine::GetWebShellTitleAndURL(nsIWebShell* aWebShell, *aTitle = ToNewUnicode(docTitle); } - nsIURI* url = aDoc->GetDocumentURL(); + nsIURI* url = aDoc->GetDocumentURI(); if (!url) return; nsCAutoString urlCStr; diff --git a/mozilla/content/base/src/nsRange.cpp b/mozilla/content/base/src/nsRange.cpp index babef5803b6..8407a9851c2 100644 --- a/mozilla/content/base/src/nsRange.cpp +++ b/mozilla/content/base/src/nsRange.cpp @@ -606,18 +606,12 @@ nsresult nsRange::AddToListOf(nsIDOMNode* aNode) } -nsresult nsRange::RemoveFromListOf(nsIDOMNode* aNode) +void nsRange::RemoveFromListOf(nsIDOMNode* aNode) { - if (!aNode) - return NS_ERROR_NULL_POINTER; + nsCOMPtr content(do_QueryInterface(aNode)); - nsresult res; - nsCOMPtr cN = do_QueryInterface(aNode, &res); - if (NS_FAILED(res)) - return res; - - res = cN->RangeRemove(NS_STATIC_CAST(nsIDOMRange*,this)); - return res; + if (content) + content->RangeRemove(NS_STATIC_CAST(nsIDOMRange *, this)); } diff --git a/mozilla/content/base/src/nsRange.h b/mozilla/content/base/src/nsRange.h index 6630afc3cd2..811ac1359aa 100644 --- a/mozilla/content/base/src/nsRange.h +++ b/mozilla/content/base/src/nsRange.h @@ -192,7 +192,7 @@ protected: nsresult AddToListOf(nsIDOMNode* aNode); - nsresult RemoveFromListOf(nsIDOMNode* aNode); + void RemoveFromListOf(nsIDOMNode* aNode); nsresult ContentOwnsUs(nsIDOMNode* domNode); diff --git a/mozilla/content/base/src/nsScriptLoader.cpp b/mozilla/content/base/src/nsScriptLoader.cpp index aaf73bba6c3..29cee048b67 100644 --- a/mozilla/content/base/src/nsScriptLoader.cpp +++ b/mozilla/content/base/src/nsScriptLoader.cpp @@ -429,12 +429,12 @@ nsScriptLoader::ProcessScriptElement(nsIDOMHTMLScriptElement *aElement, // Check to see if we have a src attribute. aElement->GetSrc(src); if (!src.IsEmpty()) { - nsCOMPtr baseURI, scriptURI; + nsCOMPtr scriptURI; // Use the SRC attribute value to load the URL nsCOMPtr content(do_QueryInterface(aElement)); NS_ASSERTION(content, "nsIDOMHTMLScriptElement not implementing nsIContent"); - content->GetBaseURL(getter_AddRefs(baseURI)); + nsCOMPtr baseURI = content->GetBaseURI(); rv = NS_NewURI(getter_AddRefs(scriptURI), src, nsnull, baseURI); if (NS_FAILED(rv)) { @@ -442,7 +442,7 @@ nsScriptLoader::ProcessScriptElement(nsIDOMHTMLScriptElement *aElement, } // Check that the containing page is allowed to load this URI. - nsIURI *docURI = mDocument->GetDocumentURL(); + nsIURI *docURI = mDocument->GetDocumentURI(); if (!docURI) { return FireErrorNotification(NS_ERROR_UNEXPECTED, aElement, aObserver); } @@ -496,7 +496,7 @@ nsScriptLoader::ProcessScriptElement(nsIDOMHTMLScriptElement *aElement, httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"), NS_LITERAL_CSTRING("*/*"), PR_FALSE); - httpChannel->SetReferrer(mDocument->GetDocumentURL()); + httpChannel->SetReferrer(mDocument->GetDocumentURI()); } rv = NS_NewStreamLoader(getter_AddRefs(loader), channel, this, request); } @@ -508,7 +508,7 @@ nsScriptLoader::ProcessScriptElement(nsIDOMHTMLScriptElement *aElement, } else { request->mLoading = PR_FALSE; request->mIsInline = PR_TRUE; - request->mURI = mDocument->GetDocumentURL(); + request->mURI = mDocument->GetDocumentURI(); nsCOMPtr scriptElement(do_QueryInterface(aElement)); if (scriptElement) { diff --git a/mozilla/content/base/src/nsTextNode.cpp b/mozilla/content/base/src/nsTextNode.cpp index d252ca69859..f58d33712eb 100644 --- a/mozilla/content/base/src/nsTextNode.cpp +++ b/mozilla/content/base/src/nsTextNode.cpp @@ -62,11 +62,11 @@ public: NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::) // nsIContent - nsIAtom *Tag() const; - NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags); + virtual nsIAtom *Tag() const; + virtual PRBool IsContentOfType(PRUint32 aFlags) const; #ifdef DEBUG - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; - NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent, PRBool aDumpAll) const; + virtual void List(FILE* out, PRInt32 aIndent) const; + virtual void DumpContent(FILE* out, PRInt32 aIndent, PRBool aDumpAll) const; #endif // nsITextContent @@ -165,14 +165,14 @@ nsTextNode::CloneContent(PRBool aCloneText, nsITextContent** aReturn) return NS_OK; } -NS_IMETHODIMP_(PRBool) -nsTextNode::IsContentOfType(PRUint32 aFlags) +PRBool +nsTextNode::IsContentOfType(PRUint32 aFlags) const { return !(aFlags & ~eTEXT); } #ifdef DEBUG -NS_IMETHODIMP +void nsTextNode::List(FILE* out, PRInt32 aIndent) const { NS_PRECONDITION(mDocument, "bad content"); @@ -187,10 +187,9 @@ nsTextNode::List(FILE* out, PRInt32 aIndent) const fputs(NS_LossyConvertUCS2toASCII(tmp).get(), out); fputs(">\n", out); - return NS_OK; } -NS_IMETHODIMP +void nsTextNode::DumpContent(FILE* out, PRInt32 aIndent, PRBool aDumpAll) const { NS_PRECONDITION(mDocument, "bad content"); @@ -207,6 +206,5 @@ nsTextNode::DumpContent(FILE* out, PRInt32 aIndent, PRBool aDumpAll) const if(aIndent) fputs("\n", out); } } - return NS_OK; } #endif diff --git a/mozilla/content/html/content/public/nsIFormSubmission.h b/mozilla/content/html/content/public/nsIFormSubmission.h index 6ef63b91f25..c7b7335e04d 100644 --- a/mozilla/content/html/content/public/nsIFormSubmission.h +++ b/mozilla/content/html/content/public/nsIFormSubmission.h @@ -70,7 +70,7 @@ public: * * @param aAcceptsFiles the boolean output */ - NS_IMETHOD AcceptsFiles(PRBool* aAcceptsFiles) const = 0; + virtual PRBool AcceptsFiles() const = 0; /** * Call to perform the submission @@ -83,9 +83,10 @@ public: * loaded * @param aRequest (out param) the Request for the submission */ - NS_IMETHOD SubmitTo(nsIURI* aActionURL, const nsAString& aTarget, - nsIContent* aSource, nsIPresContext* aPresContext, - nsIDocShell** aDocShell, nsIRequest** aRequest) = 0; + virtual nsresult SubmitTo(nsIURI* aActionURL, const nsAString& aTarget, + nsIContent* aSource, nsIPresContext* aPresContext, + nsIDocShell** aDocShell, + nsIRequest** aRequest) = 0; /** * Submit a name/value pair @@ -94,9 +95,9 @@ public: * @param aName the name of the parameter * @param aValue the value of the parameter */ - NS_IMETHOD AddNameValuePair(nsIDOMHTMLElement* aSource, - const nsAString& aName, - const nsAString& aValue) = 0; + virtual nsresult AddNameValuePair(nsIDOMHTMLElement* aSource, + const nsAString& aName, + const nsAString& aValue) = 0; /** * Submit a name/file pair @@ -109,12 +110,12 @@ public: * @param aMoreFilesToCome true if another name/file pair with the same name * will be sent soon */ - NS_IMETHOD AddNameFilePair(nsIDOMHTMLElement* aSource, - const nsAString& aName, - const nsAString& aFilename, - nsIInputStream* aStream, - const nsACString& aContentType, - PRBool aMoreFilesToCome) = 0; + virtual nsresult AddNameFilePair(nsIDOMHTMLElement* aSource, + const nsAString& aName, + const nsAString& aFilename, + nsIInputStream* aStream, + const nsACString& aContentType, + PRBool aMoreFilesToCome) = 0; }; diff --git a/mozilla/content/html/content/src/Makefile.in b/mozilla/content/html/content/src/Makefile.in index d5f8143480d..bdc9cf380e8 100644 --- a/mozilla/content/html/content/src/Makefile.in +++ b/mozilla/content/html/content/src/Makefile.in @@ -117,7 +117,6 @@ CPPSRCS = \ $(NULL) EXPORTS = \ -nsIAttributeContent.h \ nsIHTMLTableCellElement.h \ nsIHTMLTableColElement.h \ $(NULL) diff --git a/mozilla/content/html/content/src/nsAttributeContent.cpp b/mozilla/content/html/content/src/nsAttributeContent.cpp index 4dbdbc13793..529b5498b24 100644 --- a/mozilla/content/html/content/src/nsAttributeContent.cpp +++ b/mozilla/content/html/content/src/nsAttributeContent.cpp @@ -36,7 +36,6 @@ * the terms of any one of the NPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ -#include "nsIAttributeContent.h" #include "nsGenericElement.h" #include "nsIDocument.h" #include "nsIDocument.h" @@ -67,135 +66,120 @@ // XXX share all id's in this dir -class nsAttributeContent : public nsITextContent, public nsIAttributeContent +class nsAttributeContent : public nsITextContent { public: - friend nsresult NS_NewAttributeContent(nsAttributeContent** aNewFrame); - - nsAttributeContent(); + nsAttributeContent(nsIContent* aContent, PRInt32 aNameSpaceID, + nsIAtom* aAttrName); virtual ~nsAttributeContent(); - NS_IMETHOD Init(nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttrName); - // nsISupports NS_DECL_ISUPPORTS // Implementation for nsIContent - NS_IMETHOD_(PRBool) IsNativeAnonymous() const { return PR_TRUE; } - NS_IMETHOD_(void) SetNativeAnonymous(PRBool aAnonymous) { } + virtual PRBool IsNativeAnonymous() const { return PR_TRUE; } + virtual void SetNativeAnonymous(PRBool aAnonymous) { } - NS_IMETHOD GetNameSpaceID(PRInt32* aID) const + virtual void GetNameSpaceID(PRInt32* aID) const { *aID = kNameSpaceID_None; - return NS_OK; } - nsIAtom *Tag() const + virtual nsIAtom *Tag() const { return nsLayoutAtoms::textTagName; } - NS_IMETHOD_(nsINodeInfo *) GetNodeInfo() const + virtual nsINodeInfo *GetNodeInfo() const { return nsnull; } - NS_IMETHOD_(nsIAtom *) GetIDAttributeName() const + virtual nsIAtom *GetIDAttributeName() const { return nsnull; } - NS_IMETHOD_(nsIAtom *) GetClassAttributeName() const + virtual nsIAtom * GetClassAttributeName() const { return nsnull; } - NS_IMETHOD_(already_AddRefed) GetExistingAttrNameFromQName(const nsAString& aStr) + virtual already_AddRefed GetExistingAttrNameFromQName(const nsAString& aStr) const { return nsnull; } - NS_IMETHOD SetFocus(nsIPresContext* aPresContext) { return NS_OK; } - NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext) { return NS_OK; } - - NS_IMETHOD_(nsIContent*) GetBindingParent() const { + virtual nsIContent *GetBindingParent() const { return nsnull; } - NS_IMETHOD SetBindingParent(nsIContent* aParent) { + virtual nsresult SetBindingParent(nsIContent* aParent) { return NS_OK; } - NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags) { + virtual PRBool IsContentOfType(PRUint32 aFlags) const { return !(aFlags & ~eTEXT); } - NS_IMETHOD GetListenerManager(nsIEventListenerManager **aResult) { + virtual nsresult GetListenerManager(nsIEventListenerManager **aResult) { return NS_ERROR_NOT_IMPLEMENTED; } - NS_IMETHOD GetBaseURL(nsIURI** aURI) const; + virtual already_AddRefed GetBaseURI() const; - NS_IMETHOD DoneCreatingElement() { - return NS_OK; - } - - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsAString& aValue, - PRBool aNotify) { return NS_OK; } - NS_IMETHOD SetAttr(nsINodeInfo *aNodeInfo, const nsAString& aValue, - PRBool aNotify) { return NS_OK; } - NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) { return NS_OK; } - NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsAString& aResult) const {return NS_CONTENT_ATTR_NOT_THERE; } - NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom** aPrefix, nsAString& aResult) const {return NS_CONTENT_ATTR_NOT_THERE; } - NS_IMETHOD_(PRBool) HasAttr(PRInt32 aNameSpaceID, nsIAtom *aAttribute) const { + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsAString& aValue, + PRBool aNotify) { return NS_OK; } + virtual nsresult SetAttr(nsINodeInfo *aNodeInfo, const nsAString& aValue, + PRBool aNotify) { return NS_OK; } + virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) { return NS_OK; } + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsAString& aResult) const {return NS_CONTENT_ATTR_NOT_THERE; } + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom** aPrefix, nsAString& aResult) const {return NS_CONTENT_ATTR_NOT_THERE; } + virtual PRBool HasAttr(PRInt32 aNameSpaceID, nsIAtom *aAttribute) const { return PR_FALSE; } - NS_IMETHOD GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, nsIAtom** aName, nsIAtom** aPrefix) const { + virtual nsresult GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, + nsIAtom** aName, nsIAtom** aPrefix) const { aName = nsnull; aPrefix = nsnull; return NS_ERROR_ILLEGAL_VALUE; } - NS_IMETHOD_(PRUint32) GetAttrCount() const { return 0; } + virtual PRUint32 GetAttrCount() const { return 0; } #ifdef DEBUG - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const { return NS_OK; } - NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const { return NS_OK; } + void List(FILE* out, PRInt32 aIndent) const { } + void DumpContent(FILE* out, PRInt32 aIndent, PRBool aDumpAll) const { } #endif - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, - nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, - PRUint32 aFlags, - nsEventStatus* aEventStatus); + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus); virtual PRUint32 ContentID() const { NS_ERROR("nsAttributeContent::ContentID() not implemented!"); return 0; } - NS_IMETHOD SetContentID(PRUint32 aID) { - return NS_ERROR_NOT_IMPLEMENTED; - } - - NS_IMETHOD RangeAdd(nsIDOMRange* aRange); - NS_IMETHOD RangeRemove(nsIDOMRange* aRange); + virtual nsresult RangeAdd(nsIDOMRange* aRange); + virtual void RangeRemove(nsIDOMRange* aRange); const nsVoidArray * GetRangeList() const; // Implementation for nsIContent - NS_IMETHOD_(PRBool) CanContainChildren() const { return PR_FALSE; } + virtual PRBool CanContainChildren() const { return PR_FALSE; } - NS_IMETHOD_(PRUint32) GetChildCount() const { return 0; } - NS_IMETHOD_(nsIContent *) GetChildAt(PRUint32 aIndex) const { return nsnull; } - NS_IMETHOD_(PRInt32) IndexOf(nsIContent* aPossibleChild) const { return -1; } - NS_IMETHOD InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument) { return NS_OK; } - NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument) { return NS_OK; } - NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify, - PRBool aDeepSetDocument) { return NS_OK; } - NS_IMETHOD RemoveChildAt(PRUint32 aIndex, PRBool aNotify) { return NS_OK; } + virtual PRUint32 GetChildCount() const { return 0; } + virtual nsIContent *GetChildAt(PRUint32 aIndex) const { return nsnull; } + virtual PRInt32 IndexOf(nsIContent* aPossibleChild) const { return -1; } + virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, + PRBool aDeepSetDocument) { return NS_OK; } + virtual nsresult ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, + PRBool aDeepSetDocument) { return NS_OK; } + virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument) { return NS_OK; } + virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify) { return NS_OK; } NS_IMETHOD SplitText(PRUint32 aOffset, nsIDOMText** aReturn){ return NS_OK; } - + /////////////////// // Implementation for nsITextContent NS_IMETHOD GetText(const nsTextFragment** aFragmentsResult); @@ -239,24 +223,28 @@ public: nsresult -NS_NewAttributeContent(nsIContent** aContent) +NS_NewAttributeContent(nsIContent* aContent, PRInt32 aNameSpaceID, + nsIAtom* aAttrName, nsIContent** aResult) { - NS_ENSURE_ARG_POINTER(aContent); + NS_ENSURE_TRUE(aContent && aAttrName && aResult, NS_ERROR_ILLEGAL_VALUE); - nsAttributeContent* it = new nsAttributeContent(); - if (!it) { + *aResult = new nsAttributeContent(aContent, aNameSpaceID, aAttrName); + if (!*aResult) { return NS_ERROR_OUT_OF_MEMORY; } - return CallQueryInterface(it, aContent); + NS_ADDREF(*aResult); + + return NS_OK; } //---------------------------------------------------------------------- -nsAttributeContent::nsAttributeContent() - : mText() +nsAttributeContent::nsAttributeContent(nsIContent* aContent, + PRInt32 aNameSpaceID, + nsIAtom* aAttrName) + : mContent(aContent), mNameSpaceID(aNameSpaceID), mAttrName(aAttrName) { - mContent = nsnull; } //---------------------------------------------------------------------- @@ -264,22 +252,6 @@ nsAttributeContent::~nsAttributeContent() { } -//---------------------------------------------------------------------- -NS_IMETHODIMP -nsAttributeContent::Init(nsIContent* aContent, PRInt32 aNameSpaceID, - nsIAtom* aAttrName) -{ - NS_ENSURE_TRUE(aAttrName && aContent, NS_ERROR_NULL_POINTER); - - mContent = aContent; - - mNameSpaceID = aNameSpaceID; - mAttrName = aAttrName; - return NS_OK; -} - - - /** * @param aIID The name of the class implementing the method * @param _classiiddef The name of the #define symbol that defines the IID @@ -290,7 +262,6 @@ nsAttributeContent::Init(nsIContent* aContent, PRInt32 aNameSpaceID, NS_INTERFACE_MAP_BEGIN(nsAttributeContent) NS_INTERFACE_MAP_ENTRY(nsIContent) NS_INTERFACE_MAP_ENTRY(nsITextContent) - NS_INTERFACE_MAP_ENTRY(nsIAttributeContent) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent) NS_INTERFACE_MAP_END @@ -329,10 +300,9 @@ nsAttributeContent::RangeAdd(nsIDOMRange* aRange) } -nsresult +void nsAttributeContent::RangeRemove(nsIDOMRange* aRange) { - return NS_ERROR_FAILURE; } @@ -342,20 +312,23 @@ nsAttributeContent::GetRangeList() const return nsnull; } -NS_IMETHODIMP -nsAttributeContent::GetBaseURL(nsIURI** aURI) const +already_AddRefed +nsAttributeContent::GetBaseURI() const { if (GetParent()) { - return GetParent()->GetBaseURL(aURI); + return GetParent()->GetBaseURI(); } + nsIURI *uri; + if (mDocument) { - NS_IF_ADDREF(*aURI = mDocument->GetBaseURL()); + uri = mDocument->GetBaseURI(); + NS_IF_ADDREF(uri); } else { - *aURI = nsnull; + uri = nsnull; } - return NS_OK; + return uri; } @@ -511,22 +484,17 @@ nsAttributeContent::IsOnlyWhitespace(PRBool* aResult) NS_IMETHODIMP nsAttributeContent::CloneContent(PRBool aCloneText, nsITextContent** aReturn) { - nsresult result = NS_OK; - nsAttributeContent* it; - NS_NEWXPCOM(it, nsAttributeContent); - if (nsnull == it) { + nsAttributeContent* it = + new nsAttributeContent(mContent, mNameSpaceID, mAttrName); + if (!it) { return NS_ERROR_OUT_OF_MEMORY; } - result = CallQueryInterface(it, aReturn); - if (NS_FAILED(result)) { - return result; - } - result = it->Init(mContent, mNameSpaceID, mAttrName); - if (NS_FAILED(result) || !aCloneText) { - return result; - } + it->mText = mText; - return result; + + NS_ADDREF(*aReturn = it); + + return NS_OK; } NS_IMETHODIMP diff --git a/mozilla/content/html/content/src/nsFormSubmission.cpp b/mozilla/content/html/content/src/nsFormSubmission.cpp index 88289e62824..0705326419e 100644 --- a/mozilla/content/html/content/src/nsFormSubmission.cpp +++ b/mozilla/content/html/content/src/nsFormSubmission.cpp @@ -86,17 +86,20 @@ public: mEncoder(aEncoder), mFormProcessor(aFormProcessor), mBidiOptions(aBidiOptions) - { }; - virtual ~nsFormSubmission() { }; + { + }; + virtual ~nsFormSubmission() + { + }; NS_DECL_ISUPPORTS // // nsIFormSubmission // - NS_IMETHOD SubmitTo(nsIURI* aActionURL, const nsAString& aTarget, - nsIContent* aSource, nsIPresContext* aPresContext, - nsIDocShell** aDocShell, nsIRequest** aRequest); + virtual nsresult SubmitTo(nsIURI* aActionURI, const nsAString& aTarget, + nsIContent* aSource, nsIPresContext* aPresContext, + nsIDocShell** aDocShell, nsIRequest** aRequest); /** * Called to initialize the submission. Perform any initialization that may @@ -110,10 +113,10 @@ protected: * Given a URI and the current submission, create the final URI and data * stream that will be submitted. Subclasses *must* implement this. * - * @param aURL the URL being submitted to [INOUT] + * @param aURI the URI being submitted to [INOUT] * @param aPostDataStream a data stream for POST data [OUT] */ - NS_IMETHOD GetEncodedSubmission(nsIURI* aURL, + NS_IMETHOD GetEncodedSubmission(nsIURI* aURI, nsIInputStream** aPostDataStream) = 0; // Helpers @@ -251,23 +254,28 @@ public: PRInt32 aMethod) : nsFormSubmission(aCharset, aEncoder, aFormProcessor, aBidiOptions), mMethod(aMethod) - { } - virtual ~nsFSURLEncoded() { } - + { + } + virtual ~nsFSURLEncoded() + { + } + NS_DECL_ISUPPORTS_INHERITED // nsIFormSubmission - NS_IMETHOD AddNameValuePair(nsIDOMHTMLElement* aSource, - const nsAString& aName, - const nsAString& aValue); - NS_IMETHOD AddNameFilePair(nsIDOMHTMLElement* aSource, - const nsAString& aName, - const nsAString& aFilename, - nsIInputStream* aStream, - const nsACString& aContentType, - PRBool aMoreFilesToCome); - NS_IMETHOD AcceptsFiles(PRBool* aAcceptsFiles) const - { *aAcceptsFiles = PR_FALSE; return NS_OK; } + virtual nsresult AddNameValuePair(nsIDOMHTMLElement* aSource, + const nsAString& aName, + const nsAString& aValue); + virtual nsresult AddNameFilePair(nsIDOMHTMLElement* aSource, + const nsAString& aName, + const nsAString& aFilename, + nsIInputStream* aStream, + const nsACString& aContentType, + PRBool aMoreFilesToCome); + virtual PRBool AcceptsFiles() const + { + return PR_FALSE; + } NS_IMETHOD Init(); @@ -305,7 +313,7 @@ NS_IMPL_RELEASE_INHERITED(nsFSURLEncoded, nsFormSubmission) NS_IMPL_ADDREF_INHERITED(nsFSURLEncoded, nsFormSubmission) NS_IMPL_QUERY_INTERFACE_INHERITED0(nsFSURLEncoded, nsFormSubmission) -NS_IMETHODIMP +nsresult nsFSURLEncoded::AddNameValuePair(nsIDOMHTMLElement* aSource, const nsAString& aName, const nsAString& aValue) @@ -360,7 +368,7 @@ nsFSURLEncoded::AddNameValuePair(nsIDOMHTMLElement* aSource, return NS_OK; } -NS_IMETHODIMP +nsresult nsFSURLEncoded::AddNameFilePair(nsIDOMHTMLElement* aSource, const nsAString& aName, const nsAString& aFilename, @@ -368,7 +376,7 @@ nsFSURLEncoded::AddNameFilePair(nsIDOMHTMLElement* aSource, const nsACString& aContentType, PRBool aMoreFilesToCome) { - return AddNameValuePair(aSource,aName,aFilename); + return AddNameValuePair(aSource, aName, aFilename); } // @@ -576,17 +584,19 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIFormSubmission - NS_IMETHOD AddNameValuePair(nsIDOMHTMLElement* aSource, - const nsAString& aName, - const nsAString& aValue); - NS_IMETHOD AddNameFilePair(nsIDOMHTMLElement* aSource, - const nsAString& aName, - const nsAString& aFilename, - nsIInputStream* aStream, - const nsACString& aContentType, - PRBool aMoreFilesToCome); - NS_IMETHOD AcceptsFiles(PRBool* aAcceptsFiles) const - { *aAcceptsFiles = PR_TRUE; return NS_OK; } + virtual nsresult AddNameValuePair(nsIDOMHTMLElement* aSource, + const nsAString& aName, + const nsAString& aValue); + virtual nsresult AddNameFilePair(nsIDOMHTMLElement* aSource, + const nsAString& aName, + const nsAString& aFilename, + nsIInputStream* aStream, + const nsACString& aContentType, + PRBool aMoreFilesToCome); + virtual PRBool AcceptsFiles() const + { + return PR_TRUE; + } NS_IMETHOD Init(); @@ -722,7 +732,7 @@ nsFSMultipartFormData::ProcessAndEncode(nsIDOMHTMLElement* aSource, // // nsIFormSubmission // -NS_IMETHODIMP +nsresult nsFSMultipartFormData::AddNameValuePair(nsIDOMHTMLElement* aSource, const nsAString& aName, const nsAString& aValue) @@ -744,7 +754,7 @@ nsFSMultipartFormData::AddNameValuePair(nsIDOMHTMLElement* aSource, return NS_OK; } -NS_IMETHODIMP +nsresult nsFSMultipartFormData::AddNameFilePair(nsIDOMHTMLElement* aSource, const nsAString& aName, const nsAString& aFilename, @@ -891,21 +901,24 @@ public: nsIFormProcessor* aFormProcessor, PRInt32 aBidiOptions) : nsFormSubmission(aCharset, aEncoder, aFormProcessor, aBidiOptions) - { } - virtual ~nsFSTextPlain() { } - + { + } + virtual ~nsFSTextPlain() + { + } + NS_DECL_ISUPPORTS_INHERITED // nsIFormSubmission - NS_IMETHOD AddNameValuePair(nsIDOMHTMLElement* aSource, - const nsAString& aName, - const nsAString& aValue); - NS_IMETHOD AddNameFilePair(nsIDOMHTMLElement* aSource, - const nsAString& aName, - const nsAString& aFilename, - nsIInputStream* aStream, - const nsACString& aContentType, - PRBool aMoreFilesToCome); + virtual nsresult AddNameValuePair(nsIDOMHTMLElement* aSource, + const nsAString& aName, + const nsAString& aValue); + virtual nsresult AddNameFilePair(nsIDOMHTMLElement* aSource, + const nsAString& aName, + const nsAString& aFilename, + nsIInputStream* aStream, + const nsACString& aContentType, + PRBool aMoreFilesToCome); NS_IMETHOD Init(); @@ -913,8 +926,10 @@ protected: // nsFormSubmission NS_IMETHOD GetEncodedSubmission(nsIURI* aURI, nsIInputStream** aPostDataStream); - NS_IMETHOD AcceptsFiles(PRBool* aAcceptsFiles) const - { *aAcceptsFiles = PR_FALSE; return NS_OK; } + virtual PRBool AcceptsFiles() const + { + return PR_FALSE; + } private: nsString mBody; @@ -924,7 +939,7 @@ NS_IMPL_RELEASE_INHERITED(nsFSTextPlain, nsFormSubmission) NS_IMPL_ADDREF_INHERITED(nsFSTextPlain, nsFormSubmission) NS_IMPL_QUERY_INTERFACE_INHERITED0(nsFSTextPlain, nsFormSubmission) -NS_IMETHODIMP +nsresult nsFSTextPlain::AddNameValuePair(nsIDOMHTMLElement* aSource, const nsAString& aName, const nsAString& aValue) @@ -950,7 +965,7 @@ nsFSTextPlain::AddNameValuePair(nsIDOMHTMLElement* aSource, return NS_OK; } -NS_IMETHODIMP +nsresult nsFSTextPlain::AddNameFilePair(nsIDOMHTMLElement* aSource, const nsAString& aName, const nsAString& aFilename, @@ -992,7 +1007,8 @@ nsFSTextPlain::GetEncodedSubmission(nsIURI* aURI, // Append the body to and force-plain-text args to the mailto line nsCString escapedBody; - escapedBody.Adopt(nsEscape(NS_ConvertUCS2toUTF8(mBody).get(), url_XAlphas)); + escapedBody.Adopt(nsEscape(NS_ConvertUTF16toUTF8(mBody).get(), + url_XAlphas)); path += NS_LITERAL_CSTRING("&force-plain-text=Y&body=") + escapedBody; @@ -1070,14 +1086,13 @@ SendJSWarning(nsIHTMLContent* aContent, // // Get the document URL to use as the filename // - nsCAutoString documentURLSpec; - { - nsIDocument* document = aContent->GetDocument(); - if (document) { - nsIURI *documentURL = document->GetDocumentURL(); - NS_ENSURE_TRUE(documentURL, NS_ERROR_UNEXPECTED); - documentURL->GetPath(documentURLSpec); - } + nsCAutoString documentURISpec; + + nsIDocument* document = aContent->GetDocument(); + if (document) { + nsIURI *documentURI = document->GetDocumentURI(); + NS_ENSURE_TRUE(documentURI, NS_ERROR_UNEXPECTED); + documentURI->GetPath(documentURISpec); } // @@ -1108,7 +1123,7 @@ SendJSWarning(nsIHTMLContent* aContent, NS_ENSURE_TRUE(scriptError, NS_ERROR_UNEXPECTED); rv = scriptError->Init(warningStr.get(), - NS_ConvertUTF8toUCS2(documentURLSpec).get(), + NS_ConvertUTF8toUTF16(documentURISpec).get(), nsnull, (uintN)0, 0, nsIScriptError::warningFlag, "HTML"); @@ -1199,18 +1214,18 @@ GetSubmissionFromForm(nsIHTMLContent* aForm, return NS_OK; } -NS_IMETHODIMP -nsFormSubmission::SubmitTo(nsIURI* aActionURL, const nsAString& aTarget, +nsresult +nsFormSubmission::SubmitTo(nsIURI* aActionURI, const nsAString& aTarget, nsIContent* aSource, nsIPresContext* aPresContext, nsIDocShell** aDocShell, nsIRequest** aRequest) { nsresult rv; // - // Finish encoding (get post data stream and URL) + // Finish encoding (get post data stream and URI) // nsCOMPtr postDataStream; - rv = GetEncodedSubmission(aActionURL, getter_AddRefs(postDataStream)); + rv = GetEncodedSubmission(aActionURI, getter_AddRefs(postDataStream)); NS_ENSURE_SUCCESS(rv, rv); // @@ -1221,7 +1236,7 @@ nsFormSubmission::SubmitTo(nsIURI* aActionURL, const nsAString& aTarget, NS_ENSURE_TRUE(handler, NS_ERROR_FAILURE); return handler->OnLinkClickSync(aSource, eLinkVerb_Replace, - aActionURL, + aActionURI, PromiseFlatString(aTarget).get(), postDataStream, nsnull, aDocShell, aRequest); @@ -1438,7 +1453,7 @@ nsFormSubmission::ProcessValue(nsIDOMHTMLElement* aSource, nsCOMPtr formControl = do_QueryInterface(aSource); if (formControl) { if (formControl->GetType() == NS_FORM_INPUT_HIDDEN) { - return new NS_ConvertASCIItoUCS2(mCharset); + return new NS_ConvertASCIItoUTF16(mCharset); } } } diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 27e568adb9e..2ab9fcfa6fd 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -1296,17 +1296,13 @@ nsGenericHTMLElement::InNavQuirksMode(nsIDocument* aDoc) return mode == eCompatibility_NavQuirks; } -nsresult +void nsGenericHTMLElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) { PRBool doNothing = aDocument == mDocument; // short circuit useless work - nsresult result = nsGenericElement::SetDocument(aDocument, aDeep, - aCompileEventHandlers); - if (NS_FAILED(result)) { - return result; - } + nsGenericElement::SetDocument(aDocument, aDeep, aCompileEventHandlers); if (!doNothing && mDocument && mAttributes) { ReparseStyleAttribute(); @@ -1316,8 +1312,6 @@ nsGenericHTMLElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, NS_RELEASE(sheet); } } - - return result; } nsresult @@ -1475,8 +1469,7 @@ nsGenericHTMLElement::HandleDOMEventForAnchors(nsIPresContext* aPresContext, if (nsEventStatus_eConsumeNoDefault != *aEventStatus) { nsInputEvent* inputEvent = NS_STATIC_CAST(nsInputEvent*, aEvent); nsAutoString target; - nsCOMPtr baseURL; - GetBaseURL(getter_AddRefs(baseURL)); + nsCOMPtr baseURI = GetBaseURI(); GetAttr(kNameSpaceID_None, nsHTMLAtoms::target, target); if (target.IsEmpty()) { GetBaseTarget(target); @@ -1486,7 +1479,7 @@ nsGenericHTMLElement::HandleDOMEventForAnchors(nsIPresContext* aPresContext, break; // let the click go through so we can handle it in JS/XUL } - ret = TriggerLink(aPresContext, eLinkVerb_Replace, baseURL, hrefURI, + ret = TriggerLink(aPresContext, eLinkVerb_Replace, baseURI, hrefURI, target, PR_TRUE); *aEventStatus = nsEventStatus_eConsumeDoDefault; @@ -1531,13 +1524,12 @@ nsGenericHTMLElement::HandleDOMEventForAnchors(nsIPresContext* aPresContext, case NS_FOCUS_CONTENT: { nsAutoString target; - nsCOMPtr baseURL; - GetBaseURL(getter_AddRefs(baseURL)); + nsCOMPtr baseURI = GetBaseURI(); GetAttr(kNameSpaceID_None, nsHTMLAtoms::target, target); if (target.IsEmpty()) { GetBaseTarget(target); } - ret = TriggerLink(aPresContext, eLinkVerb_Replace, baseURL, + ret = TriggerLink(aPresContext, eLinkVerb_Replace, baseURI, hrefURI, target, PR_FALSE); } break; @@ -1563,40 +1555,38 @@ nsGenericHTMLElement::GetHrefURIForAnchors(nsIURI** aURI) // This is used by the three nsILink implementations and // nsHTMLStyleElement. - // Get href= attribute (relative URL). - nsAutoString relURLSpec; + // Get href= attribute (relative URI). + nsAutoString relURISpec; if (NS_CONTENT_ATTR_HAS_VALUE == - GetAttr(kNameSpaceID_None, nsHTMLAtoms::href, relURLSpec)) { - // Get base URL. - nsCOMPtr baseURL; - GetBaseURL(getter_AddRefs(baseURL)); + GetAttr(kNameSpaceID_None, nsHTMLAtoms::href, relURISpec)) { + // Get base URI. + nsCOMPtr baseURI = GetBaseURI(); - // Get absolute URL. + // Get absolute URI. nsresult rv = nsContentUtils::NewURIWithDocumentCharset(aURI, - relURLSpec, + relURISpec, mDocument, - baseURL); + baseURI); if (NS_FAILED(rv)) { *aURI = nsnull; } } else { - // Absolute URL is null to say we have no HREF. + // Absolute URI is null to say we have no HREF. *aURI = nsnull; } return NS_OK; } -NS_IMETHODIMP +void nsGenericHTMLElement::GetNameSpaceID(PRInt32* aID) const { // XXX // XXX This is incorrect!!!!!!!!!!!!!!!! // XXX *aID = kNameSpaceID_XHTML; - return NS_OK; } // Based on nsNodeInfo::QualifiedNameEquals @@ -1646,7 +1636,7 @@ QualifiedNameEquals(const nsACString& aQualifiedName, nsIAtom* aName, } already_AddRefed -nsGenericHTMLElement::GetExistingAttrNameFromQName(const nsAString& aStr) +nsGenericHTMLElement::GetExistingAttrNameFromQName(const nsAString& aStr) const { if (!mAttributes) { return nsnull; @@ -1680,10 +1670,8 @@ nsGenericHTMLElement::GetExistingAttrNameFromQName(const nsAString& aStr) } nsresult -nsGenericHTMLElement::SetAttr(PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - const nsAString& aValue, - PRBool aNotify) +nsGenericHTMLElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + const nsAString& aValue, PRBool aNotify) { NS_ASSERTION(aNameSpaceID != kNameSpaceID_XHTML, "Error, attribute on [X]HTML element set with XHTML namespace, " @@ -1807,9 +1795,8 @@ nsGenericHTMLElement::SetAttr(PRInt32 aNameSpaceID, return result; } -NS_IMETHODIMP -nsGenericHTMLElement::SetAttr(nsINodeInfo* aNodeInfo, - const nsAString& aValue, +nsresult +nsGenericHTMLElement::SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, PRBool aNotify) { NS_ENSURE_ARG_POINTER(aNodeInfo); @@ -2238,7 +2225,7 @@ nsGenericHTMLElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom *aAttribute, return rv; } -NS_IMETHODIMP_(PRBool) +PRBool nsGenericHTMLElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const { NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, @@ -2275,7 +2262,7 @@ nsGenericHTMLElement::GetAttrNameAt(PRUint32 aIndex, return NS_ERROR_ILLEGAL_VALUE; } -NS_IMETHODIMP_(PRUint32) +PRUint32 nsGenericHTMLElement::GetAttrCount() const { if (!mAttributes) { @@ -2313,13 +2300,13 @@ nsGenericHTMLElement::GetClasses(nsVoidArray& aArray) const return NS_OK; } -NS_IMETHODIMP_(nsIAtom*) +nsIAtom * nsGenericHTMLElement::GetIDAttributeName() const { return nsHTMLAtoms::id; } -NS_IMETHODIMP_(nsIAtom*) +nsIAtom * nsGenericHTMLElement::GetClassAttributeName() const { return nsHTMLAtoms::kClass; @@ -2376,8 +2363,8 @@ nsGenericHTMLElement::SetInlineStyleRule(nsICSSStyleRule* aStyleRule, aNotify); } -nsresult -nsGenericHTMLElement::GetBaseURL(nsIURI** aBaseURL) const +already_AddRefed +nsGenericHTMLElement::GetBaseURI() const { nsIDocument* doc = GetOwnerDocument(); @@ -2388,51 +2375,55 @@ nsGenericHTMLElement::GetBaseURL(nsIURI** aBaseURL) const mAttributes->GetAttribute(nsHTMLAtoms::_baseHref, baseHref); if (baseHref.GetUnit() == eHTMLUnit_String) { - // We have a _baseHref attribute; that will determine our base URL - return GetBaseURL(baseHref, doc, aBaseURL); + // We have a _baseHref attribute; that will determine our base URI + nsIURI *uri; + GetBaseURI(baseHref, doc, &uri); + + return uri; } } // If we are a plain old HTML element (not XHTML), don't bother asking the - // base class -- our base URL is determined solely by the document base. + // base class -- our base URI is determined solely by the document base. if (mNodeInfo->NamespaceEquals(kNameSpaceID_None)) { if (doc) { - NS_IF_ADDREF(*aBaseURL = doc->GetBaseURL()); - } else { - *aBaseURL = nsnull; + nsIURI *uri = doc->GetBaseURI(); + NS_IF_ADDREF(uri); + + return uri; } - return NS_OK; + return nsnull; } - return nsGenericElement::GetBaseURL(aBaseURL); + return nsGenericElement::GetBaseURI(); } nsresult -nsGenericHTMLElement::GetBaseURL(const nsHTMLValue& aBaseHref, +nsGenericHTMLElement::GetBaseURI(const nsHTMLValue& aBaseHref, nsIDocument* aDocument, - nsIURI** aBaseURL) + nsIURI** aBaseURI) { nsresult result = NS_OK; - nsIURI* docBaseURL; + nsIURI* docBaseURI; if (aDocument) { - docBaseURL = aDocument->GetBaseURL(); + docBaseURI = aDocument->GetBaseURI(); } else { - docBaseURL = nsnull; + docBaseURI = nsnull; } if (eHTMLUnit_String == aBaseHref.GetUnit()) { nsAutoString baseHref; aBaseHref.GetStringValue(baseHref); - *aBaseURL = nsnull; - return NS_NewURI(aBaseURL, baseHref, nsnull, docBaseURL); + *aBaseURI = nsnull; + return NS_NewURI(aBaseURI, baseHref, nsnull, docBaseURI); } - *aBaseURL = docBaseURL; - NS_IF_ADDREF(*aBaseURL); + *aBaseURI = docBaseURI; + NS_IF_ADDREF(*aBaseURI); return result; } @@ -2493,7 +2484,7 @@ nsGenericHTMLElement::ListAttributes(FILE* out) const } } -nsresult +void nsGenericHTMLElement::List(FILE* out, PRInt32 aIndent) const { NS_PRECONDITION(nsnull != mDocument, "bad content"); @@ -2521,13 +2512,12 @@ nsGenericHTMLElement::List(FILE* out, PRInt32 aIndent) const for (index = aIndent; --index >= 0; ) fputs(" ", out); } fputs(">\n", out); - - return NS_OK; } -nsresult +void nsGenericHTMLElement::DumpContent(FILE* out, PRInt32 aIndent, - PRBool aDumpAll) const { + PRBool aDumpAll) const +{ NS_PRECONDITION(nsnull != mDocument, "bad content"); PRInt32 index; @@ -2557,14 +2547,12 @@ nsGenericHTMLElement::DumpContent(FILE* out, PRInt32 aIndent, if(aIndent) fputs("\n", out); } - - return NS_OK; } #endif -NS_IMETHODIMP_(PRBool) -nsGenericHTMLElement::IsContentOfType(PRUint32 aFlags) +PRBool +nsGenericHTMLElement::IsContentOfType(PRUint32 aFlags) const { return !(aFlags & ~(eELEMENT | eHTML)); } @@ -2608,7 +2596,7 @@ nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute, return NS_CONTENT_ATTR_NOT_THERE; } -NS_IMETHODIMP_(PRBool) +PRBool nsGenericHTMLElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { static const AttributeDependenceEntry* const map[] = { @@ -3112,8 +3100,7 @@ nsGenericHTMLElement::AttrToURI(nsIAtom* aAttrName, nsAString& aAbsoluteURI) return NS_OK; } - nsCOMPtr baseURI; - GetBaseURL(getter_AddRefs(baseURI)); + nsCOMPtr baseURI = GetBaseURI(); nsIDocument* doc = GetOwnerDocument(); @@ -3191,11 +3178,10 @@ nsGenericHTMLElement::ParseStyleAttribute(const nsAString& aValue, nsHTMLValue& } } if (cssParser) { - nsCOMPtr baseURL; - GetBaseURL(getter_AddRefs(baseURL)); + nsCOMPtr baseURI = GetBaseURI(); nsCOMPtr rule; - result = cssParser->ParseStyleAttribute(aValue, baseURL, + result = cssParser->ParseStyleAttribute(aValue, baseURI, getter_AddRefs(rule)); if (cssLoader) { cssLoader->RecycleParser(cssParser); @@ -3502,14 +3488,14 @@ nsGenericHTMLElement::MapBackgroundAttributesInto(const nsIHTMLMappedAttributes* nsCOMPtr doc; nsresult rv = shell->GetDocument(getter_AddRefs(doc)); if (NS_SUCCEEDED(rv) && doc) { - nsCOMPtr docURL; + nsCOMPtr docURI; nsHTMLValue baseHref; aAttributes->GetAttribute(nsHTMLAtoms::_baseHref, baseHref); - nsGenericHTMLElement::GetBaseURL(baseHref, doc, - getter_AddRefs(docURL)); + nsGenericHTMLElement::GetBaseURI(baseHref, doc, + getter_AddRefs(docURI)); nsCOMPtr uri; rv = nsContentUtils::NewURIWithDocumentCharset( - getter_AddRefs(uri), spec, doc, docURL); + getter_AddRefs(uri), spec, doc, docURI); if (NS_SUCCEEDED(rv)) { nsCSSValue::URL *url = new nsCSSValue::URL(uri, spec.get()); if (url) { @@ -3744,25 +3730,25 @@ nsGenericHTMLContainerElement::Compact() return NS_OK; } -NS_IMETHODIMP_(PRBool) +PRBool nsGenericHTMLContainerElement::CanContainChildren() const { return PR_TRUE; } -NS_IMETHODIMP_(PRUint32) +PRUint32 nsGenericHTMLContainerElement::GetChildCount() const { return mChildren.Count(); } -NS_IMETHODIMP_(nsIContent *) +nsIContent * nsGenericHTMLContainerElement::GetChildAt(PRUint32 aIndex) const { return (nsIContent *)mChildren.SafeElementAt(aIndex); } -NS_IMETHODIMP_(PRInt32) +PRInt32 nsGenericHTMLContainerElement::IndexOf(nsIContent* aPossibleChild) const { return mChildren.IndexOf(aPossibleChild); @@ -3846,8 +3832,8 @@ NS_INTERFACE_MAP_BEGIN(nsGenericHTMLContainerFormElement) NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement) -NS_IMETHODIMP_(PRBool) -nsGenericHTMLContainerFormElement::IsContentOfType(PRUint32 aFlags) +PRBool +nsGenericHTMLContainerFormElement::IsContentOfType(PRUint32 aFlags) const { return !(aFlags & ~(eELEMENT | eHTML | eHTML_FORM_CONTROL)); } @@ -3911,7 +3897,7 @@ nsGenericHTMLContainerFormElement::GetForm(nsIDOMHTMLFormElement** aForm) return NS_OK; } -NS_IMETHODIMP_(void) +void nsGenericHTMLContainerFormElement::SetParent(nsIContent* aParent) { if (!aParent && mForm) { @@ -3929,7 +3915,7 @@ nsGenericHTMLContainerFormElement::SetParent(nsIContent* aParent) nsGenericElement::SetParent(aParent); } -NS_IMETHODIMP +void nsGenericHTMLContainerFormElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) @@ -3952,8 +3938,7 @@ nsGenericHTMLContainerFormElement::SetDocument(nsIDocument* aDocument, } } - return nsGenericHTMLElement::SetDocument(aDocument, aDeep, - aCompileEventHandlers); + nsGenericHTMLElement::SetDocument(aDocument, aDeep, aCompileEventHandlers); } @@ -4024,7 +4009,7 @@ nsGenericHTMLElement::SetFormControlAttribute(nsIForm* aForm, return rv; } -NS_IMETHODIMP +nsresult nsGenericHTMLContainerFormElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAString& aVal, @@ -4033,7 +4018,7 @@ nsGenericHTMLContainerFormElement::SetAttr(PRInt32 aNameSpaceID, return SetFormControlAttribute(mForm, aNameSpaceID, aName, aVal, aNotify); } -NS_IMETHODIMP +nsresult nsGenericHTMLContainerFormElement::SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, PRBool aNotify) @@ -4059,8 +4044,8 @@ NS_INTERFACE_MAP_BEGIN(nsGenericHTMLLeafFormElement) NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement) -NS_IMETHODIMP_(PRBool) -nsGenericHTMLLeafFormElement::IsContentOfType(PRUint32 aFlags) +PRBool +nsGenericHTMLLeafFormElement::IsContentOfType(PRUint32 aFlags) const { return !(aFlags & ~(eELEMENT | eHTML | eHTML_FORM_CONTROL)); } @@ -4124,7 +4109,7 @@ nsGenericHTMLLeafFormElement::GetForm(nsIDOMHTMLFormElement** aForm) return NS_OK; } -NS_IMETHODIMP_(void) +void nsGenericHTMLLeafFormElement::SetParent(nsIContent* aParent) { PRBool old_parent = NS_PTR_TO_INT32(GetParent()); @@ -4144,7 +4129,7 @@ nsGenericHTMLLeafFormElement::SetParent(nsIContent* aParent) } } -NS_IMETHODIMP +void nsGenericHTMLLeafFormElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) @@ -4167,18 +4152,16 @@ nsGenericHTMLLeafFormElement::SetDocument(nsIDocument* aDocument, } } - return nsGenericHTMLElement::SetDocument(aDocument, aDeep, - aCompileEventHandlers); + nsGenericHTMLElement::SetDocument(aDocument, aDeep, aCompileEventHandlers); } -NS_IMETHODIMP +void nsGenericHTMLLeafFormElement::DoneCreatingElement() { RestoreFormControlState(this, this); - return NS_OK; } -NS_IMETHODIMP +nsresult nsGenericHTMLLeafFormElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAString& aValue, @@ -4187,7 +4170,7 @@ nsGenericHTMLLeafFormElement::SetAttr(PRInt32 aNameSpaceID, return SetFormControlAttribute(mForm, aNameSpaceID, aName, aValue, aNotify); } -NS_IMETHODIMP +nsresult nsGenericHTMLLeafFormElement::SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, PRBool aNotify) @@ -4195,27 +4178,26 @@ nsGenericHTMLLeafFormElement::SetAttr(nsINodeInfo* aNodeInfo, return nsGenericHTMLLeafElement::SetAttr(aNodeInfo, aValue, aNotify); } -nsresult +void nsGenericHTMLElement::SetElementFocus(PRBool aDoFocus) { nsCOMPtr presContext; GetPresContext(this, getter_AddRefs(presContext)); - if (!presContext) { - return NS_OK; - } + if (!presContext) + return; if (aDoFocus) { - nsresult rv = SetFocus(presContext); - NS_ENSURE_SUCCESS(rv,rv); + SetFocus(presContext); + nsCOMPtr esm; - rv = presContext->GetEventStateManager(getter_AddRefs(esm)); + presContext->GetEventStateManager(getter_AddRefs(esm)); if (esm) { - rv = esm->MoveCaretToFocus(); + esm->MoveCaretToFocus(); } - return rv; + return; } - return RemoveFocus(presContext); + RemoveFocus(presContext); } nsresult nsGenericHTMLElement::RegUnRegAccessKey(PRBool aDoReg) @@ -4457,7 +4439,7 @@ nsGenericHTMLElement::GetProtocolFromHrefString(const nsAString& aHref, // set the protocol to the protocol of the base URI. if (aDocument) { - nsIURI *uri = aDocument->GetBaseURL(); + nsIURI *uri = aDocument->GetBaseURI(); if (uri) { uri->GetScheme(protocol); } diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.h b/mozilla/content/html/content/src/nsGenericHTMLElement.h index 336a5809f26..0b37c8c763b 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.h +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.h @@ -81,7 +81,7 @@ public: virtual ~nsGenericHTMLElement(); #ifdef GATHER_ELEMENT_USEAGE_STATISTICS - nsresult Init(nsINodeInfo *aNodeInfo); + virtual nsresult Init(nsINodeInfo *aNodeInfo); #endif /** Call on shutdown to release globals */ @@ -102,9 +102,8 @@ public: void **aInstancePtr); // From nsGenericElement - NS_METHOD CopyInnerTo(nsIContent* aSrcContent, - nsGenericHTMLElement* aDest, - PRBool aDeep); + virtual nsresult CopyInnerTo(nsIContent* aSrcContent, + nsGenericHTMLElement* aDest, PRBool aDeep); // Implementation for nsIDOMNode NS_METHOD GetNodeName(nsAString& aNodeName); @@ -123,33 +122,33 @@ public: nsIDOMNodeList** aReturn); // Implementation for nsIDOMHTMLElement - nsresult GetId(nsAString& aId); - nsresult SetId(const nsAString& aId); - nsresult GetTitle(nsAString& aTitle); - nsresult SetTitle(const nsAString& aTitle); - nsresult GetLang(nsAString& aLang); - nsresult SetLang(const nsAString& aLang); - nsresult GetDir(nsAString& aDir); - nsresult SetDir(const nsAString& aDir); - nsresult GetClassName(nsAString& aClassName); - nsresult SetClassName(const nsAString& aClassName); - nsresult GetStyle(nsIDOMCSSStyleDeclaration** aStyle); - nsresult GetOffsetTop(PRInt32* aOffsetTop); - nsresult GetOffsetLeft(PRInt32* aOffsetLeft); - nsresult GetOffsetWidth(PRInt32* aOffsetWidth); - nsresult GetOffsetHeight(PRInt32* aOffsetHeight); - nsresult GetOffsetParent(nsIDOMElement** aOffsetParent); - virtual nsresult GetInnerHTML(nsAString& aInnerHTML); - virtual nsresult SetInnerHTML(const nsAString& aInnerHTML); - nsresult GetScrollTop(PRInt32* aScrollTop); - nsresult SetScrollTop(PRInt32 aScrollTop); - nsresult GetScrollLeft(PRInt32* aScrollLeft); - nsresult SetScrollLeft(PRInt32 aScrollLeft); - nsresult GetScrollHeight(PRInt32* aScrollHeight); - nsresult GetScrollWidth(PRInt32* aScrollWidth); - nsresult GetClientHeight(PRInt32* aClientHeight); - nsresult GetClientWidth(PRInt32* aClientWidth); - nsresult ScrollIntoView(PRBool aTop); + NS_IMETHOD GetId(nsAString& aId); + NS_IMETHOD SetId(const nsAString& aId); + NS_IMETHOD GetTitle(nsAString& aTitle); + NS_IMETHOD SetTitle(const nsAString& aTitle); + NS_IMETHOD GetLang(nsAString& aLang); + NS_IMETHOD SetLang(const nsAString& aLang); + NS_IMETHOD GetDir(nsAString& aDir); + NS_IMETHOD SetDir(const nsAString& aDir); + NS_IMETHOD GetClassName(nsAString& aClassName); + NS_IMETHOD SetClassName(const nsAString& aClassName); + NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle); + NS_IMETHOD GetOffsetTop(PRInt32* aOffsetTop); + NS_IMETHOD GetOffsetLeft(PRInt32* aOffsetLeft); + NS_IMETHOD GetOffsetWidth(PRInt32* aOffsetWidth); + NS_IMETHOD GetOffsetHeight(PRInt32* aOffsetHeight); + NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent); + NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML); + NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML); + NS_IMETHOD GetScrollTop(PRInt32* aScrollTop); + NS_IMETHOD SetScrollTop(PRInt32 aScrollTop); + NS_IMETHOD GetScrollLeft(PRInt32* aScrollLeft); + NS_IMETHOD SetScrollLeft(PRInt32 aScrollLeft); + NS_IMETHOD GetScrollHeight(PRInt32* aScrollHeight); + NS_IMETHOD GetScrollWidth(PRInt32* aScrollWidth); + NS_IMETHOD GetClientHeight(PRInt32* aClientHeight); + NS_IMETHOD GetClientWidth(PRInt32* aClientWidth); + NS_IMETHOD ScrollIntoView(PRBool aTop); /** * Get the frame's offset information for offsetTop/Left/Width/Height. @@ -171,33 +170,29 @@ public: static const nsSize GetClientAreaSize(nsIFrame *aFrame); // Implementation for nsIContent - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers); - NS_IMETHOD GetNameSpaceID(PRInt32* aID) const; - NS_IMETHOD_(already_AddRefed) GetExistingAttrNameFromQName(const nsAString& aStr); - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, - PRBool aNotify); - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, - const nsAString& aValue, - PRBool aNotify); - NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsAString& aResult) const; - NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom** aPrefix, nsAString& aResult) const; - NS_IMETHOD_(PRBool) HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const; - NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - PRBool aNotify); - NS_IMETHOD GetAttrNameAt(PRUint32 aIndex, - PRInt32* aNameSpaceID, - nsIAtom** aName, - nsIAtom** aPrefix) const; - NS_IMETHOD_(PRUint32) GetAttrCount() const; + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); + virtual void GetNameSpaceID(PRInt32* aID) const; + virtual already_AddRefed GetExistingAttrNameFromQName(const nsAString& aStr) const; + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify); + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify); + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsAString& aResult) const; + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsIAtom** aPrefix, nsAString& aResult) const; + virtual PRBool HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const; + virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + PRBool aNotify); + virtual nsresult GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, + nsIAtom** aName, nsIAtom** aPrefix) const; + virtual PRUint32 GetAttrCount() const; #ifdef DEBUG - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; - NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const; + virtual void List(FILE* out, PRInt32 aIndent) const; + virtual void DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const; #endif - NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags); + virtual PRBool IsContentOfType(PRUint32 aFlags) const; /** * Standard anchor HandleDOMEvent, used by A, AREA and LINK (parameters @@ -219,13 +214,13 @@ public: NS_IMETHOD GetHTMLAttribute(nsIAtom* aAttribute, nsHTMLValue& aValue) const; NS_IMETHOD GetID(nsIAtom** aResult) const; NS_IMETHOD GetClasses(nsVoidArray& aArray) const; - NS_IMETHOD_(nsIAtom*) GetIDAttributeName() const; - NS_IMETHOD_(nsIAtom*) GetClassAttributeName() const; + virtual nsIAtom *GetIDAttributeName() const; + virtual nsIAtom *GetClassAttributeName() const; NS_IMETHOD_(PRBool) HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const; NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker); NS_IMETHOD GetInlineStyleRule(nsICSSStyleRule** aStyleRule); NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify); - NS_IMETHOD GetBaseURL(nsIURI** aBaseURL) const; + already_AddRefed GetBaseURI() const; NS_IMETHOD GetBaseTarget(nsAString& aBaseTarget) const; //---------------------------------------- @@ -655,7 +650,7 @@ public: * @param aDocument the document * @param aResult the base URL */ - static nsresult GetBaseURL(const nsHTMLValue& aBaseHref, + static nsresult GetBaseURI(const nsHTMLValue& aBaseHref, nsIDocument* aDocument, nsIURI** aResult); @@ -755,7 +750,7 @@ protected: * methods where you want to catch what occurs on your element. * @param aDoFocus true to focus, false to blur */ - nsresult SetElementFocus(PRBool aDoFocus); + void SetElementFocus(PRBool aDoFocus); /** * Register or unregister an access key to this element based on the * accesskey attribute. @@ -819,31 +814,31 @@ public: NS_IMETHOD Compact() { return NS_OK; } - NS_IMETHOD_(PRBool) CanContainChildren() const { + virtual PRBool CanContainChildren() const { return PR_FALSE; } - NS_IMETHOD_(PRUint32) GetChildCount() const { + virtual PRUint32 GetChildCount() const { return 0; } - NS_IMETHOD_(nsIContent *) GetChildAt(PRUint32 aIndex) const { + virtual nsIContent *GetChildAt(PRUint32 aIndex) const { return nsnull; } - NS_IMETHOD_(PRInt32) IndexOf(nsIContent* aPossibleChild) const { + virtual PRInt32 IndexOf(nsIContent* aPossibleChild) const { return -1; } - NS_IMETHOD InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument) { + virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument) { return NS_OK; } - NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument) { + virtual nsresult ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument) { return NS_OK; } - NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify, - PRBool aDeepSetDocument) { + virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument) { return NS_OK; } - NS_IMETHOD RemoveChildAt(PRUint32 aIndex, PRBool aNotify) { + virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify) { return NS_OK; } }; @@ -890,10 +885,10 @@ public: // Remainder of nsIHTMLContent (and nsIContent) NS_IMETHOD Compact(); - NS_IMETHOD_(PRBool) CanContainChildren() const; - NS_IMETHOD_(PRUint32) GetChildCount() const; - NS_IMETHOD_(nsIContent *) GetChildAt(PRUint32 aIndex) const; - NS_IMETHOD_(PRInt32) IndexOf(nsIContent* aPossibleChild) const; + virtual PRBool CanContainChildren() const; + virtual PRUint32 GetChildCount() const; + virtual nsIContent *GetChildAt(PRUint32 aIndex) const; + virtual PRInt32 IndexOf(nsIContent* aPossibleChild) const; // Child list modification hooks virtual PRBool InternalInsertChildAt(nsIContent* aKid, PRUint32 aIndex) { @@ -947,7 +942,7 @@ public: NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); - NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags); + virtual PRBool IsContentOfType(PRUint32 aFlags) const; // nsIFormControl NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); @@ -957,20 +952,18 @@ public: NS_IMETHOD RestoreState(nsIPresState* aState) { return NS_OK; } // nsIContent - NS_IMETHOD_(void) SetParent(nsIContent *aParent); - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers); + virtual void SetParent(nsIContent *aParent); + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, PRBool aNotify); + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify); - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, - const nsAString& aValue, - PRBool aNotify); + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify); - - NS_METHOD SetAttribute(const nsAString& aName, - const nsAString& aValue) + NS_IMETHOD SetAttribute(const nsAString& aName, + const nsAString& aValue) { return nsGenericHTMLElement::SetAttribute(aName, aValue); } @@ -994,7 +987,7 @@ public: NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); - NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags); + virtual PRBool IsContentOfType(PRUint32 aFlags) const; // nsIFormControl NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); @@ -1004,20 +997,19 @@ public: NS_IMETHOD RestoreState(nsIPresState* aState) { return NS_OK; } // nsIContent - NS_IMETHOD_(void) SetParent(nsIContent *aParent); - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers); + virtual void SetParent(nsIContent *aParent); + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, PRBool aNotify); + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify); - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, - const nsAString& aValue, - PRBool aNotify); - NS_IMETHOD DoneCreatingElement(); + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify); + virtual void DoneCreatingElement(); - NS_METHOD SetAttribute(const nsAString& aName, - const nsAString& aValue) + NS_IMETHOD SetAttribute(const nsAString& aName, + const nsAString& aValue) { return nsGenericHTMLElement::SetAttribute(aName, aValue); } diff --git a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp index e812e19131a..25ccb1d44b0 100644 --- a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp @@ -107,30 +107,28 @@ public: NS_IMETHOD SetLinkState(nsLinkState aState); NS_IMETHOD GetHrefURI(nsIURI** aURI); - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers); - NS_IMETHOD SetFocus(nsIPresContext* aPresContext); - NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext); + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); + virtual void SetFocus(nsIPresContext* aPresContext); + virtual void RemoveFocus(nsIPresContext* aPresContext); NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, const nsAString& aValue, nsHTMLValue& aResult); - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, PRUint32 aFlags, - nsEventStatus* aEventStatus); + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus); - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, - PRBool aNotify); - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, - const nsAString& aValue, - PRBool aNotify); - NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRBool aNotify); + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify); + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify); + virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify); protected: // The cached visited state nsLinkState mLinkState; - }; @@ -226,7 +224,7 @@ NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Type, type) NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, AccessKey, accesskey) -NS_IMETHODIMP +void nsHTMLAnchorElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) { @@ -237,34 +235,38 @@ nsHTMLAnchorElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, RegUnRegAccessKey(PR_FALSE); } - nsresult rv = - nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep, - aCompileEventHandlers); + nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep, + aCompileEventHandlers); // Register the access key for the new document. if (documentChanging && mDocument) { RegUnRegAccessKey(PR_TRUE); } - - return rv; } NS_IMETHODIMP nsHTMLAnchorElement::Blur() { - return SetElementFocus(PR_FALSE); + SetElementFocus(PR_FALSE); + + return NS_OK; } NS_IMETHODIMP nsHTMLAnchorElement::Focus() { - return SetElementFocus(PR_TRUE); + SetElementFocus(PR_TRUE); + + return NS_OK; } -NS_IMETHODIMP +void nsHTMLAnchorElement::SetFocus(nsIPresContext* aPresContext) { - NS_ENSURE_ARG_POINTER(aPresContext); + if (!aPresContext) { + return; + } + // don't make the link grab the focus if there is no link handler nsCOMPtr handler; nsresult rv = aPresContext->GetLinkHandler(getter_AddRefs(handler)); @@ -293,29 +295,24 @@ nsHTMLAnchorElement::SetFocus(nsIPresContext* aPresContext) } } } - - return NS_OK; } -NS_IMETHODIMP +void nsHTMLAnchorElement::RemoveFocus(nsIPresContext* aPresContext) { - NS_ENSURE_ARG_POINTER(aPresContext); + if (!aPresContext) { + return; + } + // If we are disabled, we probably shouldn't have focus in the // first place, so allow it to be removed. - nsresult rv = NS_OK; nsCOMPtr esm; aPresContext->GetEventStateManager(getter_AddRefs(esm)); - if (esm) { - if (!mDocument) - return NS_ERROR_NULL_POINTER; - - rv = esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS); + if (esm && mDocument) { + esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS); } - - return rv; } NS_IMETHODIMP @@ -339,7 +336,7 @@ nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute, } // XXX support suppress in here -NS_IMETHODIMP +nsresult nsHTMLAnchorElement::HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, @@ -640,7 +637,7 @@ nsHTMLAnchorElement::GetHrefURI(nsIURI** aURI) return GetHrefURIForAnchors(aURI); } -NS_IMETHODIMP +nsresult nsHTMLAnchorElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAString& aValue, PRBool aNotify) @@ -668,16 +665,16 @@ nsHTMLAnchorElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, return rv; } -NS_IMETHODIMP -nsHTMLAnchorElement::SetAttr(nsINodeInfo* aNodeInfo, - const nsAString& aValue, +nsresult +nsHTMLAnchorElement::SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, PRBool aNotify) { return nsGenericHTMLElement::SetAttr(aNodeInfo, aValue, aNotify); } -NS_IMETHODIMP -nsHTMLAnchorElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) +nsresult +nsHTMLAnchorElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify) { if (aAttribute == nsHTMLAtoms::href && kNameSpaceID_None == aNameSpaceID) { SetLinkState(eLinkState_Unknown); diff --git a/mozilla/content/html/content/src/nsHTMLAreaElement.cpp b/mozilla/content/html/content/src/nsHTMLAreaElement.cpp index 7d5ba3b9e8e..077761d7cb0 100644 --- a/mozilla/content/html/content/src/nsHTMLAreaElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAreaElement.cpp @@ -87,22 +87,21 @@ public: NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, const nsAString& aValue, nsHTMLValue& aResult); - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, PRUint32 aFlags, - nsEventStatus* aEventStatus); - NS_IMETHOD SetFocus(nsIPresContext* aPresContext); - NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext); + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus); + virtual void SetFocus(nsIPresContext* aPresContext); + virtual void RemoveFocus(nsIPresContext* aPresContext); - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers); - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, - const nsAString& aValue, - PRBool aNotify); - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, - PRBool aNotify); - NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRBool aNotify); + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify); + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify); + virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify); protected: // The cached visited state @@ -216,7 +215,7 @@ nsHTMLAreaElement::StringToAttribute(nsIAtom* aAttribute, return NS_CONTENT_ATTR_NOT_THERE; } -NS_IMETHODIMP +nsresult nsHTMLAreaElement::HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, @@ -227,10 +226,12 @@ nsHTMLAreaElement::HandleDOMEvent(nsIPresContext* aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP +void nsHTMLAreaElement::SetFocus(nsIPresContext* aPresContext) { - NS_ENSURE_ARG_POINTER(aPresContext); + if (!aPresContext) + return; + nsCOMPtr esm; aPresContext->GetEventStateManager(getter_AddRefs(esm)); if (esm) { @@ -252,22 +253,22 @@ nsHTMLAreaElement::SetFocus(nsIPresContext* aPresContext) } } } - return NS_OK; } -NS_IMETHODIMP +void nsHTMLAreaElement::RemoveFocus(nsIPresContext* aPresContext) { - NS_ENSURE_ARG_POINTER(aPresContext); - nsIEventStateManager* esm; - if (NS_OK == aPresContext->GetEventStateManager(&esm)) { + if (!aPresContext) + return; + + nsCOMPtr esm; + aPresContext->GetEventStateManager(getter_AddRefs(esm)); + if (esm) { esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS); - NS_RELEASE(esm); } - return NS_OK; } -NS_IMETHODIMP +void nsHTMLAreaElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) { @@ -278,18 +279,15 @@ nsHTMLAreaElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, RegUnRegAccessKey(PR_FALSE); } - nsresult rv = nsGenericHTMLElement::SetDocument(aDocument, aDeep, - aCompileEventHandlers); + nsGenericHTMLElement::SetDocument(aDocument, aDeep, aCompileEventHandlers); // Register the access key for the new document. if (documentChanging && mDocument) { RegUnRegAccessKey(PR_TRUE); } - - return rv; } -NS_IMETHODIMP +nsresult nsHTMLAreaElement::SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, PRBool aNotify) @@ -297,8 +295,7 @@ nsHTMLAreaElement::SetAttr(nsINodeInfo* aNodeInfo, return nsGenericHTMLElement::SetAttr(aNodeInfo, aValue, aNotify); } - -NS_IMETHODIMP +nsresult nsHTMLAreaElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAString& aValue, PRBool aNotify) @@ -322,7 +319,7 @@ nsHTMLAreaElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, return rv; } -NS_IMETHODIMP +nsresult nsHTMLAreaElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) { diff --git a/mozilla/content/html/content/src/nsHTMLBodyElement.cpp b/mozilla/content/html/content/src/nsHTMLBodyElement.cpp index 58614a9513b..bb2ef95611a 100644 --- a/mozilla/content/html/content/src/nsHTMLBodyElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLBodyElement.cpp @@ -116,8 +116,8 @@ public: NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, const nsAString& aValue, nsHTMLValue& aResult); - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers); + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker); NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; @@ -495,7 +495,7 @@ nsHTMLBodyElement::StringToAttribute(nsIAtom* aAttribute, return NS_CONTENT_ATTR_NOT_THERE; } -NS_IMETHODIMP +void nsHTMLBodyElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) { @@ -506,8 +506,8 @@ nsHTMLBodyElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, // destroy old style rule since the sheet will probably change NS_RELEASE(mContentStyleRule); } - return nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep, - aCompileEventHandlers); + nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep, + aCompileEventHandlers); } static diff --git a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp index 0d0e6829c30..97b0686bdb0 100644 --- a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp @@ -102,19 +102,18 @@ public: nsAString& aResult) const; NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAString& aValue, PRBool aNotify); - NS_IMETHOD SetFocus(nsIPresContext* aPresContext); - NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext); + virtual void SetFocus(nsIPresContext* aPresContext); + virtual void RemoveFocus(nsIPresContext* aPresContext); NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, const nsAString& aValue, nsHTMLValue& aResult); NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, nsAString& aResult) const; - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, - nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, - PRUint32 aFlags, - nsEventStatus* aEventStatus); + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus); protected: PRInt8 mType; @@ -280,13 +279,17 @@ NS_IMPL_STRING_ATTR(nsHTMLButtonElement, Value, value) NS_IMETHODIMP nsHTMLButtonElement::Blur() { - return SetElementFocus(PR_FALSE); + SetElementFocus(PR_FALSE); + + return NS_OK; } NS_IMETHODIMP nsHTMLButtonElement::Focus() { - return SetElementFocus(PR_TRUE); + SetElementFocus(PR_TRUE); + + return NS_OK; } NS_IMETHODIMP @@ -327,20 +330,23 @@ nsHTMLButtonElement::Click() return NS_OK; } -NS_IMETHODIMP +void nsHTMLButtonElement::SetFocus(nsIPresContext* aPresContext) { - NS_ENSURE_ARG_POINTER(aPresContext); + if (!aPresContext) + return; + // first see if we are disabled or not. If disabled then do nothing. nsAutoString disabled; if (NS_CONTENT_ATTR_HAS_VALUE == GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled)) { - return NS_OK; + return; } nsCOMPtr esm; - if (NS_OK == aPresContext->GetEventStateManager(getter_AddRefs(esm))) { + aPresContext->GetEventStateManager(getter_AddRefs(esm)); + if (esm) { esm->SetContentState(this, NS_EVENT_STATE_FOCUS); } @@ -350,18 +356,16 @@ nsHTMLButtonElement::SetFocus(nsIPresContext* aPresContext) formControlFrame->SetFocus(PR_TRUE, PR_TRUE); formControlFrame->ScrollIntoView(aPresContext); } - - return NS_OK; } -NS_IMETHODIMP +void nsHTMLButtonElement::RemoveFocus(nsIPresContext* aPresContext) { - NS_ENSURE_ARG_POINTER(aPresContext); + if (!aPresContext) + return; + // If we are disabled, we probably shouldn't have focus in the // first place, so allow it to be removed. - nsresult rv = NS_OK; - nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_FALSE); if (formControlFrame) { @@ -369,15 +373,10 @@ nsHTMLButtonElement::RemoveFocus(nsIPresContext* aPresContext) } nsCOMPtr esm; - if (NS_OK == aPresContext->GetEventStateManager(getter_AddRefs(esm))) { - - if (!mDocument) - return NS_ERROR_NULL_POINTER; - - rv = esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS); + aPresContext->GetEventStateManager(getter_AddRefs(esm)); + if (esm && mDocument) { + esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS); } - - return rv; } static const nsHTMLValue::EnumTable kButtonTypeTable[] = { @@ -433,7 +432,7 @@ nsHTMLButtonElement::AttributeToString(nsIAtom* aAttribute, aValue, aResult); } -NS_IMETHODIMP +nsresult nsHTMLButtonElement::HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, diff --git a/mozilla/content/html/content/src/nsHTMLFormElement.cpp b/mozilla/content/html/content/src/nsHTMLFormElement.cpp index 81e44bc5ac1..66feb04bf7e 100644 --- a/mozilla/content/html/content/src/nsHTMLFormElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFormElement.cpp @@ -104,8 +104,9 @@ public: mIsSubmitting(PR_FALSE), mDeferSubmission(PR_FALSE), mPendingSubmission(nsnull), - mSubmittingRequest(nsnull) { } - + mSubmittingRequest(nsnull) + { + } virtual ~nsHTMLFormElement(); @@ -169,15 +170,17 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, nsAString& aResult) const; - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, PRUint32 aFlags, - nsEventStatus* aEventStatus); - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers); - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, PRBool aNotify); - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, - PRBool aNotify) { + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus); + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify); + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify) + { // This will end up calling the other SetAttr(). return nsGenericHTMLContainerElement::SetAttr(aNodeInfo, aValue, aNotify); } @@ -526,7 +529,7 @@ nsHTMLFormElement::GetElements(nsIDOMHTMLCollection** aElements) return NS_OK; } -NS_IMETHODIMP +nsresult nsHTMLFormElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAString& aValue, PRBool aNotify) { @@ -663,14 +666,13 @@ nsHTMLFormElement::AttributeToString(nsIAtom* aAttribute, aValue, aResult); } -NS_IMETHODIMP +void nsHTMLFormElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) { nsCOMPtr oldDocument = do_QueryInterface(mDocument); - nsresult rv = nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep, - aCompileEventHandlers); - NS_ENSURE_SUCCESS(rv, rv); + nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep, + aCompileEventHandlers); nsCOMPtr newDocument = do_QueryInterface(mDocument); if (oldDocument != newDocument) { @@ -682,12 +684,10 @@ nsHTMLFormElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, newDocument->AddedForm(); } } - - return rv; } -NS_IMETHODIMP +nsresult nsHTMLFormElement::HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, @@ -1272,8 +1272,8 @@ nsHTMLFormElement::GetActionURL(nsIURI** aActionURL) } // Get base URL - nsIURI *docURL = mDocument->GetDocumentURL(); - NS_ENSURE_TRUE(docURL, NS_ERROR_UNEXPECTED); + nsIURI *docURI = mDocument->GetDocumentURI(); + NS_ENSURE_TRUE(docURI, NS_ERROR_UNEXPECTED); // If an action is not specified and we are inside // a HTML document then reload the URL. This makes us @@ -1291,11 +1291,10 @@ nsHTMLFormElement::GetActionURL(nsIURI** aActionURL) return NS_OK; } - rv = docURL->Clone(getter_AddRefs(actionURL)); + rv = docURI->Clone(getter_AddRefs(actionURL)); NS_ENSURE_SUCCESS(rv, rv); } else { - nsCOMPtr baseURL; - GetBaseURL(getter_AddRefs(baseURL)); + nsCOMPtr baseURL = GetBaseURI(); NS_ASSERTION(baseURL, "No Base URL found in Form Submit!\n"); if (!baseURL) { return NS_OK; // No base URL -> exit early, see Bug 30721 @@ -1311,7 +1310,7 @@ nsHTMLFormElement::GetActionURL(nsIURI** aActionURL) // nsIScriptSecurityManager *securityManager = nsContentUtils::GetSecurityManager(); - rv = securityManager->CheckLoadURI(docURL, actionURL, + rv = securityManager->CheckLoadURI(docURI, actionURL, nsIScriptSecurityManager::STANDARD); NS_ENSURE_SUCCESS(rv, rv); diff --git a/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp b/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp index 45bbc18ce12..07368504610 100644 --- a/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp @@ -71,11 +71,10 @@ public: // These override the SetAttr methods in nsGenericHTMLElement (need // both here to silence compiler warnings). - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - const nsAString& aValue, PRBool aNotify); - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, - const nsAString& aValue, - PRBool aNotify); + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + const nsAString& aValue, PRBool aNotify); + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify); // nsIFramesetElement NS_IMETHOD GetRowSpec(PRInt32 *aNumValues, const nsFramesetSpec** aSpecs); @@ -210,7 +209,7 @@ nsHTMLFrameSetElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMPL_STRING_ATTR(nsHTMLFrameSetElement, Cols, cols) NS_IMPL_STRING_ATTR(nsHTMLFrameSetElement, Rows, rows) -NS_IMETHODIMP +nsresult nsHTMLFrameSetElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsAString& aValue, @@ -251,23 +250,19 @@ nsHTMLFrameSetElement::SetAttr(PRInt32 aNameSpaceID, } } - rv = nsGenericHTMLContainerElement::SetAttr(aNameSpaceID, - aAttribute, - aValue, + rv = nsGenericHTMLContainerElement::SetAttr(aNameSpaceID, aAttribute, aValue, aNotify); mCurrentRowColHint = NS_STYLE_HINT_REFLOW; return rv; } -NS_IMETHODIMP +nsresult nsHTMLFrameSetElement::SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, PRBool aNotify) { - return nsGenericHTMLContainerElement::SetAttr(aNodeInfo, - aValue, - aNotify); + return nsGenericHTMLContainerElement::SetAttr(aNodeInfo, aValue, aNotify); } diff --git a/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp b/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp index cbe7863e84c..4e26d563bb5 100644 --- a/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp @@ -91,9 +91,9 @@ public: NS_IMETHOD SetFrameLoader(nsIFrameLoader *aFrameLoader); // nsIContent - NS_IMETHOD_(void) SetParent(nsIContent *aParent); - NS_IMETHOD SetDocument(nsIDocument *aDocument, PRBool aDeep, - PRBool aCompileEventHandlers); + virtual void SetParent(nsIContent *aParent); + virtual void SetDocument(nsIDocument *aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, const nsAString& aValue, @@ -101,8 +101,9 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, nsAString& aResult) const; - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, PRBool aNotify) { + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify) + { nsresult rv = nsGenericHTMLContainerElement::SetAttr(aNameSpaceID, aName, aValue, aNotify); @@ -113,8 +114,9 @@ public: return rv; } - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, - PRBool aNotify) { + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify) + { // This will end up calling our other SetAttr method return nsGenericHTMLContainerElement::SetAttr(aNodeInfo, aValue, aNotify); } @@ -320,7 +322,7 @@ nsHTMLIFrameElement::LoadSrc() } -NS_IMETHODIMP_(void) +void nsHTMLIFrameElement::SetParent(nsIContent *aParent) { nsGenericHTMLContainerElement::SetParent(aParent); @@ -334,16 +336,14 @@ nsHTMLIFrameElement::SetParent(nsIContent *aParent) LoadSrc(); } -NS_IMETHODIMP +void nsHTMLIFrameElement::SetDocument(nsIDocument *aDocument, PRBool aDeep, PRBool aCompileEventHandlers) { const nsIDocument *old_doc = mDocument; - nsresult rv = - nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep, - aCompileEventHandlers); - NS_ENSURE_SUCCESS(rv, rv); + nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep, + aCompileEventHandlers); if (!aDocument && mFrameLoader) { // This iframe is being taken out of the document, destroy the @@ -358,11 +358,9 @@ nsHTMLIFrameElement::SetDocument(nsIDocument *aDocument, PRBool aDeep, // When document is being set to null on the element's destruction, // or when the document is being set to what the document already // is, do not call LoadSrc(). - if (!GetParent() || !aDocument || aDocument == old_doc) { - return NS_OK; + if (GetParent() && aDocument && aDocument != old_doc) { + LoadSrc(); } - - return LoadSrc(); } NS_IMETHODIMP diff --git a/mozilla/content/html/content/src/nsHTMLImageElement.cpp b/mozilla/content/html/content/src/nsHTMLImageElement.cpp index 72c0efc5d35..7ca81d42f3a 100644 --- a/mozilla/content/html/content/src/nsHTMLImageElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLImageElement.cpp @@ -127,28 +127,29 @@ public: nsChangeHint& aHint) const; NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, PRUint32 aFlags, - nsEventStatus* aEventStatus); + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus); // SetAttr override. C++ is stupid, so have to override both // overloaded methods. - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, PRBool aNotify); - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, - PRBool aNotify); + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify); + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify); // XXXbz What about UnsetAttr? We don't seem to unload images when // that happens... - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers); - NS_IMETHOD_(void) SetParent(nsIContent* aParent); + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); + virtual void SetParent(nsIContent* aParent); protected: void GetImageFrame(nsIImageFrame** aImageFrame); - nsresult GetXY(PRInt32* aX, PRInt32* aY); - nsresult GetWidthHeight(PRInt32* aWidth, PRInt32* aHeight); + nsPoint GetXY(); + nsSize GetWidthHeight(); }; nsresult @@ -301,25 +302,19 @@ nsHTMLImageElement::GetComplete(PRBool* aComplete) return NS_OK; } -nsresult -nsHTMLImageElement::GetXY(PRInt32* aX, PRInt32* aY) +nsPoint +nsHTMLImageElement::GetXY() { - if (aX) { - *aX = 0; - } - - if (aY) { - *aY = 0; - } + nsPoint point(0, 0); if (!mDocument) { - return NS_OK; + return point; } // Get Presentation shell 0 nsIPresShell *presShell = mDocument->GetShellAt(0); if (!presShell) { - return NS_OK; + return point; } // Get the Presentation Context from the Shell @@ -327,7 +322,7 @@ nsHTMLImageElement::GetXY(PRInt32* aX, PRInt32* aY) presShell->GetPresContext(getter_AddRefs(context)); if (!context) { - return NS_OK; + return point; } // Flush all pending notifications so that our frames are uptodate @@ -338,52 +333,47 @@ nsHTMLImageElement::GetXY(PRInt32* aX, PRInt32* aY) presShell->GetPrimaryFrameFor(this, &frame); if (!frame) { - return NS_OK; + return point; } nsPoint origin(0, 0); nsIView* parentView; nsresult rv = frame->GetOffsetFromView(context, origin, &parentView); - NS_ENSURE_SUCCESS(rv, rv); + if (NS_FAILED(rv)) { + return point; + } // Get the scale from that Presentation Context float scale; context->GetTwipsToPixels(&scale); // Convert to pixels using that scale - if (aX) { - *aX = NSTwipsToIntPixels(origin.x, scale); - } + point.x = NSTwipsToIntPixels(origin.x, scale); + point.y = NSTwipsToIntPixels(origin.y, scale); - if (aY) { - *aY = NSTwipsToIntPixels(origin.y, scale); - } - - return NS_OK; + return point; } NS_IMETHODIMP nsHTMLImageElement::GetX(PRInt32* aX) { - return GetXY(aX, nsnull); + *aX = GetXY().x; + + return NS_OK; } NS_IMETHODIMP nsHTMLImageElement::GetY(PRInt32* aY) { - return GetXY(nsnull, aY); + *aY = GetXY().y; + + return NS_OK; } -nsresult -nsHTMLImageElement::GetWidthHeight(PRInt32* aWidth, PRInt32* aHeight) +nsSize +nsHTMLImageElement::GetWidthHeight() { - if (aHeight) { - *aHeight = 0; - } - - if (aWidth) { - *aWidth = 0; - } + nsSize size; if (mDocument) { // Flush all pending notifications so that our frames are up to date. @@ -405,7 +395,7 @@ nsHTMLImageElement::GetWidthHeight(PRInt32* aWidth, PRInt32* aHeight) if (frame) { // XXX we could put an accessor on nsIImageFrame to return its // mComputedSize..... - nsSize size = frame->GetSize(); + size = frame->GetSize(); nsMargin margin; frame->CalcBorderPadding(margin); @@ -420,13 +410,8 @@ nsHTMLImageElement::GetWidthHeight(PRInt32* aWidth, PRInt32* aHeight) float t2p; context->GetTwipsToPixels(&t2p); - if (aWidth) { - *aWidth = NSTwipsToIntPixels(size.width, t2p); - } - - if (aHeight) { - *aHeight = NSTwipsToIntPixels(size.height, t2p); - } + size.width = NSTwipsToIntPixels(size.width, t2p); + size.height = NSTwipsToIntPixels(size.height, t2p); } } else { nsHTMLValue value; @@ -435,34 +420,30 @@ nsHTMLImageElement::GetWidthHeight(PRInt32* aWidth, PRInt32* aHeight) mCurrentRequest->GetImage(getter_AddRefs(image)); } - if (aWidth) { - nsresult rv = GetHTMLAttribute(nsHTMLAtoms::width, value); - - if (rv == NS_CONTENT_ATTR_HAS_VALUE) { - *aWidth = value.GetPixelValue(); - } else if (image) { - image->GetWidth(aWidth); - } + if (GetHTMLAttribute(nsHTMLAtoms::width, + value) == NS_CONTENT_ATTR_HAS_VALUE) { + size.width = value.GetPixelValue(); + } else if (image) { + image->GetWidth(&size.width); } - if (aHeight) { - nsresult rv = GetHTMLAttribute(nsHTMLAtoms::height, value); - - if (rv == NS_CONTENT_ATTR_HAS_VALUE) { - *aHeight = value.GetPixelValue(); - } else if (image) { - image->GetHeight(aHeight); - } + if (GetHTMLAttribute(nsHTMLAtoms::height, + value) == NS_CONTENT_ATTR_HAS_VALUE) { + size.height = value.GetPixelValue(); + } else if (image) { + image->GetHeight(&size.height); } } - return NS_OK; + return size; } NS_IMETHODIMP nsHTMLImageElement::GetHeight(PRInt32* aHeight) { - return GetWidthHeight(nsnull, aHeight); + *aHeight = GetWidthHeight().height; + + return NS_OK; } NS_IMETHODIMP @@ -480,7 +461,9 @@ nsHTMLImageElement::SetHeight(PRInt32 aHeight) NS_IMETHODIMP nsHTMLImageElement::GetWidth(PRInt32* aWidth) { - return GetWidthHeight(aWidth, nsnull); + *aWidth = GetWidthHeight().width; + + return NS_OK; } NS_IMETHODIMP @@ -588,10 +571,9 @@ nsHTMLImageElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapR } -NS_IMETHODIMP +nsresult nsHTMLImageElement::HandleDOMEvent(nsIPresContext* aPresContext, - nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, PRUint32 aFlags, nsEventStatus* aEventStatus) { @@ -612,7 +594,7 @@ nsHTMLImageElement::HandleDOMEvent(nsIPresContext* aPresContext, aEventStatus); } -NS_IMETHODIMP +nsresult nsHTMLImageElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAString& aValue, PRBool aNotify) { @@ -630,21 +612,21 @@ nsHTMLImageElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, aValue, aNotify); } -NS_IMETHODIMP +nsresult nsHTMLImageElement::SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, PRBool aNotify) { return nsGenericHTMLLeafElement::SetAttr(aNodeInfo, aValue, aNotify); } -NS_IMETHODIMP +void nsHTMLImageElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) { PRBool documentChanging = aDocument && (aDocument != mDocument); - nsresult rv = nsGenericHTMLLeafElement::SetDocument(aDocument, aDeep, - aCompileEventHandlers); + nsGenericHTMLLeafElement::SetDocument(aDocument, aDeep, + aCompileEventHandlers); if (documentChanging && GetParent()) { // Our base URI may have changed; claim that our URI changed, and the // nsImageLoadingContent will decide whether a new image load is warranted. @@ -654,10 +636,9 @@ nsHTMLImageElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, ImageURIChanged(uri); } } - return rv; } -NS_IMETHODIMP_(void) +void nsHTMLImageElement::SetParent(nsIContent* aParent) { nsGenericHTMLLeafElement::SetParent(aParent); diff --git a/mozilla/content/html/content/src/nsHTMLInputElement.cpp b/mozilla/content/html/content/src/nsHTMLInputElement.cpp index 5f16b9bb318..2e3afe0a163 100644 --- a/mozilla/content/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLInputElement.cpp @@ -173,8 +173,8 @@ public: NS_IMETHOD RestoreState(nsIPresState* aState); // nsIContent - NS_IMETHOD SetFocus(nsIPresContext* aPresContext); - NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext); + virtual void SetFocus(nsIPresContext* aPresContext); + virtual void RemoveFocus(nsIPresContext* aPresContext); NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, const nsAString& aValue, @@ -187,16 +187,17 @@ public: nsChangeHint& aHint) const; NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, PRUint32 aFlags, - nsEventStatus* aEventStatus); - - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers); - NS_IMETHOD_(void) SetParent(nsIContent* aParent); + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus); + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); + virtual void SetParent(nsIContent* aParent); - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, PRBool aNotify) { + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify) + { BeforeSetAttr(aNameSpaceID, aName, &aValue, aNotify); nsresult rv = nsGenericHTMLLeafFormElement::SetAttr(aNameSpaceID, aName, @@ -205,14 +206,16 @@ public: AfterSetAttr(aNameSpaceID, aName, &aValue, aNotify); return rv; } - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, - PRBool aNotify) { + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify) + { // This will end up calling the other SetAttr(). return nsGenericHTMLLeafFormElement::SetAttr(aNodeInfo, aValue, aNotify); } - NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRBool aNotify) { + virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify) + { BeforeSetAttr(aNameSpaceID, aAttribute, nsnull, aNotify); nsresult rv = nsGenericHTMLLeafElement::UnsetAttr(aNameSpaceID, @@ -223,7 +226,7 @@ public: return rv; } - NS_IMETHOD DoneCreatingElement(); + virtual void DoneCreatingElement(); // nsITextControlElement NS_IMETHOD TakeTextFrameValue(const nsAString& aValue); @@ -1153,29 +1156,34 @@ nsHTMLInputElement::FireOnChange() NS_IMETHODIMP nsHTMLInputElement::Blur() { - return SetElementFocus(PR_FALSE); + SetElementFocus(PR_FALSE); + + return NS_OK; } NS_IMETHODIMP nsHTMLInputElement::Focus() { - return SetElementFocus(PR_TRUE); + SetElementFocus(PR_TRUE); + + return NS_OK; } -NS_IMETHODIMP +void nsHTMLInputElement::SetFocus(nsIPresContext* aPresContext) { - NS_ENSURE_ARG_POINTER(aPresContext); + if (!aPresContext) + return; // We can't be focus'd if we don't have a document - if (! mDocument) - return NS_OK; + if (!mDocument) + return; // first see if we are disabled or not. If disabled then do nothing. nsAutoString disabled; if (NS_CONTENT_ATTR_HAS_VALUE == GetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled)) { - return NS_OK; + return; } // If the window is not active, do not allow the focus to bring the @@ -1190,11 +1198,11 @@ nsHTMLInputElement::SetFocus(nsIPresContext* aPresContext) nsCOMPtr domWin(do_QueryInterface(win)); focusController->SetFocusedWindow(domWin); focusController->SetFocusedElement(this); - return NS_OK; + + return; } nsCOMPtr esm; - aPresContext->GetEventStateManager(getter_AddRefs(esm)); if (esm) { @@ -1209,17 +1217,16 @@ nsHTMLInputElement::SetFocus(nsIPresContext* aPresContext) // Could call SelectAll(aPresContext) here to automatically // select text when we receive focus - only for text and password! } - - return NS_OK; } -NS_IMETHODIMP +void nsHTMLInputElement::RemoveFocus(nsIPresContext* aPresContext) { - NS_ENSURE_ARG_POINTER(aPresContext); + if (!aPresContext) + return; + // If we are disabled, we probably shouldn't have focus in the // first place, so allow it to be removed. - nsresult rv = NS_OK; nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE); @@ -1230,14 +1237,9 @@ nsHTMLInputElement::RemoveFocus(nsIPresContext* aPresContext) nsCOMPtr esm; aPresContext->GetEventStateManager(getter_AddRefs(esm)); - if (esm) { - if (!mDocument) - return NS_ERROR_NULL_POINTER; - - rv = esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS); + if (esm && mDocument) { + esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS); } - - return rv; } NS_IMETHODIMP @@ -1393,7 +1395,7 @@ nsHTMLInputElement::Click() return NS_OK; } -NS_IMETHODIMP +nsresult nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, @@ -1745,7 +1747,7 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext, } -NS_IMETHODIMP +void nsHTMLInputElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) { @@ -1758,10 +1760,8 @@ nsHTMLInputElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, WillRemoveFromRadioGroup(); } - nsresult rv = nsGenericHTMLLeafFormElement::SetDocument(aDocument, aDeep, - aCompileEventHandlers); - - NS_ENSURE_SUCCESS(rv, rv); + nsGenericHTMLLeafFormElement::SetDocument(aDocument, aDeep, + aCompileEventHandlers); if (mType == NS_FORM_INPUT_IMAGE && documentChanging && aDocument && GetParent()) { @@ -1778,7 +1778,7 @@ nsHTMLInputElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, // and the parser is still creating the element. if (mForm || mType != NS_FORM_INPUT_RADIO || GET_BOOLBIT(mBitField, BF_PARSER_CREATING)) { - return NS_OK; + return; } // Add radio to document if we don't have a form already (if we do it's @@ -1786,11 +1786,9 @@ nsHTMLInputElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, if (aDocument && !mForm && mType == NS_FORM_INPUT_RADIO) { AddedToRadioGroup(); } - - return NS_OK; } -NS_IMETHODIMP_(void) +void nsHTMLInputElement::SetParent(nsIContent* aParent) { nsGenericHTMLLeafFormElement::SetParent(aParent); @@ -2388,8 +2386,7 @@ nsHTMLInputElement::SubmitNamesValues(nsIFormSubmission* aFormSubmission, NS_ENSURE_SUCCESS(rv, rv); if (!filename.IsEmpty()) { - PRBool acceptsFiles = PR_FALSE; - aFormSubmission->AcceptsFiles(&acceptsFiles); + PRBool acceptsFiles = aFormSubmission->AcceptsFiles(); if (acceptsFiles) { // @@ -2544,7 +2541,7 @@ nsHTMLInputElement::SaveState() return rv; } -NS_IMETHODIMP +void nsHTMLInputElement::DoneCreatingElement() { SET_BOOLBIT(mBitField, BF_PARSER_CREATING, PR_FALSE); @@ -2582,8 +2579,6 @@ nsHTMLInputElement::DoneCreatingElement() // if (!mForm && mType == NS_FORM_INPUT_RADIO) AddedToRadioGroup(); - - return NS_OK; } NS_IMETHODIMP diff --git a/mozilla/content/html/content/src/nsHTMLLabelElement.cpp b/mozilla/content/html/content/src/nsHTMLLabelElement.cpp index f93c0966178..30d78c30e9e 100644 --- a/mozilla/content/html/content/src/nsHTMLLabelElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLLabelElement.cpp @@ -174,18 +174,19 @@ public: nsIContent* aSubmitElement); // nsIContent - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers); - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, PRUint32 aFlags, - nsEventStatus* aEventStatus); - NS_IMETHOD SetFocus(nsIPresContext* aContext); - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, PRBool aNotify); - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, - PRBool aNotify); - NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRBool aNotify); + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus); + virtual void SetFocus(nsIPresContext* aContext); + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify); + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify); + virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify); protected: already_AddRefed GetForContent(); @@ -307,7 +308,7 @@ nsHTMLLabelElement::SetHtmlFor(const nsAString& aValue) value, PR_TRUE); } -NS_IMETHODIMP +void nsHTMLLabelElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) { @@ -318,16 +319,13 @@ nsHTMLLabelElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, RegUnRegAccessKey(PR_FALSE); } - nsresult rv = - nsGenericHTMLContainerFormElement::SetDocument(aDocument, aDeep, - aCompileEventHandlers); + nsGenericHTMLContainerFormElement::SetDocument(aDocument, aDeep, + aCompileEventHandlers); // Register the access key for the new document. if (documentChanging && mDocument) { RegUnRegAccessKey(PR_TRUE); } - - return rv; } static PRBool @@ -353,7 +351,7 @@ EventTargetIn(nsIPresContext *aPresContext, nsEvent *aEvent, return PR_FALSE; } -NS_IMETHODIMP +nsresult nsHTMLLabelElement::HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, @@ -380,7 +378,7 @@ nsHTMLLabelElement::HandleDOMEvent(nsIPresContext* aPresContext, switch (aEvent->message) { case NS_MOUSE_LEFT_CLICK: // Focus the for content. - rv = content->SetFocus(aPresContext); + content->SetFocus(aPresContext); // This sends the event twice down parts of its path. Oh well. // This is needed for: // * Making radio buttons and checkboxes get checked. @@ -412,17 +410,14 @@ nsHTMLLabelElement::HandleDOMEvent(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP +void nsHTMLLabelElement::SetFocus(nsIPresContext* aContext) { // Since we don't have '-moz-user-focus: normal', the only time // |SetFocus| will be called is when the accesskey is activated. nsCOMPtr content = GetForContent(); if (content) - return content->SetFocus(aContext); - - // Do nothing (yes, really)! - return NS_OK; + content->SetFocus(aContext); } nsresult @@ -438,7 +433,7 @@ nsHTMLLabelElement::SubmitNamesValues(nsIFormSubmission* aFormSubmission, return NS_OK; } -NS_IMETHODIMP +nsresult nsHTMLLabelElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAString& aValue, PRBool aNotify) { @@ -457,14 +452,14 @@ nsHTMLLabelElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, return rv; } -NS_IMETHODIMP +nsresult nsHTMLLabelElement::SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, PRBool aNotify) { return nsGenericHTMLElement::SetAttr(aNodeInfo, aValue, aNotify); } -NS_IMETHODIMP +nsresult nsHTMLLabelElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) { diff --git a/mozilla/content/html/content/src/nsHTMLLinkElement.cpp b/mozilla/content/html/content/src/nsHTMLLinkElement.cpp index 9629df176fc..9d2efb99068 100644 --- a/mozilla/content/html/content/src/nsHTMLLinkElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLLinkElement.cpp @@ -87,105 +87,22 @@ public: NS_IMETHOD SetLinkState(nsLinkState aState); NS_IMETHOD GetHrefURI(nsIURI** aURI); - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers) { - nsCOMPtr oldDoc = mDocument; - - nsAutoString rel; - nsAutoString rev; - GetAttr(kNameSpaceID_None, nsHTMLAtoms::rel, rel); - GetAttr(kNameSpaceID_None, nsHTMLAtoms::rev, rev); - - CreateAndDispatchEvent(oldDoc, rel, rev, NS_LITERAL_STRING("DOMLinkRemoved")); - - // Do the removal and addition into the new doc. - nsresult rv = nsGenericHTMLLeafElement::SetDocument(aDocument, aDeep, - aCompileEventHandlers); - if (NS_SUCCEEDED(rv)) { - UpdateStyleSheet(oldDoc); - } - - CreateAndDispatchEvent(mDocument, rel, rev, NS_LITERAL_STRING("DOMLinkAdded")); - - return rv; - } - + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); void CreateAndDispatchEvent(nsIDocument* aDoc, const nsString& aRel, - const nsString& aRev, - const nsAString& aEventName) { - if (!aDoc) - return; + const nsString& aRev, + const nsAString& aEventName); + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify); + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify); + virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify); - // In the unlikely case that both rev is specified *and* rel=stylesheet, - // this code will cause the event to fire, on the principle that maybe the - // page really does want to specify that it's author is a stylesheet. Since - // this should never actually happen and the performance hit is minimal, - // doing the "right" thing costs virtually nothing here, even if it doesn't - // make much sense. - if (aRev.IsEmpty() && - (aRel.IsEmpty() || aRel.EqualsIgnoreCase("stylesheet"))) - return; - - nsCOMPtr docEvent(do_QueryInterface(aDoc)); - nsCOMPtr event; - docEvent->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event)); - if (event) { - event->InitEvent(aEventName, PR_TRUE, PR_TRUE); - PRBool noDefault; - nsCOMPtr target(do_QueryInterface(NS_STATIC_CAST(nsIDOMNode*, this))); - if (target) - target->DispatchEvent(event, &noDefault); - } - } - - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, PRBool aNotify) { - if (aName == nsHTMLAtoms::href && kNameSpaceID_None == aNameSpaceID) { - SetLinkState(eLinkState_Unknown); - } - - nsresult rv = nsGenericHTMLLeafElement::SetAttr(aNameSpaceID, aName, - aValue, aNotify); - if (NS_SUCCEEDED(rv)) { - UpdateStyleSheet(); - } - return rv; - } - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, - PRBool aNotify) { - nsresult rv = nsGenericHTMLLeafElement::SetAttr(aNodeInfo, aValue, - aNotify); - - // nsGenericHTMLLeafElement::SetAttr(nsINodeInfo* aNodeInfo, - // const nsAString& aValue, - // PRBool aNotify) - // - // calls - // - // nsHTMLLinkElement::SetAttr(PRInt32 aNameSpaceID, - // nsIAtom* aName, - // const nsAString& aValue, - // PRBool aNotify) - // - // which ends up calling UpdateStyleSheet so we don't call UpdateStyleSheet - // here ourselves. - - return rv; - } - NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRBool aNotify) { - nsresult rv = nsGenericHTMLLeafElement::UnsetAttr(aNameSpaceID, - aAttribute, - aNotify); - if (NS_SUCCEEDED(rv)) { - UpdateStyleSheet(); - } - return rv; - } - - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, PRUint32 aFlags, - nsEventStatus* aEventStatus); + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus); protected: virtual void GetStyleSheetURL(PRBool* aIsInline, @@ -318,7 +235,115 @@ NS_IMPL_STRING_ATTR(nsHTMLLinkElement, Rev, rev) NS_IMPL_STRING_ATTR(nsHTMLLinkElement, Target, target) NS_IMPL_STRING_ATTR(nsHTMLLinkElement, Type, type) -NS_IMETHODIMP +void +nsHTMLLinkElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers) +{ + nsCOMPtr oldDoc = mDocument; + + nsAutoString rel; + nsAutoString rev; + GetAttr(kNameSpaceID_None, nsHTMLAtoms::rel, rel); + GetAttr(kNameSpaceID_None, nsHTMLAtoms::rev, rev); + + CreateAndDispatchEvent(oldDoc, rel, rev, + NS_LITERAL_STRING("DOMLinkRemoved")); + + // Do the removal and addition into the new doc. + nsGenericHTMLLeafElement::SetDocument(aDocument, aDeep, + aCompileEventHandlers); + UpdateStyleSheet(oldDoc); + + CreateAndDispatchEvent(mDocument, rel, rev, + NS_LITERAL_STRING("DOMLinkAdded")); +} + +void +nsHTMLLinkElement::CreateAndDispatchEvent(nsIDocument* aDoc, + const nsString& aRel, + const nsString& aRev, + const nsAString& aEventName) +{ + if (!aDoc) + return; + + // In the unlikely case that both rev is specified *and* rel=stylesheet, + // this code will cause the event to fire, on the principle that maybe the + // page really does want to specify that it's author is a stylesheet. Since + // this should never actually happen and the performance hit is minimal, + // doing the "right" thing costs virtually nothing here, even if it doesn't + // make much sense. + if (aRev.IsEmpty() && + (aRel.IsEmpty() || aRel.EqualsIgnoreCase("stylesheet"))) + return; + + nsCOMPtr docEvent(do_QueryInterface(aDoc)); + nsCOMPtr event; + docEvent->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event)); + if (event) { + event->InitEvent(aEventName, PR_TRUE, PR_TRUE); + PRBool noDefault; + nsCOMPtr target = + do_QueryInterface(NS_STATIC_CAST(nsIDOMNode*, this)); + if (target) + target->DispatchEvent(event, &noDefault); + } +} + +nsresult +nsHTMLLinkElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify) +{ + if (aName == nsHTMLAtoms::href && kNameSpaceID_None == aNameSpaceID) { + SetLinkState(eLinkState_Unknown); + } + + nsresult rv = nsGenericHTMLLeafElement::SetAttr(aNameSpaceID, aName, aValue, + aNotify); + if (NS_SUCCEEDED(rv)) { + UpdateStyleSheet(); + } + + return rv; +} + +nsresult +nsHTMLLinkElement::SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify) +{ + nsresult rv = nsGenericHTMLLeafElement::SetAttr(aNodeInfo, aValue, aNotify); + + // nsGenericHTMLLeafElement::SetAttr(nsINodeInfo* aNodeInfo, + // const nsAString& aValue, + // PRBool aNotify) + // + // calls + // + // nsHTMLLinkElement::SetAttr(PRInt32 aNameSpaceID, + // nsIAtom* aName, + // const nsAString& aValue, + // PRBool aNotify) + // + // which ends up calling UpdateStyleSheet so we don't call UpdateStyleSheet + // here ourselves. + + return rv; +} + +nsresult +nsHTMLLinkElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify) +{ + nsresult rv = nsGenericHTMLLeafElement::UnsetAttr(aNameSpaceID, aAttribute, + aNotify); + if (NS_SUCCEEDED(rv)) { + UpdateStyleSheet(); + } + + return rv; +} + +nsresult nsHTMLLinkElement::HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, diff --git a/mozilla/content/html/content/src/nsHTMLMapElement.cpp b/mozilla/content/html/content/src/nsHTMLMapElement.cpp index ff767f0ddd9..16b7f15a9ea 100644 --- a/mozilla/content/html/content/src/nsHTMLMapElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLMapElement.cpp @@ -73,8 +73,8 @@ public: NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute, PRInt32 aModType, nsChangeHint& aHint) const; - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers); + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); protected: GenericElementCollection* mAreas; @@ -134,7 +134,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLMapElement, NS_HTML_CONTENT_INTERFACE_MAP_END -NS_IMETHODIMP +void nsHTMLMapElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) { @@ -148,9 +148,8 @@ nsHTMLMapElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, } } - nsresult rv = nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep, - aCompileEventHandlers); - NS_ENSURE_SUCCESS(rv, rv); + nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep, + aCompileEventHandlers); if (documentChanging) { // Since we changed the document, gotta re-QI @@ -160,8 +159,6 @@ nsHTMLMapElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, htmlDoc->AddImageMap(this); } } - - return NS_OK; } NS_IMETHODIMP diff --git a/mozilla/content/html/content/src/nsHTMLOptGroupElement.cpp b/mozilla/content/html/content/src/nsHTMLOptGroupElement.cpp index 22d81316f93..b53256b9420 100644 --- a/mozilla/content/html/content/src/nsHTMLOptGroupElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLOptGroupElement.cpp @@ -75,17 +75,18 @@ public: NS_DECL_NSIDOMHTMLOPTGROUPELEMENT // nsIContent - NS_IMETHOD InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD RemoveChildAt(PRUint32 aIndex, PRBool aNotify); + virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument); + virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify); - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, PRUint32 aFlags, - nsEventStatus* aEventStatus); + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus); protected: @@ -177,7 +178,7 @@ NS_IMPL_BOOL_ATTR(nsHTMLOptGroupElement, Disabled, disabled) NS_IMPL_STRING_ATTR(nsHTMLOptGroupElement, Label, label) -NS_IMETHODIMP +nsresult nsHTMLOptGroupElement::HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, @@ -224,7 +225,7 @@ nsHTMLOptGroupElement::GetSelect(nsISelectElement **aSelectElement) } // nsIContent -NS_IMETHODIMP +nsresult nsHTMLOptGroupElement::AppendChildTo(nsIContent* aKid, PRBool aNotify, PRBool aDeepSetDocument) { @@ -242,7 +243,7 @@ nsHTMLOptGroupElement::AppendChildTo(nsIContent* aKid, PRBool aNotify, aDeepSetDocument); } -NS_IMETHODIMP +nsresult nsHTMLOptGroupElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, PRBool aDeepSetDocument) { @@ -258,7 +259,7 @@ nsHTMLOptGroupElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex, aDeepSetDocument); } -NS_IMETHODIMP +nsresult nsHTMLOptGroupElement::ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, PRBool aDeepSetDocument) { @@ -275,7 +276,7 @@ nsHTMLOptGroupElement::ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, aDeepSetDocument); } -NS_IMETHODIMP +nsresult nsHTMLOptGroupElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify) { nsCOMPtr sel; diff --git a/mozilla/content/html/content/src/nsHTMLOptionElement.cpp b/mozilla/content/html/content/src/nsHTMLOptionElement.cpp index 3b8eb547830..744d0ff9de5 100644 --- a/mozilla/content/html/content/src/nsHTMLOptionElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLOptionElement.cpp @@ -117,13 +117,13 @@ public: NS_IMETHOD SetSelectedInternal(PRBool aValue, PRBool aNotify); // nsIContent - NS_IMETHOD InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD RemoveChildAt(PRUint32 aIndex, PRBool aNotify); + virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument); + virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify); protected: /** @@ -595,7 +595,7 @@ nsHTMLOptionElement::NotifyTextChanged() // Override nsIContent children changing methods so we can detect when our text // is changing // -NS_IMETHODIMP +nsresult nsHTMLOptionElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, PRBool aDeepSetDocument) { @@ -606,7 +606,7 @@ nsHTMLOptionElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex, return rv; } -NS_IMETHODIMP +nsresult nsHTMLOptionElement::ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, PRBool aDeepSetDocument) { @@ -617,7 +617,7 @@ nsHTMLOptionElement::ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, return rv; } -NS_IMETHODIMP +nsresult nsHTMLOptionElement::AppendChildTo(nsIContent* aKid, PRBool aNotify, PRBool aDeepSetDocument) { nsresult rv = nsGenericHTMLContainerElement::AppendChildTo(aKid, @@ -627,7 +627,7 @@ nsHTMLOptionElement::AppendChildTo(nsIContent* aKid, PRBool aNotify, PRBool aDee return rv; } -NS_IMETHODIMP +nsresult nsHTMLOptionElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify) { nsresult rv = nsGenericHTMLContainerElement::RemoveChildAt(aIndex, diff --git a/mozilla/content/html/content/src/nsHTMLScriptElement.cpp b/mozilla/content/html/content/src/nsHTMLScriptElement.cpp index 8a7e321bc76..fecc975736c 100644 --- a/mozilla/content/html/content/src/nsHTMLScriptElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLScriptElement.cpp @@ -69,7 +69,7 @@ class nsHTMLScriptEventHandler : public nsIScriptEventHandler public: nsHTMLScriptEventHandler(nsIDOMHTMLScriptElement *aOuter); virtual ~nsHTMLScriptEventHandler() {}; - + // nsISupports NS_DECL_ISUPPORTS @@ -227,7 +227,7 @@ nsHTMLScriptEventHandler::Invoke(nsISupports *aTargetObject, // wrap the target object... nsCOMPtr xpc(do_GetService(nsIXPConnect::GetCID())); nsCOMPtr holder; - + JSContext *cx = (JSContext *)scriptContext->GetNativeContext(); JSObject *scriptObject = nsnull; @@ -237,7 +237,7 @@ nsHTMLScriptEventHandler::Invoke(nsISupports *aTargetObject, aTargetObject, NS_GET_IID(nsISupports), getter_AddRefs(holder)); - if (holder) { + if (holder) { rv = holder->GetJSObject(&scriptObject); } } @@ -339,17 +339,18 @@ public: NS_IMETHOD SetLineNumber(PRUint32 aLineNumber); NS_IMETHOD GetLineNumber(PRUint32* aLineNumber); - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, PRBool aNotify); - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers); - NS_IMETHOD InsertChildAt(nsIContent* aKid, PRUint32 aIndex, - PRBool aNotify, PRBool aDeepSetDocument); - NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify, - PRBool aDeepSetDocument); + // nsIContent + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify); + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); + virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument); - virtual nsresult GetInnerHTML(nsAString& aInnerHTML); - virtual nsresult SetInnerHTML(const nsAString& aInnerHTML); + NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML); + NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML); protected: PRBool IsOnloadEventForWindow(); @@ -418,8 +419,8 @@ nsHTMLScriptElement::~nsHTMLScriptElement() } -NS_IMPL_ADDREF_INHERITED(nsHTMLScriptElement, nsGenericElement) -NS_IMPL_RELEASE_INHERITED(nsHTMLScriptElement, nsGenericElement) +NS_IMPL_ADDREF_INHERITED(nsHTMLScriptElement, nsGenericElement) +NS_IMPL_RELEASE_INHERITED(nsHTMLScriptElement, nsGenericElement) // QueryInterface implementation for nsHTMLScriptElement NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLScriptElement, @@ -435,7 +436,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLScriptElement, NS_HTML_CONTENT_INTERFACE_MAP_END -NS_IMETHODIMP +nsresult nsHTMLScriptElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAString& aValue, PRBool aNotify) { @@ -456,20 +457,18 @@ nsHTMLScriptElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, return rv; } -NS_IMETHODIMP +void nsHTMLScriptElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) { - nsresult rv = nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep, - aCompileEventHandlers); - if (NS_SUCCEEDED(rv) && aDocument) { + nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep, + aCompileEventHandlers); + if (aDocument) { MaybeProcessScript(); } - - return rv; } -NS_IMETHODIMP +nsresult nsHTMLScriptElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, PRBool aDeepSetDocument) { @@ -483,7 +482,7 @@ nsHTMLScriptElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex, return rv; } -NS_IMETHODIMP +nsresult nsHTMLScriptElement::AppendChildTo(nsIContent* aKid, PRBool aNotify, PRBool aDeepSetDocument) { @@ -544,31 +543,31 @@ NS_IMPL_STRING_ATTR(nsHTMLScriptElement, Type, type) NS_IMPL_STRING_ATTR(nsHTMLScriptElement, HtmlFor, _for) NS_IMPL_STRING_ATTR(nsHTMLScriptElement, Event, _event) -nsresult +NS_IMETHODIMP nsHTMLScriptElement::GetInnerHTML(nsAString& aInnerHTML) { return GetContentsAsText(aInnerHTML); } -nsresult +NS_IMETHODIMP nsHTMLScriptElement::SetInnerHTML(const nsAString& aInnerHTML) { return ReplaceContentsWithText(aInnerHTML, PR_TRUE); } /* void scriptAvailable (in nsresult aResult, in nsIDOMHTMLScriptElement aElement, in nsIURI aURI, in PRInt32 aLineNo, in PRUint32 aScriptLength, [size_is (aScriptLength)] in wstring aScript); */ -NS_IMETHODIMP -nsHTMLScriptElement::ScriptAvailable(nsresult aResult, - nsIDOMHTMLScriptElement *aElement, +NS_IMETHODIMP +nsHTMLScriptElement::ScriptAvailable(nsresult aResult, + nsIDOMHTMLScriptElement *aElement, PRBool aIsInline, PRBool aWasPending, - nsIURI *aURI, + nsIURI *aURI, PRInt32 aLineNo, const nsAString& aScript) { if (!aIsInline && NS_FAILED(aResult)) { nsCOMPtr presContext; - GetPresContext(this, getter_AddRefs(presContext)); + GetPresContext(this, getter_AddRefs(presContext)); nsEventStatus status = nsEventStatus_eIgnore; nsScriptErrorEvent event; @@ -595,8 +594,8 @@ nsHTMLScriptElement::ScriptAvailable(nsresult aResult, } /* void scriptEvaluated (in nsresult aResult, in nsIDOMHTMLScriptElement aElement); */ -NS_IMETHODIMP -nsHTMLScriptElement::ScriptEvaluated(nsresult aResult, +NS_IMETHODIMP +nsHTMLScriptElement::ScriptEvaluated(nsresult aResult, nsIDOMHTMLScriptElement *aElement, PRBool aIsInline, PRBool aWasPending) @@ -604,7 +603,7 @@ nsHTMLScriptElement::ScriptEvaluated(nsresult aResult, nsresult rv = NS_OK; if (!aIsInline) { nsCOMPtr presContext; - GetPresContext(this, getter_AddRefs(presContext)); + GetPresContext(this, getter_AddRefs(presContext)); nsEventStatus status = nsEventStatus_eIgnore; nsEvent event; @@ -618,7 +617,7 @@ nsHTMLScriptElement::ScriptEvaluated(nsresult aResult, return rv; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLScriptElement::SetLineNumber(PRUint32 aLineNumber) { mLineNumber = aLineNumber; @@ -626,7 +625,7 @@ nsHTMLScriptElement::SetLineNumber(PRUint32 aLineNumber) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLScriptElement::GetLineNumber(PRUint32* aLineNumber) { NS_ENSURE_ARG_POINTER(aLineNumber); diff --git a/mozilla/content/html/content/src/nsHTMLSelectElement.cpp b/mozilla/content/html/content/src/nsHTMLSelectElement.cpp index 6c638157c78..ef00f97500c 100644 --- a/mozilla/content/html/content/src/nsHTMLSelectElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSelectElement.cpp @@ -225,22 +225,21 @@ public: NS_DECL_NSIDOMNSXBLFORMCONTROL // nsIContent - NS_IMETHOD InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD RemoveChildAt(PRUint32 aIndex, PRBool aNotify); + virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument); + virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify); - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, - nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, - PRUint32 aFlags, - nsEventStatus* aEventStatus); + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus); - NS_IMETHOD SetFocus(nsIPresContext* aPresContext); - NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext); + virtual void SetFocus(nsIPresContext* aPresContext); + virtual void RemoveFocus(nsIPresContext* aPresContext); // Overriden nsIFormControl methods NS_IMETHOD_(PRInt32) GetType() { return NS_FORM_SELECT; } @@ -539,9 +538,9 @@ nsHTMLSelectElement::GetForm(nsIDOMHTMLFormElement** aForm) // nsIContent -NS_IMETHODIMP +nsresult nsHTMLSelectElement::AppendChildTo(nsIContent* aKid, PRBool aNotify, - PRBool aDeepSetDocument) + PRBool aDeepSetDocument) { WillAddOptions(aKid, this, GetChildCount()); @@ -551,9 +550,9 @@ nsHTMLSelectElement::AppendChildTo(nsIContent* aKid, PRBool aNotify, aDeepSetDocument); } -NS_IMETHODIMP +nsresult nsHTMLSelectElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex, - PRBool aNotify, PRBool aDeepSetDocument) + PRBool aNotify, PRBool aDeepSetDocument) { WillAddOptions(aKid, this, aIndex); @@ -563,9 +562,9 @@ nsHTMLSelectElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex, aDeepSetDocument); } -NS_IMETHODIMP +nsresult nsHTMLSelectElement::ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, - PRBool aNotify, PRBool aDeepSetDocument) + PRBool aNotify, PRBool aDeepSetDocument) { WillRemoveOptions(this, aIndex); WillAddOptions(aKid, this, aIndex); @@ -576,7 +575,7 @@ nsHTMLSelectElement::ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, aDeepSetDocument); } -NS_IMETHODIMP +nsresult nsHTMLSelectElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify) { WillRemoveOptions(this, aIndex); @@ -854,7 +853,7 @@ nsHTMLSelectElement::WillAddOptions(nsIContent* aOptions, // Get the index where the options will be inserted PRInt32 ind = -1; - if (!mNonOptionChildren) { + if (!mNonOptionChildren) { // If there are no artifacts, aContentIndex == ind ind = aContentIndex; } else { @@ -898,7 +897,7 @@ nsHTMLSelectElement::WillRemoveOptions(nsIContent* aParent, nsIContent *currentKid = aParent->GetChildAt(aContentIndex); if (currentKid) { PRInt32 ind; - if (!mNonOptionChildren) { + if (!mNonOptionChildren) { // If there are no artifacts, aContentIndex == ind ind = aContentIndex; } else { @@ -1035,7 +1034,7 @@ nsHTMLSelectElement::Add(nsIDOMHTMLElement* aElement, // Just in case we're not the parent, get the parent of the reference // element - nsCOMPtr parent; + nsCOMPtr parent; aBefore->GetParentNode(getter_AddRefs(parent)); if (!parent) { // NOT_FOUND_ERR: Raised if before is not a descendant of the SELECT @@ -1058,8 +1057,8 @@ nsHTMLSelectElement::Add(nsIDOMHTMLElement* aElement, return parent->InsertBefore(aElement, aBefore, getter_AddRefs(added)); } -NS_IMETHODIMP -nsHTMLSelectElement::Remove(PRInt32 aIndex) +NS_IMETHODIMP +nsHTMLSelectElement::Remove(PRInt32 aIndex) { nsCOMPtr option; Item(aIndex, getter_AddRefs(option)); @@ -1557,7 +1556,7 @@ nsHTMLSelectElement::IsOptionDisabled(PRInt32 aIndex, PRBool* aIsDisabled) optionNode = parent; } } - + return NS_OK; } @@ -1648,7 +1647,7 @@ nsHTMLSelectElement::SetValue(const nsAString& aValue) } } } - + return rv; } @@ -1662,19 +1661,25 @@ NS_IMPL_INT_ATTR(nsHTMLSelectElement, TabIndex, tabindex) NS_IMETHODIMP nsHTMLSelectElement::Blur() { - return SetElementFocus(PR_FALSE); + SetElementFocus(PR_FALSE); + + return NS_OK; } NS_IMETHODIMP nsHTMLSelectElement::Focus() { - return SetElementFocus(PR_TRUE); + SetElementFocus(PR_TRUE); + + return NS_OK; } -NS_IMETHODIMP +void nsHTMLSelectElement::SetFocus(nsIPresContext* aPresContext) { - NS_ENSURE_ARG_POINTER(aPresContext); + if (!aPresContext) + return; + // first see if we are disabled or not. If disabled then do nothing. nsAutoString disabled; @@ -1682,11 +1687,10 @@ nsHTMLSelectElement::SetFocus(nsIPresContext* aPresContext) nsGenericHTMLContainerFormElement::GetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled)) { - return NS_OK; + return; } nsCOMPtr esm; - aPresContext->GetEventStateManager(getter_AddRefs(esm)); if (esm) { @@ -1701,17 +1705,16 @@ nsHTMLSelectElement::SetFocus(nsIPresContext* aPresContext) // Could call SelectAll(aPresContext) here to automatically // select text when we receive focus. } - - return NS_OK; } -NS_IMETHODIMP +void nsHTMLSelectElement::RemoveFocus(nsIPresContext* aPresContext) { - NS_ENSURE_ARG_POINTER(aPresContext); + if (!aPresContext) + return; + // If we are disabled, we probably shouldn't have focus in the // first place, so allow it to be removed. - nsresult rv = NS_OK; nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_FALSE); @@ -1722,24 +1725,18 @@ nsHTMLSelectElement::RemoveFocus(nsIPresContext* aPresContext) nsCOMPtr esm; aPresContext->GetEventStateManager(getter_AddRefs(esm)); - if (esm) { - if (!mDocument) { - return NS_ERROR_NULL_POINTER; - } - - rv = esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS); + if (esm && mDocument) { + esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS); } - - return rv; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLSelectElement::Item(PRUint32 aIndex, nsIDOMNode** aReturn) { return mOptions->Item(aIndex, aReturn); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLSelectElement::NamedItem(const nsAString& aName, nsIDOMNode** aReturn) { @@ -1892,7 +1889,7 @@ nsHTMLSelectElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMap } -NS_IMETHODIMP +nsresult nsHTMLSelectElement::HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, @@ -1922,11 +1919,11 @@ nsHTMLSelectElement::HandleDOMEvent(nsIPresContext* aPresContext, } // Must notify the frame that the blur event occurred - // NOTE: At this point EventStateManager has not yet set the + // NOTE: At this point EventStateManager has not yet set the /// new content as having focus so this content is still considered // the focused element. So the ComboboxControlFrame tracks the focus // at a class level (Bug 32920) - if ((nsEventStatus_eIgnore == *aEventStatus) && + if ((nsEventStatus_eIgnore == *aEventStatus) && !(aFlags & NS_EVENT_FLAG_CAPTURE) && !(aFlags & NS_EVENT_FLAG_SYSTEM_EVENT) && (aEvent->message == NS_BLUR_CONTENT) && formControlFrame) { formControlFrame->SetFocus(PR_FALSE, PR_TRUE); @@ -2194,7 +2191,7 @@ nsHTMLSelectElement::DispatchDOMEvent(const nsAString& aName) // nsHTMLOptionCollection implementation // -nsHTMLOptionCollection::nsHTMLOptionCollection(nsHTMLSelectElement* aSelect) +nsHTMLOptionCollection::nsHTMLOptionCollection(nsHTMLSelectElement* aSelect) { // Do not maintain a reference counted reference. When // the select goes away, it will let us know. @@ -2233,7 +2230,7 @@ NS_IMPL_RELEASE_INHERITED(nsHTMLOptionCollection, nsGenericDOMHTMLCollection) // nsIDOMNSHTMLOptionCollection interface -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLOptionCollection::GetLength(PRUint32* aLength) { return mElements->Count(aLength); @@ -2347,7 +2344,7 @@ nsHTMLOptionCollection::ItemAsOption(PRInt32 aIndex, return rv; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLOptionCollection::NamedItem(const nsAString& aName, nsIDOMNode** aReturn) { @@ -2374,11 +2371,11 @@ nsHTMLOptionCollection::NamedItem(const nsAString& aName, } } } - + return rv; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLOptionCollection::Add(nsIDOMHTMLOptionElement *aOption) { nsCOMPtr ret; diff --git a/mozilla/content/html/content/src/nsHTMLSpanElement.cpp b/mozilla/content/html/content/src/nsHTMLSpanElement.cpp index 7796edf71a4..977dab22cd3 100644 --- a/mozilla/content/html/content/src/nsHTMLSpanElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSpanElement.cpp @@ -63,8 +63,8 @@ public: // nsIDOMHTMLElement NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::) - nsresult GetInnerHTML(nsAString& aInnerHTML); - nsresult SetInnerHTML(const nsAString& aInnerHTML); + NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML); + NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML); }; nsresult @@ -142,7 +142,7 @@ nsHTMLSpanElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) return NS_OK; } -nsresult +NS_IMETHODIMP nsHTMLSpanElement::GetInnerHTML(nsAString& aInnerHTML) { if (mNodeInfo->Equals(nsHTMLAtoms::xmp) || @@ -153,7 +153,7 @@ nsHTMLSpanElement::GetInnerHTML(nsAString& aInnerHTML) return nsGenericHTMLContainerElement::GetInnerHTML(aInnerHTML); } -nsresult +NS_IMETHODIMP nsHTMLSpanElement::SetInnerHTML(const nsAString& aInnerHTML) { if (mNodeInfo->Equals(nsHTMLAtoms::xmp) || diff --git a/mozilla/content/html/content/src/nsHTMLStyleElement.cpp b/mozilla/content/html/content/src/nsHTMLStyleElement.cpp index 64c100a5ec1..ac30804eb55 100644 --- a/mozilla/content/html/content/src/nsHTMLStyleElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLStyleElement.cpp @@ -76,97 +76,24 @@ public: // nsIDOMHTMLStyleElement NS_DECL_NSIDOMHTMLSTYLEELEMENT - NS_IMETHOD InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument) - { - nsresult rv = nsGenericHTMLContainerElement::InsertChildAt(aKid, aIndex, aNotify, aDeepSetDocument); - if (NS_SUCCEEDED(rv)) { - UpdateStyleSheet(); - } - return rv; - } + virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument); + virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify); + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); + virtual nsresult SetAttr(PRUint32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify); + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify); + virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify); - NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument) - { - nsresult rv = nsGenericHTMLContainerElement::ReplaceChildAt(aKid, aIndex, aNotify, aDeepSetDocument); - if (NS_SUCCEEDED(rv)) { - UpdateStyleSheet(); - } - return rv; - } - - NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify, - PRBool aDeepSetDocument) - { - nsresult rv = nsGenericHTMLContainerElement::AppendChildTo(aKid, aNotify, aDeepSetDocument); - if (NS_SUCCEEDED(rv)) { - UpdateStyleSheet(); - } - return rv; - } - - NS_IMETHOD RemoveChildAt(PRUint32 aIndex, PRBool aNotify) - { - nsresult rv = nsGenericHTMLContainerElement::RemoveChildAt(aIndex, aNotify); - if (NS_SUCCEEDED(rv)) { - UpdateStyleSheet(); - } - return rv; - } - - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers) { - nsCOMPtr oldDoc = mDocument; - nsresult rv = nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep, - aCompileEventHandlers); - if (NS_SUCCEEDED(rv)) { - UpdateStyleSheet(oldDoc); - } - return rv; - } - - NS_IMETHOD SetAttr(PRUint32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, PRBool aNotify) { - nsresult rv = nsGenericHTMLContainerElement::SetAttr(aNameSpaceID, aName, - aValue, aNotify); - if (NS_SUCCEEDED(rv)) { - UpdateStyleSheet(); - } - return rv; - } - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, - const nsAString& aValue, PRBool aNotify) { - nsresult rv = nsGenericHTMLContainerElement::SetAttr(aNodeInfo, aValue, - aNotify); - - // nsGenericHTMLContainerElement::SetAttribute(nsINodeInfo* aNodeInfo, - // const nsAString& aValue, - // PRBool aNotify) - // - // calls - // - // SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - // const nsAString& aValue, PRBool aNotify) - // - // which ends up calling UpdateStyleSheet so we don't call UpdateStyleSheet - // here ourselves. - - return rv; - } - NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRBool aNotify) { - nsresult rv = nsGenericHTMLContainerElement::UnsetAttr(aNameSpaceID, - aAttribute, - aNotify); - if (NS_SUCCEEDED(rv)) { - UpdateStyleSheet(); - } - return rv; - } - - nsresult GetInnerHTML(nsAString& aInnerHTML); - nsresult SetInnerHTML(const nsAString& aInnerHTML); + NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML); + NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML); protected: void GetStyleSheetURL(PRBool* aIsInline, @@ -294,12 +221,126 @@ NS_IMPL_STRING_ATTR(nsHTMLStyleElement, Media, media) NS_IMPL_STRING_ATTR(nsHTMLStyleElement, Type, type) nsresult +nsHTMLStyleElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument) +{ + nsresult rv = + nsGenericHTMLContainerElement::InsertChildAt(aKid, aIndex, aNotify, + aDeepSetDocument); + if (NS_SUCCEEDED(rv)) { + UpdateStyleSheet(); + } + + return rv; +} + +nsresult +nsHTMLStyleElement::ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument) +{ + nsresult rv = + nsGenericHTMLContainerElement::ReplaceChildAt(aKid, aIndex, aNotify, + aDeepSetDocument); + if (NS_SUCCEEDED(rv)) { + UpdateStyleSheet(); + } + + return rv; +} + +nsresult +nsHTMLStyleElement::AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument) +{ + nsresult rv = + nsGenericHTMLContainerElement::AppendChildTo(aKid, aNotify, + aDeepSetDocument); + if (NS_SUCCEEDED(rv)) { + UpdateStyleSheet(); + } + + return rv; +} + +nsresult +nsHTMLStyleElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify) +{ + nsresult rv = nsGenericHTMLContainerElement::RemoveChildAt(aIndex, aNotify); + if (NS_SUCCEEDED(rv)) { + UpdateStyleSheet(); + } + + return rv; +} + +void +nsHTMLStyleElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers) +{ + nsCOMPtr oldDoc = mDocument; + + nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep, + aCompileEventHandlers); + + UpdateStyleSheet(oldDoc); +} + +nsresult +nsHTMLStyleElement::SetAttr(PRUint32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify) +{ + nsresult rv = nsGenericHTMLContainerElement::SetAttr(aNameSpaceID, aName, + aValue, aNotify); + if (NS_SUCCEEDED(rv)) { + UpdateStyleSheet(); + } + + return rv; +} + +nsresult +nsHTMLStyleElement::SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify) +{ + nsresult rv = nsGenericHTMLContainerElement::SetAttr(aNodeInfo, aValue, + aNotify); + + // nsGenericHTMLContainerElement::SetAttribute(nsINodeInfo* aNodeInfo, + // const nsAString& aValue, + // PRBool aNotify) + // + // calls + // + // SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, + // const nsAString& aValue, PRBool aNotify) + // + // which ends up calling UpdateStyleSheet so we don't call UpdateStyleSheet + // here ourselves. + + return rv; +} + +nsresult +nsHTMLStyleElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify) +{ + nsresult rv = nsGenericHTMLContainerElement::UnsetAttr(aNameSpaceID, + aAttribute, + aNotify); + if (NS_SUCCEEDED(rv)) { + UpdateStyleSheet(); + } + + return rv; +} + +NS_IMETHODIMP nsHTMLStyleElement::GetInnerHTML(nsAString& aInnerHTML) { return GetContentsAsText(aInnerHTML); } -nsresult +NS_IMETHODIMP nsHTMLStyleElement::SetInnerHTML(const nsAString& aInnerHTML) { SetEnableUpdates(PR_FALSE); diff --git a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp index fc63b8e2627..52063cf2b86 100644 --- a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -118,13 +118,13 @@ public: NS_IMETHOD SetValueChanged(PRBool aValueChanged); // nsIContent - NS_IMETHOD InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD RemoveChildAt(PRUint32 aIndex, PRBool aNotify); + virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument); + virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify); NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, const nsAString& aValue, nsHTMLValue& aResult); @@ -133,14 +133,15 @@ public: PRInt32 aModType, nsChangeHint& aHint) const; NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, PRUint32 aFlags, - nsEventStatus* aEventStatus); - NS_IMETHOD SetFocus(nsIPresContext* aPresContext); - NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext); + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus); + virtual void SetFocus(nsIPresContext* aPresContext); + virtual void RemoveFocus(nsIPresContext* aPresContext); - nsresult GetInnerHTML(nsAString& aInnerHTML); - nsresult SetInnerHTML(const nsAString& aInnerHTML); + NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML); + NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML); protected: nsCOMPtr mControllers; @@ -265,19 +266,25 @@ nsHTMLTextAreaElement::GetForm(nsIDOMHTMLFormElement** aForm) NS_IMETHODIMP nsHTMLTextAreaElement::Blur() { - return SetElementFocus(PR_FALSE); + SetElementFocus(PR_FALSE); + + return NS_OK; } NS_IMETHODIMP nsHTMLTextAreaElement::Focus() { - return SetElementFocus(PR_TRUE); + SetElementFocus(PR_TRUE); + + return NS_OK; } -NS_IMETHODIMP +void nsHTMLTextAreaElement::SetFocus(nsIPresContext* aPresContext) { - NS_ENSURE_ARG_POINTER(aPresContext); + if (!aPresContext) + return; + // first see if we are disabled or not. If disabled then do nothing. nsAutoString disabled; @@ -285,11 +292,13 @@ nsHTMLTextAreaElement::SetFocus(nsIPresContext* aPresContext) nsGenericHTMLContainerFormElement::GetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled)) { - return NS_OK; + return; } nsCOMPtr esm; - if (NS_OK == aPresContext->GetEventStateManager(getter_AddRefs(esm))) { + aPresContext->GetEventStateManager(getter_AddRefs(esm)); + + if (esm) { esm->SetContentState(this, NS_EVENT_STATE_FOCUS); } @@ -301,17 +310,16 @@ nsHTMLTextAreaElement::SetFocus(nsIPresContext* aPresContext) // Could call SelectAll(aPresContext) here to automatically // select text when we receive focus. } - - return NS_OK; } -NS_IMETHODIMP +void nsHTMLTextAreaElement::RemoveFocus(nsIPresContext* aPresContext) { - NS_ENSURE_ARG_POINTER(aPresContext); + if (!aPresContext) + return; + // If we are disabled, we probably shouldn't have focus in the // first place, so allow it to be removed. - nsresult rv = NS_OK; nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_FALSE); @@ -320,17 +328,11 @@ nsHTMLTextAreaElement::RemoveFocus(nsIPresContext* aPresContext) } nsCOMPtr esm; - aPresContext->GetEventStateManager(getter_AddRefs(esm)); - if (esm) { - if (!mDocument) - return NS_ERROR_NULL_POINTER; - - rv = esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS); + if (esm && mDocument) { + esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS); } - - return rv; } NS_IMETHODIMP @@ -533,7 +535,7 @@ nsHTMLTextAreaElement::SetDefaultValue(const nsAString& aDefaultValue) return ReplaceContentsWithText(aDefaultValue, PR_TRUE); } -NS_IMETHODIMP +nsresult nsHTMLTextAreaElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, PRBool aDeepSetDocument) { @@ -546,7 +548,7 @@ nsHTMLTextAreaElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex, return rv; } -NS_IMETHODIMP +nsresult nsHTMLTextAreaElement::ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, PRBool aDeepSetDocument) { @@ -559,7 +561,7 @@ nsHTMLTextAreaElement::ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, return rv; } -NS_IMETHODIMP +nsresult nsHTMLTextAreaElement::AppendChildTo(nsIContent* aKid, PRBool aNotify, PRBool aDeepSetDocument) { @@ -572,7 +574,7 @@ nsHTMLTextAreaElement::AppendChildTo(nsIContent* aKid, PRBool aNotify, return rv; } -NS_IMETHODIMP +nsresult nsHTMLTextAreaElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify) { nsresult rv; @@ -661,7 +663,7 @@ nsHTMLTextAreaElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aM } -NS_IMETHODIMP +nsresult nsHTMLTextAreaElement::HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, @@ -731,13 +733,13 @@ nsHTMLTextAreaElement::DoneAddingChildren() } -nsresult +NS_IMETHODIMP nsHTMLTextAreaElement::GetInnerHTML(nsAString& aInnerHTML) { return GetContentsAsText(aInnerHTML); } -nsresult +NS_IMETHODIMP nsHTMLTextAreaElement::SetInnerHTML(const nsAString& aInnerHTML) { return ReplaceContentsWithText(aInnerHTML, PR_TRUE); diff --git a/mozilla/content/html/content/src/nsIAttributeContent.h b/mozilla/content/html/content/src/nsIAttributeContent.h deleted file mode 100644 index cf4b306ca3d..00000000000 --- a/mozilla/content/html/content/src/nsIAttributeContent.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#ifndef nsIAttributeContent_h___ -#define nsIAttributeContent_h___ - -#include "nsISupports.h" - -class nsIContent; -class nsIAtom; - -// IID for the nsIAttributeContent class -#define NS_IATTRIBUTECONTENT_IID \ -{ 0xbed47b65, 0x54f9, 0x11d3, \ -{ 0x96, 0xe9, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } } - -class nsIAttributeContent : public nsISupports { -public: - //friend nsresult NS_NewAttributeContent(nsIAttributeContent** aNewFrame); - NS_DEFINE_STATIC_IID_ACCESSOR(NS_IATTRIBUTECONTENT_IID) - - NS_IMETHOD Init(nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttrName) = 0; - -}; - -#endif /* nsIAttributeContent_h___ */ diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index 446a847ebe5..ccb39ab6d01 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -51,7 +51,7 @@ #include "nsParserUtils.h" #include "nsIScriptLoader.h" #include "nsIHTMLContent.h" -#include "nsIURL.h" +#include "nsIURI.h" #include "nsNetUtil.h" #include "nsIPresShell.h" #include "nsIPresContext.h" @@ -225,7 +225,7 @@ public: NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW - nsresult Init(nsIDocument* aDoc, nsIURI* aURL, nsISupports* aContainer, + nsresult Init(nsIDocument* aDoc, nsIURI* aURI, nsISupports* aContainer, nsIChannel* aChannel); // nsISupports @@ -1989,7 +1989,7 @@ SinkContext::FlushText(PRBool* aDidFlush, PRBool aReleaseLast) nsresult NS_NewHTMLContentSink(nsIHTMLContentSink** aResult, nsIDocument* aDoc, - nsIURI* aURL, + nsIURI* aURI, nsISupports* aContainer, nsIChannel* aChannel) { @@ -2001,7 +2001,7 @@ NS_NewHTMLContentSink(nsIHTMLContentSink** aResult, return NS_ERROR_OUT_OF_MEMORY; } - nsresult rv = it->Init(aDoc, aURL, aContainer, aChannel); + nsresult rv = it->Init(aDoc, aURI, aContainer, aChannel); NS_ENSURE_SUCCESS(rv, rv); @@ -2120,7 +2120,7 @@ IsScriptEnabled(nsIDocument *aDoc, nsIDocShell *aContainer) nsresult HTMLContentSink::Init(nsIDocument* aDoc, - nsIURI* aURL, + nsIURI* aURI, nsISupports* aContainer, nsIChannel* aChannel) { @@ -2132,7 +2132,7 @@ HTMLContentSink::Init(nsIDocument* aDoc, MOZ_TIMER_RESET(mWatch); MOZ_TIMER_START(mWatch); - nsresult rv = nsContentSink::Init(aDoc, aURL, aContainer, aChannel); + nsresult rv = nsContentSink::Init(aDoc, aURI, aContainer, aChannel); if NS_FAILED(rv) { MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n")); MOZ_TIMER_STOP(mWatch); @@ -2281,7 +2281,7 @@ HTMLContentSink::Init(nsIDocument* aDoc, #ifdef NS_DEBUG nsCAutoString spec; - (void)aURL->GetSpec(spec); + (void)aURI->GetSpec(spec); SINK_TRACE(SINK_TRACE_CALLS, ("HTMLContentSink::Init: this=%p url='%s'", this, spec.get())); @@ -3805,7 +3805,7 @@ HTMLContentSink::StartLayout() // If the document we are loading has a reference or it is a // frameset document, disable the scroll bars on the views. - if (mDocumentURL) { + if (mDocumentURI) { nsCAutoString ref; // Since all URI's that pass through here aren't URL's we can't @@ -3813,7 +3813,7 @@ HTMLContentSink::StartLayout() // finding the 'ref' part of the URI, we'll haveto revert to // string routines for finding the data past '#' - rv = mDocumentURL->GetSpec(ref); + rv = mDocumentURI->GetSpec(ref); nsReadingIterator start, end; @@ -3920,19 +3920,19 @@ HTMLContentSink::ProcessAREATag(const nsIParserNode& aNode) void HTMLContentSink::ProcessBaseHref(const nsAString& aBaseHref) { - //-- Make sure this page is allowed to load this URL + //-- Make sure this page is allowed to load this URI nsresult rv; nsCOMPtr baseHrefURI; rv = NS_NewURI(getter_AddRefs(baseHrefURI), aBaseHref, nsnull); if (NS_FAILED(rv)) return; - // Setting "BASE URL" from the last BASE tag appearing in HEAD. + // Setting "BASE URI" from the last BASE tag appearing in HEAD. if (!mBody) { // The document checks if it is legal to set this base - rv = mDocument->SetBaseURL(baseHrefURI); + rv = mDocument->SetBaseURI(baseHrefURI); if (NS_SUCCEEDED(rv)) { - mDocumentBaseURL = mDocument->GetBaseURL(); + mDocumentBaseURI = mDocument->GetBaseURI(); } } else { // NAV compatibility quirk @@ -3940,7 +3940,7 @@ HTMLContentSink::ProcessBaseHref(const nsAString& aBaseHref) nsIScriptSecurityManager *securityManager = nsContentUtils::GetSecurityManager(); - rv = securityManager->CheckLoadURI(mDocumentBaseURL, baseHrefURI, + rv = securityManager->CheckLoadURI(mDocumentBaseURI, baseHrefURI, nsIScriptSecurityManager::STANDARD); if (NS_FAILED(rv)) { return; @@ -4662,20 +4662,19 @@ HTMLContentSink::SetDocumentCharset(nsACString& aCharset) NS_IMETHODIMP HTMLContentSink::DumpContentModel() { - nsresult result = NS_OK; FILE* out = ::fopen("rtest_html.txt", "a"); if (out) { if (mDocument) { nsIContent* root = mDocument->GetRootContent(); if (root) { - if (mDocumentURL) { + if (mDocumentURI) { nsCAutoString buf; - mDocumentURL->GetSpec(buf); + mDocumentURI->GetSpec(buf); fputs(buf.get(), out); } fputs(";", out); - result = root->DumpContent(out, 0, PR_FALSE); + root->DumpContent(out, 0, PR_FALSE); fputs(";\n", out); } } @@ -4683,7 +4682,7 @@ HTMLContentSink::DumpContentModel() fclose(out); } - return result; + return NS_OK; } #endif diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index 986578ef8a6..a001f0d3545 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -394,7 +394,7 @@ nsHTMLDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup) void -nsHTMLDocument::BaseResetToURI(nsIURI *aURL) +nsHTMLDocument::BaseResetToURI(nsIURI *aURI) { nsresult rv = NS_OK; @@ -412,12 +412,12 @@ nsHTMLDocument::BaseResetToURI(nsIURI *aURL) mImageMaps.Clear(); mForms = nsnull; - if (aURL) { + if (aURI) { if (!mAttrStyleSheet) { - rv = NS_NewHTMLStyleSheet(getter_AddRefs(mAttrStyleSheet), aURL, this); + rv = NS_NewHTMLStyleSheet(getter_AddRefs(mAttrStyleSheet), aURI, this); } else { - rv = mAttrStyleSheet->Reset(aURL); + rv = mAttrStyleSheet->Reset(aURI); } if (NS_SUCCEEDED(rv)) { // tell the world about our new style sheet @@ -425,10 +425,10 @@ nsHTMLDocument::BaseResetToURI(nsIURI *aURL) if (!mStyleAttrStyleSheet) { rv = NS_NewHTMLCSSStyleSheet(getter_AddRefs(mStyleAttrStyleSheet), - aURL, this); + aURI, this); } else { - rv = mStyleAttrStyleSheet->Reset(aURL); + rv = mStyleAttrStyleSheet->Reset(aURI); } if (NS_SUCCEEDED(rv)) { // tell the world about our new style sheet @@ -451,7 +451,7 @@ nsHTMLDocument::BaseResetToURI(nsIURI *aURL) } -NS_IMETHODIMP +nsresult nsHTMLDocument::CreateShell(nsIPresContext* aContext, nsIViewManager* aViewManager, nsStyleSet* aStyleSet, @@ -779,7 +779,7 @@ nsHTMLDocument::RetrieveRelevantHeaders(nsIChannel *aChannel) return; } -NS_IMETHODIMP +nsresult nsHTMLDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup, @@ -822,8 +822,8 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, return rv; } - nsCOMPtr aURL; - rv = aChannel->GetURI(getter_AddRefs(aURL)); + nsCOMPtr uri; + rv = aChannel->GetURI(getter_AddRefs(uri)); if (NS_FAILED(rv)) { return rv; } @@ -884,10 +884,10 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, } nsCAutoString scheme; - aURL->GetScheme(scheme); + uri->GetScheme(scheme); nsCAutoString urlSpec; - aURL->GetSpec(urlSpec); + uri->GetSpec(urlSpec); PRInt32 charsetSource = kCharsetUninitialized; nsCAutoString charset; @@ -989,15 +989,14 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, else { if (IsXHTML()) { nsCOMPtr xmlsink; - - rv = NS_NewXMLContentSink(getter_AddRefs(xmlsink), this, aURL, + rv = NS_NewXMLContentSink(getter_AddRefs(xmlsink), this, uri, docShell, aChannel); sink = xmlsink; } else { nsCOMPtr htmlsink; - rv = NS_NewHTMLContentSink(getter_AddRefs(htmlsink), this, aURL, + rv = NS_NewHTMLContentSink(getter_AddRefs(htmlsink), this, uri, docShell, aChannel); sink = htmlsink; @@ -1009,21 +1008,19 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, } mParser->SetContentSink(sink); - // parser the content of the URL - mParser->Parse(aURL, nsnull, PR_FALSE, (void *)this); + // parser the content of the URI + mParser->Parse(uri, nsnull, PR_FALSE, (void *)this); } return rv; } -NS_IMETHODIMP +void nsHTMLDocument::StopDocumentLoad() { if (mParser) { mParser->Terminate(); } - - return NS_OK; } // static @@ -1517,7 +1514,7 @@ nsHTMLDocument::FlushPendingNotifications(PRBool aFlushReflows, nsDocument::FlushPendingNotifications(aFlushReflows, aUpdateViews); } -NS_IMETHODIMP_(PRBool) +PRBool nsHTMLDocument::IsCaseSensitive() { return IsXHTML(); @@ -1832,10 +1829,10 @@ NS_IMETHODIMP nsHTMLDocument::GetBaseURI(nsAString &aURI) { aURI.Truncate(); - nsIURI *uri = mDocumentBaseURL; // WEAK + nsIURI *uri = mDocumentBaseURI; // WEAK if (!uri) { - uri = mDocumentURL; + uri = mDocumentURI; } if (uri) { @@ -2030,8 +2027,8 @@ nsHTMLDocument::GetURL(nsAString& aURL) { nsCAutoString str; - if (mDocumentURL) { - mDocumentURL->GetSpec(str); + if (mDocumentURI) { + mDocumentURI->GetSpec(str); } CopyUTF8toUTF16(str, aURL); @@ -2281,7 +2278,7 @@ nsHTMLDocument::SetCookie(const nsAString& aCookie) { // not having a cookie service isn't an error nsCOMPtr service = do_GetService(kCookieServiceCID); - if (service && mDocumentURL) { + if (service && mDocumentURI) { nsCOMPtr prompt; nsCOMPtr window (do_QueryInterface(GetScriptGlobalObject())); if (window) { @@ -2307,14 +2304,14 @@ nsHTMLDocument::SetCookie(const nsAString& aCookie) // static nsresult -nsHTMLDocument::GetSourceDocumentURL(nsIURI** sourceURL) +nsHTMLDocument::GetSourceDocumentURI(nsIURI** sourceURI) { // XXX Tom said this reminded him of the "Six Degrees of // Kevin Bacon" game. We try to get from here to there using // whatever connections possible. The problem is that this // could break if any of the connections along the way change. // I wish there were a better way. - *sourceURL = nsnull; + *sourceURI = nsnull; // XXX This will fail on non-DOM contexts :( nsCOMPtr domDoc; @@ -2325,14 +2322,14 @@ nsHTMLDocument::GetSourceDocumentURL(nsIURI** sourceURL) return NS_OK; // No document in the window } - NS_IF_ADDREF(*sourceURL = doc->GetDocumentURL()); + NS_IF_ADDREF(*sourceURI = doc->GetDocumentURI()); - return sourceURL ? NS_OK : NS_ERROR_FAILURE; + return sourceURI ? NS_OK : NS_ERROR_FAILURE; } // XXX TBI: accepting arguments to the open method. nsresult -nsHTMLDocument::OpenCommon(nsIURI* aSourceURL) +nsHTMLDocument::OpenCommon(nsIURI* aSourceURI) { // If we already have a parser we ignore the document.open call. if (mParser) { @@ -2360,7 +2357,7 @@ nsHTMLDocument::OpenCommon(nsIURI* aSourceURL) nsCOMPtr channel; nsCOMPtr group = do_QueryReferent(mDocumentLoadGroup); - rv = NS_NewChannel(getter_AddRefs(channel), aSourceURL, nsnull, group); + rv = NS_NewChannel(getter_AddRefs(channel), aSourceURI, nsnull, group); if (NS_FAILED(rv)) { return rv; @@ -2444,7 +2441,7 @@ nsHTMLDocument::OpenCommon(nsIURI* aSourceURL) if (NS_SUCCEEDED(rv)) { nsCOMPtr sink; - rv = NS_NewHTMLContentSink(getter_AddRefs(sink), this, aSourceURL, + rv = NS_NewHTMLContentSink(getter_AddRefs(sink), this, aSourceURI, docshell, channel); NS_ENSURE_SUCCESS(rv, rv); @@ -2486,21 +2483,21 @@ nsHTMLDocument::Open() NS_IMETHODIMP nsHTMLDocument::Open(nsIDOMDocument** aReturn) { - // XXX The URL of the newly created document will match + // XXX The URI of the newly created document will match // that of the source document. Is this right? // XXX This will fail on non-DOM contexts :( - nsCOMPtr sourceURL; - nsresult rv = GetSourceDocumentURL(getter_AddRefs(sourceURL)); + nsCOMPtr sourceURI; + nsresult rv = GetSourceDocumentURI(getter_AddRefs(sourceURI)); - // Recover if we had a problem obtaining the source URL - if (!sourceURL) { - rv = NS_NewURI(getter_AddRefs(sourceURL), + // Recover if we had a problem obtaining the source URI + if (!sourceURI) { + rv = NS_NewURI(getter_AddRefs(sourceURI), NS_LITERAL_CSTRING("about:blank")); } NS_ENSURE_SUCCESS(rv, rv); - rv = OpenCommon(sourceURL); + rv = OpenCommon(sourceURI); NS_ENSURE_SUCCESS(rv, rv); return CallQueryInterface(this, aReturn); @@ -2628,13 +2625,13 @@ nsHTMLDocument::ScriptWriteCommon(PRBool aNewlineTerminate) nsCAutoString spec; - if (mDocumentURL) { - rv = mDocumentURL->GetSpec(spec); + if (mDocumentURI) { + rv = mDocumentURI->GetSpec(spec); NS_ENSURE_SUCCESS(rv, rv); } - if (!mDocumentURL || nsCRT::strcasecmp(spec.get(), "about:blank") == 0) { - // The current document's URL and principal are empty or "about:blank". + if (!mDocumentURI || nsCRT::strcasecmp(spec.get(), "about:blank") == 0) { + // The current document's URI and principal are empty or "about:blank". // By writing to this document, the script acquires responsibility for the // document for security purposes. Thus a document.write of a script tag // ends up producing a script with the same principals as the script @@ -2650,7 +2647,7 @@ nsHTMLDocument::ScriptWriteCommon(PRBool aNewlineTerminate) subject->GetURI(getter_AddRefs(subjectURI)); if (subjectURI) { - mDocumentURL = subjectURI; + mDocumentURI = subjectURI; mPrincipal = subject; } } @@ -3801,7 +3798,7 @@ nsHTMLDocument::CreateAndAddWyciwygChannel(void) nsresult rv = NS_OK; nsCAutoString url, originalSpec; - mDocumentURL->GetSpec(originalSpec); + mDocumentURI->GetSpec(originalSpec); // Generate the wyciwyg url url = NS_LITERAL_CSTRING("wyciwyg://") @@ -3891,14 +3888,14 @@ nsHTMLDocument::SetDesignMode(const nsAString & aDesignMode) nsresult rv = NS_OK; nsCAutoString url; - mDocumentURL->GetSpec(url); + mDocumentURI->GetSpec(url); // test if the above works if document.domain is set for Midas document // (www.netscape.com --> netscape.com) 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. rv = nsContentUtils::GetSecurityManager()->CheckSameOrigin(nsnull, - mDocumentURL); + mDocumentURI); if (NS_FAILED(rv)) return rv; } diff --git a/mozilla/content/html/document/src/nsHTMLDocument.h b/mozilla/content/html/document/src/nsHTMLDocument.h index e493215947a..206b5152a7b 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.h +++ b/mozilla/content/html/document/src/nsHTMLDocument.h @@ -89,20 +89,20 @@ public: virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup); virtual void ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup); - NS_IMETHOD CreateShell(nsIPresContext* aContext, - nsIViewManager* aViewManager, - nsStyleSet* aStyleSet, - nsIPresShell** aInstancePtrResult); + virtual nsresult CreateShell(nsIPresContext* aContext, + nsIViewManager* aViewManager, + nsStyleSet* aStyleSet, + nsIPresShell** aInstancePtrResult); - NS_IMETHOD StartDocumentLoad(const char* aCommand, - nsIChannel* aChannel, - nsILoadGroup* aLoadGroup, - nsISupports* aContainer, - nsIStreamListener **aDocListener, - PRBool aReset = PR_TRUE, - nsIContentSink* aSink = nsnull); + virtual nsresult StartDocumentLoad(const char* aCommand, + nsIChannel* aChannel, + nsILoadGroup* aLoadGroup, + nsISupports* aContainer, + nsIStreamListener **aDocListener, + PRBool aReset = PR_TRUE, + nsIContentSink* aSink = nsnull); - NS_IMETHOD StopDocumentLoad(); + virtual void StopDocumentLoad(); virtual void EndLoad(); @@ -153,7 +153,7 @@ public: virtual void FlushPendingNotifications(PRBool aFlushReflows = PR_TRUE, PRBool aUpdateViews = PR_FALSE); - NS_IMETHOD_(PRBool) IsCaseSensitive(); + virtual PRBool IsCaseSensitive(); // nsIDOMDocument interface NS_DECL_NSIDOMDOCUMENT @@ -246,7 +246,7 @@ protected: static PRBool MatchNameAttribute(nsIContent* aContent, nsString* aData); static PRBool MatchFormControls(nsIContent* aContent, nsString* aData); - static nsresult GetSourceDocumentURL(nsIURI** sourceURL); + static nsresult GetSourceDocumentURI(nsIURI** sourceURI); static void DocumentWriteTerminationFunc(nsISupports *aRef); diff --git a/mozilla/content/html/document/src/nsHTMLFragmentContentSink.cpp b/mozilla/content/html/document/src/nsHTMLFragmentContentSink.cpp index efa27bbf468..aa4f0a28556 100644 --- a/mozilla/content/html/document/src/nsHTMLFragmentContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLFragmentContentSink.cpp @@ -43,7 +43,7 @@ #include "nsIHTMLContent.h" #include "nsIHTMLContentContainer.h" #include "nsHTMLAtoms.h" -#include "nsHTMLTokens.h" +#include "nsHTMLTokens.h" #include "nsGenericHTMLElement.h" #include "nsIDOMText.h" #include "nsIDOMComment.h" @@ -81,7 +81,7 @@ public: NS_IMETHOD DidBuildModel(void); NS_IMETHOD WillInterrupt(void); NS_IMETHOD WillResume(void); - NS_IMETHOD SetParser(nsIParser* aParser); + NS_IMETHOD SetParser(nsIParser* aParser); NS_IMETHOD FlushPendingNotifications() { return NS_OK; } NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; } @@ -156,7 +156,7 @@ public: nsCOMPtr mNodeInfoManager; }; -class nsHTMLFragmentContentSink2 : public nsHTMLFragmentContentSink +class nsHTMLFragmentContentSink2 : public nsHTMLFragmentContentSink { public: nsHTMLFragmentContentSink2() { mHitSentinel = PR_TRUE; mSeenBody = PR_FALSE;} @@ -250,7 +250,7 @@ nsHTMLFragmentContentSink::WillBuildModel(void) return CallQueryInterface(frag, &mRoot); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::DidBuildModel(void) { FlushText(); @@ -262,49 +262,49 @@ nsHTMLFragmentContentSink::DidBuildModel(void) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::WillInterrupt(void) { return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::WillResume(void) { return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::SetParser(nsIParser* aParser) { NS_IF_RELEASE(mParser); mParser = aParser; NS_IF_ADDREF(mParser); - + return NS_OK; } - -NS_IMETHODIMP + +NS_IMETHODIMP nsHTMLFragmentContentSink::BeginContext(PRInt32 aID) { return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::EndContext(PRInt32 aID) { return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::SetTitle(const nsString& aValue) { NS_ENSURE_TRUE(mNodeInfoManager, NS_ERROR_NOT_INITIALIZED); - + nsresult result=NS_OK; nsCOMPtr nodeInfo; - result = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::title, nsnull, + result = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::title, nsnull, kNameSpaceID_None, getter_AddRefs(nodeInfo)); if(NS_SUCCEEDED(result)) { @@ -313,14 +313,14 @@ nsHTMLFragmentContentSink::SetTitle(const nsString& aValue) if (NS_SUCCEEDED(result)) { nsIContent *parent = GetCurrentContent(); - + if (nsnull == parent) { parent = mRoot; } - + result=parent->AppendChildTo(content, PR_FALSE, PR_FALSE); - - if (NS_SUCCEEDED(result)) { + + if (NS_SUCCEEDED(result)) { result=AddTextToContent(content,aValue); } } @@ -329,31 +329,31 @@ nsHTMLFragmentContentSink::SetTitle(const nsString& aValue) return result; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::OpenHTML(const nsIParserNode& aNode) { return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::CloseHTML() { return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::OpenHead(const nsIParserNode& aNode) { return OpenContainer(aNode); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::CloseHead() { return CloseContainer(eHTMLTag_head); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::OpenBody(const nsIParserNode& aNode) { // Ignore repeated BODY elements. The DTD is just sending them @@ -367,43 +367,43 @@ nsHTMLFragmentContentSink::OpenBody(const nsIParserNode& aNode) } } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::CloseBody() { return CloseContainer(eHTMLTag_body); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::OpenForm(const nsIParserNode& aNode) { return OpenContainer(aNode); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::CloseForm() { return CloseContainer(eHTMLTag_form); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::OpenFrameset(const nsIParserNode& aNode) { return OpenContainer(aNode); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::CloseFrameset() { return CloseContainer(eHTMLTag_frameset); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::OpenMap(const nsIParserNode& aNode) { return OpenContainer(aNode); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::CloseMap() { return CloseContainer(eHTMLTag_map); @@ -436,11 +436,11 @@ nsHTMLFragmentContentSink::AddBaseTagInfo(nsIHTMLContent* aContent) static const char kSentinelStr[] = "endnote"; -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::OpenContainer(const nsIParserNode& aNode) { NS_ENSURE_TRUE(mNodeInfoManager, NS_ERROR_NOT_INITIALIZED); - + nsAutoString tag; nsresult result = NS_OK; @@ -450,7 +450,7 @@ nsHTMLFragmentContentSink::OpenContainer(const nsIParserNode& aNode) } else if (mHitSentinel) { FlushText(); - + nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType()); nsIHTMLContent *content = nsnull; @@ -486,11 +486,11 @@ nsHTMLFragmentContentSink::OpenContainer(const nsIParserNode& aNode) result = AddAttributes(aNode, content); if (NS_OK == result) { nsIContent *parent = GetCurrentContent(); - + if (nsnull == parent) { parent = mRoot; } - + parent->AppendChildTo(content, PR_FALSE, PR_FALSE); PushContent(content); } @@ -504,13 +504,13 @@ nsHTMLFragmentContentSink::OpenContainer(const nsIParserNode& aNode) || nodeType == eHTMLTag_td || nodeType == eHTMLTag_th) // XXX if navigator_quirks_mode (only body in html supports background) - AddBaseTagInfo(content); + AddBaseTagInfo(content); } return result; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::CloseContainer(const nsHTMLTag aTag) { if (mHitSentinel && (nsnull != GetCurrentContent())) { @@ -522,24 +522,24 @@ nsHTMLFragmentContentSink::CloseContainer(const nsHTMLTag aTag) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::AddHeadContent(const nsIParserNode& aNode) { return AddLeaf(aNode); } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::AddLeaf(const nsIParserNode& aNode) { NS_ENSURE_TRUE(mNodeInfoManager, NS_ERROR_NOT_INITIALIZED); - + nsresult result = NS_OK; switch (aNode.GetTokenType()) { case eToken_start: { FlushText(); - + // Create new leaf content object nsCOMPtr content; nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType()); @@ -551,7 +551,7 @@ nsHTMLFragmentContentSink::AddLeaf(const nsIParserNode& aNode) nsCOMPtr nodeInfo; - if (nodeType == eHTMLTag_userdefined) { + if (nodeType == eHTMLTag_userdefined) { result = mNodeInfoManager->GetNodeInfo(aNode.GetText(), nsnull, kNameSpaceID_None, @@ -576,26 +576,26 @@ nsHTMLFragmentContentSink::AddLeaf(const nsIParserNode& aNode) result = AddAttributes(aNode, content); if (NS_OK == result) { nsIContent *parent = GetCurrentContent(); - + if (nsnull == parent) { parent = mRoot; } - + parent->AppendChildTo(content, PR_FALSE, PR_FALSE); } } - if(nodeType == eHTMLTag_plaintext || + if(nodeType == eHTMLTag_plaintext || nodeType == eHTMLTag_script || nodeType == eHTMLTag_style || nodeType == eHTMLTag_textarea || nodeType == eHTMLTag_xmp) { - + // Create a text node holding the content nsCOMPtr dtd; mParser->GetDTD(getter_AddRefs(dtd)); NS_ENSURE_TRUE(dtd, NS_ERROR_FAILURE); - + nsAutoString skippedContent; PRInt32 lineNo = 0; @@ -615,7 +615,7 @@ nsHTMLFragmentContentSink::AddLeaf(const nsIParserNode& aNode) case eToken_newline: result = AddText(aNode.GetText()); break; - + case eToken_entity: { nsAutoString tmp; @@ -629,11 +629,11 @@ nsHTMLFragmentContentSink::AddLeaf(const nsIParserNode& aNode) } break; } - + return result; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::AddComment(const nsIParserNode& aNode) { nsIContent *comment; @@ -641,20 +641,20 @@ nsHTMLFragmentContentSink::AddComment(const nsIParserNode& aNode) nsresult result = NS_OK; FlushText(); - + result = NS_NewCommentNode(&comment); if (NS_SUCCEEDED(result)) { result = CallQueryInterface(comment, &domComment); if (NS_SUCCEEDED(result)) { domComment->AppendData(aNode.GetText()); NS_RELEASE(domComment); - + nsIContent *parent = GetCurrentContent(); - + if (nsnull == parent) { parent = mRoot; } - + parent->AppendChildTo(comment, PR_FALSE, PR_FALSE); } NS_RELEASE(comment); @@ -663,7 +663,7 @@ nsHTMLFragmentContentSink::AddComment(const nsIParserNode& aNode) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::AddProcessingInstruction(const nsIParserNode& aNode) { return NS_OK; @@ -680,7 +680,7 @@ nsHTMLFragmentContentSink::AddDocTypeDecl(const nsIParserNode& aNode) return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsHTMLFragmentContentSink::GetFragment(nsIDOMDocumentFragment** aFragment) { if (mRoot) { @@ -702,19 +702,19 @@ nsHTMLFragmentContentSink::SetTargetDocument(nsIDocument* aTargetDocument) if (mNodeInfoManager) { return NS_OK; } - + nsresult rv = NS_NewNodeInfoManager(getter_AddRefs(mNodeInfoManager)); NS_ENSURE_SUCCESS(rv, rv); - + rv = mNodeInfoManager->Init(nsnull); if (NS_FAILED(rv)) { mNodeInfoManager = nsnull; } - return rv; + return rv; } -nsIContent* +nsIContent* nsHTMLFragmentContentSink::GetCurrentContent() { if (nsnull != mContentStack) { @@ -725,17 +725,17 @@ nsHTMLFragmentContentSink::GetCurrentContent() return nsnull; } -PRInt32 +PRInt32 nsHTMLFragmentContentSink::PushContent(nsIContent *aContent) { if (nsnull == mContentStack) { mContentStack = new nsVoidArray(); } - + mContentStack->AppendElement((void *)aContent); return mContentStack->Count(); } - + nsIContent* nsHTMLFragmentContentSink::PopContent() { @@ -784,9 +784,9 @@ nsHTMLFragmentContentSink::AddText(const nsAString& aString) } } mTextLength += - nsContentUtils::CopyNewlineNormalizedUnicodeTo(aString, + nsContentUtils::CopyNewlineNormalizedUnicodeTo(aString, offset, - &mText[mTextLength], + &mText[mTextLength], amount, isLastCharCR); offset += amount; @@ -801,7 +801,7 @@ nsHTMLFragmentContentSink::AddTextToContent(nsIHTMLContent* aContent,const nsStr NS_ASSERTION(aContent !=nsnull, "can't add text w/o a content"); nsresult result=NS_OK; - + if(aContent) { if (!aText.IsEmpty()) { nsCOMPtr text; @@ -871,7 +871,7 @@ nsHTMLFragmentContentSink::AddAttributes(const nsIParserNode& aNode, // wins. This does mean that we do some extra work in the case when the same // attribute is set multiple times, but we save a HasAttr call in the much // more common case of reasonable HTML. - + for (PRInt32 i = ac - 1; i >= 0; i--) { // Get lower-cased key const nsAString& key = aNode.GetKeyAt(i); diff --git a/mozilla/content/html/document/src/nsImageDocument.cpp b/mozilla/content/html/document/src/nsImageDocument.cpp index aace7f245cd..be5d8d23f81 100644 --- a/mozilla/content/html/document/src/nsImageDocument.cpp +++ b/mozilla/content/html/document/src/nsImageDocument.cpp @@ -87,13 +87,13 @@ public: virtual nsresult Init(); - NS_IMETHOD StartDocumentLoad(const char* aCommand, - nsIChannel* aChannel, - nsILoadGroup* aLoadGroup, - nsISupports* aContainer, - nsIStreamListener** aDocListener, - PRBool aReset = PR_TRUE, - nsIContentSink* aSink = nsnull); + virtual nsresult StartDocumentLoad(const char* aCommand, + nsIChannel* aChannel, + nsILoadGroup* aLoadGroup, + nsISupports* aContainer, + nsIStreamListener** aDocListener, + PRBool aReset = PR_TRUE, + nsIContentSink* aSink = nsnull); virtual void SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject); @@ -227,7 +227,7 @@ nsImageDocument::Init() return NS_OK; } -NS_IMETHODIMP +nsresult nsImageDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup, @@ -494,7 +494,7 @@ nsImageDocument::CreateSyntheticDocument() NS_ENSURE_TRUE(imageLoader, NS_ERROR_UNEXPECTED); nsCAutoString src; - mDocumentURL->GetSpec(src); + mDocumentURI->GetSpec(src); NS_ConvertUTF8toUCS2 srcString(src); // Make sure not to start the image load from here... diff --git a/mozilla/content/html/document/src/nsMediaDocument.cpp b/mozilla/content/html/document/src/nsMediaDocument.cpp index 45689cd5634..d9244c91086 100644 --- a/mozilla/content/html/document/src/nsMediaDocument.cpp +++ b/mozilla/content/html/document/src/nsMediaDocument.cpp @@ -150,7 +150,7 @@ nsMediaDocument::Init() return NS_OK; } -NS_IMETHODIMP +nsresult nsMediaDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup, @@ -306,7 +306,7 @@ nsMediaDocument::UpdateTitleAndCharset(const nsACString& aTypeStr, const nsAString& aStatus) { nsXPIDLString fileStr; - nsCOMPtr uri = do_QueryInterface(mDocumentURL); + nsCOMPtr uri = do_QueryInterface(mDocumentURI); if (uri) { nsCAutoString fileName; nsCOMPtr url = do_QueryInterface(uri); diff --git a/mozilla/content/html/document/src/nsMediaDocument.h b/mozilla/content/html/document/src/nsMediaDocument.h index b789b6d7f30..7616a9b080f 100644 --- a/mozilla/content/html/document/src/nsMediaDocument.h +++ b/mozilla/content/html/document/src/nsMediaDocument.h @@ -51,15 +51,15 @@ public: nsMediaDocument(); virtual ~nsMediaDocument(); - virtual nsresult Init(); + virtual nsresult Init(); - NS_IMETHOD StartDocumentLoad(const char* aCommand, - nsIChannel* aChannel, - nsILoadGroup* aLoadGroup, - nsISupports* aContainer, - nsIStreamListener** aDocListener, - PRBool aReset = PR_TRUE, - nsIContentSink* aSink = nsnull); + virtual nsresult StartDocumentLoad(const char* aCommand, + nsIChannel* aChannel, + nsILoadGroup* aLoadGroup, + nsISupports* aContainer, + nsIStreamListener** aDocListener, + PRBool aReset = PR_TRUE, + nsIContentSink* aSink = nsnull); protected: virtual nsresult CreateSyntheticDocument(); diff --git a/mozilla/content/html/document/src/nsPluginDocument.cpp b/mozilla/content/html/document/src/nsPluginDocument.cpp index 6b4cee7514e..5ee700c07a3 100644 --- a/mozilla/content/html/document/src/nsPluginDocument.cpp +++ b/mozilla/content/html/document/src/nsPluginDocument.cpp @@ -53,13 +53,13 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIPLUGINDOCUMENT - NS_IMETHOD StartDocumentLoad(const char* aCommand, - nsIChannel* aChannel, - nsILoadGroup* aLoadGroup, - nsISupports* aContainer, - nsIStreamListener** aDocListener, - PRBool aReset = PR_TRUE, - nsIContentSink* aSink = nsnull); + virtual nsresult StartDocumentLoad(const char* aCommand, + nsIChannel* aChannel, + nsILoadGroup* aLoadGroup, + nsISupports* aContainer, + nsIStreamListener** aDocListener, + PRBool aReset = PR_TRUE, + nsIContentSink* aSink = nsnull); virtual void SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject); @@ -102,7 +102,7 @@ nsPluginDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObje } -NS_IMETHODIMP +nsresult nsPluginDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup, @@ -192,7 +192,7 @@ nsPluginDocument::CreateSyntheticPluginDocument() // set URL nsCAutoString src; - mDocumentURL->GetSpec(src); + mDocumentURI->GetSpec(src); NS_ConvertUTF8toUCS2 srcString(src); nsHTMLValue val(srcString); diff --git a/mozilla/content/html/style/src/nsCSSLoader.cpp b/mozilla/content/html/style/src/nsCSSLoader.cpp index 54572369b30..3cf0fdca31f 100644 --- a/mozilla/content/html/style/src/nsCSSLoader.cpp +++ b/mozilla/content/html/style/src/nsCSSLoader.cpp @@ -1040,7 +1040,7 @@ CSSLoaderImpl::CreateSheet(nsIURI* aURI, // Inline style. Use the document's base URL so that @import in // the inline sheet picks up the right base. NS_ASSERTION(aLinkingContent, "Inline stylesheet without linking content?"); - aLinkingContent->GetBaseURL(getter_AddRefs(sheetURI)); + sheetURI = aLinkingContent->GetBaseURI(); } rv = NS_NewCSSStyleSheet(aSheet, sheetURI); @@ -1352,7 +1352,7 @@ CSSLoaderImpl::LoadSheet(SheetLoadData* aLoadData, StyleSheetState aSheetState) NS_LITERAL_CSTRING("text/css,*/*;q=0.1"), PR_FALSE); if (mDocument) { - nsIURI *documentURI = mDocument->GetDocumentURL(); + nsIURI *documentURI = mDocument->GetDocumentURI(); NS_ASSERTION(documentURI, "Null document uri is bad!"); if (documentURI) { httpChannel->SetReferrer(documentURI); @@ -1638,7 +1638,7 @@ CSSLoaderImpl::LoadStyleLink(nsIContent* aElement, NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_INITIALIZED); // Check whether we should even load - nsIURI *docURI = mDocument->GetDocumentURL(); + nsIURI *docURI = mDocument->GetDocumentURI(); if (!docURI) return NS_ERROR_FAILURE; nsresult rv = CheckLoadAllowed(docURI, aURL, aElement); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/content/html/style/src/nsDOMCSSAttrDeclaration.cpp b/mozilla/content/html/style/src/nsDOMCSSAttrDeclaration.cpp index 525c908f898..8a9a53b1973 100644 --- a/mozilla/content/html/style/src/nsDOMCSSAttrDeclaration.cpp +++ b/mozilla/content/html/style/src/nsDOMCSSAttrDeclaration.cpp @@ -153,8 +153,8 @@ nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(nsIURI** aBaseURI, // XXXbz GetOwnerDocument nsIDocument* doc = nodeInfo->GetDocument(); - mContent->GetBaseURL(aBaseURI); - + nsCOMPtr base = mContent->GetBaseURI(); + nsCOMPtr htmlContainer(do_QueryInterface(doc)); if (htmlContainer) { htmlContainer->GetCSSLoader(*aCSSLoader); @@ -178,6 +178,8 @@ nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(nsIURI** aBaseURI, (*aCSSParser)->SetCaseSensitive(!mContent->IsContentOfType(nsIContent::eHTML) || nodeInfo->NamespaceEquals(kNameSpaceID_XHTML)); + base.swap(*aBaseURI); + return NS_OK; } diff --git a/mozilla/content/html/style/src/nsStyleUtil.cpp b/mozilla/content/html/style/src/nsStyleUtil.cpp index 746bb92e7c2..6ef165add4b 100644 --- a/mozilla/content/html/style/src/nsStyleUtil.cpp +++ b/mozilla/content/html/style/src/nsStyleUtil.cpp @@ -497,8 +497,7 @@ PRBool nsStyleUtil::IsSimpleXlink(nsIContent *aContent, nsIPresContext *aPresCon aContent->GetAttr(kNameSpaceID_XLink, nsHTMLAtoms::href, val); // It's an XLink. Resolve it relative to aContent's base URI. - nsCOMPtr baseURI; - aContent->GetBaseURL(getter_AddRefs(baseURI)); + nsCOMPtr baseURI = aContent->GetBaseURI(); nsCOMPtr absURI; // XXX should we make sure to get the right charset off the document? diff --git a/mozilla/content/svg/content/src/nsSVGElement.cpp b/mozilla/content/svg/content/src/nsSVGElement.cpp index a6bc2ef3ab9..fa8609d66e9 100644 --- a/mozilla/content/svg/content/src/nsSVGElement.cpp +++ b/mozilla/content/svg/content/src/nsSVGElement.cpp @@ -123,43 +123,43 @@ nsSVGElement::Init() //---------------------------------------------------------------------- // nsIContent methods -NS_IMETHODIMP_(PRBool) +PRBool nsSVGElement::CanContainChildren() const { return PR_TRUE; } -NS_IMETHODIMP_(PRUint32) +PRUint32 nsSVGElement::GetChildCount() const { return mChildren.Count(); } -NS_IMETHODIMP_(nsIContent *) +nsIContent * nsSVGElement::GetChildAt(PRUint32 aIndex) const { return (nsIContent *)mChildren.SafeElementAt(aIndex); } -NS_IMETHODIMP_(PRInt32) +PRInt32 nsSVGElement::IndexOf(nsIContent* aPossibleChild) const { return mChildren.IndexOf(aPossibleChild); } -NS_IMETHODIMP_(nsIAtom*) +nsIAtom * nsSVGElement::GetIDAttributeName() const { return nsSVGAtoms::id; } -NS_IMETHODIMP_(already_AddRefed) -nsSVGElement::GetExistingAttrNameFromQName(const nsAString& aStr) +already_AddRefed +nsSVGElement::GetExistingAttrNameFromQName(const nsAString& aStr) const { return mAttributes->GetExistingAttrNameFromQName(aStr); } -NS_IMETHODIMP +nsresult nsSVGElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAString& aValue, PRBool aNotify) @@ -171,7 +171,7 @@ nsSVGElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, return SetAttr(ni, aValue, aNotify); } -NS_IMETHODIMP +nsresult nsSVGElement::SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, PRBool aNotify) @@ -179,7 +179,7 @@ nsSVGElement::SetAttr(nsINodeInfo* aNodeInfo, return mAttributes->SetAttr(aNodeInfo, aValue, aNotify); } -NS_IMETHODIMP +nsresult nsSVGElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsAString& aResult) const { @@ -187,7 +187,7 @@ nsSVGElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, return GetAttr(aNameSpaceID, aName, getter_AddRefs(prefix), aResult); } -NS_IMETHODIMP +nsresult nsSVGElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom** aPrefix, nsAString& aResult) const @@ -198,14 +198,14 @@ nsSVGElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, return mAttributes->GetAttr(aNameSpaceID, aName, aPrefix, aResult); } -NS_IMETHODIMP +nsresult nsSVGElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify) { return mAttributes->UnsetAttr(aNameSpaceID, aName, aNotify); } -NS_IMETHODIMP_(PRBool) +PRBool nsSVGElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const { NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, @@ -213,7 +213,7 @@ nsSVGElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const return mAttributes->HasAttr(aNameSpaceID, aName); } -NS_IMETHODIMP +nsresult nsSVGElement::GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, nsIAtom** aName, @@ -222,27 +222,25 @@ nsSVGElement::GetAttrNameAt(PRUint32 aIndex, return mAttributes->GetAttrNameAt(aIndex, aNameSpaceID, aName, aPrefix); } -NS_IMETHODIMP_(PRUint32) +PRUint32 nsSVGElement::GetAttrCount() const { return mAttributes->Count(); } #ifdef DEBUG -NS_IMETHODIMP +void nsSVGElement::List(FILE* out, PRInt32 aIndent) const { // XXX fprintf(out, "some SVG element\n"); - return NS_OK; } -NS_IMETHODIMP +void nsSVGElement::DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const { // XXX fprintf(out, "some SVG element\n"); - return NS_OK; } #endif // DEBUG diff --git a/mozilla/content/svg/content/src/nsSVGElement.h b/mozilla/content/svg/content/src/nsSVGElement.h index 04d63bc9d80..942133c644d 100644 --- a/mozilla/content/svg/content/src/nsSVGElement.h +++ b/mozilla/content/svg/content/src/nsSVGElement.h @@ -71,34 +71,29 @@ public: // nsIContent interface methods - NS_IMETHOD_(PRBool) CanContainChildren() const; - NS_IMETHOD_(PRUint32) GetChildCount() const; - NS_IMETHOD_(nsIContent *) GetChildAt(PRUint32 aIndex) const; - NS_IMETHOD_(PRInt32) IndexOf(nsIContent* aPossibleChild) const; - NS_IMETHOD_(nsIAtom *) GetIDAttributeName() const; - NS_IMETHOD_(already_AddRefed) GetExistingAttrNameFromQName(const nsAString& aStr); - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, - PRBool aNotify); - NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, - const nsAString& aValue, - PRBool aNotify); - NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsAString& aResult) const; - NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom** aPrefix, - nsAString& aResult) const; - NS_IMETHOD_(PRBool) HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const; - NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRBool aNotify); - NS_IMETHOD GetAttrNameAt(PRUint32 aIndex, - PRInt32* aNameSpaceID, - nsIAtom** aName, - nsIAtom** aPrefix) const; - NS_IMETHOD_(PRUint32) GetAttrCount() const; + virtual PRBool CanContainChildren() const; + virtual PRUint32 GetChildCount() const; + virtual nsIContent *GetChildAt(PRUint32 aIndex) const; + virtual PRInt32 IndexOf(nsIContent* aPossibleChild) const; + virtual nsIAtom *GetIDAttributeName() const; + virtual already_AddRefed GetExistingAttrNameFromQName(const nsAString& aStr) const; + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify); + virtual nsresult SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify); + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsAString& aResult) const; + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsIAtom** aPrefix, nsAString& aResult) const; + virtual PRBool HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const; + virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify); + virtual nsresult GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, + nsIAtom** aName, nsIAtom** aPrefix) const; + virtual PRUint32 GetAttrCount() const; #ifdef DEBUG - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; - NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const; + virtual void List(FILE* out, PRInt32 aIndent) const; + virtual void DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const; #endif // DEBUG // Child list modification hooks diff --git a/mozilla/content/svg/content/src/nsSVGStyleValue.cpp b/mozilla/content/svg/content/src/nsSVGStyleValue.cpp index c93c58251fe..2eb85509c1a 100644 --- a/mozilla/content/svg/content/src/nsSVGStyleValue.cpp +++ b/mozilla/content/svg/content/src/nsSVGStyleValue.cpp @@ -153,12 +153,11 @@ nsSVGStyleValue::UpdateStyleRule(nsIContent* aContent) } NS_ASSERTION(aContent, "need content node for base URL"); - nsCOMPtr baseURL; - aContent->GetBaseURL(getter_AddRefs(baseURL)); - + nsCOMPtr baseURI = aContent->GetBaseURI(); + nsCOMPtr css = do_CreateInstance(kCSSParserCID); NS_ASSERTION(css, "can't get a css parser"); if (!css) return; - css->ParseStyleAttribute(mValue, baseURL, getter_AddRefs(mRule)); + css->ParseStyleAttribute(mValue, baseURI, getter_AddRefs(mRule)); } diff --git a/mozilla/content/svg/document/src/nsSVGDocument.cpp b/mozilla/content/svg/document/src/nsSVGDocument.cpp index c912130318c..25099e708f6 100644 --- a/mozilla/content/svg/document/src/nsSVGDocument.cpp +++ b/mozilla/content/svg/document/src/nsSVGDocument.cpp @@ -61,7 +61,7 @@ nsSVGDocument::~nsSVGDocument() { } -NS_IMETHODIMP +nsresult nsSVGDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup, @@ -107,8 +107,8 @@ NS_IMETHODIMP nsSVGDocument::GetDomain(nsAString& aDomain) { nsCAutoString domain; - if (mDocumentURL) { - nsresult rv = mDocumentURL->GetHost(domain); + if (mDocumentURI) { + nsresult rv = mDocumentURI->GetHost(domain); if (NS_FAILED(rv)) return rv; } @@ -121,8 +121,8 @@ NS_IMETHODIMP nsSVGDocument::GetURL(nsAString& aURL) { nsCAutoString url; - if (mDocumentURL) { - nsresult rv = mDocumentURL->GetSpec(url); + if (mDocumentURI) { + nsresult rv = mDocumentURI->GetSpec(url); if (NS_FAILED(rv)) return rv; } diff --git a/mozilla/content/svg/document/src/nsSVGDocument.h b/mozilla/content/svg/document/src/nsSVGDocument.h index 390353699d5..499c9e2e653 100644 --- a/mozilla/content/svg/document/src/nsSVGDocument.h +++ b/mozilla/content/svg/document/src/nsSVGDocument.h @@ -52,14 +52,14 @@ class nsSVGDocument : public nsXMLDocument, virtual ~nsSVGDocument(); // Most methods will just fall through to the XMLDocument - - NS_IMETHOD StartDocumentLoad(const char* aCommand, - nsIChannel* aChannel, - nsILoadGroup* aLoadGroup, - nsISupports* aContainer, - nsIStreamListener **aDocListener, - PRBool aReset = PR_TRUE, - nsIContentSink* aSink = nsnull); + + virtual nsresult StartDocumentLoad(const char* aCommand, + nsIChannel* aChannel, + nsILoadGroup* aLoadGroup, + nsISupports* aContainer, + nsIStreamListener **aDocListener, + PRBool aReset = PR_TRUE, + nsIContentSink* aSink = nsnull); NS_DECL_NSIDOMSVGDOCUMENT NS_FORWARD_NSIDOMDOCUMENT(nsXMLDocument::) diff --git a/mozilla/content/xbl/src/nsBindingManager.cpp b/mozilla/content/xbl/src/nsBindingManager.cpp index efc9736ed94..c455081a138 100644 --- a/mozilla/content/xbl/src/nsBindingManager.cpp +++ b/mozilla/content/xbl/src/nsBindingManager.cpp @@ -866,7 +866,7 @@ nsBindingManager::LoadBindingDocument(nsIDocument* aBoundDoc, aURL->GetScheme(otherScheme); nsCAutoString scheme; - aBoundDoc->GetDocumentURL()->GetScheme(scheme); + aBoundDoc->GetDocumentURI()->GetScheme(scheme); // First we need to load our binding. *aResult = nsnull; diff --git a/mozilla/content/xbl/src/nsXBLBinding.cpp b/mozilla/content/xbl/src/nsXBLBinding.cpp index fe817589fd8..eb0c21d2841 100644 --- a/mozilla/content/xbl/src/nsXBLBinding.cpp +++ b/mozilla/content/xbl/src/nsXBLBinding.cpp @@ -339,7 +339,8 @@ struct ContentListData : public EnumData { -PRBool PR_CALLBACK BuildContentLists(nsHashKey* aKey, void* aData, void* aClosure) +PR_STATIC_CALLBACK(PRBool) +BuildContentLists(nsHashKey* aKey, void* aData, void* aClosure) { ContentListData* data = (ContentListData*)aClosure; nsIBindingManager* bm = data->mBindingManager; @@ -423,7 +424,8 @@ PRBool PR_CALLBACK BuildContentLists(nsHashKey* aKey, void* aData, void* aClosur return PR_TRUE; } -PRBool PR_CALLBACK RealizeDefaultContent(nsHashKey* aKey, void* aData, void* aClosure) +PR_STATIC_CALLBACK(PRBool) +RealizeDefaultContent(nsHashKey* aKey, void* aData, void* aClosure) { ContentListData* data = (ContentListData*)aClosure; nsIBindingManager* bm = data->mBindingManager; @@ -475,7 +477,8 @@ PRBool PR_CALLBACK RealizeDefaultContent(nsHashKey* aKey, void* aData, void* aCl return PR_TRUE; } -PRBool PR_CALLBACK ChangeDocumentForDefaultContent(nsHashKey* aKey, void* aData, void* aClosure) +PR_STATIC_CALLBACK(PRBool) +ChangeDocumentForDefaultContent(nsHashKey* aKey, void* aData, void* aClosure) { nsVoidArray* arr = NS_STATIC_CAST(nsVoidArray*, aData); PRInt32 count = arr->Count(); @@ -1369,7 +1372,7 @@ nsXBLBinding::AllowScripts() return result; } -static PRBool PR_CALLBACK +PR_STATIC_CALLBACK(PRBool) DeleteVoidArray(nsHashKey* aKey, void* aData, void* aClosure) { delete NS_STATIC_CAST(nsVoidArray*, aData); diff --git a/mozilla/content/xbl/src/nsXBLContentSink.cpp b/mozilla/content/xbl/src/nsXBLContentSink.cpp index 94373d4eee3..3f7e765f899 100644 --- a/mozilla/content/xbl/src/nsXBLContentSink.cpp +++ b/mozilla/content/xbl/src/nsXBLContentSink.cpp @@ -64,7 +64,7 @@ nsresult NS_NewXBLContentSink(nsIXMLContentSink** aResult, nsIDocument* aDoc, - nsIURI* aURL, + nsIURI* aURI, nsISupports* aContainer) { NS_ENSURE_ARG_POINTER(aResult); @@ -74,7 +74,7 @@ NS_NewXBLContentSink(nsIXMLContentSink** aResult, NS_ENSURE_TRUE(it, NS_ERROR_OUT_OF_MEMORY); nsCOMPtr kungFuDeathGrip = it; - nsresult rv = it->Init(aDoc, aURL, aContainer); + nsresult rv = it->Init(aDoc, aURI, aContainer); NS_ENSURE_SUCCESS(rv, rv); return CallQueryInterface(it, aResult); @@ -102,11 +102,11 @@ nsXBLContentSink::~nsXBLContentSink() nsresult nsXBLContentSink::Init(nsIDocument* aDoc, - nsIURI* aURL, + nsIURI* aURI, nsISupports* aContainer) { nsresult rv; - rv = nsXMLContentSink::Init(aDoc, aURL, aContainer, nsnull); + rv = nsXMLContentSink::Init(aDoc, aURI, aContainer, nsnull); return rv; } @@ -263,7 +263,7 @@ nsXBLContentSink::ReportUnexpectedElement(nsIAtom* aElementName, NS_ENSURE_SUCCESS(rv, rv); nsCAutoString documentURI; - mDocumentURL->GetSpec(documentURI); + mDocumentURI->GetSpec(documentURI); rv = errorObject->Init(errorText.get(), NS_ConvertUTF8toUCS2(documentURI).get(), @@ -411,13 +411,13 @@ nsXBLContentSink::OnOpenContainer(const PRUnichar **aAtts, mDocument->GetBindingManager()->PutXBLDocumentInfo(mDocInfo); - nsIURI *url = mDocument->GetDocumentURL(); + nsIURI *uri = mDocument->GetDocumentURI(); PRBool isChrome = PR_FALSE; PRBool isRes = PR_FALSE; - url->SchemeIs("chrome", &isChrome); - url->SchemeIs("resource", &isRes); + uri->SchemeIs("chrome", &isChrome); + uri->SchemeIs("resource", &isRes); mIsChromeOrResource = isChrome || isRes; nsIXBLDocumentInfo* info = mDocInfo; @@ -963,7 +963,7 @@ nsXBLContentSink::AddAttributesToXULPrototype(const PRUnichar **aAtts, NS_ENSURE_SUCCESS(rv, rv); } - rv = mCSSParser->ParseStyleAttribute(value, mDocumentURL, + rv = mCSSParser->ParseStyleAttribute(value, mDocumentURI, getter_AddRefs(aElement->mInlineStyleRule)); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to parse style rule"); diff --git a/mozilla/content/xbl/src/nsXBLDocumentInfo.cpp b/mozilla/content/xbl/src/nsXBLDocumentInfo.cpp index 03c6a1dce8a..f529e00f1f8 100644 --- a/mozilla/content/xbl/src/nsXBLDocumentInfo.cpp +++ b/mozilla/content/xbl/src/nsXBLDocumentInfo.cpp @@ -365,7 +365,7 @@ nsXBLDocumentInfo::nsXBLDocumentInfo(nsIDocument* aDocument) mScriptAccess(PR_TRUE), mBindingTable(nsnull) { - nsIURI* uri = aDocument->GetDocumentURL(); + nsIURI* uri = aDocument->GetDocumentURI(); if (IsChromeOrResourceURI(uri)) { // Cache whether or not this chrome XBL can execute scripts. nsCOMPtr reg(do_GetService(NS_CHROMEREGISTRY_CONTRACTID)); diff --git a/mozilla/content/xbl/src/nsXBLDocumentInfo.h b/mozilla/content/xbl/src/nsXBLDocumentInfo.h index e7d90c452b0..87238e8b077 100644 --- a/mozilla/content/xbl/src/nsXBLDocumentInfo.h +++ b/mozilla/content/xbl/src/nsXBLDocumentInfo.h @@ -56,7 +56,7 @@ public: NS_IMETHOD GetScriptAccess(PRBool* aResult) { *aResult = mScriptAccess; return NS_OK; }; NS_IMETHOD SetScriptAccess(PRBool aAccess) { mScriptAccess = aAccess; return NS_OK; }; - NS_IMETHOD_(nsIURI*) DocumentURI() { return mDocument->GetDocumentURL(); }; + NS_IMETHOD_(nsIURI*) DocumentURI() { return mDocument->GetDocumentURI(); }; NS_IMETHOD GetPrototypeBinding(const nsACString& aRef, nsXBLPrototypeBinding** aResult); NS_IMETHOD SetPrototypeBinding(const nsACString& aRef, nsXBLPrototypeBinding* aBinding); diff --git a/mozilla/content/xbl/src/nsXBLResourceLoader.cpp b/mozilla/content/xbl/src/nsXBLResourceLoader.cpp index d9d0ee182b9..c867444e43a 100644 --- a/mozilla/content/xbl/src/nsXBLResourceLoader.cpp +++ b/mozilla/content/xbl/src/nsXBLResourceLoader.cpp @@ -105,7 +105,7 @@ nsXBLResourceLoader::LoadResources(PRBool* aResult) nsCOMPtr doc; info->GetDocument(getter_AddRefs(doc)); - nsIURI *docURL = doc->GetDocumentURL(); + nsIURI *docURL = doc->GetDocumentURI(); nsCOMPtr url; diff --git a/mozilla/content/xbl/src/nsXBLService.cpp b/mozilla/content/xbl/src/nsXBLService.cpp index 7c363ecfe84..28cff7cc917 100644 --- a/mozilla/content/xbl/src/nsXBLService.cpp +++ b/mozilla/content/xbl/src/nsXBLService.cpp @@ -392,7 +392,7 @@ nsXBLStreamListener::Load(nsIDOMEvent* aEvent) // Remove ourselves from the set of pending docs. nsIBindingManager *bindingManager = doc->GetBindingManager(); - nsIURI* documentURI = mBindingDocument->GetDocumentURL(); + nsIURI* documentURI = mBindingDocument->GetDocumentURI(); bindingManager->RemoveLoadingDocListener(documentURI); if (!mBindingDocument->GetRootContent()) { @@ -563,7 +563,7 @@ nsXBLService::LoadBindings(nsIContent* aContent, nsIURI* aURL, PRBool aAugmentFl } // Security check - remote pages can't load local bindings, except from chrome - nsIURI *docURI = document->GetDocumentURL(); + nsIURI *docURI = document->GetDocumentURI(); PRBool isChrome = PR_FALSE; rv = docURI->SchemeIs("chrome", &isChrome); @@ -982,8 +982,8 @@ NS_IMETHODIMP nsXBLService::GetBindingInternal(nsIContent* aBoundElement, nsCOMPtr bindingURI; nsresult rv = NS_NewURI(getter_AddRefs(bindingURI), value, - PromiseFlatCString(doc->GetDocumentCharacterSet()).get(), - doc->GetBaseURL()); + doc->GetDocumentCharacterSet().get(), + doc->GetBaseURI()); NS_ENSURE_SUCCESS(rv, rv); if (NS_FAILED(GetBindingInternal(aBoundElement, bindingURI, aPeekOnly, diff --git a/mozilla/content/xml/content/src/nsXMLCDATASection.cpp b/mozilla/content/xml/content/src/nsXMLCDATASection.cpp index 86017ce9de3..85ccb92bb13 100644 --- a/mozilla/content/xml/content/src/nsXMLCDATASection.cpp +++ b/mozilla/content/xml/content/src/nsXMLCDATASection.cpp @@ -67,10 +67,10 @@ public: // nsIContent virtual nsIAtom *Tag() const; - NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags); + virtual PRBool IsContentOfType(PRUint32 aFlags) const; #ifdef DEBUG - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; - NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const; + virtual void List(FILE* out, PRInt32 aIndent) const; + virtual void DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const; #endif // nsITextContent @@ -119,8 +119,8 @@ nsXMLCDATASection::Tag() const return nsLayoutAtoms::textTagName; } -NS_IMETHODIMP_(PRBool) -nsXMLCDATASection::IsContentOfType(PRUint32 aFlags) +PRBool +nsXMLCDATASection::IsContentOfType(PRUint32 aFlags) const { return !(aFlags & ~eTEXT); } @@ -180,7 +180,7 @@ nsXMLCDATASection::CloneContent(PRBool aCloneText, nsITextContent** aReturn) } #ifdef DEBUG -NS_IMETHODIMP +void nsXMLCDATASection::List(FILE* out, PRInt32 aIndent) const { NS_PRECONDITION(mDocument, "bad content"); @@ -195,12 +195,10 @@ nsXMLCDATASection::List(FILE* out, PRInt32 aIndent) const fputs(NS_LossyConvertUCS2toASCII(tmp).get(), out); fputs(">\n", out); - return NS_OK; } -NS_IMETHODIMP +void nsXMLCDATASection::DumpContent(FILE* out, PRInt32 aIndent, PRBool aDumpAll) const { - return NS_OK; } #endif diff --git a/mozilla/content/xml/content/src/nsXMLElement.cpp b/mozilla/content/xml/content/src/nsXMLElement.cpp index 908fafc81db..b4edb8c668d 100644 --- a/mozilla/content/xml/content/src/nsXMLElement.cpp +++ b/mozilla/content/xml/content/src/nsXMLElement.cpp @@ -144,7 +144,7 @@ NS_IMPL_ADDREF_INHERITED(nsXMLElement, nsGenericElement) NS_IMPL_RELEASE_INHERITED(nsXMLElement, nsGenericElement) -NS_IMETHODIMP +nsresult nsXMLElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAString& aValue, PRBool aNotify) @@ -153,7 +153,7 @@ nsXMLElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, aNotify); } -NS_IMETHODIMP +nsresult nsXMLElement::SetAttr(nsINodeInfo *aNodeInfo, const nsAString& aValue, PRBool aNotify) @@ -174,8 +174,8 @@ nsXMLElement::SetAttr(nsINodeInfo *aNodeInfo, return nsGenericContainerElement::SetAttr(aNodeInfo, aValue, aNotify); } -static nsresult DocShellToPresContext(nsIDocShell *aShell, - nsIPresContext **aPresContext) +static nsresult +DocShellToPresContext(nsIDocShell *aShell, nsIPresContext **aPresContext) { *aPresContext = nsnull; @@ -187,8 +187,9 @@ static nsresult DocShellToPresContext(nsIDocShell *aShell, return ds->GetPresContext(aPresContext); } -static nsresult CheckLoadURI(const nsString& aSpec, nsIURI *aBaseURI, - nsIDocument* aDocument, nsIURI **aAbsURI) +static nsresult +CheckLoadURI(const nsString& aSpec, nsIURI *aBaseURI, nsIDocument* aDocument, + nsIURI **aAbsURI) { *aAbsURI = nsnull; @@ -211,7 +212,8 @@ static nsresult CheckLoadURI(const nsString& aSpec, nsIURI *aBaseURI, return rv; } -static inline nsresult SpecialAutoLoadReturn(nsresult aRv, nsLinkVerb aVerb) +static inline +nsresult SpecialAutoLoadReturn(nsresult aRv, nsLinkVerb aVerb) { if (NS_SUCCEEDED(aRv)) { switch(aVerb) { @@ -305,9 +307,8 @@ nsXMLElement::MaybeTriggerAutoLink(nsIDocShell *aShell) } // base - nsCOMPtr base; - rv = GetBaseURL(getter_AddRefs(base)); - if (NS_FAILED(rv)) + nsCOMPtr base = GetBaseURI(); + if (!base) break; // href= ? @@ -335,7 +336,7 @@ nsXMLElement::MaybeTriggerAutoLink(nsIDocShell *aShell) return rv; } -NS_IMETHODIMP +nsresult nsXMLElement::HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, @@ -405,15 +406,14 @@ nsXMLElement::HandleDOMEvent(nsIPresContext* aPresContext, verb = eLinkVerb_Embed; } - nsCOMPtr baseURL; - GetBaseURL(getter_AddRefs(baseURL)); + nsCOMPtr baseURI = GetBaseURI(); nsCOMPtr uri; ret = nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(uri), href, mDocument, - baseURL); + baseURI); if (NS_SUCCEEDED(ret)) { - ret = TriggerLink(aPresContext, verb, baseURL, uri, target, + ret = TriggerLink(aPresContext, verb, baseURI, uri, target, PR_TRUE); } @@ -467,16 +467,15 @@ nsXMLElement::HandleDOMEvent(nsIPresContext* aPresContext, break; } - nsCOMPtr baseURL; - GetBaseURL(getter_AddRefs(baseURL)); + nsCOMPtr baseURI = GetBaseURI(); nsCOMPtr uri; ret = nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(uri), href, mDocument, - baseURL); + baseURI); if (NS_SUCCEEDED(ret)) { - ret = TriggerLink(aPresContext, eLinkVerb_Replace, baseURL, uri, + ret = TriggerLink(aPresContext, eLinkVerb_Replace, baseURI, uri, target, PR_FALSE); } diff --git a/mozilla/content/xml/content/src/nsXMLElement.h b/mozilla/content/xml/content/src/nsXMLElement.h index b4319e80b28..d03046635c0 100644 --- a/mozilla/content/xml/content/src/nsXMLElement.h +++ b/mozilla/content/xml/content/src/nsXMLElement.h @@ -74,17 +74,14 @@ public: NS_IMETHOD GetID(nsIAtom** aResult) const; // nsIContent - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, - PRBool aNotify); - NS_IMETHOD SetAttr(nsINodeInfo *aNodeInfo, - const nsAString& aValue, - PRBool aNotify); - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, - nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, - PRUint32 aFlags, - nsEventStatus* aEventStatus); + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify); + virtual nsresult SetAttr(nsINodeInfo *aNodeInfo, const nsAString& aValue, + PRBool aNotify); + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus); protected: PRBool mIsLink; diff --git a/mozilla/content/xml/content/src/nsXMLProcessingInstruction.cpp b/mozilla/content/xml/content/src/nsXMLProcessingInstruction.cpp index db81ccf5de1..d4137dc02c4 100644 --- a/mozilla/content/xml/content/src/nsXMLProcessingInstruction.cpp +++ b/mozilla/content/xml/content/src/nsXMLProcessingInstruction.cpp @@ -118,8 +118,8 @@ nsXMLProcessingInstruction::Tag() const return nsLayoutAtoms::processingInstructionTagName; } -NS_IMETHODIMP_(PRBool) -nsXMLProcessingInstruction::IsContentOfType(PRUint32 aFlags) +PRBool +nsXMLProcessingInstruction::IsContentOfType(PRUint32 aFlags) const { return !(aFlags & ~ePROCESSING_INSTRUCTION); } @@ -167,7 +167,7 @@ nsXMLProcessingInstruction::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) } #ifdef DEBUG -NS_IMETHODIMP +void nsXMLProcessingInstruction::List(FILE* out, PRInt32 aIndent) const { NS_PRECONDITION(mDocument, "bad content"); @@ -183,12 +183,11 @@ nsXMLProcessingInstruction::List(FILE* out, PRInt32 aIndent) const fputs(NS_LossyConvertUCS2toASCII(tmp).get(), out); fputs(">\n", out); - return NS_OK; } -NS_IMETHODIMP +void nsXMLProcessingInstruction::DumpContent(FILE* out, PRInt32 aIndent, - PRBool aDumpAll) const { - return NS_OK; + PRBool aDumpAll) const +{ } #endif diff --git a/mozilla/content/xml/content/src/nsXMLProcessingInstruction.h b/mozilla/content/xml/content/src/nsXMLProcessingInstruction.h index 64ffde0e0f1..bb5cc2c41dc 100644 --- a/mozilla/content/xml/content/src/nsXMLProcessingInstruction.h +++ b/mozilla/content/xml/content/src/nsXMLProcessingInstruction.h @@ -65,11 +65,11 @@ public: // nsIContent virtual nsIAtom *Tag() const; - NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags); + virtual PRBool IsContentOfType(PRUint32 aFlags) const; #ifdef DEBUG - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; - NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent, PRBool aDumpAll) const; + virtual void List(FILE* out, PRInt32 aIndent) const; + virtual void DumpContent(FILE* out, PRInt32 aIndent, PRBool aDumpAll) const; #endif protected: diff --git a/mozilla/content/xml/content/src/nsXMLStylesheetPI.cpp b/mozilla/content/xml/content/src/nsXMLStylesheetPI.cpp index 087be1007e8..321761b78f8 100644 --- a/mozilla/content/xml/content/src/nsXMLStylesheetPI.cpp +++ b/mozilla/content/xml/content/src/nsXMLStylesheetPI.cpp @@ -63,8 +63,8 @@ public: NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); // nsIContent - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, - PRBool aCompileEventHandlers); + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); // nsStyleLinkElement NS_IMETHOD GetCharset(nsAString& aCharset); @@ -101,17 +101,15 @@ nsXMLStylesheetPI::~nsXMLStylesheetPI() // nsIContent -NS_IMETHODIMP +void nsXMLStylesheetPI::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) { nsCOMPtr oldDoc = mDocument; - nsresult rv = nsXMLProcessingInstruction::SetDocument(aDocument, aDeep, - aCompileEventHandlers); - if (NS_SUCCEEDED(rv)) { - UpdateStyleSheet(oldDoc); - } - return rv; + nsXMLProcessingInstruction::SetDocument(aDocument, aDeep, + aCompileEventHandlers); + + UpdateStyleSheet(oldDoc); } @@ -171,7 +169,7 @@ nsXMLStylesheetPI::GetStyleSheetURL(PRBool* aIsInline, nsIURI *baseURL; nsCAutoString charset; if (mDocument) { - baseURL = mDocument->GetBaseURL(); + baseURL = mDocument->GetBaseURI(); charset = mDocument->GetDocumentCharacterSet(); } else { baseURL = nsnull; diff --git a/mozilla/content/xml/document/src/nsXMLContentSink.cpp b/mozilla/content/xml/document/src/nsXMLContentSink.cpp index 92c992fed09..91c8cc38206 100644 --- a/mozilla/content/xml/document/src/nsXMLContentSink.cpp +++ b/mozilla/content/xml/document/src/nsXMLContentSink.cpp @@ -48,7 +48,7 @@ #include "nsIDOMNSDocument.h" #include "nsIXMLContent.h" #include "nsIScriptGlobalObject.h" -#include "nsIURL.h" +#include "nsIURI.h" #include "nsIRefreshURI.h" #include "nsNetUtil.h" #include "nsIDocShell.h" @@ -122,7 +122,7 @@ static const char kLoadAsData[] = "loadAsData"; nsresult NS_NewXMLContentSink(nsIXMLContentSink** aResult, nsIDocument* aDoc, - nsIURI* aURL, + nsIURI* aURI, nsISupports* aContainer, nsIChannel* aChannel) { @@ -137,7 +137,7 @@ NS_NewXMLContentSink(nsIXMLContentSink** aResult, } nsCOMPtr kungFuDeathGrip = it; - nsresult rv = it->Init(aDoc, aURL, aContainer, aChannel); + nsresult rv = it->Init(aDoc, aURI, aContainer, aChannel); NS_ENSURE_SUCCESS(rv, rv); return CallQueryInterface(it, aResult); @@ -147,8 +147,8 @@ nsXMLContentSink::nsXMLContentSink() { mDocument = nsnull; - mDocumentURL = nsnull; - mDocumentBaseURL = nsnull; + mDocumentURI = nsnull; + mDocumentBaseURI = nsnull; mParser = nsnull; mDocElement = nsnull; mText = nsnull; @@ -175,11 +175,11 @@ nsXMLContentSink::~nsXMLContentSink() nsresult nsXMLContentSink::Init(nsIDocument* aDoc, - nsIURI* aURL, + nsIURI* aURI, nsISupports* aContainer, nsIChannel* aChannel) { - nsresult rv = nsContentSink::Init(aDoc, aURL, aContainer, aChannel); + nsresult rv = nsContentSink::Init(aDoc, aURI, aContainer, aChannel); NS_ENSURE_SUCCESS(rv, rv); if (!mDocShell) { @@ -264,12 +264,12 @@ nsXMLContentSink::DidBuildModel() // documentElement? NS_ASSERTION(mDocument->IndexOf(mDocElement) != -1, "mDocElement not in doc?"); - mDocument->BeginUpdate(UPDATE_CONTENT_MODEL); + + mozAutoDocUpdate(mDocument, UPDATE_CONTENT_MODEL, PR_TRUE); mDocument->ContentInserted(nsnull, mDocElement, // XXXbz is this last arg relevant if // the container is null? mDocument->IndexOf(mDocElement)); - mDocument->EndUpdate(UPDATE_CONTENT_MODEL); } // Check if we want to prettyprint @@ -600,7 +600,7 @@ nsXMLContentSink::AddContentAsLeaf(nsIContent *aContent) } // Create an XML parser and an XSL content sink and start parsing -// the XSL stylesheet located at the given URL. +// the XSL stylesheet located at the given URI. nsresult nsXMLContentSink::LoadXSLStyleSheet(nsIURI* aUrl) { @@ -619,7 +619,7 @@ nsXMLContentSink::LoadXSLStyleSheet(nsIURI* aUrl) return NS_ERROR_FAILURE; } - return mXSLTProcessor->LoadStyleSheet(aUrl, loadGroup, mDocumentURL); + return mXSLTProcessor->LoadStyleSheet(aUrl, loadGroup, mDocumentURI); } nsresult @@ -651,15 +651,15 @@ nsXMLContentSink::ProcessStyleLink(nsIContent* aElement, return NS_OK; nsCOMPtr url; - rv = NS_NewURI(getter_AddRefs(url), aHref, nsnull, mDocumentBaseURL); + rv = NS_NewURI(getter_AddRefs(url), aHref, nsnull, mDocumentBaseURI); NS_ENSURE_SUCCESS(rv, rv); nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager(); - rv = secMan->CheckLoadURI(mDocumentURL, url, + rv = secMan->CheckLoadURI(mDocumentURI, url, nsIScriptSecurityManager::ALLOW_CHROME); NS_ENSURE_SUCCESS(rv, NS_OK); - rv = secMan->CheckSameOriginURI(mDocumentURL, url); + rv = secMan->CheckSameOriginURI(mDocumentURI, url); NS_ENSURE_SUCCESS(rv, NS_OK); return LoadXSLStyleSheet(url); @@ -699,9 +699,9 @@ nsXMLContentSink::ProcessBASETag(nsIContent* aContent) nsCOMPtr baseURI; rv = NS_NewURI(getter_AddRefs(baseURI), value); if (NS_SUCCEEDED(rv)) { - rv = mDocument->SetBaseURL(baseURI); // The document checks if it is legal to set this base + rv = mDocument->SetBaseURI(baseURI); // The document checks if it is legal to set this base if (NS_SUCCEEDED(rv)) { - mDocumentBaseURL = mDocument->GetBaseURL(); + mDocumentBaseURI = mDocument->GetBaseURI(); } } } @@ -873,7 +873,7 @@ nsXMLContentSink::StartLayout() RefreshIfEnabled(shell->GetViewManager()); } - if (mDocumentURL) { + if (mDocumentURI) { nsCAutoString ref; // Since all URI's that pass through here aren't URL's we can't @@ -881,7 +881,7 @@ nsXMLContentSink::StartLayout() // finding the 'ref' part of the URI, we'll haveto revert to // string routines for finding the data past '#' - mDocumentURL->GetSpec(ref); + mDocumentURI->GetSpec(ref); nsReadingIterator start, end; diff --git a/mozilla/content/xml/document/src/nsXMLDocument.cpp b/mozilla/content/xml/document/src/nsXMLDocument.cpp index 6888e420ada..2e863ea7163 100644 --- a/mozilla/content/xml/document/src/nsXMLDocument.cpp +++ b/mozilla/content/xml/document/src/nsXMLDocument.cpp @@ -133,8 +133,8 @@ NS_NewDOMDocument(nsIDOMDocument** aInstancePtrResult, nsCOMPtr kungFuDeathGrip(doc); - doc->SetDocumentURL(aBaseURI); - doc->SetBaseURL(aBaseURI); + doc->nsIDocument::SetDocumentURI(aBaseURI); + doc->SetBaseURI(aBaseURI); if (aDoctype) { nsCOMPtr tmpNode; @@ -422,7 +422,7 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn) } } - nsIURI *baseURI = mDocumentURL; + nsIURI *baseURI = mDocumentURI; nsCAutoString charset; if (callingContext) { @@ -437,7 +437,7 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn) nsCOMPtr doc(do_QueryInterface(dom_doc)); if (doc) { - baseURI = doc->GetBaseURL(); + baseURI = doc->GetBaseURI(); charset = doc->GetDocumentCharacterSet(); } } @@ -465,8 +465,8 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn) return NS_OK; } - SetDocumentURL(uri); - SetBaseURL(uri); + this->nsIDocument::SetDocumentURI(uri); + SetBaseURI(uri); // Store script context, if any, in case we encounter redirect // (because we need it there) @@ -575,7 +575,7 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn) return NS_OK; } -NS_IMETHODIMP +nsresult nsXMLDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup, @@ -917,7 +917,7 @@ nsXMLDocument::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) nsAutoString emptyStr; emptyStr.Truncate(); rv = NS_NewDOMDocument(getter_AddRefs(newDoc), emptyStr, emptyStr, - newDocType, mDocumentURL); + newDocType, mDocumentURI); if (NS_FAILED(rv)) return rv; if (aDeep) { diff --git a/mozilla/content/xml/document/src/nsXMLDocument.h b/mozilla/content/xml/document/src/nsXMLDocument.h index a205a7b0247..2400cb597d5 100644 --- a/mozilla/content/xml/document/src/nsXMLDocument.h +++ b/mozilla/content/xml/document/src/nsXMLDocument.h @@ -71,12 +71,12 @@ public: virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup); - NS_IMETHOD StartDocumentLoad(const char* aCommand, nsIChannel* channel, - nsILoadGroup* aLoadGroup, - nsISupports* aContainer, - nsIStreamListener **aDocListener, - PRBool aReset = PR_TRUE, - nsIContentSink* aSink = nsnull); + virtual nsresult StartDocumentLoad(const char* aCommand, nsIChannel* channel, + nsILoadGroup* aLoadGroup, + nsISupports* aContainer, + nsIStreamListener **aDocListener, + PRBool aReset = PR_TRUE, + nsIContentSink* aSink = nsnull); virtual void EndLoad(); diff --git a/mozilla/content/xul/content/src/nsXULElement.cpp b/mozilla/content/xul/content/src/nsXULElement.cpp index 3af4c149cb2..5b58076e222 100644 --- a/mozilla/content/xul/content/src/nsXULElement.cpp +++ b/mozilla/content/xul/content/src/nsXULElement.cpp @@ -1044,7 +1044,7 @@ nsXULElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) rv = nsXULElement::Create(mSlots->mNodeInfo, getter_AddRefs(result)); if (NS_SUCCEEDED(rv)) { - rv = result->SetDocument(mDocument, PR_TRUE, PR_TRUE); + result->SetDocument(mDocument, PR_TRUE, PR_TRUE); } } if (NS_FAILED(rv)) return rv; @@ -1140,7 +1140,7 @@ nsXULElement::GetTagName(nsAString& aTagName) return NS_OK; } -NS_IMETHODIMP_(nsINodeInfo *) +nsINodeInfo * nsXULElement::GetNodeInfo() const { return NodeInfo(); @@ -1542,7 +1542,7 @@ nsXULElement::AddScriptEventListener(nsIAtom* aName, return rv; } -NS_IMETHODIMP +nsresult nsXULElement::GetListenerManager(nsIEventListenerManager** aResult) { if (!mListenerManager) { @@ -1560,12 +1560,6 @@ nsXULElement::GetListenerManager(nsIEventListenerManager** aResult) } -NS_IMETHODIMP -nsXULElement::DoneCreatingElement() -{ - return NS_OK; -} - //---------------------------------------------------------------------- // nsIScriptEventHandlerOwner interface @@ -1690,12 +1684,11 @@ nsXULElement::AddListenerFor(nsINodeInfo *aNodeInfo, return NS_OK; } -NS_IMETHODIMP -nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) +void +nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers) { if (aDocument != mDocument) { - nsCOMPtr rdfDoc; - if (mDocument) { // Notify XBL- & nsIAnonymousContentCreator-generated // anonymous content that the document is changing. @@ -1778,11 +1771,9 @@ nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileE child->SetDocument(aDocument, aDeep, aCompileEventHandlers); } } - - return NS_OK; } -NS_IMETHODIMP_(void) +void nsXULElement::SetParent(nsIContent* aParent) { nsIContent::SetParent(aParent); @@ -1793,26 +1784,26 @@ nsXULElement::SetParent(nsIContent* aParent) } } -NS_IMETHODIMP_(PRBool) +PRBool nsXULElement::IsNativeAnonymous() const { return PR_FALSE; } -NS_IMETHODIMP_(void) +void nsXULElement::SetNativeAnonymous(PRBool aAnonymous) { // XXX Need to make this actually do something - bug 165110 } -NS_IMETHODIMP_(PRBool) +PRBool nsXULElement::CanContainChildren() const { // XXX Hmm -- not sure if this is unilaterally true... return PR_TRUE; } -NS_IMETHODIMP_(PRUint32) +PRUint32 nsXULElement::GetChildCount() const { if (NS_FAILED(EnsureContentsGenerated())) { @@ -1822,7 +1813,7 @@ nsXULElement::GetChildCount() const return PeekChildCount(); } -NS_IMETHODIMP_(nsIContent *) +nsIContent * nsXULElement::GetChildAt(PRUint32 aIndex) const { if (NS_FAILED(EnsureContentsGenerated())) { @@ -1832,7 +1823,7 @@ nsXULElement::GetChildAt(PRUint32 aIndex) const return NS_STATIC_CAST(nsIContent*, mChildren.SafeElementAt(aIndex)); } -NS_IMETHODIMP_(PRInt32) +PRInt32 nsXULElement::IndexOf(nsIContent* aPossibleChild) const { nsresult rv; @@ -1843,7 +1834,7 @@ nsXULElement::IndexOf(nsIContent* aPossibleChild) const return mChildren.IndexOf(aPossibleChild); } -NS_IMETHODIMP +nsresult nsXULElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, PRBool aDeepSetDocument) { @@ -1890,7 +1881,7 @@ nsXULElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, return NS_OK; } -NS_IMETHODIMP +nsresult nsXULElement::ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, PRBool aDeepSetDocument) { @@ -1949,8 +1940,9 @@ nsXULElement::ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, return NS_OK; } -NS_IMETHODIMP -nsXULElement::AppendChildTo(nsIContent* aKid, PRBool aNotify, PRBool aDeepSetDocument) +nsresult +nsXULElement::AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument) { nsresult rv; if (NS_FAILED(rv = EnsureContentsGenerated())) @@ -1992,7 +1984,7 @@ nsXULElement::AppendChildTo(nsIContent* aKid, PRBool aNotify, PRBool aDeepSetDoc return NS_OK; } -NS_IMETHODIMP +nsresult nsXULElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify) { nsresult rv; @@ -2130,12 +2122,10 @@ nsXULElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify) return NS_OK; } -NS_IMETHODIMP +void nsXULElement::GetNameSpaceID(PRInt32* aNameSpaceID) const { *aNameSpaceID = NodeInfo()->NamespaceID(); - - return NS_OK; } nsIAtom * @@ -2144,8 +2134,8 @@ nsXULElement::Tag() const return NodeInfo()->NameAtom(); } -NS_IMETHODIMP_(already_AddRefed) -nsXULElement::GetExistingAttrNameFromQName(const nsAString& aStr) +already_AddRefed +nsXULElement::GetExistingAttrNameFromQName(const nsAString& aStr) const { NS_ConvertUCS2toUTF8 utf8String(aStr); @@ -2216,9 +2206,8 @@ nsXULElement::UnregisterAccessKey(const nsAString& aOldValue) // needed to maintain attribute namespace ID as well as ordering // NOTE: Changes to this function may need to be made in // |SetInlineStyleRule| as well. -NS_IMETHODIMP -nsXULElement::SetAttr(nsINodeInfo* aNodeInfo, - const nsAString& aValue, +nsresult +nsXULElement::SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, PRBool aNotify) { NS_ASSERTION(nsnull != aNodeInfo, "must have attribute nodeinfo"); @@ -2265,9 +2254,8 @@ nsXULElement::SetAttr(nsINodeInfo* aNodeInfo, // create a new style rule based off the value of this attribute, and we // need to let the document know about the StyleRule change. if (aNodeInfo->Equals(nsXULAtoms::style, kNameSpaceID_None)) { - nsCOMPtr baseURL; - GetBaseURL(getter_AddRefs(baseURL)); - Attributes()->UpdateStyleRule(baseURL, aValue); + nsCOMPtr baseURI = GetBaseURI(); + Attributes()->UpdateStyleRule(baseURI, aValue); } if (NodeInfo()->Equals(nsXULAtoms::window) && @@ -2353,11 +2341,9 @@ nsXULElement::FinishSetAttr(PRInt32 aAttrNS, nsIAtom* aAttrName, } } -NS_IMETHODIMP -nsXULElement::SetAttr(PRInt32 aNameSpaceID, - nsIAtom* aName, - const nsAString& aValue, - PRBool aNotify) +nsresult +nsXULElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify) { nsCOMPtr ni; NodeInfo()->NodeInfoManager()->GetNodeInfo(aName, nsnull, aNameSpaceID, @@ -2366,19 +2352,16 @@ nsXULElement::SetAttr(PRInt32 aNameSpaceID, return SetAttr(ni, aValue, aNotify); } -NS_IMETHODIMP -nsXULElement::GetAttr(PRInt32 aNameSpaceID, - nsIAtom* aName, +nsresult +nsXULElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsAString& aResult) const { nsCOMPtr prefix; return GetAttr(aNameSpaceID, aName, getter_AddRefs(prefix), aResult); } -NS_IMETHODIMP -nsXULElement::GetAttr(PRInt32 aNameSpaceID, - nsIAtom* aName, - nsIAtom** aPrefix, +nsresult +nsXULElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom** aPrefix, nsAString& aResult) const { NS_ASSERTION(nsnull != aName, "must have attribute name"); @@ -2427,7 +2410,7 @@ nsXULElement::GetAttr(PRInt32 aNameSpaceID, return NS_CONTENT_ATTR_NOT_THERE; } -NS_IMETHODIMP_(PRBool) +PRBool nsXULElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const { NS_ASSERTION(nsnull != aName, "must have attribute name"); @@ -2466,9 +2449,8 @@ nsXULElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const return PR_FALSE; } -NS_IMETHODIMP -nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, - nsIAtom* aName, PRBool aNotify) +nsresult +nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify) { NS_ASSERTION(nsnull != aName, "must have attribute name"); if (nsnull == aName) @@ -2537,9 +2519,8 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, // If CLASS is being unset, delete our class list. Attributes()->UpdateClassList(NS_LITERAL_STRING("")); } else if (aName == nsXULAtoms::style) { - nsCOMPtr baseURL; - GetBaseURL(getter_AddRefs(baseURL)); - Attributes()->UpdateStyleRule(baseURL, NS_LITERAL_STRING("")); + nsCOMPtr baseURI = GetBaseURI(); + Attributes()->UpdateStyleRule(baseURI, NS_LITERAL_STRING("")); // AttributeChanged() will handle the style reresolution } } @@ -2620,11 +2601,9 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, return NS_OK; } -NS_IMETHODIMP -nsXULElement::GetAttrNameAt(PRUint32 aIndex, - PRInt32* aNameSpaceID, - nsIAtom** aName, - nsIAtom** aPrefix) const +nsresult +nsXULElement::GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, + nsIAtom** aName, nsIAtom** aPrefix) const { #ifdef DEBUG_ATTRIBUTE_STATS int local = Attributes() ? Attributes()->Count() : 0; @@ -2691,7 +2670,7 @@ nsXULElement::GetAttrNameAt(PRUint32 aIndex, return NS_ERROR_ILLEGAL_VALUE; } -NS_IMETHODIMP_(PRUint32) +PRUint32 nsXULElement::GetAttrCount() const { PRBool haveLocalAttributes; @@ -2748,7 +2727,7 @@ rdf_Indent(FILE* out, PRInt32 aIndent) for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); } -NS_IMETHODIMP +void nsXULElement::List(FILE* out, PRInt32 aIndent) const { NS_PRECONDITION(mDocument != nsnull, "bad content"); @@ -2865,17 +2844,13 @@ nsXULElement::List(FILE* out, PRInt32 aIndent) const } } } - - return NS_OK; } #endif -NS_IMETHODIMP -nsXULElement::HandleDOMEvent(nsIPresContext* aPresContext, - nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, - PRUint32 aFlags, - nsEventStatus* aEventStatus) +nsresult +nsXULElement::HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, PRUint32 aFlags, + nsEventStatus* aEventStatus) { nsresult ret = NS_OK; @@ -3135,26 +3110,28 @@ nsXULElement::ContentID() const return 0; } -NS_IMETHODIMP +void nsXULElement::SetContentID(PRUint32 aID) { - return NS_OK; } -NS_IMETHODIMP -nsXULElement::GetBaseURL(nsIURI **aURI) const +already_AddRefed +nsXULElement::GetBaseURI() const { - // XXX TODO, should share the impl with nsGenericElement - if (mDocument) { - NS_IF_ADDREF(*aURI = mDocument->GetBaseURL()); - } else { - *aURI = nsnull; - } + // XXX TODO, should share the impl with nsGenericElement + nsIURI *base; - return NS_OK; + if (mDocument) { + base = mDocument->GetBaseURI(); + NS_IF_ADDREF(base); + } else { + base = nsnull; + } + + return base; } -NS_IMETHODIMP +nsresult nsXULElement::RangeAdd(nsIDOMRange* aRange) { // rdf content does not yet support DOM ranges @@ -3162,11 +3139,10 @@ nsXULElement::RangeAdd(nsIDOMRange* aRange) } -NS_IMETHODIMP +void nsXULElement::RangeRemove(nsIDOMRange* aRange) { // rdf content does not yet support DOM ranges - return NS_OK; } @@ -3534,13 +3510,13 @@ nsXULElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const return PR_FALSE; } -NS_IMETHODIMP_(nsIAtom *) +nsIAtom * nsXULElement::GetIDAttributeName() const { return nsXULAtoms::id; } -NS_IMETHODIMP_(nsIAtom *) +nsIAtom * nsXULElement::GetClassAttributeName() const { return nsXULAtoms::clazz; @@ -4075,182 +4051,190 @@ nsXULElement::GetParentTree(nsIDOMXULMultiSelectControlElement** aTreeElement) PRBool nsXULElement::IsAncestor(nsIDOMNode* aParentNode, nsIDOMNode* aChildNode) { - nsCOMPtr parent = aChildNode; - while (parent && (parent != aParentNode)) { - nsCOMPtr newParent; - parent->GetParentNode(getter_AddRefs(newParent)); - parent = newParent; - } + nsCOMPtr parent = aChildNode; + while (parent && (parent != aParentNode)) { + nsCOMPtr newParent; + parent->GetParentNode(getter_AddRefs(newParent)); + parent = newParent; + } - if (parent) - return PR_TRUE; - return PR_FALSE; + if (parent) + return PR_TRUE; + return PR_FALSE; } NS_IMETHODIMP nsXULElement::Focus() { - // What kind of crazy tries to focus an element without a doc? - if (!mDocument) - return NS_OK; + // What kind of crazy tries to focus an element without a doc? + if (!mDocument) + return NS_OK; + + // Obtain a presentation context and then call SetFocus. + if (mDocument->GetNumberOfShells() == 0) + return NS_OK; + + nsIPresShell *shell = mDocument->GetShellAt(0); + + // Retrieve the context + nsCOMPtr presContext; + shell->GetPresContext(getter_AddRefs(presContext)); + + // Set focus + SetFocus(presContext); - // Obtain a presentation context and then call SetFocus. - if (mDocument->GetNumberOfShells() == 0) return NS_OK; - - nsIPresShell *shell = mDocument->GetShellAt(0); - - // Retrieve the context - nsCOMPtr presContext; - shell->GetPresContext(getter_AddRefs(presContext)); - - // Set focus - return SetFocus(presContext); } NS_IMETHODIMP nsXULElement::Blur() { - // What kind of crazy tries to blur an element without a doc? - if (!mDocument) - return NS_OK; + // What kind of crazy tries to blur an element without a doc? + if (!mDocument) + return NS_OK; + + // Obtain a presentation context and then call SetFocus. + if (mDocument->GetNumberOfShells() == 0) + return NS_OK; + + nsIPresShell *shell = mDocument->GetShellAt(0); + + // Retrieve the context + nsCOMPtr presContext; + shell->GetPresContext(getter_AddRefs(presContext)); + + // Set focus + RemoveFocus(presContext); - // Obtain a presentation context and then call SetFocus. - if (mDocument->GetNumberOfShells() == 0) return NS_OK; - - nsIPresShell *shell = mDocument->GetShellAt(0); - - // Retrieve the context - nsCOMPtr presContext; - shell->GetPresContext(getter_AddRefs(presContext)); - - // Set focus - return RemoveFocus(presContext); } NS_IMETHODIMP nsXULElement::Click() { - nsAutoString disabled; - GetAttribute(NS_LITERAL_STRING("disabled"), disabled); - if (disabled == NS_LITERAL_STRING("true")) - return NS_OK; + nsAutoString disabled; + GetAttribute(NS_LITERAL_STRING("disabled"), disabled); + if (disabled == NS_LITERAL_STRING("true")) + return NS_OK; - nsCOMPtr doc = mDocument; // Strong just in case - if (doc) { - PRUint32 numShells = doc->GetNumberOfShells(); - nsCOMPtr context; + nsCOMPtr doc = mDocument; // Strong just in case + if (doc) { + PRUint32 numShells = doc->GetNumberOfShells(); + nsCOMPtr context; - for (PRUint32 i = 0; i < numShells; ++i) { - nsIPresShell *shell = doc->GetShellAt(i); - shell->GetPresContext(getter_AddRefs(context)); + for (PRUint32 i = 0; i < numShells; ++i) { + nsIPresShell *shell = doc->GetShellAt(i); + shell->GetPresContext(getter_AddRefs(context)); - nsMouseEvent eventDown; - eventDown.eventStructType = NS_MOUSE_EVENT; - eventDown.message = NS_MOUSE_LEFT_BUTTON_DOWN; - eventDown.isShift = PR_FALSE; - eventDown.isControl = PR_FALSE; - eventDown.isAlt = PR_FALSE; - eventDown.isMeta = PR_FALSE; - eventDown.clickCount = 0; - eventDown.widget = nsnull; + nsMouseEvent eventDown; + eventDown.eventStructType = NS_MOUSE_EVENT; + eventDown.message = NS_MOUSE_LEFT_BUTTON_DOWN; + eventDown.isShift = PR_FALSE; + eventDown.isControl = PR_FALSE; + eventDown.isAlt = PR_FALSE; + eventDown.isMeta = PR_FALSE; + eventDown.clickCount = 0; + eventDown.widget = nsnull; - nsMouseEvent eventUp(eventDown), // use copy constructor for bit-wise copy - eventClick(eventDown); - eventUp.message = NS_MOUSE_LEFT_BUTTON_UP; - eventClick.message = NS_XUL_CLICK; + // use copy constructor for bit-wise copy + nsMouseEvent eventUp(eventDown), eventClick(eventDown); + eventUp.message = NS_MOUSE_LEFT_BUTTON_UP; + eventClick.message = NS_XUL_CLICK; - // send mouse down - nsEventStatus status = nsEventStatus_eIgnore; - HandleDOMEvent(context, &eventDown, nsnull, NS_EVENT_FLAG_INIT, &status); + // send mouse down + nsEventStatus status = nsEventStatus_eIgnore; + HandleDOMEvent(context, &eventDown, nsnull, NS_EVENT_FLAG_INIT, + &status); - // send mouse up - status = nsEventStatus_eIgnore; // reset status - HandleDOMEvent(context, &eventUp, nsnull, NS_EVENT_FLAG_INIT, &status); + // send mouse up + status = nsEventStatus_eIgnore; // reset status + HandleDOMEvent(context, &eventUp, nsnull, NS_EVENT_FLAG_INIT, + &status); - // send mouse click - status = nsEventStatus_eIgnore; // reset status - HandleDOMEvent(context, &eventClick, nsnull, NS_EVENT_FLAG_INIT, &status); + // send mouse click + status = nsEventStatus_eIgnore; // reset status + HandleDOMEvent(context, &eventClick, nsnull, NS_EVENT_FLAG_INIT, + &status); + } } - } - // oncommand is fired when an element is clicked... - return DoCommand(); + // oncommand is fired when an element is clicked... + return DoCommand(); } NS_IMETHODIMP nsXULElement::DoCommand() { - nsCOMPtr doc = mDocument; // strong just in case - if (doc) { - PRUint32 numShells = doc->GetNumberOfShells(); - nsCOMPtr context; + nsCOMPtr doc = mDocument; // strong just in case + if (doc) { + PRUint32 numShells = doc->GetNumberOfShells(); + nsCOMPtr context; - for (PRUint32 i = 0; i < numShells; ++i) { - nsIPresShell *shell = doc->GetShellAt(i); - shell->GetPresContext(getter_AddRefs(context)); + for (PRUint32 i = 0; i < numShells; ++i) { + nsIPresShell *shell = doc->GetShellAt(i); + shell->GetPresContext(getter_AddRefs(context)); - nsEventStatus status = nsEventStatus_eIgnore; - nsMouseEvent event; - event.eventStructType = NS_EVENT; - event.message = NS_XUL_COMMAND; - HandleDOMEvent(context, &event, nsnull, NS_EVENT_FLAG_INIT, &status); + nsEventStatus status = nsEventStatus_eIgnore; + nsMouseEvent event; + event.eventStructType = NS_EVENT; + event.message = NS_XUL_COMMAND; + HandleDOMEvent(context, &event, nsnull, NS_EVENT_FLAG_INIT, + &status); + } } - } - return NS_OK; + return NS_OK; } // nsIFocusableContent interface and helpers -NS_IMETHODIMP +void nsXULElement::SetFocus(nsIPresContext* aPresContext) { - nsAutoString disabled; - GetAttribute(NS_LITERAL_STRING("disabled"), disabled); - if (disabled == NS_LITERAL_STRING("true")) - return NS_OK; + nsAutoString disabled; + GetAttribute(NS_LITERAL_STRING("disabled"), disabled); + if (disabled == NS_LITERAL_STRING("true")) + return; - nsIEventStateManager* esm; - if (NS_OK == aPresContext->GetEventStateManager(&esm)) { + nsCOMPtr esm; + aPresContext->GetEventStateManager(getter_AddRefs(esm)); - esm->SetContentState((nsIStyledContent*)this, NS_EVENT_STATE_FOCUS); - NS_RELEASE(esm); - } - - return NS_OK; + if (esm) { + esm->SetContentState((nsIStyledContent*)this, NS_EVENT_STATE_FOCUS); + } } -NS_IMETHODIMP +void nsXULElement::RemoveFocus(nsIPresContext* aPresContext) { - return NS_OK; } -NS_IMETHODIMP_(nsIContent*) +nsIContent * nsXULElement::GetBindingParent() const { - return mBindingParent; + return mBindingParent; } -NS_IMETHODIMP +nsresult nsXULElement::SetBindingParent(nsIContent* aParent) { - mBindingParent = aParent; // [Weak] no addref - if (mBindingParent) { - PRUint32 count = GetChildCount(); - for (PRUint32 i = 0; i < count; i++) { - GetChildAt(i)->SetBindingParent(aParent); + nsresult rv = NS_OK; + + mBindingParent = aParent; // [Weak] no addref + if (mBindingParent) { + PRUint32 count = GetChildCount(); + for (PRUint32 i = 0; i < count; i++) { + rv |= GetChildAt(i)->SetBindingParent(aParent); + } } - } - return NS_OK; + + return rv; } -NS_IMETHODIMP_(PRBool) -nsXULElement::IsContentOfType(PRUint32 aFlags) +PRBool +nsXULElement::IsContentOfType(PRUint32 aFlags) const { - return !(aFlags & ~(eELEMENT | eXUL)); + return !(aFlags & ~(eELEMENT | eXUL)); } nsresult diff --git a/mozilla/content/xul/content/src/nsXULElement.h b/mozilla/content/xul/content/src/nsXULElement.h index 1caae11b6fe..fd493ec6007 100644 --- a/mozilla/content/xul/content/src/nsXULElement.h +++ b/mozilla/content/xul/content/src/nsXULElement.h @@ -437,61 +437,68 @@ public: NS_DECL_ISUPPORTS // nsIContent (from nsIStyledContent) - NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers); - NS_IMETHOD_(void) SetParent(nsIContent* aParent); - NS_IMETHOD_(PRBool) IsNativeAnonymous() const; - NS_IMETHOD_(void) SetNativeAnonymous(PRBool aAnonymous); - NS_IMETHOD_(PRBool) CanContainChildren() const; - NS_IMETHOD_(PRUint32) GetChildCount() const; - NS_IMETHOD_(nsIContent *) GetChildAt(PRUint32 aIndex) const; - NS_IMETHOD_(PRInt32) IndexOf(nsIContent* aPossibleChild) const; - NS_IMETHOD InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, - PRBool aNotify, PRBool aDeepSetDocument); - NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify, - PRBool aDeepSetDocument); - NS_IMETHOD RemoveChildAt(PRUint32 aIndex, PRBool aNotify); - NS_IMETHOD GetNameSpaceID(PRInt32* aNameSpeceID) const; + virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); + virtual void SetParent(nsIContent* aParent); + virtual PRBool IsNativeAnonymous() const; + virtual void SetNativeAnonymous(PRBool aAnonymous); + virtual PRBool CanContainChildren() const; + virtual PRUint32 GetChildCount() const; + virtual nsIContent *GetChildAt(PRUint32 aIndex) const; + virtual PRInt32 IndexOf(nsIContent* aPossibleChild) const; + virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument); + virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify); + virtual void GetNameSpaceID(PRInt32* aNameSpeceID) const; virtual nsIAtom *Tag() const; - NS_IMETHOD_(nsINodeInfo *) GetNodeInfo() const; - NS_IMETHOD_(nsIAtom *) GetIDAttributeName() const; - NS_IMETHOD_(nsIAtom *) GetClassAttributeName() const; - NS_IMETHOD_(already_AddRefed) GetExistingAttrNameFromQName(const nsAString& aStr); - NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAString& aValue, PRBool aNotify); - NS_IMETHOD SetAttr(nsINodeInfo *aNodeInfo, const nsAString& aValue, PRBool aNotify); - NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsAString& aResult) const; - NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom** aPrefix, nsAString& aResult) const; - NS_IMETHOD_(PRBool) HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const; - NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify); - NS_IMETHOD GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, - nsIAtom** aName, nsIAtom** aPrefix) const; - NS_IMETHOD_(PRUint32) GetAttrCount() const; + virtual nsINodeInfo *GetNodeInfo() const; + virtual nsIAtom *GetIDAttributeName() const; + virtual nsIAtom *GetClassAttributeName() const; + virtual already_AddRefed GetExistingAttrNameFromQName(const nsAString& aStr) const; + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify); + virtual nsresult SetAttr(nsINodeInfo *aNodeInfo, const nsAString& aValue, + PRBool aNotify); + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsAString& aResult) const; + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsIAtom** aPrefix, nsAString& aResult) const; + virtual PRBool HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const; + virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + PRBool aNotify); + virtual nsresult GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, + nsIAtom** aName, nsIAtom** aPrefix) const; + virtual PRUint32 GetAttrCount() const; #ifdef DEBUG - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; - NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const { return NS_OK; } + virtual void List(FILE* out, PRInt32 aIndent) const; + virtual void DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const + { + } #endif - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, PRUint32 aFlags, nsEventStatus* aEventStatus); - NS_IMETHOD DoneCreatingElement(); virtual PRUint32 ContentID() const; - NS_IMETHOD SetContentID(PRUint32 aID); + virtual void SetContentID(PRUint32 aID); - NS_IMETHOD RangeAdd(nsIDOMRange* aRange); - NS_IMETHOD RangeRemove(nsIDOMRange* aRange); + virtual nsresult RangeAdd(nsIDOMRange* aRange); + virtual void RangeRemove(nsIDOMRange* aRange); virtual const nsVoidArray *GetRangeList() const; - NS_IMETHOD SetFocus(nsIPresContext* aPresContext); - NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext); + virtual void SetFocus(nsIPresContext* aPresContext); + virtual void RemoveFocus(nsIPresContext* aPresContext); - NS_IMETHOD_(nsIContent*) GetBindingParent() const; - NS_IMETHOD SetBindingParent(nsIContent* aParent); - NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags); - NS_IMETHOD GetBaseURL(nsIURI** aURI) const; - NS_IMETHOD GetListenerManager(nsIEventListenerManager** aResult); + virtual nsIContent *GetBindingParent() const; + virtual nsresult SetBindingParent(nsIContent* aParent); + virtual PRBool IsContentOfType(PRUint32 aFlags) const; + virtual already_AddRefed GetBaseURI() const; + virtual nsresult GetListenerManager(nsIEventListenerManager** aResult); // nsIXMLContent NS_IMETHOD MaybeTriggerAutoLink(nsIDocShell *aShell); diff --git a/mozilla/content/xul/document/src/nsXULDocument.cpp b/mozilla/content/xul/document/src/nsXULDocument.cpp index 7f01bfcc6c4..990563a3bca 100644 --- a/mozilla/content/xul/document/src/nsXULDocument.cpp +++ b/mozilla/content/xul/document/src/nsXULDocument.cpp @@ -422,8 +422,8 @@ nsXULDocument::~nsXULDocument() // 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); + if (mDocumentURI) + gXULCache->RemoveFromFastLoadSet(mDocumentURI); NS_RELEASE(gXULCache); } @@ -560,7 +560,7 @@ nsXULDocument::PrepareStyleSheets(nsIURI* anURL) return NS_OK; } -NS_IMETHODIMP +nsresult nsXULDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup, nsISupports* aContainer, @@ -571,10 +571,10 @@ nsXULDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, mDocumentTitle.Truncate(); - nsresult rv = aChannel->GetOriginalURI(getter_AddRefs(mDocumentURL)); + nsresult rv = aChannel->GetOriginalURI(getter_AddRefs(mDocumentURI)); if (NS_FAILED(rv)) return rv; - rv = PrepareStyleSheets(mDocumentURL); + rv = PrepareStyleSheets(mDocumentURI); if (NS_FAILED(rv)) return rv; RetrieveRelevantHeaders(aChannel); @@ -582,8 +582,8 @@ nsXULDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, // Look in the chrome cache: we've got this puppy loaded // already. nsCOMPtr proto; - if (IsChromeURI(mDocumentURL)) - gXULCache->GetPrototype(mDocumentURL, getter_AddRefs(proto)); + if (IsChromeURI(mDocumentURI)) + gXULCache->GetPrototype(mDocumentURI, getter_AddRefs(proto)); // Same comment as nsChromeProtocolHandler::NewChannel and // nsXULDocument::ResumeWalk @@ -632,7 +632,7 @@ nsXULDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, else { PRBool useXULCache; gXULCache->GetEnabled(&useXULCache); - PRBool fillXULCache = (useXULCache && IsChromeURI(mDocumentURL)); + PRBool fillXULCache = (useXULCache && IsChromeURI(mDocumentURI)); // It's just a vanilla document load. Create a parser to deal @@ -654,7 +654,7 @@ nsXULDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, *aDocListener = listener; - parser->Parse(mDocumentURL); + parser->Parse(mDocumentURI); // Put the current prototype, created under PrepareToLoad, into the // XUL prototype cache now. We can't do this under PrepareToLoad or @@ -679,11 +679,10 @@ nsXULDocument::GetPrincipal() return mMasterPrototype->GetDocumentPrincipal(); } -NS_IMETHODIMP +void nsXULDocument::SetPrincipal(nsIPrincipal *aPrincipal) { NS_NOTREACHED("SetPrincipal"); - return NS_ERROR_NOT_IMPLEMENTED; } void @@ -1227,7 +1226,7 @@ nsXULDocument::ContentRemoved(nsIContent* aContainer, aIndexInContainer); } -NS_IMETHODIMP +nsresult nsXULDocument::HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, @@ -1621,7 +1620,7 @@ nsXULDocument::Persist(nsIContent* aElement, PRInt32 aNameSpaceID, // there already). { nsCAutoString docurl; - rv = mDocumentURL->GetSpec(docurl); + rv = mDocumentURI->GetSpec(docurl); if (NS_FAILED(rv)) return rv; nsCOMPtr doc; @@ -2196,7 +2195,7 @@ nsXULDocument::StartLayout(void) if (!mRootContent) { #ifdef PR_LOGGING nsCAutoString urlspec; - mDocumentURL->GetSpec(urlspec); + mDocumentURI->GetSpec(urlspec); PR_LOG(gXULLog, PR_LOG_ALWAYS, ("xul: unable to layout '%s'; no root content", urlspec.get())); @@ -2375,7 +2374,7 @@ nsXULDocument::PrepareToLoad(nsISupports* aContainer, nsCOMPtr principal = do_QueryInterface(owner); - return PrepareToLoadPrototype(mDocumentURL, aCommand, principal, aResult); + return PrepareToLoadPrototype(mDocumentURI, aCommand, principal, aResult); } @@ -2445,7 +2444,7 @@ nsXULDocument::ApplyPersistentAttributes() if (NS_FAILED(rv)) return rv; nsCAutoString docurl; - mDocumentURL->GetSpec(docurl); + mDocumentURI->GetSpec(docurl); nsCOMPtr doc; gRDFService->GetResource(docurl, getter_AddRefs(doc)); @@ -3025,9 +3024,9 @@ nsXULDocument::ResumeWalk() // the master document and prototype document have the same origin. PRBool overlayIsChrome = IsChromeURI(uri); - if (!IsChromeURI(mDocumentURL) && !overlayIsChrome) { + if (!IsChromeURI(mDocumentURI) && !overlayIsChrome) { // Make sure we're allowed to load this overlay. - rv = secMan->CheckSameOriginURI(mDocumentURL, uri); + rv = secMan->CheckSameOriginURI(mDocumentURI, uri); if (NS_FAILED(rv)) { // move on to the next overlay continue; @@ -3146,7 +3145,7 @@ nsXULDocument::ResumeWalk() StartLayout(); - if (mIsWritingFastLoad && IsChromeURI(mDocumentURL)) + if (mIsWritingFastLoad && IsChromeURI(mDocumentURI)) gXULCache->WritePrototype(mMasterPrototype); for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) { @@ -3324,7 +3323,7 @@ nsXULDocument::OnStreamComplete(nsIStreamLoader* aLoader, PRBool useXULCache; gXULCache->GetEnabled(&useXULCache); - if (useXULCache && IsChromeURI(mDocumentURL)) { + if (useXULCache && IsChromeURI(mDocumentURI)) { gXULCache->PutScript(scriptProto->mSrcURI, NS_REINTERPRET_CAST(void*, scriptProto->mJSObject)); } @@ -3459,8 +3458,7 @@ nsXULDocument::CreateElement(nsXULPrototypeElement* aPrototype, nsIContent** aRe if (! result) return NS_ERROR_UNEXPECTED; - rv = result->SetDocument(this, PR_FALSE, PR_TRUE); - if (NS_FAILED(rv)) return rv; + result->SetDocument(this, PR_FALSE, PR_TRUE); rv = AddAttributes(aPrototype, result); if (NS_FAILED(rv)) return rv; @@ -3480,8 +3478,7 @@ nsXULDocument::CreateElement(nsXULPrototypeElement* aPrototype, nsIContent** aRe if (! result) return NS_ERROR_UNEXPECTED; - rv = result->SetDocument(this, PR_FALSE, PR_TRUE); - if (NS_FAILED(rv)) return rv; + result->SetDocument(this, PR_FALSE, PR_TRUE); rv = AddAttributes(aPrototype, result); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/content/xul/document/src/nsXULDocument.h b/mozilla/content/xul/document/src/nsXULDocument.h index d3461a90029..5243ff1551c 100644 --- a/mozilla/content/xul/document/src/nsXULDocument.h +++ b/mozilla/content/xul/document/src/nsXULDocument.h @@ -95,17 +95,17 @@ public: virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup); virtual void ResetToURI(nsIURI *aURI, nsILoadGroup* aLoadGroup); - NS_IMETHOD StartDocumentLoad(const char* aCommand, - nsIChannel *channel, - nsILoadGroup* aLoadGroup, - nsISupports* aContainer, - nsIStreamListener **aDocListener, - PRBool aReset = PR_TRUE, - nsIContentSink* aSink = nsnull); + virtual nsresult StartDocumentLoad(const char* aCommand, + nsIChannel *channel, + nsILoadGroup* aLoadGroup, + nsISupports* aContainer, + nsIStreamListener **aDocListener, + PRBool aReset = PR_TRUE, + nsIContentSink* aSink = nsnull); virtual nsIPrincipal* GetPrincipal(); - NS_IMETHOD SetPrincipal(nsIPrincipal *aPrincipal); + virtual void SetPrincipal(nsIPrincipal *aPrincipal); virtual void SetContentType(const nsAString& aContentType); @@ -130,11 +130,11 @@ public: virtual void AttributeChanged(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aModType); - NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, - nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, - PRUint32 aFlags, - nsEventStatus* aEventStatus); + virtual nsresult HandleDOMEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus* aEventStatus); // nsIXULDocument interface NS_IMETHOD AddElementForID(const nsAString& aID, nsIContent* aElement); diff --git a/mozilla/content/xul/templates/src/nsXULContentBuilder.cpp b/mozilla/content/xul/templates/src/nsXULContentBuilder.cpp index d62c6dac2f9..42317d04941 100644 --- a/mozilla/content/xul/templates/src/nsXULContentBuilder.cpp +++ b/mozilla/content/xul/templates/src/nsXULContentBuilder.cpp @@ -1079,8 +1079,7 @@ nsXULContentBuilder::RemoveMember(nsIContent* aContainerElement, // Set its document to null so that it'll get knocked out of // the XUL doc's resource-to-element map. - rv = child->SetDocument(nsnull, PR_TRUE, PR_TRUE); - if (NS_FAILED(rv)) return rv; + child->SetDocument(nsnull, PR_TRUE, PR_TRUE); // Remove from the content support map. mContentSupportMap.Remove(child); @@ -1515,9 +1514,7 @@ nsXULContentBuilder::CreateElement(PRInt32 aNameSpaceID, return NS_ERROR_UNEXPECTED; } - rv = result->SetDocument(doc, PR_FALSE, PR_TRUE); - NS_ASSERTION(NS_SUCCEEDED(rv), "unable to set element's document"); - if (NS_FAILED(rv)) return rv; + result->SetDocument(doc, PR_FALSE, PR_TRUE); *aResult = result; NS_ADDREF(*aResult); diff --git a/mozilla/content/xul/templates/src/nsXULContentUtils.cpp b/mozilla/content/xul/templates/src/nsXULContentUtils.cpp index 77bb9081531..93eb3ec9eff 100644 --- a/mozilla/content/xul/templates/src/nsXULContentUtils.cpp +++ b/mozilla/content/xul/templates/src/nsXULContentUtils.cpp @@ -231,7 +231,7 @@ nsXULContentUtils::GetElementRefResource(nsIContent* aElement, nsIRDFResource** // We'll use rdf_MakeAbsolute() to translate this to a URL. nsCOMPtr doc = aElement->GetDocument(); - nsIURI *url = doc->GetDocumentURL(); + nsIURI *url = doc->GetDocumentURI(); NS_ASSERTION(url != nsnull, "element has no document"); if (! url) return NS_ERROR_UNEXPECTED; @@ -333,7 +333,7 @@ nsXULContentUtils::MakeElementURI(nsIDocument* aDocument, const nsAString& aElem CopyUTF16toUTF8(aElementID, aURI); } else { - nsIURI *docURL = aDocument->GetBaseURL(); + nsIURI *docURL = aDocument->GetBaseURI(); // XXX Urgh. This is so broken; I'd really just like to use // NS_MakeAbsolueURI(). Unfortunatly, doing that breaks @@ -389,7 +389,7 @@ nsXULContentUtils::MakeElementID(nsIDocument* aDocument, const nsAString& aURI, // Convert a URI into an element ID that can be accessed from the // DOM APIs. nsCAutoString spec; - aDocument->GetBaseURL()->GetSpec(spec); + aDocument->GetBaseURI()->GetSpec(spec); // XXX FIX ME to not do a copy nsAutoString str(aURI); diff --git a/mozilla/content/xul/templates/src/nsXULTemplateBuilder.cpp b/mozilla/content/xul/templates/src/nsXULTemplateBuilder.cpp index 75bbc1e4104..e91c4540b99 100644 --- a/mozilla/content/xul/templates/src/nsXULTemplateBuilder.cpp +++ b/mozilla/content/xul/templates/src/nsXULTemplateBuilder.cpp @@ -740,7 +740,7 @@ nsXULTemplateBuilder::LoadDataSources() // // rdf:bookmarks rdf:history http://foo.bar.com/blah.cgi?baz=9 // - nsIURI *docurl = doc->GetDocumentURL(); + nsIURI *docurl = doc->GetDocumentURI(); nsAutoString datasources; mRoot->GetAttr(kNameSpaceID_None, nsXULAtoms::datasources, datasources); diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 7da93f743fe..bdd5e168274 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -4448,7 +4448,7 @@ nsDocShell::CreateAboutBlankContentViewer() Embed(viewer, "", 0); viewer->SetDOMDocument(domdoc); - SetCurrentURI(blankDoc->GetDocumentURL()); + SetCurrentURI(blankDoc->GetDocumentURI()); rv = NS_OK; } } @@ -7126,7 +7126,7 @@ nsDocShell::SetBaseUrlForWyciwyg(nsIContentViewer * aContentViewer) if (docViewer) { rv = docViewer->GetDocument(getter_AddRefs(document)); if (document) - rv = document->SetBaseURL(baseURI); + rv = document->SetBaseURI(baseURI); } } return rv; diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index c5945736b6e..4c5ed651507 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -630,7 +630,7 @@ nsWebShell::OnLinkClickSync(nsIContent *aContent, nsCOMPtr refererDoc(do_QueryInterface(refererOwnerDoc)); NS_ENSURE_TRUE(refererDoc, NS_ERROR_UNEXPECTED); - nsIURI *referer = refererDoc->GetDocumentURL(); + nsIURI *referer = refererDoc->GetDocumentURI(); // referer could be null here in some odd cases, but that's ok, // we'll just load the link w/o sending a referer in those cases. diff --git a/mozilla/dom/src/base/nsGlobalWindow.cpp b/mozilla/dom/src/base/nsGlobalWindow.cpp index 2357df28156..c8127f5bd49 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.cpp +++ b/mozilla/dom/src/base/nsGlobalWindow.cpp @@ -508,7 +508,7 @@ GlobalWindowImpl::SetNewDocument(nsIDOMDocument* aDocument, mIsScopeClear = PR_FALSE; if (doc) { - docURL = doc->GetDocumentURL(); + docURL = doc->GetDocumentURI(); } else { docURL = nsnull; } @@ -2913,7 +2913,7 @@ PRBool IsPopupBlocked(nsIDOMDocument* aDoc) nsCOMPtr pm(do_GetService(NS_POPUPWINDOWMANAGER_CONTRACTID)); if (pm && doc) { PRUint32 permission = nsIPopupWindowManager::ALLOW_POPUP; - pm->TestPermission(doc->GetDocumentURL(), &permission); + pm->TestPermission(doc->GetDocumentURI(), &permission); blocked = (permission == nsIPopupWindowManager::DENY_POPUP); } return blocked; @@ -3101,7 +3101,7 @@ GlobalWindowImpl::FireAbuseEvents(PRBool aBlocked, PRBool aWindow, contextWindow->GetDocument(getter_AddRefs(domdoc)); nsCOMPtr doc(do_QueryInterface(domdoc)); if (doc) - baseURL = doc->GetBaseURL(); + baseURL = doc->GetBaseURI(); // use the base URI to build what would have been the popup's URI nsCOMPtr ios(do_GetService(NS_IOSERVICE_CONTRACTID)); @@ -5438,7 +5438,7 @@ GlobalWindowImpl::SecurityCheckURL(const char *aURL) caller->GetDocument(getter_AddRefs(callerDOMdoc)); nsCOMPtr callerDoc(do_QueryInterface(callerDOMdoc)); if (callerDoc) - baseURI = callerDoc->GetDocumentURL(); + baseURI = callerDoc->GetDocumentURI(); } } diff --git a/mozilla/dom/src/base/nsJSEnvironment.cpp b/mozilla/dom/src/base/nsJSEnvironment.cpp index a3b965635f2..cd6e4a6d45a 100644 --- a/mozilla/dom/src/base/nsJSEnvironment.cpp +++ b/mozilla/dom/src/base/nsJSEnvironment.cpp @@ -255,6 +255,7 @@ NS_ScriptErrorReporter(JSContext *cx, } } +#ifdef DEBUG // Print it to stderr as well, for the benefit of those invoking // mozilla with -console. nsAutoString error; @@ -274,7 +275,6 @@ NS_ScriptErrorReporter(JSContext *cx, if (status != nsEventStatus_eIgnore && !JSREPORT_IS_WARNING(report->flags)) error.Append(NS_LITERAL_STRING("Error was suppressed by event handler\n")); -#ifdef DEBUG char *errorStr = ToNewCString(error); if (errorStr) { fprintf(stderr, "%s\n", errorStr); diff --git a/mozilla/dom/src/base/nsLocation.cpp b/mozilla/dom/src/base/nsLocation.cpp index 0686732a052..f7d85739745 100644 --- a/mozilla/dom/src/base/nsLocation.cpp +++ b/mozilla/dom/src/base/nsLocation.cpp @@ -900,7 +900,7 @@ LocationImpl::GetSourceDocument(JSContext* cx, nsIDocument** aDocument) // could break if any of the connections along the way change. // I wish there were a better way. - nsresult result = NS_ERROR_FAILURE; + nsresult rv = NS_ERROR_FAILURE; // We need to use the dynamically scoped global and assume that the // current JSContext is a DOM context with a nsIScriptGlobalObject so @@ -910,20 +910,19 @@ LocationImpl::GetSourceDocument(JSContext* cx, nsIDocument** aDocument) nsCOMPtr nativeGlob; nsJSUtils::GetDynamicScriptGlobal(cx, getter_AddRefs(nativeGlob)); - if (nativeGlob) { - nsCOMPtr window = do_QueryInterface(nativeGlob, &result); + nsCOMPtr window = do_QueryInterface(nativeGlob, &rv); - if (window) { - nsCOMPtr domDoc; - result = window->GetDocument(getter_AddRefs(domDoc)); - if (domDoc) { - return CallQueryInterface(domDoc, aDocument); - } + if (window) { + nsCOMPtr domDoc; + rv = window->GetDocument(getter_AddRefs(domDoc)); + if (domDoc) { + return CallQueryInterface(domDoc, aDocument); } } else { *aDocument = nsnull; } - return result; + + return rv; } nsresult @@ -932,11 +931,11 @@ LocationImpl::GetSourceBaseURL(JSContext* cx, nsIURI** sourceURL) nsCOMPtr doc; nsresult rv = GetSourceDocument(cx, getter_AddRefs(doc)); if (doc) { - NS_IF_ADDREF(*sourceURL = doc->GetBaseURL()); - return NS_OK; + NS_IF_ADDREF(*sourceURL = doc->GetBaseURI()); + } else { + *sourceURL = nsnull; } - *sourceURL = nsnull; return rv; } @@ -946,7 +945,7 @@ LocationImpl::GetSourceURL(JSContext* cx, nsIURI** sourceURL) nsCOMPtr doc; nsresult rv = GetSourceDocument(cx, getter_AddRefs(doc)); if (doc) { - NS_IF_ADDREF(*sourceURL = doc->GetDocumentURL()); + NS_IF_ADDREF(*sourceURL = doc->GetDocumentURI()); } else { *sourceURL = nsnull; } diff --git a/mozilla/editor/composer/src/nsComposerDocumentCommands.cpp b/mozilla/editor/composer/src/nsComposerDocumentCommands.cpp index 578c61cad2d..af90c4340b1 100644 --- a/mozilla/editor/composer/src/nsComposerDocumentCommands.cpp +++ b/mozilla/editor/composer/src/nsComposerDocumentCommands.cpp @@ -462,7 +462,7 @@ nsDocumentStateCommand::GetCommandStateParams(const char *aCommandName, nsCOMPtr doc = do_QueryInterface(domDoc); if (!doc) return NS_ERROR_FAILURE; - nsIURI *uri = doc->GetDocumentURL(); + nsIURI *uri = doc->GetDocumentURI(); if (!uri) return NS_ERROR_FAILURE; return aParams->SetISupportsValue(STATE_DATA, (nsISupports*)uri); diff --git a/mozilla/editor/composer/src/nsEditingSession.cpp b/mozilla/editor/composer/src/nsEditingSession.cpp index 14aa91ada92..d22734acc3a 100644 --- a/mozilla/editor/composer/src/nsEditingSession.cpp +++ b/mozilla/editor/composer/src/nsEditingSession.cpp @@ -759,7 +759,7 @@ nsEditingSession::OnLocationChange(nsIWebProgress *aWebProgress, nsCOMPtr doc = do_QueryInterface(domDoc); if (!doc) return NS_ERROR_FAILURE; - doc->SetDocumentURL(aURI); + doc->SetDocumentURI(aURI); // Notify the location-changed observer that // the document URL has changed diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp index 9099a492626..d7005ee5108 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp @@ -1262,7 +1262,7 @@ nsHTMLEditor::UpdateBaseURL() nsCOMPtr doc = do_QueryInterface(domDoc); if (!doc) return NS_ERROR_FAILURE; - return doc->SetBaseURL(doc->GetDocumentURL()); + return doc->SetBaseURI(doc->GetDocumentURI()); } return NS_OK; } diff --git a/mozilla/embedding/browser/activex/src/plugin/LegacyPlugin.cpp b/mozilla/embedding/browser/activex/src/plugin/LegacyPlugin.cpp index 013b19b7efd..72d67e93f3e 100644 --- a/mozilla/embedding/browser/activex/src/plugin/LegacyPlugin.cpp +++ b/mozilla/embedding/browser/activex/src/plugin/LegacyPlugin.cpp @@ -855,7 +855,7 @@ NewControl(const char *pluginType, nsCOMPtr doc(do_QueryInterface(DOMdocument)); if (doc) { - nsIURI *baseURI = doc->GetBaseURL(); + nsIURI *baseURI = doc->GetBaseURI(); if (baseURI) { nsCAutoString newURL; diff --git a/mozilla/embedding/browser/activex/src/plugin/XPCDocument.cpp b/mozilla/embedding/browser/activex/src/plugin/XPCDocument.cpp index d1bde20497f..d1bdbdd8760 100644 --- a/mozilla/embedding/browser/activex/src/plugin/XPCDocument.cpp +++ b/mozilla/embedding/browser/activex/src/plugin/XPCDocument.cpp @@ -1899,7 +1899,7 @@ END_COM_MAP() nsCOMPtr doc(do_QueryInterface(mDOMDocument)); if (doc) { - nsIURI *baseURI = doc->GetBaseURL(); + nsIURI *baseURI = doc->GetBaseURI(); nsCAutoString spec; if (baseURI && NS_SUCCEEDED(baseURI->GetSpec(spec))) diff --git a/mozilla/embedding/components/find/src/nsWebBrowserFind.cpp b/mozilla/embedding/components/find/src/nsWebBrowserFind.cpp index 35c577d66a6..158feb1091b 100644 --- a/mozilla/embedding/components/find/src/nsWebBrowserFind.cpp +++ b/mozilla/embedding/components/find/src/nsWebBrowserFind.cpp @@ -668,7 +668,7 @@ nsresult nsWebBrowserFind::SearchInFrame(nsIDOMWindow* aWindow, nsCOMPtr theDoc = do_QueryInterface(domDoc); if (!theDoc) return NS_ERROR_FAILURE; - nsIURI *docURI = theDoc->GetDocumentURL(); + nsIURI *docURI = theDoc->GetDocumentURI(); NS_ENSURE_TRUE(docURI, NS_ERROR_FAILURE); // Get the security manager and do the same-origin check diff --git a/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp b/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp index 24126971103..421a45e2afb 100644 --- a/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp +++ b/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp @@ -1401,13 +1401,13 @@ nsresult nsWebBrowserPersist::SaveDocumentInternal( // Persist the main document nsCOMPtr doc(do_QueryInterface(aDocument)); - mURI = doc->GetDocumentURL(); + mURI = doc->GetDocumentURI(); nsCOMPtr oldBaseURI = mCurrentBaseURI; nsCAutoString oldCharset(mCurrentCharset); // Store the base URI and the charset - mCurrentBaseURI = doc->GetBaseURL(); + mCurrentBaseURI = doc->GetBaseURI(); mCurrentCharset = doc->GetDocumentCharacterSet(); // Does the caller want to fixup the referenced URIs and save those too? diff --git a/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp b/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp index 769cfbd03bb..7266024c57b 100644 --- a/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp +++ b/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp @@ -773,7 +773,7 @@ nsWindowWatcher::OpenWindowJS(nsIDOMWindow *aParent, nsCOMPtr doc(do_QueryInterface(document)); if (doc) { // Set the referrer - loadInfo->SetReferrer(doc->GetDocumentURL()); + loadInfo->SetReferrer(doc->GetDocumentURI()); } } } @@ -1137,7 +1137,7 @@ nsWindowWatcher::URIfromURL(const char *aURL, nsCOMPtr doc; doc = do_QueryInterface(domDoc); if (doc) { - baseURI = doc->GetBaseURL(); + baseURI = doc->GetBaseURI(); } } } diff --git a/mozilla/extensions/cookie/nsImgManager.cpp b/mozilla/extensions/cookie/nsImgManager.cpp index 3215cb01bd3..956c0eda6ac 100644 --- a/mozilla/extensions/cookie/nsImgManager.cpp +++ b/mozilla/extensions/cookie/nsImgManager.cpp @@ -213,7 +213,7 @@ NS_IMETHODIMP nsImgManager::ShouldLoad(PRInt32 aContentType, return NS_OK; } - nsIURI *baseURI = doc->GetBaseURL(); + nsIURI *baseURI = doc->GetBaseURI(); if (!baseURI) return rv; diff --git a/mozilla/extensions/inspector/base/src/inDeepTreeWalker.cpp b/mozilla/extensions/inspector/base/src/inDeepTreeWalker.cpp index 7ce89681914..0dd12305620 100644 --- a/mozilla/extensions/inspector/base/src/inDeepTreeWalker.cpp +++ b/mozilla/extensions/inspector/base/src/inDeepTreeWalker.cpp @@ -336,8 +336,7 @@ inDeepTreeWalker::NextNode(nsIDOMNode **_retval) char* getURL(nsIDOMDocument* aDoc) { nsCOMPtr doc = do_QueryInterface(aDoc); - nsCOMPtr uri; - doc->GetDocumentURL(getter_AddRefs(uri)); + nsIURI *uri = doc->GetDocumentURI(); char* s; uri->GetSpec(&s); return s; diff --git a/mozilla/extensions/transformiix/source/base/txURIUtils.cpp b/mozilla/extensions/transformiix/source/base/txURIUtils.cpp index 81eeea6b9ab..555f94edd94 100644 --- a/mozilla/extensions/transformiix/source/base/txURIUtils.cpp +++ b/mozilla/extensions/transformiix/source/base/txURIUtils.cpp @@ -343,11 +343,11 @@ URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode) // Create a temporary channel to get nsIDocument->Reset to // do the right thing. We want the output document to get // much of the input document's characteristics. - serv->NewChannelFromURI(sourceDoc->GetDocumentURL(), + serv->NewChannelFromURI(sourceDoc->GetDocumentURI(), getter_AddRefs(channel)); } aNewDoc->Reset(channel, loadGroup); - aNewDoc->SetBaseURL(sourceDoc->GetBaseURL()); + aNewDoc->SetBaseURI(sourceDoc->GetBaseURI()); // Copy charset aNewDoc->SetDocumentCharacterSet(sourceDoc->GetDocumentCharacterSet()); diff --git a/mozilla/extensions/transformiix/source/xml/parser/txXMLParser.cpp b/mozilla/extensions/transformiix/source/xml/parser/txXMLParser.cpp index 2fa11ff46ca..da056196ff3 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/txXMLParser.cpp +++ b/mozilla/extensions/transformiix/source/xml/parser/txXMLParser.cpp @@ -83,7 +83,7 @@ txParseDocumentFromURI(const nsAString& aHref, const nsAString& aReferrer, nsIDocument* loaderDocument = txXPathNativeNode::getDocument(aLoader); nsCOMPtr loadGroup = loaderDocument->GetDocumentLoadGroup(); - nsIURI *loaderUri = loaderDocument->GetDocumentURL(); + nsIURI *loaderUri = loaderDocument->GetDocumentURI(); NS_ENSURE_TRUE(loaderUri, NS_ERROR_FAILURE); nsCOMPtr channel; diff --git a/mozilla/extensions/transformiix/source/xslt/txMozillaStylesheetCompiler.cpp b/mozilla/extensions/transformiix/source/xslt/txMozillaStylesheetCompiler.cpp index 15a6afb179c..93288a7cbd0 100644 --- a/mozilla/extensions/transformiix/source/xslt/txMozillaStylesheetCompiler.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txMozillaStylesheetCompiler.cpp @@ -754,7 +754,7 @@ TX_CompileStylesheet(nsIDOMNode* aNode, txStylesheet** aStylesheet) } nsCOMPtr doc = do_QueryInterface(document); - nsIURI *uri = doc->GetBaseURL(); + nsIURI *uri = doc->GetBaseURI(); nsCAutoString baseURI; uri->GetSpec(baseURI); diff --git a/mozilla/extensions/transformiix/source/xslt/txMozillaTextOutput.cpp b/mozilla/extensions/transformiix/source/xslt/txMozillaTextOutput.cpp index d02cf99753c..c6b71683473 100644 --- a/mozilla/extensions/transformiix/source/xslt/txMozillaTextOutput.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txMozillaTextOutput.cpp @@ -177,11 +177,11 @@ void txMozillaTextOutput::createResultDocument(nsIDOMDocument* aSourceDocument, // Create a temporary channel to get nsIDocument->Reset to // do the right thing. We want the output document to get // much of the input document's characteristics. - serv->NewChannelFromURI(sourceDoc->GetDocumentURL(), + serv->NewChannelFromURI(sourceDoc->GetDocumentURI(), getter_AddRefs(channel)); } doc->Reset(channel, loadGroup); - doc->SetBaseURL(sourceDoc->GetBaseURL()); + doc->SetBaseURI(sourceDoc->GetBaseURI()); // Set the charset if (!mOutputFormat.mEncoding.IsEmpty()) { @@ -239,11 +239,7 @@ void txMozillaTextOutput::createResultDocument(nsIDOMDocument* aSourceDocument, return; } - rv = rootContent->SetDocument(doc, PR_FALSE, PR_TRUE); - NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to set the document"); - if (NS_FAILED(rv)) { - return; - } + rootContent->SetDocument(doc, PR_FALSE, PR_TRUE); doc->SetRootContent(rootContent); diff --git a/mozilla/extensions/transformiix/source/xslt/txMozillaXMLOutput.cpp b/mozilla/extensions/transformiix/source/xslt/txMozillaXMLOutput.cpp index 4d9d19421e1..480d61e1b41 100644 --- a/mozilla/extensions/transformiix/source/xslt/txMozillaXMLOutput.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txMozillaXMLOutput.cpp @@ -214,7 +214,7 @@ void txMozillaXMLOutput::endDocument() sgo->GetDocShell(getter_AddRefs(docShell)); nsCOMPtr refURI = do_QueryInterface(docShell); if (refURI) { - refURI->SetupRefreshURIFromHeader(doc->GetBaseURL(), + refURI->SetupRefreshURIFromHeader(doc->GetBaseURI(), mRefreshString); } } @@ -639,7 +639,7 @@ void txMozillaXMLOutput::endHTMLElement(nsIDOMElement* aElement) rv = NS_NewURI(getter_AddRefs(baseURI), value, nsnull); if (NS_FAILED(rv)) return; - doc->SetBaseURL(baseURI); // The document checks if it is legal to set this base + doc->SetBaseURI(baseURI); // The document checks if it is legal to set this base } else if (mCreatingNewDocument && atom == txHTMLAtoms::meta) { // handle HTTP-EQUIV data diff --git a/mozilla/extensions/wallet/src/nsWalletService.cpp b/mozilla/extensions/wallet/src/nsWalletService.cpp index 81c4bc7e24e..a037b02ea09 100644 --- a/mozilla/extensions/wallet/src/nsWalletService.cpp +++ b/mozilla/extensions/wallet/src/nsWalletService.cpp @@ -387,7 +387,7 @@ nsWalletlibService::OnStateChange(nsIWebProgress* aWebProgress, return NS_OK; } - nsIURI *uri = doc->GetDocumentURL(); + nsIURI *uri = doc->GetDocumentURI(); if (!uri) { NS_ASSERTION(0, "no URI available"); return NS_OK; diff --git a/mozilla/extensions/wallet/src/wallet.cpp b/mozilla/extensions/wallet/src/wallet.cpp index 78c141decfb..c8ba97a5862 100644 --- a/mozilla/extensions/wallet/src/wallet.cpp +++ b/mozilla/extensions/wallet/src/wallet.cpp @@ -2697,7 +2697,7 @@ static void wallet_InitializeCurrentURL(nsIDocument * doc) { /* get url */ - nsIURI *url = doc->GetDocumentURL(); + nsIURI *url = doc->GetDocumentURI(); if (wallet_lastUrl == url) { return; } else { @@ -3425,7 +3425,7 @@ wallet_TraversalForPrefill if (NS_SUCCEEDED(result)) { nsCOMPtr doc = do_QueryInterface(domdoc); if (doc) { - nsIURI *url = doc->GetDocumentURL(); + nsIURI *url = doc->GetDocumentURI(); if (url) { wallet_GetHostFile(url, urlName); } @@ -3899,7 +3899,7 @@ WLLT_OnSubmit(nsIContent* currentForm, nsIDOMWindowInternal* window) { if (!doc) { return; } - nsIURI *docURL = doc->GetDocumentURL(); + nsIURI *docURL = doc->GetDocumentURI(); if (!docURL) { return; } diff --git a/mozilla/extensions/webservices/soap/src/nsHTTPSOAPTransport.cpp b/mozilla/extensions/webservices/soap/src/nsHTTPSOAPTransport.cpp index 21e9b5eced5..f93b4ecc5f7 100644 --- a/mozilla/extensions/webservices/soap/src/nsHTTPSOAPTransport.cpp +++ b/mozilla/extensions/webservices/soap/src/nsHTTPSOAPTransport.cpp @@ -112,7 +112,7 @@ nsresult ChangePrincipal(nsIDOMDocument* aDocument) nsCOMPtr targetDoc(do_QueryInterface(aDocument, &rv)); NS_ENSURE_SUCCESS(rv, rv); - rv = secMgr->CheckSameOrigin(nsnull, targetDoc->GetDocumentURL()); + rv = secMgr->CheckSameOrigin(nsnull, targetDoc->GetDocumentURI()); // change the principal only if the script security // manager has denied access. if (NS_FAILED(rv)) { diff --git a/mozilla/extensions/xmlextras/base/src/nsDOMParser.cpp b/mozilla/extensions/xmlextras/base/src/nsDOMParser.cpp index a6082e21174..98e28c2f9ad 100644 --- a/mozilla/extensions/xmlextras/base/src/nsDOMParser.cpp +++ b/mozilla/extensions/xmlextras/base/src/nsDOMParser.cpp @@ -482,7 +482,7 @@ nsDOMParser::ParseFromStream(nsIInputStream *stream, nsCOMPtr doc = do_QueryInterface(domdoc); if (doc) { - baseURI = doc->GetBaseURL(); + baseURI = doc->GetBaseURI(); } } } diff --git a/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp b/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp index 29055c74efe..374f7f0690a 100644 --- a/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp +++ b/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp @@ -628,7 +628,7 @@ nsXMLHttpRequest::GetBaseURI(nsIURI **aBaseURI) nsCOMPtr doc = GetDocumentFromScriptContext(mScriptContext); if (doc) { - NS_IF_ADDREF(*aBaseURI = doc->GetBaseURL()); + NS_IF_ADDREF(*aBaseURI = doc->GetBaseURI()); } return NS_OK; diff --git a/mozilla/extensions/xmlextras/tests/TestXMLExtras.cpp b/mozilla/extensions/xmlextras/tests/TestXMLExtras.cpp index b7f848f3a87..c3331ba809e 100644 --- a/mozilla/extensions/xmlextras/tests/TestXMLExtras.cpp +++ b/mozilla/extensions/xmlextras/tests/TestXMLExtras.cpp @@ -273,7 +273,7 @@ int main (int argc, char* argv[]) nsCOMPtr doc = do_QueryInterface(pDOMDocument); if (doc) { nsCAutoString spec; - doc->GetDocumentURL()->GetSpec(spec); + doc->GetDocumentURI()->GetSpec(spec); printf("Document URI=\"%s\"\n",spec.get()); } } diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 788f4eeb686..cf83a6a29f3 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -92,7 +92,6 @@ #include "nsISupportsArray.h" #include "nsIAnonymousContentCreator.h" #include "nsIFrameManager.h" -#include "nsIAttributeContent.h" #include "nsIPrefBranch.h" #include "nsIPrefService.h" #include "nsLegendFrame.h" @@ -1394,7 +1393,7 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex case eStyleContentType_Attr: { - nsIAtom* attrName = nsnull; + nsCOMPtr attrName; PRInt32 attrNameSpace = kNameSpaceID_None; PRInt32 barIndex = contentString.FindChar('|'); // CSS namespace delimiter if (-1 != barIndex) { @@ -1404,11 +1403,11 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex attrNameSpace = nameSpaceVal.ToInteger(&error, 10); contentString.Cut(0, barIndex + 1); if (contentString.Length()) { - attrName = NS_NewAtom(contentString); + attrName = do_GetAtom(contentString); } } else { - attrName = NS_NewAtom(contentString); + attrName = do_GetAtom(contentString); } // Creates the content and frame and return if successful @@ -1416,27 +1415,22 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex if (attrName) { nsIFrame* textFrame = nsnull; nsCOMPtr content; - rv = NS_NewAttributeContent(getter_AddRefs(content)); + rv = NS_NewAttributeContent(aContent, attrNameSpace, attrName, + getter_AddRefs(content)); - nsCOMPtr attrContent(do_QueryInterface(content)); - if (attrContent) { - attrContent->Init(aContent, attrNameSpace, attrName); + // Set aContent as the parent content and set the document + // object. This way event handling works + content->SetParent(aContent); + content->SetDocument(aDocument, PR_TRUE, PR_TRUE); - // Set aContent as the parent content and set the document - // object. This way event handling works - content->SetParent(aContent); - content->SetDocument(aDocument, PR_TRUE, PR_TRUE); + // Create a text frame and initialize it + NS_NewTextFrame(shell, &textFrame); + textFrame->Init(aPresContext, content, aParentFrame, aStyleContext, + nsnull); - // Create a text frame and initialize it - NS_NewTextFrame(shell, &textFrame); - textFrame->Init(aPresContext, content, aParentFrame, aStyleContext, - nsnull); - - // Return the text frame - *aFrame = textFrame; - rv = NS_OK; - } - NS_RELEASE(attrName); + // Return the text frame + *aFrame = textFrame; + rv = NS_OK; } return rv; } @@ -3392,7 +3386,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell, else #endif #ifdef MOZ_SVG - if (NS_SUCCEEDED(aDocElement->GetNameSpaceID(&nameSpaceID)) && + if (aDocElement->GetNameSpaceID(&nameSpaceID), (nameSpaceID == kNameSpaceID_SVG)) { rv = NS_NewSVGOuterSVGFrame(aPresShell, aDocElement, &contentFrame); if (NS_FAILED(rv)) { @@ -5056,22 +5050,29 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell content->SetParent(aParent); content->SetDocument(aDocument, PR_TRUE, PR_TRUE); + nsresult rv; #ifdef MOZ_XUL - // Only cut XUL scrollbars off if they're not in a XUL document. This allows - // scrollbars to be styled from XUL (although not from XML or HTML). - nsIAtom* tag = content->Tag(); - if (tag == nsXULAtoms::scrollbar || tag == nsXULAtoms::scrollcorner) { + // Only cut XUL scrollbars off if they're not in a XUL document. + // This allows scrollbars to be styled from XUL (although not + // from XML or HTML). + nsINodeInfo *ni = content->GetNodeInfo(); + + if (ni && (ni->Equals(nsXULAtoms::scrollbar, kNameSpaceID_XUL) || + ni->Equals(nsXULAtoms::scrollcorner, kNameSpaceID_XUL))) { nsCOMPtr xulDoc(do_QueryInterface(aDocument)); if (xulDoc) - content->SetBindingParent(aParent); - else content->SetBindingParent(content); + rv = content->SetBindingParent(aParent); + else + rv = content->SetBindingParent(content); } else #endif - content->SetBindingParent(content); - + rv = content->SetBindingParent(content); + + NS_ENSURE_SUCCESS(rv, rv); + nsIFrame * newFrame = nsnull; - nsresult rv = creator->CreateFrameFor(aPresContext, content, &newFrame); + rv = creator->CreateFrameFor(aPresContext, content, &newFrame); if (NS_SUCCEEDED(rv) && newFrame != nsnull) { aChildItems.AddChild(newFrame); } @@ -6784,8 +6785,9 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell, nsStyleContext* aStyleContext, nsFrameItems& aFrameItems) { - NS_ASSERTION(NS_SUCCEEDED(aContent->GetNameSpaceID(&aNameSpaceID)) && - (aNameSpaceID == kNameSpaceID_SVG), "SVG frame constructed in wrong namespace"); + NS_ASSERTION((aContent->GetNameSpaceID(&aNameSpaceID), + (aNameSpaceID == kNameSpaceID_SVG)), + "SVG frame constructed in wrong namespace"); nsresult rv = NS_OK; PRBool isAbsolutelyPositioned = PR_FALSE; diff --git a/mozilla/layout/base/nsImageLoader.cpp b/mozilla/layout/base/nsImageLoader.cpp index b14979c542a..0086a2b448d 100644 --- a/mozilla/layout/base/nsImageLoader.cpp +++ b/mozilla/layout/base/nsImageLoader.cpp @@ -117,7 +117,7 @@ nsImageLoader::Load(nsIURI *aURI) if (NS_FAILED(rv)) return rv; // XXX: initialDocumentURI is NULL! - return il->LoadImage(aURI, nsnull, doc->GetDocumentURL(), loadGroup, + return il->LoadImage(aURI, nsnull, doc->GetDocumentURI(), loadGroup, this, doc, nsIRequest::LOAD_BACKGROUND, nsnull, nsnull, getter_AddRefs(mRequest)); diff --git a/mozilla/layout/base/nsPresContext.cpp b/mozilla/layout/base/nsPresContext.cpp index 33d160f16ec..658a0909a57 100644 --- a/mozilla/layout/base/nsPresContext.cpp +++ b/mozilla/layout/base/nsPresContext.cpp @@ -681,7 +681,7 @@ nsPresContext::SetShell(nsIPresShell* aShell) if (NS_SUCCEEDED(mShell->GetDocument(getter_AddRefs(doc)))) { NS_ASSERTION(doc, "expect document here"); if (doc) { - mBaseURL = doc->GetBaseURL(); + mBaseURL = doc->GetBaseURI(); if (!mNeverAnimate && mBaseURL) { PRBool isChrome = PR_FALSE; @@ -697,7 +697,7 @@ nsPresContext::SetShell(nsIPresShell* aShell) if (mLangService) { doc->AddCharSetObserver(this); - UpdateCharSet(PromiseFlatCString(doc->GetDocumentCharacterSet()).get()); + UpdateCharSet(doc->GetDocumentCharacterSet().get()); } } } diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 8ee706d3ae0..a75c5ae32c7 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -2690,7 +2690,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) #ifdef NS_DEBUG if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { if (mDocument) { - nsIURI *uri = mDocument->GetDocumentURL(); + nsIURI *uri = mDocument->GetDocumentURI(); if (uri) { nsCAutoString url; uri->GetSpec(url); @@ -7291,7 +7291,7 @@ PresShell::DumpReflows() if (mReflowCountMgr) { nsCAutoString uriStr; if (mDocument) { - nsIURI *uri = mDocument->GetDocumentURL(); + nsIURI *uri = mDocument->GetDocumentURI(); if (uri) { uri->GetPath(uriStr); } diff --git a/mozilla/layout/base/src/nsImageLoader.cpp b/mozilla/layout/base/src/nsImageLoader.cpp index b14979c542a..0086a2b448d 100644 --- a/mozilla/layout/base/src/nsImageLoader.cpp +++ b/mozilla/layout/base/src/nsImageLoader.cpp @@ -117,7 +117,7 @@ nsImageLoader::Load(nsIURI *aURI) if (NS_FAILED(rv)) return rv; // XXX: initialDocumentURI is NULL! - return il->LoadImage(aURI, nsnull, doc->GetDocumentURL(), loadGroup, + return il->LoadImage(aURI, nsnull, doc->GetDocumentURI(), loadGroup, this, doc, nsIRequest::LOAD_BACKGROUND, nsnull, nsnull, getter_AddRefs(mRequest)); diff --git a/mozilla/layout/base/src/nsPresContext.cpp b/mozilla/layout/base/src/nsPresContext.cpp index 33d160f16ec..658a0909a57 100644 --- a/mozilla/layout/base/src/nsPresContext.cpp +++ b/mozilla/layout/base/src/nsPresContext.cpp @@ -681,7 +681,7 @@ nsPresContext::SetShell(nsIPresShell* aShell) if (NS_SUCCEEDED(mShell->GetDocument(getter_AddRefs(doc)))) { NS_ASSERTION(doc, "expect document here"); if (doc) { - mBaseURL = doc->GetBaseURL(); + mBaseURL = doc->GetBaseURI(); if (!mNeverAnimate && mBaseURL) { PRBool isChrome = PR_FALSE; @@ -697,7 +697,7 @@ nsPresContext::SetShell(nsIPresShell* aShell) if (mLangService) { doc->AddCharSetObserver(this); - UpdateCharSet(PromiseFlatCString(doc->GetDocumentCharacterSet()).get()); + UpdateCharSet(doc->GetDocumentCharacterSet().get()); } } } diff --git a/mozilla/layout/forms/nsIsIndexFrame.cpp b/mozilla/layout/forms/nsIsIndexFrame.cpp index 7a08b537dfe..7ba40e09fa4 100644 --- a/mozilla/layout/forms/nsIsIndexFrame.cpp +++ b/mozilla/layout/forms/nsIsIndexFrame.cpp @@ -417,44 +417,44 @@ nsIsIndexFrame::OnSubmit(nsIPresContext* aPresContext) if (!document) return NS_OK; // No doc means don't submit, see Bug 28988 // Resolve url to an absolute url - nsIURI *docURL = document->GetBaseURL(); + nsIURI *docURL = document->GetBaseURI(); if (!docURL) { NS_ERROR("No Base URL found in Form Submit!\n"); return NS_OK; // No base URL -> exit early, see Bug 30721 } - // If an action is not specified and we are inside - // a HTML document then reload the URL. This makes us - // compatible with 4.x browsers. - // If we are in some other type of document such as XML or - // XUL, do nothing. This prevents undesirable reloading of - // a document inside XUL. + // If an action is not specified and we are inside + // a HTML document then reload the URL. This makes us + // compatible with 4.x browsers. + // If we are in some other type of document such as XML or + // XUL, do nothing. This prevents undesirable reloading of + // a document inside XUL. - nsresult rv; - nsCOMPtr htmlDoc; - htmlDoc = do_QueryInterface(document, &rv); - if (NS_FAILED(rv)) { - // Must be a XML, XUL or other non-HTML document type - // so do nothing. - return NS_OK; - } + nsresult rv; + nsCOMPtr htmlDoc; + htmlDoc = do_QueryInterface(document, &rv); + if (NS_FAILED(rv)) { + // Must be a XML, XUL or other non-HTML document type + // so do nothing. + return NS_OK; + } - // Necko's MakeAbsoluteURI doesn't reuse the baseURL's rel path if it is - // passed a zero length rel path. - nsCAutoString relPath; - docURL->GetSpec(relPath); - if (!relPath.IsEmpty()) { - CopyUTF8toUTF16(relPath, href); + // Necko's MakeAbsoluteURI doesn't reuse the baseURL's rel path if it is + // passed a zero length rel path. + nsCAutoString relPath; + docURL->GetSpec(relPath); + if (!relPath.IsEmpty()) { + CopyUTF8toUTF16(relPath, href); - // If re-using the same URL, chop off old query string (bug 25330) - PRInt32 queryStart = href.FindChar('?'); - if (kNotFound != queryStart) { - href.Truncate(queryStart); - } - } else { - NS_ERROR("Rel path couldn't be formed in form submit!\n"); - return NS_ERROR_OUT_OF_MEMORY; + // If re-using the same URL, chop off old query string (bug 25330) + PRInt32 queryStart = href.FindChar('?'); + if (kNotFound != queryStart) { + href.Truncate(queryStart); } + } else { + NS_ERROR("Rel path couldn't be formed in form submit!\n"); + return NS_ERROR_OUT_OF_MEMORY; + } // Add the URI encoded form values to the URI // Get the scheme of the URI. diff --git a/mozilla/layout/generic/nsBulletFrame.cpp b/mozilla/layout/generic/nsBulletFrame.cpp index 83197b97592..1cfc971eb0f 100644 --- a/mozilla/layout/generic/nsBulletFrame.cpp +++ b/mozilla/layout/generic/nsBulletFrame.cpp @@ -139,7 +139,7 @@ nsBulletFrame::Init(nsIPresContext* aPresContext, if (mContent) { doc = mContent->GetDocument(); if (doc) { - documentURI = doc->GetDocumentURL(); + documentURI = doc->GetDocumentURI(); } } @@ -1632,7 +1632,7 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext, if (mContent) { doc = mContent->GetDocument(); if (doc) { - documentURI = doc->GetDocumentURL(); + documentURI = doc->GetDocumentURI(); } } diff --git a/mozilla/layout/generic/nsHTMLParts.h b/mozilla/layout/generic/nsHTMLParts.h index c585b630fc0..7854ff0259d 100644 --- a/mozilla/layout/generic/nsHTMLParts.h +++ b/mozilla/layout/generic/nsHTMLParts.h @@ -100,7 +100,8 @@ NS_NewBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, // Special Generated Content Frame nsresult -NS_NewAttributeContent(nsIContent ** aResult); +NS_NewAttributeContent(nsIContent* aContent, PRInt32 aNameSpaceID, + nsIAtom* aAttrName, nsIContent** aResult); // Create a basic area frame but the GetFrameForPoint is overridden to always // return the option frame diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index c9f33bef293..f7fc1382df3 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -1495,7 +1495,7 @@ nsImageFrame::TriggerLink(nsIPresContext* aPresContext, rv = ps->GetDocument(getter_AddRefs(doc)); if (NS_SUCCEEDED(rv)) { - nsIURI *baseURI = doc ? doc->GetDocumentURL() : nsnull; + nsIURI *baseURI = doc ? doc->GetDocumentURI() : nsnull; rv = securityManager->CheckLoadURI(baseURI, aURI, nsIScriptSecurityManager::STANDARD); @@ -1659,10 +1659,9 @@ nsImageFrame::HandleEvent(nsIPresContext* aPresContext, } if (!inside && isServerMap) { - nsCOMPtr baseURL; - mContent->GetBaseURL(getter_AddRefs(baseURL)); - - if (baseURL) { + nsCOMPtr baseURI = mContent->GetBaseURI(); + + if (baseURI) { // Server side image maps use the href in a containing anchor // element to provide the basis for the destination url. nsAutoString src; @@ -1676,7 +1675,7 @@ nsImageFrame::HandleEvent(nsIPresContext* aPresContext, } nsCOMPtr uri; nsresult rv = NS_NewURI(getter_AddRefs(uri), src, charset.get(), - baseURL); + baseURI); NS_ENSURE_SUCCESS(rv, rv); // XXX if the mouse is over/clicked in the border/padding area @@ -1701,7 +1700,7 @@ nsImageFrame::HandleEvent(nsIPresContext* aPresContext, } else { - NS_WARNING("baseURL is null for imageFrame - ignoring mouse event"); + NS_WARNING("baseURI is null for imageFrame - ignoring mouse event"); } } } @@ -1865,7 +1864,7 @@ nsImageFrame::SpecToURI(const nsAString& aSpec, nsIIOService *aIOService, { nsCOMPtr baseURI; if (mContent) { - mContent->GetBaseURL(getter_AddRefs(baseURI)); + baseURI = mContent->GetBaseURI(); } nsCAutoString charset; GetDocumentCharacterSet(charset); diff --git a/mozilla/layout/generic/nsImageMap.cpp b/mozilla/layout/generic/nsImageMap.cpp index 4ad1a56845c..934cf45120d 100644 --- a/mozilla/layout/generic/nsImageMap.cpp +++ b/mozilla/layout/generic/nsImageMap.cpp @@ -455,7 +455,7 @@ void RectArea::ParseCoords(const nsAString& aSpec) nsIDocument* doc = nodeInfo->GetDocument(); nsCAutoString urlSpec; if (doc) { - nsIURI *uri = doc->GetDocumentURL(); + nsIURI *uri = doc->GetDocumentURI(); if (uri) { uri->GetSpec(urlSpec); } @@ -949,9 +949,7 @@ nsImageMap::IsInside(nscoord aX, nscoord aY, if (area->IsInside(aX, aY)) { if (area->GetHasURL()) { // Set the image loader's source URL and base URL - nsCOMPtr baseUri; - - mMap->GetBaseURL(getter_AddRefs(baseUri)); + nsCOMPtr baseUri = mMap->GetBaseURI(); if (!baseUri) { return PR_FALSE; diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index 77ceb103c21..6589514cb0d 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -568,10 +568,8 @@ void nsObjectFrame::IsSupportedDocument(nsIContent* aContent, PRBool* aDoc) if((rv == NS_CONTENT_ATTR_HAS_VALUE) && (data.Length() > 0)) { nsCOMPtr uri; - nsCOMPtr baseURL; - - aContent->GetBaseURL(getter_AddRefs(baseURL)); - rv = NS_NewURI(getter_AddRefs(uri), data, nsnull, baseURL); + nsCOMPtr baseURI = aContent->GetBaseURI(); + rv = NS_NewURI(getter_AddRefs(uri), data, nsnull, baseURI); if (NS_FAILED(rv)) return; nsCOMPtr mimeService = do_GetService(NS_MIMESERVICE_CONTRACTID, &rv); @@ -1021,20 +1019,19 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext, nsCOMPtr container; nsCOMPtr pluginHost; - nsCOMPtr baseURL; nsCOMPtr fullURL; nsAutoString classid; - mContent->GetBaseURL(getter_AddRefs(baseURL)); + nsCOMPtr baseURI = mContent->GetBaseURI(); nsAutoString codeBase; if ((NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::codebase, codeBase)) && !codeBase.IsEmpty()) { nsCOMPtr codeBaseURL; - rv = MakeAbsoluteURL(getter_AddRefs(codeBaseURL), codeBase, baseURL); + rv = MakeAbsoluteURL(getter_AddRefs(codeBaseURL), codeBase, baseURI); if (NS_SUCCEEDED(rv)) { - baseURL = codeBaseURL; + baseURI = codeBaseURL; } } @@ -1046,9 +1043,9 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext, // if we find "java:" in the class id, we have a java applet if(bJavaObject) { - if (!baseURL) return NS_ERROR_FAILURE; + if (!baseURI) return NS_ERROR_FAILURE; - fullURL = baseURL; + fullURL = baseURI; // get the nsIPluginHost interface pluginHost = do_GetService(kCPluginManagerCID); @@ -1069,9 +1066,9 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext, // if we haven't matched to an internal type, check to see if // we have an ActiveX handler // if not, create the default plugin - if (!baseURL) return NS_ERROR_FAILURE; + if (!baseURI) return NS_ERROR_FAILURE; - fullURL = baseURL; + fullURL = baseURI; // get the nsIPluginHost interface pluginHost = do_GetService(kCPluginManagerCID); @@ -1098,7 +1095,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext, } else { // no clsid - the object is either an applet or a plugin nsAutoString src; - if (!baseURL) return NS_ERROR_FAILURE; + if (!baseURI) return NS_ERROR_FAILURE; // get the nsIPluginHost interface pluginHost = do_GetService(kCPluginManagerCID); @@ -1110,10 +1107,10 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext, if (tag == nsHTMLAtoms::applet) { if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::code, src)) { // Create an absolute URL - rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURL); + rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURI); } else - fullURL = baseURL; + fullURL = baseURI; rv = InstantiatePlugin(aPresContext, aMetrics, aReflowState, pluginHost, "application/x-java-vm", fullURL); @@ -1135,19 +1132,19 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext, if (NS_CONTENT_ATTR_HAS_VALUE == rv) { // Create an absolute URL - rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURL); + rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURI); if (NS_FAILED(rv)) { // Failed to create URI, maybe because we didn't // reconize the protocol handler ==> treat like // no 'src'/'data' was specified in the embed/object tag - fullURL = baseURL; + fullURL = baseURI; } } else { // we didn't find a src or data param, so just set the url // to the base - fullURL = baseURL; + fullURL = baseURI; } // now try to instantiate a plugin instance based on a mime type @@ -2315,7 +2312,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarge if (NS_SUCCEEDED(rv) && doc) { // XXX should this really be the document base URL? Or the // content's base URL? - baseURL = doc->GetBaseURL(); // gets the document's url + baseURL = doc->GetBaseURI(); // gets the document's url } else { mOwner->GetFullURL(*getter_AddRefs(baseURL)); // gets the plugin's content url } @@ -2607,7 +2604,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetDocumentBase(const char* *result) nsCOMPtr doc; mContext->PresShell()->GetDocument(getter_AddRefs(doc)); - rv = doc->GetBaseURL()->GetSpec(mDocumentBase); + rv = doc->GetBaseURI()->GetSpec(mDocumentBase); } if (rv == NS_OK) *result = ToNewCString(mDocumentBase); @@ -2864,10 +2861,9 @@ void nsObjectFrame::FixUpURLS(const nsString &name, nsString &value) if (name.EqualsIgnoreCase("PLUGINURL") || name.EqualsIgnoreCase("PLUGINSPAGE")) { - nsCOMPtr baseURL; - mContent->GetBaseURL(getter_AddRefs(baseURL)); + nsCOMPtr baseURI = mContent->GetBaseURI(); nsAutoString newURL; - NS_MakeAbsoluteURI(newURL, value, baseURL); + NS_MakeAbsoluteURI(newURL, value, baseURI); if (!newURL.IsEmpty()) value = newURL; } diff --git a/mozilla/layout/html/base/src/nsBulletFrame.cpp b/mozilla/layout/html/base/src/nsBulletFrame.cpp index 83197b97592..1cfc971eb0f 100644 --- a/mozilla/layout/html/base/src/nsBulletFrame.cpp +++ b/mozilla/layout/html/base/src/nsBulletFrame.cpp @@ -139,7 +139,7 @@ nsBulletFrame::Init(nsIPresContext* aPresContext, if (mContent) { doc = mContent->GetDocument(); if (doc) { - documentURI = doc->GetDocumentURL(); + documentURI = doc->GetDocumentURI(); } } @@ -1632,7 +1632,7 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext, if (mContent) { doc = mContent->GetDocument(); if (doc) { - documentURI = doc->GetDocumentURL(); + documentURI = doc->GetDocumentURI(); } } diff --git a/mozilla/layout/html/base/src/nsHTMLParts.h b/mozilla/layout/html/base/src/nsHTMLParts.h index c585b630fc0..7854ff0259d 100644 --- a/mozilla/layout/html/base/src/nsHTMLParts.h +++ b/mozilla/layout/html/base/src/nsHTMLParts.h @@ -100,7 +100,8 @@ NS_NewBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, // Special Generated Content Frame nsresult -NS_NewAttributeContent(nsIContent ** aResult); +NS_NewAttributeContent(nsIContent* aContent, PRInt32 aNameSpaceID, + nsIAtom* aAttrName, nsIContent** aResult); // Create a basic area frame but the GetFrameForPoint is overridden to always // return the option frame diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index c9f33bef293..f7fc1382df3 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -1495,7 +1495,7 @@ nsImageFrame::TriggerLink(nsIPresContext* aPresContext, rv = ps->GetDocument(getter_AddRefs(doc)); if (NS_SUCCEEDED(rv)) { - nsIURI *baseURI = doc ? doc->GetDocumentURL() : nsnull; + nsIURI *baseURI = doc ? doc->GetDocumentURI() : nsnull; rv = securityManager->CheckLoadURI(baseURI, aURI, nsIScriptSecurityManager::STANDARD); @@ -1659,10 +1659,9 @@ nsImageFrame::HandleEvent(nsIPresContext* aPresContext, } if (!inside && isServerMap) { - nsCOMPtr baseURL; - mContent->GetBaseURL(getter_AddRefs(baseURL)); - - if (baseURL) { + nsCOMPtr baseURI = mContent->GetBaseURI(); + + if (baseURI) { // Server side image maps use the href in a containing anchor // element to provide the basis for the destination url. nsAutoString src; @@ -1676,7 +1675,7 @@ nsImageFrame::HandleEvent(nsIPresContext* aPresContext, } nsCOMPtr uri; nsresult rv = NS_NewURI(getter_AddRefs(uri), src, charset.get(), - baseURL); + baseURI); NS_ENSURE_SUCCESS(rv, rv); // XXX if the mouse is over/clicked in the border/padding area @@ -1701,7 +1700,7 @@ nsImageFrame::HandleEvent(nsIPresContext* aPresContext, } else { - NS_WARNING("baseURL is null for imageFrame - ignoring mouse event"); + NS_WARNING("baseURI is null for imageFrame - ignoring mouse event"); } } } @@ -1865,7 +1864,7 @@ nsImageFrame::SpecToURI(const nsAString& aSpec, nsIIOService *aIOService, { nsCOMPtr baseURI; if (mContent) { - mContent->GetBaseURL(getter_AddRefs(baseURI)); + baseURI = mContent->GetBaseURI(); } nsCAutoString charset; GetDocumentCharacterSet(charset); diff --git a/mozilla/layout/html/base/src/nsImageMap.cpp b/mozilla/layout/html/base/src/nsImageMap.cpp index 4ad1a56845c..934cf45120d 100644 --- a/mozilla/layout/html/base/src/nsImageMap.cpp +++ b/mozilla/layout/html/base/src/nsImageMap.cpp @@ -455,7 +455,7 @@ void RectArea::ParseCoords(const nsAString& aSpec) nsIDocument* doc = nodeInfo->GetDocument(); nsCAutoString urlSpec; if (doc) { - nsIURI *uri = doc->GetDocumentURL(); + nsIURI *uri = doc->GetDocumentURI(); if (uri) { uri->GetSpec(urlSpec); } @@ -949,9 +949,7 @@ nsImageMap::IsInside(nscoord aX, nscoord aY, if (area->IsInside(aX, aY)) { if (area->GetHasURL()) { // Set the image loader's source URL and base URL - nsCOMPtr baseUri; - - mMap->GetBaseURL(getter_AddRefs(baseUri)); + nsCOMPtr baseUri = mMap->GetBaseURI(); if (!baseUri) { return PR_FALSE; diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index 77ceb103c21..6589514cb0d 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -568,10 +568,8 @@ void nsObjectFrame::IsSupportedDocument(nsIContent* aContent, PRBool* aDoc) if((rv == NS_CONTENT_ATTR_HAS_VALUE) && (data.Length() > 0)) { nsCOMPtr uri; - nsCOMPtr baseURL; - - aContent->GetBaseURL(getter_AddRefs(baseURL)); - rv = NS_NewURI(getter_AddRefs(uri), data, nsnull, baseURL); + nsCOMPtr baseURI = aContent->GetBaseURI(); + rv = NS_NewURI(getter_AddRefs(uri), data, nsnull, baseURI); if (NS_FAILED(rv)) return; nsCOMPtr mimeService = do_GetService(NS_MIMESERVICE_CONTRACTID, &rv); @@ -1021,20 +1019,19 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext, nsCOMPtr container; nsCOMPtr pluginHost; - nsCOMPtr baseURL; nsCOMPtr fullURL; nsAutoString classid; - mContent->GetBaseURL(getter_AddRefs(baseURL)); + nsCOMPtr baseURI = mContent->GetBaseURI(); nsAutoString codeBase; if ((NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::codebase, codeBase)) && !codeBase.IsEmpty()) { nsCOMPtr codeBaseURL; - rv = MakeAbsoluteURL(getter_AddRefs(codeBaseURL), codeBase, baseURL); + rv = MakeAbsoluteURL(getter_AddRefs(codeBaseURL), codeBase, baseURI); if (NS_SUCCEEDED(rv)) { - baseURL = codeBaseURL; + baseURI = codeBaseURL; } } @@ -1046,9 +1043,9 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext, // if we find "java:" in the class id, we have a java applet if(bJavaObject) { - if (!baseURL) return NS_ERROR_FAILURE; + if (!baseURI) return NS_ERROR_FAILURE; - fullURL = baseURL; + fullURL = baseURI; // get the nsIPluginHost interface pluginHost = do_GetService(kCPluginManagerCID); @@ -1069,9 +1066,9 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext, // if we haven't matched to an internal type, check to see if // we have an ActiveX handler // if not, create the default plugin - if (!baseURL) return NS_ERROR_FAILURE; + if (!baseURI) return NS_ERROR_FAILURE; - fullURL = baseURL; + fullURL = baseURI; // get the nsIPluginHost interface pluginHost = do_GetService(kCPluginManagerCID); @@ -1098,7 +1095,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext, } else { // no clsid - the object is either an applet or a plugin nsAutoString src; - if (!baseURL) return NS_ERROR_FAILURE; + if (!baseURI) return NS_ERROR_FAILURE; // get the nsIPluginHost interface pluginHost = do_GetService(kCPluginManagerCID); @@ -1110,10 +1107,10 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext, if (tag == nsHTMLAtoms::applet) { if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::code, src)) { // Create an absolute URL - rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURL); + rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURI); } else - fullURL = baseURL; + fullURL = baseURI; rv = InstantiatePlugin(aPresContext, aMetrics, aReflowState, pluginHost, "application/x-java-vm", fullURL); @@ -1135,19 +1132,19 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext, if (NS_CONTENT_ATTR_HAS_VALUE == rv) { // Create an absolute URL - rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURL); + rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURI); if (NS_FAILED(rv)) { // Failed to create URI, maybe because we didn't // reconize the protocol handler ==> treat like // no 'src'/'data' was specified in the embed/object tag - fullURL = baseURL; + fullURL = baseURI; } } else { // we didn't find a src or data param, so just set the url // to the base - fullURL = baseURL; + fullURL = baseURI; } // now try to instantiate a plugin instance based on a mime type @@ -2315,7 +2312,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarge if (NS_SUCCEEDED(rv) && doc) { // XXX should this really be the document base URL? Or the // content's base URL? - baseURL = doc->GetBaseURL(); // gets the document's url + baseURL = doc->GetBaseURI(); // gets the document's url } else { mOwner->GetFullURL(*getter_AddRefs(baseURL)); // gets the plugin's content url } @@ -2607,7 +2604,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetDocumentBase(const char* *result) nsCOMPtr doc; mContext->PresShell()->GetDocument(getter_AddRefs(doc)); - rv = doc->GetBaseURL()->GetSpec(mDocumentBase); + rv = doc->GetBaseURI()->GetSpec(mDocumentBase); } if (rv == NS_OK) *result = ToNewCString(mDocumentBase); @@ -2864,10 +2861,9 @@ void nsObjectFrame::FixUpURLS(const nsString &name, nsString &value) if (name.EqualsIgnoreCase("PLUGINURL") || name.EqualsIgnoreCase("PLUGINSPAGE")) { - nsCOMPtr baseURL; - mContent->GetBaseURL(getter_AddRefs(baseURL)); + nsCOMPtr baseURI = mContent->GetBaseURI(); nsAutoString newURL; - NS_MakeAbsoluteURI(newURL, value, baseURL); + NS_MakeAbsoluteURI(newURL, value, baseURI); if (!newURL.IsEmpty()) value = newURL; } diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index 8ee706d3ae0..a75c5ae32c7 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -2690,7 +2690,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) #ifdef NS_DEBUG if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { if (mDocument) { - nsIURI *uri = mDocument->GetDocumentURL(); + nsIURI *uri = mDocument->GetDocumentURI(); if (uri) { nsCAutoString url; uri->GetSpec(url); @@ -7291,7 +7291,7 @@ PresShell::DumpReflows() if (mReflowCountMgr) { nsCAutoString uriStr; if (mDocument) { - nsIURI *uri = mDocument->GetDocumentURL(); + nsIURI *uri = mDocument->GetDocumentURI(); if (uri) { uri->GetPath(uriStr); } diff --git a/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp b/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp index 7a08b537dfe..7ba40e09fa4 100644 --- a/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp +++ b/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp @@ -417,44 +417,44 @@ nsIsIndexFrame::OnSubmit(nsIPresContext* aPresContext) if (!document) return NS_OK; // No doc means don't submit, see Bug 28988 // Resolve url to an absolute url - nsIURI *docURL = document->GetBaseURL(); + nsIURI *docURL = document->GetBaseURI(); if (!docURL) { NS_ERROR("No Base URL found in Form Submit!\n"); return NS_OK; // No base URL -> exit early, see Bug 30721 } - // If an action is not specified and we are inside - // a HTML document then reload the URL. This makes us - // compatible with 4.x browsers. - // If we are in some other type of document such as XML or - // XUL, do nothing. This prevents undesirable reloading of - // a document inside XUL. + // If an action is not specified and we are inside + // a HTML document then reload the URL. This makes us + // compatible with 4.x browsers. + // If we are in some other type of document such as XML or + // XUL, do nothing. This prevents undesirable reloading of + // a document inside XUL. - nsresult rv; - nsCOMPtr htmlDoc; - htmlDoc = do_QueryInterface(document, &rv); - if (NS_FAILED(rv)) { - // Must be a XML, XUL or other non-HTML document type - // so do nothing. - return NS_OK; - } + nsresult rv; + nsCOMPtr htmlDoc; + htmlDoc = do_QueryInterface(document, &rv); + if (NS_FAILED(rv)) { + // Must be a XML, XUL or other non-HTML document type + // so do nothing. + return NS_OK; + } - // Necko's MakeAbsoluteURI doesn't reuse the baseURL's rel path if it is - // passed a zero length rel path. - nsCAutoString relPath; - docURL->GetSpec(relPath); - if (!relPath.IsEmpty()) { - CopyUTF8toUTF16(relPath, href); + // Necko's MakeAbsoluteURI doesn't reuse the baseURL's rel path if it is + // passed a zero length rel path. + nsCAutoString relPath; + docURL->GetSpec(relPath); + if (!relPath.IsEmpty()) { + CopyUTF8toUTF16(relPath, href); - // If re-using the same URL, chop off old query string (bug 25330) - PRInt32 queryStart = href.FindChar('?'); - if (kNotFound != queryStart) { - href.Truncate(queryStart); - } - } else { - NS_ERROR("Rel path couldn't be formed in form submit!\n"); - return NS_ERROR_OUT_OF_MEMORY; + // If re-using the same URL, chop off old query string (bug 25330) + PRInt32 queryStart = href.FindChar('?'); + if (kNotFound != queryStart) { + href.Truncate(queryStart); } + } else { + NS_ERROR("Rel path couldn't be formed in form submit!\n"); + return NS_ERROR_OUT_OF_MEMORY; + } // Add the URI encoded form values to the URI // Get the scheme of the URI. diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 788f4eeb686..cf83a6a29f3 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -92,7 +92,6 @@ #include "nsISupportsArray.h" #include "nsIAnonymousContentCreator.h" #include "nsIFrameManager.h" -#include "nsIAttributeContent.h" #include "nsIPrefBranch.h" #include "nsIPrefService.h" #include "nsLegendFrame.h" @@ -1394,7 +1393,7 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex case eStyleContentType_Attr: { - nsIAtom* attrName = nsnull; + nsCOMPtr attrName; PRInt32 attrNameSpace = kNameSpaceID_None; PRInt32 barIndex = contentString.FindChar('|'); // CSS namespace delimiter if (-1 != barIndex) { @@ -1404,11 +1403,11 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex attrNameSpace = nameSpaceVal.ToInteger(&error, 10); contentString.Cut(0, barIndex + 1); if (contentString.Length()) { - attrName = NS_NewAtom(contentString); + attrName = do_GetAtom(contentString); } } else { - attrName = NS_NewAtom(contentString); + attrName = do_GetAtom(contentString); } // Creates the content and frame and return if successful @@ -1416,27 +1415,22 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex if (attrName) { nsIFrame* textFrame = nsnull; nsCOMPtr content; - rv = NS_NewAttributeContent(getter_AddRefs(content)); + rv = NS_NewAttributeContent(aContent, attrNameSpace, attrName, + getter_AddRefs(content)); - nsCOMPtr attrContent(do_QueryInterface(content)); - if (attrContent) { - attrContent->Init(aContent, attrNameSpace, attrName); + // Set aContent as the parent content and set the document + // object. This way event handling works + content->SetParent(aContent); + content->SetDocument(aDocument, PR_TRUE, PR_TRUE); - // Set aContent as the parent content and set the document - // object. This way event handling works - content->SetParent(aContent); - content->SetDocument(aDocument, PR_TRUE, PR_TRUE); + // Create a text frame and initialize it + NS_NewTextFrame(shell, &textFrame); + textFrame->Init(aPresContext, content, aParentFrame, aStyleContext, + nsnull); - // Create a text frame and initialize it - NS_NewTextFrame(shell, &textFrame); - textFrame->Init(aPresContext, content, aParentFrame, aStyleContext, - nsnull); - - // Return the text frame - *aFrame = textFrame; - rv = NS_OK; - } - NS_RELEASE(attrName); + // Return the text frame + *aFrame = textFrame; + rv = NS_OK; } return rv; } @@ -3392,7 +3386,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell, else #endif #ifdef MOZ_SVG - if (NS_SUCCEEDED(aDocElement->GetNameSpaceID(&nameSpaceID)) && + if (aDocElement->GetNameSpaceID(&nameSpaceID), (nameSpaceID == kNameSpaceID_SVG)) { rv = NS_NewSVGOuterSVGFrame(aPresShell, aDocElement, &contentFrame); if (NS_FAILED(rv)) { @@ -5056,22 +5050,29 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell content->SetParent(aParent); content->SetDocument(aDocument, PR_TRUE, PR_TRUE); + nsresult rv; #ifdef MOZ_XUL - // Only cut XUL scrollbars off if they're not in a XUL document. This allows - // scrollbars to be styled from XUL (although not from XML or HTML). - nsIAtom* tag = content->Tag(); - if (tag == nsXULAtoms::scrollbar || tag == nsXULAtoms::scrollcorner) { + // Only cut XUL scrollbars off if they're not in a XUL document. + // This allows scrollbars to be styled from XUL (although not + // from XML or HTML). + nsINodeInfo *ni = content->GetNodeInfo(); + + if (ni && (ni->Equals(nsXULAtoms::scrollbar, kNameSpaceID_XUL) || + ni->Equals(nsXULAtoms::scrollcorner, kNameSpaceID_XUL))) { nsCOMPtr xulDoc(do_QueryInterface(aDocument)); if (xulDoc) - content->SetBindingParent(aParent); - else content->SetBindingParent(content); + rv = content->SetBindingParent(aParent); + else + rv = content->SetBindingParent(content); } else #endif - content->SetBindingParent(content); - + rv = content->SetBindingParent(content); + + NS_ENSURE_SUCCESS(rv, rv); + nsIFrame * newFrame = nsnull; - nsresult rv = creator->CreateFrameFor(aPresContext, content, &newFrame); + rv = creator->CreateFrameFor(aPresContext, content, &newFrame); if (NS_SUCCEEDED(rv) && newFrame != nsnull) { aChildItems.AddChild(newFrame); } @@ -6784,8 +6785,9 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell, nsStyleContext* aStyleContext, nsFrameItems& aFrameItems) { - NS_ASSERTION(NS_SUCCEEDED(aContent->GetNameSpaceID(&aNameSpaceID)) && - (aNameSpaceID == kNameSpaceID_SVG), "SVG frame constructed in wrong namespace"); + NS_ASSERTION((aContent->GetNameSpaceID(&aNameSpaceID), + (aNameSpaceID == kNameSpaceID_SVG)), + "SVG frame constructed in wrong namespace"); nsresult rv = NS_OK; PRBool isAbsolutelyPositioned = PR_FALSE; diff --git a/mozilla/layout/printing/nsPrintEngine.cpp b/mozilla/layout/printing/nsPrintEngine.cpp index 894076d92fa..1290e43583c 100644 --- a/mozilla/layout/printing/nsPrintEngine.cpp +++ b/mozilla/layout/printing/nsPrintEngine.cpp @@ -1852,7 +1852,7 @@ nsPrintEngine::GetWebShellTitleAndURL(nsIWebShell* aWebShell, *aTitle = ToNewUnicode(docTitle); } - nsIURI* url = aDoc->GetDocumentURL(); + nsIURI* url = aDoc->GetDocumentURI(); if (!url) return; nsCAutoString urlCStr; diff --git a/mozilla/layout/style/nsCSSLoader.cpp b/mozilla/layout/style/nsCSSLoader.cpp index 54572369b30..3cf0fdca31f 100644 --- a/mozilla/layout/style/nsCSSLoader.cpp +++ b/mozilla/layout/style/nsCSSLoader.cpp @@ -1040,7 +1040,7 @@ CSSLoaderImpl::CreateSheet(nsIURI* aURI, // Inline style. Use the document's base URL so that @import in // the inline sheet picks up the right base. NS_ASSERTION(aLinkingContent, "Inline stylesheet without linking content?"); - aLinkingContent->GetBaseURL(getter_AddRefs(sheetURI)); + sheetURI = aLinkingContent->GetBaseURI(); } rv = NS_NewCSSStyleSheet(aSheet, sheetURI); @@ -1352,7 +1352,7 @@ CSSLoaderImpl::LoadSheet(SheetLoadData* aLoadData, StyleSheetState aSheetState) NS_LITERAL_CSTRING("text/css,*/*;q=0.1"), PR_FALSE); if (mDocument) { - nsIURI *documentURI = mDocument->GetDocumentURL(); + nsIURI *documentURI = mDocument->GetDocumentURI(); NS_ASSERTION(documentURI, "Null document uri is bad!"); if (documentURI) { httpChannel->SetReferrer(documentURI); @@ -1638,7 +1638,7 @@ CSSLoaderImpl::LoadStyleLink(nsIContent* aElement, NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_INITIALIZED); // Check whether we should even load - nsIURI *docURI = mDocument->GetDocumentURL(); + nsIURI *docURI = mDocument->GetDocumentURI(); if (!docURI) return NS_ERROR_FAILURE; nsresult rv = CheckLoadAllowed(docURI, aURL, aElement); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/layout/style/nsDOMCSSAttrDeclaration.cpp b/mozilla/layout/style/nsDOMCSSAttrDeclaration.cpp index 525c908f898..8a9a53b1973 100644 --- a/mozilla/layout/style/nsDOMCSSAttrDeclaration.cpp +++ b/mozilla/layout/style/nsDOMCSSAttrDeclaration.cpp @@ -153,8 +153,8 @@ nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(nsIURI** aBaseURI, // XXXbz GetOwnerDocument nsIDocument* doc = nodeInfo->GetDocument(); - mContent->GetBaseURL(aBaseURI); - + nsCOMPtr base = mContent->GetBaseURI(); + nsCOMPtr htmlContainer(do_QueryInterface(doc)); if (htmlContainer) { htmlContainer->GetCSSLoader(*aCSSLoader); @@ -178,6 +178,8 @@ nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(nsIURI** aBaseURI, (*aCSSParser)->SetCaseSensitive(!mContent->IsContentOfType(nsIContent::eHTML) || nodeInfo->NamespaceEquals(kNameSpaceID_XHTML)); + base.swap(*aBaseURI); + return NS_OK; } diff --git a/mozilla/layout/style/nsStyleUtil.cpp b/mozilla/layout/style/nsStyleUtil.cpp index 746bb92e7c2..6ef165add4b 100644 --- a/mozilla/layout/style/nsStyleUtil.cpp +++ b/mozilla/layout/style/nsStyleUtil.cpp @@ -497,8 +497,7 @@ PRBool nsStyleUtil::IsSimpleXlink(nsIContent *aContent, nsIPresContext *aPresCon aContent->GetAttr(kNameSpaceID_XLink, nsHTMLAtoms::href, val); // It's an XLink. Resolve it relative to aContent's base URI. - nsCOMPtr baseURI; - aContent->GetBaseURL(getter_AddRefs(baseURI)); + nsCOMPtr baseURI = aContent->GetBaseURI(); nsCOMPtr absURI; // XXX should we make sure to get the right charset off the document? diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.cpp b/mozilla/layout/xul/base/src/nsBoxFrame.cpp index b9db5e8af3f..71267d954b2 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsBoxFrame.cpp @@ -754,7 +754,7 @@ nsBoxFrame::IsInitialReflowForPrintPreview(nsBoxLayoutState& aState, nsCOMPtr doc; presShell->GetDocument(getter_AddRefs(doc)); if (!doc) return PR_FALSE; - nsIURI *uri = doc->GetDocumentURL(); + nsIURI *uri = doc->GetDocumentURI(); if (!uri) return PR_FALSE; uri->SchemeIs("chrome", &aIsChrome); return PR_TRUE; diff --git a/mozilla/layout/xul/base/src/nsImageBoxFrame.cpp b/mozilla/layout/xul/base/src/nsImageBoxFrame.cpp index ab6d4a219fc..aa7c286a4b6 100644 --- a/mozilla/layout/xul/base/src/nsImageBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsImageBoxFrame.cpp @@ -362,7 +362,7 @@ nsImageBoxFrame::GetImageSource() if (mUseSrcAttr) { nsCOMPtr baseURI; if (mContent) { - mContent->GetBaseURL(getter_AddRefs(baseURI)); + baseURI = mContent->GetBaseURI(); } // XXX origin charset needed NS_NewURI(getter_AddRefs(mURI), src, nsnull, baseURI); @@ -459,7 +459,7 @@ nsImageBoxFrame::UpdateImage(nsIPresContext* aPresContext, PRBool& aResize) if (mContent) { doc = mContent->GetDocument(); if (doc) { - documentURI = doc->GetDocumentURL(); + documentURI = doc->GetDocumentURI(); } } diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index 98ac9a4890d..2c5d6a7c6c2 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -1933,7 +1933,7 @@ nsTreeBodyFrame::GetImage(PRInt32 aRowIndex, const PRUnichar* aColID, PRBool aUs // The page is currently being torn down. Why bother. return NS_ERROR_FAILURE; - mContent->GetBaseURL(getter_AddRefs(baseURI)); + baseURI = mContent->GetBaseURI(); nsCOMPtr srcURI; // XXX origin charset needed @@ -1949,7 +1949,7 @@ nsTreeBodyFrame::GetImage(PRInt32 aRowIndex, const PRUnichar* aColID, PRBool aUs mImageGuard = PR_TRUE; // XXX: initialDocumentURI is NULL! - rv = il->LoadImage(srcURI, nsnull, doc->GetDocumentURL(), nsnull, + rv = il->LoadImage(srcURI, nsnull, doc->GetDocumentURI(), nsnull, imgDecoderObserver, doc, nsIRequest::LOAD_NORMAL, nsnull, nsnull, getter_AddRefs(imageRequest)); mImageGuard = PR_FALSE; diff --git a/mozilla/mailnews/compose/src/nsMsgSend.cpp b/mozilla/mailnews/compose/src/nsMsgSend.cpp index 567d6edeac9..e8006978664 100644 --- a/mozilla/mailnews/compose/src/nsMsgSend.cpp +++ b/mozilla/mailnews/compose/src/nsMsgSend.cpp @@ -1509,7 +1509,7 @@ nsMsgComposeAndSend::GetEmbeddedObjectInfo(nsIDOMNode *node, nsMsgAttachmentData return NS_ERROR_OUT_OF_MEMORY; nsCAutoString spec; - nsIURI *uri = doc->GetDocumentURL(); + nsIURI *uri = doc->GetDocumentURI(); if (!uri) return NS_ERROR_OUT_OF_MEMORY; diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp index 7c37ee3dd05..e58e64c5544 100644 --- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -5617,7 +5617,7 @@ NS_IMETHODIMP nsPluginHostImpl::NewPluginURLStream(const nsString& aURL, if (NS_SUCCEEDED(rv) && doc) { // Create an absolute URL - rv = NS_MakeAbsoluteURI(absUrl, aURL, doc->GetBaseURL()); + rv = NS_MakeAbsoluteURI(absUrl, aURL, doc->GetBaseURI()); } } } @@ -5737,13 +5737,13 @@ nsPluginHostImpl::DoURLLoadSecurityCheck(nsIPluginInstance *aInstance, if (!doc) return NS_ERROR_FAILURE; - nsIURI *sourceURL = doc->GetDocumentURL(); + nsIURI *sourceURL = doc->GetDocumentURI(); if (!sourceURL) return NS_ERROR_FAILURE; // Create an absolute URL for the target in case the target is relative nsCOMPtr targetURL; - rv = NS_NewURI(getter_AddRefs(targetURL), aURL, doc->GetBaseURL()); + rv = NS_NewURI(getter_AddRefs(targetURL), aURL, doc->GetBaseURI()); if (!targetURL) return NS_ERROR_FAILURE; @@ -5911,7 +5911,7 @@ nsresult nsPluginHostImpl::NewEmbededPluginStream(nsIURI* aURL, // to reject requests without referrer set, see bug 157796 nsCOMPtr httpChannel(do_QueryInterface(channel)); if (httpChannel && doc) - httpChannel->SetReferrer(doc->GetBaseURL()); + httpChannel->SetReferrer(doc->GetBaseURI()); rv = channel->AsyncOpen(listener, nsnull); if (NS_SUCCEEDED(rv)) diff --git a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp index cfffb97fd12..29510320472 100644 --- a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp @@ -3100,7 +3100,7 @@ nsChromeRegistry::GetAgentSheets(nsIDocShell* aDocShell, nsISupportsArray **aRes nsCOMPtr doc = content->GetDocument(); nsCOMPtr url; rv = NS_NewURI(getter_AddRefs(url), nsDependentCString(token), - nsnull, doc->GetDocumentURL()); + nsnull, doc->GetDocumentURI()); nsCOMPtr sheet; // The CSSLoader handles all the prototype cache stuff for diff --git a/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.cpp b/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.cpp index 9a89d5fa33f..e63bb05756a 100644 --- a/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.cpp +++ b/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.cpp @@ -329,7 +329,7 @@ nsSecureBrowserUIImpl::Notify(nsIContent* formNode, nsCOMPtr document = formNode->GetDocument(); if (!document) return NS_OK; - nsIURI *formURL = document->GetBaseURL(); + nsIURI *formURL = document->GetBaseURI(); nsCOMPtr postingWindow(do_QueryInterface(document->GetScriptGlobalObject())); diff --git a/mozilla/webshell/tests/viewer/nsViewerApp.cpp b/mozilla/webshell/tests/viewer/nsViewerApp.cpp index bea380a93f0..54b8aeab893 100644 --- a/mozilla/webshell/tests/viewer/nsViewerApp.cpp +++ b/mozilla/webshell/tests/viewer/nsViewerApp.cpp @@ -1089,7 +1089,7 @@ nsViewerApp::CreateRobot(nsBrowserWindow* aWindow) shell->GetDocument(getter_AddRefs(doc)); if (doc) { nsCAutoString str; - nsresult rv = doc->GetDocumentURL()->GetSpec(str); + nsresult rv = doc->GetDocumentURI()->GetSpec(str); if (NS_FAILED(rv)) { return rv; } diff --git a/mozilla/webshell/tests/viewer/nsWebCrawler.cpp b/mozilla/webshell/tests/viewer/nsWebCrawler.cpp index 206897bbd6a..e156e7b722f 100644 --- a/mozilla/webshell/tests/viewer/nsWebCrawler.cpp +++ b/mozilla/webshell/tests/viewer/nsWebCrawler.cpp @@ -767,7 +767,7 @@ nsWebCrawler::FindURLsIn(nsIDocument* aDocument, nsIContent* aNode) aNode->GetAttr(kNameSpaceID_None, mSrcAttr, src); } nsresult rv; - rv = NS_MakeAbsoluteURI(absURLSpec, src, aDocument->GetDocumentURL()); + rv = NS_MakeAbsoluteURI(absURLSpec, src, aDocument->GetDocumentURI()); if (NS_OK == rv) { nsCOMPtr urlAtom = do_GetAtom(absURLSpec); if (0 == mVisited->Get(urlAtom)) { diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index a63b25a4248..eaa24dc5339 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -1417,13 +1417,14 @@ void nsWebShellWindow::LoadContentAreas() { if (docViewer) { nsCOMPtr doc; docViewer->GetDocument(getter_AddRefs(doc)); - nsIURI *mainURL = doc->GetDocumentURL(); - if (mainURL) { - nsCAutoString search; - nsCOMPtr url = do_QueryInterface(mainURL); - if (url) - url->GetQuery(search); - searchSpec = NS_ConvertUTF8toUCS2(search); + nsIURI *mainURL = doc->GetDocumentURI(); + + nsCAutoString search; + nsCOMPtr url = do_QueryInterface(mainURL); + if (url) { + url->GetQuery(search); + + CopyUTF8toUTF16(search, searchSpec); } } } diff --git a/mozilla/xpfe/components/history/src/nsHistoryLoadListener.cpp b/mozilla/xpfe/components/history/src/nsHistoryLoadListener.cpp index ac5a068e71b..c9f5c920d21 100644 --- a/mozilla/xpfe/components/history/src/nsHistoryLoadListener.cpp +++ b/mozilla/xpfe/components/history/src/nsHistoryLoadListener.cpp @@ -109,7 +109,7 @@ nsHistoryLoadListener::OnStateChange(nsIWebProgress *aWebProgress, if (!doc) return NS_OK; nsCOMPtr uri; - rv = doc->GetDocumentURL(getter_AddRefs(uri)); + rv = doc->GetDocumentURI(getter_AddRefs(uri)); if (NS_FAILED(rv)) return rv; nsXPIDLCString urlString;