Backed out changeset 659550973d4d (bug 851892)

This commit is contained in:
Sebastian Hengst 2017-01-20 19:30:37 +01:00
Родитель bcb6968086
Коммит 24246c7ba1
10 изменённых файлов: 466 добавлений и 180 удалений

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

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

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

@ -47,7 +47,6 @@ 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*);
@ -57,13 +56,12 @@ 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,23 +45,21 @@ 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,9 +60,6 @@ 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
@ -121,15 +118,17 @@ 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,16 +190,43 @@ ServoStyleRule::List(FILE* out, int32_t aIndent) const
/* CSSRule implementation */
uint16_t
ServoStyleRule::Type() const
NS_IMETHODIMP
ServoStyleRule::GetType(uint16_t* aType)
{
return nsIDOMCSSRule::STYLE_RULE;
*aType = nsIDOMCSSRule::STYLE_RULE;
return NS_OK;
}
void
ServoStyleRule::GetCssTextImpl(nsAString& aCssText) const
NS_IMETHODIMP
ServoStyleRule::GetCssText(nsAString& aCssText)
{
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,17 +57,13 @@ 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,10 +1166,30 @@ DOMCSSDeclarationImpl::DocToUpdate()
namespace mozilla {
namespace css {
uint16_t
StyleRule::Type() const
NS_IMETHODIMP
StyleRule::GetType(uint16_t* aType)
{
return nsIDOMCSSRule::STYLE_RULE;
*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;
}
NS_IMETHODIMP
@ -1352,8 +1372,8 @@ StyleRule::List(FILE* out, int32_t aIndent) const
}
#endif
void
StyleRule::GetCssTextImpl(nsAString& aCssText) const
NS_IMETHODIMP
StyleRule::GetCssText(nsAString& aCssText)
{
if (mSelector) {
mSelector->ToString(aCssText, GetStyleSheet());
@ -1369,6 +1389,14 @@ StyleRule::GetCssTextImpl(nsAString& aCssText) const
}
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,15 +328,12 @@ 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; }
@ -345,7 +342,6 @@ public:
void SetDeclaration(Declaration* aDecl);
virtual int32_t GetType() const override;
using Rule::GetType;
CSSStyleSheet* GetStyleSheet() const
{

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

@ -143,28 +143,6 @@ 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
//
@ -344,14 +322,16 @@ ImportRule::SetSheet(CSSStyleSheet* aSheet)
mMedia = mChildSheet->Media();
}
uint16_t
ImportRule::Type() const
NS_IMETHODIMP
ImportRule::GetType(uint16_t* aType)
{
return nsIDOMCSSRule::IMPORT_RULE;
NS_ENSURE_ARG_POINTER(aType);
*aType = nsIDOMCSSRule::IMPORT_RULE;
return NS_OK;
}
void
ImportRule::GetCssTextImpl(nsAString& aCssText) const
NS_IMETHODIMP
ImportRule::GetCssText(nsAString& aCssText)
{
aCssText.AssignLiteral("@import url(");
nsStyleUtil::AppendEscapedCSSString(mURLSpec, aCssText);
@ -365,6 +345,31 @@ ImportRule::GetCssTextImpl(nsAString& aCssText) const
}
}
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
@ -571,7 +576,7 @@ GroupRule::InsertStyleRuleAt(uint32_t aIndex, Rule* aRule)
}
void
GroupRule::AppendRulesToCssText(nsAString& aCssText) const
GroupRule::AppendRulesToCssText(nsAString& aCssText)
{
aCssText.AppendLiteral(" {\n");
@ -752,18 +757,45 @@ MediaRule::SetMedia(nsMediaList* aMedia)
return NS_OK;
}
uint16_t
MediaRule::Type() const
// nsIDOMCSSRule methods
NS_IMETHODIMP
MediaRule::GetType(uint16_t* aType)
{
return nsIDOMCSSRule::MEDIA_RULE;
*aType = nsIDOMCSSRule::MEDIA_RULE;
return NS_OK;
}
void
MediaRule::GetCssTextImpl(nsAString& aCssText) const
NS_IMETHODIMP
MediaRule::GetCssText(nsAString& aCssText)
{
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
@ -852,7 +884,7 @@ MediaRule::WrapObject(JSContext* aCx,
}
void
MediaRule::AppendConditionText(nsAString& aOutput) const
MediaRule::AppendConditionText(nsAString& aOutput)
{
if (mMedia) {
nsAutoString mediaText;
@ -942,19 +974,46 @@ DocumentRule::Clone() const
return clone.forget();
}
uint16_t
DocumentRule::Type() const
// nsIDOMCSSRule methods
NS_IMETHODIMP
DocumentRule::GetType(uint16_t* aType)
{
// XXX What should really happen here?
return nsIDOMCSSRule::UNKNOWN_RULE;
*aType = nsIDOMCSSRule::UNKNOWN_RULE;
return NS_OK;
}
void
DocumentRule::GetCssTextImpl(nsAString& aCssText) const
NS_IMETHODIMP
DocumentRule::GetCssText(nsAString& aCssText)
{
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
@ -1075,7 +1134,7 @@ DocumentRule::WrapObject(JSContext* aCx,
}
void
DocumentRule::AppendConditionText(nsAString& aCssText) const
DocumentRule::AppendConditionText(nsAString& aCssText)
{
for (URL *url = mURLs; url; url = url->next) {
switch (url->func) {
@ -1187,14 +1246,15 @@ NameSpaceRule::Clone() const
return clone.forget();
}
uint16_t
NameSpaceRule::Type() const
NS_IMETHODIMP
NameSpaceRule::GetType(uint16_t* aType)
{
return nsIDOMCSSRule::NAMESPACE_RULE;
*aType = nsIDOMCSSRule::NAMESPACE_RULE;
return NS_OK;
}
void
NameSpaceRule::GetCssTextImpl(nsAString& aCssText) const
NS_IMETHODIMP
NameSpaceRule::GetCssText(nsAString& aCssText)
{
aCssText.AssignLiteral("@namespace ");
if (mPrefix) {
@ -1203,6 +1263,31 @@ NameSpaceRule::GetCssTextImpl(nsAString& aCssText) const
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
@ -1354,13 +1439,6 @@ nsCSSFontFaceStyleDecl::GetPropertyValue(nsCSSFontDesc aFontDescID,
NS_IMETHODIMP
nsCSSFontFaceStyleDecl::GetCssText(nsAString & aCssText)
{
GetCssTextImpl(aCssText);
return NS_OK;
}
void
nsCSSFontFaceStyleDecl::GetCssTextImpl(nsAString& aCssText) const
{
nsAutoString descStr;
@ -1379,6 +1457,7 @@ nsCSSFontFaceStyleDecl::GetCssTextImpl(nsAString& aCssText) const
aCssText.AppendLiteral(";\n");
}
}
return NS_OK;
}
NS_IMETHODIMP
@ -1623,21 +1702,47 @@ nsCSSFontFaceRule::GetType() const
return Rule::FONT_FACE_RULE;
}
uint16_t
nsCSSFontFaceRule::Type() const
NS_IMETHODIMP
nsCSSFontFaceRule::GetType(uint16_t* aType)
{
return nsIDOMCSSRule::FONT_FACE_RULE;
*aType = nsIDOMCSSRule::FONT_FACE_RULE;
return NS_OK;
}
void
nsCSSFontFaceRule::GetCssTextImpl(nsAString& aCssText) const
NS_IMETHODIMP
nsCSSFontFaceRule::GetCssText(nsAString& aCssText)
{
nsAutoString propText;
mDecl.GetCssTextImpl(propText);
mDecl.GetCssText(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
@ -1806,16 +1911,43 @@ nsCSSFontFeatureValuesRule::GetType() const
return Rule::FONT_FEATURE_VALUES_RULE;
}
uint16_t
nsCSSFontFeatureValuesRule::Type() const
NS_IMETHODIMP
nsCSSFontFeatureValuesRule::GetType(uint16_t* aType)
{
return nsIDOMCSSRule::FONT_FEATURE_VALUES_RULE;
*aType = nsIDOMCSSRule::FONT_FEATURE_VALUES_RULE;
return NS_OK;
}
void
nsCSSFontFeatureValuesRule::GetCssTextImpl(nsAString& aCssText) const
NS_IMETHODIMP
nsCSSFontFeatureValuesRule::GetCssText(nsAString& aCssText)
{
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
@ -2069,14 +2201,15 @@ nsCSSKeyframeRule::GetType() const
return Rule::KEYFRAME_RULE;
}
uint16_t
nsCSSKeyframeRule::Type() const
NS_IMETHODIMP
nsCSSKeyframeRule::GetType(uint16_t* aType)
{
return nsIDOMCSSRule::KEYFRAME_RULE;
*aType = nsIDOMCSSRule::KEYFRAME_RULE;
return NS_OK;
}
void
nsCSSKeyframeRule::GetCssTextImpl(nsAString& aCssText) const
NS_IMETHODIMP
nsCSSKeyframeRule::GetCssText(nsAString& aCssText)
{
DoGetKeyText(aCssText);
aCssText.AppendLiteral(" { ");
@ -2084,6 +2217,32 @@ nsCSSKeyframeRule::GetCssTextImpl(nsAString& aCssText) const
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
@ -2247,14 +2406,15 @@ nsCSSKeyframesRule::GetType() const
return Rule::KEYFRAMES_RULE;
}
uint16_t
nsCSSKeyframesRule::Type() const
NS_IMETHODIMP
nsCSSKeyframesRule::GetType(uint16_t* aType)
{
return nsIDOMCSSRule::KEYFRAMES_RULE;
*aType = nsIDOMCSSRule::KEYFRAMES_RULE;
return NS_OK;
}
void
nsCSSKeyframesRule::GetCssTextImpl(nsAString& aCssText) const
NS_IMETHODIMP
nsCSSKeyframesRule::GetCssText(nsAString& aCssText)
{
aCssText.AssignLiteral("@keyframes ");
aCssText.Append(mName);
@ -2266,6 +2426,32 @@ nsCSSKeyframesRule::GetCssTextImpl(nsAString& aCssText) const
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
@ -2572,20 +2758,47 @@ nsCSSPageRule::GetType() const
return Rule::PAGE_RULE;
}
uint16_t
nsCSSPageRule::Type() const
NS_IMETHODIMP
nsCSSPageRule::GetType(uint16_t* aType)
{
return nsIDOMCSSRule::PAGE_RULE;
*aType = nsIDOMCSSRule::PAGE_RULE;
return NS_OK;
}
void
nsCSSPageRule::GetCssTextImpl(nsAString& aCssText) const
NS_IMETHODIMP
nsCSSPageRule::GetCssText(nsAString& aCssText)
{
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
@ -2699,18 +2912,45 @@ NS_INTERFACE_MAP_BEGIN(CSSSupportsRule)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSSupportsRule)
NS_INTERFACE_MAP_END_INHERITING(GroupRule)
uint16_t
CSSSupportsRule::Type() const
// nsIDOMCSSRule methods
NS_IMETHODIMP
CSSSupportsRule::GetType(uint16_t* aType)
{
return nsIDOMCSSRule::SUPPORTS_RULE;
*aType = nsIDOMCSSRule::SUPPORTS_RULE;
return NS_OK;
}
void
CSSSupportsRule::GetCssTextImpl(nsAString& aCssText) const
NS_IMETHODIMP
CSSSupportsRule::GetCssText(nsAString& aCssText)
{
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
@ -2842,14 +3082,16 @@ nsCSSCounterStyleRule::GetType() const
return Rule::COUNTER_STYLE_RULE;
}
uint16_t
nsCSSCounterStyleRule::Type() const
// nsIDOMCSSRule methods
NS_IMETHODIMP
nsCSSCounterStyleRule::GetType(uint16_t* aType)
{
return nsIDOMCSSRule::COUNTER_STYLE_RULE;
*aType = nsIDOMCSSRule::COUNTER_STYLE_RULE;
return NS_OK;
}
void
nsCSSCounterStyleRule::GetCssTextImpl(nsAString& aCssText) const
NS_IMETHODIMP
nsCSSCounterStyleRule::GetCssText(nsAString& aCssText)
{
aCssText.AssignLiteral(u"@counter-style ");
nsStyleUtil::AppendEscapedCSSIdent(mName, aCssText);
@ -2859,10 +3101,7 @@ nsCSSCounterStyleRule::GetCssTextImpl(nsAString& aCssText) const
id = nsCSSCounterDesc(id + 1)) {
if (mValues[id].GetUnit() != eCSSUnit_Null) {
nsAutoString 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);
(this->*kGetters[id])(tmp);
aCssText.AppendLiteral(u" ");
AppendASCIItoUTF16(nsCSSProps::GetStringValue(id), aCssText);
aCssText.AppendLiteral(u": ");
@ -2871,6 +3110,32 @@ nsCSSCounterStyleRule::GetCssTextImpl(nsAString& aCssText) const
}
}
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,13 +67,15 @@ 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
@ -89,10 +91,6 @@ 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;
@ -101,7 +99,7 @@ public:
JS::Handle<JSObject*> aGivenProto) override;
protected:
void AppendConditionText(nsAString& aOutput) const;
void AppendConditionText(nsAString& aOutput);
RefPtr<nsMediaList> mMedia;
};
@ -123,13 +121,15 @@ 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,10 +169,6 @@ 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;
@ -180,7 +176,7 @@ public:
JS::Handle<JSObject*> aGivenProto) override;
protected:
void AppendConditionText(nsAString& aOutput) const;
void AppendConditionText(nsAString& aOutput);
nsAutoPtr<URL> mURLs; // linked list of |struct URL| above.
};
@ -233,9 +229,6 @@ 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
@ -271,19 +264,17 @@ 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,
@ -348,16 +339,14 @@ 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);
@ -438,16 +427,14 @@ 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; }
@ -489,20 +476,18 @@ 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;
@ -574,16 +559,14 @@ 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);
@ -614,7 +597,6 @@ 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;
@ -625,6 +607,9 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE
// nsIDOMCSSGroupingRule interface
NS_DECL_NSIDOMCSSGROUPINGRULE
@ -634,10 +619,6 @@ 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,
@ -679,16 +660,14 @@ 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,