Bug 851892 part 17. Convert CSSKeyframeRule to WebIDL. r=peterv,heycam

This commit is contained in:
Boris Zbarsky 2017-01-13 10:41:04 -05:00
Родитель 31b541487b
Коммит 7659de2826
8 изменённых файлов: 33 добавлений и 19 удалений

Просмотреть файл

@ -74,7 +74,6 @@
#include "nsMemory.h"
// includes needed for the prototype chain interfaces
#include "nsIDOMCSSKeyframeRule.h"
#include "nsIDOMCSSKeyframesRule.h"
#include "nsIDOMCSSCounterStyleRule.h"
#include "nsIDOMXULCommandDispatcher.h"
@ -220,9 +219,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSKeyframeRule, nsCSSRuleSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS |
nsIXPCScriptable::WANT_PRECREATE)
NS_DEFINE_CLASSINFO_DATA(CSSKeyframesRule, nsCSSRuleSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS |
nsIXPCScriptable::WANT_PRECREATE)
@ -546,11 +542,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)

Просмотреть файл

@ -39,7 +39,6 @@ enum nsDOMClassInfoID
eDOMClassInfo_ChromeMessageBroadcaster_id,
eDOMClassInfo_ChromeMessageSender_id,
eDOMClassInfo_CSSKeyframeRule_id,
eDOMClassInfo_CSSKeyframesRule_id,
// @counter-style in CSS

Просмотреть файл

@ -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;
void SetIsNotDOMBinding()

Просмотреть файл

@ -221,6 +221,11 @@ DOMInterfaces = {
'nativeType': 'mozilla::css::ImportRule',
},
'CSSKeyframeRule': {
'nativeType': 'nsCSSKeyframeRule',
'headerFile': 'nsCSSRules.h',
},
'CSSLexer': {
'wrapperCache': False
},

Просмотреть файл

@ -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;
};

Просмотреть файл

@ -94,6 +94,7 @@ WEBIDL_FILES = [
'CSSFontFeatureValuesRule.webidl',
'CSSGroupingRule.webidl',
'CSSImportRule.webidl',
'CSSKeyframeRule.webidl',
'CSSLexer.webidl',
'CSSMediaRule.webidl',
'CSSMozDocumentRule.webidl',

Просмотреть файл

@ -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"
@ -2005,7 +2006,6 @@ nsCSSKeyframeRule::nsCSSKeyframeRule(const nsCSSKeyframeRule& aCopy)
, mKeys(aCopy.mKeys)
, mDeclaration(new css::Declaration(*aCopy.mDeclaration))
{
SetIsNotDOMBinding();
mDeclaration->SetOwningRule(this);
}
@ -2044,7 +2044,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
// 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
@ -2142,12 +2141,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
@ -2189,8 +2194,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);
}
// -------------------------------------------

Просмотреть файл

@ -415,7 +415,6 @@ public:
, mKeys(mozilla::Move(aKeys))
, mDeclaration(mozilla::Move(aDeclaration))
{
SetIsNotDOMBinding();
mDeclaration->SetOwningRule(this);
}
private:
@ -438,6 +437,9 @@ public:
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
// The XPCOM GetKeyText is fine.
// The XPCOM SetKeyText is fine.
nsICSSDeclaration* Style();
const nsTArray<float>& GetKeys() const { return mKeys; }
mozilla::css::Declaration* Declaration() { return mDeclaration; }