Issue #2490 - Part 11: Convert CSSImportRule to WebIDL.

Note that the .media PutForwards is a new feature coming along for the ride, now
that we're using the spec IDL.
This commit is contained in:
Moonchild 2024-04-03 13:22:41 +02:00 committed by roytam1
commit 525606c15d
9 changed files with 38 additions and 40 deletions

View file

@ -34,6 +34,7 @@
#include "nsDOMClassInfoID.h"
#include "mozilla/dom/CSSStyleDeclarationBinding.h"
#include "mozilla/dom/CSSNamespaceRuleBinding.h"
#include "mozilla/dom/CSSImportRuleBinding.h"
#include "StyleRule.h"
#include "nsFont.h"
#include "nsIURI.h"
@ -242,7 +243,7 @@ ImportRule::ImportRule(nsMediaList* aMedia, const nsString& aURLSpec,
, mURLSpec(aURLSpec)
, mMedia(aMedia)
{
SetIsNotDOMBinding();
MOZ_ASSERT(aMedia);
// XXXbz This is really silly.... the mMedia here will be replaced
// with itself if we manage to load a sheet. Which should really
// never fail nowadays, in sane cases.
@ -252,7 +253,6 @@ ImportRule::ImportRule(const ImportRule& aCopy)
: Rule(aCopy),
mURLSpec(aCopy.mURLSpec)
{
SetIsNotDOMBinding();
// Whether or not an @import rule has a null sheet is a permanent
// property of that @import rule, since it is null only if the target
// sheet failed security checks.
@ -284,7 +284,6 @@ ImportRule::IsCCLeaf() const
// QueryInterface implementation for ImportRule
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(ImportRule)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSImportRule)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSImportRule)
NS_INTERFACE_MAP_END_INHERITING(Rule)
NS_IMPL_CYCLE_COLLECTION_CLASS(ImportRule)
@ -373,6 +372,12 @@ ImportRule::GetCssTextImpl(nsAString& aCssText) const
aCssText.Append(';');
}
StyleSheet*
ImportRule::GetStyleSheet() const
{
return mChildSheet;
}
NS_IMETHODIMP
ImportRule::GetHref(nsAString & aHref)
{
@ -385,7 +390,7 @@ ImportRule::GetMedia(nsIDOMMediaList * *aMedia)
{
NS_ENSURE_ARG_POINTER(aMedia);
NS_IF_ADDREF(*aMedia = mMedia);
NS_ADDREF(*aMedia = mMedia);
return NS_OK;
}
@ -416,8 +421,7 @@ ImportRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
ImportRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
return CSSImportRuleBinding::Wrap(aCx, this, aGivenProto);
}
GroupRule::GroupRule(uint32_t aLineNumber, uint32_t aColumnNumber)