diff --git a/dom/src/base/Makefile.in b/dom/src/base/Makefile.in index 41c4621d702d..0820083d8fa3 100644 --- a/dom/src/base/Makefile.in +++ b/dom/src/base/Makefile.in @@ -109,4 +109,6 @@ FORCE_STATIC_LIB = 1 LOCAL_INCLUDES = -I$(srcdir)/../events +DEFINES += -D_IMPL_NS_LAYOUT + include $(topsrcdir)/config/rules.mk diff --git a/dom/src/base/nsDOMClassInfo.cpp b/dom/src/base/nsDOMClassInfo.cpp index 502aeefc8496..5bb4b58402a4 100644 --- a/dom/src/base/nsDOMClassInfo.cpp +++ b/dom/src/base/nsDOMClassInfo.cpp @@ -176,7 +176,9 @@ #include "nsIDOMElement.h" #include "nsIDOMCSSStyleDeclaration.h" #include "nsIScriptGlobalObject.h" - +#include "nsStyleSet.h" +#include "nsStyleContext.h" +#include "nsAutoPtr.h" // includes needed for the prototype chain interfaces #include "nsIDOMNavigator.h" @@ -4883,12 +4885,11 @@ nsElementSH::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx, shell->GetPresContext(getter_AddRefs(pctx)); NS_ENSURE_TRUE(pctx, NS_ERROR_UNEXPECTED); - // XXX this is a hack so that we don't take a performance hit by using - // the DOM computed style API. We can get rid of this hack if we merge - // the jsdom library with layout. + nsRefPtr sc = pctx->StyleSet()->ResolveStyleFor(content, + nsnull); + NS_ENSURE_TRUE(sc, NS_ERROR_FAILURE); - nsCOMPtr bindingURL; - pctx->GetXBLBindingURL(content, getter_AddRefs(bindingURL)); + nsIURI *bindingURL = sc->GetStyleDisplay()->mBinding; if (!bindingURL) { // No binding, nothing left to do here. return NS_OK; diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 107843809329..6e7b129c885b 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -856,18 +856,6 @@ nsPresContext::SetImageAnimationMode(PRUint16 aMode) mImageAnimationMode = aMode; } -nsresult -nsPresContext::GetXBLBindingURL(nsIContent* aContent, nsIURI** aResult) -{ - nsRefPtr sc; - sc = StyleSet()->ResolveStyleFor(aContent, nsnull); - NS_ENSURE_TRUE(sc, NS_ERROR_FAILURE); - - *aResult = sc->GetStyleDisplay()->mBinding; - NS_IF_ADDREF(*aResult); - return NS_OK; -} - NS_IMETHODIMP nsPresContext::GetMetricsFor(const nsFont& aFont, nsIFontMetrics** aResult) { diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index a359678ecc72..f33b591aea82 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -78,8 +78,8 @@ class nsIRenderingContext; #endif #define NS_IPRESCONTEXT_IID \ -{ 0x2820eeff, 0x7e66, 0x43df, \ - {0xae, 0x19, 0xee, 0xf6, 0x09, 0xc1, 0xcf, 0xfe} } +{ 0xa394329f, 0x3b10, 0x49ac, \ + {0x8f, 0xf2, 0xeb, 0x0b, 0x66, 0x93, 0x82, 0x38} } enum nsWidgetType { eWidgetType_Button = 1, @@ -175,13 +175,6 @@ public: */ virtual void ClearStyleDataAndReflow() = 0; - /** - * Resolve a new style context for a content node and return the URL - * for its XBL binding, or null if it has no binding specified in CSS. - */ - virtual nsresult GetXBLBindingURL(nsIContent* aContent, - nsIURI** aResult) = 0; - void* AllocateFromShell(size_t aSize) { if (mShell) diff --git a/layout/base/public/nsIPresContext.h b/layout/base/public/nsIPresContext.h index a359678ecc72..f33b591aea82 100644 --- a/layout/base/public/nsIPresContext.h +++ b/layout/base/public/nsIPresContext.h @@ -78,8 +78,8 @@ class nsIRenderingContext; #endif #define NS_IPRESCONTEXT_IID \ -{ 0x2820eeff, 0x7e66, 0x43df, \ - {0xae, 0x19, 0xee, 0xf6, 0x09, 0xc1, 0xcf, 0xfe} } +{ 0xa394329f, 0x3b10, 0x49ac, \ + {0x8f, 0xf2, 0xeb, 0x0b, 0x66, 0x93, 0x82, 0x38} } enum nsWidgetType { eWidgetType_Button = 1, @@ -175,13 +175,6 @@ public: */ virtual void ClearStyleDataAndReflow() = 0; - /** - * Resolve a new style context for a content node and return the URL - * for its XBL binding, or null if it has no binding specified in CSS. - */ - virtual nsresult GetXBLBindingURL(nsIContent* aContent, - nsIURI** aResult) = 0; - void* AllocateFromShell(size_t aSize) { if (mShell) diff --git a/layout/base/public/nsPresContext.h b/layout/base/public/nsPresContext.h index a359678ecc72..f33b591aea82 100644 --- a/layout/base/public/nsPresContext.h +++ b/layout/base/public/nsPresContext.h @@ -78,8 +78,8 @@ class nsIRenderingContext; #endif #define NS_IPRESCONTEXT_IID \ -{ 0x2820eeff, 0x7e66, 0x43df, \ - {0xae, 0x19, 0xee, 0xf6, 0x09, 0xc1, 0xcf, 0xfe} } +{ 0xa394329f, 0x3b10, 0x49ac, \ + {0x8f, 0xf2, 0xeb, 0x0b, 0x66, 0x93, 0x82, 0x38} } enum nsWidgetType { eWidgetType_Button = 1, @@ -175,13 +175,6 @@ public: */ virtual void ClearStyleDataAndReflow() = 0; - /** - * Resolve a new style context for a content node and return the URL - * for its XBL binding, or null if it has no binding specified in CSS. - */ - virtual nsresult GetXBLBindingURL(nsIContent* aContent, - nsIURI** aResult) = 0; - void* AllocateFromShell(size_t aSize) { if (mShell) diff --git a/layout/base/src/nsPresContext.cpp b/layout/base/src/nsPresContext.cpp index 107843809329..6e7b129c885b 100644 --- a/layout/base/src/nsPresContext.cpp +++ b/layout/base/src/nsPresContext.cpp @@ -856,18 +856,6 @@ nsPresContext::SetImageAnimationMode(PRUint16 aMode) mImageAnimationMode = aMode; } -nsresult -nsPresContext::GetXBLBindingURL(nsIContent* aContent, nsIURI** aResult) -{ - nsRefPtr sc; - sc = StyleSet()->ResolveStyleFor(aContent, nsnull); - NS_ENSURE_TRUE(sc, NS_ERROR_FAILURE); - - *aResult = sc->GetStyleDisplay()->mBinding; - NS_IF_ADDREF(*aResult); - return NS_OK; -} - NS_IMETHODIMP nsPresContext::GetMetricsFor(const nsFont& aFont, nsIFontMetrics** aResult) { diff --git a/layout/base/src/nsPresContext.h b/layout/base/src/nsPresContext.h index c5ebd7e6bbc9..29b2b3a8c285 100644 --- a/layout/base/src/nsPresContext.h +++ b/layout/base/src/nsPresContext.h @@ -71,7 +71,6 @@ public: virtual void SetImageAnimationMode(PRUint16 aMode); virtual void ClearStyleDataAndReflow(); - virtual nsresult GetXBLBindingURL(nsIContent* aContent, nsIURI** aResult); NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics** aResult); virtual const nsFont* GetDefaultFont(PRUint8 aFontID) const;