Bug 1427512 - Part 10: Remove nsIDOMCSSKeyframesRule. r=xidorn

MozReview-Commit-ID: 1U6Jd0Y6AlR
This commit is contained in:
Cameron McCormack 2018-01-11 16:17:55 +08:00
Родитель 457039956c
Коммит ba47c98383
8 изменённых файлов: 26 добавлений и 104 удалений

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

@ -10,7 +10,6 @@ with Files("**"):
XPIDL_SOURCES += [
'nsIDOMCounter.idl',
'nsIDOMCSSKeyframeRule.idl',
'nsIDOMCSSKeyframesRule.idl',
'nsIDOMCSSPageRule.idl',
'nsIDOMCSSPrimitiveValue.idl',
'nsIDOMCSSRule.idl',

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

@ -1,20 +0,0 @@
/* -*- 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/. */
#include "nsISupports.idl"
interface nsIDOMCSSRuleList;
interface nsIDOMCSSKeyframeRule;
[scriptable, uuid(400f4b70-ad0a-4047-aba4-ee8019f6b907)]
interface nsIDOMCSSKeyframesRule : nsISupports
{
attribute DOMString name;
readonly attribute nsIDOMCSSRuleList cssRules;
void appendRule(in DOMString rule);
void deleteRule(in DOMString key);
nsIDOMCSSKeyframeRule findRule(in DOMString key);
};

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

@ -11,29 +11,6 @@
namespace mozilla {
namespace dom {
NS_IMPL_ADDREF_INHERITED(CSSKeyframesRule, css::GroupRule)
NS_IMPL_RELEASE_INHERITED(CSSKeyframesRule, css::GroupRule)
// QueryInterface implementation for CSSKeyframesRule
NS_INTERFACE_MAP_BEGIN(CSSKeyframesRule)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSKeyframesRule)
NS_INTERFACE_MAP_END_INHERITING(GroupRule)
NS_IMETHODIMP
CSSKeyframesRule::GetCssRules(nsIDOMCSSRuleList** aRuleList)
{
NS_ADDREF(*aRuleList = CssRules());
return NS_OK;
}
NS_IMETHODIMP
CSSKeyframesRule::FindRule(const nsAString& aKey,
nsIDOMCSSKeyframeRule** aResult)
{
NS_IF_ADDREF(*aResult = FindRule(aKey));
return NS_OK;
}
/* virtual */ bool
CSSKeyframesRule::UseForPresentation(nsPresContext* aPresContext,
nsMediaQueryResultCacheKey& aKey)

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

@ -8,7 +8,6 @@
#define mozilla_dom_CSSKeyframesRule_h
#include "mozilla/css/GroupRule.h"
#include "nsIDOMCSSKeyframesRule.h"
#include "mozilla/dom/CSSKeyframeRule.h"
@ -16,30 +15,22 @@ namespace mozilla {
namespace dom {
class CSSKeyframesRule : public css::GroupRule
, public nsIDOMCSSKeyframesRule
{
protected:
using css::GroupRule::GroupRule;
virtual ~CSSKeyframesRule() {}
public:
NS_DECL_ISUPPORTS_INHERITED
int32_t GetType() const final { return Rule::KEYFRAMES_RULE; }
using Rule::GetType;
// nsIDOMCSSKeyframesRule interface
NS_IMETHOD GetCssRules(nsIDOMCSSRuleList** aRuleList) final;
NS_IMETHOD FindRule(const nsAString& aKey,
nsIDOMCSSKeyframeRule** aResult) final;
// WebIDL interface
uint16_t Type() const final { return nsIDOMCSSRule::KEYFRAMES_RULE; }
// The XPCOM GetName is OK
// The XPCOM SetName is OK
virtual void GetName(nsAString& aName) const = 0;
virtual void SetName(const nsAString& aName) = 0;
virtual CSSRuleList* CssRules() = 0;
// The XPCOM appendRule is OK, since it never throws
using nsIDOMCSSKeyframesRule::DeleteRule;
virtual void AppendRule(const nsAString& aRule) = 0;
virtual void DeleteRule(const nsAString& aKey) = 0;
virtual CSSKeyframeRule* FindRule(const nsAString& aKey) = 0;
bool UseForPresentation(nsPresContext* aPresContext,

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

@ -256,36 +256,34 @@ ServoKeyframesRule::UpdateRule(Func aCallback)
}
}
NS_IMETHODIMP
ServoKeyframesRule::GetName(nsAString& aName)
void
ServoKeyframesRule::GetName(nsAString& aName) const
{
nsAtom* name = Servo_KeyframesRule_GetName(mRawRule);
aName = nsDependentAtomString(name);
return NS_OK;
}
NS_IMETHODIMP
void
ServoKeyframesRule::SetName(const nsAString& aName)
{
RefPtr<nsAtom> name = NS_Atomize(aName);
nsAtom* oldName = Servo_KeyframesRule_GetName(mRawRule);
if (name == oldName) {
return NS_OK;
return;
}
UpdateRule([this, &name]() {
Servo_KeyframesRule_SetName(mRawRule, name.forget().take());
});
return NS_OK;
}
NS_IMETHODIMP
void
ServoKeyframesRule::AppendRule(const nsAString& aRule)
{
StyleSheet* sheet = GetStyleSheet();
if (!sheet) {
// We cannot parse the rule if we don't have a stylesheet.
return NS_OK;
return;
}
NS_ConvertUTF16toUTF8 rule(aRule);
@ -296,15 +294,14 @@ ServoKeyframesRule::AppendRule(const nsAString& aRule)
mKeyframeList->AppendRule();
}
});
return NS_OK;
}
NS_IMETHODIMP
void
ServoKeyframesRule::DeleteRule(const nsAString& aKey)
{
auto index = FindRuleIndexForKey(aKey);
if (index == kRuleNotFound) {
return NS_OK;
return;
}
UpdateRule([this, index]() {
@ -313,7 +310,6 @@ ServoKeyframesRule::DeleteRule(const nsAString& aKey)
mKeyframeList->RemoveRule(index);
}
});
return NS_OK;
}
/* virtual */ void

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

@ -31,16 +31,13 @@ public:
#endif
void SetStyleSheet(StyleSheet* aSheet) final;
// nsIDOMCSSKeyframesRule interface
NS_IMETHOD GetName(nsAString& aName) final;
NS_IMETHOD SetName(const nsAString& aName) final;
NS_IMETHOD AppendRule(const nsAString& aRule) final;
NS_IMETHOD DeleteRule(const nsAString& aKey) final;
using nsIDOMCSSKeyframesRule::FindRule;
// WebIDL interface
void GetCssTextImpl(nsAString& aCssText) const final;
void GetName(nsAString& aName) const final;
void SetName(const nsAString& aName) final;
dom::CSSRuleList* CssRules() final;
void AppendRule(const nsAString& aRule) final;
void DeleteRule(const nsAString& aKey) final;
dom::CSSKeyframeRule* FindRule(const nsAString& aKey) final;
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const final;

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

@ -1109,13 +1109,6 @@ nsCSSKeyframesRule::Clone() const
return clone.forget();
}
NS_IMPL_ADDREF_INHERITED(nsCSSKeyframesRule, dom::CSSKeyframesRule)
NS_IMPL_RELEASE_INHERITED(nsCSSKeyframesRule, dom::CSSKeyframesRule)
// QueryInterface implementation for nsCSSKeyframesRule
NS_INTERFACE_MAP_BEGIN(nsCSSKeyframesRule)
NS_INTERFACE_MAP_END_INHERITING(dom::CSSKeyframesRule)
#ifdef DEBUG
void
nsCSSKeyframesRule::List(FILE* out, int32_t aIndent) const
@ -1149,18 +1142,17 @@ nsCSSKeyframesRule::GetCssTextImpl(nsAString& aCssText) const
aCssText.Append('}');
}
NS_IMETHODIMP
nsCSSKeyframesRule::GetName(nsAString& aName)
void
nsCSSKeyframesRule::GetName(nsAString& aName) const
{
mName->ToString(aName);
return NS_OK;
}
NS_IMETHODIMP
void
nsCSSKeyframesRule::SetName(const nsAString& aName)
{
if (mName->Equals(aName)) {
return NS_OK;
return;
}
nsIDocument* doc = GetDocument();
@ -1171,11 +1163,9 @@ nsCSSKeyframesRule::SetName(const nsAString& aName)
if (StyleSheet* sheet = GetStyleSheet()) {
sheet->RuleChanged(this);
}
return NS_OK;
}
NS_IMETHODIMP
void
nsCSSKeyframesRule::AppendRule(const nsAString& aRule)
{
// The spec is confusing, and I think we should just append the rule,
@ -1196,8 +1186,6 @@ nsCSSKeyframesRule::AppendRule(const nsAString& aRule)
sheet->RuleChanged(this);
}
}
return NS_OK;
}
static const uint32_t RULE_NOT_FOUND = uint32_t(-1);
@ -1226,7 +1214,7 @@ nsCSSKeyframesRule::FindRuleIndexForKey(const nsAString& aKey)
return RULE_NOT_FOUND;
}
NS_IMETHODIMP
void
nsCSSKeyframesRule::DeleteRule(const nsAString& aKey)
{
uint32_t index = FindRuleIndexForKey(aKey);
@ -1240,7 +1228,6 @@ nsCSSKeyframesRule::DeleteRule(const nsAString& aKey)
sheet->RuleChanged(this);
}
}
return NS_OK;
}
nsCSSKeyframeRule*

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

@ -296,24 +296,19 @@ private:
nsCSSKeyframesRule(const nsCSSKeyframesRule& aCopy);
~nsCSSKeyframesRule();
public:
NS_DECL_ISUPPORTS_INHERITED
// Rule methods
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
// nsIDOMCSSKeyframesRule interface
NS_IMETHOD GetName(nsAString& aName) final;
NS_IMETHOD SetName(const nsAString& aName) final;
NS_IMETHOD AppendRule(const nsAString& aRule) final;
NS_IMETHOD DeleteRule(const nsAString& aKey) final;
using nsIDOMCSSKeyframesRule::FindRule;
// WebIDL interface
void GetCssTextImpl(nsAString& aCssText) const final;
void GetName(nsAString& aName) const final;
void SetName(const nsAString& aName) final;
mozilla::dom::CSSRuleList* CssRules() final { return GroupRule::CssRules(); }
void AppendRule(const nsAString& aRule) final;
void DeleteRule(const nsAString& aKey) final;
nsCSSKeyframeRule* FindRule(const nsAString& aKey) final;
const nsAtom* GetName() const { return mName; }