Make XUL elements implement nsIDOMElementCSSInlineStyle. Bug 336096, patch by

Alex Vincent <ajvincent@gmail.com>, r+sr=sicking
This commit is contained in:
bzbarsky%mit.edu 2006-09-21 03:35:50 +00:00
Родитель 9823d58566
Коммит 2af8e92994
2 изменённых файлов: 29 добавлений и 0 удалений

Просмотреть файл

@ -83,6 +83,7 @@
#include "nsIDOMNodeList.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMElementCSSInlineStyle.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDocument.h"
#include "nsIEventListenerManager.h"
@ -261,6 +262,29 @@ PRUint32 nsXULPrototypeAttribute::gNumCacheSets;
PRUint32 nsXULPrototypeAttribute::gNumCacheFills;
#endif
class nsXULElementTearoff : public nsIDOMElementCSSInlineStyle
{
NS_DECL_ISUPPORTS
nsXULElementTearoff(nsXULElement *aElement)
: mElement(aElement)
{
}
NS_FORWARD_NSIDOMELEMENTCSSINLINESTYLE(mElement->)
private:
nsRefPtr<nsXULElement> mElement;
};
NS_IMPL_ADDREF(nsXULElementTearoff)
NS_IMPL_RELEASE(nsXULElementTearoff)
NS_INTERFACE_MAP_BEGIN(nsXULElementTearoff)
NS_INTERFACE_MAP_ENTRY(nsIDOMElementCSSInlineStyle)
NS_INTERFACE_MAP_END_AGGREGATED(mElement)
//----------------------------------------------------------------------
// nsXULElement
//
@ -416,6 +440,10 @@ nsXULElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
inst = NS_STATIC_CAST(nsIScriptEventHandlerOwner *, this);
} else if (aIID.Equals(NS_GET_IID(nsIChromeEventHandler))) {
inst = NS_STATIC_CAST(nsIChromeEventHandler *, this);
} else if (aIID.Equals(NS_GET_IID(nsIDOMElementCSSInlineStyle))) {
inst = NS_STATIC_CAST(nsIDOMElementCSSInlineStyle *,
new nsXULElementTearoff(this));
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
} else if (aIID.Equals(NS_GET_IID(nsIClassInfo))) {
inst = nsContentUtils::GetClassInfoInstance(eDOMClassInfo_XULElement_id);
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);

Просмотреть файл

@ -2384,6 +2384,7 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMElementCSSInlineStyle)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(XULCommandDispatcher, nsIDOMXULCommandDispatcher)