diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index ea3676418b8..b140c2ebd62 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -98,6 +98,8 @@ public: nsISupports* aContainer, nsIStreamListener **aDocListener) = 0; + NS_IMETHOD StopDocumentLoad() = 0; + /** * Return the title of the document. May return null. */ diff --git a/content/base/public/nsITextContent.h b/content/base/public/nsITextContent.h index a6ae2174457..46fb3099ee5 100644 --- a/content/base/public/nsITextContent.h +++ b/content/base/public/nsITextContent.h @@ -23,9 +23,9 @@ #define nsITextContent_h___ #include "nslayout.h" +#include "nsIContent.h" class nsString; class nsTextFragment; -class nsIContent; // IID for the nsITextContent interface #define NS_ITEXT_CONTENT_IID \ @@ -35,7 +35,7 @@ class nsIContent; * Interface for textual content. This interface is used to provide * an efficient access to text content. */ -class nsITextContent : public nsISupports { +class nsITextContent : public nsIContent { public: static const nsIID& GetIID() { static nsIID iid = NS_ITEXT_CONTENT_IID; return iid; } diff --git a/content/base/src/nsCommentNode.cpp b/content/base/src/nsCommentNode.cpp index 69fd11369c4..de0dc53d975 100644 --- a/content/base/src/nsCommentNode.cpp +++ b/content/base/src/nsCommentNode.cpp @@ -39,8 +39,6 @@ static NS_DEFINE_IID(kITextContentIID, NS_ITEXT_CONTENT_IID); class nsCommentNode : public nsIDOMComment, public nsIScriptObjectOwner, - public nsIDOMEventReceiver, - public nsIContent, public nsITextContent { public: @@ -61,9 +59,6 @@ public: // nsIScriptObjectOwner NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC_DOM_DATA(mInner) - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(mInner) - // nsIContent //NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner) diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 09174192a99..7f821ca6f67 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -848,7 +848,7 @@ nsDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) return rv; } -nsresult +NS_IMETHODIMP nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup, @@ -858,6 +858,12 @@ nsDocument::StartDocumentLoad(const char* aCommand, return Reset(aChannel, aLoadGroup); } +NS_IMETHODIMP +nsDocument::StopDocumentLoad() +{ + return NS_OK; +} + const nsString* nsDocument::GetDocumentTitle() const { return mDocumentTitle; diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index 6989505fe31..2ea591ee5a7 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -110,7 +110,6 @@ class nsDocument : public nsIDocument, public nsIDOMDocument, public nsIDOMNSDocument, public nsIDiskDocument, - public nsIScriptObjectOwner, public nsIJSScriptObject, public nsSupportsWeakReference, public nsIDOMEventReceiver, @@ -127,6 +126,8 @@ public: nsISupports* aContainer, nsIStreamListener **aDocListener); + NS_IMETHOD StopDocumentLoad(); + /** * Return the title of the document. May return null. */ diff --git a/content/base/src/nsDocumentViewer.cpp b/content/base/src/nsDocumentViewer.cpp index 220fe5ce1bf..c1e8f54deb1 100644 --- a/content/base/src/nsDocumentViewer.cpp +++ b/content/base/src/nsDocumentViewer.cpp @@ -537,6 +537,10 @@ DocumentViewerImpl::Init(nsIWidget* aParentWidget, NS_IMETHODIMP DocumentViewerImpl::Stop(void) { + if (mDocument) { + mDocument->StopDocumentLoad(); + } + if (mPresContext) { mPresContext->Stop(); } diff --git a/content/base/src/nsGenericDOMDataNode.cpp b/content/base/src/nsGenericDOMDataNode.cpp index 84f9c1f90ef..91eef154ebb 100644 --- a/content/base/src/nsGenericDOMDataNode.cpp +++ b/content/base/src/nsGenericDOMDataNode.cpp @@ -494,8 +494,6 @@ nsGenericDOMDataNode::SetScriptObject(void *aScriptObject) //---------------------------------------------------------------------- -// nsIDOMEventReceiver implementation - nsresult nsGenericDOMDataNode::GetListenerManager(nsIEventListenerManager** aResult) { @@ -512,72 +510,6 @@ nsGenericDOMDataNode::GetListenerManager(nsIEventListenerManager** aResult) return rv; } -nsresult -nsGenericDOMDataNode::GetNewListenerManager(nsIEventListenerManager** aResult) -{ - return NS_NewEventListenerManager(aResult); -} - -nsresult -nsGenericDOMDataNode::HandleEvent(nsIDOMEvent *aEvent) -{ - return NS_ERROR_FAILURE; -} - -nsresult -nsGenericDOMDataNode::AddEventListenerByIID(nsIDOMEventListener* aListener, - const nsIID& aIID) -{ - nsIEventListenerManager *manager; - - if (NS_OK == GetListenerManager(&manager)) { - manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); - NS_RELEASE(manager); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -nsresult -nsGenericDOMDataNode::RemoveEventListenerByIID(nsIDOMEventListener* aListener, - const nsIID& aIID) -{ - if (nsnull != mListenerManager) { - mListenerManager->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -nsresult -nsGenericDOMDataNode::AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) -{ - nsIEventListenerManager *manager; - - if (NS_OK == GetListenerManager(&manager)) { - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - manager->AddEventListenerByType(aListener, aType, flags); - NS_RELEASE(manager); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -nsresult -nsGenericDOMDataNode::RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) -{ - if (nsnull != mListenerManager) { - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - mListenerManager->RemoveEventListenerByType(aListener, aType, flags); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - //---------------------------------------------------------------------- // Implementation of nsIContent diff --git a/content/base/src/nsGenericDOMDataNode.h b/content/base/src/nsGenericDOMDataNode.h index ca4cb2ca651..336af7900d3 100644 --- a/content/base/src/nsGenericDOMDataNode.h +++ b/content/base/src/nsGenericDOMDataNode.h @@ -22,6 +22,7 @@ #ifndef nsGenericDOMDataNode_h___ #define nsGenericDOMDataNode_h___ +#include "nsCOMPtr.h" #include "nsIDOMCharacterData.h" #include "nsIScriptObjectOwner.h" #include "nsIDOMEventReceiver.h" @@ -31,6 +32,7 @@ #include "nsINameSpaceManager.h" #include "nsITextContent.h" #include "nsDOMError.h" +#include "nsIEventListenerManager.h" extern const nsIID kIDOMCharacterDataIID; extern const nsIID kIDOMNodeIID; @@ -43,7 +45,6 @@ extern const nsIID kIContentIID; class nsIDOMAttr; class nsIDOMEventListener; class nsIDOMNodeList; -class nsIEventListenerManager; class nsIFrame; class nsIStyleContext; class nsIStyleRule; @@ -105,19 +106,6 @@ struct nsGenericDOMDataNode { nsresult DeleteData(PRUint32 aOffset, PRUint32 aCount); nsresult ReplaceData(PRUint32 aOffset, PRUint32 aCount, const nsString& aArg); - // nsIDOMEventReceiver interface - nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID); - nsresult RemoveEventListenerByIID(nsIDOMEventListener* aListener, - const nsIID& aIID); - nsresult GetListenerManager(nsIEventListenerManager** aInstancePtrResult); - nsresult GetNewListenerManager(nsIEventListenerManager** aInstancePtrResult); - nsresult HandleEvent(nsIDOMEvent *aEvent); - - // nsIDOMEventTarget interface - nsresult AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture); - nsresult RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture); // nsIScriptObjectOwner interface nsresult GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); @@ -227,6 +215,8 @@ struct nsGenericDOMDataNode { //---------------------------------------- + nsresult GetListenerManager(nsIEventListenerManager** aInstancePtrResult); + void ToCString(nsString& aBuf, PRInt32 aOffset, PRInt32 aLen) const; // Up pointer to the real content object that we are @@ -549,16 +539,18 @@ struct nsGenericDOMDataNode { return NS_OK; \ } \ if (_id.Equals(kIDOMEventReceiverIID)) { \ - nsIDOMEventReceiver* tmp = _this; \ - *_iptr = (void*) tmp; \ - NS_ADDREF_THIS(); \ - return NS_OK; \ + nsCOMPtr man; \ + if (NS_SUCCEEDED(mInner.GetListenerManager(getter_AddRefs(man)))){ \ + return man->QueryInterface(kIDOMEventReceiverIID, (void**)_iptr); \ + } \ + return NS_NOINTERFACE; \ } \ if (_id.Equals(kIDOMEventTargetIID)) { \ - nsIDOMEventTarget* tmp = _this; \ - *_iptr = (void*) tmp; \ - NS_ADDREF_THIS(); \ - return NS_OK; \ + nsCOMPtr man; \ + if (NS_SUCCEEDED(mInner.GetListenerManager(getter_AddRefs(man)))){ \ + return man->QueryInterface(kIDOMEventTargetIID, (void**)_iptr); \ + } \ + return NS_NOINTERFACE; \ } \ if (_id.Equals(kIScriptObjectOwnerIID)) { \ nsIScriptObjectOwner* tmp = _this; \ diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index f053fc1bef0..b6bbd8505f1 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -380,7 +380,6 @@ nsGenericElement::nsGenericElement() mTag = nsnull; mContent = nsnull; mDOMSlots = nsnull; - mListenerManager = nsnull; mContentID = 0; } @@ -389,7 +388,6 @@ nsGenericElement::~nsGenericElement() // pop any enclosed ranges out // nsRange::OwnerGone(mContent); not used for now NS_IF_RELEASE(mTag); - NS_IF_RELEASE(mListenerManager); if (nsnull != mDOMSlots) { if (nsnull != mDOMSlots->mChildNodes) { mDOMSlots->mChildNodes->DropReference(); @@ -404,6 +402,7 @@ nsGenericElement::~nsGenericElement() mDOMSlots->mAttributeMap->DropReference(); NS_RELEASE(mDOMSlots->mAttributeMap); } + NS_IF_RELEASE(mDOMSlots->mListenerManager); // XXX Should really be arena managed PR_DELETE(mDOMSlots); } @@ -420,11 +419,27 @@ nsGenericElement::GetDOMSlots() mDOMSlots->mAttributeMap = nsnull; mDOMSlots->mRangeList = nsnull; mDOMSlots->mCapturer = nsnull; + mDOMSlots->mListenerManager = nsnull; } return mDOMSlots; } +void +nsGenericElement::MaybeClearDOMSlots() +{ + if (mDOMSlots && + (nsnull == mDOMSlots->mScriptObject) && + (nsnull == mDOMSlots->mChildNodes) && + (nsnull == mDOMSlots->mStyle) && + (nsnull == mDOMSlots->mAttributeMap) && + (nsnull == mDOMSlots->mRangeList) && + (nsnull == mDOMSlots->mCapturer) && + (nsnull == mDOMSlots->mListenerManager)) { + PR_DELETE(mDOMSlots); + } +} + void nsGenericElement::Init(nsIContent* aOuterContentObject, nsIAtom* aTag) @@ -1004,9 +1019,9 @@ nsGenericElement::HandleDOMEvent(nsIPresContext* aPresContext, } //Local handling stage - if (mListenerManager && !(aEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH)) { + if (mDOMSlots && mDOMSlots->mListenerManager && !(aEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH)) { aEvent->flags |= aFlags; - mListenerManager->HandleEvent(aPresContext, aEvent, aDOMEvent, aFlags, aEventStatus); + mDOMSlots->mListenerManager->HandleEvent(aPresContext, aEvent, aDOMEvent, aFlags, aEventStatus); aEvent->flags &= ~aFlags; } @@ -1090,11 +1105,7 @@ nsGenericElement::RangeRemove(nsIDOMRange& aRange) if (mDOMSlots->mRangeList->Count() == 0) { delete mDOMSlots->mRangeList; mDOMSlots->mRangeList = nsnull; - if ( (mDOMSlots->mScriptObject == nsnull) && - (mDOMSlots->mChildNodes == nsnull) && - (mDOMSlots->mStyle == nsnull) ) { - PR_DELETE(mDOMSlots); - } + MaybeClearDOMSlots(); } return NS_OK; } @@ -1220,9 +1231,10 @@ nsGenericElement::SetScriptObject(void *aScriptObject) slots->mScriptObject = aScriptObject; if (!aScriptObject) { - if (mListenerManager) { - mListenerManager->RemoveAllListeners(PR_TRUE); + if (slots->mListenerManager) { + slots->mListenerManager->RemoveAllListeners(PR_TRUE); } + MaybeClearDOMSlots(); } return NS_OK; @@ -1230,90 +1242,24 @@ nsGenericElement::SetScriptObject(void *aScriptObject) //---------------------------------------------------------------------- -// nsIDOMEventReceiver implementation - nsresult nsGenericElement::GetListenerManager(nsIEventListenerManager** aResult) { - if (nsnull != mListenerManager) { - NS_ADDREF(mListenerManager); - *aResult = mListenerManager; + nsDOMSlots *slots = GetDOMSlots(); + + if (nsnull != slots->mListenerManager) { + NS_ADDREF(slots->mListenerManager); + *aResult = slots->mListenerManager; return NS_OK; } nsresult rv = NS_NewEventListenerManager(aResult); if (NS_OK == rv) { - mListenerManager = *aResult; - NS_ADDREF(mListenerManager); + slots->mListenerManager = *aResult; + NS_ADDREF(slots->mListenerManager); } return rv; } -nsresult -nsGenericElement::GetNewListenerManager(nsIEventListenerManager** aResult) -{ - return NS_NewEventListenerManager(aResult); -} - -nsresult -nsGenericElement::HandleEvent(nsIDOMEvent *aEvent) -{ - return NS_ERROR_FAILURE; -} - -nsresult -nsGenericElement::AddEventListenerByIID(nsIDOMEventListener* aListener, - const nsIID& aIID) -{ - nsIEventListenerManager *manager; - - if (NS_OK == GetListenerManager(&manager)) { - manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); - NS_RELEASE(manager); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -nsresult -nsGenericElement::RemoveEventListenerByIID(nsIDOMEventListener* aListener, - const nsIID& aIID) -{ - if (nsnull != mListenerManager) { - mListenerManager->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -nsresult -nsGenericElement::AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) -{ - nsIEventListenerManager *manager; - - if (NS_OK == GetListenerManager(&manager)) { - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - manager->AddEventListenerByType(aListener, aType, flags); - NS_RELEASE(manager); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -nsresult -nsGenericElement::RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) -{ - if (nsnull != mListenerManager) { - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - mListenerManager->RemoveEventListenerByType(aListener, aType, flags); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - //---------------------------------------------------------------------- // nsIJSScriptObject implementation diff --git a/content/base/src/nsGenericElement.h b/content/base/src/nsGenericElement.h index 17b1d662c05..8f761c46341 100644 --- a/content/base/src/nsGenericElement.h +++ b/content/base/src/nsGenericElement.h @@ -22,6 +22,7 @@ #ifndef nsGenericElement_h___ #define nsGenericElement_h___ +#include "nsCOMPtr.h" #include "nsIContent.h" #include "nsIDOMAttr.h" #include "nsIDOMNamedNodeMap.h" @@ -32,6 +33,7 @@ #include "nsIJSScriptObject.h" #include "nsILinkHandler.h" #include "nsGenericDOMNodeList.h" +#include "nsIEventListenerManager.h" extern const nsIID kIDOMNodeIID; extern const nsIID kIDOMElementIID; @@ -44,7 +46,6 @@ extern const nsIID kIContentIID; class nsIDOMAttr; class nsIDOMEventListener; -class nsIEventListenerManager; class nsIFrame; class nsISupportsArray; class nsIDOMScriptObjectFactory; @@ -115,14 +116,12 @@ typedef struct { nsDOMAttributeMap* mAttributeMap; nsVoidArray *mRangeList; nsIContent* mCapturer; + nsIEventListenerManager* mListenerManager; } nsDOMSlots; -class nsGenericElement : public nsIJSScriptObject { +class nsGenericElement { public: nsGenericElement(); -#if 1 - virtual // XXX temporary until vidur fixes this up -#endif ~nsGenericElement(); void Init(nsIContent* aOuterContentObject, nsIAtom* aTag); @@ -151,20 +150,6 @@ public: nsIDOMNodeList** aReturn); nsresult Normalize(); - // nsIDOMEventReceiver interface - nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID); - nsresult RemoveEventListenerByIID(nsIDOMEventListener* aListener, - const nsIID& aIID); - nsresult GetListenerManager(nsIEventListenerManager** aInstancePtrResult); - nsresult GetNewListenerManager(nsIEventListenerManager** aInstancePtrResult); - nsresult HandleEvent(nsIDOMEvent *aEvent); - - // nsIDOMEventTarget interface - nsresult AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture); - nsresult RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture); - // nsIScriptObjectOwner interface nsresult GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); nsresult SetScriptObject(void *aScriptObject); @@ -223,6 +208,8 @@ public: //---------------------------------------- + nsresult GetListenerManager(nsIEventListenerManager** aInstancePtrResult); + nsresult RenderFrame(nsIPresContext*); nsresult AddScriptEventListener(nsIAtom* aAttribute, @@ -249,6 +236,7 @@ public: static nsIAtom* CutNameSpacePrefix(nsString& aString); nsDOMSlots *GetDOMSlots(); + void MaybeClearDOMSlots(); // Up pointer to the real content object that we are // supporting. Sometimes there is work that we just can't do @@ -256,10 +244,9 @@ public: // work. nsIContent* mContent; - nsIDocument* mDocument; - nsIContent* mParent; + nsIDocument* mDocument; // WEAK + nsIContent* mParent; // WEAK nsIAtom* mTag; - nsIEventListenerManager* mListenerManager; nsDOMSlots *mDOMSlots; PRUint32 mContentID; }; @@ -913,6 +900,37 @@ public: return _g.SetScriptObject(aScriptObject); \ } +#define NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(_g) \ + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(_g) \ + virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, \ + jsval aID, jsval *aVp) { \ + return _g.AddProperty(aContext, aObj, aID, aVp); \ + } \ + virtual PRBool DeleteProperty(JSContext *aContext, JSObject *aObj, \ + jsval aID, jsval *aVp) { \ + return _g.DeleteProperty(aContext, aObj, aID, aVp); \ + } \ + virtual PRBool GetProperty(JSContext *aContext, JSObject *aObj, \ + jsval aID, jsval *aVp) { \ + return _g.GetProperty(aContext, aObj, aID, aVp); \ + } \ + virtual PRBool SetProperty(JSContext *aContext, JSObject *aObj, \ + jsval aID, jsval *aVp) { \ + return _g.SetProperty(aContext, aObj, aID, aVp); \ + } \ + virtual PRBool EnumerateProperty(JSContext *aContext, JSObject *aObj) { \ + return _g.EnumerateProperty(aContext, aObj); \ + } \ + virtual PRBool Resolve(JSContext *aContext, JSObject *aObj, jsval aID) { \ + return _g.EnumerateProperty(aContext, aObj); \ + } \ + virtual PRBool Convert(JSContext *aContext, JSObject *aObj, jsval aID) { \ + return _g.EnumerateProperty(aContext, aObj); \ + } \ + virtual void Finalize(JSContext *aContext, JSObject *aObj) { \ + _g.Finalize(aContext, aObj); \ + } + #define NS_IMPL_CONTENT_QUERY_INTERFACE(_id, _iptr, _this, _base) \ if (_id.Equals(kISupportsIID)) { \ _base* tmp = _this; \ @@ -934,16 +952,18 @@ public: return NS_OK; \ } \ if (_id.Equals(kIDOMEventReceiverIID)) { \ - nsIDOMEventReceiver* tmp = _this; \ - *_iptr = (void*) tmp; \ - NS_ADDREF_THIS(); \ - return NS_OK; \ + nsCOMPtr man; \ + if (NS_SUCCEEDED(mInner.GetListenerManager(getter_AddRefs(man)))){ \ + return man->QueryInterface(kIDOMEventReceiverIID, (void**)_iptr); \ + } \ + return NS_NOINTERFACE; \ } \ if (_id.Equals(kIDOMEventTargetIID)) { \ - nsIDOMEventTarget* tmp = _this; \ - *_iptr = (void*) tmp; \ - NS_ADDREF_THIS(); \ - return NS_OK; \ + nsCOMPtr man; \ + if (NS_SUCCEEDED(mInner.GetListenerManager(getter_AddRefs(man)))){ \ + return man->QueryInterface(kIDOMEventTargetIID, (void**)_iptr); \ + } \ + return NS_NOINTERFACE; \ } \ if (_id.Equals(kIScriptObjectOwnerIID)) { \ nsIScriptObjectOwner* tmp = _this; \ @@ -959,7 +979,7 @@ public: return NS_OK; \ } \ if (_id.Equals(kIJSScriptObjectIID)) { \ - nsIJSScriptObject* tmp = (nsIJSScriptObject*)&mInner; \ + nsIJSScriptObject* tmp = _this; \ *_iptr = (void*) tmp; \ NS_ADDREF_THIS(); \ return NS_OK; \ diff --git a/content/base/src/nsNameSpaceManager.cpp b/content/base/src/nsNameSpaceManager.cpp index d464536871b..4853b3e1f6f 100644 --- a/content/base/src/nsNameSpaceManager.cpp +++ b/content/base/src/nsNameSpaceManager.cpp @@ -34,6 +34,7 @@ static NS_DEFINE_IID(kINameSpaceIID, NS_INAMESPACE_IID); static const char kXMLNSNameSpaceURI[] = ""; static const char kXMLNameSpaceURI[] = "http://www.w3.org/XML/1998/namespace"; static const char kHTMLNameSpaceURI[] = "http://www.w3.org/TR/REC-html40"; // XXX?? "urn:w3-org-ns:HTML"?? +static const char kXHTMLNameSpaceURI[] = "http://www.w3.org/1999/xhtml"; //----------------------------------------------------------- // Name Space ID table support @@ -109,15 +110,19 @@ static void AddRefTable() nsString* xmlns = new nsString(kXMLNSNameSpaceURI); nsString* xml = new nsString(kXMLNameSpaceURI); nsString* html = new nsString(kHTMLNameSpaceURI); + nsString* xhtml = new nsString(kXHTMLNameSpaceURI); gURIArray->AppendElement(xmlns); // ordering here needs to match IDs gURIArray->AppendElement(xml); gURIArray->AppendElement(html); + gURIArray->AppendElement(xhtml); NameSpaceURIKey xmlnsKey(xmlns); NameSpaceURIKey xmlKey(xml); NameSpaceURIKey htmlKey(html); + NameSpaceURIKey xhtmlKey(xhtml); gURIToIDTable->Put(&xmlnsKey, (void*)kNameSpaceID_XMLNS); gURIToIDTable->Put(&xmlKey, (void*)kNameSpaceID_XML); gURIToIDTable->Put(&htmlKey, (void*)kNameSpaceID_HTML); + gURIToIDTable->Put(&xhtmlKey, (void*)kNameSpaceID_HTML); } NS_ASSERTION(nsnull != gURIToIDTable, "no URI table"); NS_ASSERTION(nsnull != gURIArray, "no URI array"); diff --git a/content/base/src/nsStyleContext.cpp b/content/base/src/nsStyleContext.cpp index d73e1b6fcaf..b562999b423 100644 --- a/content/base/src/nsStyleContext.cpp +++ b/content/base/src/nsStyleContext.cpp @@ -766,7 +766,7 @@ PRInt32 StyleSpacingImpl::CalcDifference(const StyleSpacingImpl& aOther) const (mOutlineStyle != aOther.mOutlineStyle) || (mOutlineColor != aOther.mOutlineColor) || (mOutlineRadius != aOther.mOutlineRadius)) { - return NS_STYLE_HINT_REFLOW; // XXX: should be VISUAL: see bugs 9809 and 9816 + return NS_STYLE_HINT_VISUAL; // XXX: should be VISUAL: see bugs 9809 and 9816 } return NS_STYLE_HINT_NONE; } diff --git a/content/base/src/nsTextNode.cpp b/content/base/src/nsTextNode.cpp index 6c7cf57d004..ed401bf5ae5 100644 --- a/content/base/src/nsTextNode.cpp +++ b/content/base/src/nsTextNode.cpp @@ -36,8 +36,6 @@ static NS_DEFINE_IID(kITextContentIID, NS_ITEXT_CONTENT_IID); class nsTextNode : public nsIDOMText, public nsIScriptObjectOwner, - public nsIDOMEventReceiver, - public nsIContent, public nsITextContent { public: @@ -59,9 +57,6 @@ public: // nsIScriptObjectOwner NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC_DOM_DATA(mInner) - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(mInner) - // nsIContent NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner) diff --git a/content/events/src/nsEventListenerManager.cpp b/content/events/src/nsEventListenerManager.cpp index 64b63881434..219386c3759 100644 --- a/content/events/src/nsEventListenerManager.cpp +++ b/content/events/src/nsEventListenerManager.cpp @@ -96,7 +96,12 @@ nsEventListenerManager::~nsEventListenerManager() NS_IMPL_ADDREF(nsEventListenerManager) NS_IMPL_RELEASE(nsEventListenerManager) -NS_IMPL_QUERY_INTERFACE1(nsEventListenerManager, nsIEventListenerManager) +NS_INTERFACE_MAP_BEGIN(nsEventListenerManager) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIEventListenerManager) + NS_INTERFACE_MAP_ENTRY(nsIEventListenerManager) + NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget) + NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver) +NS_INTERFACE_MAP_END nsVoidArray** nsEventListenerManager::GetListenersByIID(const nsIID& aIID) { @@ -1200,7 +1205,9 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext, case NS_PAGE_LOAD: case NS_PAGE_UNLOAD: - + case NS_IMAGE_LOAD: + case NS_IMAGE_ERROR: + if (nsnull != mLoadListeners) { if (nsnull == *aDOMEvent) { ret = NS_NewDOMUIEvent(aDOMEvent, aPresContext, aEvent); @@ -1216,11 +1223,14 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext, if (NS_OK == ls->mListener->QueryInterface(kIDOMLoadListenerIID, (void**)&mLoadListener)) { switch(aEvent->message) { case NS_PAGE_LOAD: + case NS_IMAGE_LOAD: ret = mLoadListener->Load(*aDOMEvent); break; case NS_PAGE_UNLOAD: ret = mLoadListener->Unload(*aDOMEvent); break; + case NS_IMAGE_ERROR: + ret = mLoadListener->Error(*aDOMEvent); default: break; } @@ -1231,6 +1241,7 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext, PRUint32 subType = 0; switch(aEvent->message) { case NS_PAGE_LOAD: + case NS_IMAGE_LOAD: subType = NS_EVENT_BITS_LOAD_LOAD; if (ls->mSubType & NS_EVENT_BITS_LOAD_LOAD) { correctSubType = PR_TRUE; @@ -1242,6 +1253,12 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext, correctSubType = PR_TRUE; } break; + case NS_IMAGE_ERROR: + subType = NS_EVENT_BITS_LOAD_ERROR; + if (ls->mSubType & NS_EVENT_BITS_LOAD_ERROR) { + correctSubType = PR_TRUE; + } + break; default: break; } @@ -1733,6 +1750,62 @@ nsresult nsEventListenerManager::RemoveAllListeners(PRBool aScriptOnly) return NS_OK; } +// nsIDOMEventTarget interface +NS_IMETHODIMP +nsEventListenerManager::AddEventListener(const nsString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) +{ + PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; + + return AddEventListenerByType(aListener, aType, flags); +} + +NS_IMETHODIMP +nsEventListenerManager::RemoveEventListener(const nsString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) +{ + PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; + + return RemoveEventListenerByType(aListener, aType, flags); +} + +// nsIDOMEventReceiver interface +NS_IMETHODIMP +nsEventListenerManager::AddEventListenerByIID(nsIDOMEventListener *aListener, + const nsIID& aIID) +{ + return AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); +} + +NS_IMETHODIMP +nsEventListenerManager::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID) +{ + return RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); +} + +NS_IMETHODIMP +nsEventListenerManager::GetListenerManager(nsIEventListenerManager** aInstancePtrResult) +{ + NS_ENSURE_ARG_POINTER(aInstancePtrResult); + *aInstancePtrResult = NS_STATIC_CAST(nsIEventListenerManager*, this); + NS_ADDREF(*aInstancePtrResult); + return NS_OK; +} + +NS_IMETHODIMP +nsEventListenerManager::GetNewListenerManager(nsIEventListenerManager **aInstancePtrResult) +{ + return NS_NewEventListenerManager(aInstancePtrResult); +} + +NS_IMETHODIMP +nsEventListenerManager::HandleEvent(nsIDOMEvent *aEvent) +{ + return NS_ERROR_FAILURE; +} + NS_HTML nsresult NS_NewEventListenerManager(nsIEventListenerManager** aInstancePtrResult) { nsIEventListenerManager* l = new nsEventListenerManager(); @@ -1747,3 +1820,4 @@ NS_HTML nsresult NS_NewEventListenerManager(nsIEventListenerManager** aInstanceP return NS_ERROR_FAILURE; } + diff --git a/content/events/src/nsEventListenerManager.h b/content/events/src/nsEventListenerManager.h index 5c822fd1a75..d9662e7fcfc 100644 --- a/content/events/src/nsEventListenerManager.h +++ b/content/events/src/nsEventListenerManager.h @@ -27,6 +27,7 @@ #include "jsapi.h" #include "nsCOMPtr.h" #include "nsIPrincipal.h" +#include "nsIDOMEventReceiver.h" class nsIDOMEvent; class nsIAtom; @@ -46,7 +47,9 @@ typedef struct { * Event listener manager */ -class nsEventListenerManager : public nsIEventListenerManager { +class nsEventListenerManager : public nsIEventListenerManager, + public nsIDOMEventReceiver +{ public: nsEventListenerManager(); @@ -102,6 +105,21 @@ public: static nsresult GetIdentifiersForType(nsIAtom* aType, nsIID& aIID, PRInt32* aSubType); + // nsIDOMEventTarget interface + NS_IMETHOD AddEventListener(const nsString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture); + NS_IMETHOD RemoveEventListener(const nsString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture); + + // nsIDOMEventReceiver interface + NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID); + NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID); + NS_IMETHOD GetListenerManager(nsIEventListenerManager** aInstancePtrResult); + NS_IMETHOD GetNewListenerManager(nsIEventListenerManager **aInstancePtrResult); + NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent); + protected: nsresult HandleEventSubType(nsListenerStruct* aListenerStruct, nsIDOMEvent* aDOMEvent, diff --git a/content/html/content/src/nsAttributeContent.cpp b/content/html/content/src/nsAttributeContent.cpp index b95c61f6027..6fbdaea5a6e 100644 --- a/content/html/content/src/nsAttributeContent.cpp +++ b/content/html/content/src/nsAttributeContent.cpp @@ -74,7 +74,7 @@ static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID); static NS_DEFINE_IID(kITextContentIID, NS_ITEXT_CONTENT_IID); -class nsAttributeContent : public nsIContent, public nsITextContent, public nsIAttributeContent { +class nsAttributeContent : public nsITextContent, public nsIAttributeContent { public: friend nsresult NS_NewAttributeContent(nsAttributeContent** aNewFrame); diff --git a/content/html/content/src/nsHTMLAnchorElement.cpp b/content/html/content/src/nsHTMLAnchorElement.cpp index 24979aec6e7..c03407b18a7 100644 --- a/content/html/content/src/nsHTMLAnchorElement.cpp +++ b/content/html/content/src/nsHTMLAnchorElement.cpp @@ -20,6 +20,7 @@ * Contributor(s): */ #include "nsIDOMHTMLAnchorElement.h" +#include "nsIDOMNSHTMLAnchorElement.h" #include "nsIScriptObjectOwner.h" #include "nsIDOMEventReceiver.h" #include "nsIHTMLContent.h" @@ -30,7 +31,7 @@ #include "nsIMutableStyleContext.h" #include "nsStyleConsts.h" #include "nsIPresContext.h" -#include "nsINameSpaceManager.h" +#include "nsIEventStateManager.h" #include "nsIURL.h" #include "nsIFocusableContent.h" @@ -52,8 +53,8 @@ static NS_DEFINE_IID(kIDOMHTMLAnchorElementIID, NS_IDOMHTMLANCHORELEMENT_IID); static NS_DEFINE_IID(kIFocusableContentIID, NS_IFOCUSABLECONTENT_IID); class nsHTMLAnchorElement : public nsIDOMHTMLAnchorElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIDOMNSHTMLAnchorElement, + public nsIJSScriptObject, public nsIHTMLContent, public nsIFocusableContent { @@ -101,11 +102,18 @@ public: NS_IMETHOD Blur(); NS_IMETHOD Focus(); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + // nsIDOMNSHTMLAnchorElement + NS_IMETHOD GetProtocol(nsString& aProtocol); + NS_IMETHOD GetHost(nsString& aHost); + NS_IMETHOD GetHostname(nsString& aHostname); + NS_IMETHOD GetPathname(nsString& aPathname); + NS_IMETHOD GetSearch(nsString& aSearch); + NS_IMETHOD GetPort(nsString& aPort); + NS_IMETHOD GetHash(nsString& aHash); + NS_IMETHOD GetText(nsString& aText); - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) @@ -165,6 +173,11 @@ nsHTMLAnchorElement::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_ADDREF_THIS(); return NS_OK; } + else if (aIID.Equals(NS_GET_IID(nsIDOMNSHTMLAnchorElement))) { + *aInstancePtr = (void*)(nsIDOMNSHTMLAnchorElement*) this; + NS_ADDREF_THIS(); + return NS_OK; + } return NS_NOINTERFACE; } @@ -383,3 +396,205 @@ nsHTMLAnchorElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const { return mInner.SizeOf(aSizer, aResult, sizeof(*this)); } + +NS_IMETHODIMP +nsHTMLAnchorElement::GetProtocol(nsString& aProtocol) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + char* protocol; + result = url->GetScheme(&protocol); + if (result == NS_OK) { + aProtocol.SetString(protocol); + aProtocol.Append(":"); + nsCRT::free(protocol); + } + NS_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAnchorElement::GetHost(nsString& aHost) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + char* host; + result = url->GetHost(&host); + if (result == NS_OK) { + aHost.SetString(host); + nsCRT::free(host); + PRInt32 port; + (void)url->GetPort(&port); + if (-1 != port) { + aHost.Append(":"); + aHost.Append(port, 10); + } + } + NS_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAnchorElement::GetHostname(nsString& aHostname) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + char* host; + result = url->GetHost(&host); + if (result == NS_OK) { + aHostname.SetString(host); + nsCRT::free(host); + } + NS_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAnchorElement::GetPathname(nsString& aPathname) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + char* file; + result = url->GetPath(&file); + if (result == NS_OK) { + aPathname.SetString(file); + nsCRT::free(file); + } + NS_IF_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAnchorElement::GetSearch(nsString& aSearch) +{ + nsAutoString href; + nsIURI *uri; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&uri, href); + if (NS_OK == result) { + char *search; + nsIURL* url; + result = uri->QueryInterface(NS_GET_IID(nsIURL), (void**)&url); + if (NS_SUCCEEDED(result)) { + result = url->GetQuery(&search); + NS_RELEASE(url); + } + if (result == NS_OK && (nsnull != search) && ('\0' != *search)) { + aSearch.SetString("?"); + aSearch.Append(search); + nsCRT::free(search); + } + else { + aSearch.SetLength(0); + } + NS_RELEASE(uri); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAnchorElement::GetPort(nsString& aPort) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + aPort.SetLength(0); + PRInt32 port; + (void)url->GetPort(&port); + if (-1 != port) { + aPort.Append(port, 10); + } + NS_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAnchorElement::GetHash(nsString& aHash) +{ + nsAutoString href; + nsIURI *uri; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&uri, href); + + if (NS_OK == result) { + char *ref; + nsIURL* url; + result = uri->QueryInterface(NS_GET_IID(nsIURL), (void**)&url); + if (NS_SUCCEEDED(result)) { + result = url->GetRef(&ref); + NS_RELEASE(url); + } + if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) { + aHash.SetString("#"); + aHash.Append(ref); + nsCRT::free(ref); + } + else { + aHash.SetLength(0); + } + NS_RELEASE(uri); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAnchorElement::GetText(nsString& aText) +{ + // XXX TBI + return NS_ERROR_NOT_IMPLEMENTED; +} + diff --git a/content/html/content/src/nsHTMLAppletElement.cpp b/content/html/content/src/nsHTMLAppletElement.cpp index 9c0174ab035..a1add16f7c0 100644 --- a/content/html/content/src/nsHTMLAppletElement.cpp +++ b/content/html/content/src/nsHTMLAppletElement.cpp @@ -52,8 +52,7 @@ static NS_DEFINE_IID(kIDOMHTMLAppletElementIID, NS_IDOMHTMLAPPLETELEMENT_IID); class nsHTMLAppletElement : public nsIDOMHTMLAppletElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -96,14 +95,40 @@ public: NS_IMETHOD GetWidth(nsString& aWidth); NS_IMETHOD SetWidth(const nsString& aWidth); - // nsIScriptObjectOwner + // nsIJSScriptObject + virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, + jsval aID, jsval *aVp) { + return mInner.AddProperty(aContext, aObj, aID, aVp); + } + virtual PRBool DeleteProperty(JSContext *aContext, JSObject *aObj, + jsval aID, jsval *aVp) { + return mInner.DeleteProperty(aContext, aObj, aID, aVp); + } + virtual PRBool GetProperty(JSContext *aContext, JSObject *aObj, + jsval aID, jsval *aVp) { + return mInner.GetProperty(aContext, aObj, aID, aVp); + } + virtual PRBool SetProperty(JSContext *aContext, JSObject *aObj, + jsval aID, jsval *aVp) { + return mInner.SetProperty(aContext, aObj, aID, aVp); + } + virtual PRBool EnumerateProperty(JSContext *aContext, JSObject *aObj) { + return mInner.EnumerateProperty(aContext, aObj); + } + virtual PRBool Resolve(JSContext *aContext, JSObject *aObj, jsval aID) { + return mInner.EnumerateProperty(aContext, aObj); + } + virtual PRBool Convert(JSContext *aContext, JSObject *aObj, jsval aID) { + return mInner.EnumerateProperty(aContext, aObj); + } + virtual void Finalize(JSContext *aContext, JSObject *aObj) { + mInner.Finalize(aContext, aObj); + } + NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); NS_IMETHOD SetScriptObject(void *aScriptObject); - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) - // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLAreaElement.cpp b/content/html/content/src/nsHTMLAreaElement.cpp index 71e162b80f8..f9de7e5f146 100644 --- a/content/html/content/src/nsHTMLAreaElement.cpp +++ b/content/html/content/src/nsHTMLAreaElement.cpp @@ -20,6 +20,7 @@ * Contributor(s): */ #include "nsIDOMHTMLAreaElement.h" +#include "nsIDOMNSHTMLAreaElement.h" #include "nsIScriptObjectOwner.h" #include "nsIDOMEventReceiver.h" #include "nsIHTMLContent.h" @@ -32,13 +33,14 @@ #include "nsIPresContext.h" #include "nsIFocusableContent.h" #include "nsIEventStateManager.h" +#include "nsIURL.h" +#include "nsNetUtil.h" static NS_DEFINE_IID(kIDOMHTMLAreaElementIID, NS_IDOMHTMLAREAELEMENT_IID); static NS_DEFINE_IID(kIFocusableContentIID, NS_IFOCUSABLECONTENT_IID); class nsHTMLAreaElement : public nsIDOMHTMLAreaElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIFocusableContent { @@ -76,11 +78,17 @@ public: NS_IMETHOD GetTarget(nsString& aTarget); NS_IMETHOD SetTarget(const nsString& aTarget); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + // nsIDOMNSHTMLAreaElement + NS_IMETHOD GetProtocol(nsString& aProtocol); + NS_IMETHOD GetHost(nsString& aHost); + NS_IMETHOD GetHostname(nsString& aHostname); + NS_IMETHOD GetPathname(nsString& aPathname); + NS_IMETHOD GetSearch(nsString& aSearch); + NS_IMETHOD GetPort(nsString& aPort); + NS_IMETHOD GetHash(nsString& aHash); - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) @@ -140,6 +148,11 @@ nsHTMLAreaElement::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_ADDREF_THIS(); return NS_OK; } + else if (aIID.Equals(NS_GET_IID(nsIDOMNSHTMLAreaElement))) { + *aInstancePtr = (void*)(nsIDOMNSHTMLAreaElement*) this; + NS_ADDREF_THIS(); + return NS_OK; + } return NS_NOINTERFACE; } @@ -259,3 +272,197 @@ nsHTMLAreaElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const { return mInner.SizeOf(aSizer, aResult, sizeof(*this)); } + +NS_IMETHODIMP +nsHTMLAreaElement::GetProtocol(nsString& aProtocol) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + char* protocol; + result = url->GetScheme(&protocol); + if (result == NS_OK) { + aProtocol.SetString(protocol); + aProtocol.Append(":"); + nsCRT::free(protocol); + } + NS_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAreaElement::GetHost(nsString& aHost) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + char* host; + result = url->GetHost(&host); + if (result == NS_OK) { + aHost.SetString(host); + nsCRT::free(host); + PRInt32 port; + (void)url->GetPort(&port); + if (-1 != port) { + aHost.Append(":"); + aHost.Append(port, 10); + } + } + NS_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAreaElement::GetHostname(nsString& aHostname) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + char* host; + result = url->GetHost(&host); + if (result == NS_OK) { + aHostname.SetString(host); + nsCRT::free(host); + } + NS_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAreaElement::GetPathname(nsString& aPathname) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + char* file; + result = url->GetPath(&file); + if (result == NS_OK) { + aPathname.SetString(file); + nsCRT::free(file); + } + NS_IF_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAreaElement::GetSearch(nsString& aSearch) +{ + nsAutoString href; + nsIURI *uri; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&uri, href); + if (NS_OK == result) { + char *search; + nsIURL* url; + result = uri->QueryInterface(NS_GET_IID(nsIURL), (void**)&url); + if (NS_SUCCEEDED(result)) { + result = url->GetQuery(&search); + NS_RELEASE(url); + } + if (result == NS_OK && (nsnull != search) && ('\0' != *search)) { + aSearch.SetString("?"); + aSearch.Append(search); + nsCRT::free(search); + } + else { + aSearch.SetLength(0); + } + NS_RELEASE(uri); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAreaElement::GetPort(nsString& aPort) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + aPort.SetLength(0); + PRInt32 port; + (void)url->GetPort(&port); + if (-1 != port) { + aPort.Append(port, 10); + } + NS_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAreaElement::GetHash(nsString& aHash) +{ + nsAutoString href; + nsIURI *uri; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&uri, href); + + if (NS_OK == result) { + char *ref; + nsIURL* url; + result = uri->QueryInterface(NS_GET_IID(nsIURL), (void**)&url); + if (NS_SUCCEEDED(result)) { + result = url->GetRef(&ref); + NS_RELEASE(url); + } + if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) { + aHash.SetString("#"); + aHash.Append(ref); + nsCRT::free(ref); + } + else { + aHash.SetLength(0); + } + NS_RELEASE(uri); + } + } + + return result; +} diff --git a/content/html/content/src/nsHTMLBRElement.cpp b/content/html/content/src/nsHTMLBRElement.cpp index c15b73c34d0..edeb0537f3b 100644 --- a/content/html/content/src/nsHTMLBRElement.cpp +++ b/content/html/content/src/nsHTMLBRElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLBRElementIID, NS_IDOMHTMLBRELEMENT_IID); class nsHTMLBRElement : public nsIDOMHTMLBRElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -59,11 +58,8 @@ public: NS_IMETHOD GetClear(nsString& aClear); NS_IMETHOD SetClear(const nsString& aClear); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLBaseElement.cpp b/content/html/content/src/nsHTMLBaseElement.cpp index fc040839e5f..db9e73fd911 100644 --- a/content/html/content/src/nsHTMLBaseElement.cpp +++ b/content/html/content/src/nsHTMLBaseElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLBaseElementIID, NS_IDOMHTMLBASEELEMENT_IID); class nsHTMLBaseElement : public nsIDOMHTMLBaseElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -60,11 +59,8 @@ public: NS_IMETHOD GetTarget(nsString& aTarget); NS_IMETHOD SetTarget(const nsString& aTarget); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLBaseFontElement.cpp b/content/html/content/src/nsHTMLBaseFontElement.cpp index 17f4f79aca3..b31d7df211f 100644 --- a/content/html/content/src/nsHTMLBaseFontElement.cpp +++ b/content/html/content/src/nsHTMLBaseFontElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLBaseFontElementIID, NS_IDOMHTMLBASEFONTELEMENT_IID); class nsHTMLBaseFontElement : public nsIDOMHTMLBaseFontElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -62,11 +61,8 @@ public: NS_IMETHOD GetSize(nsString& aSize); NS_IMETHOD SetSize(const nsString& aSize); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLBodyElement.cpp b/content/html/content/src/nsHTMLBodyElement.cpp index 2f5c484c79f..5c9385e7c59 100644 --- a/content/html/content/src/nsHTMLBodyElement.cpp +++ b/content/html/content/src/nsHTMLBodyElement.cpp @@ -44,6 +44,7 @@ #include "nsIHTMLAttributes.h" #include "nsIHTMLContentContainer.h" #include "nsISupportsArray.h" +#include "nsIFrame.h" #include "nsIDocShell.h" static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID); @@ -162,8 +163,7 @@ nsresult nsBodyInner::SetDocument(nsIDocument* aDocument, PRBool aDeep) //---------------------------------------------------------------------- class nsHTMLBodyElement : public nsIDOMHTMLBodyElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -196,11 +196,8 @@ public: NS_IMETHOD GetVLink(nsString& aVLink); NS_IMETHOD SetVLink(const nsString& aVLink); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) @@ -599,11 +596,65 @@ nsHTMLBodyElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMPL_STRING_ATTR(nsHTMLBodyElement, ALink, alink) NS_IMPL_STRING_ATTR(nsHTMLBodyElement, Background, background) -NS_IMPL_STRING_ATTR(nsHTMLBodyElement, BgColor, bgcolor) NS_IMPL_STRING_ATTR(nsHTMLBodyElement, Link, link) NS_IMPL_STRING_ATTR(nsHTMLBodyElement, Text, text) NS_IMPL_STRING_ATTR(nsHTMLBodyElement, VLink, vlink) +NS_IMETHODIMP +nsHTMLBodyElement::GetBgColor(nsString& aBgColor) +{ + // If we don't have an attribute, find the actual color used for + // (generally from the user agent style sheet) for compatibility + if (NS_CONTENT_ATTR_NOT_THERE == mInner.GetAttribute(kNameSpaceID_None, nsHTMLAtoms::bgcolor, aBgColor)) { + nsresult result = NS_OK; + if (mInner.mDocument) { + // Make sure the presentation is up-to-date + result = mInner.mDocument->FlushPendingNotifications(); + if (NS_FAILED(result)) { + return result; + } + } + + nsCOMPtr context; + result = nsGenericHTMLElement::GetPresContext(this, + getter_AddRefs(context)); + if (NS_FAILED(result)) { + return result; + } + + nsCOMPtr shell; + result = context->GetShell(getter_AddRefs(shell)); + if (NS_FAILED(result)) { + return result; + } + + nsIFrame* frame; + result = shell->GetPrimaryFrameFor(this, &frame); + if (NS_FAILED(result)) { + return result; + } + + if (frame) { + const nsStyleColor* styleColor; + result = frame->GetStyleData(eStyleStruct_Color, (const nsStyleStruct*&)styleColor); + if (NS_FAILED(result)) { + return result; + } + + nsHTMLValue value(styleColor->mBackgroundColor); + nsGenericHTMLElement::ColorToString(value, aBgColor); + } + } + + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLBodyElement::SetBgColor(const nsString& aBgColor) +{ + return mInner.SetAttribute(kNameSpaceID_None, nsHTMLAtoms::bgcolor, aBgColor, PR_TRUE); +} + NS_IMETHODIMP nsHTMLBodyElement::StringToAttribute(nsIAtom* aAttribute, const nsString& aValue, diff --git a/content/html/content/src/nsHTMLButtonElement.cpp b/content/html/content/src/nsHTMLButtonElement.cpp index f90dc0c69f5..7f5d1c90b1e 100644 --- a/content/html/content/src/nsHTMLButtonElement.cpp +++ b/content/html/content/src/nsHTMLButtonElement.cpp @@ -46,8 +46,7 @@ static NS_DEFINE_IID(kIDOMHTMLButtonElementIID, NS_IDOMHTMLBUTTONELEMENT_IID); static NS_DEFINE_IID(kIFocusableContentIID, NS_IFOCUSABLECONTENT_IID); class nsHTMLButtonElement : public nsIDOMHTMLButtonElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIFormControl, public nsIFocusableContent @@ -86,11 +85,8 @@ public: NS_IMETHOD Blur(); NS_IMETHOD Focus(); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLDListElement.cpp b/content/html/content/src/nsHTMLDListElement.cpp index c149b11e7e8..ac47063a793 100644 --- a/content/html/content/src/nsHTMLDListElement.cpp +++ b/content/html/content/src/nsHTMLDListElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLDListElementIID, NS_IDOMHTMLDLISTELEMENT_IID); class nsHTMLDListElement : public nsIDOMHTMLDListElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -59,11 +58,8 @@ public: NS_IMETHOD GetCompact(PRBool* aCompact); NS_IMETHOD SetCompact(PRBool aCompact); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLDelElement.cpp b/content/html/content/src/nsHTMLDelElement.cpp index ddbda9ccf73..cefbeaec813 100644 --- a/content/html/content/src/nsHTMLDelElement.cpp +++ b/content/html/content/src/nsHTMLDelElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLModElementIID, NS_IDOMHTMLMODELEMENT_IID); class nsHTMLDelElement : public nsIDOMHTMLModElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -60,11 +59,8 @@ public: NS_IMETHOD GetDateTime(nsString& aDateTime); NS_IMETHOD SetDateTime(const nsString& aDateTime); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLDirectoryElement.cpp b/content/html/content/src/nsHTMLDirectoryElement.cpp index 874ed8d247d..b81d442cf4d 100644 --- a/content/html/content/src/nsHTMLDirectoryElement.cpp +++ b/content/html/content/src/nsHTMLDirectoryElement.cpp @@ -39,8 +39,7 @@ extern nsGenericHTMLElement::EnumTable kListTypeTable[]; static NS_DEFINE_IID(kIDOMHTMLDirectoryElementIID, NS_IDOMHTMLDIRECTORYELEMENT_IID); class nsHTMLDirectoryElement : public nsIDOMHTMLDirectoryElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -63,11 +62,8 @@ public: NS_IMETHOD GetCompact(PRBool* aCompact); NS_IMETHOD SetCompact(PRBool aCompact); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLDivElement.cpp b/content/html/content/src/nsHTMLDivElement.cpp index cabd680317d..aeaf5fd299a 100644 --- a/content/html/content/src/nsHTMLDivElement.cpp +++ b/content/html/content/src/nsHTMLDivElement.cpp @@ -37,8 +37,7 @@ static NS_DEFINE_IID(kIDOMHTMLDivElementIID, NS_IDOMHTMLDIVELEMENT_IID); class nsHTMLDivElement : public nsIDOMHTMLDivElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -61,11 +60,8 @@ public: NS_IMETHOD GetAlign(nsString& aAlign); NS_IMETHOD SetAlign(const nsString& aAlign); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLEmbedElement.cpp b/content/html/content/src/nsHTMLEmbedElement.cpp index 0c066f9b7b9..4b4c4ac0764 100644 --- a/content/html/content/src/nsHTMLEmbedElement.cpp +++ b/content/html/content/src/nsHTMLEmbedElement.cpp @@ -36,8 +36,7 @@ //static NS_DEFINE_IID(kIDOMHTMLEmbedElementIID, NS_IDOMHTMLEmbedELEMENT_IID); class nsHTMLEmbedElement : public nsIDOMHTMLElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -58,11 +57,8 @@ public: // nsIDOMHTMLEmbedElement - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLFieldSetElement.cpp b/content/html/content/src/nsHTMLFieldSetElement.cpp index 27247697237..8041c036272 100644 --- a/content/html/content/src/nsHTMLFieldSetElement.cpp +++ b/content/html/content/src/nsHTMLFieldSetElement.cpp @@ -41,8 +41,7 @@ static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID); static NS_DEFINE_IID(kIFormIID, NS_IFORM_IID); class nsHTMLFieldSetElement : public nsIDOMHTMLFieldSetElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIFormControl { @@ -66,11 +65,8 @@ public: NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLFontElement.cpp b/content/html/content/src/nsHTMLFontElement.cpp index 92d14556a6b..f5bf19e2815 100644 --- a/content/html/content/src/nsHTMLFontElement.cpp +++ b/content/html/content/src/nsHTMLFontElement.cpp @@ -38,8 +38,7 @@ static NS_DEFINE_IID(kIDOMHTMLFontElementIID, NS_IDOMHTMLFONTELEMENT_IID); class nsHTMLFontElement : public nsIDOMHTMLFontElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -66,11 +65,8 @@ public: NS_IMETHOD GetSize(nsString& aSize); NS_IMETHOD SetSize(const nsString& aSize); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index 8db02284d4e..1f6b1229f07 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -57,11 +57,9 @@ class nsFormControlList; class nsHTMLFormElement : public nsIDOMHTMLFormElement, public nsIDOMNSHTMLFormElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, - public nsIForm, - public nsIJSScriptObject + public nsIForm { public: nsHTMLFormElement(nsIAtom* aTag); @@ -102,11 +100,6 @@ public: NS_IMETHOD Item(PRUint32 aIndex, nsIDOMElement** aReturn); NS_IMETHOD NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, jsval* aReturn); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) @@ -115,18 +108,19 @@ public: NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) // nsIJSScriptObject - PRBool AddProperty(JSContext *aContext, JSObject *aObj, + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); - PRBool DeleteProperty(JSContext *aContext, JSObject *aObj, + virtual PRBool DeleteProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); - PRBool GetProperty(JSContext *aContext, JSObject *aObj, + virtual PRBool GetProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); - PRBool SetProperty(JSContext *aContext, JSObject *aObj, + virtual PRBool SetProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); - PRBool EnumerateProperty(JSContext *aContext, JSObject *aObj); - PRBool Resolve(JSContext *aContext, JSObject *aObj, jsval aID); - PRBool Convert(JSContext *aContext, JSObject *aObj, jsval aID); - void Finalize(JSContext *aContext, JSObject *aObj); + virtual PRBool EnumerateProperty(JSContext *aContext, JSObject *aObj); + virtual PRBool Resolve(JSContext *aContext, JSObject *aObj, jsval aID); + virtual PRBool Convert(JSContext *aContext, JSObject *aObj, jsval aID); + virtual void Finalize(JSContext *aContext, JSObject *aObj); // nsIForm NS_IMETHOD AddElement(nsIFormControl* aElement); diff --git a/content/html/content/src/nsHTMLFrameElement.cpp b/content/html/content/src/nsHTMLFrameElement.cpp index 76f9933c7f6..ddc374e61de 100644 --- a/content/html/content/src/nsHTMLFrameElement.cpp +++ b/content/html/content/src/nsHTMLFrameElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLFrameElementIID, NS_IDOMHTMLFRAMEELEMENT_IID); class nsHTMLFrameElement : public nsIDOMHTMLFrameElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIChromeEventHandler { @@ -74,11 +73,8 @@ public: NS_IMETHOD GetSrc(nsString& aSrc); NS_IMETHOD SetSrc(const nsString& aSrc); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLFrameSetElement.cpp b/content/html/content/src/nsHTMLFrameSetElement.cpp index 1c98117e633..3c7a843c381 100644 --- a/content/html/content/src/nsHTMLFrameSetElement.cpp +++ b/content/html/content/src/nsHTMLFrameSetElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLFrameSetElementIID, NS_IDOMHTMLFRAMESETELEMENT_IID); class nsHTMLFrameSetElement : public nsIDOMHTMLFrameSetElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -60,11 +59,8 @@ public: NS_IMETHOD GetRows(nsString& aRows); NS_IMETHOD SetRows(const nsString& aRows); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLHRElement.cpp b/content/html/content/src/nsHTMLHRElement.cpp index 35ed40e6555..ac6e3c1581c 100644 --- a/content/html/content/src/nsHTMLHRElement.cpp +++ b/content/html/content/src/nsHTMLHRElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLHRElementIID, NS_IDOMHTMLHRELEMENT_IID); class nsHTMLHRElement : public nsIDOMHTMLHRElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -65,11 +64,8 @@ public: NS_IMETHOD GetWidth(nsString& aWidth); NS_IMETHOD SetWidth(const nsString& aWidth); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLHeadElement.cpp b/content/html/content/src/nsHTMLHeadElement.cpp index 6e2665efcf4..2bdf61f9203 100644 --- a/content/html/content/src/nsHTMLHeadElement.cpp +++ b/content/html/content/src/nsHTMLHeadElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLHeadElementIID, NS_IDOMHTMLHEADELEMENT_IID); class nsHTMLHeadElement : public nsIDOMHTMLHeadElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -58,11 +57,8 @@ public: NS_IMETHOD GetProfile(nsString& aProfile); NS_IMETHOD SetProfile(const nsString& aProfile); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLHeadingElement.cpp b/content/html/content/src/nsHTMLHeadingElement.cpp index 43107ebdcc2..713c6c29069 100644 --- a/content/html/content/src/nsHTMLHeadingElement.cpp +++ b/content/html/content/src/nsHTMLHeadingElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLHeadingElementIID, NS_IDOMHTMLHEADINGELEMENT_IID); class nsHTMLHeadingElement : public nsIDOMHTMLHeadingElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -59,11 +58,8 @@ public: NS_IMETHOD GetAlign(nsString& aAlign); NS_IMETHOD SetAlign(const nsString& aAlign); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLHtmlElement.cpp b/content/html/content/src/nsHTMLHtmlElement.cpp index 62079d6efe6..b7ca3750486 100644 --- a/content/html/content/src/nsHTMLHtmlElement.cpp +++ b/content/html/content/src/nsHTMLHtmlElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLHtmlElementIID, NS_IDOMHTMLHTMLELEMENT_IID); class nsHTMLHtmlElement : public nsIDOMHTMLHtmlElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -59,11 +58,8 @@ public: NS_IMETHOD GetVersion(nsString& aVersion); NS_IMETHOD SetVersion(const nsString& aVersion); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLIFrameElement.cpp b/content/html/content/src/nsHTMLIFrameElement.cpp index 2c41bd9e2c8..840ed22be26 100644 --- a/content/html/content/src/nsHTMLIFrameElement.cpp +++ b/content/html/content/src/nsHTMLIFrameElement.cpp @@ -36,8 +36,7 @@ static NS_DEFINE_IID(kIDOMHTMLIFrameElementIID, NS_IDOMHTMLIFRAMEELEMENT_IID); class nsHTMLIFrameElement : public nsIDOMHTMLIFrameElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIChromeEventHandler { @@ -79,11 +78,8 @@ public: NS_IMETHOD GetWidth(nsString& aWidth); NS_IMETHOD SetWidth(const nsString& aWidth); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLImageElement.cpp b/content/html/content/src/nsHTMLImageElement.cpp index 059693201be..2d3afb9d49d 100644 --- a/content/html/content/src/nsHTMLImageElement.cpp +++ b/content/html/content/src/nsHTMLImageElement.cpp @@ -64,10 +64,8 @@ static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID); class nsHTMLImageElement : public nsIDOMHTMLImageElement, public nsIDOMImage, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, - public nsIHTMLContent, public nsIJSScriptObject, + public nsIHTMLContent, public nsIJSNativeInitializer { public: @@ -120,11 +118,6 @@ public: NS_IMETHOD SetLowsrc(const nsString& aLowsrc); NS_IMETHOD GetComplete(PRBool* aComplete); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_NO_SETDOCUMENT_USING_GENERIC(mInner) @@ -133,18 +126,19 @@ public: NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) // nsIJSScriptObject - PRBool AddProperty(JSContext *aContext, JSObject *aObj, + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); - PRBool DeleteProperty(JSContext *aContext, JSObject *aObj, + virtual PRBool DeleteProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); - PRBool GetProperty(JSContext *aContext, JSObject *aObj, + virtual PRBool GetProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); - PRBool SetProperty(JSContext *aContext, JSObject *aObj, + virtual PRBool SetProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); - PRBool EnumerateProperty(JSContext *aContext, JSObject *aObj); - PRBool Resolve(JSContext *aContext, JSObject *aObj, jsval aID); - PRBool Convert(JSContext *aContext, JSObject *aObj, jsval aID); - void Finalize(JSContext *aContext, JSObject *aObj); + virtual PRBool EnumerateProperty(JSContext *aContext, JSObject *aObj); + virtual PRBool Resolve(JSContext *aContext, JSObject *aObj, jsval aID); + virtual PRBool Convert(JSContext *aContext, JSObject *aObj, jsval aID); + virtual void Finalize(JSContext *aContext, JSObject *aObj); // nsIJSNativeInitializer NS_IMETHOD Initialize(JSContext* aContext, JSObject *aObj, @@ -545,10 +539,9 @@ nsHTMLImageElement::GetCallerSourceURL(JSContext* cx, if (doc) { result = doc->GetBaseURL(*sourceURL); - } - - if (!*sourceURL) { - *sourceURL = doc->GetDocumentURL(); + if (!*sourceURL) { + *sourceURL = doc->GetDocumentURL(); + } } } } diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index 79e2b8e75be..0161babbc34 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -71,8 +71,7 @@ static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID); class nsHTMLInputElement : public nsIDOMHTMLInputElement, public nsIDOMNSHTMLInputElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIFormControl, public nsIFocusableContent, @@ -163,6 +162,7 @@ public: NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); NS_IMETHOD GetType(nsString& aType); + NS_IMETHOD SetType(const nsString& aType); NS_IMETHOD GetUseMap(nsString& aUseMap); NS_IMETHOD SetUseMap(const nsString& aUseMap); NS_IMETHOD GetValue(nsString& aValue); @@ -178,11 +178,8 @@ public: // nsIDOMNSHTMLInputElement NS_DECL_IDOMNSHTMLINPUTELEMENT - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner) @@ -411,15 +408,9 @@ NS_IMPL_STRING_ATTR(nsHTMLInputElement, Size, size) NS_IMPL_STRING_ATTR(nsHTMLInputElement, Src, src) NS_IMPL_INT_ATTR(nsHTMLInputElement, TabIndex, tabindex) NS_IMPL_STRING_ATTR(nsHTMLInputElement, UseMap, usemap) +NS_IMPL_STRING_ATTR(nsHTMLInputElement, Type, type) //NS_IMPL_STRING_ATTR(nsHTMLInputElement, Value, value) -NS_IMETHODIMP -nsHTMLInputElement::GetType(nsString& aValue) -{ - mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::type, aValue); - return NS_OK; -} - NS_IMETHODIMP nsHTMLInputElement::GetValue(nsString& aValue) { diff --git a/content/html/content/src/nsHTMLInsElement.cpp b/content/html/content/src/nsHTMLInsElement.cpp index fd7e79407ca..bf55fed6e19 100644 --- a/content/html/content/src/nsHTMLInsElement.cpp +++ b/content/html/content/src/nsHTMLInsElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLModElementIID, NS_IDOMHTMLMODELEMENT_IID); class nsHTMLInsElement : public nsIDOMHTMLModElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -60,11 +59,8 @@ public: NS_IMETHOD GetDateTime(nsString& aDateTime); NS_IMETHOD SetDateTime(const nsString& aDateTime); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLIsIndexElement.cpp b/content/html/content/src/nsHTMLIsIndexElement.cpp index a242484ff84..c7a00fb2cbc 100644 --- a/content/html/content/src/nsHTMLIsIndexElement.cpp +++ b/content/html/content/src/nsHTMLIsIndexElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLIsIndexElementIID, NS_IDOMHTMLISINDEXELEMENT_IID); class nsHTMLIsIndexElement : public nsIDOMHTMLIsIndexElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -59,11 +58,8 @@ public: NS_IMETHOD GetPrompt(nsString& aPrompt); NS_IMETHOD SetPrompt(const nsString& aPrompt); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLLIElement.cpp b/content/html/content/src/nsHTMLLIElement.cpp index 9d7de9e1a63..759f775af3b 100644 --- a/content/html/content/src/nsHTMLLIElement.cpp +++ b/content/html/content/src/nsHTMLLIElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLLIElementIID, NS_IDOMHTMLLIELEMENT_IID); class nsHTMLLIElement : public nsIDOMHTMLLIElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -61,11 +60,8 @@ public: NS_IMETHOD GetValue(PRInt32* aValue); NS_IMETHOD SetValue(PRInt32 aValue); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLLabelElement.cpp b/content/html/content/src/nsHTMLLabelElement.cpp index 4812abede9b..55a6bdf6acd 100644 --- a/content/html/content/src/nsHTMLLabelElement.cpp +++ b/content/html/content/src/nsHTMLLabelElement.cpp @@ -47,8 +47,7 @@ static NS_DEFINE_IID(kIFormIID, NS_IFORM_IID); static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID); class nsHTMLLabelElement : public nsIDOMHTMLLabelElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIFormControl @@ -77,11 +76,8 @@ public: NS_IMETHOD GetHtmlFor(nsString& aHtmlFor); NS_IMETHOD SetHtmlFor(const nsString& aHtmlFor); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLLegendElement.cpp b/content/html/content/src/nsHTMLLegendElement.cpp index 8f006649700..c72f08a0377 100644 --- a/content/html/content/src/nsHTMLLegendElement.cpp +++ b/content/html/content/src/nsHTMLLegendElement.cpp @@ -40,8 +40,7 @@ static NS_DEFINE_IID(kIDOMHTMLFormElementIID, NS_IDOMHTMLFORMELEMENT_IID); static NS_DEFINE_IID(kIFormIID, NS_IFORM_IID); class nsHTMLLegendElement : public nsIDOMHTMLLegendElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIFormControl { @@ -68,11 +67,8 @@ public: NS_IMETHOD GetAlign(nsString& aAlign); NS_IMETHOD SetAlign(const nsString& aAlign); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLLinkElement.cpp b/content/html/content/src/nsHTMLLinkElement.cpp index 979914055fd..6c4d377a222 100644 --- a/content/html/content/src/nsHTMLLinkElement.cpp +++ b/content/html/content/src/nsHTMLLinkElement.cpp @@ -39,8 +39,7 @@ static NS_DEFINE_IID(kIStyleSheetLinkingElementIID, NS_ISTYLESHEETLINKINGELEMENT static NS_DEFINE_IID(kIDOMStyleSheetIID, NS_IDOMSTYLESHEET_IID); class nsHTMLLinkElement : public nsIDOMHTMLLinkElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIStyleSheetLinkingElement { @@ -80,11 +79,8 @@ public: NS_IMETHOD GetType(nsString& aType); NS_IMETHOD SetType(const nsString& aType); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLMapElement.cpp b/content/html/content/src/nsHTMLMapElement.cpp index 605b13d28f0..94e4cee8d42 100644 --- a/content/html/content/src/nsHTMLMapElement.cpp +++ b/content/html/content/src/nsHTMLMapElement.cpp @@ -39,8 +39,7 @@ static NS_DEFINE_IID(kIDOMHTMLMapElementIID, NS_IDOMHTMLMAPELEMENT_IID); static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID); class nsHTMLMapElement : public nsIDOMHTMLMapElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -64,11 +63,8 @@ public: NS_IMETHOD GetName(nsString& aName); NS_IMETHOD SetName(const nsString& aName); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMETHOD GetDocument(nsIDocument*& aResult) const { diff --git a/content/html/content/src/nsHTMLMenuElement.cpp b/content/html/content/src/nsHTMLMenuElement.cpp index 72bdda4f55b..cb0567c13e1 100644 --- a/content/html/content/src/nsHTMLMenuElement.cpp +++ b/content/html/content/src/nsHTMLMenuElement.cpp @@ -39,8 +39,7 @@ extern nsGenericHTMLElement::EnumTable kListTypeTable[]; static NS_DEFINE_IID(kIDOMHTMLMenuElementIID, NS_IDOMHTMLMENUELEMENT_IID); class nsHTMLMenuElement : public nsIDOMHTMLMenuElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -63,11 +62,8 @@ public: NS_IMETHOD GetCompact(PRBool* aCompact); NS_IMETHOD SetCompact(PRBool aCompact); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLMetaElement.cpp b/content/html/content/src/nsHTMLMetaElement.cpp index 51183b4d95b..ccf05088358 100644 --- a/content/html/content/src/nsHTMLMetaElement.cpp +++ b/content/html/content/src/nsHTMLMetaElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLMetaElementIID, NS_IDOMHTMLMETAELEMENT_IID); class nsHTMLMetaElement : public nsIDOMHTMLMetaElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -64,11 +63,8 @@ public: NS_IMETHOD GetScheme(nsString& aScheme); NS_IMETHOD SetScheme(const nsString& aScheme); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLModElement.cpp b/content/html/content/src/nsHTMLModElement.cpp index 86c1965b0ee..b1db11ca9c2 100644 --- a/content/html/content/src/nsHTMLModElement.cpp +++ b/content/html/content/src/nsHTMLModElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLModElementIID, NS_IDOMHTMLMODELEMENT_IID); class nsHTMLModElement : public nsIDOMHTMLModElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -60,11 +59,8 @@ public: NS_IMETHOD GetDateTime(nsString& aDateTime); NS_IMETHOD SetDateTime(const nsString& aDateTime); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLOListElement.cpp b/content/html/content/src/nsHTMLOListElement.cpp index dc3ce2f28ec..31fbd19ca73 100644 --- a/content/html/content/src/nsHTMLOListElement.cpp +++ b/content/html/content/src/nsHTMLOListElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLOListElementIID, NS_IDOMHTMLOLISTELEMENT_IID); class nsHTMLOListElement : public nsIDOMHTMLOListElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -63,11 +62,8 @@ public: NS_IMETHOD GetType(nsString& aType); NS_IMETHOD SetType(const nsString& aType); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLObjectElement.cpp b/content/html/content/src/nsHTMLObjectElement.cpp index fb20242e583..751708cdf69 100644 --- a/content/html/content/src/nsHTMLObjectElement.cpp +++ b/content/html/content/src/nsHTMLObjectElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLObjectElementIID, NS_IDOMHTMLOBJECTELEMENT_IID); class nsHTMLObjectElement : public nsIDOMHTMLObjectElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -91,11 +90,8 @@ public: NS_IMETHOD GetWidth(nsString& aWidth); NS_IMETHOD SetWidth(const nsString& aWidth); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLOptGroupElement.cpp b/content/html/content/src/nsHTMLOptGroupElement.cpp index 9e02b26a8ff..3a730b88ad6 100644 --- a/content/html/content/src/nsHTMLOptGroupElement.cpp +++ b/content/html/content/src/nsHTMLOptGroupElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLOptGroupElementIID, NS_IDOMHTMLOPTGROUPELEMENT_IID); class nsHTMLOptGroupElement : public nsIDOMHTMLOptGroupElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -60,11 +59,8 @@ public: NS_IMETHOD GetLabel(nsString& aLabel); NS_IMETHOD SetLabel(const nsString& aLabel); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLOptionElement.cpp b/content/html/content/src/nsHTMLOptionElement.cpp index 90bf38df4da..71ff83d0eef 100644 --- a/content/html/content/src/nsHTMLOptionElement.cpp +++ b/content/html/content/src/nsHTMLOptionElement.cpp @@ -67,8 +67,7 @@ static NS_DEFINE_IID(kIFormControlFrameIID, NS_IFORMCONTROLFRAME_IID); static NS_DEFINE_IID(kIJSNativeInitializerIID, NS_IJSNATIVEINITIALIZER_IID); class nsHTMLOptionElement : public nsIDOMHTMLOptionElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIJSNativeInitializer //public nsIFormControl @@ -106,11 +105,8 @@ public: NS_IMETHOD GetValue(nsString& aValue); NS_IMETHOD SetValue(const nsString& aValue); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_NO_SETPARENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLParagraphElement.cpp b/content/html/content/src/nsHTMLParagraphElement.cpp index 8ae32ee1d43..99437a50171 100644 --- a/content/html/content/src/nsHTMLParagraphElement.cpp +++ b/content/html/content/src/nsHTMLParagraphElement.cpp @@ -37,8 +37,7 @@ static NS_DEFINE_IID(kIDOMHTMLParagraphElementIID, NS_IDOMHTMLPARAGRAPHELEMENT_IID); class nsHTMLParagraphElement : public nsIDOMHTMLParagraphElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -61,11 +60,8 @@ public: NS_IMETHOD GetAlign(nsString& aAlign); NS_IMETHOD SetAlign(const nsString& aAlign); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLParamElement.cpp b/content/html/content/src/nsHTMLParamElement.cpp index 6710641bb4f..211d5c7a608 100644 --- a/content/html/content/src/nsHTMLParamElement.cpp +++ b/content/html/content/src/nsHTMLParamElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLParamElementIID, NS_IDOMHTMLPARAMELEMENT_IID); class nsHTMLParamElement : public nsIDOMHTMLParamElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -64,11 +63,8 @@ public: NS_IMETHOD GetValueType(nsString& aValueType); NS_IMETHOD SetValueType(const nsString& aValueType); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLPreElement.cpp b/content/html/content/src/nsHTMLPreElement.cpp index ca01e01a6b0..964c9b9f541 100644 --- a/content/html/content/src/nsHTMLPreElement.cpp +++ b/content/html/content/src/nsHTMLPreElement.cpp @@ -37,8 +37,7 @@ static NS_DEFINE_IID(kIDOMHTMLPreElementIID, NS_IDOMHTMLPREELEMENT_IID); class nsHTMLPreElement : public nsIDOMHTMLPreElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -61,11 +60,8 @@ public: NS_IMETHOD GetWidth(PRInt32* aWidth); NS_IMETHOD SetWidth(PRInt32 aWidth); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLQuoteElement.cpp b/content/html/content/src/nsHTMLQuoteElement.cpp index e0b57b797f0..0034ff5820a 100644 --- a/content/html/content/src/nsHTMLQuoteElement.cpp +++ b/content/html/content/src/nsHTMLQuoteElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLQuoteElementIID, NS_IDOMHTMLQUOTEELEMENT_IID); class nsHTMLQuoteElement : public nsIDOMHTMLQuoteElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -58,11 +57,8 @@ public: NS_IMETHOD GetCite(nsString& aCite); NS_IMETHOD SetCite(const nsString& aCite); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLScriptElement.cpp b/content/html/content/src/nsHTMLScriptElement.cpp index d5332e66b84..bc3291d6fe0 100644 --- a/content/html/content/src/nsHTMLScriptElement.cpp +++ b/content/html/content/src/nsHTMLScriptElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLScriptElementIID, NS_IDOMHTMLSCRIPTELEMENT_IID); class nsHTMLScriptElement : public nsIDOMHTMLScriptElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -70,11 +69,8 @@ public: NS_IMETHOD GetType(nsString& aType); NS_IMETHOD SetType(const nsString& aType); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLSelectElement.cpp b/content/html/content/src/nsHTMLSelectElement.cpp index 18f32da98bc..a9eff9c3cb7 100644 --- a/content/html/content/src/nsHTMLSelectElement.cpp +++ b/content/html/content/src/nsHTMLSelectElement.cpp @@ -92,10 +92,9 @@ public: // nsIDOMHTMLCollection interface NS_DECL_IDOMHTMLCOLLECTION - // nsIScriptObjectOwner - NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject); - // nsIJSScriptObject interface + NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); + NS_IMETHOD SetScriptObject(void *aScriptObject); PRBool AddProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); PRBool DeleteProperty(JSContext *aContext, JSObject *aObj, @@ -126,9 +125,7 @@ private: class nsHTMLSelectElement : public nsIDOMHTMLSelectElement, public nsIDOMNSHTMLSelectElement, - public nsIScriptObjectOwner, public nsIJSScriptObject, - public nsIDOMEventReceiver, public nsIHTMLContent, public nsIFormControl, public nsIFocusableContent, @@ -179,12 +176,6 @@ public: NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) - // nsIContent NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner) @@ -206,6 +197,7 @@ public: NS_IMETHOD IsDoneAddingContent(PRBool * aIsDone); // nsIJSScriptObject + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); virtual PRBool DeleteProperty(JSContext *aContext, JSObject *aObj, @@ -1407,7 +1399,6 @@ nsHTMLOptionCollection::IndexOf(nsIContent* aOption) return -1; } - // nsIScriptObjectOwner interface NS_IMETHODIMP @@ -1421,6 +1412,12 @@ nsHTMLOptionCollection::GetScriptObject(nsIScriptContext *aContext, void** aScri return res; } +NS_IMETHODIMP +nsHTMLOptionCollection::SetScriptObject(void* aScriptObject) +{ + return nsGenericDOMHTMLCollection::SetScriptObject(aScriptObject); +} + // nsIJSScriptObject interface PRBool diff --git a/content/html/content/src/nsHTMLSharedObjectElement.cpp b/content/html/content/src/nsHTMLSharedObjectElement.cpp index fb20242e583..751708cdf69 100644 --- a/content/html/content/src/nsHTMLSharedObjectElement.cpp +++ b/content/html/content/src/nsHTMLSharedObjectElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLObjectElementIID, NS_IDOMHTMLOBJECTELEMENT_IID); class nsHTMLObjectElement : public nsIDOMHTMLObjectElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -91,11 +90,8 @@ public: NS_IMETHOD GetWidth(nsString& aWidth); NS_IMETHOD SetWidth(const nsString& aWidth); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLSpacerElement.cpp b/content/html/content/src/nsHTMLSpacerElement.cpp index d488fed4bd3..a458ac9d631 100644 --- a/content/html/content/src/nsHTMLSpacerElement.cpp +++ b/content/html/content/src/nsHTMLSpacerElement.cpp @@ -37,8 +37,7 @@ //static NS_DEFINE_IID(kIDOMHTMLSpacerElementIID, NS_IDOMHTMLSpacerELEMENT_IID); class nsHTMLSpacerElement : public nsIDOMHTMLElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -57,11 +56,8 @@ public: // nsIDOMHTMLElement NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLSpanElement.cpp b/content/html/content/src/nsHTMLSpanElement.cpp index 7c3314d718d..5109d14c211 100644 --- a/content/html/content/src/nsHTMLSpanElement.cpp +++ b/content/html/content/src/nsHTMLSpanElement.cpp @@ -32,8 +32,7 @@ #include "nsIPresContext.h" class nsHTMLSpanElement : public nsIDOMHTMLElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -52,11 +51,8 @@ public: // nsIDOMHTMLElement NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLStyleElement.cpp b/content/html/content/src/nsHTMLStyleElement.cpp index 70be55f9caa..cbe938d17a1 100644 --- a/content/html/content/src/nsHTMLStyleElement.cpp +++ b/content/html/content/src/nsHTMLStyleElement.cpp @@ -41,8 +41,7 @@ static NS_DEFINE_IID(kIStyleSheetLinkingElementIID, NS_ISTYLESHEETLINKINGELEMENT static NS_DEFINE_IID(kIDOMStyleSheetIID, NS_IDOMSTYLESHEET_IID); class nsHTMLStyleElement : public nsIDOMHTMLStyleElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIStyleSheetLinkingElement { @@ -70,11 +69,8 @@ public: NS_IMETHOD GetType(nsString& aType); NS_IMETHOD SetType(const nsString& aType); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLTableCaptionElement.cpp b/content/html/content/src/nsHTMLTableCaptionElement.cpp index 96f1eb3c324..22c3bd1606c 100644 --- a/content/html/content/src/nsHTMLTableCaptionElement.cpp +++ b/content/html/content/src/nsHTMLTableCaptionElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLTableCaptionElementIID, NS_IDOMHTMLTABLECAPTIONELEMENT_IID); class nsHTMLTableCaptionElement : public nsIDOMHTMLTableCaptionElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -59,11 +58,8 @@ public: NS_IMETHOD GetAlign(nsString& aAlign); NS_IMETHOD SetAlign(const nsString& aAlign); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLTableCellElement.cpp b/content/html/content/src/nsHTMLTableCellElement.cpp index 29d3e0f9b11..eeae1bf0ed6 100644 --- a/content/html/content/src/nsHTMLTableCellElement.cpp +++ b/content/html/content/src/nsHTMLTableCellElement.cpp @@ -41,8 +41,7 @@ static NS_DEFINE_IID(kIDOMHTMLTableRowElementIID, NS_IDOMHTMLTABLEROWELEMENT_IID class nsHTMLTableCellElement : public nsIHTMLTableCellElement, public nsIDOMHTMLTableCellElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -102,11 +101,8 @@ public: NS_IMETHOD GetWidth(nsString& aWidth); NS_IMETHOD SetWidth(const nsString& aWidth); -// nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - -// nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) +// nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLTableColElement.cpp b/content/html/content/src/nsHTMLTableColElement.cpp index 20097a9ef8f..62f59060830 100644 --- a/content/html/content/src/nsHTMLTableColElement.cpp +++ b/content/html/content/src/nsHTMLTableColElement.cpp @@ -38,8 +38,7 @@ static NS_DEFINE_IID(kIHTMLTableColElementIID, NS_IHTMLTABLECOLELEMENT_IID); class nsHTMLTableColElement : public nsIDOMHTMLTableColElement, public nsIHTMLTableColElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -72,11 +71,8 @@ public: NS_IMETHOD GetWidth(nsString& aWidth); NS_IMETHOD SetWidth(const nsString& aWidth); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLTableColGroupElement.cpp b/content/html/content/src/nsHTMLTableColGroupElement.cpp index 971541968ca..d6fc679611e 100644 --- a/content/html/content/src/nsHTMLTableColGroupElement.cpp +++ b/content/html/content/src/nsHTMLTableColGroupElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLTableColElementIID, NS_IDOMHTMLTABLECOLELEMENT_IID); class nsHTMLTableColGroupElement : public nsIDOMHTMLTableColElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -69,11 +68,8 @@ public: NS_IMETHOD GetWidth(nsString& aWidth); NS_IMETHOD SetWidth(const nsString& aWidth); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLTableElement.cpp b/content/html/content/src/nsHTMLTableElement.cpp index 6a7fa985d74..21f9c5c74bf 100644 --- a/content/html/content/src/nsHTMLTableElement.cpp +++ b/content/html/content/src/nsHTMLTableElement.cpp @@ -52,8 +52,7 @@ class GenericElementCollection; class TableRowsCollection; class nsHTMLTableElement : public nsIDOMHTMLTableElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -108,11 +107,8 @@ public: NS_IMETHOD InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); NS_IMETHOD DeleteRow(PRInt32 aIndex); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLTableRowElement.cpp b/content/html/content/src/nsHTMLTableRowElement.cpp index 4b562bda51f..223a7f132e2 100644 --- a/content/html/content/src/nsHTMLTableRowElement.cpp +++ b/content/html/content/src/nsHTMLTableRowElement.cpp @@ -138,8 +138,7 @@ nsTableCellCollection::Item(PRUint32 aIndex, //---------------------------------------------------------------------- class nsHTMLTableRowElement : public nsIDOMHTMLTableRowElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -178,11 +177,8 @@ public: NS_IMETHOD InsertCell(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); NS_IMETHOD DeleteCell(PRInt32 aIndex); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLTableSectionElement.cpp b/content/html/content/src/nsHTMLTableSectionElement.cpp index d94bad9142b..609e0852d32 100644 --- a/content/html/content/src/nsHTMLTableSectionElement.cpp +++ b/content/html/content/src/nsHTMLTableSectionElement.cpp @@ -40,8 +40,7 @@ static NS_DEFINE_IID(kIDOMHTMLCollectionIID, NS_IDOMHTMLCOLLECTION_IID); // you will see the phrases "rowgroup" and "section" used interchangably class nsHTMLTableSectionElement : public nsIDOMHTMLTableSectionElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -73,11 +72,8 @@ public: NS_IMETHOD InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); NS_IMETHOD DeleteRow(PRInt32 aIndex); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLTextAreaElement.cpp b/content/html/content/src/nsHTMLTextAreaElement.cpp index 4fbeee4e4c6..9fb094ea4d7 100644 --- a/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -58,8 +58,7 @@ static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID); class nsHTMLTextAreaElement : public nsIDOMHTMLTextAreaElement, public nsIDOMNSHTMLTextAreaElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIFormControl, public nsIFocusableContent, @@ -109,11 +108,8 @@ public: // nsIDOMNSHTMLTextAreaElement NS_DECL_IDOMNSHTMLTEXTAREAELEMENT - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLTitleElement.cpp b/content/html/content/src/nsHTMLTitleElement.cpp index 7f817dec070..8f2072fef6d 100644 --- a/content/html/content/src/nsHTMLTitleElement.cpp +++ b/content/html/content/src/nsHTMLTitleElement.cpp @@ -40,8 +40,7 @@ static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID); static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID); class nsHTMLTitleElement : public nsIDOMHTMLTitleElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -64,11 +63,8 @@ public: NS_IMETHOD GetText(nsString& aType); NS_IMETHOD SetText(const nsString& aType); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLUListElement.cpp b/content/html/content/src/nsHTMLUListElement.cpp index 9dc7f222ca3..726cc0c75b0 100644 --- a/content/html/content/src/nsHTMLUListElement.cpp +++ b/content/html/content/src/nsHTMLUListElement.cpp @@ -38,8 +38,7 @@ extern nsGenericHTMLElement::EnumTable kOldListTypeTable[]; static NS_DEFINE_IID(kIDOMHTMLUListElementIID, NS_IDOMHTMLULISTELEMENT_IID); class nsHTMLUListElement : public nsIDOMHTMLUListElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -64,11 +63,8 @@ public: NS_IMETHOD GetType(nsString& aType); NS_IMETHOD SetType(const nsString& aType); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/content/src/nsHTMLWBRElement.cpp b/content/html/content/src/nsHTMLWBRElement.cpp index dd05a25ef1e..84928e9b7f8 100644 --- a/content/html/content/src/nsHTMLWBRElement.cpp +++ b/content/html/content/src/nsHTMLWBRElement.cpp @@ -36,8 +36,7 @@ //static NS_DEFINE_IID(kIDOMHTMLWBRElementIID, NS_IDOMHTMLWBRELEMENT_IID); class nsHTMLWBRElement : public nsIDOMHTMLElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -56,11 +55,8 @@ public: // nsIDOMHTMLElement NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index 8a54de46df7..9ae8d879ace 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -752,6 +752,16 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, return rv; } +NS_IMETHODIMP +nsHTMLDocument::StopDocumentLoad() +{ + if (mParser) { + mParser->Terminate(); + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLDocument::EndLoad() { diff --git a/content/html/document/src/nsHTMLDocument.h b/content/html/document/src/nsHTMLDocument.h index e2480708561..4ecf034cafd 100644 --- a/content/html/document/src/nsHTMLDocument.h +++ b/content/html/document/src/nsHTMLDocument.h @@ -70,6 +70,8 @@ public: nsISupports* aContainer, nsIStreamListener **aDocListener); + NS_IMETHOD StopDocumentLoad(); + NS_IMETHOD EndLoad(); NS_IMETHOD AddImageMap(nsIDOMHTMLMapElement* aMap); diff --git a/content/xml/content/src/nsXMLCDATASection.cpp b/content/xml/content/src/nsXMLCDATASection.cpp index 8f16ea067b5..f8a268f1664 100644 --- a/content/xml/content/src/nsXMLCDATASection.cpp +++ b/content/xml/content/src/nsXMLCDATASection.cpp @@ -38,8 +38,6 @@ static NS_DEFINE_IID(kITextContentIID, NS_ITEXT_CONTENT_IID); class nsXMLCDATASection : public nsIDOMCDATASection, public nsIScriptObjectOwner, - public nsIDOMEventReceiver, - public nsIContent, public nsITextContent { public: @@ -61,9 +59,6 @@ public: // nsIScriptObjectOwner NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC_DOM_DATA(mInner) - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(mInner) - // nsIContent NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner) diff --git a/content/xml/content/src/nsXMLElement.h b/content/xml/content/src/nsXMLElement.h index b1d5ee04139..af408704acf 100644 --- a/content/xml/content/src/nsXMLElement.h +++ b/content/xml/content/src/nsXMLElement.h @@ -39,8 +39,6 @@ class nsIEventListenerManager; class nsIHTMLAttributes; class nsXMLElement : public nsIDOMElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, public nsIXMLContent, public nsIBindableContent, public nsIJSScriptObject @@ -205,9 +203,6 @@ public: NS_IMETHOD GetBinding(nsIXBLBinding** aResult); NS_IMETHOD GetBaseTag(nsIAtom** aResult); - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) - // nsIJSScriptObject virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp) { return mInner.AddProperty(aContext, aObj, aID, aVp); diff --git a/content/xml/content/src/nsXMLEntity.cpp b/content/xml/content/src/nsXMLEntity.cpp index 3dc3d07c330..15f3f84f1c3 100644 --- a/content/xml/content/src/nsXMLEntity.cpp +++ b/content/xml/content/src/nsXMLEntity.cpp @@ -36,7 +36,6 @@ static NS_DEFINE_IID(kIDOMEntityIID, NS_IDOMENTITY_IID); class nsXMLEntity : public nsIDOMEntity, public nsIScriptObjectOwner, - public nsIDOMEventReceiver, public nsIContent { public: @@ -59,9 +58,6 @@ public: NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); NS_IMETHOD SetScriptObject(void *aScriptObject); - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(mInner) - // nsIContent NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner) @@ -138,10 +134,11 @@ nsXMLEntity::QueryInterface(REFNSIID aIID, void** aInstancePtrResult) return NS_OK; } if (aIID.Equals(kIDOMEventReceiverIID)) { - nsIDOMEventReceiver* tmp = this; - *aInstancePtrResult = (void*) tmp; - NS_ADDREF_THIS(); - return NS_OK; + nsCOMPtr man; + if (NS_SUCCEEDED(mInner.GetListenerManager(getter_AddRefs(man)))){ + return man->QueryInterface(kIDOMEventReceiverIID, (void**)aInstancePtrResult); + } + return NS_NOINTERFACE; } if (aIID.Equals(kIScriptObjectOwnerIID)) { nsIScriptObjectOwner* tmp = this; diff --git a/content/xml/content/src/nsXMLNotation.cpp b/content/xml/content/src/nsXMLNotation.cpp index cd48b3c13f3..8c34ee86609 100644 --- a/content/xml/content/src/nsXMLNotation.cpp +++ b/content/xml/content/src/nsXMLNotation.cpp @@ -36,7 +36,6 @@ static NS_DEFINE_IID(kIDOMNotationIID, NS_IDOMNOTATION_IID); class nsXMLNotation : public nsIDOMNotation, public nsIScriptObjectOwner, - public nsIDOMEventReceiver, public nsIContent { public: @@ -59,9 +58,6 @@ public: NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); NS_IMETHOD SetScriptObject(void *aScriptObject); - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(mInner) - // nsIContent NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner) @@ -135,10 +131,11 @@ nsXMLNotation::QueryInterface(REFNSIID aIID, void** aInstancePtrResult) return NS_OK; } if (aIID.Equals(kIDOMEventReceiverIID)) { - nsIDOMEventReceiver* tmp = this; - *aInstancePtrResult = (void*) tmp; - NS_ADDREF_THIS(); - return NS_OK; + nsCOMPtr man; + if (NS_SUCCEEDED(mInner.GetListenerManager(getter_AddRefs(man)))){ + return man->QueryInterface(kIDOMEventReceiverIID, (void**)aInstancePtrResult); + } + return NS_NOINTERFACE; } if (aIID.Equals(kIScriptObjectOwnerIID)) { nsIScriptObjectOwner* tmp = this; diff --git a/content/xml/content/src/nsXMLProcessingInstruction.cpp b/content/xml/content/src/nsXMLProcessingInstruction.cpp index 2b7722cadea..e088a723384 100644 --- a/content/xml/content/src/nsXMLProcessingInstruction.cpp +++ b/content/xml/content/src/nsXMLProcessingInstruction.cpp @@ -36,7 +36,6 @@ static NS_DEFINE_IID(kIDOMProcessingInstructionIID, NS_IDOMPROCESSINGINSTRUCTION class nsXMLProcessingInstruction : public nsIDOMProcessingInstruction, public nsIScriptObjectOwner, - public nsIDOMEventReceiver, public nsIContent { public: @@ -58,9 +57,6 @@ public: NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); NS_IMETHOD SetScriptObject(void *aScriptObject); - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(mInner) - // nsIContent NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner) @@ -130,10 +126,11 @@ nsXMLProcessingInstruction::QueryInterface(REFNSIID aIID, void** aInstancePtrRes return NS_OK; } if (aIID.Equals(kIDOMEventReceiverIID)) { - nsIDOMEventReceiver* tmp = this; - *aInstancePtrResult = (void*) tmp; - NS_ADDREF_THIS(); - return NS_OK; + nsCOMPtr man; + if (NS_SUCCEEDED(mInner.GetListenerManager(getter_AddRefs(man)))){ + return man->QueryInterface(kIDOMEventReceiverIID, (void**)aInstancePtrResult); + } + return NS_NOINTERFACE; } if (aIID.Equals(kIScriptObjectOwnerIID)) { nsIScriptObjectOwner* tmp = this; diff --git a/content/xul/content/src/nsXULElement.h b/content/xul/content/src/nsXULElement.h index 985e2ef32c8..ef5cb83423d 100644 --- a/content/xul/content/src/nsXULElement.h +++ b/content/xul/content/src/nsXULElement.h @@ -314,7 +314,6 @@ class nsXULElement : public nsIStyledContent, public nsIBindableContent, public nsIDOMXULElement, public nsIDOMEventReceiver, - public nsIScriptObjectOwner, public nsIScriptEventHandlerOwner, public nsIJSScriptObject, public nsIStyleRule, diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index 6e1b3a9686d..8ea552a423c 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -751,6 +751,12 @@ nsXULDocument::StartDocumentLoad(const char* aCommand, return NS_OK; } +NS_IMETHODIMP +nsXULDocument::StopDocumentLoad() +{ + return NS_OK; +} + const nsString* nsXULDocument::GetDocumentTitle() const { diff --git a/content/xul/document/src/nsXULDocument.h b/content/xul/document/src/nsXULDocument.h index 8a7c7a259b9..4472d1e0e36 100644 --- a/content/xul/document/src/nsXULDocument.h +++ b/content/xul/document/src/nsXULDocument.h @@ -89,7 +89,6 @@ class nsXULDocument : public nsIDocument, public nsIDOMNSDocument, public nsIDOMEventCapturer, public nsIJSScriptObject, - public nsIScriptObjectOwner, public nsIHTMLContentContainer, public nsIStreamLoaderObserver, public nsSupportsWeakReference @@ -113,6 +112,8 @@ public: nsISupports* aContainer, nsIStreamListener **aDocListener); + NS_IMETHOD StopDocumentLoad(); + virtual const nsString* GetDocumentTitle() const; virtual nsIURI* GetDocumentURL() const; diff --git a/dom/public/html/MANIFEST b/dom/public/html/MANIFEST index 7ff91e487d3..adcf8a00b65 100644 --- a/dom/public/html/MANIFEST +++ b/dom/public/html/MANIFEST @@ -67,3 +67,5 @@ nsIDOMImage.h nsIDOMNSHTMLButtonElement.h nsIDOMNSHTMLDocument.h nsIDOMOption.h +nsIDOMNSHTMLAnchorElement.h +nsIDOMNSHTMLAreaElement.h diff --git a/dom/public/html/Makefile.in b/dom/public/html/Makefile.in index 927abf1672d..e69de29bb2d 100644 --- a/dom/public/html/Makefile.in +++ b/dom/public/html/Makefile.in @@ -1,104 +0,0 @@ -# -# The contents of this file are subject to the Netscape Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/NPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): -# - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = dom - -EXPORTS = \ - nsIDOMHTMLIFrameElement.h \ - nsIDOMHTMLAnchorElement.h \ - nsIDOMHTMLAppletElement.h \ - nsIDOMHTMLAreaElement.h \ - nsIDOMHTMLBRElement.h \ - nsIDOMHTMLBaseElement.h \ - nsIDOMHTMLBaseFontElement.h \ - nsIDOMHTMLBodyElement.h \ - nsIDOMHTMLButtonElement.h \ - nsIDOMHTMLCollection.h \ - nsIDOMHTMLDListElement.h \ - nsIDOMHTMLDirectoryElement.h \ - nsIDOMHTMLDivElement.h \ - nsIDOMHTMLDocument.h \ - nsIDOMHTMLElement.h \ - nsIDOMHTMLEmbedElement.h \ - nsIDOMHTMLFieldSetElement.h \ - nsIDOMHTMLFontElement.h \ - nsIDOMHTMLFormElement.h \ - nsIDOMHTMLFormControlList.h \ - nsIDOMNSHTMLFormElement.h \ - nsIDOMHTMLFrameElement.h \ - nsIDOMHTMLFrameSetElement.h \ - nsIDOMHTMLHRElement.h \ - nsIDOMHTMLHeadElement.h \ - nsIDOMHTMLHeadingElement.h \ - nsIDOMHTMLHtmlElement.h \ - nsIDOMHTMLImageElement.h \ - nsIDOMHTMLInputElement.h \ - nsIDOMNSHTMLInputElement.h \ - nsIDOMHTMLIsIndexElement.h \ - nsIDOMHTMLLIElement.h \ - nsIDOMHTMLLabelElement.h \ - nsIDOMHTMLLayerElement.h \ - nsIDOMHTMLLegendElement.h \ - nsIDOMHTMLLinkElement.h \ - nsIDOMHTMLMapElement.h \ - nsIDOMHTMLMenuElement.h \ - nsIDOMHTMLMetaElement.h \ - nsIDOMHTMLModElement.h \ - nsIDOMHTMLOListElement.h \ - nsIDOMHTMLObjectElement.h \ - nsIDOMHTMLOptGroupElement.h \ - nsIDOMHTMLOptionElement.h \ - nsIDOMNSHTMLOptionCollection.h \ - nsIDOMHTMLParagraphElement.h \ - nsIDOMHTMLParamElement.h \ - nsIDOMHTMLPreElement.h \ - nsIDOMHTMLQuoteElement.h \ - nsIDOMHTMLScriptElement.h \ - nsIDOMHTMLSelectElement.h \ - nsIDOMNSHTMLSelectElement.h \ - nsIDOMHTMLStyleElement.h \ - nsIDOMHTMLTableCaptionElement.h \ - nsIDOMHTMLTableCellElement.h \ - nsIDOMHTMLTableColElement.h \ - nsIDOMHTMLTableElement.h \ - nsIDOMHTMLTableRowElement.h \ - nsIDOMHTMLTableSectionElement.h \ - nsIDOMHTMLTextAreaElement.h \ - nsIDOMNSHTMLTextAreaElement.h \ - nsIDOMHTMLTitleElement.h \ - nsIDOMHTMLUListElement.h \ - nsIDOMImage.h \ - nsIDOMNSHTMLButtonElement.h \ - nsIDOMNSHTMLDocument.h \ - nsIDOMOption.h \ - $(NULL) - -EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) - -include $(topsrcdir)/config/rules.mk - diff --git a/dom/public/html/makefile.win b/dom/public/html/makefile.win index 50875f3410c..18222f012d7 100644 --- a/dom/public/html/makefile.win +++ b/dom/public/html/makefile.win @@ -94,7 +94,10 @@ EXPORTS2= \ nsIDOMImage.h \ nsIDOMNSHTMLButtonElement.h \ nsIDOMNSHTMLDocument.h \ - nsIDOMOption.h + nsIDOMOption.h \ + nsIDOMNSHTMLAnchorElement.h \ + nsIDOMNSHTMLAreaElement.h + MODULE=dom diff --git a/dom/public/html/nsIDOMHTMLInputElement.h b/dom/public/html/nsIDOMHTMLInputElement.h index 5e19f1c5000..f6306fbef92 100644 --- a/dom/public/html/nsIDOMHTMLInputElement.h +++ b/dom/public/html/nsIDOMHTMLInputElement.h @@ -84,6 +84,7 @@ public: NS_IMETHOD SetTabIndex(PRInt32 aTabIndex)=0; NS_IMETHOD GetType(nsString& aType)=0; + NS_IMETHOD SetType(const nsString& aType)=0; NS_IMETHOD GetUseMap(nsString& aUseMap)=0; NS_IMETHOD SetUseMap(const nsString& aUseMap)=0; @@ -135,6 +136,7 @@ public: NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); \ NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); \ NS_IMETHOD GetType(nsString& aType); \ + NS_IMETHOD SetType(const nsString& aType); \ NS_IMETHOD GetUseMap(nsString& aUseMap); \ NS_IMETHOD SetUseMap(const nsString& aUseMap); \ NS_IMETHOD GetValue(nsString& aValue); \ @@ -179,6 +181,7 @@ public: NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) { return _to GetTabIndex(aTabIndex); } \ NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) { return _to SetTabIndex(aTabIndex); } \ NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ + NS_IMETHOD SetType(const nsString& aType) { return _to SetType(aType); } \ NS_IMETHOD GetUseMap(nsString& aUseMap) { return _to GetUseMap(aUseMap); } \ NS_IMETHOD SetUseMap(const nsString& aUseMap) { return _to SetUseMap(aUseMap); } \ NS_IMETHOD GetValue(nsString& aValue) { return _to GetValue(aValue); } \ diff --git a/dom/public/html/nsIDOMNSHTMLAnchorElement.h b/dom/public/html/nsIDOMNSHTMLAnchorElement.h new file mode 100644 index 00000000000..25f7ceef70b --- /dev/null +++ b/dom/public/html/nsIDOMNSHTMLAnchorElement.h @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +/* AUTO-GENERATED. DO NOT EDIT!!! */ + +#ifndef nsIDOMNSHTMLAnchorElement_h__ +#define nsIDOMNSHTMLAnchorElement_h__ + +#include "nsISupports.h" +#include "nsString.h" +#include "nsIScriptContext.h" + + +#define NS_IDOMNSHTMLANCHORELEMENT_IID \ + { 0xa6cf911c, 0x15b3, 0x11d2, \ + { 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } + +class nsIDOMNSHTMLAnchorElement : public nsISupports { +public: + static const nsIID& GetIID() { static nsIID iid = NS_IDOMNSHTMLANCHORELEMENT_IID; return iid; } + + NS_IMETHOD GetProtocol(nsString& aProtocol)=0; + + NS_IMETHOD GetHost(nsString& aHost)=0; + + NS_IMETHOD GetHostname(nsString& aHostname)=0; + + NS_IMETHOD GetPathname(nsString& aPathname)=0; + + NS_IMETHOD GetSearch(nsString& aSearch)=0; + + NS_IMETHOD GetPort(nsString& aPort)=0; + + NS_IMETHOD GetHash(nsString& aHash)=0; + + NS_IMETHOD GetText(nsString& aText)=0; +}; + + +#define NS_DECL_IDOMNSHTMLANCHORELEMENT \ + NS_IMETHOD GetProtocol(nsString& aProtocol); \ + NS_IMETHOD GetHost(nsString& aHost); \ + NS_IMETHOD GetHostname(nsString& aHostname); \ + NS_IMETHOD GetPathname(nsString& aPathname); \ + NS_IMETHOD GetSearch(nsString& aSearch); \ + NS_IMETHOD GetPort(nsString& aPort); \ + NS_IMETHOD GetHash(nsString& aHash); \ + NS_IMETHOD GetText(nsString& aText); \ + + + +#define NS_FORWARD_IDOMNSHTMLANCHORELEMENT(_to) \ + NS_IMETHOD GetProtocol(nsString& aProtocol) { return _to GetProtocol(aProtocol); } \ + NS_IMETHOD GetHost(nsString& aHost) { return _to GetHost(aHost); } \ + NS_IMETHOD GetHostname(nsString& aHostname) { return _to GetHostname(aHostname); } \ + NS_IMETHOD GetPathname(nsString& aPathname) { return _to GetPathname(aPathname); } \ + NS_IMETHOD GetSearch(nsString& aSearch) { return _to GetSearch(aSearch); } \ + NS_IMETHOD GetPort(nsString& aPort) { return _to GetPort(aPort); } \ + NS_IMETHOD GetHash(nsString& aHash) { return _to GetHash(aHash); } \ + NS_IMETHOD GetText(nsString& aText) { return _to GetText(aText); } \ + + +#endif // nsIDOMNSHTMLAnchorElement_h__ diff --git a/dom/public/html/nsIDOMNSHTMLAreaElement.h b/dom/public/html/nsIDOMNSHTMLAreaElement.h new file mode 100644 index 00000000000..d1ea10fd6d2 --- /dev/null +++ b/dom/public/html/nsIDOMNSHTMLAreaElement.h @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +/* AUTO-GENERATED. DO NOT EDIT!!! */ + +#ifndef nsIDOMNSHTMLAreaElement_h__ +#define nsIDOMNSHTMLAreaElement_h__ + +#include "nsISupports.h" +#include "nsString.h" +#include "nsIScriptContext.h" + + +#define NS_IDOMNSHTMLAREAELEMENT_IID \ + { 0xa6cf911b, 0x15b3, 0x11d2, \ + { 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } + +class nsIDOMNSHTMLAreaElement : public nsISupports { +public: + static const nsIID& GetIID() { static nsIID iid = NS_IDOMNSHTMLAREAELEMENT_IID; return iid; } + + NS_IMETHOD GetProtocol(nsString& aProtocol)=0; + + NS_IMETHOD GetHost(nsString& aHost)=0; + + NS_IMETHOD GetHostname(nsString& aHostname)=0; + + NS_IMETHOD GetPathname(nsString& aPathname)=0; + + NS_IMETHOD GetSearch(nsString& aSearch)=0; + + NS_IMETHOD GetPort(nsString& aPort)=0; + + NS_IMETHOD GetHash(nsString& aHash)=0; +}; + + +#define NS_DECL_IDOMNSHTMLAREAELEMENT \ + NS_IMETHOD GetProtocol(nsString& aProtocol); \ + NS_IMETHOD GetHost(nsString& aHost); \ + NS_IMETHOD GetHostname(nsString& aHostname); \ + NS_IMETHOD GetPathname(nsString& aPathname); \ + NS_IMETHOD GetSearch(nsString& aSearch); \ + NS_IMETHOD GetPort(nsString& aPort); \ + NS_IMETHOD GetHash(nsString& aHash); \ + + + +#define NS_FORWARD_IDOMNSHTMLAREAELEMENT(_to) \ + NS_IMETHOD GetProtocol(nsString& aProtocol) { return _to GetProtocol(aProtocol); } \ + NS_IMETHOD GetHost(nsString& aHost) { return _to GetHost(aHost); } \ + NS_IMETHOD GetHostname(nsString& aHostname) { return _to GetHostname(aHostname); } \ + NS_IMETHOD GetPathname(nsString& aPathname) { return _to GetPathname(aPathname); } \ + NS_IMETHOD GetSearch(nsString& aSearch) { return _to GetSearch(aSearch); } \ + NS_IMETHOD GetPort(nsString& aPort) { return _to GetPort(aPort); } \ + NS_IMETHOD GetHash(nsString& aHash) { return _to GetHash(aHash); } \ + + +#endif // nsIDOMNSHTMLAreaElement_h__ diff --git a/dom/public/idl/html/HTMLAnchorElement.idl b/dom/public/idl/html/HTMLAnchorElement.idl index eeafb5855d4..e69de29bb2d 100644 --- a/dom/public/idl/html/HTMLAnchorElement.idl +++ b/dom/public/idl/html/HTMLAnchorElement.idl @@ -1,19 +0,0 @@ - interface HTMLAnchorElement : HTMLElement { - /* IID: { 0xa6cf90aa, 0x15b3, 0x11d2, \ - { 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */ - - attribute DOMString accessKey; - attribute DOMString charset; - attribute DOMString coords; - attribute DOMString href; - attribute DOMString hreflang; - attribute DOMString name; - attribute DOMString rel; - attribute DOMString rev; - attribute DOMString shape; - attribute long tabIndex; - attribute DOMString target; - attribute DOMString type; - void blur(); - void focus(); - }; diff --git a/dom/public/idl/html/HTMLAreaElement.idl b/dom/public/idl/html/HTMLAreaElement.idl index 060496659eb..e69de29bb2d 100644 --- a/dom/public/idl/html/HTMLAreaElement.idl +++ b/dom/public/idl/html/HTMLAreaElement.idl @@ -1,13 +0,0 @@ - interface HTMLAreaElement : HTMLElement { - /* IID: { 0xa6cf90b0, 0x15b3, 0x11d2, \ - { 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */ - - attribute DOMString accessKey; - attribute DOMString alt; - attribute DOMString coords; - attribute DOMString href; - attribute boolean noHref; - attribute DOMString shape; - attribute long tabIndex; - attribute DOMString target; - }; diff --git a/dom/public/idl/html/HTMLInputElement.idl b/dom/public/idl/html/HTMLInputElement.idl index 8df8f57fc5b..b10a7c8c282 100644 --- a/dom/public/idl/html/HTMLInputElement.idl +++ b/dom/public/idl/html/HTMLInputElement.idl @@ -17,7 +17,7 @@ attribute DOMString size; attribute DOMString src; attribute long tabIndex; - readonly attribute DOMString type; + attribute DOMString type; attribute DOMString useMap; attribute DOMString value; attribute DOMString autocomplete; diff --git a/dom/public/nsDOMPropEnums.h b/dom/public/nsDOMPropEnums.h index b689b49a261..9096c75e770 100644 --- a/dom/public/nsDOMPropEnums.h +++ b/dom/public/nsDOMPropEnums.h @@ -684,6 +684,21 @@ enum nsDOMProp { NS_DOM_PROP_NSDOCUMENT_HEIGHT, NS_DOM_PROP_NSDOCUMENT_STYLESHEETS, NS_DOM_PROP_NSDOCUMENT_WIDTH, + NS_DOM_PROP_NSHTMLANCHORELEMENT_PROTOCOL, + NS_DOM_PROP_NSHTMLANCHORELEMENT_HOST, + NS_DOM_PROP_NSHTMLANCHORELEMENT_HOSTNAME, + NS_DOM_PROP_NSHTMLANCHORELEMENT_PATHNAME, + NS_DOM_PROP_NSHTMLANCHORELEMENT_SEARCH, + NS_DOM_PROP_NSHTMLANCHORELEMENT_PORT, + NS_DOM_PROP_NSHTMLANCHORELEMENT_HASH, + NS_DOM_PROP_NSHTMLANCHORELEMENT_TEXT, + NS_DOM_PROP_NSHTMLAREAELEMENT_PROTOCOL, + NS_DOM_PROP_NSHTMLAREAELEMENT_HOST, + NS_DOM_PROP_NSHTMLAREAELEMENT_HOSTNAME, + NS_DOM_PROP_NSHTMLAREAELEMENT_PATHNAME, + NS_DOM_PROP_NSHTMLAREAELEMENT_SEARCH, + NS_DOM_PROP_NSHTMLAREAELEMENT_PORT, + NS_DOM_PROP_NSHTMLAREAELEMENT_HASH, NS_DOM_PROP_NSHTMLBUTTONELEMENT_BLUR, NS_DOM_PROP_NSHTMLBUTTONELEMENT_FOCUS, NS_DOM_PROP_NSHTMLDOCUMENT_ALINKCOLOR, diff --git a/dom/public/nsDOMPropNames.h b/dom/public/nsDOMPropNames.h index fbf0acd6f9f..8661885e499 100644 --- a/dom/public/nsDOMPropNames.h +++ b/dom/public/nsDOMPropNames.h @@ -683,6 +683,21 @@ "nsdocument.height", \ "nsdocument.stylesheets", \ "nsdocument.width", \ + "nshtmlanchorelement.protocol", \ + "nshtmlanchorelement.host", \ + "nshtmlanchorelement.hostname", \ + "nshtmlanchorelement.pathname", \ + "nshtmlanchorelement.search", \ + "nshtmlanchorelement.port", \ + "nshtmlanchorelement.hash", \ + "nshtmlanchorelement.text", \ + "nshtmlareaelement.protocol", \ + "nshtmlareaelement.host", \ + "nshtmlareaelement.hostname", \ + "nshtmlareaelement.pathname", \ + "nshtmlareaelement.search", \ + "nshtmlareaelement.port", \ + "nshtmlareaelement.hash", \ "nshtmlbuttonelement.blur", \ "nshtmlbuttonelement.focus", \ "nshtmldocument.alinkcolor", \ @@ -894,7 +909,7 @@ "xulcheckboxelement.imgalign", \ "xulcheckboxelement.src", \ "xulcheckboxelement.value", \ - "xulcommanddispatcher.active", \ + "xulcommanddispatcher.active", \ "xulcommanddispatcher.addcommandupdater", \ "xulcommanddispatcher.focusedelement", \ "xulcommanddispatcher.focusedwindow", \ diff --git a/dom/public/nsIJSScriptObject.h b/dom/public/nsIJSScriptObject.h index a6c17a4b2d9..ae90850bb8f 100644 --- a/dom/public/nsIJSScriptObject.h +++ b/dom/public/nsIJSScriptObject.h @@ -24,6 +24,7 @@ #define nsIJSScriptObject_h__ #include "nsISupports.h" +#include "nsIScriptObjectOwner.h" #include "jsapi.h" #define NS_IJSSCRIPTOBJECT_IID \ @@ -39,7 +40,7 @@ *

* It is used by the script runtime to collect information about an object */ -class nsIJSScriptObject : public nsISupports { +class nsIJSScriptObject : public nsIScriptObjectOwner { public: static const nsIID& GetIID() { static nsIID iid = NS_IJSSCRIPTOBJECT_IID; return iid; } virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, jsval aID, diff --git a/dom/src/base/nsGlobalWindow.cpp b/dom/src/base/nsGlobalWindow.cpp index 60b238dd668..cadbb2b656c 100644 --- a/dom/src/base/nsGlobalWindow.cpp +++ b/dom/src/base/nsGlobalWindow.cpp @@ -3265,8 +3265,10 @@ NS_IMETHODIMP GlobalWindowImpl::ClearTimeoutOrInterval(PRInt32 aTimerID) nsTimeoutImpl **top, *timeout; public_id = (PRUint32)aTimerID; - if(!public_id) /* id of zero is reserved for internal use */ - return NS_ERROR_FAILURE; + if(!public_id) { /* id of zero is reserved for internal use */ + /* return silently for compatibility (see bug 30700) */ + return NS_OK; + } for(top = &mTimeouts; (timeout = *top) != NULL; top = &timeout->next) { if(timeout->public_id == public_id) diff --git a/dom/src/base/nsGlobalWindow.h b/dom/src/base/nsGlobalWindow.h index 22fd9c216bb..8940e28740a 100644 --- a/dom/src/base/nsGlobalWindow.h +++ b/dom/src/base/nsGlobalWindow.h @@ -70,8 +70,7 @@ class HistoryImpl; //***************************************************************************** // GlobalWindowImpl: Global Object for Scripting //***************************************************************************** -class GlobalWindowImpl : public nsIScriptObjectOwner, - public nsIScriptGlobalObject, +class GlobalWindowImpl : public nsIScriptGlobalObject, public nsIDOMWindow, public nsIJSScriptObject, public nsIScriptObjectPrincipal, @@ -276,8 +275,7 @@ class nsIURI; // LocationImpl: Script "location" object //***************************************************************************** -class LocationImpl : public nsIScriptObjectOwner, - public nsIDOMLocation, +class LocationImpl : public nsIDOMLocation, public nsIDOMNSLocation, public nsIJSScriptObject { diff --git a/dom/src/base/nsLocation.cpp b/dom/src/base/nsLocation.cpp index 785056b3600..65d96934ee3 100644 --- a/dom/src/base/nsLocation.cpp +++ b/dom/src/base/nsLocation.cpp @@ -67,9 +67,9 @@ NS_IMPL_ADDREF(LocationImpl) NS_IMPL_RELEASE(LocationImpl) NS_INTERFACE_MAP_BEGIN(LocationImpl) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIScriptObjectOwner) - NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMLocation) NS_INTERFACE_MAP_ENTRY(nsIDOMLocation) + NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner) NS_INTERFACE_MAP_ENTRY(nsIDOMNSLocation) NS_INTERFACE_MAP_ENTRY(nsIJSScriptObject) NS_INTERFACE_MAP_END diff --git a/dom/src/html/nsJSHTMLAnchorElement.cpp b/dom/src/html/nsJSHTMLAnchorElement.cpp index a0c23fc487f..85c233adbfd 100644 --- a/dom/src/html/nsJSHTMLAnchorElement.cpp +++ b/dom/src/html/nsJSHTMLAnchorElement.cpp @@ -34,12 +34,14 @@ #include "nsCOMPtr.h" #include "nsDOMPropEnums.h" #include "nsString.h" +#include "nsIDOMNSHTMLAnchorElement.h" #include "nsIDOMHTMLAnchorElement.h" static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID); static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID); static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID); +static NS_DEFINE_IID(kINSHTMLAnchorElementIID, NS_IDOMNSHTMLANCHORELEMENT_IID); static NS_DEFINE_IID(kIHTMLAnchorElementIID, NS_IDOMHTMLANCHORELEMENT_IID); // @@ -57,7 +59,15 @@ enum HTMLAnchorElement_slots { HTMLANCHORELEMENT_SHAPE = -9, HTMLANCHORELEMENT_TABINDEX = -10, HTMLANCHORELEMENT_TARGET = -11, - HTMLANCHORELEMENT_TYPE = -12 + HTMLANCHORELEMENT_TYPE = -12, + NSHTMLANCHORELEMENT_PROTOCOL = -13, + NSHTMLANCHORELEMENT_HOST = -14, + NSHTMLANCHORELEMENT_HOSTNAME = -15, + NSHTMLANCHORELEMENT_PATHNAME = -16, + NSHTMLANCHORELEMENT_SEARCH = -17, + NSHTMLANCHORELEMENT_PORT = -18, + NSHTMLANCHORELEMENT_HASH = -19, + NSHTMLANCHORELEMENT_TEXT = -20 }; /***********************************************************************/ @@ -224,6 +234,158 @@ GetHTMLAnchorElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) } break; } + case NSHTMLANCHORELEMENT_PROTOCOL: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLANCHORELEMENT_PROTOCOL, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + nsIDOMNSHTMLAnchorElement* b; + if (NS_OK == a->QueryInterface(kINSHTMLAnchorElementIID, (void **)&b)) { + rv = b->GetProtocol(prop); + if(NS_SUCCEEDED(rv)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + NS_RELEASE(b); + } + else { + rv = NS_ERROR_DOM_WRONG_TYPE_ERR; + } + } + break; + } + case NSHTMLANCHORELEMENT_HOST: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLANCHORELEMENT_HOST, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + nsIDOMNSHTMLAnchorElement* b; + if (NS_OK == a->QueryInterface(kINSHTMLAnchorElementIID, (void **)&b)) { + rv = b->GetHost(prop); + if(NS_SUCCEEDED(rv)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + NS_RELEASE(b); + } + else { + rv = NS_ERROR_DOM_WRONG_TYPE_ERR; + } + } + break; + } + case NSHTMLANCHORELEMENT_HOSTNAME: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLANCHORELEMENT_HOSTNAME, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + nsIDOMNSHTMLAnchorElement* b; + if (NS_OK == a->QueryInterface(kINSHTMLAnchorElementIID, (void **)&b)) { + rv = b->GetHostname(prop); + if(NS_SUCCEEDED(rv)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + NS_RELEASE(b); + } + else { + rv = NS_ERROR_DOM_WRONG_TYPE_ERR; + } + } + break; + } + case NSHTMLANCHORELEMENT_PATHNAME: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLANCHORELEMENT_PATHNAME, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + nsIDOMNSHTMLAnchorElement* b; + if (NS_OK == a->QueryInterface(kINSHTMLAnchorElementIID, (void **)&b)) { + rv = b->GetPathname(prop); + if(NS_SUCCEEDED(rv)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + NS_RELEASE(b); + } + else { + rv = NS_ERROR_DOM_WRONG_TYPE_ERR; + } + } + break; + } + case NSHTMLANCHORELEMENT_SEARCH: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLANCHORELEMENT_SEARCH, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + nsIDOMNSHTMLAnchorElement* b; + if (NS_OK == a->QueryInterface(kINSHTMLAnchorElementIID, (void **)&b)) { + rv = b->GetSearch(prop); + if(NS_SUCCEEDED(rv)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + NS_RELEASE(b); + } + else { + rv = NS_ERROR_DOM_WRONG_TYPE_ERR; + } + } + break; + } + case NSHTMLANCHORELEMENT_PORT: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLANCHORELEMENT_PORT, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + nsIDOMNSHTMLAnchorElement* b; + if (NS_OK == a->QueryInterface(kINSHTMLAnchorElementIID, (void **)&b)) { + rv = b->GetPort(prop); + if(NS_SUCCEEDED(rv)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + NS_RELEASE(b); + } + else { + rv = NS_ERROR_DOM_WRONG_TYPE_ERR; + } + } + break; + } + case NSHTMLANCHORELEMENT_HASH: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLANCHORELEMENT_HASH, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + nsIDOMNSHTMLAnchorElement* b; + if (NS_OK == a->QueryInterface(kINSHTMLAnchorElementIID, (void **)&b)) { + rv = b->GetHash(prop); + if(NS_SUCCEEDED(rv)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + NS_RELEASE(b); + } + else { + rv = NS_ERROR_DOM_WRONG_TYPE_ERR; + } + } + break; + } + case NSHTMLANCHORELEMENT_TEXT: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLANCHORELEMENT_TEXT, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + nsIDOMNSHTMLAnchorElement* b; + if (NS_OK == a->QueryInterface(kINSHTMLAnchorElementIID, (void **)&b)) { + rv = b->GetText(prop); + if(NS_SUCCEEDED(rv)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + NS_RELEASE(b); + } + else { + rv = NS_ERROR_DOM_WRONG_TYPE_ERR; + } + } + break; + } default: return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp); } @@ -558,6 +720,14 @@ static JSPropertySpec HTMLAnchorElementProperties[] = {"tabIndex", HTMLANCHORELEMENT_TABINDEX, JSPROP_ENUMERATE}, {"target", HTMLANCHORELEMENT_TARGET, JSPROP_ENUMERATE}, {"type", HTMLANCHORELEMENT_TYPE, JSPROP_ENUMERATE}, + {"protocol", NSHTMLANCHORELEMENT_PROTOCOL, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"host", NSHTMLANCHORELEMENT_HOST, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"hostname", NSHTMLANCHORELEMENT_HOSTNAME, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"pathname", NSHTMLANCHORELEMENT_PATHNAME, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"search", NSHTMLANCHORELEMENT_SEARCH, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"port", NSHTMLANCHORELEMENT_PORT, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"hash", NSHTMLANCHORELEMENT_HASH, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"text", NSHTMLANCHORELEMENT_TEXT, JSPROP_ENUMERATE | JSPROP_READONLY}, {0} }; diff --git a/dom/src/html/nsJSHTMLAreaElement.cpp b/dom/src/html/nsJSHTMLAreaElement.cpp index 2353cd78467..18a44495936 100644 --- a/dom/src/html/nsJSHTMLAreaElement.cpp +++ b/dom/src/html/nsJSHTMLAreaElement.cpp @@ -35,12 +35,14 @@ #include "nsDOMPropEnums.h" #include "nsString.h" #include "nsIDOMHTMLAreaElement.h" +#include "nsIDOMNSHTMLAreaElement.h" static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID); static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID); static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID); static NS_DEFINE_IID(kIHTMLAreaElementIID, NS_IDOMHTMLAREAELEMENT_IID); +static NS_DEFINE_IID(kINSHTMLAreaElementIID, NS_IDOMNSHTMLAREAELEMENT_IID); // // HTMLAreaElement property ids @@ -53,7 +55,14 @@ enum HTMLAreaElement_slots { HTMLAREAELEMENT_NOHREF = -5, HTMLAREAELEMENT_SHAPE = -6, HTMLAREAELEMENT_TABINDEX = -7, - HTMLAREAELEMENT_TARGET = -8 + HTMLAREAELEMENT_TARGET = -8, + NSHTMLAREAELEMENT_PROTOCOL = -9, + NSHTMLAREAELEMENT_HOST = -10, + NSHTMLAREAELEMENT_HOSTNAME = -11, + NSHTMLAREAELEMENT_PATHNAME = -12, + NSHTMLAREAELEMENT_SEARCH = -13, + NSHTMLAREAELEMENT_PORT = -14, + NSHTMLAREAELEMENT_HASH = -15 }; /***********************************************************************/ @@ -172,6 +181,139 @@ GetHTMLAreaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) } break; } + case NSHTMLAREAELEMENT_PROTOCOL: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLAREAELEMENT_PROTOCOL, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + nsIDOMNSHTMLAreaElement* b; + if (NS_OK == a->QueryInterface(kINSHTMLAreaElementIID, (void **)&b)) { + rv = b->GetProtocol(prop); + if(NS_SUCCEEDED(rv)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + NS_RELEASE(b); + } + else { + rv = NS_ERROR_DOM_WRONG_TYPE_ERR; + } + } + break; + } + case NSHTMLAREAELEMENT_HOST: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLAREAELEMENT_HOST, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + nsIDOMNSHTMLAreaElement* b; + if (NS_OK == a->QueryInterface(kINSHTMLAreaElementIID, (void **)&b)) { + rv = b->GetHost(prop); + if(NS_SUCCEEDED(rv)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + NS_RELEASE(b); + } + else { + rv = NS_ERROR_DOM_WRONG_TYPE_ERR; + } + } + break; + } + case NSHTMLAREAELEMENT_HOSTNAME: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLAREAELEMENT_HOSTNAME, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + nsIDOMNSHTMLAreaElement* b; + if (NS_OK == a->QueryInterface(kINSHTMLAreaElementIID, (void **)&b)) { + rv = b->GetHostname(prop); + if(NS_SUCCEEDED(rv)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + NS_RELEASE(b); + } + else { + rv = NS_ERROR_DOM_WRONG_TYPE_ERR; + } + } + break; + } + case NSHTMLAREAELEMENT_PATHNAME: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLAREAELEMENT_PATHNAME, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + nsIDOMNSHTMLAreaElement* b; + if (NS_OK == a->QueryInterface(kINSHTMLAreaElementIID, (void **)&b)) { + rv = b->GetPathname(prop); + if(NS_SUCCEEDED(rv)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + NS_RELEASE(b); + } + else { + rv = NS_ERROR_DOM_WRONG_TYPE_ERR; + } + } + break; + } + case NSHTMLAREAELEMENT_SEARCH: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLAREAELEMENT_SEARCH, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + nsIDOMNSHTMLAreaElement* b; + if (NS_OK == a->QueryInterface(kINSHTMLAreaElementIID, (void **)&b)) { + rv = b->GetSearch(prop); + if(NS_SUCCEEDED(rv)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + NS_RELEASE(b); + } + else { + rv = NS_ERROR_DOM_WRONG_TYPE_ERR; + } + } + break; + } + case NSHTMLAREAELEMENT_PORT: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLAREAELEMENT_PORT, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + nsIDOMNSHTMLAreaElement* b; + if (NS_OK == a->QueryInterface(kINSHTMLAreaElementIID, (void **)&b)) { + rv = b->GetPort(prop); + if(NS_SUCCEEDED(rv)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + NS_RELEASE(b); + } + else { + rv = NS_ERROR_DOM_WRONG_TYPE_ERR; + } + } + break; + } + case NSHTMLAREAELEMENT_HASH: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLAREAELEMENT_HASH, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + nsIDOMNSHTMLAreaElement* b; + if (NS_OK == a->QueryInterface(kINSHTMLAreaElementIID, (void **)&b)) { + rv = b->GetHash(prop); + if(NS_SUCCEEDED(rv)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + NS_RELEASE(b); + } + else { + rv = NS_ERROR_DOM_WRONG_TYPE_ERR; + } + } + break; + } default: return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp); } @@ -386,6 +528,13 @@ static JSPropertySpec HTMLAreaElementProperties[] = {"shape", HTMLAREAELEMENT_SHAPE, JSPROP_ENUMERATE}, {"tabIndex", HTMLAREAELEMENT_TABINDEX, JSPROP_ENUMERATE}, {"target", HTMLAREAELEMENT_TARGET, JSPROP_ENUMERATE}, + {"protocol", NSHTMLAREAELEMENT_PROTOCOL, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"host", NSHTMLAREAELEMENT_HOST, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"hostname", NSHTMLAREAELEMENT_HOSTNAME, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"pathname", NSHTMLAREAELEMENT_PATHNAME, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"search", NSHTMLAREAELEMENT_SEARCH, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"port", NSHTMLAREAELEMENT_PORT, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"hash", NSHTMLAREAELEMENT_HASH, JSPROP_ENUMERATE | JSPROP_READONLY}, {0} }; diff --git a/dom/src/html/nsJSHTMLInputElement.cpp b/dom/src/html/nsJSHTMLInputElement.cpp index 29871bd48ae..709daf4cad2 100644 --- a/dom/src/html/nsJSHTMLInputElement.cpp +++ b/dom/src/html/nsJSHTMLInputElement.cpp @@ -564,6 +564,18 @@ SetHTMLInputElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) } break; } + case HTMLINPUTELEMENT_TYPE: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLINPUTELEMENT_TYPE, PR_TRUE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + nsJSUtils::nsConvertJSValToString(prop, cx, *vp); + + rv = a->SetType(prop); + + } + break; + } case HTMLINPUTELEMENT_USEMAP: { rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLINPUTELEMENT_USEMAP, PR_TRUE); @@ -824,7 +836,7 @@ static JSPropertySpec HTMLInputElementProperties[] = {"size", HTMLINPUTELEMENT_SIZE, JSPROP_ENUMERATE}, {"src", HTMLINPUTELEMENT_SRC, JSPROP_ENUMERATE}, {"tabIndex", HTMLINPUTELEMENT_TABINDEX, JSPROP_ENUMERATE}, - {"type", HTMLINPUTELEMENT_TYPE, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"type", HTMLINPUTELEMENT_TYPE, JSPROP_ENUMERATE}, {"useMap", HTMLINPUTELEMENT_USEMAP, JSPROP_ENUMERATE}, {"value", HTMLINPUTELEMENT_VALUE, JSPROP_ENUMERATE}, {"autocomplete", HTMLINPUTELEMENT_AUTOCOMPLETE, JSPROP_ENUMERATE}, diff --git a/extensions/cookie/nsCookieHTTPNotify.cpp b/extensions/cookie/nsCookieHTTPNotify.cpp index 36be2477717..ab017d3a7a7 100644 --- a/extensions/cookie/nsCookieHTTPNotify.cpp +++ b/extensions/cookie/nsCookieHTTPNotify.cpp @@ -180,7 +180,7 @@ nsCookieHTTPNotify::ModifyRequest(nsISupports *aContext) rv = SetupCookieService(); if (NS_FAILED(rv)) return rv; - nsString cookie; + nsAutoString cookie; rv = mCookieService->GetCookieStringFromHTTP(pURL, pFirstURL, cookie); if (NS_FAILED(rv)) return rv; diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 220fe5ce1bf..c1e8f54deb1 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -537,6 +537,10 @@ DocumentViewerImpl::Init(nsIWidget* aParentWidget, NS_IMETHODIMP DocumentViewerImpl::Stop(void) { + if (mDocument) { + mDocument->StopDocumentLoad(); + } + if (mPresContext) { mPresContext->Stop(); } diff --git a/layout/base/public/nsIDocument.h b/layout/base/public/nsIDocument.h index ea3676418b8..b140c2ebd62 100644 --- a/layout/base/public/nsIDocument.h +++ b/layout/base/public/nsIDocument.h @@ -98,6 +98,8 @@ public: nsISupports* aContainer, nsIStreamListener **aDocListener) = 0; + NS_IMETHOD StopDocumentLoad() = 0; + /** * Return the title of the document. May return null. */ diff --git a/layout/base/public/nsITextContent.h b/layout/base/public/nsITextContent.h index a6ae2174457..46fb3099ee5 100644 --- a/layout/base/public/nsITextContent.h +++ b/layout/base/public/nsITextContent.h @@ -23,9 +23,9 @@ #define nsITextContent_h___ #include "nslayout.h" +#include "nsIContent.h" class nsString; class nsTextFragment; -class nsIContent; // IID for the nsITextContent interface #define NS_ITEXT_CONTENT_IID \ @@ -35,7 +35,7 @@ class nsIContent; * Interface for textual content. This interface is used to provide * an efficient access to text content. */ -class nsITextContent : public nsISupports { +class nsITextContent : public nsIContent { public: static const nsIID& GetIID() { static nsIID iid = NS_ITEXT_CONTENT_IID; return iid; } diff --git a/layout/base/src/nsCommentNode.cpp b/layout/base/src/nsCommentNode.cpp index 69fd11369c4..de0dc53d975 100644 --- a/layout/base/src/nsCommentNode.cpp +++ b/layout/base/src/nsCommentNode.cpp @@ -39,8 +39,6 @@ static NS_DEFINE_IID(kITextContentIID, NS_ITEXT_CONTENT_IID); class nsCommentNode : public nsIDOMComment, public nsIScriptObjectOwner, - public nsIDOMEventReceiver, - public nsIContent, public nsITextContent { public: @@ -61,9 +59,6 @@ public: // nsIScriptObjectOwner NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC_DOM_DATA(mInner) - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(mInner) - // nsIContent //NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner) diff --git a/layout/base/src/nsDocument.cpp b/layout/base/src/nsDocument.cpp index 09174192a99..7f821ca6f67 100644 --- a/layout/base/src/nsDocument.cpp +++ b/layout/base/src/nsDocument.cpp @@ -848,7 +848,7 @@ nsDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) return rv; } -nsresult +NS_IMETHODIMP nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup, @@ -858,6 +858,12 @@ nsDocument::StartDocumentLoad(const char* aCommand, return Reset(aChannel, aLoadGroup); } +NS_IMETHODIMP +nsDocument::StopDocumentLoad() +{ + return NS_OK; +} + const nsString* nsDocument::GetDocumentTitle() const { return mDocumentTitle; diff --git a/layout/base/src/nsDocument.h b/layout/base/src/nsDocument.h index 6989505fe31..2ea591ee5a7 100644 --- a/layout/base/src/nsDocument.h +++ b/layout/base/src/nsDocument.h @@ -110,7 +110,6 @@ class nsDocument : public nsIDocument, public nsIDOMDocument, public nsIDOMNSDocument, public nsIDiskDocument, - public nsIScriptObjectOwner, public nsIJSScriptObject, public nsSupportsWeakReference, public nsIDOMEventReceiver, @@ -127,6 +126,8 @@ public: nsISupports* aContainer, nsIStreamListener **aDocListener); + NS_IMETHOD StopDocumentLoad(); + /** * Return the title of the document. May return null. */ diff --git a/layout/base/src/nsDocumentViewer.cpp b/layout/base/src/nsDocumentViewer.cpp index 220fe5ce1bf..c1e8f54deb1 100644 --- a/layout/base/src/nsDocumentViewer.cpp +++ b/layout/base/src/nsDocumentViewer.cpp @@ -537,6 +537,10 @@ DocumentViewerImpl::Init(nsIWidget* aParentWidget, NS_IMETHODIMP DocumentViewerImpl::Stop(void) { + if (mDocument) { + mDocument->StopDocumentLoad(); + } + if (mPresContext) { mPresContext->Stop(); } diff --git a/layout/base/src/nsGenericDOMDataNode.cpp b/layout/base/src/nsGenericDOMDataNode.cpp index 84f9c1f90ef..91eef154ebb 100644 --- a/layout/base/src/nsGenericDOMDataNode.cpp +++ b/layout/base/src/nsGenericDOMDataNode.cpp @@ -494,8 +494,6 @@ nsGenericDOMDataNode::SetScriptObject(void *aScriptObject) //---------------------------------------------------------------------- -// nsIDOMEventReceiver implementation - nsresult nsGenericDOMDataNode::GetListenerManager(nsIEventListenerManager** aResult) { @@ -512,72 +510,6 @@ nsGenericDOMDataNode::GetListenerManager(nsIEventListenerManager** aResult) return rv; } -nsresult -nsGenericDOMDataNode::GetNewListenerManager(nsIEventListenerManager** aResult) -{ - return NS_NewEventListenerManager(aResult); -} - -nsresult -nsGenericDOMDataNode::HandleEvent(nsIDOMEvent *aEvent) -{ - return NS_ERROR_FAILURE; -} - -nsresult -nsGenericDOMDataNode::AddEventListenerByIID(nsIDOMEventListener* aListener, - const nsIID& aIID) -{ - nsIEventListenerManager *manager; - - if (NS_OK == GetListenerManager(&manager)) { - manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); - NS_RELEASE(manager); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -nsresult -nsGenericDOMDataNode::RemoveEventListenerByIID(nsIDOMEventListener* aListener, - const nsIID& aIID) -{ - if (nsnull != mListenerManager) { - mListenerManager->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -nsresult -nsGenericDOMDataNode::AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) -{ - nsIEventListenerManager *manager; - - if (NS_OK == GetListenerManager(&manager)) { - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - manager->AddEventListenerByType(aListener, aType, flags); - NS_RELEASE(manager); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -nsresult -nsGenericDOMDataNode::RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) -{ - if (nsnull != mListenerManager) { - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - mListenerManager->RemoveEventListenerByType(aListener, aType, flags); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - //---------------------------------------------------------------------- // Implementation of nsIContent diff --git a/layout/base/src/nsGenericDOMDataNode.h b/layout/base/src/nsGenericDOMDataNode.h index ca4cb2ca651..336af7900d3 100644 --- a/layout/base/src/nsGenericDOMDataNode.h +++ b/layout/base/src/nsGenericDOMDataNode.h @@ -22,6 +22,7 @@ #ifndef nsGenericDOMDataNode_h___ #define nsGenericDOMDataNode_h___ +#include "nsCOMPtr.h" #include "nsIDOMCharacterData.h" #include "nsIScriptObjectOwner.h" #include "nsIDOMEventReceiver.h" @@ -31,6 +32,7 @@ #include "nsINameSpaceManager.h" #include "nsITextContent.h" #include "nsDOMError.h" +#include "nsIEventListenerManager.h" extern const nsIID kIDOMCharacterDataIID; extern const nsIID kIDOMNodeIID; @@ -43,7 +45,6 @@ extern const nsIID kIContentIID; class nsIDOMAttr; class nsIDOMEventListener; class nsIDOMNodeList; -class nsIEventListenerManager; class nsIFrame; class nsIStyleContext; class nsIStyleRule; @@ -105,19 +106,6 @@ struct nsGenericDOMDataNode { nsresult DeleteData(PRUint32 aOffset, PRUint32 aCount); nsresult ReplaceData(PRUint32 aOffset, PRUint32 aCount, const nsString& aArg); - // nsIDOMEventReceiver interface - nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID); - nsresult RemoveEventListenerByIID(nsIDOMEventListener* aListener, - const nsIID& aIID); - nsresult GetListenerManager(nsIEventListenerManager** aInstancePtrResult); - nsresult GetNewListenerManager(nsIEventListenerManager** aInstancePtrResult); - nsresult HandleEvent(nsIDOMEvent *aEvent); - - // nsIDOMEventTarget interface - nsresult AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture); - nsresult RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture); // nsIScriptObjectOwner interface nsresult GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); @@ -227,6 +215,8 @@ struct nsGenericDOMDataNode { //---------------------------------------- + nsresult GetListenerManager(nsIEventListenerManager** aInstancePtrResult); + void ToCString(nsString& aBuf, PRInt32 aOffset, PRInt32 aLen) const; // Up pointer to the real content object that we are @@ -549,16 +539,18 @@ struct nsGenericDOMDataNode { return NS_OK; \ } \ if (_id.Equals(kIDOMEventReceiverIID)) { \ - nsIDOMEventReceiver* tmp = _this; \ - *_iptr = (void*) tmp; \ - NS_ADDREF_THIS(); \ - return NS_OK; \ + nsCOMPtr man; \ + if (NS_SUCCEEDED(mInner.GetListenerManager(getter_AddRefs(man)))){ \ + return man->QueryInterface(kIDOMEventReceiverIID, (void**)_iptr); \ + } \ + return NS_NOINTERFACE; \ } \ if (_id.Equals(kIDOMEventTargetIID)) { \ - nsIDOMEventTarget* tmp = _this; \ - *_iptr = (void*) tmp; \ - NS_ADDREF_THIS(); \ - return NS_OK; \ + nsCOMPtr man; \ + if (NS_SUCCEEDED(mInner.GetListenerManager(getter_AddRefs(man)))){ \ + return man->QueryInterface(kIDOMEventTargetIID, (void**)_iptr); \ + } \ + return NS_NOINTERFACE; \ } \ if (_id.Equals(kIScriptObjectOwnerIID)) { \ nsIScriptObjectOwner* tmp = _this; \ diff --git a/layout/base/src/nsGenericElement.cpp b/layout/base/src/nsGenericElement.cpp index f053fc1bef0..b6bbd8505f1 100644 --- a/layout/base/src/nsGenericElement.cpp +++ b/layout/base/src/nsGenericElement.cpp @@ -380,7 +380,6 @@ nsGenericElement::nsGenericElement() mTag = nsnull; mContent = nsnull; mDOMSlots = nsnull; - mListenerManager = nsnull; mContentID = 0; } @@ -389,7 +388,6 @@ nsGenericElement::~nsGenericElement() // pop any enclosed ranges out // nsRange::OwnerGone(mContent); not used for now NS_IF_RELEASE(mTag); - NS_IF_RELEASE(mListenerManager); if (nsnull != mDOMSlots) { if (nsnull != mDOMSlots->mChildNodes) { mDOMSlots->mChildNodes->DropReference(); @@ -404,6 +402,7 @@ nsGenericElement::~nsGenericElement() mDOMSlots->mAttributeMap->DropReference(); NS_RELEASE(mDOMSlots->mAttributeMap); } + NS_IF_RELEASE(mDOMSlots->mListenerManager); // XXX Should really be arena managed PR_DELETE(mDOMSlots); } @@ -420,11 +419,27 @@ nsGenericElement::GetDOMSlots() mDOMSlots->mAttributeMap = nsnull; mDOMSlots->mRangeList = nsnull; mDOMSlots->mCapturer = nsnull; + mDOMSlots->mListenerManager = nsnull; } return mDOMSlots; } +void +nsGenericElement::MaybeClearDOMSlots() +{ + if (mDOMSlots && + (nsnull == mDOMSlots->mScriptObject) && + (nsnull == mDOMSlots->mChildNodes) && + (nsnull == mDOMSlots->mStyle) && + (nsnull == mDOMSlots->mAttributeMap) && + (nsnull == mDOMSlots->mRangeList) && + (nsnull == mDOMSlots->mCapturer) && + (nsnull == mDOMSlots->mListenerManager)) { + PR_DELETE(mDOMSlots); + } +} + void nsGenericElement::Init(nsIContent* aOuterContentObject, nsIAtom* aTag) @@ -1004,9 +1019,9 @@ nsGenericElement::HandleDOMEvent(nsIPresContext* aPresContext, } //Local handling stage - if (mListenerManager && !(aEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH)) { + if (mDOMSlots && mDOMSlots->mListenerManager && !(aEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH)) { aEvent->flags |= aFlags; - mListenerManager->HandleEvent(aPresContext, aEvent, aDOMEvent, aFlags, aEventStatus); + mDOMSlots->mListenerManager->HandleEvent(aPresContext, aEvent, aDOMEvent, aFlags, aEventStatus); aEvent->flags &= ~aFlags; } @@ -1090,11 +1105,7 @@ nsGenericElement::RangeRemove(nsIDOMRange& aRange) if (mDOMSlots->mRangeList->Count() == 0) { delete mDOMSlots->mRangeList; mDOMSlots->mRangeList = nsnull; - if ( (mDOMSlots->mScriptObject == nsnull) && - (mDOMSlots->mChildNodes == nsnull) && - (mDOMSlots->mStyle == nsnull) ) { - PR_DELETE(mDOMSlots); - } + MaybeClearDOMSlots(); } return NS_OK; } @@ -1220,9 +1231,10 @@ nsGenericElement::SetScriptObject(void *aScriptObject) slots->mScriptObject = aScriptObject; if (!aScriptObject) { - if (mListenerManager) { - mListenerManager->RemoveAllListeners(PR_TRUE); + if (slots->mListenerManager) { + slots->mListenerManager->RemoveAllListeners(PR_TRUE); } + MaybeClearDOMSlots(); } return NS_OK; @@ -1230,90 +1242,24 @@ nsGenericElement::SetScriptObject(void *aScriptObject) //---------------------------------------------------------------------- -// nsIDOMEventReceiver implementation - nsresult nsGenericElement::GetListenerManager(nsIEventListenerManager** aResult) { - if (nsnull != mListenerManager) { - NS_ADDREF(mListenerManager); - *aResult = mListenerManager; + nsDOMSlots *slots = GetDOMSlots(); + + if (nsnull != slots->mListenerManager) { + NS_ADDREF(slots->mListenerManager); + *aResult = slots->mListenerManager; return NS_OK; } nsresult rv = NS_NewEventListenerManager(aResult); if (NS_OK == rv) { - mListenerManager = *aResult; - NS_ADDREF(mListenerManager); + slots->mListenerManager = *aResult; + NS_ADDREF(slots->mListenerManager); } return rv; } -nsresult -nsGenericElement::GetNewListenerManager(nsIEventListenerManager** aResult) -{ - return NS_NewEventListenerManager(aResult); -} - -nsresult -nsGenericElement::HandleEvent(nsIDOMEvent *aEvent) -{ - return NS_ERROR_FAILURE; -} - -nsresult -nsGenericElement::AddEventListenerByIID(nsIDOMEventListener* aListener, - const nsIID& aIID) -{ - nsIEventListenerManager *manager; - - if (NS_OK == GetListenerManager(&manager)) { - manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); - NS_RELEASE(manager); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -nsresult -nsGenericElement::RemoveEventListenerByIID(nsIDOMEventListener* aListener, - const nsIID& aIID) -{ - if (nsnull != mListenerManager) { - mListenerManager->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -nsresult -nsGenericElement::AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) -{ - nsIEventListenerManager *manager; - - if (NS_OK == GetListenerManager(&manager)) { - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - manager->AddEventListenerByType(aListener, aType, flags); - NS_RELEASE(manager); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -nsresult -nsGenericElement::RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) -{ - if (nsnull != mListenerManager) { - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - mListenerManager->RemoveEventListenerByType(aListener, aType, flags); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - //---------------------------------------------------------------------- // nsIJSScriptObject implementation diff --git a/layout/base/src/nsGenericElement.h b/layout/base/src/nsGenericElement.h index 17b1d662c05..8f761c46341 100644 --- a/layout/base/src/nsGenericElement.h +++ b/layout/base/src/nsGenericElement.h @@ -22,6 +22,7 @@ #ifndef nsGenericElement_h___ #define nsGenericElement_h___ +#include "nsCOMPtr.h" #include "nsIContent.h" #include "nsIDOMAttr.h" #include "nsIDOMNamedNodeMap.h" @@ -32,6 +33,7 @@ #include "nsIJSScriptObject.h" #include "nsILinkHandler.h" #include "nsGenericDOMNodeList.h" +#include "nsIEventListenerManager.h" extern const nsIID kIDOMNodeIID; extern const nsIID kIDOMElementIID; @@ -44,7 +46,6 @@ extern const nsIID kIContentIID; class nsIDOMAttr; class nsIDOMEventListener; -class nsIEventListenerManager; class nsIFrame; class nsISupportsArray; class nsIDOMScriptObjectFactory; @@ -115,14 +116,12 @@ typedef struct { nsDOMAttributeMap* mAttributeMap; nsVoidArray *mRangeList; nsIContent* mCapturer; + nsIEventListenerManager* mListenerManager; } nsDOMSlots; -class nsGenericElement : public nsIJSScriptObject { +class nsGenericElement { public: nsGenericElement(); -#if 1 - virtual // XXX temporary until vidur fixes this up -#endif ~nsGenericElement(); void Init(nsIContent* aOuterContentObject, nsIAtom* aTag); @@ -151,20 +150,6 @@ public: nsIDOMNodeList** aReturn); nsresult Normalize(); - // nsIDOMEventReceiver interface - nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID); - nsresult RemoveEventListenerByIID(nsIDOMEventListener* aListener, - const nsIID& aIID); - nsresult GetListenerManager(nsIEventListenerManager** aInstancePtrResult); - nsresult GetNewListenerManager(nsIEventListenerManager** aInstancePtrResult); - nsresult HandleEvent(nsIDOMEvent *aEvent); - - // nsIDOMEventTarget interface - nsresult AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture); - nsresult RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture); - // nsIScriptObjectOwner interface nsresult GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); nsresult SetScriptObject(void *aScriptObject); @@ -223,6 +208,8 @@ public: //---------------------------------------- + nsresult GetListenerManager(nsIEventListenerManager** aInstancePtrResult); + nsresult RenderFrame(nsIPresContext*); nsresult AddScriptEventListener(nsIAtom* aAttribute, @@ -249,6 +236,7 @@ public: static nsIAtom* CutNameSpacePrefix(nsString& aString); nsDOMSlots *GetDOMSlots(); + void MaybeClearDOMSlots(); // Up pointer to the real content object that we are // supporting. Sometimes there is work that we just can't do @@ -256,10 +244,9 @@ public: // work. nsIContent* mContent; - nsIDocument* mDocument; - nsIContent* mParent; + nsIDocument* mDocument; // WEAK + nsIContent* mParent; // WEAK nsIAtom* mTag; - nsIEventListenerManager* mListenerManager; nsDOMSlots *mDOMSlots; PRUint32 mContentID; }; @@ -913,6 +900,37 @@ public: return _g.SetScriptObject(aScriptObject); \ } +#define NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(_g) \ + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(_g) \ + virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, \ + jsval aID, jsval *aVp) { \ + return _g.AddProperty(aContext, aObj, aID, aVp); \ + } \ + virtual PRBool DeleteProperty(JSContext *aContext, JSObject *aObj, \ + jsval aID, jsval *aVp) { \ + return _g.DeleteProperty(aContext, aObj, aID, aVp); \ + } \ + virtual PRBool GetProperty(JSContext *aContext, JSObject *aObj, \ + jsval aID, jsval *aVp) { \ + return _g.GetProperty(aContext, aObj, aID, aVp); \ + } \ + virtual PRBool SetProperty(JSContext *aContext, JSObject *aObj, \ + jsval aID, jsval *aVp) { \ + return _g.SetProperty(aContext, aObj, aID, aVp); \ + } \ + virtual PRBool EnumerateProperty(JSContext *aContext, JSObject *aObj) { \ + return _g.EnumerateProperty(aContext, aObj); \ + } \ + virtual PRBool Resolve(JSContext *aContext, JSObject *aObj, jsval aID) { \ + return _g.EnumerateProperty(aContext, aObj); \ + } \ + virtual PRBool Convert(JSContext *aContext, JSObject *aObj, jsval aID) { \ + return _g.EnumerateProperty(aContext, aObj); \ + } \ + virtual void Finalize(JSContext *aContext, JSObject *aObj) { \ + _g.Finalize(aContext, aObj); \ + } + #define NS_IMPL_CONTENT_QUERY_INTERFACE(_id, _iptr, _this, _base) \ if (_id.Equals(kISupportsIID)) { \ _base* tmp = _this; \ @@ -934,16 +952,18 @@ public: return NS_OK; \ } \ if (_id.Equals(kIDOMEventReceiverIID)) { \ - nsIDOMEventReceiver* tmp = _this; \ - *_iptr = (void*) tmp; \ - NS_ADDREF_THIS(); \ - return NS_OK; \ + nsCOMPtr man; \ + if (NS_SUCCEEDED(mInner.GetListenerManager(getter_AddRefs(man)))){ \ + return man->QueryInterface(kIDOMEventReceiverIID, (void**)_iptr); \ + } \ + return NS_NOINTERFACE; \ } \ if (_id.Equals(kIDOMEventTargetIID)) { \ - nsIDOMEventTarget* tmp = _this; \ - *_iptr = (void*) tmp; \ - NS_ADDREF_THIS(); \ - return NS_OK; \ + nsCOMPtr man; \ + if (NS_SUCCEEDED(mInner.GetListenerManager(getter_AddRefs(man)))){ \ + return man->QueryInterface(kIDOMEventTargetIID, (void**)_iptr); \ + } \ + return NS_NOINTERFACE; \ } \ if (_id.Equals(kIScriptObjectOwnerIID)) { \ nsIScriptObjectOwner* tmp = _this; \ @@ -959,7 +979,7 @@ public: return NS_OK; \ } \ if (_id.Equals(kIJSScriptObjectIID)) { \ - nsIJSScriptObject* tmp = (nsIJSScriptObject*)&mInner; \ + nsIJSScriptObject* tmp = _this; \ *_iptr = (void*) tmp; \ NS_ADDREF_THIS(); \ return NS_OK; \ diff --git a/layout/base/src/nsNameSpaceManager.cpp b/layout/base/src/nsNameSpaceManager.cpp index d464536871b..4853b3e1f6f 100644 --- a/layout/base/src/nsNameSpaceManager.cpp +++ b/layout/base/src/nsNameSpaceManager.cpp @@ -34,6 +34,7 @@ static NS_DEFINE_IID(kINameSpaceIID, NS_INAMESPACE_IID); static const char kXMLNSNameSpaceURI[] = ""; static const char kXMLNameSpaceURI[] = "http://www.w3.org/XML/1998/namespace"; static const char kHTMLNameSpaceURI[] = "http://www.w3.org/TR/REC-html40"; // XXX?? "urn:w3-org-ns:HTML"?? +static const char kXHTMLNameSpaceURI[] = "http://www.w3.org/1999/xhtml"; //----------------------------------------------------------- // Name Space ID table support @@ -109,15 +110,19 @@ static void AddRefTable() nsString* xmlns = new nsString(kXMLNSNameSpaceURI); nsString* xml = new nsString(kXMLNameSpaceURI); nsString* html = new nsString(kHTMLNameSpaceURI); + nsString* xhtml = new nsString(kXHTMLNameSpaceURI); gURIArray->AppendElement(xmlns); // ordering here needs to match IDs gURIArray->AppendElement(xml); gURIArray->AppendElement(html); + gURIArray->AppendElement(xhtml); NameSpaceURIKey xmlnsKey(xmlns); NameSpaceURIKey xmlKey(xml); NameSpaceURIKey htmlKey(html); + NameSpaceURIKey xhtmlKey(xhtml); gURIToIDTable->Put(&xmlnsKey, (void*)kNameSpaceID_XMLNS); gURIToIDTable->Put(&xmlKey, (void*)kNameSpaceID_XML); gURIToIDTable->Put(&htmlKey, (void*)kNameSpaceID_HTML); + gURIToIDTable->Put(&xhtmlKey, (void*)kNameSpaceID_HTML); } NS_ASSERTION(nsnull != gURIToIDTable, "no URI table"); NS_ASSERTION(nsnull != gURIArray, "no URI array"); diff --git a/layout/base/src/nsStyleContext.cpp b/layout/base/src/nsStyleContext.cpp index d73e1b6fcaf..b562999b423 100644 --- a/layout/base/src/nsStyleContext.cpp +++ b/layout/base/src/nsStyleContext.cpp @@ -766,7 +766,7 @@ PRInt32 StyleSpacingImpl::CalcDifference(const StyleSpacingImpl& aOther) const (mOutlineStyle != aOther.mOutlineStyle) || (mOutlineColor != aOther.mOutlineColor) || (mOutlineRadius != aOther.mOutlineRadius)) { - return NS_STYLE_HINT_REFLOW; // XXX: should be VISUAL: see bugs 9809 and 9816 + return NS_STYLE_HINT_VISUAL; // XXX: should be VISUAL: see bugs 9809 and 9816 } return NS_STYLE_HINT_NONE; } diff --git a/layout/base/src/nsTextNode.cpp b/layout/base/src/nsTextNode.cpp index 6c7cf57d004..ed401bf5ae5 100644 --- a/layout/base/src/nsTextNode.cpp +++ b/layout/base/src/nsTextNode.cpp @@ -36,8 +36,6 @@ static NS_DEFINE_IID(kITextContentIID, NS_ITEXT_CONTENT_IID); class nsTextNode : public nsIDOMText, public nsIScriptObjectOwner, - public nsIDOMEventReceiver, - public nsIContent, public nsITextContent { public: @@ -59,9 +57,6 @@ public: // nsIScriptObjectOwner NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC_DOM_DATA(mInner) - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(mInner) - // nsIContent NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner) diff --git a/layout/events/src/nsEventListenerManager.cpp b/layout/events/src/nsEventListenerManager.cpp index 64b63881434..219386c3759 100644 --- a/layout/events/src/nsEventListenerManager.cpp +++ b/layout/events/src/nsEventListenerManager.cpp @@ -96,7 +96,12 @@ nsEventListenerManager::~nsEventListenerManager() NS_IMPL_ADDREF(nsEventListenerManager) NS_IMPL_RELEASE(nsEventListenerManager) -NS_IMPL_QUERY_INTERFACE1(nsEventListenerManager, nsIEventListenerManager) +NS_INTERFACE_MAP_BEGIN(nsEventListenerManager) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIEventListenerManager) + NS_INTERFACE_MAP_ENTRY(nsIEventListenerManager) + NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget) + NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver) +NS_INTERFACE_MAP_END nsVoidArray** nsEventListenerManager::GetListenersByIID(const nsIID& aIID) { @@ -1200,7 +1205,9 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext, case NS_PAGE_LOAD: case NS_PAGE_UNLOAD: - + case NS_IMAGE_LOAD: + case NS_IMAGE_ERROR: + if (nsnull != mLoadListeners) { if (nsnull == *aDOMEvent) { ret = NS_NewDOMUIEvent(aDOMEvent, aPresContext, aEvent); @@ -1216,11 +1223,14 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext, if (NS_OK == ls->mListener->QueryInterface(kIDOMLoadListenerIID, (void**)&mLoadListener)) { switch(aEvent->message) { case NS_PAGE_LOAD: + case NS_IMAGE_LOAD: ret = mLoadListener->Load(*aDOMEvent); break; case NS_PAGE_UNLOAD: ret = mLoadListener->Unload(*aDOMEvent); break; + case NS_IMAGE_ERROR: + ret = mLoadListener->Error(*aDOMEvent); default: break; } @@ -1231,6 +1241,7 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext, PRUint32 subType = 0; switch(aEvent->message) { case NS_PAGE_LOAD: + case NS_IMAGE_LOAD: subType = NS_EVENT_BITS_LOAD_LOAD; if (ls->mSubType & NS_EVENT_BITS_LOAD_LOAD) { correctSubType = PR_TRUE; @@ -1242,6 +1253,12 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext, correctSubType = PR_TRUE; } break; + case NS_IMAGE_ERROR: + subType = NS_EVENT_BITS_LOAD_ERROR; + if (ls->mSubType & NS_EVENT_BITS_LOAD_ERROR) { + correctSubType = PR_TRUE; + } + break; default: break; } @@ -1733,6 +1750,62 @@ nsresult nsEventListenerManager::RemoveAllListeners(PRBool aScriptOnly) return NS_OK; } +// nsIDOMEventTarget interface +NS_IMETHODIMP +nsEventListenerManager::AddEventListener(const nsString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) +{ + PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; + + return AddEventListenerByType(aListener, aType, flags); +} + +NS_IMETHODIMP +nsEventListenerManager::RemoveEventListener(const nsString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) +{ + PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; + + return RemoveEventListenerByType(aListener, aType, flags); +} + +// nsIDOMEventReceiver interface +NS_IMETHODIMP +nsEventListenerManager::AddEventListenerByIID(nsIDOMEventListener *aListener, + const nsIID& aIID) +{ + return AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); +} + +NS_IMETHODIMP +nsEventListenerManager::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID) +{ + return RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); +} + +NS_IMETHODIMP +nsEventListenerManager::GetListenerManager(nsIEventListenerManager** aInstancePtrResult) +{ + NS_ENSURE_ARG_POINTER(aInstancePtrResult); + *aInstancePtrResult = NS_STATIC_CAST(nsIEventListenerManager*, this); + NS_ADDREF(*aInstancePtrResult); + return NS_OK; +} + +NS_IMETHODIMP +nsEventListenerManager::GetNewListenerManager(nsIEventListenerManager **aInstancePtrResult) +{ + return NS_NewEventListenerManager(aInstancePtrResult); +} + +NS_IMETHODIMP +nsEventListenerManager::HandleEvent(nsIDOMEvent *aEvent) +{ + return NS_ERROR_FAILURE; +} + NS_HTML nsresult NS_NewEventListenerManager(nsIEventListenerManager** aInstancePtrResult) { nsIEventListenerManager* l = new nsEventListenerManager(); @@ -1747,3 +1820,4 @@ NS_HTML nsresult NS_NewEventListenerManager(nsIEventListenerManager** aInstanceP return NS_ERROR_FAILURE; } + diff --git a/layout/events/src/nsEventListenerManager.h b/layout/events/src/nsEventListenerManager.h index 5c822fd1a75..d9662e7fcfc 100644 --- a/layout/events/src/nsEventListenerManager.h +++ b/layout/events/src/nsEventListenerManager.h @@ -27,6 +27,7 @@ #include "jsapi.h" #include "nsCOMPtr.h" #include "nsIPrincipal.h" +#include "nsIDOMEventReceiver.h" class nsIDOMEvent; class nsIAtom; @@ -46,7 +47,9 @@ typedef struct { * Event listener manager */ -class nsEventListenerManager : public nsIEventListenerManager { +class nsEventListenerManager : public nsIEventListenerManager, + public nsIDOMEventReceiver +{ public: nsEventListenerManager(); @@ -102,6 +105,21 @@ public: static nsresult GetIdentifiersForType(nsIAtom* aType, nsIID& aIID, PRInt32* aSubType); + // nsIDOMEventTarget interface + NS_IMETHOD AddEventListener(const nsString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture); + NS_IMETHOD RemoveEventListener(const nsString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture); + + // nsIDOMEventReceiver interface + NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID); + NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID); + NS_IMETHOD GetListenerManager(nsIEventListenerManager** aInstancePtrResult); + NS_IMETHOD GetNewListenerManager(nsIEventListenerManager **aInstancePtrResult); + NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent); + protected: nsresult HandleEventSubType(nsListenerStruct* aListenerStruct, nsIDOMEvent* aDOMEvent, diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 82961fea879..9150b7950a1 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -338,14 +338,14 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext, return NS_ERROR_FAILURE; nsCOMPtr content; - elementFactory->CreateInstanceByTag("scrollbar", getter_AddRefs(content)); - content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, "horizontal", PR_FALSE); + elementFactory->CreateInstanceByTag(nsAutoString("scrollbar"), getter_AddRefs(content)); + content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, nsAutoString("horizontal"), PR_FALSE); aAnonymousChildren.AppendElement(content); // create vertical scrollbar content = nsnull; - elementFactory->CreateInstanceByTag("scrollbar", getter_AddRefs(content)); - content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, "vertical", PR_FALSE); + elementFactory->CreateInstanceByTag(nsAutoString("scrollbar"), getter_AddRefs(content)); + content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, nsAutoString("vertical"), PR_FALSE); aAnonymousChildren.AppendElement(content); // XXX For GFX never have scrollbars @@ -828,7 +828,7 @@ nsGfxScrollFrameInner::AttributeChanged(nsIDocument *aDocument, nscoord x = 0; nscoord y = 0; - nsString value; + nsAutoString value; if (NS_CONTENT_ATTR_HAS_VALUE == hcontent->GetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, value)) { PRInt32 error; @@ -1044,12 +1044,12 @@ nsGfxScrollFrameInner::CalculateChildTotalSize(nsIFrame* aKidFrame, void nsGfxScrollFrameInner::SetScrollbarVisibility(nsIFrame* aScrollbar, PRBool aVisible) { - nsString oldStyle = ""; + nsAutoString oldStyle = ""; nsCOMPtr child; aScrollbar->GetContent(getter_AddRefs(child)); child->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, oldStyle); - nsString newStyle; + nsAutoString newStyle; if (aVisible) newStyle = ""; else @@ -1722,7 +1722,7 @@ nsGfxScrollFrameInner::SetAttribute(nsIFrame* aFrame, nsIAtom* aAtom, nscoord aS aFrame->GetContent(getter_AddRefs(content)); char ch[100]; sprintf(ch,"%d", aSize); - nsString newValue(ch); + nsAutoString newValue(ch); content->SetAttribute(kNameSpaceID_None, aAtom, newValue, aReflow); return PR_TRUE; } @@ -1736,7 +1736,7 @@ nsGfxScrollFrameInner::GetIntegerAttribute(nsIFrame* aFrame, nsIAtom* atom, PRIn nsCOMPtr content; aFrame->GetContent(getter_AddRefs(content)); - nsString value; + nsAutoString value; if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, atom, value)) { PRInt32 error; @@ -1880,7 +1880,7 @@ nsBoxFrame::GetRedefinedMinPrefMax(nsIFrame* aFrame, nsBoxInfo& aSize) aFrame->GetContent(getter_AddRefs(content)); PRInt32 error; - nsString value; + nsAutoString value; if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsXULAtoms::flex, value)) { diff --git a/layout/html/base/src/nsGfxScrollFrame.cpp b/layout/html/base/src/nsGfxScrollFrame.cpp index 82961fea879..9150b7950a1 100644 --- a/layout/html/base/src/nsGfxScrollFrame.cpp +++ b/layout/html/base/src/nsGfxScrollFrame.cpp @@ -338,14 +338,14 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext, return NS_ERROR_FAILURE; nsCOMPtr content; - elementFactory->CreateInstanceByTag("scrollbar", getter_AddRefs(content)); - content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, "horizontal", PR_FALSE); + elementFactory->CreateInstanceByTag(nsAutoString("scrollbar"), getter_AddRefs(content)); + content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, nsAutoString("horizontal"), PR_FALSE); aAnonymousChildren.AppendElement(content); // create vertical scrollbar content = nsnull; - elementFactory->CreateInstanceByTag("scrollbar", getter_AddRefs(content)); - content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, "vertical", PR_FALSE); + elementFactory->CreateInstanceByTag(nsAutoString("scrollbar"), getter_AddRefs(content)); + content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, nsAutoString("vertical"), PR_FALSE); aAnonymousChildren.AppendElement(content); // XXX For GFX never have scrollbars @@ -828,7 +828,7 @@ nsGfxScrollFrameInner::AttributeChanged(nsIDocument *aDocument, nscoord x = 0; nscoord y = 0; - nsString value; + nsAutoString value; if (NS_CONTENT_ATTR_HAS_VALUE == hcontent->GetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, value)) { PRInt32 error; @@ -1044,12 +1044,12 @@ nsGfxScrollFrameInner::CalculateChildTotalSize(nsIFrame* aKidFrame, void nsGfxScrollFrameInner::SetScrollbarVisibility(nsIFrame* aScrollbar, PRBool aVisible) { - nsString oldStyle = ""; + nsAutoString oldStyle = ""; nsCOMPtr child; aScrollbar->GetContent(getter_AddRefs(child)); child->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, oldStyle); - nsString newStyle; + nsAutoString newStyle; if (aVisible) newStyle = ""; else @@ -1722,7 +1722,7 @@ nsGfxScrollFrameInner::SetAttribute(nsIFrame* aFrame, nsIAtom* aAtom, nscoord aS aFrame->GetContent(getter_AddRefs(content)); char ch[100]; sprintf(ch,"%d", aSize); - nsString newValue(ch); + nsAutoString newValue(ch); content->SetAttribute(kNameSpaceID_None, aAtom, newValue, aReflow); return PR_TRUE; } @@ -1736,7 +1736,7 @@ nsGfxScrollFrameInner::GetIntegerAttribute(nsIFrame* aFrame, nsIAtom* atom, PRIn nsCOMPtr content; aFrame->GetContent(getter_AddRefs(content)); - nsString value; + nsAutoString value; if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, atom, value)) { PRInt32 error; @@ -1880,7 +1880,7 @@ nsBoxFrame::GetRedefinedMinPrefMax(nsIFrame* aFrame, nsBoxInfo& aSize) aFrame->GetContent(getter_AddRefs(content)); PRInt32 error; - nsString value; + nsAutoString value; if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsXULAtoms::flex, value)) { diff --git a/layout/html/content/src/nsAttributeContent.cpp b/layout/html/content/src/nsAttributeContent.cpp index b95c61f6027..6fbdaea5a6e 100644 --- a/layout/html/content/src/nsAttributeContent.cpp +++ b/layout/html/content/src/nsAttributeContent.cpp @@ -74,7 +74,7 @@ static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID); static NS_DEFINE_IID(kITextContentIID, NS_ITEXT_CONTENT_IID); -class nsAttributeContent : public nsIContent, public nsITextContent, public nsIAttributeContent { +class nsAttributeContent : public nsITextContent, public nsIAttributeContent { public: friend nsresult NS_NewAttributeContent(nsAttributeContent** aNewFrame); diff --git a/layout/html/content/src/nsHTMLAnchorElement.cpp b/layout/html/content/src/nsHTMLAnchorElement.cpp index 24979aec6e7..c03407b18a7 100644 --- a/layout/html/content/src/nsHTMLAnchorElement.cpp +++ b/layout/html/content/src/nsHTMLAnchorElement.cpp @@ -20,6 +20,7 @@ * Contributor(s): */ #include "nsIDOMHTMLAnchorElement.h" +#include "nsIDOMNSHTMLAnchorElement.h" #include "nsIScriptObjectOwner.h" #include "nsIDOMEventReceiver.h" #include "nsIHTMLContent.h" @@ -30,7 +31,7 @@ #include "nsIMutableStyleContext.h" #include "nsStyleConsts.h" #include "nsIPresContext.h" -#include "nsINameSpaceManager.h" +#include "nsIEventStateManager.h" #include "nsIURL.h" #include "nsIFocusableContent.h" @@ -52,8 +53,8 @@ static NS_DEFINE_IID(kIDOMHTMLAnchorElementIID, NS_IDOMHTMLANCHORELEMENT_IID); static NS_DEFINE_IID(kIFocusableContentIID, NS_IFOCUSABLECONTENT_IID); class nsHTMLAnchorElement : public nsIDOMHTMLAnchorElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIDOMNSHTMLAnchorElement, + public nsIJSScriptObject, public nsIHTMLContent, public nsIFocusableContent { @@ -101,11 +102,18 @@ public: NS_IMETHOD Blur(); NS_IMETHOD Focus(); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + // nsIDOMNSHTMLAnchorElement + NS_IMETHOD GetProtocol(nsString& aProtocol); + NS_IMETHOD GetHost(nsString& aHost); + NS_IMETHOD GetHostname(nsString& aHostname); + NS_IMETHOD GetPathname(nsString& aPathname); + NS_IMETHOD GetSearch(nsString& aSearch); + NS_IMETHOD GetPort(nsString& aPort); + NS_IMETHOD GetHash(nsString& aHash); + NS_IMETHOD GetText(nsString& aText); - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) @@ -165,6 +173,11 @@ nsHTMLAnchorElement::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_ADDREF_THIS(); return NS_OK; } + else if (aIID.Equals(NS_GET_IID(nsIDOMNSHTMLAnchorElement))) { + *aInstancePtr = (void*)(nsIDOMNSHTMLAnchorElement*) this; + NS_ADDREF_THIS(); + return NS_OK; + } return NS_NOINTERFACE; } @@ -383,3 +396,205 @@ nsHTMLAnchorElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const { return mInner.SizeOf(aSizer, aResult, sizeof(*this)); } + +NS_IMETHODIMP +nsHTMLAnchorElement::GetProtocol(nsString& aProtocol) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + char* protocol; + result = url->GetScheme(&protocol); + if (result == NS_OK) { + aProtocol.SetString(protocol); + aProtocol.Append(":"); + nsCRT::free(protocol); + } + NS_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAnchorElement::GetHost(nsString& aHost) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + char* host; + result = url->GetHost(&host); + if (result == NS_OK) { + aHost.SetString(host); + nsCRT::free(host); + PRInt32 port; + (void)url->GetPort(&port); + if (-1 != port) { + aHost.Append(":"); + aHost.Append(port, 10); + } + } + NS_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAnchorElement::GetHostname(nsString& aHostname) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + char* host; + result = url->GetHost(&host); + if (result == NS_OK) { + aHostname.SetString(host); + nsCRT::free(host); + } + NS_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAnchorElement::GetPathname(nsString& aPathname) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + char* file; + result = url->GetPath(&file); + if (result == NS_OK) { + aPathname.SetString(file); + nsCRT::free(file); + } + NS_IF_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAnchorElement::GetSearch(nsString& aSearch) +{ + nsAutoString href; + nsIURI *uri; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&uri, href); + if (NS_OK == result) { + char *search; + nsIURL* url; + result = uri->QueryInterface(NS_GET_IID(nsIURL), (void**)&url); + if (NS_SUCCEEDED(result)) { + result = url->GetQuery(&search); + NS_RELEASE(url); + } + if (result == NS_OK && (nsnull != search) && ('\0' != *search)) { + aSearch.SetString("?"); + aSearch.Append(search); + nsCRT::free(search); + } + else { + aSearch.SetLength(0); + } + NS_RELEASE(uri); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAnchorElement::GetPort(nsString& aPort) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + aPort.SetLength(0); + PRInt32 port; + (void)url->GetPort(&port); + if (-1 != port) { + aPort.Append(port, 10); + } + NS_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAnchorElement::GetHash(nsString& aHash) +{ + nsAutoString href; + nsIURI *uri; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&uri, href); + + if (NS_OK == result) { + char *ref; + nsIURL* url; + result = uri->QueryInterface(NS_GET_IID(nsIURL), (void**)&url); + if (NS_SUCCEEDED(result)) { + result = url->GetRef(&ref); + NS_RELEASE(url); + } + if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) { + aHash.SetString("#"); + aHash.Append(ref); + nsCRT::free(ref); + } + else { + aHash.SetLength(0); + } + NS_RELEASE(uri); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAnchorElement::GetText(nsString& aText) +{ + // XXX TBI + return NS_ERROR_NOT_IMPLEMENTED; +} + diff --git a/layout/html/content/src/nsHTMLAppletElement.cpp b/layout/html/content/src/nsHTMLAppletElement.cpp index 9c0174ab035..a1add16f7c0 100644 --- a/layout/html/content/src/nsHTMLAppletElement.cpp +++ b/layout/html/content/src/nsHTMLAppletElement.cpp @@ -52,8 +52,7 @@ static NS_DEFINE_IID(kIDOMHTMLAppletElementIID, NS_IDOMHTMLAPPLETELEMENT_IID); class nsHTMLAppletElement : public nsIDOMHTMLAppletElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -96,14 +95,40 @@ public: NS_IMETHOD GetWidth(nsString& aWidth); NS_IMETHOD SetWidth(const nsString& aWidth); - // nsIScriptObjectOwner + // nsIJSScriptObject + virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, + jsval aID, jsval *aVp) { + return mInner.AddProperty(aContext, aObj, aID, aVp); + } + virtual PRBool DeleteProperty(JSContext *aContext, JSObject *aObj, + jsval aID, jsval *aVp) { + return mInner.DeleteProperty(aContext, aObj, aID, aVp); + } + virtual PRBool GetProperty(JSContext *aContext, JSObject *aObj, + jsval aID, jsval *aVp) { + return mInner.GetProperty(aContext, aObj, aID, aVp); + } + virtual PRBool SetProperty(JSContext *aContext, JSObject *aObj, + jsval aID, jsval *aVp) { + return mInner.SetProperty(aContext, aObj, aID, aVp); + } + virtual PRBool EnumerateProperty(JSContext *aContext, JSObject *aObj) { + return mInner.EnumerateProperty(aContext, aObj); + } + virtual PRBool Resolve(JSContext *aContext, JSObject *aObj, jsval aID) { + return mInner.EnumerateProperty(aContext, aObj); + } + virtual PRBool Convert(JSContext *aContext, JSObject *aObj, jsval aID) { + return mInner.EnumerateProperty(aContext, aObj); + } + virtual void Finalize(JSContext *aContext, JSObject *aObj) { + mInner.Finalize(aContext, aObj); + } + NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); NS_IMETHOD SetScriptObject(void *aScriptObject); - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) - // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLAreaElement.cpp b/layout/html/content/src/nsHTMLAreaElement.cpp index 71e162b80f8..f9de7e5f146 100644 --- a/layout/html/content/src/nsHTMLAreaElement.cpp +++ b/layout/html/content/src/nsHTMLAreaElement.cpp @@ -20,6 +20,7 @@ * Contributor(s): */ #include "nsIDOMHTMLAreaElement.h" +#include "nsIDOMNSHTMLAreaElement.h" #include "nsIScriptObjectOwner.h" #include "nsIDOMEventReceiver.h" #include "nsIHTMLContent.h" @@ -32,13 +33,14 @@ #include "nsIPresContext.h" #include "nsIFocusableContent.h" #include "nsIEventStateManager.h" +#include "nsIURL.h" +#include "nsNetUtil.h" static NS_DEFINE_IID(kIDOMHTMLAreaElementIID, NS_IDOMHTMLAREAELEMENT_IID); static NS_DEFINE_IID(kIFocusableContentIID, NS_IFOCUSABLECONTENT_IID); class nsHTMLAreaElement : public nsIDOMHTMLAreaElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIFocusableContent { @@ -76,11 +78,17 @@ public: NS_IMETHOD GetTarget(nsString& aTarget); NS_IMETHOD SetTarget(const nsString& aTarget); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + // nsIDOMNSHTMLAreaElement + NS_IMETHOD GetProtocol(nsString& aProtocol); + NS_IMETHOD GetHost(nsString& aHost); + NS_IMETHOD GetHostname(nsString& aHostname); + NS_IMETHOD GetPathname(nsString& aPathname); + NS_IMETHOD GetSearch(nsString& aSearch); + NS_IMETHOD GetPort(nsString& aPort); + NS_IMETHOD GetHash(nsString& aHash); - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) @@ -140,6 +148,11 @@ nsHTMLAreaElement::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_ADDREF_THIS(); return NS_OK; } + else if (aIID.Equals(NS_GET_IID(nsIDOMNSHTMLAreaElement))) { + *aInstancePtr = (void*)(nsIDOMNSHTMLAreaElement*) this; + NS_ADDREF_THIS(); + return NS_OK; + } return NS_NOINTERFACE; } @@ -259,3 +272,197 @@ nsHTMLAreaElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const { return mInner.SizeOf(aSizer, aResult, sizeof(*this)); } + +NS_IMETHODIMP +nsHTMLAreaElement::GetProtocol(nsString& aProtocol) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + char* protocol; + result = url->GetScheme(&protocol); + if (result == NS_OK) { + aProtocol.SetString(protocol); + aProtocol.Append(":"); + nsCRT::free(protocol); + } + NS_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAreaElement::GetHost(nsString& aHost) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + char* host; + result = url->GetHost(&host); + if (result == NS_OK) { + aHost.SetString(host); + nsCRT::free(host); + PRInt32 port; + (void)url->GetPort(&port); + if (-1 != port) { + aHost.Append(":"); + aHost.Append(port, 10); + } + } + NS_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAreaElement::GetHostname(nsString& aHostname) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + char* host; + result = url->GetHost(&host); + if (result == NS_OK) { + aHostname.SetString(host); + nsCRT::free(host); + } + NS_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAreaElement::GetPathname(nsString& aPathname) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + char* file; + result = url->GetPath(&file); + if (result == NS_OK) { + aPathname.SetString(file); + nsCRT::free(file); + } + NS_IF_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAreaElement::GetSearch(nsString& aSearch) +{ + nsAutoString href; + nsIURI *uri; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&uri, href); + if (NS_OK == result) { + char *search; + nsIURL* url; + result = uri->QueryInterface(NS_GET_IID(nsIURL), (void**)&url); + if (NS_SUCCEEDED(result)) { + result = url->GetQuery(&search); + NS_RELEASE(url); + } + if (result == NS_OK && (nsnull != search) && ('\0' != *search)) { + aSearch.SetString("?"); + aSearch.Append(search); + nsCRT::free(search); + } + else { + aSearch.SetLength(0); + } + NS_RELEASE(uri); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAreaElement::GetPort(nsString& aPort) +{ + nsAutoString href; + nsIURI *url; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&url, href); + if (NS_OK == result) { + aPort.SetLength(0); + PRInt32 port; + (void)url->GetPort(&port); + if (-1 != port) { + aPort.Append(port, 10); + } + NS_RELEASE(url); + } + } + + return result; +} + +NS_IMETHODIMP +nsHTMLAreaElement::GetHash(nsString& aHash) +{ + nsAutoString href; + nsIURI *uri; + nsresult result = NS_OK; + + result = GetHref(href); + if (NS_OK == result) { + result = NS_NewURI(&uri, href); + + if (NS_OK == result) { + char *ref; + nsIURL* url; + result = uri->QueryInterface(NS_GET_IID(nsIURL), (void**)&url); + if (NS_SUCCEEDED(result)) { + result = url->GetRef(&ref); + NS_RELEASE(url); + } + if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) { + aHash.SetString("#"); + aHash.Append(ref); + nsCRT::free(ref); + } + else { + aHash.SetLength(0); + } + NS_RELEASE(uri); + } + } + + return result; +} diff --git a/layout/html/content/src/nsHTMLBRElement.cpp b/layout/html/content/src/nsHTMLBRElement.cpp index c15b73c34d0..edeb0537f3b 100644 --- a/layout/html/content/src/nsHTMLBRElement.cpp +++ b/layout/html/content/src/nsHTMLBRElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLBRElementIID, NS_IDOMHTMLBRELEMENT_IID); class nsHTMLBRElement : public nsIDOMHTMLBRElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -59,11 +58,8 @@ public: NS_IMETHOD GetClear(nsString& aClear); NS_IMETHOD SetClear(const nsString& aClear); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLBaseElement.cpp b/layout/html/content/src/nsHTMLBaseElement.cpp index fc040839e5f..db9e73fd911 100644 --- a/layout/html/content/src/nsHTMLBaseElement.cpp +++ b/layout/html/content/src/nsHTMLBaseElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLBaseElementIID, NS_IDOMHTMLBASEELEMENT_IID); class nsHTMLBaseElement : public nsIDOMHTMLBaseElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -60,11 +59,8 @@ public: NS_IMETHOD GetTarget(nsString& aTarget); NS_IMETHOD SetTarget(const nsString& aTarget); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLBaseFontElement.cpp b/layout/html/content/src/nsHTMLBaseFontElement.cpp index 17f4f79aca3..b31d7df211f 100644 --- a/layout/html/content/src/nsHTMLBaseFontElement.cpp +++ b/layout/html/content/src/nsHTMLBaseFontElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLBaseFontElementIID, NS_IDOMHTMLBASEFONTELEMENT_IID); class nsHTMLBaseFontElement : public nsIDOMHTMLBaseFontElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -62,11 +61,8 @@ public: NS_IMETHOD GetSize(nsString& aSize); NS_IMETHOD SetSize(const nsString& aSize); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLBodyElement.cpp b/layout/html/content/src/nsHTMLBodyElement.cpp index 2f5c484c79f..5c9385e7c59 100644 --- a/layout/html/content/src/nsHTMLBodyElement.cpp +++ b/layout/html/content/src/nsHTMLBodyElement.cpp @@ -44,6 +44,7 @@ #include "nsIHTMLAttributes.h" #include "nsIHTMLContentContainer.h" #include "nsISupportsArray.h" +#include "nsIFrame.h" #include "nsIDocShell.h" static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID); @@ -162,8 +163,7 @@ nsresult nsBodyInner::SetDocument(nsIDocument* aDocument, PRBool aDeep) //---------------------------------------------------------------------- class nsHTMLBodyElement : public nsIDOMHTMLBodyElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -196,11 +196,8 @@ public: NS_IMETHOD GetVLink(nsString& aVLink); NS_IMETHOD SetVLink(const nsString& aVLink); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) @@ -599,11 +596,65 @@ nsHTMLBodyElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMPL_STRING_ATTR(nsHTMLBodyElement, ALink, alink) NS_IMPL_STRING_ATTR(nsHTMLBodyElement, Background, background) -NS_IMPL_STRING_ATTR(nsHTMLBodyElement, BgColor, bgcolor) NS_IMPL_STRING_ATTR(nsHTMLBodyElement, Link, link) NS_IMPL_STRING_ATTR(nsHTMLBodyElement, Text, text) NS_IMPL_STRING_ATTR(nsHTMLBodyElement, VLink, vlink) +NS_IMETHODIMP +nsHTMLBodyElement::GetBgColor(nsString& aBgColor) +{ + // If we don't have an attribute, find the actual color used for + // (generally from the user agent style sheet) for compatibility + if (NS_CONTENT_ATTR_NOT_THERE == mInner.GetAttribute(kNameSpaceID_None, nsHTMLAtoms::bgcolor, aBgColor)) { + nsresult result = NS_OK; + if (mInner.mDocument) { + // Make sure the presentation is up-to-date + result = mInner.mDocument->FlushPendingNotifications(); + if (NS_FAILED(result)) { + return result; + } + } + + nsCOMPtr context; + result = nsGenericHTMLElement::GetPresContext(this, + getter_AddRefs(context)); + if (NS_FAILED(result)) { + return result; + } + + nsCOMPtr shell; + result = context->GetShell(getter_AddRefs(shell)); + if (NS_FAILED(result)) { + return result; + } + + nsIFrame* frame; + result = shell->GetPrimaryFrameFor(this, &frame); + if (NS_FAILED(result)) { + return result; + } + + if (frame) { + const nsStyleColor* styleColor; + result = frame->GetStyleData(eStyleStruct_Color, (const nsStyleStruct*&)styleColor); + if (NS_FAILED(result)) { + return result; + } + + nsHTMLValue value(styleColor->mBackgroundColor); + nsGenericHTMLElement::ColorToString(value, aBgColor); + } + } + + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLBodyElement::SetBgColor(const nsString& aBgColor) +{ + return mInner.SetAttribute(kNameSpaceID_None, nsHTMLAtoms::bgcolor, aBgColor, PR_TRUE); +} + NS_IMETHODIMP nsHTMLBodyElement::StringToAttribute(nsIAtom* aAttribute, const nsString& aValue, diff --git a/layout/html/content/src/nsHTMLButtonElement.cpp b/layout/html/content/src/nsHTMLButtonElement.cpp index f90dc0c69f5..7f5d1c90b1e 100644 --- a/layout/html/content/src/nsHTMLButtonElement.cpp +++ b/layout/html/content/src/nsHTMLButtonElement.cpp @@ -46,8 +46,7 @@ static NS_DEFINE_IID(kIDOMHTMLButtonElementIID, NS_IDOMHTMLBUTTONELEMENT_IID); static NS_DEFINE_IID(kIFocusableContentIID, NS_IFOCUSABLECONTENT_IID); class nsHTMLButtonElement : public nsIDOMHTMLButtonElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIFormControl, public nsIFocusableContent @@ -86,11 +85,8 @@ public: NS_IMETHOD Blur(); NS_IMETHOD Focus(); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLDListElement.cpp b/layout/html/content/src/nsHTMLDListElement.cpp index c149b11e7e8..ac47063a793 100644 --- a/layout/html/content/src/nsHTMLDListElement.cpp +++ b/layout/html/content/src/nsHTMLDListElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLDListElementIID, NS_IDOMHTMLDLISTELEMENT_IID); class nsHTMLDListElement : public nsIDOMHTMLDListElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -59,11 +58,8 @@ public: NS_IMETHOD GetCompact(PRBool* aCompact); NS_IMETHOD SetCompact(PRBool aCompact); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLDelElement.cpp b/layout/html/content/src/nsHTMLDelElement.cpp index ddbda9ccf73..cefbeaec813 100644 --- a/layout/html/content/src/nsHTMLDelElement.cpp +++ b/layout/html/content/src/nsHTMLDelElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLModElementIID, NS_IDOMHTMLMODELEMENT_IID); class nsHTMLDelElement : public nsIDOMHTMLModElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -60,11 +59,8 @@ public: NS_IMETHOD GetDateTime(nsString& aDateTime); NS_IMETHOD SetDateTime(const nsString& aDateTime); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLDirectoryElement.cpp b/layout/html/content/src/nsHTMLDirectoryElement.cpp index 874ed8d247d..b81d442cf4d 100644 --- a/layout/html/content/src/nsHTMLDirectoryElement.cpp +++ b/layout/html/content/src/nsHTMLDirectoryElement.cpp @@ -39,8 +39,7 @@ extern nsGenericHTMLElement::EnumTable kListTypeTable[]; static NS_DEFINE_IID(kIDOMHTMLDirectoryElementIID, NS_IDOMHTMLDIRECTORYELEMENT_IID); class nsHTMLDirectoryElement : public nsIDOMHTMLDirectoryElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -63,11 +62,8 @@ public: NS_IMETHOD GetCompact(PRBool* aCompact); NS_IMETHOD SetCompact(PRBool aCompact); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLDivElement.cpp b/layout/html/content/src/nsHTMLDivElement.cpp index cabd680317d..aeaf5fd299a 100644 --- a/layout/html/content/src/nsHTMLDivElement.cpp +++ b/layout/html/content/src/nsHTMLDivElement.cpp @@ -37,8 +37,7 @@ static NS_DEFINE_IID(kIDOMHTMLDivElementIID, NS_IDOMHTMLDIVELEMENT_IID); class nsHTMLDivElement : public nsIDOMHTMLDivElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -61,11 +60,8 @@ public: NS_IMETHOD GetAlign(nsString& aAlign); NS_IMETHOD SetAlign(const nsString& aAlign); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLEmbedElement.cpp b/layout/html/content/src/nsHTMLEmbedElement.cpp index 0c066f9b7b9..4b4c4ac0764 100644 --- a/layout/html/content/src/nsHTMLEmbedElement.cpp +++ b/layout/html/content/src/nsHTMLEmbedElement.cpp @@ -36,8 +36,7 @@ //static NS_DEFINE_IID(kIDOMHTMLEmbedElementIID, NS_IDOMHTMLEmbedELEMENT_IID); class nsHTMLEmbedElement : public nsIDOMHTMLElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -58,11 +57,8 @@ public: // nsIDOMHTMLEmbedElement - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLFieldSetElement.cpp b/layout/html/content/src/nsHTMLFieldSetElement.cpp index 27247697237..8041c036272 100644 --- a/layout/html/content/src/nsHTMLFieldSetElement.cpp +++ b/layout/html/content/src/nsHTMLFieldSetElement.cpp @@ -41,8 +41,7 @@ static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID); static NS_DEFINE_IID(kIFormIID, NS_IFORM_IID); class nsHTMLFieldSetElement : public nsIDOMHTMLFieldSetElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIFormControl { @@ -66,11 +65,8 @@ public: NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLFontElement.cpp b/layout/html/content/src/nsHTMLFontElement.cpp index 92d14556a6b..f5bf19e2815 100644 --- a/layout/html/content/src/nsHTMLFontElement.cpp +++ b/layout/html/content/src/nsHTMLFontElement.cpp @@ -38,8 +38,7 @@ static NS_DEFINE_IID(kIDOMHTMLFontElementIID, NS_IDOMHTMLFONTELEMENT_IID); class nsHTMLFontElement : public nsIDOMHTMLFontElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -66,11 +65,8 @@ public: NS_IMETHOD GetSize(nsString& aSize); NS_IMETHOD SetSize(const nsString& aSize); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLFormElement.cpp b/layout/html/content/src/nsHTMLFormElement.cpp index 8db02284d4e..1f6b1229f07 100644 --- a/layout/html/content/src/nsHTMLFormElement.cpp +++ b/layout/html/content/src/nsHTMLFormElement.cpp @@ -57,11 +57,9 @@ class nsFormControlList; class nsHTMLFormElement : public nsIDOMHTMLFormElement, public nsIDOMNSHTMLFormElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, - public nsIForm, - public nsIJSScriptObject + public nsIForm { public: nsHTMLFormElement(nsIAtom* aTag); @@ -102,11 +100,6 @@ public: NS_IMETHOD Item(PRUint32 aIndex, nsIDOMElement** aReturn); NS_IMETHOD NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, jsval* aReturn); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) @@ -115,18 +108,19 @@ public: NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) // nsIJSScriptObject - PRBool AddProperty(JSContext *aContext, JSObject *aObj, + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); - PRBool DeleteProperty(JSContext *aContext, JSObject *aObj, + virtual PRBool DeleteProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); - PRBool GetProperty(JSContext *aContext, JSObject *aObj, + virtual PRBool GetProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); - PRBool SetProperty(JSContext *aContext, JSObject *aObj, + virtual PRBool SetProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); - PRBool EnumerateProperty(JSContext *aContext, JSObject *aObj); - PRBool Resolve(JSContext *aContext, JSObject *aObj, jsval aID); - PRBool Convert(JSContext *aContext, JSObject *aObj, jsval aID); - void Finalize(JSContext *aContext, JSObject *aObj); + virtual PRBool EnumerateProperty(JSContext *aContext, JSObject *aObj); + virtual PRBool Resolve(JSContext *aContext, JSObject *aObj, jsval aID); + virtual PRBool Convert(JSContext *aContext, JSObject *aObj, jsval aID); + virtual void Finalize(JSContext *aContext, JSObject *aObj); // nsIForm NS_IMETHOD AddElement(nsIFormControl* aElement); diff --git a/layout/html/content/src/nsHTMLFrameElement.cpp b/layout/html/content/src/nsHTMLFrameElement.cpp index 76f9933c7f6..ddc374e61de 100644 --- a/layout/html/content/src/nsHTMLFrameElement.cpp +++ b/layout/html/content/src/nsHTMLFrameElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLFrameElementIID, NS_IDOMHTMLFRAMEELEMENT_IID); class nsHTMLFrameElement : public nsIDOMHTMLFrameElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIChromeEventHandler { @@ -74,11 +73,8 @@ public: NS_IMETHOD GetSrc(nsString& aSrc); NS_IMETHOD SetSrc(const nsString& aSrc); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLFrameSetElement.cpp b/layout/html/content/src/nsHTMLFrameSetElement.cpp index 1c98117e633..3c7a843c381 100644 --- a/layout/html/content/src/nsHTMLFrameSetElement.cpp +++ b/layout/html/content/src/nsHTMLFrameSetElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLFrameSetElementIID, NS_IDOMHTMLFRAMESETELEMENT_IID); class nsHTMLFrameSetElement : public nsIDOMHTMLFrameSetElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -60,11 +59,8 @@ public: NS_IMETHOD GetRows(nsString& aRows); NS_IMETHOD SetRows(const nsString& aRows); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLHRElement.cpp b/layout/html/content/src/nsHTMLHRElement.cpp index 35ed40e6555..ac6e3c1581c 100644 --- a/layout/html/content/src/nsHTMLHRElement.cpp +++ b/layout/html/content/src/nsHTMLHRElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLHRElementIID, NS_IDOMHTMLHRELEMENT_IID); class nsHTMLHRElement : public nsIDOMHTMLHRElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -65,11 +64,8 @@ public: NS_IMETHOD GetWidth(nsString& aWidth); NS_IMETHOD SetWidth(const nsString& aWidth); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLHeadElement.cpp b/layout/html/content/src/nsHTMLHeadElement.cpp index 6e2665efcf4..2bdf61f9203 100644 --- a/layout/html/content/src/nsHTMLHeadElement.cpp +++ b/layout/html/content/src/nsHTMLHeadElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLHeadElementIID, NS_IDOMHTMLHEADELEMENT_IID); class nsHTMLHeadElement : public nsIDOMHTMLHeadElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -58,11 +57,8 @@ public: NS_IMETHOD GetProfile(nsString& aProfile); NS_IMETHOD SetProfile(const nsString& aProfile); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLHeadingElement.cpp b/layout/html/content/src/nsHTMLHeadingElement.cpp index 43107ebdcc2..713c6c29069 100644 --- a/layout/html/content/src/nsHTMLHeadingElement.cpp +++ b/layout/html/content/src/nsHTMLHeadingElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLHeadingElementIID, NS_IDOMHTMLHEADINGELEMENT_IID); class nsHTMLHeadingElement : public nsIDOMHTMLHeadingElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -59,11 +58,8 @@ public: NS_IMETHOD GetAlign(nsString& aAlign); NS_IMETHOD SetAlign(const nsString& aAlign); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLHtmlElement.cpp b/layout/html/content/src/nsHTMLHtmlElement.cpp index 62079d6efe6..b7ca3750486 100644 --- a/layout/html/content/src/nsHTMLHtmlElement.cpp +++ b/layout/html/content/src/nsHTMLHtmlElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLHtmlElementIID, NS_IDOMHTMLHTMLELEMENT_IID); class nsHTMLHtmlElement : public nsIDOMHTMLHtmlElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -59,11 +58,8 @@ public: NS_IMETHOD GetVersion(nsString& aVersion); NS_IMETHOD SetVersion(const nsString& aVersion); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLIFrameElement.cpp b/layout/html/content/src/nsHTMLIFrameElement.cpp index 2c41bd9e2c8..840ed22be26 100644 --- a/layout/html/content/src/nsHTMLIFrameElement.cpp +++ b/layout/html/content/src/nsHTMLIFrameElement.cpp @@ -36,8 +36,7 @@ static NS_DEFINE_IID(kIDOMHTMLIFrameElementIID, NS_IDOMHTMLIFRAMEELEMENT_IID); class nsHTMLIFrameElement : public nsIDOMHTMLIFrameElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIChromeEventHandler { @@ -79,11 +78,8 @@ public: NS_IMETHOD GetWidth(nsString& aWidth); NS_IMETHOD SetWidth(const nsString& aWidth); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLImageElement.cpp b/layout/html/content/src/nsHTMLImageElement.cpp index 059693201be..2d3afb9d49d 100644 --- a/layout/html/content/src/nsHTMLImageElement.cpp +++ b/layout/html/content/src/nsHTMLImageElement.cpp @@ -64,10 +64,8 @@ static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID); class nsHTMLImageElement : public nsIDOMHTMLImageElement, public nsIDOMImage, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, - public nsIHTMLContent, public nsIJSScriptObject, + public nsIHTMLContent, public nsIJSNativeInitializer { public: @@ -120,11 +118,6 @@ public: NS_IMETHOD SetLowsrc(const nsString& aLowsrc); NS_IMETHOD GetComplete(PRBool* aComplete); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_NO_SETDOCUMENT_USING_GENERIC(mInner) @@ -133,18 +126,19 @@ public: NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) // nsIJSScriptObject - PRBool AddProperty(JSContext *aContext, JSObject *aObj, + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); - PRBool DeleteProperty(JSContext *aContext, JSObject *aObj, + virtual PRBool DeleteProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); - PRBool GetProperty(JSContext *aContext, JSObject *aObj, + virtual PRBool GetProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); - PRBool SetProperty(JSContext *aContext, JSObject *aObj, + virtual PRBool SetProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); - PRBool EnumerateProperty(JSContext *aContext, JSObject *aObj); - PRBool Resolve(JSContext *aContext, JSObject *aObj, jsval aID); - PRBool Convert(JSContext *aContext, JSObject *aObj, jsval aID); - void Finalize(JSContext *aContext, JSObject *aObj); + virtual PRBool EnumerateProperty(JSContext *aContext, JSObject *aObj); + virtual PRBool Resolve(JSContext *aContext, JSObject *aObj, jsval aID); + virtual PRBool Convert(JSContext *aContext, JSObject *aObj, jsval aID); + virtual void Finalize(JSContext *aContext, JSObject *aObj); // nsIJSNativeInitializer NS_IMETHOD Initialize(JSContext* aContext, JSObject *aObj, @@ -545,10 +539,9 @@ nsHTMLImageElement::GetCallerSourceURL(JSContext* cx, if (doc) { result = doc->GetBaseURL(*sourceURL); - } - - if (!*sourceURL) { - *sourceURL = doc->GetDocumentURL(); + if (!*sourceURL) { + *sourceURL = doc->GetDocumentURL(); + } } } } diff --git a/layout/html/content/src/nsHTMLInputElement.cpp b/layout/html/content/src/nsHTMLInputElement.cpp index 79e2b8e75be..0161babbc34 100644 --- a/layout/html/content/src/nsHTMLInputElement.cpp +++ b/layout/html/content/src/nsHTMLInputElement.cpp @@ -71,8 +71,7 @@ static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID); class nsHTMLInputElement : public nsIDOMHTMLInputElement, public nsIDOMNSHTMLInputElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIFormControl, public nsIFocusableContent, @@ -163,6 +162,7 @@ public: NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); NS_IMETHOD GetType(nsString& aType); + NS_IMETHOD SetType(const nsString& aType); NS_IMETHOD GetUseMap(nsString& aUseMap); NS_IMETHOD SetUseMap(const nsString& aUseMap); NS_IMETHOD GetValue(nsString& aValue); @@ -178,11 +178,8 @@ public: // nsIDOMNSHTMLInputElement NS_DECL_IDOMNSHTMLINPUTELEMENT - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner) @@ -411,15 +408,9 @@ NS_IMPL_STRING_ATTR(nsHTMLInputElement, Size, size) NS_IMPL_STRING_ATTR(nsHTMLInputElement, Src, src) NS_IMPL_INT_ATTR(nsHTMLInputElement, TabIndex, tabindex) NS_IMPL_STRING_ATTR(nsHTMLInputElement, UseMap, usemap) +NS_IMPL_STRING_ATTR(nsHTMLInputElement, Type, type) //NS_IMPL_STRING_ATTR(nsHTMLInputElement, Value, value) -NS_IMETHODIMP -nsHTMLInputElement::GetType(nsString& aValue) -{ - mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::type, aValue); - return NS_OK; -} - NS_IMETHODIMP nsHTMLInputElement::GetValue(nsString& aValue) { diff --git a/layout/html/content/src/nsHTMLInsElement.cpp b/layout/html/content/src/nsHTMLInsElement.cpp index fd7e79407ca..bf55fed6e19 100644 --- a/layout/html/content/src/nsHTMLInsElement.cpp +++ b/layout/html/content/src/nsHTMLInsElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLModElementIID, NS_IDOMHTMLMODELEMENT_IID); class nsHTMLInsElement : public nsIDOMHTMLModElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -60,11 +59,8 @@ public: NS_IMETHOD GetDateTime(nsString& aDateTime); NS_IMETHOD SetDateTime(const nsString& aDateTime); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLIsIndexElement.cpp b/layout/html/content/src/nsHTMLIsIndexElement.cpp index a242484ff84..c7a00fb2cbc 100644 --- a/layout/html/content/src/nsHTMLIsIndexElement.cpp +++ b/layout/html/content/src/nsHTMLIsIndexElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLIsIndexElementIID, NS_IDOMHTMLISINDEXELEMENT_IID); class nsHTMLIsIndexElement : public nsIDOMHTMLIsIndexElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -59,11 +58,8 @@ public: NS_IMETHOD GetPrompt(nsString& aPrompt); NS_IMETHOD SetPrompt(const nsString& aPrompt); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLLIElement.cpp b/layout/html/content/src/nsHTMLLIElement.cpp index 9d7de9e1a63..759f775af3b 100644 --- a/layout/html/content/src/nsHTMLLIElement.cpp +++ b/layout/html/content/src/nsHTMLLIElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLLIElementIID, NS_IDOMHTMLLIELEMENT_IID); class nsHTMLLIElement : public nsIDOMHTMLLIElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -61,11 +60,8 @@ public: NS_IMETHOD GetValue(PRInt32* aValue); NS_IMETHOD SetValue(PRInt32 aValue); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLLabelElement.cpp b/layout/html/content/src/nsHTMLLabelElement.cpp index 4812abede9b..55a6bdf6acd 100644 --- a/layout/html/content/src/nsHTMLLabelElement.cpp +++ b/layout/html/content/src/nsHTMLLabelElement.cpp @@ -47,8 +47,7 @@ static NS_DEFINE_IID(kIFormIID, NS_IFORM_IID); static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID); class nsHTMLLabelElement : public nsIDOMHTMLLabelElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIFormControl @@ -77,11 +76,8 @@ public: NS_IMETHOD GetHtmlFor(nsString& aHtmlFor); NS_IMETHOD SetHtmlFor(const nsString& aHtmlFor); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLLayerElement.cpp b/layout/html/content/src/nsHTMLLayerElement.cpp index fad3c76759a..57586ef31d7 100644 --- a/layout/html/content/src/nsHTMLLayerElement.cpp +++ b/layout/html/content/src/nsHTMLLayerElement.cpp @@ -41,8 +41,7 @@ static NS_DEFINE_IID(kIDOMHTMLLayerElementIID, NS_IDOMHTMLLAYERELEMENT_IID); static NS_DEFINE_IID(kIDOMDocumentIID, NS_IDOMDOCUMENT_IID); class nsHTMLLayerElement : public nsIDOMHTMLLayerElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -78,11 +77,8 @@ public: NS_IMETHOD SetZIndex(PRInt32 aZIndex); NS_IMETHOD GetDocument(nsIDOMDocument** aReturn); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLLegendElement.cpp b/layout/html/content/src/nsHTMLLegendElement.cpp index 8f006649700..c72f08a0377 100644 --- a/layout/html/content/src/nsHTMLLegendElement.cpp +++ b/layout/html/content/src/nsHTMLLegendElement.cpp @@ -40,8 +40,7 @@ static NS_DEFINE_IID(kIDOMHTMLFormElementIID, NS_IDOMHTMLFORMELEMENT_IID); static NS_DEFINE_IID(kIFormIID, NS_IFORM_IID); class nsHTMLLegendElement : public nsIDOMHTMLLegendElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIFormControl { @@ -68,11 +67,8 @@ public: NS_IMETHOD GetAlign(nsString& aAlign); NS_IMETHOD SetAlign(const nsString& aAlign); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLLinkElement.cpp b/layout/html/content/src/nsHTMLLinkElement.cpp index 979914055fd..6c4d377a222 100644 --- a/layout/html/content/src/nsHTMLLinkElement.cpp +++ b/layout/html/content/src/nsHTMLLinkElement.cpp @@ -39,8 +39,7 @@ static NS_DEFINE_IID(kIStyleSheetLinkingElementIID, NS_ISTYLESHEETLINKINGELEMENT static NS_DEFINE_IID(kIDOMStyleSheetIID, NS_IDOMSTYLESHEET_IID); class nsHTMLLinkElement : public nsIDOMHTMLLinkElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIStyleSheetLinkingElement { @@ -80,11 +79,8 @@ public: NS_IMETHOD GetType(nsString& aType); NS_IMETHOD SetType(const nsString& aType); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLMapElement.cpp b/layout/html/content/src/nsHTMLMapElement.cpp index 605b13d28f0..94e4cee8d42 100644 --- a/layout/html/content/src/nsHTMLMapElement.cpp +++ b/layout/html/content/src/nsHTMLMapElement.cpp @@ -39,8 +39,7 @@ static NS_DEFINE_IID(kIDOMHTMLMapElementIID, NS_IDOMHTMLMAPELEMENT_IID); static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID); class nsHTMLMapElement : public nsIDOMHTMLMapElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -64,11 +63,8 @@ public: NS_IMETHOD GetName(nsString& aName); NS_IMETHOD SetName(const nsString& aName); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMETHOD GetDocument(nsIDocument*& aResult) const { diff --git a/layout/html/content/src/nsHTMLMenuElement.cpp b/layout/html/content/src/nsHTMLMenuElement.cpp index 72bdda4f55b..cb0567c13e1 100644 --- a/layout/html/content/src/nsHTMLMenuElement.cpp +++ b/layout/html/content/src/nsHTMLMenuElement.cpp @@ -39,8 +39,7 @@ extern nsGenericHTMLElement::EnumTable kListTypeTable[]; static NS_DEFINE_IID(kIDOMHTMLMenuElementIID, NS_IDOMHTMLMENUELEMENT_IID); class nsHTMLMenuElement : public nsIDOMHTMLMenuElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -63,11 +62,8 @@ public: NS_IMETHOD GetCompact(PRBool* aCompact); NS_IMETHOD SetCompact(PRBool aCompact); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLMetaElement.cpp b/layout/html/content/src/nsHTMLMetaElement.cpp index 51183b4d95b..ccf05088358 100644 --- a/layout/html/content/src/nsHTMLMetaElement.cpp +++ b/layout/html/content/src/nsHTMLMetaElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLMetaElementIID, NS_IDOMHTMLMETAELEMENT_IID); class nsHTMLMetaElement : public nsIDOMHTMLMetaElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -64,11 +63,8 @@ public: NS_IMETHOD GetScheme(nsString& aScheme); NS_IMETHOD SetScheme(const nsString& aScheme); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLModElement.cpp b/layout/html/content/src/nsHTMLModElement.cpp index 86c1965b0ee..b1db11ca9c2 100644 --- a/layout/html/content/src/nsHTMLModElement.cpp +++ b/layout/html/content/src/nsHTMLModElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLModElementIID, NS_IDOMHTMLMODELEMENT_IID); class nsHTMLModElement : public nsIDOMHTMLModElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -60,11 +59,8 @@ public: NS_IMETHOD GetDateTime(nsString& aDateTime); NS_IMETHOD SetDateTime(const nsString& aDateTime); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLOListElement.cpp b/layout/html/content/src/nsHTMLOListElement.cpp index dc3ce2f28ec..31fbd19ca73 100644 --- a/layout/html/content/src/nsHTMLOListElement.cpp +++ b/layout/html/content/src/nsHTMLOListElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLOListElementIID, NS_IDOMHTMLOLISTELEMENT_IID); class nsHTMLOListElement : public nsIDOMHTMLOListElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -63,11 +62,8 @@ public: NS_IMETHOD GetType(nsString& aType); NS_IMETHOD SetType(const nsString& aType); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLObjectElement.cpp b/layout/html/content/src/nsHTMLObjectElement.cpp index fb20242e583..751708cdf69 100644 --- a/layout/html/content/src/nsHTMLObjectElement.cpp +++ b/layout/html/content/src/nsHTMLObjectElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLObjectElementIID, NS_IDOMHTMLOBJECTELEMENT_IID); class nsHTMLObjectElement : public nsIDOMHTMLObjectElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -91,11 +90,8 @@ public: NS_IMETHOD GetWidth(nsString& aWidth); NS_IMETHOD SetWidth(const nsString& aWidth); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLOptGroupElement.cpp b/layout/html/content/src/nsHTMLOptGroupElement.cpp index 9e02b26a8ff..3a730b88ad6 100644 --- a/layout/html/content/src/nsHTMLOptGroupElement.cpp +++ b/layout/html/content/src/nsHTMLOptGroupElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLOptGroupElementIID, NS_IDOMHTMLOPTGROUPELEMENT_IID); class nsHTMLOptGroupElement : public nsIDOMHTMLOptGroupElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -60,11 +59,8 @@ public: NS_IMETHOD GetLabel(nsString& aLabel); NS_IMETHOD SetLabel(const nsString& aLabel); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLOptionElement.cpp b/layout/html/content/src/nsHTMLOptionElement.cpp index 90bf38df4da..71ff83d0eef 100644 --- a/layout/html/content/src/nsHTMLOptionElement.cpp +++ b/layout/html/content/src/nsHTMLOptionElement.cpp @@ -67,8 +67,7 @@ static NS_DEFINE_IID(kIFormControlFrameIID, NS_IFORMCONTROLFRAME_IID); static NS_DEFINE_IID(kIJSNativeInitializerIID, NS_IJSNATIVEINITIALIZER_IID); class nsHTMLOptionElement : public nsIDOMHTMLOptionElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIJSNativeInitializer //public nsIFormControl @@ -106,11 +105,8 @@ public: NS_IMETHOD GetValue(nsString& aValue); NS_IMETHOD SetValue(const nsString& aValue); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_NO_SETPARENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLParagraphElement.cpp b/layout/html/content/src/nsHTMLParagraphElement.cpp index 8ae32ee1d43..99437a50171 100644 --- a/layout/html/content/src/nsHTMLParagraphElement.cpp +++ b/layout/html/content/src/nsHTMLParagraphElement.cpp @@ -37,8 +37,7 @@ static NS_DEFINE_IID(kIDOMHTMLParagraphElementIID, NS_IDOMHTMLPARAGRAPHELEMENT_IID); class nsHTMLParagraphElement : public nsIDOMHTMLParagraphElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -61,11 +60,8 @@ public: NS_IMETHOD GetAlign(nsString& aAlign); NS_IMETHOD SetAlign(const nsString& aAlign); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLParamElement.cpp b/layout/html/content/src/nsHTMLParamElement.cpp index 6710641bb4f..211d5c7a608 100644 --- a/layout/html/content/src/nsHTMLParamElement.cpp +++ b/layout/html/content/src/nsHTMLParamElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLParamElementIID, NS_IDOMHTMLPARAMELEMENT_IID); class nsHTMLParamElement : public nsIDOMHTMLParamElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -64,11 +63,8 @@ public: NS_IMETHOD GetValueType(nsString& aValueType); NS_IMETHOD SetValueType(const nsString& aValueType); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLPreElement.cpp b/layout/html/content/src/nsHTMLPreElement.cpp index ca01e01a6b0..964c9b9f541 100644 --- a/layout/html/content/src/nsHTMLPreElement.cpp +++ b/layout/html/content/src/nsHTMLPreElement.cpp @@ -37,8 +37,7 @@ static NS_DEFINE_IID(kIDOMHTMLPreElementIID, NS_IDOMHTMLPREELEMENT_IID); class nsHTMLPreElement : public nsIDOMHTMLPreElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -61,11 +60,8 @@ public: NS_IMETHOD GetWidth(PRInt32* aWidth); NS_IMETHOD SetWidth(PRInt32 aWidth); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLQuoteElement.cpp b/layout/html/content/src/nsHTMLQuoteElement.cpp index e0b57b797f0..0034ff5820a 100644 --- a/layout/html/content/src/nsHTMLQuoteElement.cpp +++ b/layout/html/content/src/nsHTMLQuoteElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLQuoteElementIID, NS_IDOMHTMLQUOTEELEMENT_IID); class nsHTMLQuoteElement : public nsIDOMHTMLQuoteElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -58,11 +57,8 @@ public: NS_IMETHOD GetCite(nsString& aCite); NS_IMETHOD SetCite(const nsString& aCite); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLScriptElement.cpp b/layout/html/content/src/nsHTMLScriptElement.cpp index d5332e66b84..bc3291d6fe0 100644 --- a/layout/html/content/src/nsHTMLScriptElement.cpp +++ b/layout/html/content/src/nsHTMLScriptElement.cpp @@ -34,8 +34,7 @@ static NS_DEFINE_IID(kIDOMHTMLScriptElementIID, NS_IDOMHTMLSCRIPTELEMENT_IID); class nsHTMLScriptElement : public nsIDOMHTMLScriptElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -70,11 +69,8 @@ public: NS_IMETHOD GetType(nsString& aType); NS_IMETHOD SetType(const nsString& aType); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLSelectElement.cpp b/layout/html/content/src/nsHTMLSelectElement.cpp index 18f32da98bc..a9eff9c3cb7 100644 --- a/layout/html/content/src/nsHTMLSelectElement.cpp +++ b/layout/html/content/src/nsHTMLSelectElement.cpp @@ -92,10 +92,9 @@ public: // nsIDOMHTMLCollection interface NS_DECL_IDOMHTMLCOLLECTION - // nsIScriptObjectOwner - NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject); - // nsIJSScriptObject interface + NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); + NS_IMETHOD SetScriptObject(void *aScriptObject); PRBool AddProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); PRBool DeleteProperty(JSContext *aContext, JSObject *aObj, @@ -126,9 +125,7 @@ private: class nsHTMLSelectElement : public nsIDOMHTMLSelectElement, public nsIDOMNSHTMLSelectElement, - public nsIScriptObjectOwner, public nsIJSScriptObject, - public nsIDOMEventReceiver, public nsIHTMLContent, public nsIFormControl, public nsIFocusableContent, @@ -179,12 +176,6 @@ public: NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) - // nsIContent NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner) @@ -206,6 +197,7 @@ public: NS_IMETHOD IsDoneAddingContent(PRBool * aIsDone); // nsIJSScriptObject + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp); virtual PRBool DeleteProperty(JSContext *aContext, JSObject *aObj, @@ -1407,7 +1399,6 @@ nsHTMLOptionCollection::IndexOf(nsIContent* aOption) return -1; } - // nsIScriptObjectOwner interface NS_IMETHODIMP @@ -1421,6 +1412,12 @@ nsHTMLOptionCollection::GetScriptObject(nsIScriptContext *aContext, void** aScri return res; } +NS_IMETHODIMP +nsHTMLOptionCollection::SetScriptObject(void* aScriptObject) +{ + return nsGenericDOMHTMLCollection::SetScriptObject(aScriptObject); +} + // nsIJSScriptObject interface PRBool diff --git a/layout/html/content/src/nsHTMLSpacerElement.cpp b/layout/html/content/src/nsHTMLSpacerElement.cpp index d488fed4bd3..a458ac9d631 100644 --- a/layout/html/content/src/nsHTMLSpacerElement.cpp +++ b/layout/html/content/src/nsHTMLSpacerElement.cpp @@ -37,8 +37,7 @@ //static NS_DEFINE_IID(kIDOMHTMLSpacerElementIID, NS_IDOMHTMLSpacerELEMENT_IID); class nsHTMLSpacerElement : public nsIDOMHTMLElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -57,11 +56,8 @@ public: // nsIDOMHTMLElement NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLSpanElement.cpp b/layout/html/content/src/nsHTMLSpanElement.cpp index 7c3314d718d..5109d14c211 100644 --- a/layout/html/content/src/nsHTMLSpanElement.cpp +++ b/layout/html/content/src/nsHTMLSpanElement.cpp @@ -32,8 +32,7 @@ #include "nsIPresContext.h" class nsHTMLSpanElement : public nsIDOMHTMLElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -52,11 +51,8 @@ public: // nsIDOMHTMLElement NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLStyleElement.cpp b/layout/html/content/src/nsHTMLStyleElement.cpp index 70be55f9caa..cbe938d17a1 100644 --- a/layout/html/content/src/nsHTMLStyleElement.cpp +++ b/layout/html/content/src/nsHTMLStyleElement.cpp @@ -41,8 +41,7 @@ static NS_DEFINE_IID(kIStyleSheetLinkingElementIID, NS_ISTYLESHEETLINKINGELEMENT static NS_DEFINE_IID(kIDOMStyleSheetIID, NS_IDOMSTYLESHEET_IID); class nsHTMLStyleElement : public nsIDOMHTMLStyleElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIStyleSheetLinkingElement { @@ -70,11 +69,8 @@ public: NS_IMETHOD GetType(nsString& aType); NS_IMETHOD SetType(const nsString& aType); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLTableCaptionElement.cpp b/layout/html/content/src/nsHTMLTableCaptionElement.cpp index 96f1eb3c324..22c3bd1606c 100644 --- a/layout/html/content/src/nsHTMLTableCaptionElement.cpp +++ b/layout/html/content/src/nsHTMLTableCaptionElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLTableCaptionElementIID, NS_IDOMHTMLTABLECAPTIONELEMENT_IID); class nsHTMLTableCaptionElement : public nsIDOMHTMLTableCaptionElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -59,11 +58,8 @@ public: NS_IMETHOD GetAlign(nsString& aAlign); NS_IMETHOD SetAlign(const nsString& aAlign); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLTableCellElement.cpp b/layout/html/content/src/nsHTMLTableCellElement.cpp index 29d3e0f9b11..eeae1bf0ed6 100644 --- a/layout/html/content/src/nsHTMLTableCellElement.cpp +++ b/layout/html/content/src/nsHTMLTableCellElement.cpp @@ -41,8 +41,7 @@ static NS_DEFINE_IID(kIDOMHTMLTableRowElementIID, NS_IDOMHTMLTABLEROWELEMENT_IID class nsHTMLTableCellElement : public nsIHTMLTableCellElement, public nsIDOMHTMLTableCellElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -102,11 +101,8 @@ public: NS_IMETHOD GetWidth(nsString& aWidth); NS_IMETHOD SetWidth(const nsString& aWidth); -// nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - -// nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) +// nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLTableColElement.cpp b/layout/html/content/src/nsHTMLTableColElement.cpp index 20097a9ef8f..62f59060830 100644 --- a/layout/html/content/src/nsHTMLTableColElement.cpp +++ b/layout/html/content/src/nsHTMLTableColElement.cpp @@ -38,8 +38,7 @@ static NS_DEFINE_IID(kIHTMLTableColElementIID, NS_IHTMLTABLECOLELEMENT_IID); class nsHTMLTableColElement : public nsIDOMHTMLTableColElement, public nsIHTMLTableColElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -72,11 +71,8 @@ public: NS_IMETHOD GetWidth(nsString& aWidth); NS_IMETHOD SetWidth(const nsString& aWidth); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLTableColGroupElement.cpp b/layout/html/content/src/nsHTMLTableColGroupElement.cpp index 971541968ca..d6fc679611e 100644 --- a/layout/html/content/src/nsHTMLTableColGroupElement.cpp +++ b/layout/html/content/src/nsHTMLTableColGroupElement.cpp @@ -35,8 +35,7 @@ static NS_DEFINE_IID(kIDOMHTMLTableColElementIID, NS_IDOMHTMLTABLECOLELEMENT_IID); class nsHTMLTableColGroupElement : public nsIDOMHTMLTableColElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -69,11 +68,8 @@ public: NS_IMETHOD GetWidth(nsString& aWidth); NS_IMETHOD SetWidth(const nsString& aWidth); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLTableElement.cpp b/layout/html/content/src/nsHTMLTableElement.cpp index 6a7fa985d74..21f9c5c74bf 100644 --- a/layout/html/content/src/nsHTMLTableElement.cpp +++ b/layout/html/content/src/nsHTMLTableElement.cpp @@ -52,8 +52,7 @@ class GenericElementCollection; class TableRowsCollection; class nsHTMLTableElement : public nsIDOMHTMLTableElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -108,11 +107,8 @@ public: NS_IMETHOD InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); NS_IMETHOD DeleteRow(PRInt32 aIndex); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLTableRowElement.cpp b/layout/html/content/src/nsHTMLTableRowElement.cpp index 4b562bda51f..223a7f132e2 100644 --- a/layout/html/content/src/nsHTMLTableRowElement.cpp +++ b/layout/html/content/src/nsHTMLTableRowElement.cpp @@ -138,8 +138,7 @@ nsTableCellCollection::Item(PRUint32 aIndex, //---------------------------------------------------------------------- class nsHTMLTableRowElement : public nsIDOMHTMLTableRowElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -178,11 +177,8 @@ public: NS_IMETHOD InsertCell(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); NS_IMETHOD DeleteCell(PRInt32 aIndex); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLTableSectionElement.cpp b/layout/html/content/src/nsHTMLTableSectionElement.cpp index d94bad9142b..609e0852d32 100644 --- a/layout/html/content/src/nsHTMLTableSectionElement.cpp +++ b/layout/html/content/src/nsHTMLTableSectionElement.cpp @@ -40,8 +40,7 @@ static NS_DEFINE_IID(kIDOMHTMLCollectionIID, NS_IDOMHTMLCOLLECTION_IID); // you will see the phrases "rowgroup" and "section" used interchangably class nsHTMLTableSectionElement : public nsIDOMHTMLTableSectionElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -73,11 +72,8 @@ public: NS_IMETHOD InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); NS_IMETHOD DeleteRow(PRInt32 aIndex); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLTextAreaElement.cpp b/layout/html/content/src/nsHTMLTextAreaElement.cpp index 4fbeee4e4c6..9fb094ea4d7 100644 --- a/layout/html/content/src/nsHTMLTextAreaElement.cpp +++ b/layout/html/content/src/nsHTMLTextAreaElement.cpp @@ -58,8 +58,7 @@ static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID); class nsHTMLTextAreaElement : public nsIDOMHTMLTextAreaElement, public nsIDOMNSHTMLTextAreaElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent, public nsIFormControl, public nsIFocusableContent, @@ -109,11 +108,8 @@ public: // nsIDOMNSHTMLTextAreaElement NS_DECL_IDOMNSHTMLTEXTAREAELEMENT - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLTitleElement.cpp b/layout/html/content/src/nsHTMLTitleElement.cpp index 7f817dec070..8f2072fef6d 100644 --- a/layout/html/content/src/nsHTMLTitleElement.cpp +++ b/layout/html/content/src/nsHTMLTitleElement.cpp @@ -40,8 +40,7 @@ static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID); static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID); class nsHTMLTitleElement : public nsIDOMHTMLTitleElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -64,11 +63,8 @@ public: NS_IMETHOD GetText(nsString& aType); NS_IMETHOD SetText(const nsString& aType); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLUListElement.cpp b/layout/html/content/src/nsHTMLUListElement.cpp index 9dc7f222ca3..726cc0c75b0 100644 --- a/layout/html/content/src/nsHTMLUListElement.cpp +++ b/layout/html/content/src/nsHTMLUListElement.cpp @@ -38,8 +38,7 @@ extern nsGenericHTMLElement::EnumTable kOldListTypeTable[]; static NS_DEFINE_IID(kIDOMHTMLUListElementIID, NS_IDOMHTMLULISTELEMENT_IID); class nsHTMLUListElement : public nsIDOMHTMLUListElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -64,11 +63,8 @@ public: NS_IMETHOD GetType(nsString& aType); NS_IMETHOD SetType(const nsString& aType); - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/content/src/nsHTMLWBRElement.cpp b/layout/html/content/src/nsHTMLWBRElement.cpp index dd05a25ef1e..84928e9b7f8 100644 --- a/layout/html/content/src/nsHTMLWBRElement.cpp +++ b/layout/html/content/src/nsHTMLWBRElement.cpp @@ -36,8 +36,7 @@ //static NS_DEFINE_IID(kIDOMHTMLWBRElementIID, NS_IDOMHTMLWBRELEMENT_IID); class nsHTMLWBRElement : public nsIDOMHTMLElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, + public nsIJSScriptObject, public nsIHTMLContent { public: @@ -56,11 +55,8 @@ public: // nsIDOMHTMLElement NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) - // nsIScriptObjectOwner - NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) - - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + // nsIJSScriptObject + NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) diff --git a/layout/html/document/src/nsHTMLDocument.cpp b/layout/html/document/src/nsHTMLDocument.cpp index 8a54de46df7..9ae8d879ace 100644 --- a/layout/html/document/src/nsHTMLDocument.cpp +++ b/layout/html/document/src/nsHTMLDocument.cpp @@ -752,6 +752,16 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, return rv; } +NS_IMETHODIMP +nsHTMLDocument::StopDocumentLoad() +{ + if (mParser) { + mParser->Terminate(); + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLDocument::EndLoad() { diff --git a/layout/html/document/src/nsHTMLDocument.h b/layout/html/document/src/nsHTMLDocument.h index e2480708561..4ecf034cafd 100644 --- a/layout/html/document/src/nsHTMLDocument.h +++ b/layout/html/document/src/nsHTMLDocument.h @@ -70,6 +70,8 @@ public: nsISupports* aContainer, nsIStreamListener **aDocListener); + NS_IMETHOD StopDocumentLoad(); + NS_IMETHOD EndLoad(); NS_IMETHOD AddImageMap(nsIDOMHTMLMapElement* aMap); diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index d73e1b6fcaf..b562999b423 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -766,7 +766,7 @@ PRInt32 StyleSpacingImpl::CalcDifference(const StyleSpacingImpl& aOther) const (mOutlineStyle != aOther.mOutlineStyle) || (mOutlineColor != aOther.mOutlineColor) || (mOutlineRadius != aOther.mOutlineRadius)) { - return NS_STYLE_HINT_REFLOW; // XXX: should be VISUAL: see bugs 9809 and 9816 + return NS_STYLE_HINT_VISUAL; // XXX: should be VISUAL: see bugs 9809 and 9816 } return NS_STYLE_HINT_NONE; } diff --git a/layout/xml/content/src/nsXMLCDATASection.cpp b/layout/xml/content/src/nsXMLCDATASection.cpp index 8f16ea067b5..f8a268f1664 100644 --- a/layout/xml/content/src/nsXMLCDATASection.cpp +++ b/layout/xml/content/src/nsXMLCDATASection.cpp @@ -38,8 +38,6 @@ static NS_DEFINE_IID(kITextContentIID, NS_ITEXT_CONTENT_IID); class nsXMLCDATASection : public nsIDOMCDATASection, public nsIScriptObjectOwner, - public nsIDOMEventReceiver, - public nsIContent, public nsITextContent { public: @@ -61,9 +59,6 @@ public: // nsIScriptObjectOwner NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC_DOM_DATA(mInner) - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(mInner) - // nsIContent NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner) diff --git a/layout/xml/content/src/nsXMLDocumentType.cpp b/layout/xml/content/src/nsXMLDocumentType.cpp index 63623134e1c..f32f598bf00 100644 --- a/layout/xml/content/src/nsXMLDocumentType.cpp +++ b/layout/xml/content/src/nsXMLDocumentType.cpp @@ -38,7 +38,6 @@ static NS_DEFINE_IID(kIDOMDocumentTypeIID, NS_IDOMDOCUMENTTYPE_IID); class nsXMLDocumentType : public nsIDOMDocumentType, public nsIScriptObjectOwner, - public nsIDOMEventReceiver, public nsIContent { public: @@ -62,9 +61,6 @@ public: NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); NS_IMETHOD SetScriptObject(void *aScriptObject); - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(mInner) - // nsIContent NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner) @@ -145,10 +141,11 @@ nsXMLDocumentType::QueryInterface(REFNSIID aIID, void** aInstancePtrResult) return NS_OK; } if (aIID.Equals(kIDOMEventReceiverIID)) { - nsIDOMEventReceiver* tmp = this; - *aInstancePtrResult = (void*) tmp; - NS_ADDREF_THIS(); - return NS_OK; + nsCOMPtr man; + if (NS_SUCCEEDED(mInner.GetListenerManager(getter_AddRefs(man)))){ + return man->QueryInterface(kIDOMEventReceiverIID, (void**)aInstancePtrResult); + } + return NS_NOINTERFACE; } if (aIID.Equals(kIScriptObjectOwnerIID)) { nsIScriptObjectOwner* tmp = this; diff --git a/layout/xml/content/src/nsXMLElement.h b/layout/xml/content/src/nsXMLElement.h index b1d5ee04139..af408704acf 100644 --- a/layout/xml/content/src/nsXMLElement.h +++ b/layout/xml/content/src/nsXMLElement.h @@ -39,8 +39,6 @@ class nsIEventListenerManager; class nsIHTMLAttributes; class nsXMLElement : public nsIDOMElement, - public nsIScriptObjectOwner, - public nsIDOMEventReceiver, public nsIXMLContent, public nsIBindableContent, public nsIJSScriptObject @@ -205,9 +203,6 @@ public: NS_IMETHOD GetBinding(nsIXBLBinding** aResult); NS_IMETHOD GetBaseTag(nsIAtom** aResult); - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) - // nsIJSScriptObject virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp) { return mInner.AddProperty(aContext, aObj, aID, aVp); diff --git a/layout/xml/content/src/nsXMLEntity.cpp b/layout/xml/content/src/nsXMLEntity.cpp index 3dc3d07c330..15f3f84f1c3 100644 --- a/layout/xml/content/src/nsXMLEntity.cpp +++ b/layout/xml/content/src/nsXMLEntity.cpp @@ -36,7 +36,6 @@ static NS_DEFINE_IID(kIDOMEntityIID, NS_IDOMENTITY_IID); class nsXMLEntity : public nsIDOMEntity, public nsIScriptObjectOwner, - public nsIDOMEventReceiver, public nsIContent { public: @@ -59,9 +58,6 @@ public: NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); NS_IMETHOD SetScriptObject(void *aScriptObject); - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(mInner) - // nsIContent NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner) @@ -138,10 +134,11 @@ nsXMLEntity::QueryInterface(REFNSIID aIID, void** aInstancePtrResult) return NS_OK; } if (aIID.Equals(kIDOMEventReceiverIID)) { - nsIDOMEventReceiver* tmp = this; - *aInstancePtrResult = (void*) tmp; - NS_ADDREF_THIS(); - return NS_OK; + nsCOMPtr man; + if (NS_SUCCEEDED(mInner.GetListenerManager(getter_AddRefs(man)))){ + return man->QueryInterface(kIDOMEventReceiverIID, (void**)aInstancePtrResult); + } + return NS_NOINTERFACE; } if (aIID.Equals(kIScriptObjectOwnerIID)) { nsIScriptObjectOwner* tmp = this; diff --git a/layout/xml/content/src/nsXMLNotation.cpp b/layout/xml/content/src/nsXMLNotation.cpp index cd48b3c13f3..8c34ee86609 100644 --- a/layout/xml/content/src/nsXMLNotation.cpp +++ b/layout/xml/content/src/nsXMLNotation.cpp @@ -36,7 +36,6 @@ static NS_DEFINE_IID(kIDOMNotationIID, NS_IDOMNOTATION_IID); class nsXMLNotation : public nsIDOMNotation, public nsIScriptObjectOwner, - public nsIDOMEventReceiver, public nsIContent { public: @@ -59,9 +58,6 @@ public: NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); NS_IMETHOD SetScriptObject(void *aScriptObject); - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(mInner) - // nsIContent NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner) @@ -135,10 +131,11 @@ nsXMLNotation::QueryInterface(REFNSIID aIID, void** aInstancePtrResult) return NS_OK; } if (aIID.Equals(kIDOMEventReceiverIID)) { - nsIDOMEventReceiver* tmp = this; - *aInstancePtrResult = (void*) tmp; - NS_ADDREF_THIS(); - return NS_OK; + nsCOMPtr man; + if (NS_SUCCEEDED(mInner.GetListenerManager(getter_AddRefs(man)))){ + return man->QueryInterface(kIDOMEventReceiverIID, (void**)aInstancePtrResult); + } + return NS_NOINTERFACE; } if (aIID.Equals(kIScriptObjectOwnerIID)) { nsIScriptObjectOwner* tmp = this; diff --git a/layout/xml/content/src/nsXMLProcessingInstruction.cpp b/layout/xml/content/src/nsXMLProcessingInstruction.cpp index 2b7722cadea..e088a723384 100644 --- a/layout/xml/content/src/nsXMLProcessingInstruction.cpp +++ b/layout/xml/content/src/nsXMLProcessingInstruction.cpp @@ -36,7 +36,6 @@ static NS_DEFINE_IID(kIDOMProcessingInstructionIID, NS_IDOMPROCESSINGINSTRUCTION class nsXMLProcessingInstruction : public nsIDOMProcessingInstruction, public nsIScriptObjectOwner, - public nsIDOMEventReceiver, public nsIContent { public: @@ -58,9 +57,6 @@ public: NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); NS_IMETHOD SetScriptObject(void *aScriptObject); - // nsIDOMEventReceiver - NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(mInner) - // nsIContent NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner) @@ -130,10 +126,11 @@ nsXMLProcessingInstruction::QueryInterface(REFNSIID aIID, void** aInstancePtrRes return NS_OK; } if (aIID.Equals(kIDOMEventReceiverIID)) { - nsIDOMEventReceiver* tmp = this; - *aInstancePtrResult = (void*) tmp; - NS_ADDREF_THIS(); - return NS_OK; + nsCOMPtr man; + if (NS_SUCCEEDED(mInner.GetListenerManager(getter_AddRefs(man)))){ + return man->QueryInterface(kIDOMEventReceiverIID, (void**)aInstancePtrResult); + } + return NS_NOINTERFACE; } if (aIID.Equals(kIScriptObjectOwnerIID)) { nsIScriptObjectOwner* tmp = this; diff --git a/layout/xul/base/src/nsBoxFrame.cpp b/layout/xul/base/src/nsBoxFrame.cpp index b03b9e53edd..d79a60afaa3 100644 --- a/layout/xul/base/src/nsBoxFrame.cpp +++ b/layout/xul/base/src/nsBoxFrame.cpp @@ -512,7 +512,7 @@ nsBoxFrameInner::GetInitialDebug(PRBool& aDebug) PRBool nsBoxFrame::GetInitialHAlignment(nsBoxFrame::Halignment& aHalign) { - nsString value; + nsAutoString value; nsCOMPtr content; mInner->GetContentOf(this, getter_AddRefs(content)); @@ -560,7 +560,7 @@ PRBool nsBoxFrame::GetInitialVAlignment(nsBoxFrame::Valignment& aValign) { - nsString value; + nsAutoString value; nsCOMPtr content; mInner->GetContentOf(this, getter_AddRefs(content)); @@ -624,7 +624,7 @@ PRBool nsBoxFrame::GetInitialOrientation(PRBool& aIsHorizontal) { // see if we are a vertical or horizontal box. - nsString value; + nsAutoString value; nsCOMPtr content; mInner->GetContentOf(this, getter_AddRefs(content)); @@ -659,7 +659,7 @@ nsBoxFrame::GetInitialOrientation(PRBool& aIsHorizontal) PRBool nsBoxFrame::GetInitialAutoStretch(PRBool& aStretch) { - nsString value; + nsAutoString value; nsCOMPtr content; mInner->GetContentOf(this, getter_AddRefs(content)); @@ -907,7 +907,7 @@ nsBoxFrame::GetChildBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowStat nsReflowStatus status; PRBool redraw; - nsString reason("To get pref size"); + nsAutoString reason("To get pref size"); nsHTMLReflowState state(aReflowState); state.availableWidth = NS_INTRINSICSIZE; @@ -3423,7 +3423,7 @@ nsBoxFrame::GetFrameName(nsString& aResult) const nsIFrame* frame = (nsIFrame*)this; mInner->GetContentOf(frame, getter_AddRefs(content)); - nsString id; + nsAutoString id; content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, id); aResult = "Box[id="; @@ -3662,19 +3662,19 @@ nsBoxDebug::DisplayDebugInfoFor(nsIPresContext* aPresContext, nsCOMPtr content; aBoxFrame->mInner->GetContentOf(aBoxFrame, getter_AddRefs(content)); - nsString id; + nsAutoString id; content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, id); char idValue[100]; id.ToCString(idValue,100); - nsString kClass; + nsAutoString kClass; content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::kClass, kClass); char kClassValue[100]; kClass.ToCString(kClassValue,100); nsCOMPtr tag; content->GetTag(*getter_AddRefs(tag)); - nsString tagString; + nsAutoString tagString; tag->ToString(tagString); char tagValue[100]; tagString.ToCString(tagValue,100); @@ -3858,7 +3858,7 @@ nsBoxFrame::GetCursor(nsIPresContext* aPresContext, nsCOMPtr content; mInner->GetContentOf(this, getter_AddRefs(content)); - nsString id; + nsAutoString id; content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, id); char idValue[100]; id.ToCString(idValue,100); diff --git a/layout/xul/base/src/nsSliderFrame.cpp b/layout/xul/base/src/nsSliderFrame.cpp index a2bbf563d2e..7fb2f68ff54 100644 --- a/layout/xul/base/src/nsSliderFrame.cpp +++ b/layout/xul/base/src/nsSliderFrame.cpp @@ -133,7 +133,7 @@ nsSliderFrame::GetPageIncrement(nsIContent* content) PRInt32 nsSliderFrame::GetIntegerAttribute(nsIContent* content, nsIAtom* atom, PRInt32 defaultValue) { - nsString value; + nsAutoString value; if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, atom, value)) { PRInt32 error; @@ -178,7 +178,7 @@ nsSliderFrame::AttributeChanged(nsIPresContext* aPresContext, sprintf(ch,"%d", current); // set the new position but don't notify anyone. We already know - scrollbar->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, nsString(ch), PR_FALSE); + scrollbar->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, nsAutoString(ch), PR_FALSE); } } @@ -292,7 +292,7 @@ PRBool nsSliderFrame::IsHorizontal(nsIContent* scrollbar) { PRBool isHorizontal = PR_TRUE; - nsString value; + nsAutoString value; if (NS_CONTENT_ATTR_HAS_VALUE == scrollbar->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, value)) { if (value=="vertical") @@ -375,7 +375,7 @@ nsSliderFrame::Reflow(nsIPresContext* aPresContext, thumbFrame->GetContent(getter_AddRefs(content)); PRInt32 error; - nsString value; + nsAutoString value; if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsXULAtoms::flex, value)) { value.Trim("%"); @@ -659,7 +659,7 @@ nsSliderFrame::SetCurrentPosition(nsIContent* scrollbar, nsIFrame* aThumbFrame, sprintf(ch,"%d", newpos); // set the new position - scrollbar->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, nsString(ch), PR_TRUE); + scrollbar->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, nsAutoString(ch), PR_TRUE); if (DEBUG_SLIDER) printf("Current Pos=%s\n",ch); diff --git a/netwerk/protocol/http/src/nsHTTPRequest.cpp b/netwerk/protocol/http/src/nsHTTPRequest.cpp index 674817defe6..7942d4e2efa 100644 --- a/netwerk/protocol/http/src/nsHTTPRequest.cpp +++ b/netwerk/protocol/http/src/nsHTTPRequest.cpp @@ -103,7 +103,7 @@ nsHTTPRequest::nsHTTPRequest(nsIURI* i_URL, HTTPMethod i_Method): nsXPIDLString ua; if (NS_SUCCEEDED(httpHandler->GetUserAgent(getter_Copies(ua)))) { - nsCString uaString((const PRUnichar*)ua); + nsCAutoString uaString((const PRUnichar*)ua); SetHeader(nsHTTPAtoms::User_Agent, uaString.GetBuffer()); } diff --git a/rdf/content/src/nsXULDocument.cpp b/rdf/content/src/nsXULDocument.cpp index 6e1b3a9686d..8ea552a423c 100644 --- a/rdf/content/src/nsXULDocument.cpp +++ b/rdf/content/src/nsXULDocument.cpp @@ -751,6 +751,12 @@ nsXULDocument::StartDocumentLoad(const char* aCommand, return NS_OK; } +NS_IMETHODIMP +nsXULDocument::StopDocumentLoad() +{ + return NS_OK; +} + const nsString* nsXULDocument::GetDocumentTitle() const { diff --git a/rdf/content/src/nsXULDocument.h b/rdf/content/src/nsXULDocument.h index 8a7c7a259b9..4472d1e0e36 100644 --- a/rdf/content/src/nsXULDocument.h +++ b/rdf/content/src/nsXULDocument.h @@ -89,7 +89,6 @@ class nsXULDocument : public nsIDocument, public nsIDOMNSDocument, public nsIDOMEventCapturer, public nsIJSScriptObject, - public nsIScriptObjectOwner, public nsIHTMLContentContainer, public nsIStreamLoaderObserver, public nsSupportsWeakReference @@ -113,6 +112,8 @@ public: nsISupports* aContainer, nsIStreamListener **aDocListener); + NS_IMETHOD StopDocumentLoad(); + virtual const nsString* GetDocumentTitle() const; virtual nsIURI* GetDocumentURL() const; diff --git a/rdf/content/src/nsXULElement.h b/rdf/content/src/nsXULElement.h index 985e2ef32c8..ef5cb83423d 100644 --- a/rdf/content/src/nsXULElement.h +++ b/rdf/content/src/nsXULElement.h @@ -314,7 +314,6 @@ class nsXULElement : public nsIStyledContent, public nsIBindableContent, public nsIDOMXULElement, public nsIDOMEventReceiver, - public nsIScriptObjectOwner, public nsIScriptEventHandlerOwner, public nsIJSScriptObject, public nsIStyleRule, diff --git a/xpcom/base/IIDS.h b/xpcom/base/IIDS.h index e689b180af0..3bac753a965 100644 --- a/xpcom/base/IIDS.h +++ b/xpcom/base/IIDS.h @@ -1232,13 +1232,13 @@ nsIDOMHTMLFormControlList = { /* a6cf911a-15b3-11d2-932e-00805f8add32 */ 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }; -INTERFACENAME = { /* a6cf911b-15b3-11d2-932e-00805f8add32 */ +nsIDOMNSHTMLAreaElement = { /* a6cf911b-15b3-11d2-932e-00805f8add32 */ 0xa6cf911b, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }; -INTERFACENAME = { /* a6cf911c-15b3-11d2-932e-00805f8add32 */ +nsIDOMNSHTMLAnchorElement = { /* a6cf911c-15b3-11d2-932e-00805f8add32 */ 0xa6cf911c, 0x15b3, 0x11d2,