From 264f152ba07ea85331000c470920e2b7bd7ad7a5 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Mon, 1 Apr 2024 14:42:27 +0200 Subject: [PATCH] Issue #2490 - Part 9b: Add a CSSRule Web IDL interface. Fix Paris bindings by providing a temporary IID for nsIDOMCSSRule (thanks FranklinDM!) --- dom/bindings/Bindings.conf | 2 +- layout/style/Rule.h | 22 ++++++++-------------- layout/style/nsCSSRules.cpp | 21 --------------------- 3 files changed, 9 insertions(+), 36 deletions(-) diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index 33c812a542..43dfb627da 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -206,7 +206,7 @@ DOMInterfaces = { }, 'CSSRule': { -# 'hasXPConnectImpls': True, + 'hasXPConnectImpls': True, 'nativeType': 'mozilla::css::Rule' }, diff --git a/layout/style/Rule.h b/layout/style/Rule.h index ea6ca79f29..3537bad449 100644 --- a/layout/style/Rule.h +++ b/layout/style/Rule.h @@ -19,6 +19,11 @@ struct nsRuleData; template struct already_AddRefed; class nsHTMLCSSStyleSheet; +// Temporary IID for the nsIDOMCSSRule interface {ebb427f1-a935-480b-bd9b-bb0e3bd387a9} +#define NS_IDOM_CSSRULE_IID \ +{ 0xebb427f1, 0xa935, 0x480b, \ + { 0xbd, 0x9b, 0xbb, 0x0e, 0x3b, 0xd3, 0x87, 0xa9 } } + namespace mozilla { namespace css { class GroupRule; @@ -46,6 +51,7 @@ protected: virtual ~Rule() {} public: + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOM_CSSRULE_IID) NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(Rule) @@ -139,21 +145,9 @@ protected: uint32_t mColumnNumber; }; +NS_DEFINE_STATIC_IID_ACCESSOR(Rule, NS_IDOM_CSSRULE_IID) + } // namespace css } // namespace mozilla -// Specialization of the bindings UnwrapArg setup for css::Rule, so we can avoid -// adding an IID to css::Rule. This can go away once all css::Rule subclasses -// are on WebIDL bindings. - -#include "js/TypeDecls.h" - -namespace mozilla { -namespace dom { -template <> -nsresult -UnwrapArg(JS::Handle src, css::Rule** ppArg); -} // namepace dom -} // namespace mozilla - #endif /* mozilla_css_Rule_h___ */ diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp index e30cddc03e..6ae33fc776 100644 --- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -45,27 +45,6 @@ using namespace mozilla::dom; // base class for all rule types in a CSS style sheet -// Temporary code that can go away once all css::Rules are on WebIDL bindings. -#include "xpcpublic.h" -namespace mozilla { -namespace dom { -template<> -nsresult -UnwrapArg(JS::Handle src, css::Rule** ppArg) -{ - MOZ_ASSERT(NS_IsMainThread()); - nsCOMPtr rule = - do_QueryInterface(xpc::UnwrapReflectorToISupports(src)); - if (!rule) { - return NS_NOINTERFACE; - } - *ppArg = rule->GetCSSRule(); - NS_ADDREF(*ppArg); - return NS_OK; -} -} // namespace dom -} // namespace mozilla - namespace mozilla { namespace css {