Landing DOM Level 2 CSS and Views interfaces and implementation.

This commit is contained in:
jst%netscape.com 2000-04-26 13:58:56 +00:00
parent af2e8f2420
commit af8646bbb5
68 changed files with 2185 additions and 1282 deletions

View File

@ -46,11 +46,13 @@
#include "nsContentList.h"
#include "nsIDOMEventListener.h"
#include "nsIDOMStyleSheet.h"
#include "nsIDOMStyleSheetCollection.h"
#include "nsIDOMStyleSheetList.h"
#include "nsDOMAttribute.h"
#include "nsDOMCID.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsIDOMDOMImplementation.h"
#include "nsIDOMDocumentView.h"
#include "nsIDOMAbstractView.h"
#include "nsGenericElement.h"
#include "nsICSSStyleSheet.h"
@ -104,7 +106,6 @@ static NS_DEFINE_IID(kIScriptEventListenerIID, NS_ISCRIPTEVENTLISTENER_IID);
static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID);
static NS_DEFINE_IID(kIEventListenerManagerIID, NS_IEVENTLISTENERMANAGER_IID);
static NS_DEFINE_IID(kIPostDataIID, NS_IPOSTDATA_IID);
static NS_DEFINE_IID(kIDOMStyleSheetCollectionIID, NS_IDOMSTYLESHEETCOLLECTION_IID);
static NS_DEFINE_IID(kIDOMStyleSheetIID, NS_IDOMSTYLESHEET_IID);
static NS_DEFINE_IID(kIDOMDOMImplementationIID, NS_IDOMDOMIMPLEMENTATION_IID);
static NS_DEFINE_IID(kIDocumentObserverIID, NS_IDOCUMENT_OBSERVER_IID);
@ -126,16 +127,16 @@ static NS_DEFINE_IID(kIWordBreakerFactoryIID, NS_IWORDBREAKERFACTORY_IID);
#include "nsIHTMLDocument.h"
static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID);
class nsDOMStyleSheetCollection : public nsIDOMStyleSheetCollection,
public nsIScriptObjectOwner,
public nsIDocumentObserver
class nsDOMStyleSheetList : public nsIDOMStyleSheetList,
public nsIScriptObjectOwner,
public nsIDocumentObserver
{
public:
nsDOMStyleSheetCollection(nsIDocument *aDocument);
virtual ~nsDOMStyleSheetCollection();
nsDOMStyleSheetList(nsIDocument *aDocument);
virtual ~nsDOMStyleSheetList();
NS_DECL_ISUPPORTS
NS_DECL_IDOMSTYLESHEETCOLLECTION
NS_DECL_IDOMSTYLESHEETLIST
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; }
NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; }
@ -202,7 +203,7 @@ protected:
void* mScriptObject;
};
nsDOMStyleSheetCollection::nsDOMStyleSheetCollection(nsIDocument *aDocument)
nsDOMStyleSheetList::nsDOMStyleSheetList(nsIDocument *aDocument)
{
NS_INIT_REFCNT();
mLength = -1;
@ -213,7 +214,7 @@ nsDOMStyleSheetCollection::nsDOMStyleSheetCollection(nsIDocument *aDocument)
mScriptObject = nsnull;
}
nsDOMStyleSheetCollection::~nsDOMStyleSheetCollection()
nsDOMStyleSheetList::~nsDOMStyleSheetList()
{
if (nsnull != mDocument) {
mDocument->RemoveObserver(this);
@ -221,46 +222,18 @@ nsDOMStyleSheetCollection::~nsDOMStyleSheetCollection()
mDocument = nsnull;
}
NS_IMPL_ADDREF(nsDOMStyleSheetCollection)
NS_IMPL_RELEASE(nsDOMStyleSheetCollection)
NS_IMPL_ADDREF(nsDOMStyleSheetList)
NS_IMPL_RELEASE(nsDOMStyleSheetList)
nsresult
nsDOMStyleSheetCollection::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
{
if (NULL == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(kIDOMStyleSheetCollectionIID)) {
nsIDOMStyleSheetCollection *tmp = this;
*aInstancePtrResult = (void*) tmp;
AddRef();
return NS_OK;
}
if (aIID.Equals(kIScriptObjectOwnerIID)) {
nsIScriptObjectOwner *tmp = this;
*aInstancePtrResult = (void*) tmp;
AddRef();
return NS_OK;
}
if (aIID.Equals(kIDocumentObserverIID)) {
nsIDocumentObserver *tmp = this;
*aInstancePtrResult = (void*) tmp;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
nsIDOMStyleSheetCollection *tmp = this;
nsISupports *tmp2 = tmp;
*aInstancePtrResult = (void*) tmp2;
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_INTERFACE_MAP_BEGIN(nsDOMStyleSheetList)
NS_INTERFACE_MAP_ENTRY(nsIDOMStyleSheetList)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
NS_INTERFACE_MAP_ENTRY(nsIDocumentObserver)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStyleSheetList)
NS_INTERFACE_MAP_END
NS_IMETHODIMP
nsDOMStyleSheetCollection::GetLength(PRUint32* aLength)
nsDOMStyleSheetList::GetLength(PRUint32* aLength)
{
if (nsnull != mDocument) {
// XXX Find the number and then cache it. We'll use the
@ -293,7 +266,7 @@ nsDOMStyleSheetCollection::GetLength(PRUint32* aLength)
}
NS_IMETHODIMP
nsDOMStyleSheetCollection::Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn)
nsDOMStyleSheetList::Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn)
{
*aReturn = nsnull;
if (nsnull != mDocument) {
@ -321,19 +294,19 @@ nsDOMStyleSheetCollection::Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn)
}
NS_IMETHODIMP
nsDOMStyleSheetCollection::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
nsDOMStyleSheetList::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
{
nsresult res = NS_OK;
if (nsnull == mScriptObject) {
nsISupports *supports = (nsISupports *)(nsIDOMStyleSheetCollection *)this;
nsISupports *supports = (nsISupports *)(nsIDOMStyleSheetList *)this;
nsISupports *parent = (nsISupports *)mDocument;
// XXX Should be done through factory
res = NS_NewScriptStyleSheetCollection(aContext,
supports,
parent,
(void**)&mScriptObject);
res = NS_NewScriptStyleSheetList(aContext,
supports,
parent,
(void**)&mScriptObject);
}
*aScriptObject = mScriptObject;
@ -341,15 +314,15 @@ nsDOMStyleSheetCollection::GetScriptObject(nsIScriptContext *aContext, void** aS
}
NS_IMETHODIMP
nsDOMStyleSheetCollection::SetScriptObject(void* aScriptObject)
nsDOMStyleSheetList::SetScriptObject(void* aScriptObject)
{
mScriptObject = aScriptObject;
return NS_OK;
}
NS_IMETHODIMP
nsDOMStyleSheetCollection::StyleSheetAdded(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet)
nsDOMStyleSheetList::StyleSheetAdded(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet)
{
if (-1 != mLength) {
nsIDOMStyleSheet *domss;
@ -363,8 +336,8 @@ nsDOMStyleSheetCollection::StyleSheetAdded(nsIDocument *aDocument,
}
NS_IMETHODIMP
nsDOMStyleSheetCollection::StyleSheetRemoved(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet)
nsDOMStyleSheetList::StyleSheetRemoved(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet)
{
if (-1 != mLength) {
nsIDOMStyleSheet *domss;
@ -378,7 +351,7 @@ nsDOMStyleSheetCollection::StyleSheetRemoved(nsIDocument *aDocument,
}
NS_IMETHODIMP
nsDOMStyleSheetCollection::DocumentWillBeDestroyed(nsIDocument *aDocument)
nsDOMStyleSheetList::DocumentWillBeDestroyed(nsIDocument *aDocument)
{
if (nsnull != mDocument) {
aDocument->RemoveObserver(this);
@ -739,6 +712,18 @@ nsresult nsDocument::QueryInterface(REFNSIID aIID, void** aInstancePtr)
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIDOMDocumentStyle))) {
nsIDOMDocumentStyle* tmp = this;
*aInstancePtr = (void*) tmp;
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIDOMDocumentView))) {
nsIDOMDocumentView* tmp = this;
*aInstancePtr = (void*) tmp;
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(kIScriptObjectOwnerIID)) {
nsIScriptObjectOwner* tmp = this;
*aInstancePtr = (void*) tmp;
@ -2048,10 +2033,10 @@ nsDocument::GetElementsByTagName(const nsString& aTagname,
}
NS_IMETHODIMP
nsDocument::GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets)
nsDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets)
{
if (nsnull == mDOMStyleSheets) {
mDOMStyleSheets = new nsDOMStyleSheetCollection(this);
mDOMStyleSheets = new nsDOMStyleSheetList(this);
if (nsnull == mDOMStyleSheets) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -2086,6 +2071,17 @@ nsDocument::CreateRange(nsIDOMRange** aReturn)
}
NS_IMETHODIMP
nsDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView)
{
NS_ENSURE_ARG_POINTER(aDefaultView);
*aDefaultView = nsnull;
return NS_OK;
}
nsresult
nsDocument::GetPixelDimensions(nsIPresShell* aShell,
PRInt32* aWidth,

View File

@ -27,7 +27,9 @@
#include "nsWeakPtr.h"
#include "nsVoidArray.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentView.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMDocumentStyle.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDiskDocument.h"
#include "nsIScriptObjectOwner.h"
@ -40,7 +42,7 @@
#include "nsIPrincipal.h"
class nsIEventListenerManager;
class nsDOMStyleSheetCollection;
class nsDOMStyleSheetList;
class nsIOutputStream;
class nsDocument;
@ -109,6 +111,8 @@ protected:
class nsDocument : public nsIDocument,
public nsIDOMDocument,
public nsIDOMNSDocument,
public nsIDOMDocumentStyle,
public nsIDOMDocumentView,
public nsIDiskDocument,
public nsIJSScriptObject,
public nsSupportsWeakReference,
@ -345,7 +349,7 @@ public:
NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn);
NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn);
NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn);
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets);
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets);
NS_IMETHOD GetCharacterSet(nsString& aCharacterSet);
NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName,
const nsString& aNameSpace,
@ -357,6 +361,9 @@ public:
// nsIDOMNode interface
NS_DECL_IDOMNODE
// nsIDOMDocumentView
NS_DECL_IDOMDOCUMENTVIEW
// nsIDOMEventReceiver interface
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
@ -448,7 +455,7 @@ protected:
nsIEventListenerManager* mListenerManager;
PRInt8 mDisplaySelection;
PRBool mInDestructor;
nsDOMStyleSheetCollection *mDOMStyleSheets;
nsDOMStyleSheetList *mDOMStyleSheets;
nsINameSpaceManager* mNameSpaceManager;
nsDocHeaderData* mHeaderData;
nsILineBreaker* mLineBreaker;

View File

@ -990,16 +990,10 @@ public:
virtual void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize);
// nsIDOMCSSRule interface
NS_IMETHOD GetType(PRUint16* aType);
NS_IMETHOD GetCssText(nsString& aCssText);
NS_IMETHOD SetCssText(const nsString& aCssText);
NS_IMETHOD GetSheet(nsIDOMCSSStyleSheet** aSheet);
NS_DECL_IDOMCSSRULE
// nsIDOMCSSStyleRule interface
NS_IMETHOD GetSelectorText(nsString& aSelectorText);
NS_IMETHOD SetSelectorText(const nsString& aSelectorText);
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle);
NS_IMETHOD SetStyle(nsIDOMCSSStyleDeclaration* aStyle);
NS_DECL_IDOMCSSSTYLERULE
// nsIScriptObjectOwner interface
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
@ -3230,7 +3224,7 @@ CSSStyleRuleImpl::SetCssText(const nsString& aCssText)
}
NS_IMETHODIMP
CSSStyleRuleImpl::GetSheet(nsIDOMCSSStyleSheet** aSheet)
CSSStyleRuleImpl::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
if (nsnull != mSheet) {
return mSheet->QueryInterface(kIDOMCSSStyleSheetIID, (void**)aSheet);
@ -3239,6 +3233,12 @@ CSSStyleRuleImpl::GetSheet(nsIDOMCSSStyleSheet** aSheet)
return NS_OK;
}
NS_IMETHODIMP
CSSStyleRuleImpl::GetParentRule(nsIDOMCSSRule** aParentRule)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
CSSStyleRuleImpl::GetSelectorText(nsString& aSelectorText)
{
@ -3273,13 +3273,6 @@ CSSStyleRuleImpl::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
return NS_OK;
}
NS_IMETHODIMP
CSSStyleRuleImpl::SetStyle(nsIDOMCSSStyleDeclaration* aStyle)
{
// XXX TBI
return NS_OK;
}
NS_IMETHODIMP
CSSStyleRuleImpl::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
{

View File

@ -48,11 +48,13 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#include "nsString.h"
#include "nsVoidArray.h"
#include "nsHTMLIIDs.h"
#include "nsIDOMStyleSheetCollection.h"
#include "nsIDOMStyleSheetList.h"
#include "nsIDOMCSSStyleSheet.h"
#include "nsIDOMCSSStyleRule.h"
#include "nsIDOMCSSStyleRuleCollection.h"
#include "nsIDOMCSSRuleList.h"
#include "nsIDOMMediaList.h"
#include "nsIDOMNode.h"
#include "nsDOMError.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsICSSParser.h"
@ -75,8 +77,6 @@ static NS_DEFINE_IID(kIStyleRuleIID, NS_ISTYLE_RULE_IID);
static NS_DEFINE_IID(kIDOMStyleSheetIID, NS_IDOMSTYLESHEET_IID);
static NS_DEFINE_IID(kIDOMCSSStyleSheetIID, NS_IDOMCSSSTYLESHEET_IID);
static NS_DEFINE_IID(kIDOMCSSStyleRuleIID, NS_IDOMCSSSTYLERULE_IID);
static NS_DEFINE_IID(kIDOMCSSStyleRuleCollectionIID, NS_IDOMCSSSTYLERULECOLLECTION_IID);
static NS_DEFINE_IID(kIDOMStyleSheetCollectionIID, NS_IDOMSTYLESHEETCOLLECTION_IID);
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
// ----------------------
@ -461,7 +461,8 @@ public:
//
class CSSImportsCollectionImpl;
class CSSStyleRuleCollectionImpl;
class CSSRuleListImpl;
class DOMMediaListImpl;
class CSSStyleSheetImpl : public nsICSSStyleSheet,
public nsIDOMCSSStyleSheet,
@ -533,20 +534,10 @@ public:
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize);
// nsIDOMStyleSheet interface
NS_IMETHOD GetType(nsString& aType);
NS_IMETHOD GetDisabled(PRBool* aDisabled);
NS_IMETHOD SetDisabled(PRBool aDisabled);
NS_IMETHOD GetReadOnly(PRBool* aReadOnly);
NS_DECL_IDOMSTYLESHEET
// nsIDOMCSSStyleSheet interface
NS_IMETHOD GetOwningNode(nsIDOMNode** aOwningNode);
NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet);
NS_IMETHOD GetHref(nsString& aHref);
NS_IMETHOD GetTitle(nsString& aTitle);
NS_IMETHOD GetMedia(nsString& aMedia);
NS_IMETHOD GetCssRules(nsIDOMCSSStyleRuleCollection** aCssRules);
NS_IMETHOD InsertRule(const nsString& aRule, PRUint32 aIndex, PRUint32* aReturn);
NS_IMETHOD DeleteRule(PRUint32 aIndex);
NS_DECL_IDOMCSSSTYLESHEET
// nsIScriptObjectOwner interface
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
@ -571,13 +562,13 @@ protected:
NS_DECL_OWNINGTHREAD // for thread-safety checking
nsString mTitle;
nsISupportsArray* mMedia;
DOMMediaListImpl* mMedia;
CSSStyleSheetImpl* mFirstChild;
CSSStyleSheetImpl* mNext;
nsICSSStyleSheet* mParent;
CSSImportsCollectionImpl* mImportsCollection;
CSSStyleRuleCollectionImpl* mRuleCollection;
CSSRuleListImpl* mRuleCollection;
nsIDocument* mDocument;
nsIDOMNode* mOwningNode;
PRBool mDisabled;
@ -593,19 +584,19 @@ friend class CSSRuleProcessor;
// -------------------------------
// Style Rule Collection for the DOM
// Style Rule List for the DOM
//
class CSSStyleRuleCollectionImpl : public nsIDOMCSSStyleRuleCollection,
public nsIScriptObjectOwner
class CSSRuleListImpl : public nsIDOMCSSRuleList,
public nsIScriptObjectOwner
{
public:
CSSStyleRuleCollectionImpl(CSSStyleSheetImpl *aStyleSheet);
CSSRuleListImpl(CSSStyleSheetImpl *aStyleSheet);
NS_DECL_ISUPPORTS
// nsIDOMCSSStyleRuleCollection interface
// nsIDOMCSSRuleList interface
NS_IMETHOD GetLength(PRUint32* aLength);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMCSSStyleRule** aReturn);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMCSSRule** aReturn);
// nsIScriptObjectOwner interface
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
@ -614,7 +605,7 @@ public:
void DropReference() { mStyleSheet = nsnull; }
protected:
virtual ~CSSStyleRuleCollectionImpl();
virtual ~CSSRuleListImpl();
CSSStyleSheetImpl* mStyleSheet;
void* mScriptObject;
@ -622,7 +613,7 @@ public:
PRBool mRulesAccessed;
};
CSSStyleRuleCollectionImpl::CSSStyleRuleCollectionImpl(CSSStyleSheetImpl *aStyleSheet)
CSSRuleListImpl::CSSRuleListImpl(CSSStyleSheetImpl *aStyleSheet)
{
NS_INIT_REFCNT();
// Not reference counted to avoid circular references.
@ -632,46 +623,22 @@ CSSStyleRuleCollectionImpl::CSSStyleRuleCollectionImpl(CSSStyleSheetImpl *aStyle
mRulesAccessed = PR_FALSE;
}
CSSStyleRuleCollectionImpl::~CSSStyleRuleCollectionImpl()
CSSRuleListImpl::~CSSRuleListImpl()
{
}
NS_IMPL_ADDREF(CSSStyleRuleCollectionImpl);
NS_IMPL_RELEASE(CSSStyleRuleCollectionImpl);
NS_IMPL_ADDREF(CSSRuleListImpl);
NS_IMPL_RELEASE(CSSRuleListImpl);
nsresult
CSSStyleRuleCollectionImpl::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
{
if (NULL == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIDOMCSSStyleRuleCollectionIID)) {
nsIDOMCSSStyleRuleCollection *tmp = this;
*aInstancePtrResult = (void*) tmp;
AddRef();
return NS_OK;
}
if (aIID.Equals(kIScriptObjectOwnerIID)) {
nsIScriptObjectOwner *tmp = this;
*aInstancePtrResult = (void*) tmp;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
nsIDOMCSSStyleRuleCollection *tmp = this;
nsISupports *tmp2 = tmp;
*aInstancePtrResult = (void*) tmp2;
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_INTERFACE_MAP_BEGIN(CSSRuleListImpl)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSRuleList)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMCSSRuleList)
NS_INTERFACE_MAP_END
NS_IMETHODIMP
CSSStyleRuleCollectionImpl::GetLength(PRUint32* aLength)
CSSRuleListImpl::GetLength(PRUint32* aLength)
{
if (nsnull != mStyleSheet) {
PRInt32 count;
@ -686,7 +653,7 @@ CSSStyleRuleCollectionImpl::GetLength(PRUint32* aLength)
}
NS_IMETHODIMP
CSSStyleRuleCollectionImpl::Item(PRUint32 aIndex, nsIDOMCSSStyleRule** aReturn)
CSSRuleListImpl::Item(PRUint32 aIndex, nsIDOMCSSRule** aReturn)
{
nsresult result = NS_OK;
@ -698,7 +665,8 @@ CSSStyleRuleCollectionImpl::Item(PRUint32 aIndex, nsIDOMCSSStyleRule** aReturn)
result = mStyleSheet->GetStyleRuleAt(aIndex, rule);
if (NS_OK == result) {
result = rule->QueryInterface(kIDOMCSSStyleRuleIID, (void **)aReturn);
result = rule->QueryInterface(NS_GET_IID(nsIDOMCSSRule),
(void **)aReturn);
mRulesAccessed = PR_TRUE; // signal to never share rules again
}
NS_RELEASE(rule);
@ -709,16 +677,16 @@ CSSStyleRuleCollectionImpl::Item(PRUint32 aIndex, nsIDOMCSSStyleRule** aReturn)
}
NS_IMETHODIMP
CSSStyleRuleCollectionImpl::GetScriptObject(nsIScriptContext *aContext,
CSSRuleListImpl::GetScriptObject(nsIScriptContext *aContext,
void** aScriptObject)
{
nsresult res = NS_OK;
if (nsnull == mScriptObject) {
nsISupports *supports = (nsISupports *)(nsIDOMCSSStyleRuleCollection *)this;
nsISupports *supports = (nsISupports *)(nsIDOMCSSRuleList *)this;
// XXX Should be done through factory
res = NS_NewScriptCSSStyleRuleCollection(aContext,
res = NS_NewScriptCSSRuleList(aContext,
supports,
(nsISupports *)(nsICSSStyleSheet*)mStyleSheet,
(void**)&mScriptObject);
@ -729,16 +697,233 @@ CSSStyleRuleCollectionImpl::GetScriptObject(nsIScriptContext *aContext,
}
NS_IMETHODIMP
CSSStyleRuleCollectionImpl::SetScriptObject(void* aScriptObject)
CSSRuleListImpl::SetScriptObject(void* aScriptObject)
{
mScriptObject = aScriptObject;
return NS_OK;
}
class DOMMediaListImpl : public nsIDOMMediaList,
public nsIScriptObjectOwner,
public nsISupportsArray
{
NS_DECL_ISUPPORTS
NS_DECL_IDOMMEDIALIST
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext,
void** aScriptObject);
NS_IMETHOD SetScriptObject(void* aScriptObject);
NS_FORWARD_NSISUPPORTSARRAY(mArray->)
NS_FORWARD_NSICOLLECTION(mArray->);
NS_IMETHOD_(PRBool) operator==(const nsISupportsArray& other) {
return PR_FALSE;
}
NS_IMETHOD_(nsISupports*) operator[](PRUint32 aIndex) {
return mArray->ElementAt(aIndex);
}
DOMMediaListImpl(nsISupportsArray *aArray, CSSStyleSheetImpl *aStyleSheet);
virtual ~DOMMediaListImpl();
void DropReference() { mStyleSheet = nsnull; }
private:
nsCOMPtr<nsISupportsArray> mArray;
CSSStyleSheetImpl* mStyleSheet;
void* mScriptObject;
};
NS_IMPL_ADDREF(DOMMediaListImpl);
NS_IMPL_RELEASE(DOMMediaListImpl);
NS_INTERFACE_MAP_BEGIN(DOMMediaListImpl)
NS_INTERFACE_MAP_ENTRY(nsIDOMMediaList)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMediaList)
NS_INTERFACE_MAP_END
DOMMediaListImpl::DOMMediaListImpl(nsISupportsArray *aArray,
CSSStyleSheetImpl *aStyleSheet)
: mArray(aArray), mStyleSheet(aStyleSheet), mScriptObject(nsnull)
{
NS_ABORT_IF_FALSE(mArray, "This can't be used without an array!!");
}
DOMMediaListImpl::~DOMMediaListImpl()
{
}
NS_IMETHODIMP
DOMMediaListImpl::GetScriptObject(nsIScriptContext *aContext,
void** aScriptObject)
{
nsresult res = NS_OK;
if (nsnull == mScriptObject) {
nsISupports *supports = (nsISupports *)(nsIDOMMediaList *)this;
// XXX Should be done through factory
res = NS_NewScriptMediaList(aContext,
supports,
(nsISupports *)(nsIDOMMediaList*)mStyleSheet,
(void**)&mScriptObject);
}
*aScriptObject = mScriptObject;
return res;
}
NS_IMETHODIMP
DOMMediaListImpl::SetScriptObject(void* aScriptObject)
{
mScriptObject = aScriptObject;
return NS_OK;
}
NS_IMETHODIMP
DOMMediaListImpl::GetMediaText(nsString& aMediaText)
{
aMediaText.Truncate();
PRUint32 cnt;
nsresult rv = Count(&cnt);
if (NS_FAILED(rv)) return rv;
PRInt32 count = cnt, index = 0;
while (index < count) {
nsCOMPtr<nsISupports> tmp(dont_AddRef(ElementAt(index++)));
NS_ENSURE_TRUE(tmp, NS_ERROR_FAILURE);
nsCOMPtr<nsIAtom> medium(do_QueryInterface(tmp));
NS_ENSURE_TRUE(medium, NS_ERROR_FAILURE);
const PRUnichar *buffer;
medium->GetUnicode(&buffer);
aMediaText.Append(buffer);
if (index < count) {
aMediaText.AppendWithConversion(", ");
}
}
return NS_OK;
}
NS_IMETHODIMP
DOMMediaListImpl::SetMediaText(const nsString& aMediaText)
{
nsresult rv = Clear();
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString buf(aMediaText);
PRInt32 n = buf.FindChar(',');
do {
if (n < 0)
n = buf.Length();
nsAutoString tmp;
buf.Left(tmp, n);
tmp.CompressWhitespace();
if (tmp.Length()) {
rv = Append(tmp);
NS_ENSURE_SUCCESS(rv, rv);
}
buf.Cut(0, n + 1);
n = buf.FindChar(',');
} while (buf.Length());
return rv;
}
NS_IMETHODIMP
DOMMediaListImpl::GetLength(PRUint32* aLength)
{
NS_ENSURE_ARG_POINTER(aLength);
PRUint32 cnt;
nsresult rv = Count(&cnt);
if (NS_FAILED(rv)) return rv;
*aLength = cnt;
return NS_OK;
}
NS_IMETHODIMP
DOMMediaListImpl::Item(PRUint32 aIndex, nsString& aReturn)
{
nsCOMPtr<nsISupports> tmp(dont_AddRef(ElementAt(aIndex)));
if (tmp) {
nsCOMPtr<nsIAtom> medium(do_QueryInterface(tmp));
NS_ENSURE_TRUE(medium, NS_ERROR_FAILURE);
const PRUnichar *buffer;
medium->GetUnicode(&buffer);
aReturn.SetString(buffer);
} else {
aReturn.Truncate();
}
return NS_OK;
}
NS_IMETHODIMP
DOMMediaListImpl::Delete(const nsString& aOldMedium)
{
if (!aOldMedium.Length())
return NS_ERROR_DOM_NOT_FOUND_ERR;
nsCOMPtr<nsIAtom> old(dont_AddRef(NS_NewAtom(aOldMedium)));
NS_ENSURE_TRUE(old, NS_ERROR_OUT_OF_MEMORY);
PRInt32 indx = IndexOf(old);
if (indx < 0) {
return NS_ERROR_DOM_NOT_FOUND_ERR;
}
RemoveElementAt(indx);
return NS_OK;
}
NS_IMETHODIMP
DOMMediaListImpl::Append(const nsString& aNewMedium)
{
if (!aNewMedium.Length())
return NS_ERROR_DOM_NOT_FOUND_ERR;
nsCOMPtr<nsIAtom> media(dont_AddRef(NS_NewAtom(aNewMedium)));
NS_ENSURE_TRUE(media, NS_ERROR_OUT_OF_MEMORY);
PRInt32 indx = IndexOf(media);
if (indx >= 0) {
RemoveElementAt(indx);
}
AppendElement(media);
return NS_OK;
}
// -------------------------------
// Imports Collection for the DOM
//
class CSSImportsCollectionImpl : public nsIDOMStyleSheetCollection,
class CSSImportsCollectionImpl : public nsIDOMStyleSheetList,
public nsIScriptObjectOwner
{
public:
@ -746,7 +931,7 @@ public:
NS_DECL_ISUPPORTS
// nsIDOMCSSStyleSheetCollection interface
// nsIDOMCSSStyleSheetList interface
NS_IMETHOD GetLength(PRUint32* aLength);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn);
@ -787,8 +972,8 @@ CSSImportsCollectionImpl::QueryInterface(REFNSIID aIID, void** aInstancePtrResul
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIDOMStyleSheetCollectionIID)) {
nsIDOMStyleSheetCollection *tmp = this;
if (aIID.Equals(NS_GET_IID(nsIDOMStyleSheetList))) {
nsIDOMStyleSheetList *tmp = this;
*aInstancePtrResult = (void*) tmp;
AddRef();
return NS_OK;
@ -800,7 +985,7 @@ CSSImportsCollectionImpl::QueryInterface(REFNSIID aIID, void** aInstancePtrResul
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
nsIDOMStyleSheetCollection *tmp = this;
nsIDOMStyleSheetList *tmp = this;
nsISupports *tmp2 = tmp;
*aInstancePtrResult = (void*) tmp2;
AddRef();
@ -850,13 +1035,13 @@ CSSImportsCollectionImpl::GetScriptObject(nsIScriptContext *aContext,
nsresult res = NS_OK;
if (nsnull == mScriptObject) {
nsISupports *supports = (nsISupports *)(nsIDOMStyleSheetCollection *)this;
nsISupports *supports = (nsISupports *)(nsIDOMStyleSheetList *)this;
// XXX Should be done through factory
res = NS_NewScriptStyleSheetCollection(aContext,
supports,
(nsISupports *)mStyleSheet,
(void**)&mScriptObject);
res = NS_NewScriptStyleSheetList(aContext,
supports,
(nsISupports *)mStyleSheet,
(void**)&mScriptObject);
}
*aScriptObject = mScriptObject;
@ -1222,9 +1407,12 @@ CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy)
}
if (aCopy.mMedia) {
NS_NewISupportsArray(&mMedia);
if (mMedia) {
mMedia->AppendElements(aCopy.mMedia);
nsCOMPtr<nsISupportsArray> tmp;
NS_NewISupportsArray(getter_AddRefs(tmp));
if (tmp) {
tmp->AppendElements(NS_STATIC_CAST(nsISupportsArray *, aCopy.mMedia));
mMedia = new DOMMediaListImpl(tmp, this);
NS_IF_ADDREF(mMedia);
}
}
@ -1246,7 +1434,6 @@ CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy)
CSSStyleSheetImpl::~CSSStyleSheetImpl()
{
NS_IF_RELEASE(mMedia);
if (mFirstChild) {
CSSStyleSheetImpl* child = mFirstChild;
do {
@ -1264,6 +1451,10 @@ CSSStyleSheetImpl::~CSSStyleSheetImpl()
mImportsCollection->DropReference();
NS_RELEASE(mImportsCollection);
}
if (mMedia) {
mMedia->DropReference();
NS_RELEASE(mMedia);
}
mInner->RemoveSheet(this);
// XXX The document reference is not reference counted and should
// not be released. The document will let us know when it is going
@ -1413,13 +1604,6 @@ CSSStyleSheetImpl::GetURL(nsIURI*& aURL) const
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetTitle(nsString& aTitle) const
{
aTitle = mTitle;
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::SetTitle(const nsString& aTitle)
{
@ -1484,10 +1668,18 @@ NS_IMETHODIMP
CSSStyleSheetImpl::AppendMedium(nsIAtom* aMedium)
{
nsresult result = NS_OK;
if (nsnull == mMedia) {
result = NS_NewISupportsArray(&mMedia);
if (!mMedia) {
nsCOMPtr<nsISupportsArray> tmp;
result = NS_NewISupportsArray(getter_AddRefs(tmp));
NS_ENSURE_SUCCESS(result, result);
mMedia = new DOMMediaListImpl(tmp, this);
NS_ENSURE_TRUE(mMedia, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(mMedia);
}
if (NS_SUCCEEDED(result) && (nsnull != mMedia)) {
if (mMedia) {
mMedia->AppendElement(aMedium);
}
return result;
@ -2049,35 +2241,32 @@ CSSStyleSheetImpl::SetDisabled(PRBool aDisabled)
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetReadOnly(PRBool* aReadOnly)
NS_IMETHODIMP
CSSStyleSheetImpl::GetOwnerNode(nsIDOMNode** aOwnerNode)
{
// XXX TBI
*aReadOnly = PR_FALSE;
*aOwnerNode = mOwningNode;
NS_IF_ADDREF(*aOwnerNode);
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetOwningNode(nsIDOMNode** aOwningNode)
{
NS_IF_ADDREF(mOwningNode);
*aOwningNode = mOwningNode;
return NS_OK;
}
NS_IMETHODIMP
NS_IMETHODIMP
CSSStyleSheetImpl::GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet)
{
if (nsnull != mParent) {
return mParent->QueryInterface(kIDOMStyleSheetIID, (void **)aParentStyleSheet);
}
else {
NS_ENSURE_ARG_POINTER(aParentStyleSheet);
nsresult rv = NS_OK;
if (mParent) {
rv = mParent->QueryInterface(NS_GET_IID(nsIDOMStyleSheet),
(void **)aParentStyleSheet);
} else {
*aParentStyleSheet = nsnull;
return NS_OK;
}
return rv;
}
NS_IMETHODIMP
NS_IMETHODIMP
CSSStyleSheetImpl::GetHref(nsString& aHref)
{
if (mInner && mInner->mURL) {
@ -2089,12 +2278,19 @@ CSSStyleSheetImpl::GetHref(nsString& aHref)
}
}
else {
aHref.SetLength(0);
aHref.Truncate();
}
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetTitle(nsString& aTitle) const
{
aTitle = mTitle;
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetTitle(nsString& aTitle)
{
@ -2103,33 +2299,37 @@ CSSStyleSheetImpl::GetTitle(nsString& aTitle)
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetMedia(nsString& aMedia)
CSSStyleSheetImpl::GetMedia(nsIDOMMediaList** aMedia)
{
aMedia.Truncate();
if (nsnull != mMedia) {
PRUint32 cnt;
nsresult rv = mMedia->Count(&cnt);
if (NS_FAILED(rv)) return rv;
PRInt32 count = cnt;
PRInt32 index = 0;
nsAutoString buffer;
while (index < count) {
nsIAtom* medium = (nsIAtom*)mMedia->ElementAt(index++);
medium->ToString(buffer);
aMedia.Append(buffer);
if (index < count) {
aMedia.AppendWithConversion(", ");
}
}
NS_ENSURE_ARG_POINTER(aMedia);
*aMedia = nsnull;
if (!mMedia) {
nsCOMPtr<nsISupportsArray> tmp;
NS_NewISupportsArray(getter_AddRefs(tmp));
NS_ENSURE_TRUE(tmp, NS_ERROR_NULL_POINTER);
mMedia = new DOMMediaListImpl(tmp, this);
NS_IF_ADDREF(mMedia);
}
*aMedia = mMedia;
NS_IF_ADDREF(*aMedia);
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetCssRules(nsIDOMCSSStyleRuleCollection** aCssRules)
CSSStyleSheetImpl::GetOwnerRule(nsIDOMCSSRule** aOwnerRule)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetCssRules(nsIDOMCSSRuleList** aCssRules)
{
if (nsnull == mRuleCollection) {
mRuleCollection = new CSSStyleRuleCollectionImpl(this);
mRuleCollection = new CSSRuleListImpl(this);
if (nsnull == mRuleCollection) {
return NS_ERROR_OUT_OF_MEMORY;
}

View File

@ -66,9 +66,10 @@
#include "nsIDOMEventListener.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsIDOMStyleSheetCollection.h"
#include "nsIDOMStyleSheetList.h"
#include "nsIDOMText.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMAbstractView.h"
#include "nsIDTD.h"
#include "nsIDocumentObserver.h"
#include "nsIFormControl.h"
@ -585,6 +586,9 @@ nsXULDocument::QueryInterface(REFNSIID iid, void** result)
else if (iid.Equals(NS_GET_IID(nsIDOMNSDocument))) {
*result = NS_STATIC_CAST(nsIDOMNSDocument*, this);
}
else if (iid.Equals(NS_GET_IID(nsIDOMDocumentView))) {
*result = NS_STATIC_CAST(nsIDOMDocumentView*, this);
}
else if (iid.Equals(NS_GET_IID(nsIJSScriptObject))) {
*result = NS_STATIC_CAST(nsIJSScriptObject*, this);
}
@ -2597,7 +2601,7 @@ nsXULDocument::DestroyForwardReferences()
//
NS_IMETHODIMP
nsXULDocument::GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets)
nsXULDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets)
{
NS_NOTREACHED("nsXULDocument::GetStyleSheets");
return NS_ERROR_NOT_IMPLEMENTED;
@ -2662,6 +2666,13 @@ nsXULDocument::CreateRange(nsIDOMRange** aRange)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView)
{
NS_NOTREACHED("nsXULDocument::GetDefaultView");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULDocument::GetWidth(PRInt32* aWidth)
{

View File

@ -35,6 +35,7 @@
#include "nsIDOMEventCapturer.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMDocumentView.h"
#include "nsIDOMSelection.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIDOMXULDocument.h"
@ -67,6 +68,7 @@
class nsIAtom;
class nsIElementFactory;
class nsIDOMStyleSheetList;
class nsILoadGroup;
class nsIRDFResource;
class nsIRDFService;
@ -89,6 +91,7 @@ class nsXULDocument : public nsIDocument,
public nsIXULDocument,
public nsIStreamLoadableDocument,
public nsIDOMXULDocument,
public nsIDOMDocumentView,
public nsIDOMNSDocument,
public nsIDOMEventCapturer,
public nsIJSScriptObject,
@ -330,8 +333,11 @@ public:
// nsIDOMDocument interface
NS_DECL_IDOMDOCUMENT
// nsIDOMDocumentView interface
NS_DECL_IDOMDOCUMENTVIEW
// nsIDOMNSDocument interface
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets);
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets);
NS_IMETHOD GetCharacterSet(nsString& aCharacterSet);
NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aResult);
NS_IMETHOD CreateRange(nsIDOMRange** aRange);

View File

@ -28,27 +28,27 @@
#include "nsString.h"
#include "nsIScriptContext.h"
class nsIDOMDocument;
class nsIDOMDocumentView;
#define NS_IDOMABSTRACTVIEW_IID \
{ 0xf51ebade, 0x8b1a, 0x11d3, \
{ 0xaa, 0xe7, 0x00, 0x10, 0x83, 0x01, 0x23, 0xb4 } }
{ 0xaa, 0xe7, 0x00, 0x10, 0x83, 0x01, 0x23, 0xb4 } }
class nsIDOMAbstractView : public nsISupports {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMABSTRACTVIEW_IID; return iid; }
NS_IMETHOD GetDocument(nsIDOMDocument** aDocument)=0;
NS_IMETHOD GetDocument(nsIDOMDocumentView** aDocument)=0;
};
#define NS_DECL_IDOMABSTRACTVIEW \
NS_IMETHOD GetDocument(nsIDOMDocument** aDocument); \
NS_IMETHOD GetDocument(nsIDOMDocumentView** aDocument); \
#define NS_FORWARD_IDOMABSTRACTVIEW(_to) \
NS_IMETHOD GetDocument(nsIDOMDocument** aDocument) { return _to GetDocument(aDocument); } \
NS_IMETHOD GetDocument(nsIDOMDocumentView** aDocument) { return _to GetDocument(aDocument); } \
#endif // nsIDOMAbstractView_h__

View File

@ -32,15 +32,14 @@ nsIDOMDocumentType.h
nsIDOMDocumentView.h
nsIDOMElement.h
nsIDOMEntity.h
nsIDOMEntityReference.h
nsIDOMMediaList.h
nsIDOMNotation.h
nsIDOMNSDocument.h
nsIDOMEntityReference.h
nsIDOMNode.h
nsIDOMNamedNodeMap.h
nsIDOMNodeList.h
nsIDOMProcessingInstruction.h
nsIDOMStyleSheet.h
nsIDOMStyleSheetCollection.h
nsIDOMStyleSheetList.h
nsIDOMText.h

View File

@ -41,16 +41,15 @@ EXPORTS = \
nsIDOMDocumentView.h \
nsIDOMElement.h \
nsIDOMEntity.h \
nsIDOMEntityReference.h \
nsIDOMMediaList.h \
nsIDOMNotation.h \
nsIDOMNSDocument.h \
nsIDOMEntityReference.h \
nsIDOMNode.h \
nsIDOMNamedNodeMap.h \
nsIDOMNodeList.h \
nsIDOMProcessingInstruction.h \
nsIDOMStyleSheet.h \
nsIDOMStyleSheetCollection.h \
nsIDOMStyleSheetList.h \
nsIDOMText.h \
$(NULL)

View File

@ -36,16 +36,15 @@ EXPORTS = \
nsIDOMDocumentView.h \
nsIDOMElement.h \
nsIDOMEntity.h \
nsIDOMEntityReference.h \
nsIDOMMediaList.h \
nsIDOMNotation.h \
nsIDOMNSDocument.h \
nsIDOMEntityReference.h \
nsIDOMNode.h \
nsIDOMNamedNodeMap.h \
nsIDOMNodeList.h \
nsIDOMProcessingInstruction.h \
nsIDOMStyleSheet.h \
nsIDOMStyleSheetCollection.h \
nsIDOMStyleSheetList.h \
nsIDOMText.h \
$(NULL)

View File

@ -29,7 +29,6 @@
#include "nsIScriptContext.h"
class nsIDOMElement;
class nsIDOMStyleSheetCollection;
class nsIDOMRange;
#define NS_IDOMNSDOCUMENT_IID \
@ -44,8 +43,6 @@ public:
NS_IMETHOD GetHeight(PRInt32* aHeight)=0;
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets)=0;
NS_IMETHOD GetCharacterSet(nsString& aCharacterSet)=0;
NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aReturn)=0;
@ -57,7 +54,6 @@ public:
#define NS_DECL_IDOMNSDOCUMENT \
NS_IMETHOD GetWidth(PRInt32* aWidth); \
NS_IMETHOD GetHeight(PRInt32* aHeight); \
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets); \
NS_IMETHOD GetCharacterSet(nsString& aCharacterSet); \
NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aReturn); \
NS_IMETHOD CreateRange(nsIDOMRange** aReturn); \
@ -67,7 +63,6 @@ public:
#define NS_FORWARD_IDOMNSDOCUMENT(_to) \
NS_IMETHOD GetWidth(PRInt32* aWidth) { return _to GetWidth(aWidth); } \
NS_IMETHOD GetHeight(PRInt32* aHeight) { return _to GetHeight(aHeight); } \
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets) { return _to GetStyleSheets(aStyleSheets); } \
NS_IMETHOD GetCharacterSet(nsString& aCharacterSet) { return _to GetCharacterSet(aCharacterSet); } \
NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aReturn) { return _to CreateElementWithNameSpace(aTagName, aNameSpace, aReturn); } \
NS_IMETHOD CreateRange(nsIDOMRange** aReturn) { return _to CreateRange(aReturn); } \

View File

@ -28,6 +28,9 @@
#include "nsString.h"
#include "nsIScriptContext.h"
class nsIDOMNode;
class nsIDOMStyleSheet;
class nsIDOMMediaList;
#define NS_IDOMSTYLESHEET_IID \
{ 0xa6cf9080, 0x15b3, 0x11d2, \
@ -42,7 +45,15 @@ public:
NS_IMETHOD GetDisabled(PRBool* aDisabled)=0;
NS_IMETHOD SetDisabled(PRBool aDisabled)=0;
NS_IMETHOD GetReadOnly(PRBool* aReadOnly)=0;
NS_IMETHOD GetOwnerNode(nsIDOMNode** aOwnerNode)=0;
NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet)=0;
NS_IMETHOD GetHref(nsString& aHref)=0;
NS_IMETHOD GetTitle(nsString& aTitle)=0;
NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia)=0;
};
@ -50,7 +61,11 @@ public:
NS_IMETHOD GetType(nsString& aType); \
NS_IMETHOD GetDisabled(PRBool* aDisabled); \
NS_IMETHOD SetDisabled(PRBool aDisabled); \
NS_IMETHOD GetReadOnly(PRBool* aReadOnly); \
NS_IMETHOD GetOwnerNode(nsIDOMNode** aOwnerNode); \
NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet); \
NS_IMETHOD GetHref(nsString& aHref); \
NS_IMETHOD GetTitle(nsString& aTitle); \
NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia); \
@ -58,7 +73,11 @@ public:
NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \
NS_IMETHOD GetDisabled(PRBool* aDisabled) { return _to GetDisabled(aDisabled); } \
NS_IMETHOD SetDisabled(PRBool aDisabled) { return _to SetDisabled(aDisabled); } \
NS_IMETHOD GetReadOnly(PRBool* aReadOnly) { return _to GetReadOnly(aReadOnly); } \
NS_IMETHOD GetOwnerNode(nsIDOMNode** aOwnerNode) { return _to GetOwnerNode(aOwnerNode); } \
NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet) { return _to GetParentStyleSheet(aParentStyleSheet); } \
NS_IMETHOD GetHref(nsString& aHref) { return _to GetHref(aHref); } \
NS_IMETHOD GetTitle(nsString& aTitle) { return _to GetTitle(aTitle); } \
NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia) { return _to GetMedia(aMedia); } \
extern "C" NS_DOM nsresult NS_InitStyleSheetClass(nsIScriptContext *aContext, void **aPrototype);

View File

@ -29,7 +29,6 @@ nsIDOMCSSRule.h
nsIDOMCSSRuleList.h
nsIDOMCSSStyleDeclaration.h
nsIDOMCSSStyleRule.h
nsIDOMCSSStyleRuleCollection.h
nsIDOMCSSStyleSheet.h
nsIDOMCSSUnknownRule.h
nsIDOMCSSValue.h

View File

@ -38,7 +38,6 @@ EXPORTS = \
nsIDOMCSSRuleList.h \
nsIDOMCSSStyleDeclaration.h \
nsIDOMCSSStyleRule.h \
nsIDOMCSSStyleRuleCollection.h \
nsIDOMCSSStyleSheet.h \
nsIDOMCSSUnknownRule.h \
nsIDOMCSSValue.h \

View File

@ -33,7 +33,6 @@ EXPORTS= \
nsIDOMCSSRuleList.h \
nsIDOMCSSStyleDeclaration.h \
nsIDOMCSSStyleRule.h \
nsIDOMCSSStyleRuleCollection.h \
nsIDOMCSSStyleSheet.h \
nsIDOMCSSUnknownRule.h \
nsIDOMCSSValue.h

View File

@ -59,9 +59,6 @@ public:
NS_IMETHOD GetBackgroundRepeat(nsString& aBackgroundRepeat)=0;
NS_IMETHOD SetBackgroundRepeat(const nsString& aBackgroundRepeat)=0;
NS_IMETHOD GetBehavior(nsString& aBehavior)=0;
NS_IMETHOD SetBehavior(const nsString& aBehavior)=0;
NS_IMETHOD GetBorder(nsString& aBorder)=0;
NS_IMETHOD SetBorder(const nsString& aBorder)=0;
@ -407,6 +404,9 @@ public:
NS_IMETHOD GetZIndex(nsString& aZIndex)=0;
NS_IMETHOD SetZIndex(const nsString& aZIndex)=0;
NS_IMETHOD GetBehavior(nsString& aBehavior)=0;
NS_IMETHOD SetBehavior(const nsString& aBehavior)=0;
NS_IMETHOD GetOpacity(nsString& aOpacity)=0;
NS_IMETHOD SetOpacity(const nsString& aOpacity)=0;
};
@ -427,8 +427,6 @@ public:
NS_IMETHOD SetBackgroundPosition(const nsString& aBackgroundPosition); \
NS_IMETHOD GetBackgroundRepeat(nsString& aBackgroundRepeat); \
NS_IMETHOD SetBackgroundRepeat(const nsString& aBackgroundRepeat); \
NS_IMETHOD GetBehavior(nsString& aBehavior); \
NS_IMETHOD SetBehavior(const nsString& aBehavior); \
NS_IMETHOD GetBorder(nsString& aBorder); \
NS_IMETHOD SetBorder(const nsString& aBorder); \
NS_IMETHOD GetBorderCollapse(nsString& aBorderCollapse); \
@ -659,6 +657,8 @@ public:
NS_IMETHOD SetWordSpacing(const nsString& aWordSpacing); \
NS_IMETHOD GetZIndex(nsString& aZIndex); \
NS_IMETHOD SetZIndex(const nsString& aZIndex); \
NS_IMETHOD GetBehavior(nsString& aBehavior); \
NS_IMETHOD SetBehavior(const nsString& aBehavior); \
NS_IMETHOD GetOpacity(nsString& aOpacity); \
NS_IMETHOD SetOpacity(const nsString& aOpacity); \
@ -679,8 +679,6 @@ public:
NS_IMETHOD SetBackgroundPosition(const nsString& aBackgroundPosition) { return _to SetBackgroundPosition(aBackgroundPosition); } \
NS_IMETHOD GetBackgroundRepeat(nsString& aBackgroundRepeat) { return _to GetBackgroundRepeat(aBackgroundRepeat); } \
NS_IMETHOD SetBackgroundRepeat(const nsString& aBackgroundRepeat) { return _to SetBackgroundRepeat(aBackgroundRepeat); } \
NS_IMETHOD GetBehavior(nsString& aBehavior) { return _to GetBehavior(aBehavior); } \
NS_IMETHOD SetBehavior(const nsString& aBehavior) { return _to SetBehavior(aBehavior); } \
NS_IMETHOD GetBorder(nsString& aBorder) { return _to GetBorder(aBorder); } \
NS_IMETHOD SetBorder(const nsString& aBorder) { return _to SetBorder(aBorder); } \
NS_IMETHOD GetBorderCollapse(nsString& aBorderCollapse) { return _to GetBorderCollapse(aBorderCollapse); } \
@ -911,6 +909,8 @@ public:
NS_IMETHOD SetWordSpacing(const nsString& aWordSpacing) { return _to SetWordSpacing(aWordSpacing); } \
NS_IMETHOD GetZIndex(nsString& aZIndex) { return _to GetZIndex(aZIndex); } \
NS_IMETHOD SetZIndex(const nsString& aZIndex) { return _to SetZIndex(aZIndex); } \
NS_IMETHOD GetBehavior(nsString& aBehavior) { return _to GetBehavior(aBehavior); } \
NS_IMETHOD SetBehavior(const nsString& aBehavior) { return _to SetBehavior(aBehavior); } \
NS_IMETHOD GetOpacity(nsString& aOpacity) { return _to GetOpacity(aOpacity); } \
NS_IMETHOD SetOpacity(const nsString& aOpacity) { return _to SetOpacity(aOpacity); } \

View File

@ -40,19 +40,16 @@ public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMCSSFONTFACERULE_IID; return iid; }
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle)=0;
NS_IMETHOD SetStyle(nsIDOMCSSStyleDeclaration* aStyle)=0;
};
#define NS_DECL_IDOMCSSFONTFACERULE \
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle); \
NS_IMETHOD SetStyle(nsIDOMCSSStyleDeclaration* aStyle); \
#define NS_FORWARD_IDOMCSSFONTFACERULE(_to) \
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { return _to GetStyle(aStyle); } \
NS_IMETHOD SetStyle(nsIDOMCSSStyleDeclaration* aStyle) { return _to SetStyle(aStyle); } \
extern "C" NS_DOM nsresult NS_InitCSSFontFaceRuleClass(nsIScriptContext *aContext, void **aPrototype);

View File

@ -29,6 +29,7 @@
#include "nsIScriptContext.h"
#include "nsIDOMCSSRule.h"
class nsIDOMMediaList;
class nsIDOMCSSStyleSheet;
#define NS_IDOMCSSIMPORTRULE_IID \
@ -40,10 +41,8 @@ public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMCSSIMPORTRULE_IID; return iid; }
NS_IMETHOD GetHref(nsString& aHref)=0;
NS_IMETHOD SetHref(const nsString& aHref)=0;
NS_IMETHOD GetMedia(nsString& aMedia)=0;
NS_IMETHOD SetMedia(const nsString& aMedia)=0;
NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia)=0;
NS_IMETHOD GetStyleSheet(nsIDOMCSSStyleSheet** aStyleSheet)=0;
};
@ -51,18 +50,14 @@ public:
#define NS_DECL_IDOMCSSIMPORTRULE \
NS_IMETHOD GetHref(nsString& aHref); \
NS_IMETHOD SetHref(const nsString& aHref); \
NS_IMETHOD GetMedia(nsString& aMedia); \
NS_IMETHOD SetMedia(const nsString& aMedia); \
NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia); \
NS_IMETHOD GetStyleSheet(nsIDOMCSSStyleSheet** aStyleSheet); \
#define NS_FORWARD_IDOMCSSIMPORTRULE(_to) \
NS_IMETHOD GetHref(nsString& aHref) { return _to GetHref(aHref); } \
NS_IMETHOD SetHref(const nsString& aHref) { return _to SetHref(aHref); } \
NS_IMETHOD GetMedia(nsString& aMedia) { return _to GetMedia(aMedia); } \
NS_IMETHOD SetMedia(const nsString& aMedia) { return _to SetMedia(aMedia); } \
NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia) { return _to GetMedia(aMedia); } \
NS_IMETHOD GetStyleSheet(nsIDOMCSSStyleSheet** aStyleSheet) { return _to GetStyleSheet(aStyleSheet); } \

View File

@ -29,7 +29,8 @@
#include "nsIScriptContext.h"
#include "nsIDOMCSSRule.h"
class nsIDOMCSSStyleRuleCollection;
class nsIDOMMediaList;
class nsIDOMCSSRuleList;
#define NS_IDOMCSSMEDIARULE_IID \
{ 0xa6cf90bc, 0x15b3, 0x11d2, \
@ -39,10 +40,9 @@ class nsIDOMCSSMediaRule : public nsIDOMCSSRule {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMCSSMEDIARULE_IID; return iid; }
NS_IMETHOD GetMediaTypes(nsString& aMediaTypes)=0;
NS_IMETHOD SetMediaTypes(const nsString& aMediaTypes)=0;
NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia)=0;
NS_IMETHOD GetCssRules(nsIDOMCSSStyleRuleCollection** aCssRules)=0;
NS_IMETHOD GetCssRules(nsIDOMCSSRuleList** aCssRules)=0;
NS_IMETHOD InsertRule(const nsString& aRule, PRUint32 aIndex, PRUint32* aReturn)=0;
@ -51,18 +51,16 @@ public:
#define NS_DECL_IDOMCSSMEDIARULE \
NS_IMETHOD GetMediaTypes(nsString& aMediaTypes); \
NS_IMETHOD SetMediaTypes(const nsString& aMediaTypes); \
NS_IMETHOD GetCssRules(nsIDOMCSSStyleRuleCollection** aCssRules); \
NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia); \
NS_IMETHOD GetCssRules(nsIDOMCSSRuleList** aCssRules); \
NS_IMETHOD InsertRule(const nsString& aRule, PRUint32 aIndex, PRUint32* aReturn); \
NS_IMETHOD DeleteRule(PRUint32 aIndex); \
#define NS_FORWARD_IDOMCSSMEDIARULE(_to) \
NS_IMETHOD GetMediaTypes(nsString& aMediaTypes) { return _to GetMediaTypes(aMediaTypes); } \
NS_IMETHOD SetMediaTypes(const nsString& aMediaTypes) { return _to SetMediaTypes(aMediaTypes); } \
NS_IMETHOD GetCssRules(nsIDOMCSSStyleRuleCollection** aCssRules) { return _to GetCssRules(aCssRules); } \
NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia) { return _to GetMedia(aMedia); } \
NS_IMETHOD GetCssRules(nsIDOMCSSRuleList** aCssRules) { return _to GetCssRules(aCssRules); } \
NS_IMETHOD InsertRule(const nsString& aRule, PRUint32 aIndex, PRUint32* aReturn) { return _to InsertRule(aRule, aIndex, aReturn); } \
NS_IMETHOD DeleteRule(PRUint32 aIndex) { return _to DeleteRule(aIndex); } \

View File

@ -39,27 +39,24 @@ class nsIDOMCSSPageRule : public nsIDOMCSSRule {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMCSSPAGERULE_IID; return iid; }
NS_IMETHOD GetName(nsString& aName)=0;
NS_IMETHOD SetName(const nsString& aName)=0;
NS_IMETHOD GetSelectorText(nsString& aSelectorText)=0;
NS_IMETHOD SetSelectorText(const nsString& aSelectorText)=0;
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle)=0;
NS_IMETHOD SetStyle(nsIDOMCSSStyleDeclaration* aStyle)=0;
};
#define NS_DECL_IDOMCSSPAGERULE \
NS_IMETHOD GetName(nsString& aName); \
NS_IMETHOD SetName(const nsString& aName); \
NS_IMETHOD GetSelectorText(nsString& aSelectorText); \
NS_IMETHOD SetSelectorText(const nsString& aSelectorText); \
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle); \
NS_IMETHOD SetStyle(nsIDOMCSSStyleDeclaration* aStyle); \
#define NS_FORWARD_IDOMCSSPAGERULE(_to) \
NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \
NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \
NS_IMETHOD GetSelectorText(nsString& aSelectorText) { return _to GetSelectorText(aSelectorText); } \
NS_IMETHOD SetSelectorText(const nsString& aSelectorText) { return _to SetSelectorText(aSelectorText); } \
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { return _to GetStyle(aStyle); } \
NS_IMETHOD SetStyle(nsIDOMCSSStyleDeclaration* aStyle) { return _to SetStyle(aStyle); } \
extern "C" NS_DOM nsresult NS_InitCSSPageRuleClass(nsIScriptContext *aContext, void **aPrototype);

View File

@ -28,6 +28,7 @@
#include "nsString.h"
#include "nsIScriptContext.h"
class nsIDOMCSSRule;
class nsIDOMCSSStyleSheet;
#define NS_IDOMCSSRULE_IID \
@ -40,10 +41,11 @@ public:
enum {
UNKNOWN_RULE = 0,
STYLE_RULE = 1,
IMPORT_RULE = 2,
MEDIA_RULE = 3,
FONT_FACE_RULE = 4,
PAGE_RULE = 5
CHARSET_RULE = 2,
IMPORT_RULE = 3,
MEDIA_RULE = 4,
FONT_FACE_RULE = 5,
PAGE_RULE = 6
};
NS_IMETHOD GetType(PRUint16* aType)=0;
@ -51,7 +53,9 @@ public:
NS_IMETHOD GetCssText(nsString& aCssText)=0;
NS_IMETHOD SetCssText(const nsString& aCssText)=0;
NS_IMETHOD GetSheet(nsIDOMCSSStyleSheet** aSheet)=0;
NS_IMETHOD GetParentStyleSheet(nsIDOMCSSStyleSheet** aParentStyleSheet)=0;
NS_IMETHOD GetParentRule(nsIDOMCSSRule** aParentRule)=0;
};
@ -59,7 +63,8 @@ public:
NS_IMETHOD GetType(PRUint16* aType); \
NS_IMETHOD GetCssText(nsString& aCssText); \
NS_IMETHOD SetCssText(const nsString& aCssText); \
NS_IMETHOD GetSheet(nsIDOMCSSStyleSheet** aSheet); \
NS_IMETHOD GetParentStyleSheet(nsIDOMCSSStyleSheet** aParentStyleSheet); \
NS_IMETHOD GetParentRule(nsIDOMCSSRule** aParentRule); \
@ -67,7 +72,8 @@ public:
NS_IMETHOD GetType(PRUint16* aType) { return _to GetType(aType); } \
NS_IMETHOD GetCssText(nsString& aCssText) { return _to GetCssText(aCssText); } \
NS_IMETHOD SetCssText(const nsString& aCssText) { return _to SetCssText(aCssText); } \
NS_IMETHOD GetSheet(nsIDOMCSSStyleSheet** aSheet) { return _to GetSheet(aSheet); } \
NS_IMETHOD GetParentStyleSheet(nsIDOMCSSStyleSheet** aParentStyleSheet) { return _to GetParentStyleSheet(aParentStyleSheet); } \
NS_IMETHOD GetParentRule(nsIDOMCSSRule** aParentRule) { return _to GetParentRule(aParentRule); } \
extern "C" NS_DOM nsresult NS_InitCSSRuleClass(nsIScriptContext *aContext, void **aPrototype);

View File

@ -43,7 +43,6 @@ public:
NS_IMETHOD SetSelectorText(const nsString& aSelectorText)=0;
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle)=0;
NS_IMETHOD SetStyle(nsIDOMCSSStyleDeclaration* aStyle)=0;
};
@ -51,7 +50,6 @@ public:
NS_IMETHOD GetSelectorText(nsString& aSelectorText); \
NS_IMETHOD SetSelectorText(const nsString& aSelectorText); \
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle); \
NS_IMETHOD SetStyle(nsIDOMCSSStyleDeclaration* aStyle); \
@ -59,7 +57,6 @@ public:
NS_IMETHOD GetSelectorText(nsString& aSelectorText) { return _to GetSelectorText(aSelectorText); } \
NS_IMETHOD SetSelectorText(const nsString& aSelectorText) { return _to SetSelectorText(aSelectorText); } \
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { return _to GetStyle(aStyle); } \
NS_IMETHOD SetStyle(nsIDOMCSSStyleDeclaration* aStyle) { return _to SetStyle(aStyle); } \
extern "C" NS_DOM nsresult NS_InitCSSStyleRuleClass(nsIScriptContext *aContext, void **aPrototype);

View File

@ -29,9 +29,8 @@
#include "nsIScriptContext.h"
#include "nsIDOMStyleSheet.h"
class nsIDOMNode;
class nsIDOMStyleSheet;
class nsIDOMCSSStyleRuleCollection;
class nsIDOMCSSRule;
class nsIDOMCSSRuleList;
#define NS_IDOMCSSSTYLESHEET_IID \
{ 0xa6cf90c2, 0x15b3, 0x11d2, \
@ -41,17 +40,9 @@ class nsIDOMCSSStyleSheet : public nsIDOMStyleSheet {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMCSSSTYLESHEET_IID; return iid; }
NS_IMETHOD GetOwningNode(nsIDOMNode** aOwningNode)=0;
NS_IMETHOD GetOwnerRule(nsIDOMCSSRule** aOwnerRule)=0;
NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet)=0;
NS_IMETHOD GetHref(nsString& aHref)=0;
NS_IMETHOD GetTitle(nsString& aTitle)=0;
NS_IMETHOD GetMedia(nsString& aMedia)=0;
NS_IMETHOD GetCssRules(nsIDOMCSSStyleRuleCollection** aCssRules)=0;
NS_IMETHOD GetCssRules(nsIDOMCSSRuleList** aCssRules)=0;
NS_IMETHOD InsertRule(const nsString& aRule, PRUint32 aIndex, PRUint32* aReturn)=0;
@ -60,24 +51,16 @@ public:
#define NS_DECL_IDOMCSSSTYLESHEET \
NS_IMETHOD GetOwningNode(nsIDOMNode** aOwningNode); \
NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet); \
NS_IMETHOD GetHref(nsString& aHref); \
NS_IMETHOD GetTitle(nsString& aTitle); \
NS_IMETHOD GetMedia(nsString& aMedia); \
NS_IMETHOD GetCssRules(nsIDOMCSSStyleRuleCollection** aCssRules); \
NS_IMETHOD GetOwnerRule(nsIDOMCSSRule** aOwnerRule); \
NS_IMETHOD GetCssRules(nsIDOMCSSRuleList** aCssRules); \
NS_IMETHOD InsertRule(const nsString& aRule, PRUint32 aIndex, PRUint32* aReturn); \
NS_IMETHOD DeleteRule(PRUint32 aIndex); \
#define NS_FORWARD_IDOMCSSSTYLESHEET(_to) \
NS_IMETHOD GetOwningNode(nsIDOMNode** aOwningNode) { return _to GetOwningNode(aOwningNode); } \
NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet) { return _to GetParentStyleSheet(aParentStyleSheet); } \
NS_IMETHOD GetHref(nsString& aHref) { return _to GetHref(aHref); } \
NS_IMETHOD GetTitle(nsString& aTitle) { return _to GetTitle(aTitle); } \
NS_IMETHOD GetMedia(nsString& aMedia) { return _to GetMedia(aMedia); } \
NS_IMETHOD GetCssRules(nsIDOMCSSStyleRuleCollection** aCssRules) { return _to GetCssRules(aCssRules); } \
NS_IMETHOD GetOwnerRule(nsIDOMCSSRule** aOwnerRule) { return _to GetOwnerRule(aOwnerRule); } \
NS_IMETHOD GetCssRules(nsIDOMCSSRuleList** aCssRules) { return _to GetCssRules(aCssRules); } \
NS_IMETHOD InsertRule(const nsString& aRule, PRUint32 aIndex, PRUint32* aReturn) { return _to InsertRule(aRule, aIndex, aReturn); } \
NS_IMETHOD DeleteRule(PRUint32 aIndex) { return _to DeleteRule(aIndex); } \

View File

@ -1,4 +1,4 @@
interface Window {
interface Window {
/* IID: { 0xa6cf906b, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
@ -80,19 +80,21 @@
DOMString escape(in DOMString str);
DOMString unescape(in DOMString str);
};
};
interface EventTarget {
interface EventTarget {
/* IID: { 0x1c773b30, 0xd1cf, 0x11d2, \
{ 0xbd, 0x95, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4 } } */
void addEventListener(in DOMString type, in function EventListener listener, in boolean useCapture);
void removeEventListener(in DOMString type, in function EventListener listener, in boolean useCapture);
};
};
interface AbstractView {
// Introduced in DOM Level 2:
interface AbstractView {
/* IID: { 0xf51ebade, 0x8b1a, 0x11d3, \
{ 0xaa, 0xe7, 0x00, 0x10, 0x83, 0x01, 0x23, 0xb4 } } */
noscript readonly attribute Document document;
};
readonly attribute DocumentView document;
};

View File

@ -1,4 +1,5 @@
interface Document : Node {
interface Document : Node {
/* IID: { 0xa6cf9075, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
@ -38,18 +39,32 @@
in DOMString localName);
// Introduced in DOM Level 2:
Element getElementById(in DOMString elementId);
};
};
interface NSDocument {
interface DocumentStyle {
/* IID: { 0x3d9f4973, 0xdd2e, 0x48f5, \
{ 0xb5, 0xf7, 0x26, 0x34, 0xe0, 0x9e, 0xad, 0xd9 } } */
readonly attribute StyleSheetList styleSheets;
};
interface DocumentView {
/* IID: { 0x1acdb2ba, 0x1dd2, 0x11b2, \
{ 0x95, 0xbc, 0x95, 0x42, 0x49, 0x5d, 0x25, 0x69 } } */
readonly attribute AbstractView defaultView;
};
interface NSDocument {
/* IID: { 0xa6cf90cd, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} } */
readonly attribute long width;
readonly attribute long height;
readonly attribute StyleSheetCollection styleSheets;
readonly attribute DOMString characterSet;
// XXX This should be removed, the new createElementNS should be used in stead
Element createElementWithNameSpace(in DOMString tagName,
in DOMString nameSpace)
raises(DOMException); Range createRange();
};
raises(DOMException);
Range createRange();
};

View File

@ -1,9 +1,12 @@
interface StyleSheet {
interface StyleSheet {
/* IID: { 0xa6cf9080, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
readonly attribute wstring type;
attribute boolean disabled;
readonly attribute boolean readOnly;
};
readonly attribute DOMString type;
attribute boolean disabled;
readonly attribute Node ownerNode;
readonly attribute StyleSheet parentStyleSheet;
readonly attribute DOMString href;
readonly attribute DOMString title;
readonly attribute MediaList media;
};

View File

@ -1,132 +1,379 @@
interface CSS2Properties : CSSStyleDeclaration {
interface CSS2Properties : CSSStyleDeclaration {
/* IID: { 0xa6cf90d1, 0x15b3, 0x11d2, \
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
attribute wstring azimuth;
attribute wstring background;
attribute wstring backgroundAttachment;
attribute wstring backgroundColor;
attribute wstring backgroundImage;
attribute wstring backgroundPosition;
attribute wstring backgroundRepeat;
attribute wstring behavior;
attribute wstring border;
attribute wstring borderCollapse;
attribute wstring borderColor;
attribute wstring borderSpacing;
attribute wstring borderStyle;
attribute wstring borderTop;
attribute wstring borderRight;
attribute wstring borderBottom;
attribute wstring borderLeft;
attribute wstring borderTopColor;
attribute wstring borderRightColor;
attribute wstring borderBottomColor;
attribute wstring borderLeftColor;
attribute wstring borderTopStyle;
attribute wstring borderRightStyle;
attribute wstring borderBottomStyle;
attribute wstring borderLeftStyle;
attribute wstring borderTopWidth;
attribute wstring borderRightWidth;
attribute wstring borderBottomWidth;
attribute wstring borderLeftWidth;
attribute wstring borderWidth;
attribute wstring bottom;
attribute wstring captionSide;
attribute wstring clear;
attribute wstring clip;
attribute wstring color;
attribute wstring content;
attribute wstring counterIncrement;
attribute wstring counterReset;
attribute wstring cue;
attribute wstring cueAfter;
attribute wstring cueBefore;
attribute wstring cursor;
attribute wstring direction;
attribute wstring display;
attribute wstring elevation;
attribute wstring emptyCells;
attribute wstring cssFloat;
attribute wstring font;
attribute wstring fontFamily;
attribute wstring fontSize;
attribute wstring fontSizeAdjust;
attribute wstring fontStretch;
attribute wstring fontStyle;
attribute wstring fontVariant;
attribute wstring fontWeight;
attribute wstring height;
attribute wstring left;
attribute wstring letterSpacing;
attribute wstring lineHeight;
attribute wstring listStyle;
attribute wstring listStyleImage;
attribute wstring listStylePosition;
attribute wstring listStyleType;
attribute wstring margin;
attribute wstring marginTop;
attribute wstring marginRight;
attribute wstring marginBottom;
attribute wstring marginLeft;
attribute wstring markerOffset;
attribute wstring marks;
attribute wstring maxHeight;
attribute wstring maxWidth;
attribute wstring minHeight;
attribute wstring minWidth;
attribute wstring orphans;
attribute wstring outline;
attribute wstring outlineColor;
attribute wstring outlineStyle;
attribute wstring outlineWidth;
attribute wstring overflow;
attribute wstring padding;
attribute wstring paddingTop;
attribute wstring paddingRight;
attribute wstring paddingBottom;
attribute wstring paddingLeft;
attribute wstring page;
attribute wstring pageBreakAfter;
attribute wstring pageBreakBefore;
attribute wstring pageBreakInside;
attribute wstring pause;
attribute wstring pauseAfter;
attribute wstring pauseBefore;
attribute wstring pitch;
attribute wstring pitchRange;
attribute wstring playDuring;
attribute wstring position;
attribute wstring quotes;
attribute wstring richness;
attribute wstring right;
attribute wstring size;
attribute wstring speak;
attribute wstring speakHeader;
attribute wstring speakNumeral;
attribute wstring speakPunctuation;
attribute wstring speechRate;
attribute wstring stress;
attribute wstring tableLayout;
attribute wstring textAlign;
attribute wstring textDecoration;
attribute wstring textIndent;
attribute wstring textShadow;
attribute wstring textTransform;
attribute wstring top;
attribute wstring unicodeBidi;
attribute wstring verticalAlign;
attribute wstring visibility;
attribute wstring voiceFamily;
attribute wstring volume;
attribute wstring whiteSpace;
attribute wstring widows;
attribute wstring width;
attribute wstring wordSpacing;
attribute wstring zIndex;
attribute DOMString azimuth;
// raises(DOMException) on setting
/* XXX Kipp was here */
attribute wstring opacity;
};
attribute DOMString background;
// raises(DOMException) on setting
attribute DOMString backgroundAttachment;
// raises(DOMException) on setting
attribute DOMString backgroundColor;
// raises(DOMException) on setting
attribute DOMString backgroundImage;
// raises(DOMException) on setting
attribute DOMString backgroundPosition;
// raises(DOMException) on setting
attribute DOMString backgroundRepeat;
// raises(DOMException) on setting
attribute DOMString border;
// raises(DOMException) on setting
attribute DOMString borderCollapse;
// raises(DOMException) on setting
attribute DOMString borderColor;
// raises(DOMException) on setting
attribute DOMString borderSpacing;
// raises(DOMException) on setting
attribute DOMString borderStyle;
// raises(DOMException) on setting
attribute DOMString borderTop;
// raises(DOMException) on setting
attribute DOMString borderRight;
// raises(DOMException) on setting
attribute DOMString borderBottom;
// raises(DOMException) on setting
attribute DOMString borderLeft;
// raises(DOMException) on setting
attribute DOMString borderTopColor;
// raises(DOMException) on setting
attribute DOMString borderRightColor;
// raises(DOMException) on setting
attribute DOMString borderBottomColor;
// raises(DOMException) on setting
attribute DOMString borderLeftColor;
// raises(DOMException) on setting
attribute DOMString borderTopStyle;
// raises(DOMException) on setting
attribute DOMString borderRightStyle;
// raises(DOMException) on setting
attribute DOMString borderBottomStyle;
// raises(DOMException) on setting
attribute DOMString borderLeftStyle;
// raises(DOMException) on setting
attribute DOMString borderTopWidth;
// raises(DOMException) on setting
attribute DOMString borderRightWidth;
// raises(DOMException) on setting
attribute DOMString borderBottomWidth;
// raises(DOMException) on setting
attribute DOMString borderLeftWidth;
// raises(DOMException) on setting
attribute DOMString borderWidth;
// raises(DOMException) on setting
attribute DOMString bottom;
// raises(DOMException) on setting
attribute DOMString captionSide;
// raises(DOMException) on setting
attribute DOMString clear;
// raises(DOMException) on setting
attribute DOMString clip;
// raises(DOMException) on setting
attribute DOMString color;
// raises(DOMException) on setting
attribute DOMString content;
// raises(DOMException) on setting
attribute DOMString counterIncrement;
// raises(DOMException) on setting
attribute DOMString counterReset;
// raises(DOMException) on setting
attribute DOMString cue;
// raises(DOMException) on setting
attribute DOMString cueAfter;
// raises(DOMException) on setting
attribute DOMString cueBefore;
// raises(DOMException) on setting
attribute DOMString cursor;
// raises(DOMException) on setting
attribute DOMString direction;
// raises(DOMException) on setting
attribute DOMString display;
// raises(DOMException) on setting
attribute DOMString elevation;
// raises(DOMException) on setting
attribute DOMString emptyCells;
// raises(DOMException) on setting
attribute DOMString cssFloat;
// raises(DOMException) on setting
attribute DOMString font;
// raises(DOMException) on setting
attribute DOMString fontFamily;
// raises(DOMException) on setting
attribute DOMString fontSize;
// raises(DOMException) on setting
attribute DOMString fontSizeAdjust;
// raises(DOMException) on setting
attribute DOMString fontStretch;
// raises(DOMException) on setting
attribute DOMString fontStyle;
// raises(DOMException) on setting
attribute DOMString fontVariant;
// raises(DOMException) on setting
attribute DOMString fontWeight;
// raises(DOMException) on setting
attribute DOMString height;
// raises(DOMException) on setting
attribute DOMString left;
// raises(DOMException) on setting
attribute DOMString letterSpacing;
// raises(DOMException) on setting
attribute DOMString lineHeight;
// raises(DOMException) on setting
attribute DOMString listStyle;
// raises(DOMException) on setting
attribute DOMString listStyleImage;
// raises(DOMException) on setting
attribute DOMString listStylePosition;
// raises(DOMException) on setting
attribute DOMString listStyleType;
// raises(DOMException) on setting
attribute DOMString margin;
// raises(DOMException) on setting
attribute DOMString marginTop;
// raises(DOMException) on setting
attribute DOMString marginRight;
// raises(DOMException) on setting
attribute DOMString marginBottom;
// raises(DOMException) on setting
attribute DOMString marginLeft;
// raises(DOMException) on setting
attribute DOMString markerOffset;
// raises(DOMException) on setting
attribute DOMString marks;
// raises(DOMException) on setting
attribute DOMString maxHeight;
// raises(DOMException) on setting
attribute DOMString maxWidth;
// raises(DOMException) on setting
attribute DOMString minHeight;
// raises(DOMException) on setting
attribute DOMString minWidth;
// raises(DOMException) on setting
attribute DOMString orphans;
// raises(DOMException) on setting
attribute DOMString outline;
// raises(DOMException) on setting
attribute DOMString outlineColor;
// raises(DOMException) on setting
attribute DOMString outlineStyle;
// raises(DOMException) on setting
attribute DOMString outlineWidth;
// raises(DOMException) on setting
attribute DOMString overflow;
// raises(DOMException) on setting
attribute DOMString padding;
// raises(DOMException) on setting
attribute DOMString paddingTop;
// raises(DOMException) on setting
attribute DOMString paddingRight;
// raises(DOMException) on setting
attribute DOMString paddingBottom;
// raises(DOMException) on setting
attribute DOMString paddingLeft;
// raises(DOMException) on setting
attribute DOMString page;
// raises(DOMException) on setting
attribute DOMString pageBreakAfter;
// raises(DOMException) on setting
attribute DOMString pageBreakBefore;
// raises(DOMException) on setting
attribute DOMString pageBreakInside;
// raises(DOMException) on setting
attribute DOMString pause;
// raises(DOMException) on setting
attribute DOMString pauseAfter;
// raises(DOMException) on setting
attribute DOMString pauseBefore;
// raises(DOMException) on setting
attribute DOMString pitch;
// raises(DOMException) on setting
attribute DOMString pitchRange;
// raises(DOMException) on setting
attribute DOMString playDuring;
// raises(DOMException) on setting
attribute DOMString position;
// raises(DOMException) on setting
attribute DOMString quotes;
// raises(DOMException) on setting
attribute DOMString richness;
// raises(DOMException) on setting
attribute DOMString right;
// raises(DOMException) on setting
attribute DOMString size;
// raises(DOMException) on setting
attribute DOMString speak;
// raises(DOMException) on setting
attribute DOMString speakHeader;
// raises(DOMException) on setting
attribute DOMString speakNumeral;
// raises(DOMException) on setting
attribute DOMString speakPunctuation;
// raises(DOMException) on setting
attribute DOMString speechRate;
// raises(DOMException) on setting
attribute DOMString stress;
// raises(DOMException) on setting
attribute DOMString tableLayout;
// raises(DOMException) on setting
attribute DOMString textAlign;
// raises(DOMException) on setting
attribute DOMString textDecoration;
// raises(DOMException) on setting
attribute DOMString textIndent;
// raises(DOMException) on setting
attribute DOMString textShadow;
// raises(DOMException) on setting
attribute DOMString textTransform;
// raises(DOMException) on setting
attribute DOMString top;
// raises(DOMException) on setting
attribute DOMString unicodeBidi;
// raises(DOMException) on setting
attribute DOMString verticalAlign;
// raises(DOMException) on setting
attribute DOMString visibility;
// raises(DOMException) on setting
attribute DOMString voiceFamily;
// raises(DOMException) on setting
attribute DOMString volume;
// raises(DOMException) on setting
attribute DOMString whiteSpace;
// raises(DOMException) on setting
attribute DOMString widows;
// raises(DOMException) on setting
attribute DOMString width;
// raises(DOMException) on setting
attribute DOMString wordSpacing;
// raises(DOMException) on setting
attribute DOMString zIndex;
// raises(DOMException) on setting
/* Non-DOM 2 extensions */
attribute DOMString behavior;
// raises(DOMException) on setting
/* XXX Kipp was here */
attribute DOMString opacity;
// raises(DOMException) on setting
};

View File

@ -1,7 +1,6 @@
interface CSSFontFaceRule : CSSRule {
interface CSSFontFaceRule : CSSRule {
/* IID: { 0xa6cf90bb, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
attribute CSSStyleDeclaration style;
};
readonly attribute CSSStyleDeclaration style;
};

View File

@ -1,9 +1,8 @@
interface CSSImportRule : CSSRule {
interface CSSImportRule : CSSRule {
/* IID: { 0xa6cf90cf, 0x15b3, 0x11d2, \
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} } */
attribute wstring href;
attribute wstring media;
readonly attribute CSSStyleSheet styleSheet;
};
readonly attribute DOMString href;
readonly attribute MediaList media;
readonly attribute CSSStyleSheet styleSheet;
};

View File

@ -1,11 +1,12 @@
interface CSSMediaRule : CSSRule {
interface CSSMediaRule : CSSRule {
/* IID: { 0xa6cf90bc, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
attribute wstring mediaTypes;
readonly attribute CSSStyleRuleCollection cssRules;
unsigned long insertRule(in wstring rule, in unsigned long index);
void deleteRule(in unsigned long index);
};
readonly attribute MediaList media;
readonly attribute CSSRuleList cssRules;
unsigned long insertRule(in DOMString rule,
in unsigned long index)
raises(DOMException);
void deleteRule(in unsigned long index)
raises(DOMException);
};

View File

@ -1,8 +1,9 @@
interface CSSPageRule : CSSRule {
interface CSSPageRule : CSSRule {
/* IID: { 0xa6cf90bd, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
attribute wstring name;
attribute CSSStyleDeclaration style;
};
attribute DOMString selectorText;
// raises(DOMException) on setting
readonly attribute CSSStyleDeclaration style;
};

View File

@ -1,17 +1,20 @@
interface CSSRule {
/* IID: { 0xa6cf90c1, 0x15b3, 0x11d2, \
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} } */
const unsigned short UNKNOWN_RULE = 0;
const unsigned short STYLE_RULE = 1;
const unsigned short IMPORT_RULE = 2;
const unsigned short MEDIA_RULE = 3;
const unsigned short FONT_FACE_RULE = 4;
const unsigned short PAGE_RULE = 5;
const unsigned short UNKNOWN_RULE = 0;
const unsigned short STYLE_RULE = 1;
const unsigned short CHARSET_RULE = 2;
const unsigned short IMPORT_RULE = 3;
const unsigned short MEDIA_RULE = 4;
const unsigned short FONT_FACE_RULE = 5;
const unsigned short PAGE_RULE = 6;
readonly attribute unsigned short type;
attribute wstring cssText;
readonly attribute CSSStyleSheet sheet;
readonly attribute unsigned short type;
attribute DOMString cssText;
// raises(DOMException) on setting
readonly attribute CSSStyleSheet parentStyleSheet;
readonly attribute CSSRule parentRule;
};

View File

@ -2,7 +2,7 @@ interface CSSStyleDeclaration {
/* IID: { 0xa6cf90be, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
attribute DOMString cssText;
attribute DOMString cssText;
// raises(DOMException) on setting
DOMString getPropertyValue(in DOMString propertyName);

View File

@ -1,8 +1,9 @@
interface CSSStyleRule : CSSRule {
interface CSSStyleRule : CSSRule {
/* IID: { 0xa6cf90bf, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
attribute wstring selectorText;
attribute CSSStyleDeclaration style;
};
attribute DOMString selectorText;
// raises(DOMException) on setting
readonly attribute CSSStyleDeclaration style;
};

View File

@ -1,17 +1,12 @@
interface CSSStyleSheet : StyleSheet {
interface CSSStyleSheet : StyleSheet {
/* IID: { 0xa6cf90c2, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
readonly attribute Node owningNode;
readonly attribute StyleSheet parentStyleSheet;
readonly attribute wstring href;
readonly attribute wstring title;
readonly attribute wstring media;
readonly attribute CSSStyleRuleCollection cssRules;
unsigned long insertRule(in wstring rule, in unsigned long index);
void deleteRule(in unsigned long index);
};
readonly attribute CSSRule ownerRule;
readonly attribute CSSRuleList cssRules;
unsigned long insertRule(in DOMString rule,
in unsigned long index)
raises(DOMException);
void deleteRule(in unsigned long index)
raises(DOMException);
};

View File

@ -1,6 +1,5 @@
interface CSSUnknownRule : CSSRule {
interface CSSUnknownRule : CSSRule {
/* IID: { 0xa6cf90d0, 0x15b3, 0x11d2, \
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
};
};

View File

@ -38,7 +38,6 @@ IDLSRCS = \
CSSRuleList.idl \
CSSStyleDeclaration.idl \
CSSStyleRule.idl \
CSSStyleRuleCollection.idl \
CSSStyleSheet.idl \
CSSUnknownRule.idl \
CSSValue.idl \

View File

@ -34,7 +34,6 @@ IDLSRCS = \
CSSRuleList.idl \
CSSStyleDeclaration.idl \
CSSStyleRule.idl \
CSSStyleRuleCollection.idl \
CSSStyleSheet.idl \
CSSUnknownRule.idl \
CSSValue.idl

View File

@ -31,6 +31,7 @@
// Use genPropNames.pl to keep this list in sync with nsDOMPropNames.h
enum nsDOMProp {
NS_DOM_PROP_ABSTRACTVIEW_DOCUMENT,
NS_DOM_PROP_APPCORESMANAGER_ADD,
NS_DOM_PROP_APPCORESMANAGER_FIND,
NS_DOM_PROP_APPCORESMANAGER_REMOVE,
@ -177,17 +178,20 @@ enum nsDOMProp {
NS_DOM_PROP_CSS2PROPERTIES_ZINDEX,
NS_DOM_PROP_CSSFONTFACERULE_STYLE,
NS_DOM_PROP_CSSIMPORTRULE_HREF,
NS_DOM_PROP_CSSIMPORTRULE_MEDIA,
NS_DOM_PROP_CSSIMPORTRULE_MEDIA,
NS_DOM_PROP_CSSIMPORTRULE_STYLESHEET,
NS_DOM_PROP_CSSMEDIARULE_CSSRULES,
NS_DOM_PROP_CSSMEDIARULE_DELETERULE,
NS_DOM_PROP_CSSMEDIARULE_INSERTRULE,
NS_DOM_PROP_CSSMEDIARULE_MEDIATYPES,
NS_DOM_PROP_CSSPAGERULE_NAME,
NS_DOM_PROP_CSSMEDIARULE_MEDIA,
NS_DOM_PROP_CSSPAGERULE_SELECTORTEXT,
NS_DOM_PROP_CSSPAGERULE_STYLE,
NS_DOM_PROP_CSSRULE_CSSTEXT,
NS_DOM_PROP_CSSRULE_SHEET,
NS_DOM_PROP_CSSRULE_PARENTRULE,
NS_DOM_PROP_CSSRULE_PARENTSTYLESHEET,
NS_DOM_PROP_CSSRULE_TYPE,
NS_DOM_PROP_CSSRULELIST_ITEM,
NS_DOM_PROP_CSSRULELIST_LENGTH,
NS_DOM_PROP_CSSSTYLEDECLARATION_CSSTEXT,
NS_DOM_PROP_CSSSTYLEDECLARATION_GETPROPERTYCSSVALUE,
NS_DOM_PROP_CSSSTYLEDECLARATION_GETPROPERTYPRIORITY,
@ -199,16 +203,10 @@ enum nsDOMProp {
NS_DOM_PROP_CSSSTYLEDECLARATION_SETPROPERTY,
NS_DOM_PROP_CSSSTYLERULE_SELECTORTEXT,
NS_DOM_PROP_CSSSTYLERULE_STYLE,
NS_DOM_PROP_CSSSTYLERULECOLLECTION_ITEM,
NS_DOM_PROP_CSSSTYLERULECOLLECTION_LENGTH,
NS_DOM_PROP_CSSSTYLESHEET_CSSRULES,
NS_DOM_PROP_CSSSTYLESHEET_CSSRULES,
NS_DOM_PROP_CSSSTYLESHEET_DELETERULE,
NS_DOM_PROP_CSSSTYLESHEET_HREF,
NS_DOM_PROP_CSSSTYLESHEET_INSERTRULE,
NS_DOM_PROP_CSSSTYLESHEET_MEDIA,
NS_DOM_PROP_CSSSTYLESHEET_OWNINGNODE,
NS_DOM_PROP_CSSSTYLESHEET_PARENTSTYLESHEET,
NS_DOM_PROP_CSSSTYLESHEET_TITLE,
NS_DOM_PROP_CSSSTYLESHEET_OWNERRULE,
NS_DOM_PROP_CSSVALUE_CSSTEXT,
NS_DOM_PROP_CSSVALUE_VALUETYPE,
NS_DOM_PROP_DOCUMENT_CREATEATTRIBUTE,
@ -228,12 +226,14 @@ enum nsDOMProp {
NS_DOM_PROP_DOCUMENT_GETELEMENTSBYTAGNAMENS,
NS_DOM_PROP_DOCUMENT_IMPLEMENTATION,
NS_DOM_PROP_DOCUMENT_IMPORTNODE,
NS_DOM_PROP_DOCUMENTSTYLE_STYLESHEETS,
NS_DOM_PROP_DOCUMENTTYPE_ENTITIES,
NS_DOM_PROP_DOCUMENTTYPE_INTERNALSUBSET,
NS_DOM_PROP_DOCUMENTTYPE_NAME,
NS_DOM_PROP_DOCUMENTTYPE_NOTATIONS,
NS_DOM_PROP_DOCUMENTTYPE_PUBLICID,
NS_DOM_PROP_DOCUMENTTYPE_SYSTEMID,
NS_DOM_PROP_DOCUMENTVIEW_DEFAULTVIEW,
NS_DOM_PROP_DOMEXCEPTION_CODE,
NS_DOM_PROP_DOMEXCEPTION_MESSAGE,
NS_DOM_PROP_DOMEXCEPTION_NAME,
@ -631,6 +631,7 @@ enum nsDOMProp {
NS_DOM_PROP_KEYEVENT_KEYCODE,
NS_DOM_PROP_KEYEVENT_METAKEY,
NS_DOM_PROP_KEYEVENT_SHIFTKEY,
NS_DOM_PROP_LINKSTYLE_SHEET,
NS_DOM_PROP_LOCATION_HASH,
NS_DOM_PROP_LOCATION_HOST,
NS_DOM_PROP_LOCATION_HOSTNAME,
@ -640,6 +641,11 @@ enum nsDOMProp {
NS_DOM_PROP_LOCATION_PROTOCOL,
NS_DOM_PROP_LOCATION_SEARCH,
NS_DOM_PROP_LOCATION_TOSTRING,
NS_DOM_PROP_MEDIALIST_APPEND,
NS_DOM_PROP_MEDIALIST_DELETE,
NS_DOM_PROP_MEDIALIST_ITEM,
NS_DOM_PROP_MEDIALIST_LENGTH,
NS_DOM_PROP_MEDIALIST_MEDIATEXT,
NS_DOM_PROP_MIMETYPE_DESCRIPTION,
NS_DOM_PROP_MIMETYPE_ENABLEDPLUGIN,
NS_DOM_PROP_MIMETYPE_SUFFIXES,
@ -711,7 +717,6 @@ enum nsDOMProp {
NS_DOM_PROP_NSDOCUMENT_CREATEELEMENTWITHNAMESPACE,
NS_DOM_PROP_NSDOCUMENT_CREATERANGE,
NS_DOM_PROP_NSDOCUMENT_HEIGHT,
NS_DOM_PROP_NSDOCUMENT_STYLESHEETS,
NS_DOM_PROP_NSDOCUMENT_WIDTH,
NS_DOM_PROP_NSHTMLANCHORELEMENT_HASH,
NS_DOM_PROP_NSHTMLANCHORELEMENT_HOST,
@ -847,10 +852,14 @@ enum nsDOMProp {
NS_DOM_PROP_SELECTION_TOSTRING,
NS_DOM_PROP_SELECTIONLISTENER_NOTIFYSELECTIONCHANGED,
NS_DOM_PROP_STYLESHEET_DISABLED,
NS_DOM_PROP_STYLESHEET_READONLY,
NS_DOM_PROP_STYLESHEET_HREF,
NS_DOM_PROP_STYLESHEET_MEDIA,
NS_DOM_PROP_STYLESHEET_OWNERNODE,
NS_DOM_PROP_STYLESHEET_PARENTSTYLESHEET,
NS_DOM_PROP_STYLESHEET_TITLE,
NS_DOM_PROP_STYLESHEET_TYPE,
NS_DOM_PROP_STYLESHEETCOLLECTION_ITEM,
NS_DOM_PROP_STYLESHEETCOLLECTION_LENGTH,
NS_DOM_PROP_STYLESHEETLIST_ITEM,
NS_DOM_PROP_STYLESHEETLIST_LENGTH,
NS_DOM_PROP_TEXT_SPLITTEXT,
NS_DOM_PROP_TEXTRANGE_RANGEEND,
NS_DOM_PROP_TEXTRANGE_RANGESTART,

View File

@ -30,6 +30,7 @@
#define nsDOMPropNames_h__
#define NS_DOM_PROP_NAMES \
"abstractview.document", \
"appcoresmanager.add", \
"appcoresmanager.find", \
"appcoresmanager.remove", \
@ -181,12 +182,15 @@
"cssmediarule.cssrules", \
"cssmediarule.deleterule", \
"cssmediarule.insertrule", \
"cssmediarule.mediatypes", \
"csspagerule.name", \
"cssmediarule.media", \
"csspagerule.selectortext", \
"csspagerule.style", \
"cssrule.csstext", \
"cssrule.sheet", \
"cssrule.parentrule", \
"cssrule.parentstylesheet", \
"cssrule.type", \
"cssrulelist.item", \
"cssrulelist.length", \
"cssstyledeclaration.csstext", \
"cssstyledeclaration.getpropertycssvalue", \
"cssstyledeclaration.getpropertypriority", \
@ -198,16 +202,10 @@
"cssstyledeclaration.setproperty", \
"cssstylerule.selectortext", \
"cssstylerule.style", \
"cssstylerulecollection.item", \
"cssstylerulecollection.length", \
"cssstylesheet.cssrules", \
"cssstylesheet.deleterule", \
"cssstylesheet.href", \
"cssstylesheet.insertrule", \
"cssstylesheet.media", \
"cssstylesheet.owningnode", \
"cssstylesheet.parentstylesheet", \
"cssstylesheet.title", \
"cssstylesheet.ownerrule", \
"cssvalue.csstext", \
"cssvalue.valuetype", \
"document.createattribute", \
@ -227,12 +225,14 @@
"document.getelementsbytagnamens", \
"document.implementation", \
"document.importnode", \
"documentstyle.stylesheets", \
"documenttype.entities", \
"documenttype.internalsubset", \
"documenttype.name", \
"documenttype.notations", \
"documenttype.publicid", \
"documenttype.systemid", \
"documentview.defaultview", \
"domexception.code", \
"domexception.message", \
"domexception.name", \
@ -630,6 +630,7 @@
"keyevent.keycode", \
"keyevent.metakey", \
"keyevent.shiftkey", \
"linkstyle.sheet", \
"location.hash", \
"location.host", \
"location.hostname", \
@ -639,6 +640,11 @@
"location.protocol", \
"location.search", \
"location.tostring", \
"medialist.append", \
"medialist.delete", \
"medialist.item", \
"medialist.length", \
"medialist.mediatext", \
"mimetype.description", \
"mimetype.enabledplugin", \
"mimetype.suffixes", \
@ -710,7 +716,6 @@
"nsdocument.createelementwithnamespace", \
"nsdocument.createrange", \
"nsdocument.height", \
"nsdocument.stylesheets", \
"nsdocument.width", \
"nshtmlanchorelement.hash", \
"nshtmlanchorelement.host", \
@ -846,10 +851,14 @@
"selection.tostring", \
"selectionlistener.notifyselectionchanged", \
"stylesheet.disabled", \
"stylesheet.readonly", \
"stylesheet.href", \
"stylesheet.media", \
"stylesheet.ownernode", \
"stylesheet.parentstylesheet", \
"stylesheet.title", \
"stylesheet.type", \
"stylesheetcollection.item", \
"stylesheetcollection.length", \
"stylesheetlist.item", \
"stylesheetlist.length", \
"text.splittext", \
"textrange.rangeend", \
"textrange.rangestart", \

View File

@ -34,6 +34,7 @@ REQUIRES = xpcom raptor dom js netlib caps oji ojiimpl
CPPSRCS = \
nsBarProps.cpp \
nsDOMException.cpp \
nsJSAbstractView.cpp \
nsJSBarProp.cpp \
nsJSDOMException.cpp \
nsJSEnvironment.cpp \

View File

@ -29,6 +29,7 @@ DEFINES=-D_IMPL_NS_DOM -DWIN32_LEAN_AND_MEAN
CPPSRCS = \
nsBarProps.cpp \
nsDOMException.cpp \
nsJSAbstractView.cpp \
nsJSBarProp.cpp \
nsJSDOMException.cpp \
nsJSEnvironment.cpp \

View File

@ -58,6 +58,7 @@
#include "nsIDocShellTreeNode.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentView.h"
#include "nsIDOMFocusListener.h"
#include "nsIDOMFormListener.h"
#include "nsIDOMKeyListener.h"
@ -1646,9 +1647,7 @@ GlobalWindowImpl::UpdateCommands(const nsString& anAction)
else
{
// See if we contain a XUL document.
nsCOMPtr<nsIDOMDocument> domDoc;
GetDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(domDoc);
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(mDocument);
if (xulDoc) {
// Retrieve the command dispatcher and call updateCommands on it.
nsCOMPtr<nsIDOMXULCommandDispatcher> xulCommandDispatcher;
@ -2380,8 +2379,21 @@ NS_IMETHODIMP GlobalWindowImpl::Deactivate()
// GlobalWindowImpl::nsIDOMAbstractView
//*****************************************************************************
//NS_IMETHODIMP GlobalWindowImpl::GetDocument(nsIDOMDocument** aDocument)
// implemented by nsIDOMWindow
NS_IMETHODIMP GlobalWindowImpl::GetDocument(nsIDOMDocumentView** aDocumentView)
{
NS_ENSURE_ARG_POINTER(aDocumentView);
nsresult rv = NS_OK;
if (mDocument) {
rv = mDocument->QueryInterface(NS_GET_IID(nsIDOMDocumentView),
(void **)aDocumentView);
} else {
*aDocumentView = nsnull;
}
return rv;
}
//*****************************************************************************
// GlobalWindowImpl: Window Control Functions

View File

@ -148,7 +148,7 @@ public:
NS_IMETHOD Deactivate();
// nsIDOMAbstractView
//NS_IMETHOD GetDocument(nsIDOMDocument** aDocument);
NS_IMETHOD GetDocument(nsIDOMDocumentView** aDocumentView);
public:
// Object Management

View File

@ -35,6 +35,7 @@
#include "nsDOMPropEnums.h"
#include "nsString.h"
#include "nsIDOMNavigator.h"
#include "nsIDOMDocumentView.h"
#include "nsIDOMDocument.h"
#include "nsIDOMBarProp.h"
#include "nsIDOMAbstractView.h"
@ -53,6 +54,7 @@ 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(kINavigatorIID, NS_IDOMNAVIGATOR_IID);
static NS_DEFINE_IID(kIDocumentViewIID, NS_IDOMDOCUMENTVIEW_IID);
static NS_DEFINE_IID(kIDocumentIID, NS_IDOMDOCUMENT_IID);
static NS_DEFINE_IID(kIBarPropIID, NS_IDOMBARPROP_IID);
static NS_DEFINE_IID(kIAbstractViewIID, NS_IDOMABSTRACTVIEW_IID);
@ -103,7 +105,8 @@ enum Window_slots {
WINDOW_PAGEXOFFSET = -31,
WINDOW_PAGEYOFFSET = -32,
WINDOW_SCROLLX = -33,
WINDOW_SCROLLY = -34
WINDOW_SCROLLY = -34,
ABSTRACTVIEW_DOCUMENT = -35
};
/***********************************************************************/
@ -515,6 +518,26 @@ GetWindowProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case ABSTRACTVIEW_DOCUMENT:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ABSTRACTVIEW_DOCUMENT, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDOMDocumentView* prop;
nsIDOMAbstractView* b;
if (NS_OK == a->QueryInterface(kIAbstractViewIID, (void **)&b)) {
rv = b->GetDocument(&prop);
if(NS_SUCCEEDED(rv)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
}
NS_RELEASE(b);
}
else {
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
}
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
@ -2570,6 +2593,7 @@ static JSPropertySpec WindowProperties[] =
{"pageYOffset", WINDOW_PAGEYOFFSET, JSPROP_ENUMERATE},
{"scrollX", WINDOW_SCROLLX, JSPROP_ENUMERATE | JSPROP_READONLY},
{"scrollY", WINDOW_SCROLLY, JSPROP_ENUMERATE | JSPROP_READONLY},
{"document", ABSTRACTVIEW_DOCUMENT, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};

View File

@ -124,11 +124,11 @@
#include "nsIDOMNSHTMLFormElement.h"
#include "nsIDOMNavigator.h"
#include "nsIDOMLocation.h"
#include "nsIDOMStyleSheetCollection.h"
#include "nsIDOMStyleSheetList.h"
#include "nsIDOMCSS2Properties.h"
#include "nsIDOMCSSStyleSheet.h"
#include "nsIDOMCSSStyleRule.h"
#include "nsIDOMCSSStyleRuleCollection.h"
#include "nsIDOMCSSRuleList.h"
#include "nsIDOMRange.h"
#include "nsIDOMSelection.h"
#include "nsIDOMSelectionListener.h"
@ -722,9 +722,9 @@ void XXXDomNeverCalled()
NS_NewJSEventListener(0, 0, 0);
NS_NewScriptCSS2Properties(0, 0, 0, 0);
NS_NewScriptCSSStyleSheet(0, 0, 0, 0);
NS_NewScriptStyleSheetCollection(0, 0, 0, 0);
NS_NewScriptStyleSheetList(0, 0, 0, 0);
NS_NewScriptCSSStyleRule(0, 0, 0, 0);
NS_NewScriptCSSStyleRuleCollection(0, 0, 0, 0);
NS_NewScriptCSSRuleList(0, 0, 0, 0);
NS_NewScriptRange(0, 0, 0, 0);
NS_NewScriptSelection(0, 0, 0, 0);
NS_NewScriptSelectionListener(0, 0, 0, 0);

View File

@ -39,18 +39,21 @@ CPPSRCS = \
nsJSCharacterData.cpp \
nsJSDocument.cpp \
nsJSDocumentFragment.cpp \
nsJSDocumentStyle.cpp \
nsJSDocumentType.cpp \
nsJSDocumentView.cpp \
nsJSElement.cpp \
nsJSEntity.cpp \
nsJSEntityReference.cpp \
nsJSMediaList.cpp \
nsJSNamedNodeMap.cpp \
nsJSNode.cpp \
nsJSNodeList.cpp \
nsJSNotation.cpp \
nsJSProcessingInstruction.cpp \
nsJSText.cpp \
nsJSStyleSheet.cpp \
nsJSStyleSheetCollection.cpp \
nsJSStyleSheetList.cpp \
nsJSText.cpp \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.

View File

@ -35,18 +35,21 @@ CPPSRCS = \
nsJSCharacterData.cpp \
nsJSDocument.cpp \
nsJSDocumentFragment.cpp \
nsJSDocumentStyle.cpp \
nsJSDocumentType.cpp \
nsJSDocumentView.cpp \
nsJSElement.cpp \
nsJSEntity.cpp \
nsJSEntityReference.cpp \
nsJSMediaList.cpp \
nsJSNamedNodeMap.cpp \
nsJSNode.cpp \
nsJSNodeList.cpp \
nsJSNotation.cpp \
nsJSProcessingInstruction.cpp \
nsJSText.cpp \
nsJSStyleSheet.cpp \
nsJSStyleSheetCollection.cpp \
nsJSStyleSheetList.cpp \
nsJSText.cpp \
$(NULL)
CPP_OBJS= \
@ -57,18 +60,21 @@ CPP_OBJS= \
.\$(OBJDIR)\nsJSCharacterData.obj \
.\$(OBJDIR)\nsJSDocument.obj \
.\$(OBJDIR)\nsJSDocumentFragment.obj \
.\$(OBJDIR)\nsJSDocumentStyle.obj \
.\$(OBJDIR)\nsJSDocumentType.obj \
.\$(OBJDIR)\nsJSDocumentView.obj \
.\$(OBJDIR)\nsJSElement.obj \
.\$(OBJDIR)\nsJSEntity.obj \
.\$(OBJDIR)\nsJSEntityReference.obj \
.\$(OBJDIR)\nsJSMediaList.obj \
.\$(OBJDIR)\nsJSNamedNodeMap.obj \
.\$(OBJDIR)\nsJSNode.obj \
.\$(OBJDIR)\nsJSNodeList.obj \
.\$(OBJDIR)\nsJSNotation.obj \
.\$(OBJDIR)\nsJSProcessingInstruction.obj \
.\$(OBJDIR)\nsJSText.obj \
.\$(OBJDIR)\nsJSStyleSheet.obj \
.\$(OBJDIR)\nsJSStyleSheetCollection.obj \
.\$(OBJDIR)\nsJSStyleSheetList.obj \
.\$(OBJDIR)\nsJSText.obj \
$(NULL)

View File

@ -35,17 +35,20 @@
#include "nsDOMPropEnums.h"
#include "nsString.h"
#include "nsIDOMElement.h"
#include "nsIDOMDocumentView.h"
#include "nsIDOMAttr.h"
#include "nsIDOMDocument.h"
#include "nsIDOMProcessingInstruction.h"
#include "nsIDOMAbstractView.h"
#include "nsIDOMNode.h"
#include "nsIDOMCDATASection.h"
#include "nsIDOMStyleSheetCollection.h"
#include "nsIDOMText.h"
#include "nsIDOMDOMImplementation.h"
#include "nsIDOMDocumentType.h"
#include "nsIDOMStyleSheetList.h"
#include "nsIDOMEntityReference.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMDocumentStyle.h"
#include "nsIDOMComment.h"
#include "nsIDOMDocumentFragment.h"
#include "nsIDOMRange.h"
@ -56,17 +59,20 @@ 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(kIElementIID, NS_IDOMELEMENT_IID);
static NS_DEFINE_IID(kIDocumentViewIID, NS_IDOMDOCUMENTVIEW_IID);
static NS_DEFINE_IID(kIAttrIID, NS_IDOMATTR_IID);
static NS_DEFINE_IID(kIDocumentIID, NS_IDOMDOCUMENT_IID);
static NS_DEFINE_IID(kIProcessingInstructionIID, NS_IDOMPROCESSINGINSTRUCTION_IID);
static NS_DEFINE_IID(kIAbstractViewIID, NS_IDOMABSTRACTVIEW_IID);
static NS_DEFINE_IID(kINodeIID, NS_IDOMNODE_IID);
static NS_DEFINE_IID(kICDATASectionIID, NS_IDOMCDATASECTION_IID);
static NS_DEFINE_IID(kIStyleSheetCollectionIID, NS_IDOMSTYLESHEETCOLLECTION_IID);
static NS_DEFINE_IID(kITextIID, NS_IDOMTEXT_IID);
static NS_DEFINE_IID(kIDOMImplementationIID, NS_IDOMDOMIMPLEMENTATION_IID);
static NS_DEFINE_IID(kIDocumentTypeIID, NS_IDOMDOCUMENTTYPE_IID);
static NS_DEFINE_IID(kIStyleSheetListIID, NS_IDOMSTYLESHEETLIST_IID);
static NS_DEFINE_IID(kIEntityReferenceIID, NS_IDOMENTITYREFERENCE_IID);
static NS_DEFINE_IID(kINSDocumentIID, NS_IDOMNSDOCUMENT_IID);
static NS_DEFINE_IID(kIDocumentStyleIID, NS_IDOMDOCUMENTSTYLE_IID);
static NS_DEFINE_IID(kICommentIID, NS_IDOMCOMMENT_IID);
static NS_DEFINE_IID(kIDocumentFragmentIID, NS_IDOMDOCUMENTFRAGMENT_IID);
static NS_DEFINE_IID(kIRangeIID, NS_IDOMRANGE_IID);
@ -79,10 +85,11 @@ enum Document_slots {
DOCUMENT_DOCTYPE = -1,
DOCUMENT_IMPLEMENTATION = -2,
DOCUMENT_DOCUMENTELEMENT = -3,
NSDOCUMENT_WIDTH = -4,
NSDOCUMENT_HEIGHT = -5,
NSDOCUMENT_STYLESHEETS = -6,
NSDOCUMENT_CHARACTERSET = -7
DOCUMENTSTYLE_STYLESHEETS = -4,
DOCUMENTVIEW_DEFAULTVIEW = -5,
NSDOCUMENT_WIDTH = -6,
NSDOCUMENT_HEIGHT = -7,
NSDOCUMENT_CHARACTERSET = -8
};
/***********************************************************************/
@ -144,6 +151,46 @@ GetDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case DOCUMENTSTYLE_STYLESHEETS:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENTSTYLE_STYLESHEETS, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDOMStyleSheetList* prop;
nsIDOMDocumentStyle* b;
if (NS_OK == a->QueryInterface(kIDocumentStyleIID, (void **)&b)) {
rv = b->GetStyleSheets(&prop);
if(NS_SUCCEEDED(rv)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
}
NS_RELEASE(b);
}
else {
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
}
}
break;
}
case DOCUMENTVIEW_DEFAULTVIEW:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENTVIEW_DEFAULTVIEW, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDOMAbstractView* prop;
nsIDOMDocumentView* b;
if (NS_OK == a->QueryInterface(kIDocumentViewIID, (void **)&b)) {
rv = b->GetDefaultView(&prop);
if(NS_SUCCEEDED(rv)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
}
NS_RELEASE(b);
}
else {
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
}
}
break;
}
case NSDOCUMENT_WIDTH:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSDOCUMENT_WIDTH, PR_FALSE);
@ -182,26 +229,6 @@ GetDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case NSDOCUMENT_STYLESHEETS:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSDOCUMENT_STYLESHEETS, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDOMStyleSheetCollection* prop;
nsIDOMNSDocument* b;
if (NS_OK == a->QueryInterface(kINSDocumentIID, (void **)&b)) {
rv = b->GetStyleSheets(&prop);
if(NS_SUCCEEDED(rv)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
}
NS_RELEASE(b);
}
else {
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
}
}
break;
}
case NSDOCUMENT_CHARACTERSET:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSDOCUMENT_CHARACTERSET, PR_FALSE);
@ -1017,9 +1044,10 @@ static JSPropertySpec DocumentProperties[] =
{"doctype", DOCUMENT_DOCTYPE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"implementation", DOCUMENT_IMPLEMENTATION, JSPROP_ENUMERATE | JSPROP_READONLY},
{"documentElement", DOCUMENT_DOCUMENTELEMENT, JSPROP_ENUMERATE | JSPROP_READONLY},
{"styleSheets", DOCUMENTSTYLE_STYLESHEETS, JSPROP_ENUMERATE | JSPROP_READONLY},
{"defaultView", DOCUMENTVIEW_DEFAULTVIEW, JSPROP_ENUMERATE | JSPROP_READONLY},
{"width", NSDOCUMENT_WIDTH, JSPROP_ENUMERATE | JSPROP_READONLY},
{"height", NSDOCUMENT_HEIGHT, JSPROP_ENUMERATE | JSPROP_READONLY},
{"styleSheets", NSDOCUMENT_STYLESHEETS, JSPROP_ENUMERATE | JSPROP_READONLY},
{"characterSet", NSDOCUMENT_CHARACTERSET, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};

View File

@ -34,13 +34,17 @@
#include "nsCOMPtr.h"
#include "nsDOMPropEnums.h"
#include "nsString.h"
#include "nsIDOMNode.h"
#include "nsIDOMStyleSheet.h"
#include "nsIDOMMediaList.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(kINodeIID, NS_IDOMNODE_IID);
static NS_DEFINE_IID(kIStyleSheetIID, NS_IDOMSTYLESHEET_IID);
static NS_DEFINE_IID(kIMediaListIID, NS_IDOMMEDIALIST_IID);
//
// StyleSheet property ids
@ -48,7 +52,11 @@ static NS_DEFINE_IID(kIStyleSheetIID, NS_IDOMSTYLESHEET_IID);
enum StyleSheet_slots {
STYLESHEET_TYPE = -1,
STYLESHEET_DISABLED = -2,
STYLESHEET_READONLY = -3
STYLESHEET_OWNERNODE = -3,
STYLESHEET_PARENTSTYLESHEET = -4,
STYLESHEET_HREF = -5,
STYLESHEET_TITLE = -6,
STYLESHEET_MEDIA = -7
};
/***********************************************************************/
@ -95,14 +103,65 @@ GetStyleSheetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case STYLESHEET_READONLY:
case STYLESHEET_OWNERNODE:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_STYLESHEET_READONLY, PR_FALSE);
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_STYLESHEET_OWNERNODE, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
PRBool prop;
rv = a->GetReadOnly(&prop);
nsIDOMNode* prop;
rv = a->GetOwnerNode(&prop);
if (NS_SUCCEEDED(rv)) {
*vp = BOOLEAN_TO_JSVAL(prop);
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
}
}
break;
}
case STYLESHEET_PARENTSTYLESHEET:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_STYLESHEET_PARENTSTYLESHEET, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDOMStyleSheet* prop;
rv = a->GetParentStyleSheet(&prop);
if (NS_SUCCEEDED(rv)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
}
}
break;
}
case STYLESHEET_HREF:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_STYLESHEET_HREF, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetHref(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case STYLESHEET_TITLE:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_STYLESHEET_TITLE, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetTitle(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case STYLESHEET_MEDIA:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_STYLESHEET_MEDIA, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDOMMediaList* prop;
rv = a->GetMedia(&prop);
if (NS_SUCCEEDED(rv)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
}
}
break;
@ -225,7 +284,11 @@ static JSPropertySpec StyleSheetProperties[] =
{
{"type", STYLESHEET_TYPE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"disabled", STYLESHEET_DISABLED, JSPROP_ENUMERATE},
{"readOnly", STYLESHEET_READONLY, JSPROP_ENUMERATE | JSPROP_READONLY},
{"ownerNode", STYLESHEET_OWNERNODE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"parentStyleSheet", STYLESHEET_PARENTSTYLESHEET, JSPROP_ENUMERATE | JSPROP_READONLY},
{"href", STYLESHEET_HREF, JSPROP_ENUMERATE | JSPROP_READONLY},
{"title", STYLESHEET_TITLE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"media", STYLESHEET_MEDIA, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};

View File

@ -38,9 +38,9 @@ CPPSRCS = \
nsJSCSSMediaRule.cpp \
nsJSCSSPageRule.cpp \
nsJSCSSRule.cpp \
nsJSCSSRuleList.cpp \
nsJSCSSStyleDeclaration.cpp \
nsJSCSSStyleRule.cpp \
nsJSCSSStyleRuleCollection.cpp \
nsJSCSSStyleSheet.cpp \
nsJSCSSUnknownRule.cpp \
nsJSCSSValue.cpp \

View File

@ -16,9 +16,9 @@ CPPSRCS = \
nsJSCSSMediaRule.cpp \
nsJSCSSPageRule.cpp \
nsJSCSSRule.cpp \
nsJSCSSRuleList.cpp \
nsJSCSSStyleDeclaration.cpp \
nsJSCSSStyleRule.cpp \
nsJSCSSStyleRuleCollection.cpp \
nsJSCSSStyleSheet.cpp \
nsJSCSSUnknownRule.cpp \
nsJSCSSValue.cpp \
@ -31,9 +31,9 @@ CPP_OBJS= \
.\$(OBJDIR)\nsJSCSSMediaRule.obj \
.\$(OBJDIR)\nsJSCSSPageRule.obj \
.\$(OBJDIR)\nsJSCSSRule.obj \
.\$(OBJDIR)\nsJSCSSRuleList.obj \
.\$(OBJDIR)\nsJSCSSStyleDeclaration.obj \
.\$(OBJDIR)\nsJSCSSStyleRule.obj \
.\$(OBJDIR)\nsJSCSSStyleRuleCollection.obj \
.\$(OBJDIR)\nsJSCSSStyleSheet.obj \
.\$(OBJDIR)\nsJSCSSUnknownRule.obj \
.\$(OBJDIR)\nsJSCSSValue.obj \

View File

@ -53,122 +53,122 @@ enum CSS2Properties_slots {
CSS2PROPERTIES_BACKGROUNDIMAGE = -5,
CSS2PROPERTIES_BACKGROUNDPOSITION = -6,
CSS2PROPERTIES_BACKGROUNDREPEAT = -7,
CSS2PROPERTIES_BEHAVIOR = -8,
CSS2PROPERTIES_BORDER = -9,
CSS2PROPERTIES_BORDERCOLLAPSE = -10,
CSS2PROPERTIES_BORDERCOLOR = -11,
CSS2PROPERTIES_BORDERSPACING = -12,
CSS2PROPERTIES_BORDERSTYLE = -13,
CSS2PROPERTIES_BORDERTOP = -14,
CSS2PROPERTIES_BORDERRIGHT = -15,
CSS2PROPERTIES_BORDERBOTTOM = -16,
CSS2PROPERTIES_BORDERLEFT = -17,
CSS2PROPERTIES_BORDERTOPCOLOR = -18,
CSS2PROPERTIES_BORDERRIGHTCOLOR = -19,
CSS2PROPERTIES_BORDERBOTTOMCOLOR = -20,
CSS2PROPERTIES_BORDERLEFTCOLOR = -21,
CSS2PROPERTIES_BORDERTOPSTYLE = -22,
CSS2PROPERTIES_BORDERRIGHTSTYLE = -23,
CSS2PROPERTIES_BORDERBOTTOMSTYLE = -24,
CSS2PROPERTIES_BORDERLEFTSTYLE = -25,
CSS2PROPERTIES_BORDERTOPWIDTH = -26,
CSS2PROPERTIES_BORDERRIGHTWIDTH = -27,
CSS2PROPERTIES_BORDERBOTTOMWIDTH = -28,
CSS2PROPERTIES_BORDERLEFTWIDTH = -29,
CSS2PROPERTIES_BORDERWIDTH = -30,
CSS2PROPERTIES_BOTTOM = -31,
CSS2PROPERTIES_CAPTIONSIDE = -32,
CSS2PROPERTIES_CLEAR = -33,
CSS2PROPERTIES_CLIP = -34,
CSS2PROPERTIES_COLOR = -35,
CSS2PROPERTIES_CONTENT = -36,
CSS2PROPERTIES_COUNTERINCREMENT = -37,
CSS2PROPERTIES_COUNTERRESET = -38,
CSS2PROPERTIES_CUE = -39,
CSS2PROPERTIES_CUEAFTER = -40,
CSS2PROPERTIES_CUEBEFORE = -41,
CSS2PROPERTIES_CURSOR = -42,
CSS2PROPERTIES_DIRECTION = -43,
CSS2PROPERTIES_DISPLAY = -44,
CSS2PROPERTIES_ELEVATION = -45,
CSS2PROPERTIES_EMPTYCELLS = -46,
CSS2PROPERTIES_CSSFLOAT = -47,
CSS2PROPERTIES_FONT = -48,
CSS2PROPERTIES_FONTFAMILY = -49,
CSS2PROPERTIES_FONTSIZE = -50,
CSS2PROPERTIES_FONTSIZEADJUST = -51,
CSS2PROPERTIES_FONTSTRETCH = -52,
CSS2PROPERTIES_FONTSTYLE = -53,
CSS2PROPERTIES_FONTVARIANT = -54,
CSS2PROPERTIES_FONTWEIGHT = -55,
CSS2PROPERTIES_HEIGHT = -56,
CSS2PROPERTIES_LEFT = -57,
CSS2PROPERTIES_LETTERSPACING = -58,
CSS2PROPERTIES_LINEHEIGHT = -59,
CSS2PROPERTIES_LISTSTYLE = -60,
CSS2PROPERTIES_LISTSTYLEIMAGE = -61,
CSS2PROPERTIES_LISTSTYLEPOSITION = -62,
CSS2PROPERTIES_LISTSTYLETYPE = -63,
CSS2PROPERTIES_MARGIN = -64,
CSS2PROPERTIES_MARGINTOP = -65,
CSS2PROPERTIES_MARGINRIGHT = -66,
CSS2PROPERTIES_MARGINBOTTOM = -67,
CSS2PROPERTIES_MARGINLEFT = -68,
CSS2PROPERTIES_MARKEROFFSET = -69,
CSS2PROPERTIES_MARKS = -70,
CSS2PROPERTIES_MAXHEIGHT = -71,
CSS2PROPERTIES_MAXWIDTH = -72,
CSS2PROPERTIES_MINHEIGHT = -73,
CSS2PROPERTIES_MINWIDTH = -74,
CSS2PROPERTIES_ORPHANS = -75,
CSS2PROPERTIES_OUTLINE = -76,
CSS2PROPERTIES_OUTLINECOLOR = -77,
CSS2PROPERTIES_OUTLINESTYLE = -78,
CSS2PROPERTIES_OUTLINEWIDTH = -79,
CSS2PROPERTIES_OVERFLOW = -80,
CSS2PROPERTIES_PADDING = -81,
CSS2PROPERTIES_PADDINGTOP = -82,
CSS2PROPERTIES_PADDINGRIGHT = -83,
CSS2PROPERTIES_PADDINGBOTTOM = -84,
CSS2PROPERTIES_PADDINGLEFT = -85,
CSS2PROPERTIES_PAGE = -86,
CSS2PROPERTIES_PAGEBREAKAFTER = -87,
CSS2PROPERTIES_PAGEBREAKBEFORE = -88,
CSS2PROPERTIES_PAGEBREAKINSIDE = -89,
CSS2PROPERTIES_PAUSE = -90,
CSS2PROPERTIES_PAUSEAFTER = -91,
CSS2PROPERTIES_PAUSEBEFORE = -92,
CSS2PROPERTIES_PITCH = -93,
CSS2PROPERTIES_PITCHRANGE = -94,
CSS2PROPERTIES_PLAYDURING = -95,
CSS2PROPERTIES_POSITION = -96,
CSS2PROPERTIES_QUOTES = -97,
CSS2PROPERTIES_RICHNESS = -98,
CSS2PROPERTIES_RIGHT = -99,
CSS2PROPERTIES_SIZE = -100,
CSS2PROPERTIES_SPEAK = -101,
CSS2PROPERTIES_SPEAKHEADER = -102,
CSS2PROPERTIES_SPEAKNUMERAL = -103,
CSS2PROPERTIES_SPEAKPUNCTUATION = -104,
CSS2PROPERTIES_SPEECHRATE = -105,
CSS2PROPERTIES_STRESS = -106,
CSS2PROPERTIES_TABLELAYOUT = -107,
CSS2PROPERTIES_TEXTALIGN = -108,
CSS2PROPERTIES_TEXTDECORATION = -109,
CSS2PROPERTIES_TEXTINDENT = -110,
CSS2PROPERTIES_TEXTSHADOW = -111,
CSS2PROPERTIES_TEXTTRANSFORM = -112,
CSS2PROPERTIES_TOP = -113,
CSS2PROPERTIES_UNICODEBIDI = -114,
CSS2PROPERTIES_VERTICALALIGN = -115,
CSS2PROPERTIES_VISIBILITY = -116,
CSS2PROPERTIES_VOICEFAMILY = -117,
CSS2PROPERTIES_VOLUME = -118,
CSS2PROPERTIES_WHITESPACE = -119,
CSS2PROPERTIES_WIDOWS = -120,
CSS2PROPERTIES_WIDTH = -121,
CSS2PROPERTIES_WORDSPACING = -122,
CSS2PROPERTIES_ZINDEX = -123,
CSS2PROPERTIES_BORDER = -8,
CSS2PROPERTIES_BORDERCOLLAPSE = -9,
CSS2PROPERTIES_BORDERCOLOR = -10,
CSS2PROPERTIES_BORDERSPACING = -11,
CSS2PROPERTIES_BORDERSTYLE = -12,
CSS2PROPERTIES_BORDERTOP = -13,
CSS2PROPERTIES_BORDERRIGHT = -14,
CSS2PROPERTIES_BORDERBOTTOM = -15,
CSS2PROPERTIES_BORDERLEFT = -16,
CSS2PROPERTIES_BORDERTOPCOLOR = -17,
CSS2PROPERTIES_BORDERRIGHTCOLOR = -18,
CSS2PROPERTIES_BORDERBOTTOMCOLOR = -19,
CSS2PROPERTIES_BORDERLEFTCOLOR = -20,
CSS2PROPERTIES_BORDERTOPSTYLE = -21,
CSS2PROPERTIES_BORDERRIGHTSTYLE = -22,
CSS2PROPERTIES_BORDERBOTTOMSTYLE = -23,
CSS2PROPERTIES_BORDERLEFTSTYLE = -24,
CSS2PROPERTIES_BORDERTOPWIDTH = -25,
CSS2PROPERTIES_BORDERRIGHTWIDTH = -26,
CSS2PROPERTIES_BORDERBOTTOMWIDTH = -27,
CSS2PROPERTIES_BORDERLEFTWIDTH = -28,
CSS2PROPERTIES_BORDERWIDTH = -29,
CSS2PROPERTIES_BOTTOM = -30,
CSS2PROPERTIES_CAPTIONSIDE = -31,
CSS2PROPERTIES_CLEAR = -32,
CSS2PROPERTIES_CLIP = -33,
CSS2PROPERTIES_COLOR = -34,
CSS2PROPERTIES_CONTENT = -35,
CSS2PROPERTIES_COUNTERINCREMENT = -36,
CSS2PROPERTIES_COUNTERRESET = -37,
CSS2PROPERTIES_CUE = -38,
CSS2PROPERTIES_CUEAFTER = -39,
CSS2PROPERTIES_CUEBEFORE = -40,
CSS2PROPERTIES_CURSOR = -41,
CSS2PROPERTIES_DIRECTION = -42,
CSS2PROPERTIES_DISPLAY = -43,
CSS2PROPERTIES_ELEVATION = -44,
CSS2PROPERTIES_EMPTYCELLS = -45,
CSS2PROPERTIES_CSSFLOAT = -46,
CSS2PROPERTIES_FONT = -47,
CSS2PROPERTIES_FONTFAMILY = -48,
CSS2PROPERTIES_FONTSIZE = -49,
CSS2PROPERTIES_FONTSIZEADJUST = -50,
CSS2PROPERTIES_FONTSTRETCH = -51,
CSS2PROPERTIES_FONTSTYLE = -52,
CSS2PROPERTIES_FONTVARIANT = -53,
CSS2PROPERTIES_FONTWEIGHT = -54,
CSS2PROPERTIES_HEIGHT = -55,
CSS2PROPERTIES_LEFT = -56,
CSS2PROPERTIES_LETTERSPACING = -57,
CSS2PROPERTIES_LINEHEIGHT = -58,
CSS2PROPERTIES_LISTSTYLE = -59,
CSS2PROPERTIES_LISTSTYLEIMAGE = -60,
CSS2PROPERTIES_LISTSTYLEPOSITION = -61,
CSS2PROPERTIES_LISTSTYLETYPE = -62,
CSS2PROPERTIES_MARGIN = -63,
CSS2PROPERTIES_MARGINTOP = -64,
CSS2PROPERTIES_MARGINRIGHT = -65,
CSS2PROPERTIES_MARGINBOTTOM = -66,
CSS2PROPERTIES_MARGINLEFT = -67,
CSS2PROPERTIES_MARKEROFFSET = -68,
CSS2PROPERTIES_MARKS = -69,
CSS2PROPERTIES_MAXHEIGHT = -70,
CSS2PROPERTIES_MAXWIDTH = -71,
CSS2PROPERTIES_MINHEIGHT = -72,
CSS2PROPERTIES_MINWIDTH = -73,
CSS2PROPERTIES_ORPHANS = -74,
CSS2PROPERTIES_OUTLINE = -75,
CSS2PROPERTIES_OUTLINECOLOR = -76,
CSS2PROPERTIES_OUTLINESTYLE = -77,
CSS2PROPERTIES_OUTLINEWIDTH = -78,
CSS2PROPERTIES_OVERFLOW = -79,
CSS2PROPERTIES_PADDING = -80,
CSS2PROPERTIES_PADDINGTOP = -81,
CSS2PROPERTIES_PADDINGRIGHT = -82,
CSS2PROPERTIES_PADDINGBOTTOM = -83,
CSS2PROPERTIES_PADDINGLEFT = -84,
CSS2PROPERTIES_PAGE = -85,
CSS2PROPERTIES_PAGEBREAKAFTER = -86,
CSS2PROPERTIES_PAGEBREAKBEFORE = -87,
CSS2PROPERTIES_PAGEBREAKINSIDE = -88,
CSS2PROPERTIES_PAUSE = -89,
CSS2PROPERTIES_PAUSEAFTER = -90,
CSS2PROPERTIES_PAUSEBEFORE = -91,
CSS2PROPERTIES_PITCH = -92,
CSS2PROPERTIES_PITCHRANGE = -93,
CSS2PROPERTIES_PLAYDURING = -94,
CSS2PROPERTIES_POSITION = -95,
CSS2PROPERTIES_QUOTES = -96,
CSS2PROPERTIES_RICHNESS = -97,
CSS2PROPERTIES_RIGHT = -98,
CSS2PROPERTIES_SIZE = -99,
CSS2PROPERTIES_SPEAK = -100,
CSS2PROPERTIES_SPEAKHEADER = -101,
CSS2PROPERTIES_SPEAKNUMERAL = -102,
CSS2PROPERTIES_SPEAKPUNCTUATION = -103,
CSS2PROPERTIES_SPEECHRATE = -104,
CSS2PROPERTIES_STRESS = -105,
CSS2PROPERTIES_TABLELAYOUT = -106,
CSS2PROPERTIES_TEXTALIGN = -107,
CSS2PROPERTIES_TEXTDECORATION = -108,
CSS2PROPERTIES_TEXTINDENT = -109,
CSS2PROPERTIES_TEXTSHADOW = -110,
CSS2PROPERTIES_TEXTTRANSFORM = -111,
CSS2PROPERTIES_TOP = -112,
CSS2PROPERTIES_UNICODEBIDI = -113,
CSS2PROPERTIES_VERTICALALIGN = -114,
CSS2PROPERTIES_VISIBILITY = -115,
CSS2PROPERTIES_VOICEFAMILY = -116,
CSS2PROPERTIES_VOLUME = -117,
CSS2PROPERTIES_WHITESPACE = -118,
CSS2PROPERTIES_WIDOWS = -119,
CSS2PROPERTIES_WIDTH = -120,
CSS2PROPERTIES_WORDSPACING = -121,
CSS2PROPERTIES_ZINDEX = -122,
CSS2PROPERTIES_BEHAVIOR = -123,
CSS2PROPERTIES_OPACITY = -124
};
@ -276,18 +276,6 @@ GetCSS2PropertiesProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case CSS2PROPERTIES_BEHAVIOR:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSS2PROPERTIES_BEHAVIOR, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetBehavior(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case CSS2PROPERTIES_BORDER:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSS2PROPERTIES_BORDER, PR_FALSE);
@ -1668,6 +1656,18 @@ GetCSS2PropertiesProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case CSS2PROPERTIES_BEHAVIOR:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSS2PROPERTIES_BEHAVIOR, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetBehavior(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case CSS2PROPERTIES_OPACITY:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSS2PROPERTIES_OPACITY, PR_FALSE);
@ -1797,18 +1797,6 @@ SetCSS2PropertiesProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case CSS2PROPERTIES_BEHAVIOR:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSS2PROPERTIES_BEHAVIOR, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetBehavior(prop);
}
break;
}
case CSS2PROPERTIES_BORDER:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSS2PROPERTIES_BORDER, PR_TRUE);
@ -3189,6 +3177,18 @@ SetCSS2PropertiesProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case CSS2PROPERTIES_BEHAVIOR:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSS2PROPERTIES_BEHAVIOR, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetBehavior(prop);
}
break;
}
case CSS2PROPERTIES_OPACITY:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSS2PROPERTIES_OPACITY, PR_TRUE);
@ -3277,7 +3277,6 @@ static JSPropertySpec CSS2PropertiesProperties[] =
{"backgroundImage", CSS2PROPERTIES_BACKGROUNDIMAGE, JSPROP_ENUMERATE},
{"backgroundPosition", CSS2PROPERTIES_BACKGROUNDPOSITION, JSPROP_ENUMERATE},
{"backgroundRepeat", CSS2PROPERTIES_BACKGROUNDREPEAT, JSPROP_ENUMERATE},
{"behavior", CSS2PROPERTIES_BEHAVIOR, JSPROP_ENUMERATE},
{"border", CSS2PROPERTIES_BORDER, JSPROP_ENUMERATE},
{"borderCollapse", CSS2PROPERTIES_BORDERCOLLAPSE, JSPROP_ENUMERATE},
{"borderColor", CSS2PROPERTIES_BORDERCOLOR, JSPROP_ENUMERATE},
@ -3393,6 +3392,7 @@ static JSPropertySpec CSS2PropertiesProperties[] =
{"width", CSS2PROPERTIES_WIDTH, JSPROP_ENUMERATE},
{"wordSpacing", CSS2PROPERTIES_WORDSPACING, JSPROP_ENUMERATE},
{"zIndex", CSS2PROPERTIES_ZINDEX, JSPROP_ENUMERATE},
{"behavior", CSS2PROPERTIES_BEHAVIOR, JSPROP_ENUMERATE},
{"opacity", CSS2PROPERTIES_OPACITY, JSPROP_ENUMERATE},
{0}
};

View File

@ -117,22 +117,7 @@ SetCSSFontFaceRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case CSSFONTFACERULE_STYLE:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSFONTFACERULE_STYLE, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsIDOMCSSStyleDeclaration* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
kICSSStyleDeclarationIID, NS_ConvertASCIItoUCS2("CSSStyleDeclaration"),
cx, *vp)) {
rv = NS_ERROR_DOM_NOT_OBJECT_ERR;
}
rv = a->SetStyle(prop);
NS_IF_RELEASE(prop);
}
break;
}
case 0:
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
@ -202,7 +187,7 @@ JSClass CSSFontFaceRuleClass = {
//
static JSPropertySpec CSSFontFaceRuleProperties[] =
{
{"style", CSSFONTFACERULE_STYLE, JSPROP_ENUMERATE},
{"style", CSSFONTFACERULE_STYLE, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};

View File

@ -35,6 +35,7 @@
#include "nsDOMPropEnums.h"
#include "nsString.h"
#include "nsIDOMCSSImportRule.h"
#include "nsIDOMMediaList.h"
#include "nsIDOMCSSStyleSheet.h"
@ -42,6 +43,7 @@ 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(kICSSImportRuleIID, NS_IDOMCSSIMPORTRULE_IID);
static NS_DEFINE_IID(kIMediaListIID, NS_IDOMMEDIALIST_IID);
static NS_DEFINE_IID(kICSSStyleSheetIID, NS_IDOMCSSSTYLESHEET_IID);
//
@ -89,10 +91,11 @@ GetCSSImportRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSIMPORTRULE_MEDIA, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetMedia(prop);
nsIDOMMediaList* prop;
rv = a->GetMedia(&prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
}
}
break;
@ -143,30 +146,7 @@ SetCSSImportRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case CSSIMPORTRULE_HREF:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSIMPORTRULE_HREF, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetHref(prop);
}
break;
}
case CSSIMPORTRULE_MEDIA:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSIMPORTRULE_MEDIA, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetMedia(prop);
}
break;
}
case 0:
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
@ -236,8 +216,8 @@ JSClass CSSImportRuleClass = {
//
static JSPropertySpec CSSImportRuleProperties[] =
{
{"href", CSSIMPORTRULE_HREF, JSPROP_ENUMERATE},
{"media", CSSIMPORTRULE_MEDIA, JSPROP_ENUMERATE},
{"href", CSSIMPORTRULE_HREF, JSPROP_ENUMERATE | JSPROP_READONLY},
{"media", CSSIMPORTRULE_MEDIA, JSPROP_ENUMERATE | JSPROP_READONLY},
{"styleSheet", CSSIMPORTRULE_STYLESHEET, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};

View File

@ -34,21 +34,23 @@
#include "nsCOMPtr.h"
#include "nsDOMPropEnums.h"
#include "nsString.h"
#include "nsIDOMCSSStyleRuleCollection.h"
#include "nsIDOMMediaList.h"
#include "nsIDOMCSSRuleList.h"
#include "nsIDOMCSSMediaRule.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(kICSSStyleRuleCollectionIID, NS_IDOMCSSSTYLERULECOLLECTION_IID);
static NS_DEFINE_IID(kIMediaListIID, NS_IDOMMEDIALIST_IID);
static NS_DEFINE_IID(kICSSRuleListIID, NS_IDOMCSSRULELIST_IID);
static NS_DEFINE_IID(kICSSMediaRuleIID, NS_IDOMCSSMEDIARULE_IID);
//
// CSSMediaRule property ids
//
enum CSSMediaRule_slots {
CSSMEDIARULE_MEDIATYPES = -1,
CSSMEDIARULE_MEDIA = -1,
CSSMEDIARULE_CSSRULES = -2
};
@ -72,14 +74,15 @@ GetCSSMediaRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case CSSMEDIARULE_MEDIATYPES:
case CSSMEDIARULE_MEDIA:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSMEDIARULE_MEDIATYPES, PR_FALSE);
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSMEDIARULE_MEDIA, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetMediaTypes(prop);
nsIDOMMediaList* prop;
rv = a->GetMedia(&prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
}
}
break;
@ -88,7 +91,7 @@ GetCSSMediaRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSMEDIARULE_CSSRULES, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDOMCSSStyleRuleCollection* prop;
nsIDOMCSSRuleList* prop;
rv = a->GetCssRules(&prop);
if (NS_SUCCEEDED(rv)) {
// get the js object
@ -130,18 +133,7 @@ SetCSSMediaRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case CSSMEDIARULE_MEDIATYPES:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSMEDIARULE_MEDIATYPES, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetMediaTypes(prop);
}
break;
}
case 0:
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
@ -300,7 +292,7 @@ JSClass CSSMediaRuleClass = {
//
static JSPropertySpec CSSMediaRuleProperties[] =
{
{"mediaTypes", CSSMEDIARULE_MEDIATYPES, JSPROP_ENUMERATE},
{"media", CSSMEDIARULE_MEDIA, JSPROP_ENUMERATE | JSPROP_READONLY},
{"cssRules", CSSMEDIARULE_CSSRULES, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};

View File

@ -48,7 +48,7 @@ static NS_DEFINE_IID(kICSSStyleDeclarationIID, NS_IDOMCSSSTYLEDECLARATION_IID);
// CSSPageRule property ids
//
enum CSSPageRule_slots {
CSSPAGERULE_NAME = -1,
CSSPAGERULE_SELECTORTEXT = -1,
CSSPAGERULE_STYLE = -2
};
@ -72,12 +72,12 @@ GetCSSPageRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case CSSPAGERULE_NAME:
case CSSPAGERULE_SELECTORTEXT:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSPAGERULE_NAME, PR_FALSE);
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSPAGERULE_SELECTORTEXT, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetName(prop);
rv = a->GetSelectorText(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
@ -130,34 +130,18 @@ SetCSSPageRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case CSSPAGERULE_NAME:
case CSSPAGERULE_SELECTORTEXT:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSPAGERULE_NAME, PR_TRUE);
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSPAGERULE_SELECTORTEXT, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetName(prop);
rv = a->SetSelectorText(prop);
}
break;
}
case CSSPAGERULE_STYLE:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSPAGERULE_STYLE, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsIDOMCSSStyleDeclaration* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
kICSSStyleDeclarationIID, NS_ConvertASCIItoUCS2("CSSStyleDeclaration"),
cx, *vp)) {
rv = NS_ERROR_DOM_NOT_OBJECT_ERR;
}
rv = a->SetStyle(prop);
NS_IF_RELEASE(prop);
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
@ -227,8 +211,8 @@ JSClass CSSPageRuleClass = {
//
static JSPropertySpec CSSPageRuleProperties[] =
{
{"name", CSSPAGERULE_NAME, JSPROP_ENUMERATE},
{"style", CSSPAGERULE_STYLE, JSPROP_ENUMERATE},
{"selectorText", CSSPAGERULE_SELECTORTEXT, JSPROP_ENUMERATE},
{"style", CSSPAGERULE_STYLE, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};

View File

@ -50,7 +50,8 @@ static NS_DEFINE_IID(kICSSStyleSheetIID, NS_IDOMCSSSTYLESHEET_IID);
enum CSSRule_slots {
CSSRULE_TYPE = -1,
CSSRULE_CSSTEXT = -2,
CSSRULE_SHEET = -3
CSSRULE_PARENTSTYLESHEET = -3,
CSSRULE_PARENTRULE = -4
};
/***********************************************************************/
@ -97,12 +98,25 @@ GetCSSRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case CSSRULE_SHEET:
case CSSRULE_PARENTSTYLESHEET:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSRULE_SHEET, PR_FALSE);
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSRULE_PARENTSTYLESHEET, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDOMCSSStyleSheet* prop;
rv = a->GetSheet(&prop);
rv = a->GetParentStyleSheet(&prop);
if (NS_SUCCEEDED(rv)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
}
}
break;
}
case CSSRULE_PARENTRULE:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSRULE_PARENTRULE, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDOMCSSRule* prop;
rv = a->GetParentRule(&prop);
if (NS_SUCCEEDED(rv)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
@ -226,7 +240,8 @@ static JSPropertySpec CSSRuleProperties[] =
{
{"type", CSSRULE_TYPE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"cssText", CSSRULE_CSSTEXT, JSPROP_ENUMERATE},
{"sheet", CSSRULE_SHEET, JSPROP_ENUMERATE | JSPROP_READONLY},
{"parentStyleSheet", CSSRULE_PARENTSTYLESHEET, JSPROP_ENUMERATE | JSPROP_READONLY},
{"parentRule", CSSRULE_PARENTRULE, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};
@ -291,6 +306,9 @@ extern "C" NS_DOM nsresult NS_InitCSSRuleClass(nsIScriptContext *aContext, void
vp = INT_TO_JSVAL(nsIDOMCSSRule::STYLE_RULE);
JS_SetProperty(jscontext, constructor, "STYLE_RULE", &vp);
vp = INT_TO_JSVAL(nsIDOMCSSRule::CHARSET_RULE);
JS_SetProperty(jscontext, constructor, "CHARSET_RULE", &vp);
vp = INT_TO_JSVAL(nsIDOMCSSRule::IMPORT_RULE);
JS_SetProperty(jscontext, constructor, "IMPORT_RULE", &vp);

View File

@ -142,22 +142,6 @@ SetCSSStyleRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case CSSSTYLERULE_STYLE:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLERULE_STYLE, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsIDOMCSSStyleDeclaration* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
kICSSStyleDeclarationIID, NS_ConvertASCIItoUCS2("CSSStyleDeclaration"),
cx, *vp)) {
rv = NS_ERROR_DOM_NOT_OBJECT_ERR;
}
rv = a->SetStyle(prop);
NS_IF_RELEASE(prop);
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
@ -228,7 +212,7 @@ JSClass CSSStyleRuleClass = {
static JSPropertySpec CSSStyleRuleProperties[] =
{
{"selectorText", CSSSTYLERULE_SELECTORTEXT, JSPROP_ENUMERATE},
{"style", CSSSTYLERULE_STYLE, JSPROP_ENUMERATE},
{"style", CSSSTYLERULE_STYLE, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};

View File

@ -34,30 +34,24 @@
#include "nsCOMPtr.h"
#include "nsDOMPropEnums.h"
#include "nsString.h"
#include "nsIDOMNode.h"
#include "nsIDOMStyleSheet.h"
#include "nsIDOMCSSStyleRuleCollection.h"
#include "nsIDOMCSSRule.h"
#include "nsIDOMCSSRuleList.h"
#include "nsIDOMCSSStyleSheet.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(kINodeIID, NS_IDOMNODE_IID);
static NS_DEFINE_IID(kIStyleSheetIID, NS_IDOMSTYLESHEET_IID);
static NS_DEFINE_IID(kICSSStyleRuleCollectionIID, NS_IDOMCSSSTYLERULECOLLECTION_IID);
static NS_DEFINE_IID(kICSSRuleIID, NS_IDOMCSSRULE_IID);
static NS_DEFINE_IID(kICSSRuleListIID, NS_IDOMCSSRULELIST_IID);
static NS_DEFINE_IID(kICSSStyleSheetIID, NS_IDOMCSSSTYLESHEET_IID);
//
// CSSStyleSheet property ids
//
enum CSSStyleSheet_slots {
CSSSTYLESHEET_OWNINGNODE = -1,
CSSSTYLESHEET_PARENTSTYLESHEET = -2,
CSSSTYLESHEET_HREF = -3,
CSSSTYLESHEET_TITLE = -4,
CSSSTYLESHEET_MEDIA = -5,
CSSSTYLESHEET_CSSRULES = -6
CSSSTYLESHEET_OWNERRULE = -1,
CSSSTYLESHEET_CSSRULES = -2
};
/***********************************************************************/
@ -80,12 +74,12 @@ GetCSSStyleSheetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case CSSSTYLESHEET_OWNINGNODE:
case CSSSTYLESHEET_OWNERRULE:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_OWNINGNODE, PR_FALSE);
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_OWNERRULE, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDOMNode* prop;
rv = a->GetOwningNode(&prop);
nsIDOMCSSRule* prop;
rv = a->GetOwnerRule(&prop);
if (NS_SUCCEEDED(rv)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
@ -93,60 +87,11 @@ GetCSSStyleSheetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case CSSSTYLESHEET_PARENTSTYLESHEET:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_PARENTSTYLESHEET, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDOMStyleSheet* prop;
rv = a->GetParentStyleSheet(&prop);
if (NS_SUCCEEDED(rv)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
}
}
break;
}
case CSSSTYLESHEET_HREF:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_HREF, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetHref(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case CSSSTYLESHEET_TITLE:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_TITLE, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetTitle(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case CSSSTYLESHEET_MEDIA:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_MEDIA, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetMedia(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case CSSSTYLESHEET_CSSRULES:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_CSSRULES, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDOMCSSStyleRuleCollection* prop;
nsIDOMCSSRuleList* prop;
rv = a->GetCssRules(&prop);
if (NS_SUCCEEDED(rv)) {
// get the js object
@ -347,11 +292,7 @@ JSClass CSSStyleSheetClass = {
//
static JSPropertySpec CSSStyleSheetProperties[] =
{
{"owningNode", CSSSTYLESHEET_OWNINGNODE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"parentStyleSheet", CSSSTYLESHEET_PARENTSTYLESHEET, JSPROP_ENUMERATE | JSPROP_READONLY},
{"href", CSSSTYLESHEET_HREF, JSPROP_ENUMERATE | JSPROP_READONLY},
{"title", CSSSTYLESHEET_TITLE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"media", CSSSTYLESHEET_MEDIA, JSPROP_ENUMERATE | JSPROP_READONLY},
{"ownerRule", CSSSTYLESHEET_OWNERRULE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"cssRules", CSSSTYLESHEET_CSSRULES, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};

View File

@ -46,11 +46,13 @@
#include "nsContentList.h"
#include "nsIDOMEventListener.h"
#include "nsIDOMStyleSheet.h"
#include "nsIDOMStyleSheetCollection.h"
#include "nsIDOMStyleSheetList.h"
#include "nsDOMAttribute.h"
#include "nsDOMCID.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsIDOMDOMImplementation.h"
#include "nsIDOMDocumentView.h"
#include "nsIDOMAbstractView.h"
#include "nsGenericElement.h"
#include "nsICSSStyleSheet.h"
@ -104,7 +106,6 @@ static NS_DEFINE_IID(kIScriptEventListenerIID, NS_ISCRIPTEVENTLISTENER_IID);
static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID);
static NS_DEFINE_IID(kIEventListenerManagerIID, NS_IEVENTLISTENERMANAGER_IID);
static NS_DEFINE_IID(kIPostDataIID, NS_IPOSTDATA_IID);
static NS_DEFINE_IID(kIDOMStyleSheetCollectionIID, NS_IDOMSTYLESHEETCOLLECTION_IID);
static NS_DEFINE_IID(kIDOMStyleSheetIID, NS_IDOMSTYLESHEET_IID);
static NS_DEFINE_IID(kIDOMDOMImplementationIID, NS_IDOMDOMIMPLEMENTATION_IID);
static NS_DEFINE_IID(kIDocumentObserverIID, NS_IDOCUMENT_OBSERVER_IID);
@ -126,16 +127,16 @@ static NS_DEFINE_IID(kIWordBreakerFactoryIID, NS_IWORDBREAKERFACTORY_IID);
#include "nsIHTMLDocument.h"
static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID);
class nsDOMStyleSheetCollection : public nsIDOMStyleSheetCollection,
public nsIScriptObjectOwner,
public nsIDocumentObserver
class nsDOMStyleSheetList : public nsIDOMStyleSheetList,
public nsIScriptObjectOwner,
public nsIDocumentObserver
{
public:
nsDOMStyleSheetCollection(nsIDocument *aDocument);
virtual ~nsDOMStyleSheetCollection();
nsDOMStyleSheetList(nsIDocument *aDocument);
virtual ~nsDOMStyleSheetList();
NS_DECL_ISUPPORTS
NS_DECL_IDOMSTYLESHEETCOLLECTION
NS_DECL_IDOMSTYLESHEETLIST
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; }
NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; }
@ -202,7 +203,7 @@ protected:
void* mScriptObject;
};
nsDOMStyleSheetCollection::nsDOMStyleSheetCollection(nsIDocument *aDocument)
nsDOMStyleSheetList::nsDOMStyleSheetList(nsIDocument *aDocument)
{
NS_INIT_REFCNT();
mLength = -1;
@ -213,7 +214,7 @@ nsDOMStyleSheetCollection::nsDOMStyleSheetCollection(nsIDocument *aDocument)
mScriptObject = nsnull;
}
nsDOMStyleSheetCollection::~nsDOMStyleSheetCollection()
nsDOMStyleSheetList::~nsDOMStyleSheetList()
{
if (nsnull != mDocument) {
mDocument->RemoveObserver(this);
@ -221,46 +222,18 @@ nsDOMStyleSheetCollection::~nsDOMStyleSheetCollection()
mDocument = nsnull;
}
NS_IMPL_ADDREF(nsDOMStyleSheetCollection)
NS_IMPL_RELEASE(nsDOMStyleSheetCollection)
NS_IMPL_ADDREF(nsDOMStyleSheetList)
NS_IMPL_RELEASE(nsDOMStyleSheetList)
nsresult
nsDOMStyleSheetCollection::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
{
if (NULL == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(kIDOMStyleSheetCollectionIID)) {
nsIDOMStyleSheetCollection *tmp = this;
*aInstancePtrResult = (void*) tmp;
AddRef();
return NS_OK;
}
if (aIID.Equals(kIScriptObjectOwnerIID)) {
nsIScriptObjectOwner *tmp = this;
*aInstancePtrResult = (void*) tmp;
AddRef();
return NS_OK;
}
if (aIID.Equals(kIDocumentObserverIID)) {
nsIDocumentObserver *tmp = this;
*aInstancePtrResult = (void*) tmp;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
nsIDOMStyleSheetCollection *tmp = this;
nsISupports *tmp2 = tmp;
*aInstancePtrResult = (void*) tmp2;
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_INTERFACE_MAP_BEGIN(nsDOMStyleSheetList)
NS_INTERFACE_MAP_ENTRY(nsIDOMStyleSheetList)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
NS_INTERFACE_MAP_ENTRY(nsIDocumentObserver)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStyleSheetList)
NS_INTERFACE_MAP_END
NS_IMETHODIMP
nsDOMStyleSheetCollection::GetLength(PRUint32* aLength)
nsDOMStyleSheetList::GetLength(PRUint32* aLength)
{
if (nsnull != mDocument) {
// XXX Find the number and then cache it. We'll use the
@ -293,7 +266,7 @@ nsDOMStyleSheetCollection::GetLength(PRUint32* aLength)
}
NS_IMETHODIMP
nsDOMStyleSheetCollection::Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn)
nsDOMStyleSheetList::Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn)
{
*aReturn = nsnull;
if (nsnull != mDocument) {
@ -321,19 +294,19 @@ nsDOMStyleSheetCollection::Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn)
}
NS_IMETHODIMP
nsDOMStyleSheetCollection::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
nsDOMStyleSheetList::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
{
nsresult res = NS_OK;
if (nsnull == mScriptObject) {
nsISupports *supports = (nsISupports *)(nsIDOMStyleSheetCollection *)this;
nsISupports *supports = (nsISupports *)(nsIDOMStyleSheetList *)this;
nsISupports *parent = (nsISupports *)mDocument;
// XXX Should be done through factory
res = NS_NewScriptStyleSheetCollection(aContext,
supports,
parent,
(void**)&mScriptObject);
res = NS_NewScriptStyleSheetList(aContext,
supports,
parent,
(void**)&mScriptObject);
}
*aScriptObject = mScriptObject;
@ -341,15 +314,15 @@ nsDOMStyleSheetCollection::GetScriptObject(nsIScriptContext *aContext, void** aS
}
NS_IMETHODIMP
nsDOMStyleSheetCollection::SetScriptObject(void* aScriptObject)
nsDOMStyleSheetList::SetScriptObject(void* aScriptObject)
{
mScriptObject = aScriptObject;
return NS_OK;
}
NS_IMETHODIMP
nsDOMStyleSheetCollection::StyleSheetAdded(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet)
nsDOMStyleSheetList::StyleSheetAdded(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet)
{
if (-1 != mLength) {
nsIDOMStyleSheet *domss;
@ -363,8 +336,8 @@ nsDOMStyleSheetCollection::StyleSheetAdded(nsIDocument *aDocument,
}
NS_IMETHODIMP
nsDOMStyleSheetCollection::StyleSheetRemoved(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet)
nsDOMStyleSheetList::StyleSheetRemoved(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet)
{
if (-1 != mLength) {
nsIDOMStyleSheet *domss;
@ -378,7 +351,7 @@ nsDOMStyleSheetCollection::StyleSheetRemoved(nsIDocument *aDocument,
}
NS_IMETHODIMP
nsDOMStyleSheetCollection::DocumentWillBeDestroyed(nsIDocument *aDocument)
nsDOMStyleSheetList::DocumentWillBeDestroyed(nsIDocument *aDocument)
{
if (nsnull != mDocument) {
aDocument->RemoveObserver(this);
@ -739,6 +712,18 @@ nsresult nsDocument::QueryInterface(REFNSIID aIID, void** aInstancePtr)
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIDOMDocumentStyle))) {
nsIDOMDocumentStyle* tmp = this;
*aInstancePtr = (void*) tmp;
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIDOMDocumentView))) {
nsIDOMDocumentView* tmp = this;
*aInstancePtr = (void*) tmp;
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(kIScriptObjectOwnerIID)) {
nsIScriptObjectOwner* tmp = this;
*aInstancePtr = (void*) tmp;
@ -2048,10 +2033,10 @@ nsDocument::GetElementsByTagName(const nsString& aTagname,
}
NS_IMETHODIMP
nsDocument::GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets)
nsDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets)
{
if (nsnull == mDOMStyleSheets) {
mDOMStyleSheets = new nsDOMStyleSheetCollection(this);
mDOMStyleSheets = new nsDOMStyleSheetList(this);
if (nsnull == mDOMStyleSheets) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -2086,6 +2071,17 @@ nsDocument::CreateRange(nsIDOMRange** aReturn)
}
NS_IMETHODIMP
nsDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView)
{
NS_ENSURE_ARG_POINTER(aDefaultView);
*aDefaultView = nsnull;
return NS_OK;
}
nsresult
nsDocument::GetPixelDimensions(nsIPresShell* aShell,
PRInt32* aWidth,

View File

@ -27,7 +27,9 @@
#include "nsWeakPtr.h"
#include "nsVoidArray.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentView.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMDocumentStyle.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDiskDocument.h"
#include "nsIScriptObjectOwner.h"
@ -40,7 +42,7 @@
#include "nsIPrincipal.h"
class nsIEventListenerManager;
class nsDOMStyleSheetCollection;
class nsDOMStyleSheetList;
class nsIOutputStream;
class nsDocument;
@ -109,6 +111,8 @@ protected:
class nsDocument : public nsIDocument,
public nsIDOMDocument,
public nsIDOMNSDocument,
public nsIDOMDocumentStyle,
public nsIDOMDocumentView,
public nsIDiskDocument,
public nsIJSScriptObject,
public nsSupportsWeakReference,
@ -345,7 +349,7 @@ public:
NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn);
NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn);
NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn);
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets);
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets);
NS_IMETHOD GetCharacterSet(nsString& aCharacterSet);
NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName,
const nsString& aNameSpace,
@ -357,6 +361,9 @@ public:
// nsIDOMNode interface
NS_DECL_IDOMNODE
// nsIDOMDocumentView
NS_DECL_IDOMDOCUMENTVIEW
// nsIDOMEventReceiver interface
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
@ -448,7 +455,7 @@ protected:
nsIEventListenerManager* mListenerManager;
PRInt8 mDisplaySelection;
PRBool mInDestructor;
nsDOMStyleSheetCollection *mDOMStyleSheets;
nsDOMStyleSheetList *mDOMStyleSheets;
nsINameSpaceManager* mNameSpaceManager;
nsDocHeaderData* mHeaderData;
nsILineBreaker* mLineBreaker;

View File

@ -990,16 +990,10 @@ public:
virtual void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize);
// nsIDOMCSSRule interface
NS_IMETHOD GetType(PRUint16* aType);
NS_IMETHOD GetCssText(nsString& aCssText);
NS_IMETHOD SetCssText(const nsString& aCssText);
NS_IMETHOD GetSheet(nsIDOMCSSStyleSheet** aSheet);
NS_DECL_IDOMCSSRULE
// nsIDOMCSSStyleRule interface
NS_IMETHOD GetSelectorText(nsString& aSelectorText);
NS_IMETHOD SetSelectorText(const nsString& aSelectorText);
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle);
NS_IMETHOD SetStyle(nsIDOMCSSStyleDeclaration* aStyle);
NS_DECL_IDOMCSSSTYLERULE
// nsIScriptObjectOwner interface
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
@ -3230,7 +3224,7 @@ CSSStyleRuleImpl::SetCssText(const nsString& aCssText)
}
NS_IMETHODIMP
CSSStyleRuleImpl::GetSheet(nsIDOMCSSStyleSheet** aSheet)
CSSStyleRuleImpl::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
if (nsnull != mSheet) {
return mSheet->QueryInterface(kIDOMCSSStyleSheetIID, (void**)aSheet);
@ -3239,6 +3233,12 @@ CSSStyleRuleImpl::GetSheet(nsIDOMCSSStyleSheet** aSheet)
return NS_OK;
}
NS_IMETHODIMP
CSSStyleRuleImpl::GetParentRule(nsIDOMCSSRule** aParentRule)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
CSSStyleRuleImpl::GetSelectorText(nsString& aSelectorText)
{
@ -3273,13 +3273,6 @@ CSSStyleRuleImpl::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
return NS_OK;
}
NS_IMETHODIMP
CSSStyleRuleImpl::SetStyle(nsIDOMCSSStyleDeclaration* aStyle)
{
// XXX TBI
return NS_OK;
}
NS_IMETHODIMP
CSSStyleRuleImpl::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
{

View File

@ -48,11 +48,13 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#include "nsString.h"
#include "nsVoidArray.h"
#include "nsHTMLIIDs.h"
#include "nsIDOMStyleSheetCollection.h"
#include "nsIDOMStyleSheetList.h"
#include "nsIDOMCSSStyleSheet.h"
#include "nsIDOMCSSStyleRule.h"
#include "nsIDOMCSSStyleRuleCollection.h"
#include "nsIDOMCSSRuleList.h"
#include "nsIDOMMediaList.h"
#include "nsIDOMNode.h"
#include "nsDOMError.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsICSSParser.h"
@ -75,8 +77,6 @@ static NS_DEFINE_IID(kIStyleRuleIID, NS_ISTYLE_RULE_IID);
static NS_DEFINE_IID(kIDOMStyleSheetIID, NS_IDOMSTYLESHEET_IID);
static NS_DEFINE_IID(kIDOMCSSStyleSheetIID, NS_IDOMCSSSTYLESHEET_IID);
static NS_DEFINE_IID(kIDOMCSSStyleRuleIID, NS_IDOMCSSSTYLERULE_IID);
static NS_DEFINE_IID(kIDOMCSSStyleRuleCollectionIID, NS_IDOMCSSSTYLERULECOLLECTION_IID);
static NS_DEFINE_IID(kIDOMStyleSheetCollectionIID, NS_IDOMSTYLESHEETCOLLECTION_IID);
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
// ----------------------
@ -461,7 +461,8 @@ public:
//
class CSSImportsCollectionImpl;
class CSSStyleRuleCollectionImpl;
class CSSRuleListImpl;
class DOMMediaListImpl;
class CSSStyleSheetImpl : public nsICSSStyleSheet,
public nsIDOMCSSStyleSheet,
@ -533,20 +534,10 @@ public:
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize);
// nsIDOMStyleSheet interface
NS_IMETHOD GetType(nsString& aType);
NS_IMETHOD GetDisabled(PRBool* aDisabled);
NS_IMETHOD SetDisabled(PRBool aDisabled);
NS_IMETHOD GetReadOnly(PRBool* aReadOnly);
NS_DECL_IDOMSTYLESHEET
// nsIDOMCSSStyleSheet interface
NS_IMETHOD GetOwningNode(nsIDOMNode** aOwningNode);
NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet);
NS_IMETHOD GetHref(nsString& aHref);
NS_IMETHOD GetTitle(nsString& aTitle);
NS_IMETHOD GetMedia(nsString& aMedia);
NS_IMETHOD GetCssRules(nsIDOMCSSStyleRuleCollection** aCssRules);
NS_IMETHOD InsertRule(const nsString& aRule, PRUint32 aIndex, PRUint32* aReturn);
NS_IMETHOD DeleteRule(PRUint32 aIndex);
NS_DECL_IDOMCSSSTYLESHEET
// nsIScriptObjectOwner interface
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
@ -571,13 +562,13 @@ protected:
NS_DECL_OWNINGTHREAD // for thread-safety checking
nsString mTitle;
nsISupportsArray* mMedia;
DOMMediaListImpl* mMedia;
CSSStyleSheetImpl* mFirstChild;
CSSStyleSheetImpl* mNext;
nsICSSStyleSheet* mParent;
CSSImportsCollectionImpl* mImportsCollection;
CSSStyleRuleCollectionImpl* mRuleCollection;
CSSRuleListImpl* mRuleCollection;
nsIDocument* mDocument;
nsIDOMNode* mOwningNode;
PRBool mDisabled;
@ -593,19 +584,19 @@ friend class CSSRuleProcessor;
// -------------------------------
// Style Rule Collection for the DOM
// Style Rule List for the DOM
//
class CSSStyleRuleCollectionImpl : public nsIDOMCSSStyleRuleCollection,
public nsIScriptObjectOwner
class CSSRuleListImpl : public nsIDOMCSSRuleList,
public nsIScriptObjectOwner
{
public:
CSSStyleRuleCollectionImpl(CSSStyleSheetImpl *aStyleSheet);
CSSRuleListImpl(CSSStyleSheetImpl *aStyleSheet);
NS_DECL_ISUPPORTS
// nsIDOMCSSStyleRuleCollection interface
// nsIDOMCSSRuleList interface
NS_IMETHOD GetLength(PRUint32* aLength);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMCSSStyleRule** aReturn);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMCSSRule** aReturn);
// nsIScriptObjectOwner interface
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
@ -614,7 +605,7 @@ public:
void DropReference() { mStyleSheet = nsnull; }
protected:
virtual ~CSSStyleRuleCollectionImpl();
virtual ~CSSRuleListImpl();
CSSStyleSheetImpl* mStyleSheet;
void* mScriptObject;
@ -622,7 +613,7 @@ public:
PRBool mRulesAccessed;
};
CSSStyleRuleCollectionImpl::CSSStyleRuleCollectionImpl(CSSStyleSheetImpl *aStyleSheet)
CSSRuleListImpl::CSSRuleListImpl(CSSStyleSheetImpl *aStyleSheet)
{
NS_INIT_REFCNT();
// Not reference counted to avoid circular references.
@ -632,46 +623,22 @@ CSSStyleRuleCollectionImpl::CSSStyleRuleCollectionImpl(CSSStyleSheetImpl *aStyle
mRulesAccessed = PR_FALSE;
}
CSSStyleRuleCollectionImpl::~CSSStyleRuleCollectionImpl()
CSSRuleListImpl::~CSSRuleListImpl()
{
}
NS_IMPL_ADDREF(CSSStyleRuleCollectionImpl);
NS_IMPL_RELEASE(CSSStyleRuleCollectionImpl);
NS_IMPL_ADDREF(CSSRuleListImpl);
NS_IMPL_RELEASE(CSSRuleListImpl);
nsresult
CSSStyleRuleCollectionImpl::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
{
if (NULL == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIDOMCSSStyleRuleCollectionIID)) {
nsIDOMCSSStyleRuleCollection *tmp = this;
*aInstancePtrResult = (void*) tmp;
AddRef();
return NS_OK;
}
if (aIID.Equals(kIScriptObjectOwnerIID)) {
nsIScriptObjectOwner *tmp = this;
*aInstancePtrResult = (void*) tmp;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
nsIDOMCSSStyleRuleCollection *tmp = this;
nsISupports *tmp2 = tmp;
*aInstancePtrResult = (void*) tmp2;
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_INTERFACE_MAP_BEGIN(CSSRuleListImpl)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSRuleList)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMCSSRuleList)
NS_INTERFACE_MAP_END
NS_IMETHODIMP
CSSStyleRuleCollectionImpl::GetLength(PRUint32* aLength)
CSSRuleListImpl::GetLength(PRUint32* aLength)
{
if (nsnull != mStyleSheet) {
PRInt32 count;
@ -686,7 +653,7 @@ CSSStyleRuleCollectionImpl::GetLength(PRUint32* aLength)
}
NS_IMETHODIMP
CSSStyleRuleCollectionImpl::Item(PRUint32 aIndex, nsIDOMCSSStyleRule** aReturn)
CSSRuleListImpl::Item(PRUint32 aIndex, nsIDOMCSSRule** aReturn)
{
nsresult result = NS_OK;
@ -698,7 +665,8 @@ CSSStyleRuleCollectionImpl::Item(PRUint32 aIndex, nsIDOMCSSStyleRule** aReturn)
result = mStyleSheet->GetStyleRuleAt(aIndex, rule);
if (NS_OK == result) {
result = rule->QueryInterface(kIDOMCSSStyleRuleIID, (void **)aReturn);
result = rule->QueryInterface(NS_GET_IID(nsIDOMCSSRule),
(void **)aReturn);
mRulesAccessed = PR_TRUE; // signal to never share rules again
}
NS_RELEASE(rule);
@ -709,16 +677,16 @@ CSSStyleRuleCollectionImpl::Item(PRUint32 aIndex, nsIDOMCSSStyleRule** aReturn)
}
NS_IMETHODIMP
CSSStyleRuleCollectionImpl::GetScriptObject(nsIScriptContext *aContext,
CSSRuleListImpl::GetScriptObject(nsIScriptContext *aContext,
void** aScriptObject)
{
nsresult res = NS_OK;
if (nsnull == mScriptObject) {
nsISupports *supports = (nsISupports *)(nsIDOMCSSStyleRuleCollection *)this;
nsISupports *supports = (nsISupports *)(nsIDOMCSSRuleList *)this;
// XXX Should be done through factory
res = NS_NewScriptCSSStyleRuleCollection(aContext,
res = NS_NewScriptCSSRuleList(aContext,
supports,
(nsISupports *)(nsICSSStyleSheet*)mStyleSheet,
(void**)&mScriptObject);
@ -729,16 +697,233 @@ CSSStyleRuleCollectionImpl::GetScriptObject(nsIScriptContext *aContext,
}
NS_IMETHODIMP
CSSStyleRuleCollectionImpl::SetScriptObject(void* aScriptObject)
CSSRuleListImpl::SetScriptObject(void* aScriptObject)
{
mScriptObject = aScriptObject;
return NS_OK;
}
class DOMMediaListImpl : public nsIDOMMediaList,
public nsIScriptObjectOwner,
public nsISupportsArray
{
NS_DECL_ISUPPORTS
NS_DECL_IDOMMEDIALIST
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext,
void** aScriptObject);
NS_IMETHOD SetScriptObject(void* aScriptObject);
NS_FORWARD_NSISUPPORTSARRAY(mArray->)
NS_FORWARD_NSICOLLECTION(mArray->);
NS_IMETHOD_(PRBool) operator==(const nsISupportsArray& other) {
return PR_FALSE;
}
NS_IMETHOD_(nsISupports*) operator[](PRUint32 aIndex) {
return mArray->ElementAt(aIndex);
}
DOMMediaListImpl(nsISupportsArray *aArray, CSSStyleSheetImpl *aStyleSheet);
virtual ~DOMMediaListImpl();
void DropReference() { mStyleSheet = nsnull; }
private:
nsCOMPtr<nsISupportsArray> mArray;
CSSStyleSheetImpl* mStyleSheet;
void* mScriptObject;
};
NS_IMPL_ADDREF(DOMMediaListImpl);
NS_IMPL_RELEASE(DOMMediaListImpl);
NS_INTERFACE_MAP_BEGIN(DOMMediaListImpl)
NS_INTERFACE_MAP_ENTRY(nsIDOMMediaList)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMediaList)
NS_INTERFACE_MAP_END
DOMMediaListImpl::DOMMediaListImpl(nsISupportsArray *aArray,
CSSStyleSheetImpl *aStyleSheet)
: mArray(aArray), mStyleSheet(aStyleSheet), mScriptObject(nsnull)
{
NS_ABORT_IF_FALSE(mArray, "This can't be used without an array!!");
}
DOMMediaListImpl::~DOMMediaListImpl()
{
}
NS_IMETHODIMP
DOMMediaListImpl::GetScriptObject(nsIScriptContext *aContext,
void** aScriptObject)
{
nsresult res = NS_OK;
if (nsnull == mScriptObject) {
nsISupports *supports = (nsISupports *)(nsIDOMMediaList *)this;
// XXX Should be done through factory
res = NS_NewScriptMediaList(aContext,
supports,
(nsISupports *)(nsIDOMMediaList*)mStyleSheet,
(void**)&mScriptObject);
}
*aScriptObject = mScriptObject;
return res;
}
NS_IMETHODIMP
DOMMediaListImpl::SetScriptObject(void* aScriptObject)
{
mScriptObject = aScriptObject;
return NS_OK;
}
NS_IMETHODIMP
DOMMediaListImpl::GetMediaText(nsString& aMediaText)
{
aMediaText.Truncate();
PRUint32 cnt;
nsresult rv = Count(&cnt);
if (NS_FAILED(rv)) return rv;
PRInt32 count = cnt, index = 0;
while (index < count) {
nsCOMPtr<nsISupports> tmp(dont_AddRef(ElementAt(index++)));
NS_ENSURE_TRUE(tmp, NS_ERROR_FAILURE);
nsCOMPtr<nsIAtom> medium(do_QueryInterface(tmp));
NS_ENSURE_TRUE(medium, NS_ERROR_FAILURE);
const PRUnichar *buffer;
medium->GetUnicode(&buffer);
aMediaText.Append(buffer);
if (index < count) {
aMediaText.AppendWithConversion(", ");
}
}
return NS_OK;
}
NS_IMETHODIMP
DOMMediaListImpl::SetMediaText(const nsString& aMediaText)
{
nsresult rv = Clear();
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString buf(aMediaText);
PRInt32 n = buf.FindChar(',');
do {
if (n < 0)
n = buf.Length();
nsAutoString tmp;
buf.Left(tmp, n);
tmp.CompressWhitespace();
if (tmp.Length()) {
rv = Append(tmp);
NS_ENSURE_SUCCESS(rv, rv);
}
buf.Cut(0, n + 1);
n = buf.FindChar(',');
} while (buf.Length());
return rv;
}
NS_IMETHODIMP
DOMMediaListImpl::GetLength(PRUint32* aLength)
{
NS_ENSURE_ARG_POINTER(aLength);
PRUint32 cnt;
nsresult rv = Count(&cnt);
if (NS_FAILED(rv)) return rv;
*aLength = cnt;
return NS_OK;
}
NS_IMETHODIMP
DOMMediaListImpl::Item(PRUint32 aIndex, nsString& aReturn)
{
nsCOMPtr<nsISupports> tmp(dont_AddRef(ElementAt(aIndex)));
if (tmp) {
nsCOMPtr<nsIAtom> medium(do_QueryInterface(tmp));
NS_ENSURE_TRUE(medium, NS_ERROR_FAILURE);
const PRUnichar *buffer;
medium->GetUnicode(&buffer);
aReturn.SetString(buffer);
} else {
aReturn.Truncate();
}
return NS_OK;
}
NS_IMETHODIMP
DOMMediaListImpl::Delete(const nsString& aOldMedium)
{
if (!aOldMedium.Length())
return NS_ERROR_DOM_NOT_FOUND_ERR;
nsCOMPtr<nsIAtom> old(dont_AddRef(NS_NewAtom(aOldMedium)));
NS_ENSURE_TRUE(old, NS_ERROR_OUT_OF_MEMORY);
PRInt32 indx = IndexOf(old);
if (indx < 0) {
return NS_ERROR_DOM_NOT_FOUND_ERR;
}
RemoveElementAt(indx);
return NS_OK;
}
NS_IMETHODIMP
DOMMediaListImpl::Append(const nsString& aNewMedium)
{
if (!aNewMedium.Length())
return NS_ERROR_DOM_NOT_FOUND_ERR;
nsCOMPtr<nsIAtom> media(dont_AddRef(NS_NewAtom(aNewMedium)));
NS_ENSURE_TRUE(media, NS_ERROR_OUT_OF_MEMORY);
PRInt32 indx = IndexOf(media);
if (indx >= 0) {
RemoveElementAt(indx);
}
AppendElement(media);
return NS_OK;
}
// -------------------------------
// Imports Collection for the DOM
//
class CSSImportsCollectionImpl : public nsIDOMStyleSheetCollection,
class CSSImportsCollectionImpl : public nsIDOMStyleSheetList,
public nsIScriptObjectOwner
{
public:
@ -746,7 +931,7 @@ public:
NS_DECL_ISUPPORTS
// nsIDOMCSSStyleSheetCollection interface
// nsIDOMCSSStyleSheetList interface
NS_IMETHOD GetLength(PRUint32* aLength);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn);
@ -787,8 +972,8 @@ CSSImportsCollectionImpl::QueryInterface(REFNSIID aIID, void** aInstancePtrResul
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIDOMStyleSheetCollectionIID)) {
nsIDOMStyleSheetCollection *tmp = this;
if (aIID.Equals(NS_GET_IID(nsIDOMStyleSheetList))) {
nsIDOMStyleSheetList *tmp = this;
*aInstancePtrResult = (void*) tmp;
AddRef();
return NS_OK;
@ -800,7 +985,7 @@ CSSImportsCollectionImpl::QueryInterface(REFNSIID aIID, void** aInstancePtrResul
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
nsIDOMStyleSheetCollection *tmp = this;
nsIDOMStyleSheetList *tmp = this;
nsISupports *tmp2 = tmp;
*aInstancePtrResult = (void*) tmp2;
AddRef();
@ -850,13 +1035,13 @@ CSSImportsCollectionImpl::GetScriptObject(nsIScriptContext *aContext,
nsresult res = NS_OK;
if (nsnull == mScriptObject) {
nsISupports *supports = (nsISupports *)(nsIDOMStyleSheetCollection *)this;
nsISupports *supports = (nsISupports *)(nsIDOMStyleSheetList *)this;
// XXX Should be done through factory
res = NS_NewScriptStyleSheetCollection(aContext,
supports,
(nsISupports *)mStyleSheet,
(void**)&mScriptObject);
res = NS_NewScriptStyleSheetList(aContext,
supports,
(nsISupports *)mStyleSheet,
(void**)&mScriptObject);
}
*aScriptObject = mScriptObject;
@ -1222,9 +1407,12 @@ CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy)
}
if (aCopy.mMedia) {
NS_NewISupportsArray(&mMedia);
if (mMedia) {
mMedia->AppendElements(aCopy.mMedia);
nsCOMPtr<nsISupportsArray> tmp;
NS_NewISupportsArray(getter_AddRefs(tmp));
if (tmp) {
tmp->AppendElements(NS_STATIC_CAST(nsISupportsArray *, aCopy.mMedia));
mMedia = new DOMMediaListImpl(tmp, this);
NS_IF_ADDREF(mMedia);
}
}
@ -1246,7 +1434,6 @@ CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy)
CSSStyleSheetImpl::~CSSStyleSheetImpl()
{
NS_IF_RELEASE(mMedia);
if (mFirstChild) {
CSSStyleSheetImpl* child = mFirstChild;
do {
@ -1264,6 +1451,10 @@ CSSStyleSheetImpl::~CSSStyleSheetImpl()
mImportsCollection->DropReference();
NS_RELEASE(mImportsCollection);
}
if (mMedia) {
mMedia->DropReference();
NS_RELEASE(mMedia);
}
mInner->RemoveSheet(this);
// XXX The document reference is not reference counted and should
// not be released. The document will let us know when it is going
@ -1413,13 +1604,6 @@ CSSStyleSheetImpl::GetURL(nsIURI*& aURL) const
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetTitle(nsString& aTitle) const
{
aTitle = mTitle;
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::SetTitle(const nsString& aTitle)
{
@ -1484,10 +1668,18 @@ NS_IMETHODIMP
CSSStyleSheetImpl::AppendMedium(nsIAtom* aMedium)
{
nsresult result = NS_OK;
if (nsnull == mMedia) {
result = NS_NewISupportsArray(&mMedia);
if (!mMedia) {
nsCOMPtr<nsISupportsArray> tmp;
result = NS_NewISupportsArray(getter_AddRefs(tmp));
NS_ENSURE_SUCCESS(result, result);
mMedia = new DOMMediaListImpl(tmp, this);
NS_ENSURE_TRUE(mMedia, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(mMedia);
}
if (NS_SUCCEEDED(result) && (nsnull != mMedia)) {
if (mMedia) {
mMedia->AppendElement(aMedium);
}
return result;
@ -2049,35 +2241,32 @@ CSSStyleSheetImpl::SetDisabled(PRBool aDisabled)
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetReadOnly(PRBool* aReadOnly)
NS_IMETHODIMP
CSSStyleSheetImpl::GetOwnerNode(nsIDOMNode** aOwnerNode)
{
// XXX TBI
*aReadOnly = PR_FALSE;
*aOwnerNode = mOwningNode;
NS_IF_ADDREF(*aOwnerNode);
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetOwningNode(nsIDOMNode** aOwningNode)
{
NS_IF_ADDREF(mOwningNode);
*aOwningNode = mOwningNode;
return NS_OK;
}
NS_IMETHODIMP
NS_IMETHODIMP
CSSStyleSheetImpl::GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet)
{
if (nsnull != mParent) {
return mParent->QueryInterface(kIDOMStyleSheetIID, (void **)aParentStyleSheet);
}
else {
NS_ENSURE_ARG_POINTER(aParentStyleSheet);
nsresult rv = NS_OK;
if (mParent) {
rv = mParent->QueryInterface(NS_GET_IID(nsIDOMStyleSheet),
(void **)aParentStyleSheet);
} else {
*aParentStyleSheet = nsnull;
return NS_OK;
}
return rv;
}
NS_IMETHODIMP
NS_IMETHODIMP
CSSStyleSheetImpl::GetHref(nsString& aHref)
{
if (mInner && mInner->mURL) {
@ -2089,12 +2278,19 @@ CSSStyleSheetImpl::GetHref(nsString& aHref)
}
}
else {
aHref.SetLength(0);
aHref.Truncate();
}
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetTitle(nsString& aTitle) const
{
aTitle = mTitle;
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetTitle(nsString& aTitle)
{
@ -2103,33 +2299,37 @@ CSSStyleSheetImpl::GetTitle(nsString& aTitle)
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetMedia(nsString& aMedia)
CSSStyleSheetImpl::GetMedia(nsIDOMMediaList** aMedia)
{
aMedia.Truncate();
if (nsnull != mMedia) {
PRUint32 cnt;
nsresult rv = mMedia->Count(&cnt);
if (NS_FAILED(rv)) return rv;
PRInt32 count = cnt;
PRInt32 index = 0;
nsAutoString buffer;
while (index < count) {
nsIAtom* medium = (nsIAtom*)mMedia->ElementAt(index++);
medium->ToString(buffer);
aMedia.Append(buffer);
if (index < count) {
aMedia.AppendWithConversion(", ");
}
}
NS_ENSURE_ARG_POINTER(aMedia);
*aMedia = nsnull;
if (!mMedia) {
nsCOMPtr<nsISupportsArray> tmp;
NS_NewISupportsArray(getter_AddRefs(tmp));
NS_ENSURE_TRUE(tmp, NS_ERROR_NULL_POINTER);
mMedia = new DOMMediaListImpl(tmp, this);
NS_IF_ADDREF(mMedia);
}
*aMedia = mMedia;
NS_IF_ADDREF(*aMedia);
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetCssRules(nsIDOMCSSStyleRuleCollection** aCssRules)
CSSStyleSheetImpl::GetOwnerRule(nsIDOMCSSRule** aOwnerRule)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetCssRules(nsIDOMCSSRuleList** aCssRules)
{
if (nsnull == mRuleCollection) {
mRuleCollection = new CSSStyleRuleCollectionImpl(this);
mRuleCollection = new CSSRuleListImpl(this);
if (nsnull == mRuleCollection) {
return NS_ERROR_OUT_OF_MEMORY;
}

View File

@ -990,16 +990,10 @@ public:
virtual void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize);
// nsIDOMCSSRule interface
NS_IMETHOD GetType(PRUint16* aType);
NS_IMETHOD GetCssText(nsString& aCssText);
NS_IMETHOD SetCssText(const nsString& aCssText);
NS_IMETHOD GetSheet(nsIDOMCSSStyleSheet** aSheet);
NS_DECL_IDOMCSSRULE
// nsIDOMCSSStyleRule interface
NS_IMETHOD GetSelectorText(nsString& aSelectorText);
NS_IMETHOD SetSelectorText(const nsString& aSelectorText);
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle);
NS_IMETHOD SetStyle(nsIDOMCSSStyleDeclaration* aStyle);
NS_DECL_IDOMCSSSTYLERULE
// nsIScriptObjectOwner interface
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
@ -3230,7 +3224,7 @@ CSSStyleRuleImpl::SetCssText(const nsString& aCssText)
}
NS_IMETHODIMP
CSSStyleRuleImpl::GetSheet(nsIDOMCSSStyleSheet** aSheet)
CSSStyleRuleImpl::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
if (nsnull != mSheet) {
return mSheet->QueryInterface(kIDOMCSSStyleSheetIID, (void**)aSheet);
@ -3239,6 +3233,12 @@ CSSStyleRuleImpl::GetSheet(nsIDOMCSSStyleSheet** aSheet)
return NS_OK;
}
NS_IMETHODIMP
CSSStyleRuleImpl::GetParentRule(nsIDOMCSSRule** aParentRule)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
CSSStyleRuleImpl::GetSelectorText(nsString& aSelectorText)
{
@ -3273,13 +3273,6 @@ CSSStyleRuleImpl::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
return NS_OK;
}
NS_IMETHODIMP
CSSStyleRuleImpl::SetStyle(nsIDOMCSSStyleDeclaration* aStyle)
{
// XXX TBI
return NS_OK;
}
NS_IMETHODIMP
CSSStyleRuleImpl::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
{

View File

@ -48,11 +48,13 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#include "nsString.h"
#include "nsVoidArray.h"
#include "nsHTMLIIDs.h"
#include "nsIDOMStyleSheetCollection.h"
#include "nsIDOMStyleSheetList.h"
#include "nsIDOMCSSStyleSheet.h"
#include "nsIDOMCSSStyleRule.h"
#include "nsIDOMCSSStyleRuleCollection.h"
#include "nsIDOMCSSRuleList.h"
#include "nsIDOMMediaList.h"
#include "nsIDOMNode.h"
#include "nsDOMError.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsICSSParser.h"
@ -75,8 +77,6 @@ static NS_DEFINE_IID(kIStyleRuleIID, NS_ISTYLE_RULE_IID);
static NS_DEFINE_IID(kIDOMStyleSheetIID, NS_IDOMSTYLESHEET_IID);
static NS_DEFINE_IID(kIDOMCSSStyleSheetIID, NS_IDOMCSSSTYLESHEET_IID);
static NS_DEFINE_IID(kIDOMCSSStyleRuleIID, NS_IDOMCSSSTYLERULE_IID);
static NS_DEFINE_IID(kIDOMCSSStyleRuleCollectionIID, NS_IDOMCSSSTYLERULECOLLECTION_IID);
static NS_DEFINE_IID(kIDOMStyleSheetCollectionIID, NS_IDOMSTYLESHEETCOLLECTION_IID);
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
// ----------------------
@ -461,7 +461,8 @@ public:
//
class CSSImportsCollectionImpl;
class CSSStyleRuleCollectionImpl;
class CSSRuleListImpl;
class DOMMediaListImpl;
class CSSStyleSheetImpl : public nsICSSStyleSheet,
public nsIDOMCSSStyleSheet,
@ -533,20 +534,10 @@ public:
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize);
// nsIDOMStyleSheet interface
NS_IMETHOD GetType(nsString& aType);
NS_IMETHOD GetDisabled(PRBool* aDisabled);
NS_IMETHOD SetDisabled(PRBool aDisabled);
NS_IMETHOD GetReadOnly(PRBool* aReadOnly);
NS_DECL_IDOMSTYLESHEET
// nsIDOMCSSStyleSheet interface
NS_IMETHOD GetOwningNode(nsIDOMNode** aOwningNode);
NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet);
NS_IMETHOD GetHref(nsString& aHref);
NS_IMETHOD GetTitle(nsString& aTitle);
NS_IMETHOD GetMedia(nsString& aMedia);
NS_IMETHOD GetCssRules(nsIDOMCSSStyleRuleCollection** aCssRules);
NS_IMETHOD InsertRule(const nsString& aRule, PRUint32 aIndex, PRUint32* aReturn);
NS_IMETHOD DeleteRule(PRUint32 aIndex);
NS_DECL_IDOMCSSSTYLESHEET
// nsIScriptObjectOwner interface
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
@ -571,13 +562,13 @@ protected:
NS_DECL_OWNINGTHREAD // for thread-safety checking
nsString mTitle;
nsISupportsArray* mMedia;
DOMMediaListImpl* mMedia;
CSSStyleSheetImpl* mFirstChild;
CSSStyleSheetImpl* mNext;
nsICSSStyleSheet* mParent;
CSSImportsCollectionImpl* mImportsCollection;
CSSStyleRuleCollectionImpl* mRuleCollection;
CSSRuleListImpl* mRuleCollection;
nsIDocument* mDocument;
nsIDOMNode* mOwningNode;
PRBool mDisabled;
@ -593,19 +584,19 @@ friend class CSSRuleProcessor;
// -------------------------------
// Style Rule Collection for the DOM
// Style Rule List for the DOM
//
class CSSStyleRuleCollectionImpl : public nsIDOMCSSStyleRuleCollection,
public nsIScriptObjectOwner
class CSSRuleListImpl : public nsIDOMCSSRuleList,
public nsIScriptObjectOwner
{
public:
CSSStyleRuleCollectionImpl(CSSStyleSheetImpl *aStyleSheet);
CSSRuleListImpl(CSSStyleSheetImpl *aStyleSheet);
NS_DECL_ISUPPORTS
// nsIDOMCSSStyleRuleCollection interface
// nsIDOMCSSRuleList interface
NS_IMETHOD GetLength(PRUint32* aLength);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMCSSStyleRule** aReturn);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMCSSRule** aReturn);
// nsIScriptObjectOwner interface
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
@ -614,7 +605,7 @@ public:
void DropReference() { mStyleSheet = nsnull; }
protected:
virtual ~CSSStyleRuleCollectionImpl();
virtual ~CSSRuleListImpl();
CSSStyleSheetImpl* mStyleSheet;
void* mScriptObject;
@ -622,7 +613,7 @@ public:
PRBool mRulesAccessed;
};
CSSStyleRuleCollectionImpl::CSSStyleRuleCollectionImpl(CSSStyleSheetImpl *aStyleSheet)
CSSRuleListImpl::CSSRuleListImpl(CSSStyleSheetImpl *aStyleSheet)
{
NS_INIT_REFCNT();
// Not reference counted to avoid circular references.
@ -632,46 +623,22 @@ CSSStyleRuleCollectionImpl::CSSStyleRuleCollectionImpl(CSSStyleSheetImpl *aStyle
mRulesAccessed = PR_FALSE;
}
CSSStyleRuleCollectionImpl::~CSSStyleRuleCollectionImpl()
CSSRuleListImpl::~CSSRuleListImpl()
{
}
NS_IMPL_ADDREF(CSSStyleRuleCollectionImpl);
NS_IMPL_RELEASE(CSSStyleRuleCollectionImpl);
NS_IMPL_ADDREF(CSSRuleListImpl);
NS_IMPL_RELEASE(CSSRuleListImpl);
nsresult
CSSStyleRuleCollectionImpl::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
{
if (NULL == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIDOMCSSStyleRuleCollectionIID)) {
nsIDOMCSSStyleRuleCollection *tmp = this;
*aInstancePtrResult = (void*) tmp;
AddRef();
return NS_OK;
}
if (aIID.Equals(kIScriptObjectOwnerIID)) {
nsIScriptObjectOwner *tmp = this;
*aInstancePtrResult = (void*) tmp;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
nsIDOMCSSStyleRuleCollection *tmp = this;
nsISupports *tmp2 = tmp;
*aInstancePtrResult = (void*) tmp2;
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_INTERFACE_MAP_BEGIN(CSSRuleListImpl)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSRuleList)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMCSSRuleList)
NS_INTERFACE_MAP_END
NS_IMETHODIMP
CSSStyleRuleCollectionImpl::GetLength(PRUint32* aLength)
CSSRuleListImpl::GetLength(PRUint32* aLength)
{
if (nsnull != mStyleSheet) {
PRInt32 count;
@ -686,7 +653,7 @@ CSSStyleRuleCollectionImpl::GetLength(PRUint32* aLength)
}
NS_IMETHODIMP
CSSStyleRuleCollectionImpl::Item(PRUint32 aIndex, nsIDOMCSSStyleRule** aReturn)
CSSRuleListImpl::Item(PRUint32 aIndex, nsIDOMCSSRule** aReturn)
{
nsresult result = NS_OK;
@ -698,7 +665,8 @@ CSSStyleRuleCollectionImpl::Item(PRUint32 aIndex, nsIDOMCSSStyleRule** aReturn)
result = mStyleSheet->GetStyleRuleAt(aIndex, rule);
if (NS_OK == result) {
result = rule->QueryInterface(kIDOMCSSStyleRuleIID, (void **)aReturn);
result = rule->QueryInterface(NS_GET_IID(nsIDOMCSSRule),
(void **)aReturn);
mRulesAccessed = PR_TRUE; // signal to never share rules again
}
NS_RELEASE(rule);
@ -709,16 +677,16 @@ CSSStyleRuleCollectionImpl::Item(PRUint32 aIndex, nsIDOMCSSStyleRule** aReturn)
}
NS_IMETHODIMP
CSSStyleRuleCollectionImpl::GetScriptObject(nsIScriptContext *aContext,
CSSRuleListImpl::GetScriptObject(nsIScriptContext *aContext,
void** aScriptObject)
{
nsresult res = NS_OK;
if (nsnull == mScriptObject) {
nsISupports *supports = (nsISupports *)(nsIDOMCSSStyleRuleCollection *)this;
nsISupports *supports = (nsISupports *)(nsIDOMCSSRuleList *)this;
// XXX Should be done through factory
res = NS_NewScriptCSSStyleRuleCollection(aContext,
res = NS_NewScriptCSSRuleList(aContext,
supports,
(nsISupports *)(nsICSSStyleSheet*)mStyleSheet,
(void**)&mScriptObject);
@ -729,16 +697,233 @@ CSSStyleRuleCollectionImpl::GetScriptObject(nsIScriptContext *aContext,
}
NS_IMETHODIMP
CSSStyleRuleCollectionImpl::SetScriptObject(void* aScriptObject)
CSSRuleListImpl::SetScriptObject(void* aScriptObject)
{
mScriptObject = aScriptObject;
return NS_OK;
}
class DOMMediaListImpl : public nsIDOMMediaList,
public nsIScriptObjectOwner,
public nsISupportsArray
{
NS_DECL_ISUPPORTS
NS_DECL_IDOMMEDIALIST
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext,
void** aScriptObject);
NS_IMETHOD SetScriptObject(void* aScriptObject);
NS_FORWARD_NSISUPPORTSARRAY(mArray->)
NS_FORWARD_NSICOLLECTION(mArray->);
NS_IMETHOD_(PRBool) operator==(const nsISupportsArray& other) {
return PR_FALSE;
}
NS_IMETHOD_(nsISupports*) operator[](PRUint32 aIndex) {
return mArray->ElementAt(aIndex);
}
DOMMediaListImpl(nsISupportsArray *aArray, CSSStyleSheetImpl *aStyleSheet);
virtual ~DOMMediaListImpl();
void DropReference() { mStyleSheet = nsnull; }
private:
nsCOMPtr<nsISupportsArray> mArray;
CSSStyleSheetImpl* mStyleSheet;
void* mScriptObject;
};
NS_IMPL_ADDREF(DOMMediaListImpl);
NS_IMPL_RELEASE(DOMMediaListImpl);
NS_INTERFACE_MAP_BEGIN(DOMMediaListImpl)
NS_INTERFACE_MAP_ENTRY(nsIDOMMediaList)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMediaList)
NS_INTERFACE_MAP_END
DOMMediaListImpl::DOMMediaListImpl(nsISupportsArray *aArray,
CSSStyleSheetImpl *aStyleSheet)
: mArray(aArray), mStyleSheet(aStyleSheet), mScriptObject(nsnull)
{
NS_ABORT_IF_FALSE(mArray, "This can't be used without an array!!");
}
DOMMediaListImpl::~DOMMediaListImpl()
{
}
NS_IMETHODIMP
DOMMediaListImpl::GetScriptObject(nsIScriptContext *aContext,
void** aScriptObject)
{
nsresult res = NS_OK;
if (nsnull == mScriptObject) {
nsISupports *supports = (nsISupports *)(nsIDOMMediaList *)this;
// XXX Should be done through factory
res = NS_NewScriptMediaList(aContext,
supports,
(nsISupports *)(nsIDOMMediaList*)mStyleSheet,
(void**)&mScriptObject);
}
*aScriptObject = mScriptObject;
return res;
}
NS_IMETHODIMP
DOMMediaListImpl::SetScriptObject(void* aScriptObject)
{
mScriptObject = aScriptObject;
return NS_OK;
}
NS_IMETHODIMP
DOMMediaListImpl::GetMediaText(nsString& aMediaText)
{
aMediaText.Truncate();
PRUint32 cnt;
nsresult rv = Count(&cnt);
if (NS_FAILED(rv)) return rv;
PRInt32 count = cnt, index = 0;
while (index < count) {
nsCOMPtr<nsISupports> tmp(dont_AddRef(ElementAt(index++)));
NS_ENSURE_TRUE(tmp, NS_ERROR_FAILURE);
nsCOMPtr<nsIAtom> medium(do_QueryInterface(tmp));
NS_ENSURE_TRUE(medium, NS_ERROR_FAILURE);
const PRUnichar *buffer;
medium->GetUnicode(&buffer);
aMediaText.Append(buffer);
if (index < count) {
aMediaText.AppendWithConversion(", ");
}
}
return NS_OK;
}
NS_IMETHODIMP
DOMMediaListImpl::SetMediaText(const nsString& aMediaText)
{
nsresult rv = Clear();
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString buf(aMediaText);
PRInt32 n = buf.FindChar(',');
do {
if (n < 0)
n = buf.Length();
nsAutoString tmp;
buf.Left(tmp, n);
tmp.CompressWhitespace();
if (tmp.Length()) {
rv = Append(tmp);
NS_ENSURE_SUCCESS(rv, rv);
}
buf.Cut(0, n + 1);
n = buf.FindChar(',');
} while (buf.Length());
return rv;
}
NS_IMETHODIMP
DOMMediaListImpl::GetLength(PRUint32* aLength)
{
NS_ENSURE_ARG_POINTER(aLength);
PRUint32 cnt;
nsresult rv = Count(&cnt);
if (NS_FAILED(rv)) return rv;
*aLength = cnt;
return NS_OK;
}
NS_IMETHODIMP
DOMMediaListImpl::Item(PRUint32 aIndex, nsString& aReturn)
{
nsCOMPtr<nsISupports> tmp(dont_AddRef(ElementAt(aIndex)));
if (tmp) {
nsCOMPtr<nsIAtom> medium(do_QueryInterface(tmp));
NS_ENSURE_TRUE(medium, NS_ERROR_FAILURE);
const PRUnichar *buffer;
medium->GetUnicode(&buffer);
aReturn.SetString(buffer);
} else {
aReturn.Truncate();
}
return NS_OK;
}
NS_IMETHODIMP
DOMMediaListImpl::Delete(const nsString& aOldMedium)
{
if (!aOldMedium.Length())
return NS_ERROR_DOM_NOT_FOUND_ERR;
nsCOMPtr<nsIAtom> old(dont_AddRef(NS_NewAtom(aOldMedium)));
NS_ENSURE_TRUE(old, NS_ERROR_OUT_OF_MEMORY);
PRInt32 indx = IndexOf(old);
if (indx < 0) {
return NS_ERROR_DOM_NOT_FOUND_ERR;
}
RemoveElementAt(indx);
return NS_OK;
}
NS_IMETHODIMP
DOMMediaListImpl::Append(const nsString& aNewMedium)
{
if (!aNewMedium.Length())
return NS_ERROR_DOM_NOT_FOUND_ERR;
nsCOMPtr<nsIAtom> media(dont_AddRef(NS_NewAtom(aNewMedium)));
NS_ENSURE_TRUE(media, NS_ERROR_OUT_OF_MEMORY);
PRInt32 indx = IndexOf(media);
if (indx >= 0) {
RemoveElementAt(indx);
}
AppendElement(media);
return NS_OK;
}
// -------------------------------
// Imports Collection for the DOM
//
class CSSImportsCollectionImpl : public nsIDOMStyleSheetCollection,
class CSSImportsCollectionImpl : public nsIDOMStyleSheetList,
public nsIScriptObjectOwner
{
public:
@ -746,7 +931,7 @@ public:
NS_DECL_ISUPPORTS
// nsIDOMCSSStyleSheetCollection interface
// nsIDOMCSSStyleSheetList interface
NS_IMETHOD GetLength(PRUint32* aLength);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn);
@ -787,8 +972,8 @@ CSSImportsCollectionImpl::QueryInterface(REFNSIID aIID, void** aInstancePtrResul
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kIDOMStyleSheetCollectionIID)) {
nsIDOMStyleSheetCollection *tmp = this;
if (aIID.Equals(NS_GET_IID(nsIDOMStyleSheetList))) {
nsIDOMStyleSheetList *tmp = this;
*aInstancePtrResult = (void*) tmp;
AddRef();
return NS_OK;
@ -800,7 +985,7 @@ CSSImportsCollectionImpl::QueryInterface(REFNSIID aIID, void** aInstancePtrResul
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
nsIDOMStyleSheetCollection *tmp = this;
nsIDOMStyleSheetList *tmp = this;
nsISupports *tmp2 = tmp;
*aInstancePtrResult = (void*) tmp2;
AddRef();
@ -850,13 +1035,13 @@ CSSImportsCollectionImpl::GetScriptObject(nsIScriptContext *aContext,
nsresult res = NS_OK;
if (nsnull == mScriptObject) {
nsISupports *supports = (nsISupports *)(nsIDOMStyleSheetCollection *)this;
nsISupports *supports = (nsISupports *)(nsIDOMStyleSheetList *)this;
// XXX Should be done through factory
res = NS_NewScriptStyleSheetCollection(aContext,
supports,
(nsISupports *)mStyleSheet,
(void**)&mScriptObject);
res = NS_NewScriptStyleSheetList(aContext,
supports,
(nsISupports *)mStyleSheet,
(void**)&mScriptObject);
}
*aScriptObject = mScriptObject;
@ -1222,9 +1407,12 @@ CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy)
}
if (aCopy.mMedia) {
NS_NewISupportsArray(&mMedia);
if (mMedia) {
mMedia->AppendElements(aCopy.mMedia);
nsCOMPtr<nsISupportsArray> tmp;
NS_NewISupportsArray(getter_AddRefs(tmp));
if (tmp) {
tmp->AppendElements(NS_STATIC_CAST(nsISupportsArray *, aCopy.mMedia));
mMedia = new DOMMediaListImpl(tmp, this);
NS_IF_ADDREF(mMedia);
}
}
@ -1246,7 +1434,6 @@ CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy)
CSSStyleSheetImpl::~CSSStyleSheetImpl()
{
NS_IF_RELEASE(mMedia);
if (mFirstChild) {
CSSStyleSheetImpl* child = mFirstChild;
do {
@ -1264,6 +1451,10 @@ CSSStyleSheetImpl::~CSSStyleSheetImpl()
mImportsCollection->DropReference();
NS_RELEASE(mImportsCollection);
}
if (mMedia) {
mMedia->DropReference();
NS_RELEASE(mMedia);
}
mInner->RemoveSheet(this);
// XXX The document reference is not reference counted and should
// not be released. The document will let us know when it is going
@ -1413,13 +1604,6 @@ CSSStyleSheetImpl::GetURL(nsIURI*& aURL) const
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetTitle(nsString& aTitle) const
{
aTitle = mTitle;
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::SetTitle(const nsString& aTitle)
{
@ -1484,10 +1668,18 @@ NS_IMETHODIMP
CSSStyleSheetImpl::AppendMedium(nsIAtom* aMedium)
{
nsresult result = NS_OK;
if (nsnull == mMedia) {
result = NS_NewISupportsArray(&mMedia);
if (!mMedia) {
nsCOMPtr<nsISupportsArray> tmp;
result = NS_NewISupportsArray(getter_AddRefs(tmp));
NS_ENSURE_SUCCESS(result, result);
mMedia = new DOMMediaListImpl(tmp, this);
NS_ENSURE_TRUE(mMedia, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(mMedia);
}
if (NS_SUCCEEDED(result) && (nsnull != mMedia)) {
if (mMedia) {
mMedia->AppendElement(aMedium);
}
return result;
@ -2049,35 +2241,32 @@ CSSStyleSheetImpl::SetDisabled(PRBool aDisabled)
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetReadOnly(PRBool* aReadOnly)
NS_IMETHODIMP
CSSStyleSheetImpl::GetOwnerNode(nsIDOMNode** aOwnerNode)
{
// XXX TBI
*aReadOnly = PR_FALSE;
*aOwnerNode = mOwningNode;
NS_IF_ADDREF(*aOwnerNode);
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetOwningNode(nsIDOMNode** aOwningNode)
{
NS_IF_ADDREF(mOwningNode);
*aOwningNode = mOwningNode;
return NS_OK;
}
NS_IMETHODIMP
NS_IMETHODIMP
CSSStyleSheetImpl::GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet)
{
if (nsnull != mParent) {
return mParent->QueryInterface(kIDOMStyleSheetIID, (void **)aParentStyleSheet);
}
else {
NS_ENSURE_ARG_POINTER(aParentStyleSheet);
nsresult rv = NS_OK;
if (mParent) {
rv = mParent->QueryInterface(NS_GET_IID(nsIDOMStyleSheet),
(void **)aParentStyleSheet);
} else {
*aParentStyleSheet = nsnull;
return NS_OK;
}
return rv;
}
NS_IMETHODIMP
NS_IMETHODIMP
CSSStyleSheetImpl::GetHref(nsString& aHref)
{
if (mInner && mInner->mURL) {
@ -2089,12 +2278,19 @@ CSSStyleSheetImpl::GetHref(nsString& aHref)
}
}
else {
aHref.SetLength(0);
aHref.Truncate();
}
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetTitle(nsString& aTitle) const
{
aTitle = mTitle;
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetTitle(nsString& aTitle)
{
@ -2103,33 +2299,37 @@ CSSStyleSheetImpl::GetTitle(nsString& aTitle)
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetMedia(nsString& aMedia)
CSSStyleSheetImpl::GetMedia(nsIDOMMediaList** aMedia)
{
aMedia.Truncate();
if (nsnull != mMedia) {
PRUint32 cnt;
nsresult rv = mMedia->Count(&cnt);
if (NS_FAILED(rv)) return rv;
PRInt32 count = cnt;
PRInt32 index = 0;
nsAutoString buffer;
while (index < count) {
nsIAtom* medium = (nsIAtom*)mMedia->ElementAt(index++);
medium->ToString(buffer);
aMedia.Append(buffer);
if (index < count) {
aMedia.AppendWithConversion(", ");
}
}
NS_ENSURE_ARG_POINTER(aMedia);
*aMedia = nsnull;
if (!mMedia) {
nsCOMPtr<nsISupportsArray> tmp;
NS_NewISupportsArray(getter_AddRefs(tmp));
NS_ENSURE_TRUE(tmp, NS_ERROR_NULL_POINTER);
mMedia = new DOMMediaListImpl(tmp, this);
NS_IF_ADDREF(mMedia);
}
*aMedia = mMedia;
NS_IF_ADDREF(*aMedia);
return NS_OK;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetCssRules(nsIDOMCSSStyleRuleCollection** aCssRules)
CSSStyleSheetImpl::GetOwnerRule(nsIDOMCSSRule** aOwnerRule)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
CSSStyleSheetImpl::GetCssRules(nsIDOMCSSRuleList** aCssRules)
{
if (nsnull == mRuleCollection) {
mRuleCollection = new CSSStyleRuleCollectionImpl(this);
mRuleCollection = new CSSRuleListImpl(this);
if (nsnull == mRuleCollection) {
return NS_ERROR_OUT_OF_MEMORY;
}

View File

@ -66,9 +66,10 @@
#include "nsIDOMEventListener.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsIDOMStyleSheetCollection.h"
#include "nsIDOMStyleSheetList.h"
#include "nsIDOMText.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMAbstractView.h"
#include "nsIDTD.h"
#include "nsIDocumentObserver.h"
#include "nsIFormControl.h"
@ -585,6 +586,9 @@ nsXULDocument::QueryInterface(REFNSIID iid, void** result)
else if (iid.Equals(NS_GET_IID(nsIDOMNSDocument))) {
*result = NS_STATIC_CAST(nsIDOMNSDocument*, this);
}
else if (iid.Equals(NS_GET_IID(nsIDOMDocumentView))) {
*result = NS_STATIC_CAST(nsIDOMDocumentView*, this);
}
else if (iid.Equals(NS_GET_IID(nsIJSScriptObject))) {
*result = NS_STATIC_CAST(nsIJSScriptObject*, this);
}
@ -2597,7 +2601,7 @@ nsXULDocument::DestroyForwardReferences()
//
NS_IMETHODIMP
nsXULDocument::GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets)
nsXULDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets)
{
NS_NOTREACHED("nsXULDocument::GetStyleSheets");
return NS_ERROR_NOT_IMPLEMENTED;
@ -2662,6 +2666,13 @@ nsXULDocument::CreateRange(nsIDOMRange** aRange)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView)
{
NS_NOTREACHED("nsXULDocument::GetDefaultView");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULDocument::GetWidth(PRInt32* aWidth)
{

View File

@ -35,6 +35,7 @@
#include "nsIDOMEventCapturer.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMDocumentView.h"
#include "nsIDOMSelection.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIDOMXULDocument.h"
@ -67,6 +68,7 @@
class nsIAtom;
class nsIElementFactory;
class nsIDOMStyleSheetList;
class nsILoadGroup;
class nsIRDFResource;
class nsIRDFService;
@ -89,6 +91,7 @@ class nsXULDocument : public nsIDocument,
public nsIXULDocument,
public nsIStreamLoadableDocument,
public nsIDOMXULDocument,
public nsIDOMDocumentView,
public nsIDOMNSDocument,
public nsIDOMEventCapturer,
public nsIJSScriptObject,
@ -330,8 +333,11 @@ public:
// nsIDOMDocument interface
NS_DECL_IDOMDOCUMENT
// nsIDOMDocumentView interface
NS_DECL_IDOMDOCUMENTVIEW
// nsIDOMNSDocument interface
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets);
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets);
NS_IMETHOD GetCharacterSet(nsString& aCharacterSet);
NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aResult);
NS_IMETHOD CreateRange(nsIDOMRange** aRange);