Issue #2490 - Part 9b: Add a CSSRule Web IDL interface.

Fix Paris bindings by providing a temporary IID for nsIDOMCSSRule
(thanks FranklinDM!)
This commit is contained in:
Moonchild 2024-04-01 14:42:27 +02:00 committed by roytam1
commit 264f152ba0
3 changed files with 9 additions and 36 deletions

View file

@ -206,7 +206,7 @@ DOMInterfaces = {
},
'CSSRule': {
# 'hasXPConnectImpls': True,
'hasXPConnectImpls': True,
'nativeType': 'mozilla::css::Rule'
},

View file

@ -19,6 +19,11 @@ struct nsRuleData;
template<class T> 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<JSObject*> src, css::Rule** ppArg);
} // namepace dom
} // namespace mozilla
#endif /* mozilla_css_Rule_h___ */

View file

@ -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<JSObject*> src, css::Rule** ppArg)
{
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIDOMCSSRule> 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 {