Bug 813373, patch 3: Make sure all style rules have non-empty List implementations. r=bzbarsky

This commit is contained in:
L. David Baron 2012-11-20 11:55:14 -08:00
parent 810e59b56b
commit be38660c66
6 changed files with 48 additions and 11 deletions

View File

@ -256,6 +256,8 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData)
/* virtual */ void
BodyRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
printf("[body rule] {}\n");
}
#endif

View File

@ -185,7 +185,16 @@ AnimValuesStyleRule::MapRuleInfoInto(nsRuleData* aRuleData)
/* virtual */ void
AnimValuesStyleRule::List(FILE* out, int32_t aIndent) const
{
// WRITE ME?
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
printf("[anim values] { ");
for (uint32_t i = 0, i_end = mPropertyValuePairs.Length(); i < i_end; ++i) {
const PropertyValuePair &pair = mPropertyValuePairs[i];
nsAutoString value;
nsStyleAnimation::UncomputeValue(pair.mProperty, pair.mValue, value);
printf("%s: %s; ", nsCSSProps::GetStringValue(pair.mProperty).get(),
NS_ConvertUTF16toUTF8(value).get());
}
printf("}\n");
}
#endif

View File

@ -1991,7 +1991,14 @@ nsCSSKeyframeRule::MapRuleInfoInto(nsRuleData* aRuleData)
void
nsCSSKeyframeRule::List(FILE* out, int32_t aIndent) const
{
// FIXME: WRITE ME
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
nsAutoString tmp;
DoGetKeyText(tmp);
fputs(NS_ConvertUTF16toUTF8(tmp).get(), out);
fputs(" ", out);
mDeclaration->List(out, aIndent);
fputs("\n", out);
}
#endif
@ -2011,7 +2018,7 @@ nsCSSKeyframeRule::GetType(uint16_t* aType)
NS_IMETHODIMP
nsCSSKeyframeRule::GetCssText(nsAString& aCssText)
{
nsCSSKeyframeRule::GetKeyText(aCssText);
DoGetKeyText(aCssText);
aCssText.AppendLiteral(" { ");
nsAutoString tmp;
mDeclaration->ToString(tmp);
@ -2041,6 +2048,13 @@ nsCSSKeyframeRule::GetParentRule(nsIDOMCSSRule** aParentRule)
NS_IMETHODIMP
nsCSSKeyframeRule::GetKeyText(nsAString& aKeyText)
{
DoGetKeyText(aKeyText);
return NS_OK;
}
void
nsCSSKeyframeRule::DoGetKeyText(nsAString& aKeyText) const
{
aKeyText.Truncate();
uint32_t i = 0, i_end = mKeys.Length();
@ -2053,7 +2067,6 @@ nsCSSKeyframeRule::GetKeyText(nsAString& aKeyText)
}
aKeyText.AppendLiteral(", ");
}
return NS_OK;
}
NS_IMETHODIMP
@ -2157,7 +2170,10 @@ NS_INTERFACE_MAP_END_INHERITING(GroupRule)
void
nsCSSKeyframesRule::List(FILE* out, int32_t aIndent) const
{
// FIXME: WRITE ME
for (int32_t indent = aIndent; --indent >= 0; ) fputs(" ", out);
fprintf(out, "@keyframes %s", NS_ConvertUTF16toUTF8(mName).get());
GroupRule::List(out, aIndent);
}
#endif
@ -2440,7 +2456,11 @@ IMPL_STYLE_RULE_INHERIT_GET_DOM_RULE_WEAK(nsCSSPageRule, Rule)
void
nsCSSPageRule::List(FILE* out, int32_t aIndent) const
{
// FIXME: WRITE ME
for (int32_t indent = aIndent; --indent >= 0; ) fputs(" ", out);
fputs("@page ", out);
mDeclaration->List(out, aIndent);
fputs("\n", out);
}
#endif
@ -2555,12 +2575,8 @@ CSSSupportsRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t indent = aIndent; --indent >= 0; ) fputs(" ", out);
nsAutoString buffer;
fputs("@supports ", out);
fputs(NS_LossyConvertUTF16toASCII(mCondition).get(), out);
fputs(NS_ConvertUTF16toUTF8(mCondition).get(), out);
css::GroupRule::List(out, aIndent);
}
#endif

View File

@ -371,6 +371,8 @@ public:
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE;
void DoGetKeyText(nsAString &aKeyText) const;
private:
nsAutoTArray<float, 1> mKeys;
nsAutoPtr<mozilla::css::Declaration> mDeclaration;

View File

@ -58,6 +58,8 @@ nsHTMLStyleSheet::HTMLColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
/* virtual */ void
nsHTMLStyleSheet::HTMLColorRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
printf("[html color rule] {}\n");
}
#endif
@ -68,6 +70,8 @@ NS_IMPL_ISUPPORTS1(nsHTMLStyleSheet::GenericTableRule, nsIStyleRule)
/* virtual */ void
nsHTMLStyleSheet::GenericTableRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
printf("[generic table rule] {}\n");
}
#endif

View File

@ -45,6 +45,8 @@ nsEmptyStyleRule::MapRuleInfoInto(nsRuleData* aRuleData)
/* virtual */ void
nsEmptyStyleRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
printf("[empty style rule] {}\n");
}
#endif
@ -89,6 +91,8 @@ nsInitialStyleRule::MapRuleInfoInto(nsRuleData* aRuleData)
/* virtual */ void
nsInitialStyleRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
printf("[initial style rule] {}\n");
}
#endif