Bug 851892 part 7. Push the nsIDOMCSSRule implementation up to css::Rule. r=heycam

This commit is contained in:
Boris Zbarsky 2017-01-13 10:41:02 -05:00
Родитель 18c01c8290
Коммит e1ec75387e
10 изменённых файлов: 180 добавлений и 466 удалений

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

@ -83,7 +83,7 @@ public:
protected:
// to help implement nsIDOMCSSRule
void AppendRulesToCssText(nsAString& aCssText);
void AppendRulesToCssText(nsAString& aCssText) const;
// to implement common methods on nsIDOMCSSMediaRule and
// nsIDOMCSSMozDocumentRule

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

@ -47,6 +47,7 @@ public:
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<Rule> Clone() const override;
void SetSheet(CSSStyleSheet*);
@ -56,12 +57,13 @@ public:
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSImportRule interface
NS_DECL_NSIDOMCSSIMPORTRULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
private:
nsString mURLSpec;
RefPtr<nsMediaList> mMedia;

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

@ -45,21 +45,23 @@ public:
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<Rule> Clone() const override;
nsIAtom* GetPrefix() const { return mPrefix; }
void GetURLSpec(nsString& aURLSpec) const { aURLSpec = mURLSpec; }
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
override MOZ_MUST_OVERRIDE;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
private:
nsCOMPtr<nsIAtom> mPrefix;
nsString mURLSpec;

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

@ -60,6 +60,9 @@ public:
// sense that it doesn't have any outgoing owning edges.
virtual bool IsCCLeaf() const MOZ_MUST_OVERRIDE;
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const = 0;
#endif
@ -118,17 +121,15 @@ public:
// supposed to have a DOM rule representation (and our code wouldn't work).
virtual nsIDOMCSSRule* GetDOMRule() = 0;
// to implement methods on nsIDOMCSSRule
NS_IMETHOD GetParentRule(nsIDOMCSSRule** aParentRule) override;
NS_IMETHOD GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet) override;
virtual Rule* GetCSSRule() override;
using nsIDOMCSSRule::GetType;
// This is pure virtual because all of Rule's data members are non-owning and
// thus measured elsewhere.
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
const MOZ_MUST_OVERRIDE = 0;
// WebIDL interface, aka helpers for nsIDOMCSSRule implementation.
virtual uint16_t Type() const = 0;
virtual void GetCssTextImpl(nsAString& aCssText) const = 0;
protected:
// True if we're known-live for cycle collection purposes.
bool IsKnownLive() const;

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

@ -190,43 +190,16 @@ ServoStyleRule::List(FILE* out, int32_t aIndent) const
/* CSSRule implementation */
NS_IMETHODIMP
ServoStyleRule::GetType(uint16_t* aType)
uint16_t
ServoStyleRule::Type() const
{
*aType = nsIDOMCSSRule::STYLE_RULE;
return NS_OK;
return nsIDOMCSSRule::STYLE_RULE;
}
NS_IMETHODIMP
ServoStyleRule::GetCssText(nsAString& aCssText)
void
ServoStyleRule::GetCssTextImpl(nsAString& aCssText) const
{
Servo_StyleRule_GetCssText(mRawRule, &aCssText);
return NS_OK;
}
NS_IMETHODIMP
ServoStyleRule::SetCssText(const nsAString& aCssText)
{
return NS_OK;
}
NS_IMETHODIMP
ServoStyleRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
return css::Rule::GetParentStyleSheet(aSheet);
}
NS_IMETHODIMP
ServoStyleRule::GetParentRule(nsIDOMCSSRule** aParentRule)
{
*aParentRule = nullptr;
return NS_ERROR_NOT_IMPLEMENTED;
}
css::Rule*
ServoStyleRule::GetCSSRule()
{
return this;
}
/* CSSStyleRule implementation */

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

@ -57,13 +57,17 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(ServoStyleRule,
css::Rule)
virtual bool IsCCLeaf() const override MOZ_MUST_OVERRIDE;
NS_DECL_NSIDOMCSSRULE
NS_DECL_NSIDOMCSSSTYLERULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
RawServoStyleRule* Raw() const { return mRawRule; }
// Methods of mozilla::css::Rule
int32_t GetType() const final { return css::Rule::STYLE_RULE; }
using Rule::GetType;
already_AddRefed<Rule> Clone() const final;
nsIDOMCSSRule* GetDOMRule() final { return this; }
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const final;

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

@ -1166,30 +1166,10 @@ DOMCSSDeclarationImpl::DocToUpdate()
namespace mozilla {
namespace css {
NS_IMETHODIMP
StyleRule::GetType(uint16_t* aType)
uint16_t
StyleRule::Type() const
{
*aType = nsIDOMCSSRule::STYLE_RULE;
return NS_OK;
}
NS_IMETHODIMP
StyleRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
return Rule::GetParentStyleSheet(aSheet);
}
NS_IMETHODIMP
StyleRule::GetParentRule(nsIDOMCSSRule** aParentRule)
{
return Rule::GetParentRule(aParentRule);
}
css::Rule*
StyleRule::GetCSSRule()
{
return this;
return nsIDOMCSSRule::STYLE_RULE;
}
NS_IMETHODIMP
@ -1372,8 +1352,8 @@ StyleRule::List(FILE* out, int32_t aIndent) const
}
#endif
NS_IMETHODIMP
StyleRule::GetCssText(nsAString& aCssText)
void
StyleRule::GetCssTextImpl(nsAString& aCssText) const
{
if (mSelector) {
mSelector->ToString(aCssText, GetStyleSheet());
@ -1389,14 +1369,6 @@ StyleRule::GetCssText(nsAString& aCssText)
}
aCssText.Append(char16_t(' '));
aCssText.Append(char16_t('}'));
return NS_OK;
}
NS_IMETHODIMP
StyleRule::SetCssText(const nsAString& aCssText)
{
// XXX TBI - need to re-parse rule & declaration
return NS_OK;
}
NS_IMETHODIMP

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

@ -328,12 +328,15 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(StyleRule, Rule)
virtual bool IsCCLeaf() const override;
NS_DECL_NSIDOMCSSRULE
NS_DECL_NSIDOMCSSSTYLERULE
// nsICSSStyleRuleDOMWrapper
NS_IMETHOD GetCSSStyleRule(StyleRule **aResult) override;
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
// null for style attribute
nsCSSSelectorList* Selector() { return mSelector; }
@ -342,6 +345,7 @@ public:
void SetDeclaration(Declaration* aDecl);
virtual int32_t GetType() const override;
using Rule::GetType;
CSSStyleSheet* GetStyleSheet() const
{

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

@ -143,6 +143,28 @@ Rule::GetCSSRule()
return this;
}
NS_IMETHODIMP
Rule::GetType(uint16_t* aType)
{
*aType = Type();
return NS_OK;
}
NS_IMETHODIMP
Rule::SetCssText(const nsAString& aCssText)
{
// We used to throw for some rule types, but not all. Specifically, we did
// not throw for StyleRule. Let's just always not throw.
return NS_OK;
}
NS_IMETHODIMP
Rule::GetCssText(nsAString& aCssText)
{
GetCssTextImpl(aCssText);
return NS_OK;
}
// -------------------------------
// Style Rule List for group rules
//
@ -322,16 +344,14 @@ ImportRule::SetSheet(CSSStyleSheet* aSheet)
mMedia = mChildSheet->Media();
}
NS_IMETHODIMP
ImportRule::GetType(uint16_t* aType)
uint16_t
ImportRule::Type() const
{
NS_ENSURE_ARG_POINTER(aType);
*aType = nsIDOMCSSRule::IMPORT_RULE;
return NS_OK;
return nsIDOMCSSRule::IMPORT_RULE;
}
NS_IMETHODIMP
ImportRule::GetCssText(nsAString& aCssText)
void
ImportRule::GetCssTextImpl(nsAString& aCssText) const
{
aCssText.AssignLiteral("@import url(");
nsStyleUtil::AppendEscapedCSSString(mURLSpec, aCssText);
@ -345,31 +365,6 @@ ImportRule::GetCssText(nsAString& aCssText)
}
}
aCssText.Append(';');
return NS_OK;
}
NS_IMETHODIMP
ImportRule::SetCssText(const nsAString& aCssText)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
ImportRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
return Rule::GetParentStyleSheet(aSheet);
}
NS_IMETHODIMP
ImportRule::GetParentRule(nsIDOMCSSRule** aParentRule)
{
return Rule::GetParentRule(aParentRule);
}
css::Rule*
ImportRule::GetCSSRule()
{
return Rule::GetCSSRule();
}
NS_IMETHODIMP
@ -576,7 +571,7 @@ GroupRule::InsertStyleRuleAt(uint32_t aIndex, Rule* aRule)
}
void
GroupRule::AppendRulesToCssText(nsAString& aCssText)
GroupRule::AppendRulesToCssText(nsAString& aCssText) const
{
aCssText.AppendLiteral(" {\n");
@ -757,45 +752,18 @@ MediaRule::SetMedia(nsMediaList* aMedia)
return NS_OK;
}
// nsIDOMCSSRule methods
NS_IMETHODIMP
MediaRule::GetType(uint16_t* aType)
uint16_t
MediaRule::Type() const
{
*aType = nsIDOMCSSRule::MEDIA_RULE;
return NS_OK;
return nsIDOMCSSRule::MEDIA_RULE;
}
NS_IMETHODIMP
MediaRule::GetCssText(nsAString& aCssText)
void
MediaRule::GetCssTextImpl(nsAString& aCssText) const
{
aCssText.AssignLiteral("@media ");
AppendConditionText(aCssText);
GroupRule::AppendRulesToCssText(aCssText);
return NS_OK;
}
NS_IMETHODIMP
MediaRule::SetCssText(const nsAString& aCssText)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MediaRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
return GroupRule::GetParentStyleSheet(aSheet);
}
NS_IMETHODIMP
MediaRule::GetParentRule(nsIDOMCSSRule** aParentRule)
{
return GroupRule::GetParentRule(aParentRule);
}
css::Rule*
MediaRule::GetCSSRule()
{
return Rule::GetCSSRule();
}
// nsIDOMCSSGroupingRule methods
@ -884,7 +852,7 @@ MediaRule::WrapObject(JSContext* aCx,
}
void
MediaRule::AppendConditionText(nsAString& aOutput)
MediaRule::AppendConditionText(nsAString& aOutput) const
{
if (mMedia) {
nsAutoString mediaText;
@ -974,46 +942,19 @@ DocumentRule::Clone() const
return clone.forget();
}
// nsIDOMCSSRule methods
NS_IMETHODIMP
DocumentRule::GetType(uint16_t* aType)
uint16_t
DocumentRule::Type() const
{
// XXX What should really happen here?
*aType = nsIDOMCSSRule::UNKNOWN_RULE;
return NS_OK;
return nsIDOMCSSRule::UNKNOWN_RULE;
}
NS_IMETHODIMP
DocumentRule::GetCssText(nsAString& aCssText)
void
DocumentRule::GetCssTextImpl(nsAString& aCssText) const
{
aCssText.AssignLiteral("@-moz-document ");
AppendConditionText(aCssText);
GroupRule::AppendRulesToCssText(aCssText);
return NS_OK;
}
NS_IMETHODIMP
DocumentRule::SetCssText(const nsAString& aCssText)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
DocumentRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
return GroupRule::GetParentStyleSheet(aSheet);
}
NS_IMETHODIMP
DocumentRule::GetParentRule(nsIDOMCSSRule** aParentRule)
{
return GroupRule::GetParentRule(aParentRule);
}
css::Rule*
DocumentRule::GetCSSRule()
{
return Rule::GetCSSRule();
}
// nsIDOMCSSGroupingRule methods
@ -1134,7 +1075,7 @@ DocumentRule::WrapObject(JSContext* aCx,
}
void
DocumentRule::AppendConditionText(nsAString& aCssText)
DocumentRule::AppendConditionText(nsAString& aCssText) const
{
for (URL *url = mURLs; url; url = url->next) {
switch (url->func) {
@ -1246,15 +1187,14 @@ NameSpaceRule::Clone() const
return clone.forget();
}
NS_IMETHODIMP
NameSpaceRule::GetType(uint16_t* aType)
uint16_t
NameSpaceRule::Type() const
{
*aType = nsIDOMCSSRule::NAMESPACE_RULE;
return NS_OK;
return nsIDOMCSSRule::NAMESPACE_RULE;
}
NS_IMETHODIMP
NameSpaceRule::GetCssText(nsAString& aCssText)
void
NameSpaceRule::GetCssTextImpl(nsAString& aCssText) const
{
aCssText.AssignLiteral("@namespace ");
if (mPrefix) {
@ -1263,31 +1203,6 @@ NameSpaceRule::GetCssText(nsAString& aCssText)
aCssText.AppendLiteral("url(");
nsStyleUtil::AppendEscapedCSSString(mURLSpec, aCssText);
aCssText.AppendLiteral(");");
return NS_OK;
}
NS_IMETHODIMP
NameSpaceRule::SetCssText(const nsAString& aCssText)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
NameSpaceRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
return Rule::GetParentStyleSheet(aSheet);
}
NS_IMETHODIMP
NameSpaceRule::GetParentRule(nsIDOMCSSRule** aParentRule)
{
return Rule::GetParentRule(aParentRule);
}
css::Rule*
NameSpaceRule::GetCSSRule()
{
return Rule::GetCSSRule();
}
/* virtual */ size_t
@ -1439,6 +1354,13 @@ nsCSSFontFaceStyleDecl::GetPropertyValue(nsCSSFontDesc aFontDescID,
NS_IMETHODIMP
nsCSSFontFaceStyleDecl::GetCssText(nsAString & aCssText)
{
GetCssTextImpl(aCssText);
return NS_OK;
}
void
nsCSSFontFaceStyleDecl::GetCssTextImpl(nsAString& aCssText) const
{
nsAutoString descStr;
@ -1457,7 +1379,6 @@ nsCSSFontFaceStyleDecl::GetCssText(nsAString & aCssText)
aCssText.AppendLiteral(";\n");
}
}
return NS_OK;
}
NS_IMETHODIMP
@ -1702,47 +1623,21 @@ nsCSSFontFaceRule::GetType() const
return Rule::FONT_FACE_RULE;
}
NS_IMETHODIMP
nsCSSFontFaceRule::GetType(uint16_t* aType)
uint16_t
nsCSSFontFaceRule::Type() const
{
*aType = nsIDOMCSSRule::FONT_FACE_RULE;
return NS_OK;
return nsIDOMCSSRule::FONT_FACE_RULE;
}
NS_IMETHODIMP
nsCSSFontFaceRule::GetCssText(nsAString& aCssText)
void
nsCSSFontFaceRule::GetCssTextImpl(nsAString& aCssText) const
{
nsAutoString propText;
mDecl.GetCssText(propText);
mDecl.GetCssTextImpl(propText);
aCssText.AssignLiteral("@font-face {\n");
aCssText.Append(propText);
aCssText.Append('}');
return NS_OK;
}
NS_IMETHODIMP
nsCSSFontFaceRule::SetCssText(const nsAString& aCssText)
{
return NS_ERROR_NOT_IMPLEMENTED; // bug 443978
}
NS_IMETHODIMP
nsCSSFontFaceRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
return Rule::GetParentStyleSheet(aSheet);
}
NS_IMETHODIMP
nsCSSFontFaceRule::GetParentRule(nsIDOMCSSRule** aParentRule)
{
return Rule::GetParentRule(aParentRule);
}
css::Rule*
nsCSSFontFaceRule::GetCSSRule()
{
return Rule::GetCSSRule();
}
NS_IMETHODIMP
@ -1911,43 +1806,16 @@ nsCSSFontFeatureValuesRule::GetType() const
return Rule::FONT_FEATURE_VALUES_RULE;
}
NS_IMETHODIMP
nsCSSFontFeatureValuesRule::GetType(uint16_t* aType)
uint16_t
nsCSSFontFeatureValuesRule::Type() const
{
*aType = nsIDOMCSSRule::FONT_FEATURE_VALUES_RULE;
return NS_OK;
return nsIDOMCSSRule::FONT_FEATURE_VALUES_RULE;
}
NS_IMETHODIMP
nsCSSFontFeatureValuesRule::GetCssText(nsAString& aCssText)
void
nsCSSFontFeatureValuesRule::GetCssTextImpl(nsAString& aCssText) const
{
FontFeatureValuesRuleToString(mFamilyList, mFeatureValues, aCssText);
return NS_OK;
}
NS_IMETHODIMP
nsCSSFontFeatureValuesRule::SetCssText(const nsAString& aCssText)
{
// FIXME: implement???
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsCSSFontFeatureValuesRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
return Rule::GetParentStyleSheet(aSheet);
}
NS_IMETHODIMP
nsCSSFontFeatureValuesRule::GetParentRule(nsIDOMCSSRule** aParentRule)
{
return Rule::GetParentRule(aParentRule);
}
css::Rule*
nsCSSFontFeatureValuesRule::GetCSSRule()
{
return Rule::GetCSSRule();
}
NS_IMETHODIMP
@ -2201,15 +2069,14 @@ nsCSSKeyframeRule::GetType() const
return Rule::KEYFRAME_RULE;
}
NS_IMETHODIMP
nsCSSKeyframeRule::GetType(uint16_t* aType)
uint16_t
nsCSSKeyframeRule::Type() const
{
*aType = nsIDOMCSSRule::KEYFRAME_RULE;
return NS_OK;
return nsIDOMCSSRule::KEYFRAME_RULE;
}
NS_IMETHODIMP
nsCSSKeyframeRule::GetCssText(nsAString& aCssText)
void
nsCSSKeyframeRule::GetCssTextImpl(nsAString& aCssText) const
{
DoGetKeyText(aCssText);
aCssText.AppendLiteral(" { ");
@ -2217,32 +2084,6 @@ nsCSSKeyframeRule::GetCssText(nsAString& aCssText)
mDeclaration->ToString(tmp);
aCssText.Append(tmp);
aCssText.AppendLiteral(" }");
return NS_OK;
}
NS_IMETHODIMP
nsCSSKeyframeRule::SetCssText(const nsAString& aCssText)
{
// FIXME: implement???
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsCSSKeyframeRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
return Rule::GetParentStyleSheet(aSheet);
}
NS_IMETHODIMP
nsCSSKeyframeRule::GetParentRule(nsIDOMCSSRule** aParentRule)
{
return Rule::GetParentRule(aParentRule);
}
css::Rule*
nsCSSKeyframeRule::GetCSSRule()
{
return Rule::GetCSSRule();
}
NS_IMETHODIMP
@ -2406,15 +2247,14 @@ nsCSSKeyframesRule::GetType() const
return Rule::KEYFRAMES_RULE;
}
NS_IMETHODIMP
nsCSSKeyframesRule::GetType(uint16_t* aType)
uint16_t
nsCSSKeyframesRule::Type() const
{
*aType = nsIDOMCSSRule::KEYFRAMES_RULE;
return NS_OK;
return nsIDOMCSSRule::KEYFRAMES_RULE;
}
NS_IMETHODIMP
nsCSSKeyframesRule::GetCssText(nsAString& aCssText)
void
nsCSSKeyframesRule::GetCssTextImpl(nsAString& aCssText) const
{
aCssText.AssignLiteral("@keyframes ");
aCssText.Append(mName);
@ -2426,32 +2266,6 @@ nsCSSKeyframesRule::GetCssText(nsAString& aCssText)
aCssText.Append('\n');
}
aCssText.Append('}');
return NS_OK;
}
NS_IMETHODIMP
nsCSSKeyframesRule::SetCssText(const nsAString& aCssText)
{
// FIXME: implement???
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsCSSKeyframesRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
return GroupRule::GetParentStyleSheet(aSheet);
}
NS_IMETHODIMP
nsCSSKeyframesRule::GetParentRule(nsIDOMCSSRule** aParentRule)
{
return GroupRule::GetParentRule(aParentRule);
}
css::Rule*
nsCSSKeyframesRule::GetCSSRule()
{
return GroupRule::GetCSSRule();
}
NS_IMETHODIMP
@ -2758,47 +2572,20 @@ nsCSSPageRule::GetType() const
return Rule::PAGE_RULE;
}
NS_IMETHODIMP
nsCSSPageRule::GetType(uint16_t* aType)
uint16_t
nsCSSPageRule::Type() const
{
*aType = nsIDOMCSSRule::PAGE_RULE;
return NS_OK;
return nsIDOMCSSRule::PAGE_RULE;
}
NS_IMETHODIMP
nsCSSPageRule::GetCssText(nsAString& aCssText)
void
nsCSSPageRule::GetCssTextImpl(nsAString& aCssText) const
{
aCssText.AppendLiteral("@page { ");
nsAutoString tmp;
mDeclaration->ToString(tmp);
aCssText.Append(tmp);
aCssText.AppendLiteral(" }");
return NS_OK;
}
NS_IMETHODIMP
nsCSSPageRule::SetCssText(const nsAString& aCssText)
{
// FIXME: implement???
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsCSSPageRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
return Rule::GetParentStyleSheet(aSheet);
}
NS_IMETHODIMP
nsCSSPageRule::GetParentRule(nsIDOMCSSRule** aParentRule)
{
return Rule::GetParentRule(aParentRule);
}
css::Rule*
nsCSSPageRule::GetCSSRule()
{
return Rule::GetCSSRule();
}
NS_IMETHODIMP
@ -2912,45 +2699,18 @@ NS_INTERFACE_MAP_BEGIN(CSSSupportsRule)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSSupportsRule)
NS_INTERFACE_MAP_END_INHERITING(GroupRule)
// nsIDOMCSSRule methods
NS_IMETHODIMP
CSSSupportsRule::GetType(uint16_t* aType)
uint16_t
CSSSupportsRule::Type() const
{
*aType = nsIDOMCSSRule::SUPPORTS_RULE;
return NS_OK;
return nsIDOMCSSRule::SUPPORTS_RULE;
}
NS_IMETHODIMP
CSSSupportsRule::GetCssText(nsAString& aCssText)
void
CSSSupportsRule::GetCssTextImpl(nsAString& aCssText) const
{
aCssText.AssignLiteral("@supports ");
aCssText.Append(mCondition);
css::GroupRule::AppendRulesToCssText(aCssText);
return NS_OK;
}
NS_IMETHODIMP
CSSSupportsRule::SetCssText(const nsAString& aCssText)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
CSSSupportsRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
return css::GroupRule::GetParentStyleSheet(aSheet);
}
NS_IMETHODIMP
CSSSupportsRule::GetParentRule(nsIDOMCSSRule** aParentRule)
{
return css::GroupRule::GetParentRule(aParentRule);
}
css::Rule*
CSSSupportsRule::GetCSSRule()
{
return css::GroupRule::GetCSSRule();
}
// nsIDOMCSSGroupingRule methods
@ -3082,16 +2842,14 @@ nsCSSCounterStyleRule::GetType() const
return Rule::COUNTER_STYLE_RULE;
}
// nsIDOMCSSRule methods
NS_IMETHODIMP
nsCSSCounterStyleRule::GetType(uint16_t* aType)
uint16_t
nsCSSCounterStyleRule::Type() const
{
*aType = nsIDOMCSSRule::COUNTER_STYLE_RULE;
return NS_OK;
return nsIDOMCSSRule::COUNTER_STYLE_RULE;
}
NS_IMETHODIMP
nsCSSCounterStyleRule::GetCssText(nsAString& aCssText)
void
nsCSSCounterStyleRule::GetCssTextImpl(nsAString& aCssText) const
{
aCssText.AssignLiteral(u"@counter-style ");
nsStyleUtil::AppendEscapedCSSIdent(mName, aCssText);
@ -3101,7 +2859,10 @@ nsCSSCounterStyleRule::GetCssText(nsAString& aCssText)
id = nsCSSCounterDesc(id + 1)) {
if (mValues[id].GetUnit() != eCSSUnit_Null) {
nsAutoString tmp;
(this->*kGetters[id])(tmp);
// This is annoying. We want to be a const method, but kGetters stores
// XPCOM method pointers, which aren't const methods. The thing is,
// none of those mutate "this". So it's OK to cast away const here.
(const_cast<nsCSSCounterStyleRule*>(this)->*kGetters[id])(tmp);
aCssText.AppendLiteral(u" ");
AppendASCIItoUTF16(nsCSSProps::GetStringValue(id), aCssText);
aCssText.AppendLiteral(u": ");
@ -3110,32 +2871,6 @@ nsCSSCounterStyleRule::GetCssText(nsAString& aCssText)
}
}
aCssText.AppendLiteral(u"}");
return NS_OK;
}
NS_IMETHODIMP
nsCSSCounterStyleRule::SetCssText(const nsAString& aCssText)
{
// FIXME: implement???
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsCSSCounterStyleRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
{
return Rule::GetParentStyleSheet(aSheet);
}
NS_IMETHODIMP
nsCSSCounterStyleRule::GetParentRule(nsIDOMCSSRule** aParentRule)
{
return Rule::GetParentRule(aParentRule);
}
css::Rule*
nsCSSCounterStyleRule::GetCSSRule()
{
return Rule::GetCSSRule();
}
// nsIDOMCSSCounterStyleRule methods

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

@ -67,15 +67,13 @@ public:
return sheet ? sheet->AsGecko() : nullptr;
}
virtual int32_t GetType() const override;
using Rule::GetType;
virtual already_AddRefed<Rule> Clone() const override;
virtual nsIDOMCSSRule* GetDOMRule() override
{
return this;
}
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSGroupingRule interface
NS_DECL_NSIDOMCSSGROUPINGRULE
@ -91,6 +89,10 @@ public:
// @media rule methods
nsresult SetMedia(nsMediaList* aMedia);
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
const override MOZ_MUST_OVERRIDE;
@ -99,7 +101,7 @@ public:
JS::Handle<JSObject*> aGivenProto) override;
protected:
void AppendConditionText(nsAString& aOutput);
void AppendConditionText(nsAString& aOutput) const;
RefPtr<nsMediaList> mMedia;
};
@ -121,15 +123,13 @@ public:
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<Rule> Clone() const override;
virtual nsIDOMCSSRule* GetDOMRule() override
{
return this;
}
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSGroupingRule interface
NS_DECL_NSIDOMCSSGROUPINGRULE
@ -169,6 +169,10 @@ public:
void SetURLs(URL *aURLs) { mURLs = aURLs; }
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
const override MOZ_MUST_OVERRIDE;
@ -176,7 +180,7 @@ public:
JS::Handle<JSObject*> aGivenProto) override;
protected:
void AppendConditionText(nsAString& aOutput);
void AppendConditionText(nsAString& aOutput) const;
nsAutoPtr<URL> mURLs; // linked list of |struct URL| above.
};
@ -229,6 +233,9 @@ protected:
mozilla::CSSFontFaceDescriptors mDescriptors;
// The actual implementation of GetCssText, so we can make it const.
void GetCssTextImpl(nsAString& aCssText) const;
private:
// NOT TO BE IMPLEMENTED
// This object cannot be allocated on its own, only as part of
@ -264,17 +271,19 @@ public:
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;
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSFontFaceRule interface
NS_DECL_NSIDOMCSSFONTFACERULE
void SetDesc(nsCSSFontDesc aDescID, nsCSSValue const & aValue);
void GetDesc(nsCSSFontDesc aDescID, nsCSSValue & aValue);
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
@ -339,14 +348,16 @@ public:
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;
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSFontFaceRule interface
NS_DECL_NSIDOMCSSFONTFEATUREVALUESRULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
const mozilla::FontFamilyList& GetFamilyList() { return mFamilyList; }
void SetFamilyList(const mozilla::FontFamilyList& aFamilyList);
@ -427,14 +438,16 @@ public:
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;
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSKeyframeRule interface
NS_DECL_NSIDOMCSSKEYFRAMERULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
const nsTArray<float>& GetKeys() const { return mKeys; }
mozilla::css::Declaration* Declaration() { return mDeclaration; }
@ -476,18 +489,20 @@ public:
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;
virtual nsIDOMCSSRule* GetDOMRule() override
{
return this;
}
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSKeyframesRule interface
NS_DECL_NSIDOMCSSKEYFRAMESRULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
// rest of GroupRule
virtual bool UseForPresentation(nsPresContext* aPresContext,
nsMediaQueryResultCacheKey& aKey) override;
@ -559,14 +574,16 @@ public:
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;
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSPageRule interface
NS_DECL_NSIDOMCSSPAGERULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
mozilla::css::Declaration* Declaration() { return mDeclaration; }
void ChangeDeclaration(mozilla::css::Declaration* aDeclaration);
@ -597,6 +614,7 @@ public:
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;
virtual bool UseForPresentation(nsPresContext* aPresContext,
nsMediaQueryResultCacheKey& aKey) override;
@ -607,9 +625,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSGroupingRule interface
NS_DECL_NSIDOMCSSGROUPINGRULE
@ -619,6 +634,10 @@ public:
// nsIDOMCSSSupportsRule interface
NS_DECL_NSIDOMCSSSUPPORTSRULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
@ -660,14 +679,16 @@ public:
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;
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSCounterStyleRule
NS_DECL_NSIDOMCSSCOUNTERSTYLERULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
// 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,