Bug 1328420 Part 7: Uplift List debug method into StyleSheet. r=heycam

MozReview-Commit-ID: 7aqC6N6cZst

--HG--
extra : rebase_source : 059b441aa12c77aee5734d61a244248b5ccd06d8
This commit is contained in:
Brad Werth 2017-01-23 16:40:28 -08:00
Родитель 9fd72f68f3
Коммит f9a4e85ea6
7 изменённых файлов: 39 добавлений и 52 удалений

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

@ -725,36 +725,7 @@ ListRules(const nsCOMArray<css::Rule>& aRules, FILE* aOut, int32_t aIndent)
void
CSSStyleSheet::List(FILE* out, int32_t aIndent) const
{
int32_t index;
// Indent
nsAutoCString str;
for (index = aIndent; --index >= 0; ) {
str.AppendLiteral(" ");
}
str.AppendLiteral("CSS Style Sheet: ");
nsAutoCString urlSpec;
nsresult rv = mInner->mSheetURI->GetSpec(urlSpec);
if (NS_SUCCEEDED(rv) && !urlSpec.IsEmpty()) {
str.Append(urlSpec);
}
if (mMedia) {
str.AppendLiteral(" media: ");
nsAutoString buffer;
mMedia->GetText(buffer);
AppendUTF16toUTF8(buffer, str);
}
str.Append('\n');
fprintf_stderr(out, "%s", str.get());
for (const StyleSheet* child = GetFirstChild();
child;
child = child->mNext) {
child->List(out, aIndent + 1);
}
StyleSheet::List(out, aIndent);
fprintf_stderr(out, "%s", "Rules in source order:\n");
ListRules(mInner->mOrderedRules, out, aIndent);

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

@ -111,7 +111,7 @@ public:
// Find the ID of the owner inner window.
uint64_t FindOwningWindowInnerID() const;
#ifdef DEBUG
void List(FILE* out = stdout, int32_t aIndent = 0) const;
void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
// XXX do these belong here or are they generic?

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

@ -115,14 +115,6 @@ ServoStyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
MOZ_CRASH("stylo: not implemented");
}
#ifdef DEBUG
void
ServoStyleSheet::List(FILE* aOut, int32_t aIndex) const
{
MOZ_CRASH("stylo: not implemented");
}
#endif
css::Rule*
ServoStyleSheet::GetDOMOwnerRule() const
{

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

@ -55,10 +55,6 @@ public:
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
#ifdef DEBUG
void List(FILE* aOut = stdout, int32_t aIndex = 0) const;
#endif
RawServoStyleSheet* RawSheet() const { return mSheet; }
void SetSheetForImport(RawServoStyleSheet* aSheet) {
MOZ_ASSERT(!mSheet);

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

@ -432,6 +432,42 @@ StyleSheet::AppendStyleSheet(StyleSheet* aSheet)
DidDirty();
}
#ifdef DEBUG
void
StyleSheet::List(FILE* out, int32_t aIndent) const
{
int32_t index;
// Indent
nsAutoCString str;
for (index = aIndent; --index >= 0; ) {
str.AppendLiteral(" ");
}
str.AppendLiteral("CSS Style Sheet: ");
nsAutoCString urlSpec;
nsresult rv = GetSheetURI()->GetSpec(urlSpec);
if (NS_SUCCEEDED(rv) && !urlSpec.IsEmpty()) {
str.Append(urlSpec);
}
if (mMedia) {
str.AppendLiteral(" media: ");
nsAutoString buffer;
mMedia->GetText(buffer);
AppendUTF16toUTF8(buffer, str);
}
str.Append('\n');
fprintf_stderr(out, "%s", str.get());
for (const StyleSheet* child = GetFirstChild();
child;
child = child->mNext) {
child->List(out, aIndent + 1);
}
}
#endif
void
StyleSheet::SetMedia(nsMediaList* aMedia)
{

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

@ -153,7 +153,7 @@ public:
inline size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
#ifdef DEBUG
inline void List(FILE* aOut = stdout, int32_t aIndex = 0) const;
virtual void List(FILE* aOut = stdout, int32_t aIndex = 0) const;
#endif
// WebIDL StyleSheet API

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

@ -140,14 +140,6 @@ StyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
MOZ_STYLO_FORWARD(SizeOfIncludingThis, (aMallocSizeOf))
}
#ifdef DEBUG
void
StyleSheet::List(FILE* aOut, int32_t aIndex) const
{
MOZ_STYLO_FORWARD(List, (aOut, aIndex))
}
#endif
void StyleSheet::WillDirty() { MOZ_STYLO_FORWARD(WillDirty, ()) }
void StyleSheet::DidDirty() { MOZ_STYLO_FORWARD(DidDirty, ()) }