Bug 1427512 - Part 6: Remove nsIDOMCSSCounterStyleRule. r=xidorn
MozReview-Commit-ID: 77epTg0DMi3
--- a/dom/interfaces/css/moz.build
+++ b/dom/interfaces/css/moz.build
@@ -4,17 +4,16 @@
# 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/.
with Files("**"):
BUG_COMPONENT = ("Core", "DOM: CSS Object Model")
XPIDL_SOURCES += [
'nsIDOMCounter.idl',
- 'nsIDOMCSSCounterStyleRule.idl',
'nsIDOMCSSFontFaceRule.idl',
'nsIDOMCSSFontFeatureValuesRule.idl',
'nsIDOMCSSImportRule.idl',
'nsIDOMCSSKeyframeRule.idl',
'nsIDOMCSSKeyframesRule.idl',
'nsIDOMCSSPageRule.idl',
'nsIDOMCSSPrimitiveValue.idl',
'nsIDOMCSSRule.idl',
deleted file mode 100644
--- a/dom/interfaces/css/nsIDOMCSSCounterStyleRule.idl
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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"
-
-[scriptable, uuid(9b5e48ce-d84c-4e31-aff5-34e9f4141313)]
-interface nsIDOMCSSCounterStyleRule : nsISupports
-{
- attribute DOMString name;
- attribute DOMString system;
- attribute DOMString symbols;
- attribute DOMString additiveSymbols;
- attribute DOMString negative;
- attribute DOMString prefix;
- attribute DOMString suffix;
- attribute DOMString range;
- attribute DOMString pad;
- attribute DOMString speakAs;
- attribute DOMString fallback;
-};
--- a/layout/style/nsCSSCounterStyleRule.cpp
+++ b/layout/style/nsCSSCounterStyleRule.cpp
@@ -41,25 +41,18 @@ nsCSSCounterStyleRule::Clone() const
nsCSSCounterStyleRule::Getter const
nsCSSCounterStyleRule::kGetters[] = {
#define CSS_COUNTER_DESC(name_, method_) &nsCSSCounterStyleRule::Get##method_,
#include "nsCSSCounterDescList.h"
#undef CSS_COUNTER_DESC
};
-NS_IMPL_ADDREF_INHERITED(nsCSSCounterStyleRule, mozilla::css::Rule)
-NS_IMPL_RELEASE_INHERITED(nsCSSCounterStyleRule, mozilla::css::Rule)
-
-// QueryInterface implementation for nsCSSCounterStyleRule
-// If this ever gets its own cycle-collection bits, reevaluate our IsCCLeaf
+// If this class gets its own cycle-collection bits, reevaluate our IsCCLeaf
// implementation.
-NS_INTERFACE_MAP_BEGIN(nsCSSCounterStyleRule)
- NS_INTERFACE_MAP_ENTRY(nsIDOMCSSCounterStyleRule)
-NS_INTERFACE_MAP_END_INHERITING(mozilla::css::Rule)
bool
nsCSSCounterStyleRule::IsCCLeaf() const
{
return Rule::IsCCLeaf();
}
#ifdef DEBUG
@@ -115,27 +108,25 @@ nsCSSCounterStyleRule::GetCssTextImpl(ns
aCssText.AppendLiteral(u": ");
aCssText.Append(tmp);
aCssText.AppendLiteral(u";\n");
}
}
aCssText.AppendLiteral(u"}");
}
-// nsIDOMCSSCounterStyleRule methods
-NS_IMETHODIMP
+void
nsCSSCounterStyleRule::GetName(nsAString& aName)
{
aName.Truncate();
nsDependentAtomString name(mName);
nsStyleUtil::AppendEscapedCSSIdent(name, aName);
- return NS_OK;
}
-NS_IMETHODIMP
+void
nsCSSCounterStyleRule::SetName(const nsAString& aName)
{
RefPtr<nsAtom> name;
nsIDocument* doc = GetDocument();
if (!doc || doc->IsStyledByServo()) {
name = ServoCSSParser::ParseCounterStyleName(aName);
} else {
@@ -147,17 +138,16 @@ nsCSSCounterStyleRule::SetName(const nsA
MOZ_AUTO_DOC_UPDATE(doc, UPDATE_STYLE, true);
mName = name;
if (StyleSheet* sheet = GetStyleSheet()) {
sheet->RuleChanged(this);
}
}
- return NS_OK;
}
int32_t
nsCSSCounterStyleRule::GetSystem() const
{
const nsCSSValue& system = GetDesc(eCSSCounterDesc_System);
switch (system.GetUnit()) {
case eCSSUnit_Enumerated:
@@ -190,73 +180,70 @@ nsCSSCounterStyleRule::SetDesc(nsCSSCoun
mValues[aDescID] = aValue;
mGeneration++;
if (StyleSheet* sheet = GetStyleSheet()) {
sheet->RuleChanged(this);
}
}
-NS_IMETHODIMP
+void
nsCSSCounterStyleRule::GetSystem(nsAString& aSystem)
{
const nsCSSValue& value = GetDesc(eCSSCounterDesc_System);
if (value.GetUnit() == eCSSUnit_Null) {
aSystem.Truncate();
- return NS_OK;
+ return;
}
aSystem = NS_ConvertASCIItoUTF16(nsCSSProps::ValueToKeyword(
GetSystem(), nsCSSProps::kCounterSystemKTable));
if (value.GetUnit() == eCSSUnit_Pair) {
aSystem.Append(' ');
GetSystemArgument().AppendToString(eCSSProperty_UNKNOWN, aSystem);
}
- return NS_OK;
}
-NS_IMETHODIMP
+void
nsCSSCounterStyleRule::GetSymbols(nsAString& aSymbols)
{
const nsCSSValue& value = GetDesc(eCSSCounterDesc_Symbols);
aSymbols.Truncate();
if (value.GetUnit() == eCSSUnit_List) {
for (const nsCSSValueList* item = value.GetListValue();
item; item = item->mNext) {
item->mValue.AppendToString(eCSSProperty_UNKNOWN, aSymbols);
if (item->mNext) {
aSymbols.Append(' ');
}
}
}
- return NS_OK;
}
-NS_IMETHODIMP
+void
nsCSSCounterStyleRule::GetAdditiveSymbols(nsAString& aSymbols)
{
const nsCSSValue& value = GetDesc(eCSSCounterDesc_AdditiveSymbols);
aSymbols.Truncate();
if (value.GetUnit() == eCSSUnit_PairList) {
for (const nsCSSValuePairList* item = value.GetPairListValue();
item; item = item->mNext) {
item->mXValue.AppendToString(eCSSProperty_UNKNOWN, aSymbols);
aSymbols.Append(' ');
item->mYValue.AppendToString(eCSSProperty_UNKNOWN, aSymbols);
if (item->mNext) {
aSymbols.AppendLiteral(", ");
}
}
}
- return NS_OK;
}
-NS_IMETHODIMP
+void
nsCSSCounterStyleRule::GetRange(nsAString& aRange)
{
const nsCSSValue& value = GetDesc(eCSSCounterDesc_Range);
switch (value.GetUnit()) {
case eCSSUnit_Auto:
aRange.AssignLiteral(u"auto");
break;
@@ -288,20 +275,19 @@ nsCSSCounterStyleRule::GetRange(nsAStrin
aRange.AppendLiteral(", ");
}
}
break;
default:
aRange.Truncate();
}
- return NS_OK;
}
-NS_IMETHODIMP
+void
nsCSSCounterStyleRule::GetSpeakAs(nsAString& aSpeakAs)
{
const nsCSSValue& value = GetDesc(eCSSCounterDesc_SpeakAs);
switch (value.GetUnit()) {
case eCSSUnit_Enumerated:
switch (value.GetIntValue()) {
case NS_STYLE_COUNTER_SPEAKAS_BULLETS:
@@ -330,42 +316,40 @@ nsCSSCounterStyleRule::GetSpeakAs(nsAStr
case eCSSUnit_Null:
aSpeakAs.Truncate();
break;
default:
NS_NOTREACHED("Unknown speech synthesis");
aSpeakAs.Truncate();
}
- return NS_OK;
}
-nsresult
+void
nsCSSCounterStyleRule::GetDescriptor(nsCSSCounterDesc aDescID,
nsAString& aValue)
{
NS_ASSERTION(aDescID == eCSSCounterDesc_Negative ||
aDescID == eCSSCounterDesc_Prefix ||
aDescID == eCSSCounterDesc_Suffix ||
aDescID == eCSSCounterDesc_Pad ||
aDescID == eCSSCounterDesc_Fallback,
"Unexpected descriptor");
const nsCSSValue& value = GetDesc(aDescID);
aValue.Truncate();
if (value.GetUnit() != eCSSUnit_Null) {
value.AppendToString(eCSSProperty_UNKNOWN, aValue);
}
- return NS_OK;
}
#define CSS_COUNTER_DESC_GETTER(name_) \
-NS_IMETHODIMP \
+void \
nsCSSCounterStyleRule::Get##name_(nsAString& a##name_) \
{ \
- return GetDescriptor(eCSSCounterDesc_##name_, a##name_);\
+ GetDescriptor(eCSSCounterDesc_##name_, a##name_); \
}
CSS_COUNTER_DESC_GETTER(Negative)
CSS_COUNTER_DESC_GETTER(Prefix)
CSS_COUNTER_DESC_GETTER(Suffix)
CSS_COUNTER_DESC_GETTER(Pad)
CSS_COUNTER_DESC_GETTER(Fallback)
#undef CSS_COUNTER_DESC_GETTER
@@ -403,17 +387,17 @@ nsCSSCounterStyleRule::CheckDescValue(in
return true;
}
default:
return true;
}
}
-nsresult
+void
nsCSSCounterStyleRule::SetDescriptor(nsCSSCounterDesc aDescID,
const nsAString& aValue)
{
nsCSSValue value;
bool ok;
StyleSheet* sheet = GetStyleSheet();
@@ -433,25 +417,23 @@ nsCSSCounterStyleRule::SetDescriptor(nsC
nsIPrincipal* principal = sheet ? sheet->Principal() : nullptr;
ok = parser.ParseCounterDescriptor(aDescID, aValue, nullptr,
baseURL, principal, value);
}
if (ok && CheckDescValue(GetSystem(), aDescID, value)) {
SetDesc(aDescID, value);
}
-
- return NS_OK;
}
#define CSS_COUNTER_DESC_SETTER(name_) \
-NS_IMETHODIMP \
+void \
nsCSSCounterStyleRule::Set##name_(const nsAString& a##name_) \
{ \
- return SetDescriptor(eCSSCounterDesc_##name_, a##name_); \
+ SetDescriptor(eCSSCounterDesc_##name_, a##name_); \
}
CSS_COUNTER_DESC_SETTER(System)
CSS_COUNTER_DESC_SETTER(Symbols)
CSS_COUNTER_DESC_SETTER(AdditiveSymbols)
CSS_COUNTER_DESC_SETTER(Negative)
CSS_COUNTER_DESC_SETTER(Prefix)
CSS_COUNTER_DESC_SETTER(Suffix)
CSS_COUNTER_DESC_SETTER(Range)
--- a/layout/style/nsCSSCounterStyleRule.h
+++ b/layout/style/nsCSSCounterStyleRule.h
@@ -4,74 +4,68 @@
* 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/. */
#ifndef nsCSSCounterStyleRule_h
#define nsCSSCounterStyleRule_h
#include "mozilla/css/Rule.h"
#include "nsCSSValue.h"
-#include "nsIDOMCSSCounterStyleRule.h"
-class nsCSSCounterStyleRule final : public mozilla::css::Rule,
- public nsIDOMCSSCounterStyleRule
+class nsCSSCounterStyleRule final : public mozilla::css::Rule
{
public:
explicit nsCSSCounterStyleRule(nsAtom* aName,
uint32_t aLineNumber, uint32_t aColumnNumber)
: mozilla::css::Rule(aLineNumber, aColumnNumber)
, mName(aName)
, mGeneration(0)
{
MOZ_ASSERT(aName, "Must have non-null name");
}
private:
nsCSSCounterStyleRule(const nsCSSCounterStyleRule& aCopy);
~nsCSSCounterStyleRule();
public:
- NS_DECL_ISUPPORTS_INHERITED
virtual bool IsCCLeaf() const override;
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
virtual int32_t GetType() const override;
using Rule::GetType;
virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
- // nsIDOMCSSCounterStyleRule
- NS_DECL_NSIDOMCSSCOUNTERSTYLERULE
-
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
- // The XPCOM GetName is OK
- // The XPCOM SetName is OK
- // The XPCOM GetSystem is OK
- // The XPCOM SetSystem is OK
- // The XPCOM GetSymbols is OK
- // The XPCOM SetSymbols is OK
- // The XPCOM GetAdditiveSymbols is OK
- // The XPCOM SetAdditiveSymbols is OK
- // The XPCOM GetNegative is OK
- // The XPCOM SetNegative is OK
- // The XPCOM GetPrefix is OK
- // The XPCOM SetPrefix is OK
- // The XPCOM GetSuffix is OK
- // The XPCOM SetSuffix is OK
- // The XPCOM GetRange is OK
- // The XPCOM SetRange is OK
- // The XPCOM GetPad is OK
- // The XPCOM SetPad is OK
- // The XPCOM GetSpeakAs is OK
- // The XPCOM SetSpeakAs is OK
- // The XPCOM GetFallback is OK
- // The XPCOM SetFallback is OK
+ void GetName(nsAString& aName);
+ void SetName(const nsAString& aName);
+ void GetSystem(nsAString& aSystem);
+ void SetSystem(const nsAString& aSystem);
+ void GetSymbols(nsAString& aSymbols);
+ void SetSymbols(const nsAString& aSymbols);
+ void GetAdditiveSymbols(nsAString& aAdditiveSymbols);
+ void SetAdditiveSymbols(const nsAString& aAdditiveSymbols);
+ void GetNegative(nsAString& aNegative);
+ void SetNegative(const nsAString& aNegative);
+ void GetPrefix(nsAString& aPrefix);
+ void SetPrefix(const nsAString& aPrefix);
+ void GetSuffix(nsAString& aSuffix);
+ void SetSuffix(const nsAString& aSuffix);
+ void GetRange(nsAString& aRange);
+ void SetRange(const nsAString& aRange);
+ void GetPad(nsAString& aPad);
+ void SetPad(const nsAString& aPad);
+ void GetSpeakAs(nsAString& aSpeakAs);
+ void SetSpeakAs(const nsAString& aSpeakAs);
+ void GetFallback(nsAString& aFallback);
+ void SetFallback(const nsAString& aFallback);
// This function is only used to check whether a non-empty value, which has
// been accepted by parser, is valid for the given system and descriptor.
static bool CheckDescValue(int32_t aSystem,
nsCSSCounterDesc aDescID,
const nsCSSValue& aValue);
nsAtom* Name() const { return mName; }
@@ -94,17 +88,17 @@ public:
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
private:
typedef decltype(&nsCSSCounterStyleRule::GetSymbols) Getter;
static const Getter kGetters[];
- nsresult GetDescriptor(nsCSSCounterDesc aDescID, nsAString& aValue);
- nsresult SetDescriptor(nsCSSCounterDesc aDescID, const nsAString& aValue);
+ void GetDescriptor(nsCSSCounterDesc aDescID, nsAString& aValue);
+ void SetDescriptor(nsCSSCounterDesc aDescID, const nsAString& aValue);
RefPtr<nsAtom> mName;
nsCSSValue mValues[eCSSCounterDesc_COUNT];
uint32_t mGeneration;
};
#endif // nsCSSCounterStyleRule_h