From 3145f885861559d2f674ee3f3c131bb3c62e98ae Mon Sep 17 00:00:00 2001 From: Peter Van der Beken Date: Mon, 13 Jul 2009 13:14:57 +0200 Subject: [PATCH] Part 1 of fix for bug 500850 (Make inline style use wrapper cache and slimwrappers). r/sr=bz. --HG-- extra : rebase_source : 21f9c86dc4024e0e23882226e8395d61d5b0c518 --- content/base/src/nsGenericElement.cpp | 9 ++-- dom/base/nsDOMClassInfo.cpp | 26 ++++++++++ dom/base/nsDOMClassInfo.h | 3 ++ dom/base/nsGlobalWindow.cpp | 27 +++------- dom/base/nsGlobalWindow.h | 1 - layout/build/nsLayoutModule.cpp | 7 --- layout/style/Makefile.in | 1 - layout/style/nsCSSStyleRule.cpp | 7 ++- layout/style/nsComputedDOMStyle.cpp | 40 ++++++++++---- layout/style/nsComputedDOMStyle.h | 17 ++++-- layout/style/nsDOMCSSAttrDeclaration.cpp | 36 +++++++++---- layout/style/nsDOMCSSAttrDeclaration.h | 23 +++++---- layout/style/nsDOMCSSDeclaration.cpp | 13 ++--- layout/style/nsDOMCSSDeclaration.h | 1 - layout/style/nsICSSDeclaration.h | 2 + layout/style/nsIComputedDOMStyle.h | 66 ------------------------ 16 files changed, 137 insertions(+), 142 deletions(-) delete mode 100644 layout/style/nsIComputedDOMStyle.h diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index 5c3894067b8..148e049a66b 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -1753,10 +1753,6 @@ nsGenericElement::nsDOMSlots::nsDOMSlots(PtrBits aFlags) nsGenericElement::nsDOMSlots::~nsDOMSlots() { - if (mStyle) { - mStyle->DropReference(); - } - if (mAttributeMap) { mAttributeMap->DropReference(); } @@ -4057,7 +4053,12 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGenericElement) { nsDOMSlots *slots = tmp->GetExistingDOMSlots(); if (slots) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "slots mStyle"); + cb.NoteXPCOMChild(slots->mStyle.get()); + + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "slots mAttributeMap"); cb.NoteXPCOMChild(slots->mAttributeMap.get()); + if (tmp->IsNodeOfType(nsINode::eXUL)) cb.NoteXPCOMChild(slots->mControllers); cb.NoteXPCOMChild( diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index ff8f12c2296..2d387f5e34f 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -175,6 +175,7 @@ #include "nsIDOMRect.h" #include "nsIDOMRGBColor.h" #include "nsIDOMNSRGBAColor.h" +#include "nsDOMCSSAttrDeclaration.h" // XBL related includes. #include "nsIXBLService.h" @@ -10040,6 +10041,31 @@ nsCSSValueListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex, // CSSStyleDeclaration helper +NS_IMETHODIMP +nsCSSStyleDeclSH::PreCreate(nsISupports *nativeObj, JSContext *cx, + JSObject *globalObj, JSObject **parentObj) +{ + nsWrapperCache* cache = nsnull; + CallQueryInterface(nativeObj, &cache); + if (!cache) { + return nsDOMClassInfo::PreCreate(nativeObj, cx, globalObj, parentObj); + } + + nsICSSDeclaration *declaration = static_cast(nativeObj); + nsISupports *native_parent = declaration->GetParentObject(); + if (!native_parent) { + return NS_ERROR_FAILURE; + } + + jsval v; + nsresult rv = WrapNative(cx, globalObj, native_parent, &v); + NS_ENSURE_SUCCESS(rv, rv); + + *parentObj = JSVAL_TO_OBJECT(v); + + return NS_SUCCESS_ALLOW_SLIM_WRAPPERS; +} + nsresult nsCSSStyleDeclSH::GetStringAt(nsISupports *aNative, PRInt32 aIndex, nsAString& aResult) diff --git a/dom/base/nsDOMClassInfo.h b/dom/base/nsDOMClassInfo.h index 08df7d7f1bc..779650ad2c3 100644 --- a/dom/base/nsDOMClassInfo.h +++ b/dom/base/nsDOMClassInfo.h @@ -1423,6 +1423,9 @@ protected: nsAString& aResult); public: + NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx, + JSObject *globalObj, JSObject **parentObj); + static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) { return new nsCSSStyleDeclSH(aData); diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 4113d0ef37e..7f7b5b461a6 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -139,7 +139,7 @@ #include "nsIWebBrowserFind.h" // For window.find() #include "nsIWebContentHandlerRegistrar.h" #include "nsIWindowMediator.h" // For window.find() -#include "nsIComputedDOMStyle.h" +#include "nsComputedDOMStyle.h" #include "nsIEntropyCollector.h" #include "nsDOMCID.h" #include "nsDOMError.h" @@ -207,7 +207,6 @@ static PRLogModuleInfo* gDOMLeakPRLog; #endif -nsIFactory *nsGlobalWindow::sComputedDOMStyleFactory = nsnull; nsIDOMStorageList *nsGlobalWindow::sGlobalStorageList = nsnull; static nsIEntropyCollector *gEntropyCollector = nsnull; @@ -803,7 +802,6 @@ nsGlobalWindow::~nsGlobalWindow() void nsGlobalWindow::ShutDown() { - NS_IF_RELEASE(sComputedDOMStyleFactory); NS_IF_RELEASE(sGlobalStorageList); if (gDumpFile && gDumpFile != stdout) { @@ -6899,27 +6897,14 @@ nsGlobalWindow::GetComputedStyle(nsIDOMElement* aElt, return NS_OK; } - nsresult rv = NS_OK; - nsCOMPtr compStyle; - - if (!sComputedDOMStyleFactory) { - rv = CallGetClassObject("@mozilla.org/DOM/Level2/CSS/computedStyleDeclaration;1", - &sComputedDOMStyleFactory); - NS_ENSURE_SUCCESS(rv, rv); - } - - rv = - sComputedDOMStyleFactory->CreateInstance(nsnull, - NS_GET_IID(nsIComputedDOMStyle), - getter_AddRefs(compStyle)); - + nsRefPtr compStyle; + nsresult rv = NS_NewComputedDOMStyle(aElt, aPseudoElt, presShell, + getter_AddRefs(compStyle)); NS_ENSURE_SUCCESS(rv, rv); - rv = compStyle->Init(aElt, aPseudoElt, presShell); - NS_ENSURE_SUCCESS(rv, rv); + *aReturn = compStyle.forget().get(); - return compStyle->QueryInterface(NS_GET_IID(nsIDOMCSSStyleDeclaration), - (void **) aReturn); + return NS_OK; } //***************************************************************************** diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index 5ff07815d65..e568c7279fc 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -781,7 +781,6 @@ protected: friend class nsDOMScriptableHelper; friend class nsDOMWindowUtils; friend class PostMessageEvent; - static nsIFactory *sComputedDOMStyleFactory; static nsIDOMStorageList* sGlobalStorageList; }; diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index 9d931cf0e42..b7eb028b0cf 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -52,7 +52,6 @@ #include "nsICSSStyleSheet.h" #include "nsICategoryManager.h" #include "nsIComponentManager.h" -#include "nsIComputedDOMStyle.h" #include "nsIContentIterator.h" #include "nsIContentSerializer.h" #include "nsIController.h" @@ -517,7 +516,6 @@ MAKE_CTOR(CreateXHTMLParanoidFragmentSink,nsIFragmentContentSink, NS_NewXHT MAKE_CTOR(CreateSanitizingHTMLSerializer, nsIContentSerializer, NS_NewSanitizingHTMLSerializer) MAKE_CTOR(CreateXBLService, nsIXBLService, NS_NewXBLService) MAKE_CTOR(CreateContentPolicy, nsIContentPolicy, NS_NewContentPolicy) -MAKE_CTOR(CreateComputedDOMStyle, nsIComputedDOMStyle, NS_NewComputedDOMStyle) #ifdef MOZ_XUL MAKE_CTOR(CreateXULSortService, nsIXULSortService, NS_NewXULSortService) // NS_NewXULContentBuilder @@ -1235,11 +1233,6 @@ static const nsModuleComponentInfo gComponents[] = { RegisterNoDataProtocolContentPolicy, UnregisterNoDataProtocolContentPolicy }, - { "DOM CSS Computed Style Declaration", - NS_COMPUTEDDOMSTYLE_CID, - "@mozilla.org/DOM/Level2/CSS/computedStyleDeclaration;1", - CreateComputedDOMStyle }, - { "XUL Controllers", NS_XULCONTROLLERS_CID, "@mozilla.org/xul/xul-controllers;1", diff --git a/layout/style/Makefile.in b/layout/style/Makefile.in index fdfc4257ac6..16543c5a5c6 100644 --- a/layout/style/Makefile.in +++ b/layout/style/Makefile.in @@ -106,7 +106,6 @@ EXPORTS = \ nsICSSStyleRule.h \ nsICSSStyleRuleDOMWrapper.h \ nsICSSStyleSheet.h \ - nsIComputedDOMStyle.h \ nsIHTMLCSSStyleSheet.h \ nsIInspectorCSSUtils.h \ nsIStyleRule.h \ diff --git a/layout/style/nsCSSStyleRule.cpp b/layout/style/nsCSSStyleRule.cpp index b4907414109..9f73064c36c 100644 --- a/layout/style/nsCSSStyleRule.cpp +++ b/layout/style/nsCSSStyleRule.cpp @@ -859,7 +859,7 @@ public: virtual ~DOMCSSDeclarationImpl(void); NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent); - virtual void DropReference(void); + void DropReference(void); virtual nsresult GetCSSDeclaration(nsCSSDeclaration **aDecl, PRBool aAllocate); virtual nsresult GetCSSParsingEnvironment(nsIURI** aSheetURI, @@ -874,6 +874,11 @@ public: NS_IMETHOD_(nsrefcnt) AddRef(void); NS_IMETHOD_(nsrefcnt) Release(void); + virtual nsISupports *GetParentObject() + { + return nsnull; + } + friend class DOMCSSStyleRuleImpl; protected: diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 01d69746ac7..b63091e582f 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -77,6 +77,7 @@ #include "nsCSSKeywords.h" #include "nsStyleCoord.h" #include "nsDisplayList.h" +#include "nsDOMCSSDeclaration.h" #if defined(DEBUG_bzbarsky) || defined(DEBUG_caillon) #define DEBUG_ComputedDOMStyle @@ -90,27 +91,34 @@ static nsComputedDOMStyle *sCachedComputedDOMStyle; nsresult -NS_NewComputedDOMStyle(nsIComputedDOMStyle** aComputedStyle) +NS_NewComputedDOMStyle(nsIDOMElement *aElement, const nsAString &aPseudoElt, + nsIPresShell *aPresShell, + nsComputedDOMStyle **aComputedStyle) { NS_ENSURE_ARG_POINTER(aComputedStyle); + nsRefPtr computedStyle; if (sCachedComputedDOMStyle) { // There's an unused nsComputedDOMStyle cached, use it. // But before we use it, re-initialize the object. // Oh yeah baby, placement new! - *aComputedStyle = new (sCachedComputedDOMStyle) nsComputedDOMStyle(); + computedStyle = new (sCachedComputedDOMStyle) nsComputedDOMStyle(); sCachedComputedDOMStyle = nsnull; } else { // No nsComputedDOMStyle cached, create a new one. - *aComputedStyle = new nsComputedDOMStyle(); - NS_ENSURE_TRUE(*aComputedStyle, NS_ERROR_OUT_OF_MEMORY); + computedStyle = new nsComputedDOMStyle(); + NS_ENSURE_TRUE(computedStyle, NS_ERROR_OUT_OF_MEMORY); } - NS_ADDREF(*aComputedStyle); + nsresult rv = computedStyle->Init(aElement, aPseudoElt, aPresShell); + NS_ENSURE_SUCCESS(rv, rv); + *aComputedStyle = nsnull; + computedStyle.swap(*aComputedStyle); + return NS_OK; } @@ -131,6 +139,7 @@ nsComputedDOMStyle::nsComputedDOMStyle() nsComputedDOMStyle::~nsComputedDOMStyle() { + ClearWrapper(); } void @@ -146,19 +155,30 @@ nsComputedDOMStyle::Shutdown() NS_IMPL_CYCLE_COLLECTION_CLASS(nsComputedDOMStyle) +NS_IMPL_CYCLE_COLLECTION_ROOT_BEGIN(nsComputedDOMStyle) + NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER +NS_IMPL_CYCLE_COLLECTION_ROOT_END NS_IMPL_CYCLE_COLLECTION_UNLINK_0(nsComputedDOMStyle) +NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsComputedDOMStyle) + NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER +NS_IMPL_CYCLE_COLLECTION_TRACE_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsComputedDOMStyle) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mContent) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END // QueryInterface implementation for nsComputedDOMStyle -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsComputedDOMStyle) - NS_INTERFACE_MAP_ENTRY(nsIComputedDOMStyle) - NS_INTERFACE_MAP_ENTRY(nsICSSDeclaration) - NS_INTERFACE_MAP_ENTRY(nsIDOMCSSStyleDeclaration) +NS_INTERFACE_TABLE_HEAD(nsComputedDOMStyle) + NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY + NS_OFFSET_AND_INTERFACE_TABLE_BEGIN(nsComputedDOMStyle) + NS_INTERFACE_TABLE_ENTRY(nsComputedDOMStyle, nsICSSDeclaration) + NS_INTERFACE_TABLE_ENTRY(nsComputedDOMStyle, + nsIDOMCSSStyleDeclaration) + NS_INTERFACE_TABLE_ENTRY(nsComputedDOMStyle, nsISupports) + NS_OFFSET_AND_INTERFACE_TABLE_END + NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE + NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsComputedDOMStyle) NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMCSS2Properties, &mInner) NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMNSCSS2Properties, &mInner) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIComputedDOMStyle) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(ComputedCSSStyleDeclaration) NS_INTERFACE_MAP_END diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index 35a4d132b8b..178d7594ae4 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -41,7 +41,7 @@ #ifndef nsComputedDOMStyle_h__ #define nsComputedDOMStyle_h__ -#include "nsIComputedDOMStyle.h" +#include "nsICSSDeclaration.h" #include "nsROCSSPrimitiveValue.h" #include "nsDOMCSSDeclaration.h" @@ -57,11 +57,12 @@ #include "nsAutoPtr.h" #include "nsStyleStruct.h" -class nsComputedDOMStyle : public nsIComputedDOMStyle +class nsComputedDOMStyle : public nsICSSDeclaration, + public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_CLASS(nsComputedDOMStyle) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsComputedDOMStyle) NS_IMETHOD Init(nsIDOMElement *aElement, const nsAString& aPseudoElt, @@ -76,6 +77,11 @@ public: static void Shutdown(); + virtual nsISupports *GetParentObject() + { + return mContent; + } + private: void AssertFlushedPendingReflows() { NS_ASSERTION(mFlushedPendingReflows, @@ -448,5 +454,10 @@ private: #endif }; +nsresult +NS_NewComputedDOMStyle(nsIDOMElement *aElement, const nsAString &aPseudoElt, + nsIPresShell *aPresShell, + nsComputedDOMStyle **aComputedStyle); + #endif /* nsComputedDOMStyle_h__ */ diff --git a/layout/style/nsDOMCSSAttrDeclaration.cpp b/layout/style/nsDOMCSSAttrDeclaration.cpp index eafdce511c5..763bcb9cc74 100644 --- a/layout/style/nsDOMCSSAttrDeclaration.cpp +++ b/layout/style/nsDOMCSSAttrDeclaration.cpp @@ -52,14 +52,12 @@ #include "nsIPrincipal.h" nsDOMCSSAttributeDeclaration::nsDOMCSSAttributeDeclaration(nsIContent *aContent) + : mContent(aContent) { MOZ_COUNT_CTOR(nsDOMCSSAttributeDeclaration); - // This reference is not reference-counted. The content - // object tells us when its about to go away. NS_ASSERTION(aContent && aContent->IsNodeOfType(nsINode::eELEMENT), "Inline style for non-element content?"); - mContent = aContent; } nsDOMCSSAttributeDeclaration::~nsDOMCSSAttributeDeclaration() @@ -67,14 +65,32 @@ nsDOMCSSAttributeDeclaration::~nsDOMCSSAttributeDeclaration() MOZ_COUNT_DTOR(nsDOMCSSAttributeDeclaration); } -NS_IMPL_ADDREF(nsDOMCSSAttributeDeclaration) -NS_IMPL_RELEASE(nsDOMCSSAttributeDeclaration) +NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMCSSAttributeDeclaration) -void -nsDOMCSSAttributeDeclaration::DropReference() -{ - mContent = nsnull; -} +NS_IMPL_CYCLE_COLLECTION_ROOT_BEGIN(nsDOMCSSAttributeDeclaration) + NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER +NS_IMPL_CYCLE_COLLECTION_ROOT_END + +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMCSSAttributeDeclaration) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mContent) +NS_IMPL_CYCLE_COLLECTION_UNLINK_END + +NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDOMCSSAttributeDeclaration) + NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER +NS_IMPL_CYCLE_COLLECTION_TRACE_END + +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMCSSAttributeDeclaration) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mContent) +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END + +NS_INTERFACE_MAP_BEGIN(nsDOMCSSAttributeDeclaration) + NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY + NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsDOMCSSAttributeDeclaration) +NS_IMPL_QUERY_TAIL_INHERITING(nsDOMCSSDeclaration) + +NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCSSAttributeDeclaration) +NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCSSAttributeDeclaration) nsresult nsDOMCSSAttributeDeclaration::DeclarationChanged() diff --git a/layout/style/nsDOMCSSAttrDeclaration.h b/layout/style/nsDOMCSSAttrDeclaration.h index 39db0c8c507..46308dea9fe 100644 --- a/layout/style/nsDOMCSSAttrDeclaration.h +++ b/layout/style/nsDOMCSSAttrDeclaration.h @@ -40,26 +40,25 @@ #ifndef nsDOMCSSAttributeDeclaration_h___ #define nsDOMCSSAttributeDeclaration_h___ -#include "nsIDOMCSSStyleDeclaration.h" #include "nsDOMCSSDeclaration.h" #include "nsString.h" +#include "nsWrapperCache.h" +#include "nsIContent.h" -class nsIContent; class nsICSSLoader; class nsICSSParser; -class nsDOMCSSAttributeDeclaration : public nsDOMCSSDeclaration +class nsDOMCSSAttributeDeclaration : public nsDOMCSSDeclaration, + public nsWrapperCache { public: nsDOMCSSAttributeDeclaration(nsIContent *aContent); ~nsDOMCSSAttributeDeclaration(); - // impl AddRef/Release; QI is implemented by our parent class - NS_IMETHOD_(nsrefcnt) AddRef(void); - NS_IMETHOD_(nsrefcnt) Release(void); + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMCSSAttributeDeclaration) - virtual void DropReference(); // If GetCSSDeclaration returns non-null, then the decl it returns // is owned by our current style rule. virtual nsresult GetCSSDeclaration(nsCSSDeclaration **aDecl, @@ -71,13 +70,15 @@ public: nsICSSParser** aCSSParser); NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent); + virtual nsISupports *GetParentObject() + { + return mContent; + } + protected: virtual nsresult DeclarationChanged(); - nsAutoRefCnt mRefCnt; - NS_DECL_OWNINGTHREAD - - nsIContent *mContent; + nsCOMPtr mContent; }; #endif /* nsDOMCSSAttributeDeclaration_h___ */ diff --git a/layout/style/nsDOMCSSDeclaration.cpp b/layout/style/nsDOMCSSDeclaration.cpp index 45670460143..f668a4d7e2a 100644 --- a/layout/style/nsDOMCSSDeclaration.cpp +++ b/layout/style/nsDOMCSSDeclaration.cpp @@ -62,14 +62,15 @@ nsDOMCSSDeclaration::~nsDOMCSSDeclaration() { } - -// QueryInterface implementation for nsDOMCSSDeclaration -NS_INTERFACE_MAP_BEGIN(nsDOMCSSDeclaration) - NS_INTERFACE_MAP_ENTRY(nsICSSDeclaration) - NS_INTERFACE_MAP_ENTRY(nsIDOMCSSStyleDeclaration) +NS_INTERFACE_TABLE_HEAD(nsDOMCSSDeclaration) + NS_OFFSET_AND_INTERFACE_TABLE_BEGIN(nsDOMCSSDeclaration) + NS_INTERFACE_TABLE_ENTRY(nsDOMCSSDeclaration, nsICSSDeclaration) + NS_INTERFACE_TABLE_ENTRY(nsDOMCSSDeclaration, nsIDOMCSSStyleDeclaration) + NS_INTERFACE_TABLE_ENTRY(nsDOMCSSDeclaration, nsISupports) + NS_OFFSET_AND_INTERFACE_TABLE_END + NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMCSS2Properties, &mInner) NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMNSCSS2Properties, &mInner) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMCSSStyleDeclaration) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(CSSStyleDeclaration) NS_INTERFACE_MAP_END diff --git a/layout/style/nsDOMCSSDeclaration.h b/layout/style/nsDOMCSSDeclaration.h index 5be976fd001..147fd54727d 100644 --- a/layout/style/nsDOMCSSDeclaration.h +++ b/layout/style/nsDOMCSSDeclaration.h @@ -93,7 +93,6 @@ public: NS_IMETHOD Item(PRUint32 index, nsAString & _retval); NS_IMETHOD GetParentRule(nsIDOMCSSRule * *aParentRule) = 0; - virtual void DropReference() = 0; protected: // Always fills in the out parameter, even on failure, and if the out // parameter is null the nsresult will be the correct thing to diff --git a/layout/style/nsICSSDeclaration.h b/layout/style/nsICSSDeclaration.h index e000be39a1a..02705638d9d 100644 --- a/layout/style/nsICSSDeclaration.h +++ b/layout/style/nsICSSDeclaration.h @@ -84,6 +84,8 @@ public: */ NS_IMETHOD SetPropertyValue(const nsCSSProperty aPropID, const nsAString& aValue) = 0; + + virtual nsISupports *GetParentObject() = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsICSSDeclaration, NS_ICSSDECLARATION_IID) diff --git a/layout/style/nsIComputedDOMStyle.h b/layout/style/nsIComputedDOMStyle.h deleted file mode 100644 index c7b000e07f9..00000000000 --- a/layout/style/nsIComputedDOMStyle.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1999 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/* DOM object returned from element.getComputedStyle() */ - -#ifndef nsIComputedDOMStyle_h___ -#define nsIComputedDOMStyle_h___ - -#include "nsICSSDeclaration.h" - -class nsIDOMElement; -class nsIPresShell; - -#define NS_ICOMPUTEDDOMSTYLE_IID \ - { 0x5f0197a1, 0xa873, 0x44e5, \ - {0x96, 0x31, 0xac, 0xd6, 0xca, 0xb4, 0xf1, 0xe0 } } - -class nsIComputedDOMStyle : public nsICSSDeclaration -{ -public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICOMPUTEDDOMSTYLE_IID) - - NS_IMETHOD Init(nsIDOMElement *aElement, const nsAString& aPseudoElt, - nsIPresShell *aPresShell) = 0; -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIComputedDOMStyle, NS_ICOMPUTEDDOMSTYLE_IID) - -nsresult -NS_NewComputedDOMStyle(nsIComputedDOMStyle** aComputedStyle); - -#endif /* nsIComputedDOMStyle_h___ */