Issue #2490 - Part 17: Convert CSSKeyframeRule to WebIDL.

This commit is contained in:
Moonchild
2024-04-04 14:00:59 +02:00
committed by roytam1
parent f0de637255
commit 89d96e0226
8 changed files with 33 additions and 18 deletions
-8
View File
@@ -219,9 +219,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSKeyframeRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS |
nsIXPCScriptable::WANT_PRECREATE)
NS_DEFINE_CLASSINFO_DATA(CSSKeyframesRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS |
nsIXPCScriptable::WANT_PRECREATE)
@@ -546,11 +543,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIMessageSender)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSKeyframeRule, nsIDOMCSSKeyframeRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSKeyframeRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSKeyframesRule, nsIDOMCSSKeyframesRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSKeyframesRule)
-1
View File
@@ -27,7 +27,6 @@ DOMCI_CLASS(ContentProcessMessageManager)
DOMCI_CLASS(ChromeMessageBroadcaster)
DOMCI_CLASS(ChromeMessageSender)
DOMCI_CLASS(CSSKeyframeRule)
DOMCI_CLASS(CSSKeyframesRule)
// @counter-style in CSS
-2
View File
@@ -23,7 +23,6 @@ class ProcessGlobal;
class SandboxPrivate;
class nsInProcessTabChildGlobal;
class nsWindowRoot;
class nsCSSKeyframeRule;
class nsCSSKeyframesRule;
class nsCSSCounterStyleRule;
@@ -283,7 +282,6 @@ private:
friend class SandboxPrivate;
friend class nsInProcessTabChildGlobal;
friend class nsWindowRoot;
friend class nsCSSKeyframeRule;
friend class nsCSSKeyframesRule;
friend class nsCSSCounterStyleRule;
+5
View File
@@ -222,6 +222,11 @@ DOMInterfaces = {
'nativeType': 'mozilla::css::ImportRule',
},
'CSSKeyframeRule': {
'nativeType': 'nsCSSKeyframeRule',
'headerFile': 'nsCSSRules.h',
},
'CSSLexer': {
'wrapperCache': False
},
+14
View File
@@ -0,0 +1,14 @@
/* -*- 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-animations/#interface-csskeyframerule
*/
// https://drafts.csswg.org/css-animations/#interface-csskeyframerule
interface CSSKeyframeRule : CSSRule {
attribute DOMString keyText;
readonly attribute CSSStyleDeclaration style;
};
+1
View File
@@ -95,6 +95,7 @@ WEBIDL_FILES = [
'CSSFontFeatureValuesRule.webidl',
'CSSGroupingRule.webidl',
'CSSImportRule.webidl',
'CSSKeyframeRule.webidl',
'CSSLexer.webidl',
'CSSMediaRule.webidl',
'CSSMozDocumentRule.webidl',
+10 -6
View File
@@ -41,6 +41,7 @@
#include "mozilla/dom/CSSPageRuleBinding.h"
#include "mozilla/dom/CSSFontFaceRuleBinding.h"
#include "mozilla/dom/CSSFontFeatureValuesRuleBinding.h"
#include "mozilla/dom/CSSKeyframeRuleBinding.h"
#include "StyleRule.h"
#include "nsFont.h"
#include "nsIURI.h"
@@ -2103,7 +2104,6 @@ nsCSSKeyframeRule::nsCSSKeyframeRule(const nsCSSKeyframeRule& aCopy)
, mKeys(aCopy.mKeys)
, mDeclaration(new css::Declaration(*aCopy.mDeclaration))
{
SetIsNotDOMBinding();
mDeclaration->SetOwningRule(this);
}
@@ -2148,7 +2148,6 @@ nsCSSKeyframeRule::IsCCLeaf() const
// QueryInterface implementation for nsCSSKeyframeRule
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsCSSKeyframeRule)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSKeyframeRule)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSKeyframeRule)
NS_INTERFACE_MAP_END_INHERITING(mozilla::css::Rule)
#ifdef DEBUG
@@ -2248,12 +2247,18 @@ nsCSSKeyframeRule::SetKeyText(const nsAString& aKeyText)
NS_IMETHODIMP
nsCSSKeyframeRule::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
{
NS_ADDREF(*aStyle = Style());
return NS_OK;
}
nsICSSDeclaration*
nsCSSKeyframeRule::Style()
{
if (!mDOMDeclaration) {
mDOMDeclaration = new nsCSSKeyframeStyleDeclaration(this);
}
NS_ADDREF(*aStyle = mDOMDeclaration);
return NS_OK;
return mDOMDeclaration;
}
void
@@ -2297,8 +2302,7 @@ nsCSSKeyframeRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
nsCSSKeyframeRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
return CSSKeyframeRuleBinding::Wrap(aCx, this, aGivenProto);
}
// -------------------------------------------
+3 -1
View File
@@ -416,7 +416,6 @@ public:
, mKeys(mozilla::Move(aKeys))
, mDeclaration(mozilla::Move(aDeclaration))
{
SetIsNotDOMBinding();
mDeclaration->SetOwningRule(this);
}
private:
@@ -440,6 +439,9 @@ public:
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
// Our XPCOM GetKeyText is OK.
// Our XPCOM SetKeyText is OK.
nsICSSDeclaration* Style();
const nsTArray<float>& GetKeys() const { return mKeys; }
mozilla::css::Declaration* Declaration() { return mDeclaration; }