Issue #2490 - Part 15: Convert CSSFontFaceRule to WebIDL.

The .style PutForwards bit is coming along for the ride here as a new feature.
This commit is contained in:
Moonchild 2024-04-04 10:02:17 +02:00 • committed by roytam1
commit 50f8c18757
8 changed files with 30 additions and 20 deletions

View file

@ -74,7 +74,6 @@
// includes needed for the prototype chain interfaces
#include "nsIDOMCSSKeyframeRule.h"
#include "nsIDOMCSSKeyframesRule.h"
#include "nsIDOMCSSFontFaceRule.h"
#include "nsIDOMCSSCounterStyleRule.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIControllers.h"
@ -204,10 +203,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
DEFAULT_SCRIPTABLE_FLAGS)
#endif
NS_DEFINE_CLASSINFO_DATA(CSSFontFaceRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS |
nsIXPCScriptable::WANT_PRECREATE)
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentFrameMessageManager,
nsMessageManagerSH<nsEventTargetSH>,
DOM_DEFAULT_SCRIPTABLE_FLAGS |
@ -524,11 +519,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_END
#endif
DOM_CLASSINFO_MAP_BEGIN(CSSFontFaceRule, nsIDOMCSSFontFaceRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSFontFaceRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ContentFrameMessageManager, nsISupports)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIMessageListenerManager)

View file

@ -22,9 +22,6 @@ DOMCI_CLASS(XULTemplateBuilder)
DOMCI_CLASS(XULTreeBuilder)
#endif
// @font-face in CSS
DOMCI_CLASS(CSSFontFaceRule)
DOMCI_CLASS(ContentFrameMessageManager)
DOMCI_CLASS(ContentProcessMessageManager)
DOMCI_CLASS(ChromeMessageBroadcaster)

View file

@ -23,7 +23,6 @@ class ProcessGlobal;
class SandboxPrivate;
class nsInProcessTabChildGlobal;
class nsWindowRoot;
class nsCSSFontFaceRule;
class nsCSSFontFeatureValuesRule;
class nsCSSKeyframeRule;
class nsCSSKeyframesRule;
@ -285,7 +284,6 @@ private:
friend class SandboxPrivate;
friend class nsInProcessTabChildGlobal;
friend class nsWindowRoot;
friend class nsCSSFontFaceRule;
friend class nsCSSFontFeatureValuesRule;
friend class nsCSSKeyframeRule;
friend class nsCSSKeyframesRule;

View file

@ -203,6 +203,11 @@ DOMInterfaces = {
'headerFile': 'mozilla/css/GroupRule.h',
},
'CSSFontFaceRule': {
'nativeType': 'nsCSSFontFaceRule',
'headerFile': 'nsCSSRules.h',
},
'CSSGroupingRule': {
'concrete': False,
'nativeType': 'mozilla::css::GroupRule',

View file

@ -0,0 +1,15 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-fonts/#om-fontface
*/
// https://drafts.csswg.org/css-fonts/#om-fontface
// But we implement a very old draft, apparently....
// See bug 1058408 for implementing the current spec.
interface CSSFontFaceRule : CSSRule {
[SameObject] readonly attribute CSSStyleDeclaration style;
};

View file

@ -91,6 +91,7 @@ WEBIDL_FILES = [
'CSS.webidl',
'CSSAnimation.webidl',
'CSSConditionRule.webidl',
'CSSFontFaceRule.webidl',
'CSSGroupingRule.webidl',
'CSSImportRule.webidl',
'CSSLexer.webidl',

View file

@ -39,6 +39,7 @@
#include "mozilla/dom/CSSSupportsRuleBinding.h"
#include "mozilla/dom/CSSMozDocumentRuleBinding.h"
#include "mozilla/dom/CSSPageRuleBinding.h"
#include "mozilla/dom/CSSFontFaceRuleBinding.h"
#include "StyleRule.h"
#include "nsFont.h"
#include "nsIURI.h"
@ -1668,7 +1669,6 @@ nsCSSFontFaceRule::IsCCLeaf() const
// QueryInterface implementation for nsCSSFontFaceRule
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsCSSFontFaceRule)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSFontFaceRule)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSFontFaceRule)
NS_INTERFACE_MAP_END_INHERITING(Rule)
#ifdef DEBUG
@ -1724,6 +1724,12 @@ nsCSSFontFaceRule::GetCssTextImpl(nsAString& aCssText) const
aCssText.Append('}');
}
nsICSSDeclaration*
nsCSSFontFaceRule::Style()
{
return &mDecl;
}
NS_IMETHODIMP
nsCSSFontFaceRule::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
{
@ -1768,8 +1774,7 @@ nsCSSFontFaceRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
nsCSSFontFaceRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
return CSSFontFaceRuleBinding::Wrap(aCx, this, aGivenProto);
}
// -----------------------------------

View file

@ -248,7 +248,6 @@ public:
nsCSSFontFaceRule(uint32_t aLineNumber, uint32_t aColumnNumber)
: mozilla::css::Rule(aLineNumber, aColumnNumber)
{
SetIsNotDOMBinding();
}
nsCSSFontFaceRule(const nsCSSFontFaceRule& aCopy)
@ -256,7 +255,6 @@ public:
: mozilla::css::Rule(aCopy)
, mDecl(aCopy.mDecl)
{
SetIsNotDOMBinding();
}
NS_DECL_ISUPPORTS_INHERITED
@ -279,6 +277,7 @@ public:
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
nsICSSDeclaration* Style();
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;