diff --git a/content/base/public/nsIContent.h b/content/base/public/nsIContent.h index 5c160d4e3c06..341f333d6f86 100644 --- a/content/base/public/nsIContent.h +++ b/content/base/public/nsIContent.h @@ -521,10 +521,9 @@ public: virtual nsresult GetListenerManager(nsIEventListenerManager** aResult) = 0; /** - * Get the base URL for any relative URLs within this piece - * of content. Generally, this is the document's base URL, - * but certain content carries a local base for backward - * compatibility. + * Get the base URI for any relative URIs within this piece of + * content. Generally, this is the document's base URI, but certain + * content carries a local base for backward compatibility. * * @return the base URI */ diff --git a/content/base/src/nsGenericElement.h b/content/base/src/nsGenericElement.h index 70baef909ee2..124d572384f3 100644 --- a/content/base/src/nsGenericElement.h +++ b/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 */ - virtual nsresult Init(nsINodeInfo *aNodeInfo); + nsresult Init(nsINodeInfo *aNodeInfo); /** * Called during QueryInterface to give the binding manager a chance to @@ -369,7 +369,7 @@ public: virtual void SetNativeAnonymous(PRBool aAnonymous); virtual void GetNameSpaceID(PRInt32* aNameSpaceID) const; virtual nsIAtom *Tag() const; - virtual nsINodeInfo *GetNodeInfo() const; + virtual nsINodeInfo *GetNodeInfo() const; virtual nsIAtom *GetIDAttributeName() const; virtual nsIAtom *GetClassAttributeName() const; virtual nsresult RangeAdd(nsIDOMRange* aRange); diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 2ab9fcfa6fde..8c2246de85a5 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -541,9 +541,8 @@ IsOffsetParent(nsIContent *aContent) aContent->IsContentOfType(nsIContent::eHTML)); } -nsresult -nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, - nsIContent** aOffsetParent) +void +nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent) { *aOffsetParent = nsnull; @@ -551,14 +550,14 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, aRect.Empty(); if (!mDocument) { - return NS_OK; + return; } // Get Presentation shell 0 nsIPresShell *presShell = mDocument->GetShellAt(0); if (!presShell) { - return NS_OK; + return; } // Get the Presentation Context from the Shell @@ -566,7 +565,7 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, presShell->GetPresContext(getter_AddRefs(context)); if (!context) { - return NS_OK; + return; } // Flush all pending notifications so that our frames are uptodate @@ -577,7 +576,7 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, presShell->GetPrimaryFrameFor(this, &frame); if (!frame) { - return NS_OK; + return; } // Get the union of all rectangles in this and continuation frames @@ -746,8 +745,6 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, aRect.y = NSTwipsToIntPixels(origin.y, scale); aRect.width = NSTwipsToIntPixels(rcFrame.width, scale); aRect.height = NSTwipsToIntPixels(rcFrame.height, scale); - - return NS_OK; } nsresult @@ -755,16 +752,11 @@ nsGenericHTMLElement::GetOffsetTop(PRInt32* aOffsetTop) { nsRect rcFrame; nsCOMPtr parent; - nsresult res = GetOffsetRect(rcFrame, getter_AddRefs(parent)); + GetOffsetRect(rcFrame, getter_AddRefs(parent)); - if(NS_SUCCEEDED(res)) { - *aOffsetTop = rcFrame.y; - } - else { - *aOffsetTop = 0; - } + *aOffsetTop = rcFrame.y; - return res; + return NS_OK; } nsresult @@ -772,16 +764,11 @@ nsGenericHTMLElement::GetOffsetLeft(PRInt32* aOffsetLeft) { nsRect rcFrame; nsCOMPtr parent; - nsresult res = GetOffsetRect(rcFrame, getter_AddRefs(parent)); + GetOffsetRect(rcFrame, getter_AddRefs(parent)); - if(NS_SUCCEEDED(res)) { - *aOffsetLeft = rcFrame.x; - } - else { - *aOffsetLeft = 0; - } + *aOffsetLeft = rcFrame.x; - return res; + return NS_OK; } nsresult @@ -789,16 +776,11 @@ nsGenericHTMLElement::GetOffsetWidth(PRInt32* aOffsetWidth) { nsRect rcFrame; nsCOMPtr parent; - nsresult res = GetOffsetRect(rcFrame, getter_AddRefs(parent)); + GetOffsetRect(rcFrame, getter_AddRefs(parent)); - if(NS_SUCCEEDED(res)) { - *aOffsetWidth = rcFrame.width; - } - else { - *aOffsetWidth = 0; - } + *aOffsetWidth = rcFrame.width; - return res; + return NS_OK; } nsresult @@ -806,34 +788,27 @@ nsGenericHTMLElement::GetOffsetHeight(PRInt32* aOffsetHeight) { nsRect rcFrame; nsCOMPtr parent; - nsresult res = GetOffsetRect(rcFrame, getter_AddRefs(parent)); + GetOffsetRect(rcFrame, getter_AddRefs(parent)); - if(NS_SUCCEEDED(res)) { - *aOffsetHeight = rcFrame.height; - } - else { - *aOffsetHeight = 0; - } + *aOffsetHeight = rcFrame.height; - return res; + return NS_OK; } nsresult nsGenericHTMLElement::GetOffsetParent(nsIDOMElement** aOffsetParent) { - NS_ENSURE_ARG_POINTER(aOffsetParent); - nsRect rcFrame; nsCOMPtr parent; - nsresult res = GetOffsetRect(rcFrame, getter_AddRefs(parent)); - if (NS_SUCCEEDED(res)) { - if (parent) { - res = CallQueryInterface(parent, aOffsetParent); - } else { - *aOffsetParent = nsnull; - } + GetOffsetRect(rcFrame, getter_AddRefs(parent)); + + if (parent) { + CallQueryInterface(parent, aOffsetParent); + } else { + *aOffsetParent = nsnull; } - return res; + + return NS_OK; } nsresult @@ -932,7 +907,7 @@ nsGenericHTMLElement::SetInnerHTML(const nsAString& aInnerHTML) return rv; } -nsresult +void nsGenericHTMLElement::GetScrollInfo(nsIScrollableView **aScrollableView, float *aP2T, float *aT2P, nsIFrame **aFrame) @@ -942,7 +917,7 @@ nsGenericHTMLElement::GetScrollInfo(nsIScrollableView **aScrollableView, *aT2P = 0.0f; if (!mDocument) { - return NS_OK; + return; } mDocument->FlushPendingNotifications(PR_TRUE, PR_FALSE); @@ -950,21 +925,21 @@ nsGenericHTMLElement::GetScrollInfo(nsIScrollableView **aScrollableView, // Get the presentation shell nsIPresShell *presShell = mDocument->GetShellAt(0); if (!presShell) { - return NS_OK; + return; } // Get the presentation context nsCOMPtr presContext; presShell->GetPresContext(getter_AddRefs(presContext)); if (!presContext) { - return NS_OK; + return; } // Get the primary frame for this element nsIFrame *frame = nsnull; presShell->GetPrimaryFrameFor(this, &frame); if (!frame) { - return NS_OK; + return; } if (aFrame) { @@ -984,7 +959,7 @@ nsGenericHTMLElement::GetScrollInfo(nsIScrollableView **aScrollableView, if (scrollProvider) { scrollProvider->GetScrollableView(presContext, aScrollableView); if (*aScrollableView) { - return NS_OK; + return; } } @@ -1010,14 +985,14 @@ nsGenericHTMLElement::GetScrollInfo(nsIScrollableView **aScrollableView, } if (!scrollFrame) { - return NS_OK; + return; } } // Get the scrollable view scrollFrame->GetScrollableView(presContext, aScrollableView); - return NS_OK; + return; } diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h index 1dd27d0a99ca..7f733b857043 100644 --- a/content/html/content/src/nsGenericHTMLElement.h +++ b/content/html/content/src/nsGenericHTMLElement.h @@ -81,7 +81,7 @@ public: virtual ~nsGenericHTMLElement(); #ifdef GATHER_ELEMENT_USEAGE_STATISTICS - virtual nsresult Init(nsINodeInfo *aNodeInfo); + nsresult Init(nsINodeInfo *aNodeInfo); #endif /** Call on shutdown to release globals */ @@ -121,34 +121,40 @@ public: NS_METHOD GetElementsByTagName(const nsAString& aTagname, nsIDOMNodeList** aReturn); - // Implementation for nsIDOMHTMLElement - 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); + // nsIDOMHTMLElement methods. Note that these are non-virtual + // methods, implementations are expected to forward calls to these + // methods. + 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); + + // nsIDOMNSHTMLElement methods. Note that these are non-virtual + // methods, implementations are expected to forward calls to these + // methods. + 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); /** * Get the frame's offset information for offsetTop/Left/Width/Height. @@ -156,10 +162,9 @@ public: * @param aOffsetParent the parent the offset is relative to (offsetParent) * [OUT] */ - nsresult GetOffsetRect(nsRect& aRect, - nsIContent** aOffsetParent); - nsresult GetScrollInfo(nsIScrollableView **aScrollableView, float *aP2T, - float *aT2P, nsIFrame **aFrame = nsnull); + void GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent); + void GetScrollInfo(nsIScrollableView **aScrollableView, float *aP2T, + float *aT2P, nsIFrame **aFrame = nsnull); /** * Get an element's client info if the element doesn't have a diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index 66feb04bf7e0..5038e9888875 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -110,7 +110,7 @@ public: virtual ~nsHTMLFormElement(); - virtual nsresult Init(nsINodeInfo* aNodeInfo); + nsresult Init(nsINodeInfo* aNodeInfo); // nsISupports NS_DECL_ISUPPORTS_INHERITED diff --git a/content/html/content/src/nsHTMLScriptElement.cpp b/content/html/content/src/nsHTMLScriptElement.cpp index fecc975736c6..436baf667d3b 100644 --- a/content/html/content/src/nsHTMLScriptElement.cpp +++ b/content/html/content/src/nsHTMLScriptElement.cpp @@ -349,8 +349,8 @@ public: virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify, PRBool aDeepSetDocument); - NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML); - NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML); + virtual nsresult GetInnerHTML(nsAString& aInnerHTML); + virtual nsresult SetInnerHTML(const nsAString& aInnerHTML); protected: PRBool IsOnloadEventForWindow(); @@ -543,13 +543,13 @@ NS_IMPL_STRING_ATTR(nsHTMLScriptElement, Type, type) NS_IMPL_STRING_ATTR(nsHTMLScriptElement, HtmlFor, _for) NS_IMPL_STRING_ATTR(nsHTMLScriptElement, Event, _event) -NS_IMETHODIMP +nsresult nsHTMLScriptElement::GetInnerHTML(nsAString& aInnerHTML) { return GetContentsAsText(aInnerHTML); } -NS_IMETHODIMP +nsresult nsHTMLScriptElement::SetInnerHTML(const nsAString& aInnerHTML) { return ReplaceContentsWithText(aInnerHTML, PR_TRUE); diff --git a/content/html/content/src/nsHTMLSpanElement.cpp b/content/html/content/src/nsHTMLSpanElement.cpp index 977dab22cd3c..2d9e819be841 100644 --- a/content/html/content/src/nsHTMLSpanElement.cpp +++ b/content/html/content/src/nsHTMLSpanElement.cpp @@ -63,8 +63,8 @@ public: // nsIDOMHTMLElement NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::) - NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML); - NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML); + virtual nsresult GetInnerHTML(nsAString& aInnerHTML); + virtual nsresult SetInnerHTML(const nsAString& aInnerHTML); }; nsresult @@ -142,7 +142,7 @@ nsHTMLSpanElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) return NS_OK; } -NS_IMETHODIMP +nsresult nsHTMLSpanElement::GetInnerHTML(nsAString& aInnerHTML) { if (mNodeInfo->Equals(nsHTMLAtoms::xmp) || @@ -153,7 +153,7 @@ nsHTMLSpanElement::GetInnerHTML(nsAString& aInnerHTML) return nsGenericHTMLContainerElement::GetInnerHTML(aInnerHTML); } -NS_IMETHODIMP +nsresult nsHTMLSpanElement::SetInnerHTML(const nsAString& aInnerHTML) { if (mNodeInfo->Equals(nsHTMLAtoms::xmp) || diff --git a/content/html/content/src/nsHTMLStyleElement.cpp b/content/html/content/src/nsHTMLStyleElement.cpp index ac30804eb554..ce856af4bf51 100644 --- a/content/html/content/src/nsHTMLStyleElement.cpp +++ b/content/html/content/src/nsHTMLStyleElement.cpp @@ -92,8 +92,8 @@ public: virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify); - NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML); - NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML); + virtual nsresult GetInnerHTML(nsAString& aInnerHTML); + virtual nsresult SetInnerHTML(const nsAString& aInnerHTML); protected: void GetStyleSheetURL(PRBool* aIsInline, @@ -334,13 +334,13 @@ nsHTMLStyleElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, return rv; } -NS_IMETHODIMP +nsresult nsHTMLStyleElement::GetInnerHTML(nsAString& aInnerHTML) { return GetContentsAsText(aInnerHTML); } -NS_IMETHODIMP +nsresult nsHTMLStyleElement::SetInnerHTML(const nsAString& aInnerHTML) { SetEnableUpdates(PR_FALSE); diff --git a/content/html/content/src/nsHTMLTextAreaElement.cpp b/content/html/content/src/nsHTMLTextAreaElement.cpp index 52063cf2b862..ea9821b6ff78 100644 --- a/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -140,8 +140,8 @@ public: virtual void SetFocus(nsIPresContext* aPresContext); virtual void RemoveFocus(nsIPresContext* aPresContext); - NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML); - NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML); + virtual nsresult GetInnerHTML(nsAString& aInnerHTML); + virtual nsresult SetInnerHTML(const nsAString& aInnerHTML); protected: nsCOMPtr mControllers; @@ -733,13 +733,13 @@ nsHTMLTextAreaElement::DoneAddingChildren() } -NS_IMETHODIMP +nsresult nsHTMLTextAreaElement::GetInnerHTML(nsAString& aInnerHTML) { return GetContentsAsText(aInnerHTML); } -NS_IMETHODIMP +nsresult nsHTMLTextAreaElement::SetInnerHTML(const nsAString& aInnerHTML) { return ReplaceContentsWithText(aInnerHTML, PR_TRUE);