Bug 1100773 patch 3 - Add an aListDescendants boolean to nsStyleContext::List. r=heycam
authorL. David Baron <dbaron@dbaron.org>
Wed, 26 Nov 2014 22:29:45 -0800
changeset 242144 3e2da595d50d4da8b43a9e65deac79603dd578f6
parent 242143 6eefbe681697e947e88b2ddcd6329f76340c82c2
child 242145 0ae211c02f121e4ad16f3544ecacc38400a94f1a
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1100773
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1100773 patch 3 - Add an aListDescendants boolean to nsStyleContext::List. r=heycam
layout/style/nsStyleContext.cpp
layout/style/nsStyleContext.h
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -853,17 +853,17 @@ nsStyleContext::Mark()
     do {
       child->Mark();
       child = child->mNextSibling;
     } while (mEmptyChild != child);
   }
 }
 
 #ifdef DEBUG
-void nsStyleContext::List(FILE* out, int32_t aIndent)
+void nsStyleContext::List(FILE* out, int32_t aIndent, bool aListDescendants)
 {
   nsAutoCString str;
   // Indent
   int32_t ix;
   for (ix = aIndent; --ix >= 0; ) {
     str.AppendLiteral("  ");
   }
   str.Append(nsPrintfCString("%p(%d) parent=%p ",
@@ -890,29 +890,31 @@ void nsStyleContext::List(FILE* out, int
       str.AppendLiteral("  ");
     }
     fprintf_stderr(out, "%s}\n", str.get());
   }
   else {
     fprintf_stderr(out, "%s{}\n", str.get());
   }
 
-  if (nullptr != mChild) {
-    nsStyleContext* child = mChild;
-    do {
-      child->List(out, aIndent + 1);
-      child = child->mNextSibling;
-    } while (mChild != child);
-  }
-  if (nullptr != mEmptyChild) {
-    nsStyleContext* child = mEmptyChild;
-    do {
-      child->List(out, aIndent + 1);
-      child = child->mNextSibling;
-    } while (mEmptyChild != child);
+  if (aListDescendants) {
+    if (nullptr != mChild) {
+      nsStyleContext* child = mChild;
+      do {
+        child->List(out, aIndent + 1, aListDescendants);
+        child = child->mNextSibling;
+      } while (mChild != child);
+    }
+    if (nullptr != mEmptyChild) {
+      nsStyleContext* child = mEmptyChild;
+      do {
+        child->List(out, aIndent + 1, aListDescendants);
+        child = child->mNextSibling;
+      } while (mEmptyChild != child);
+    }
   }
 }
 #endif
 
 // Overloaded new operator. Initializes the memory to 0 and relies on an arena
 // (which comes from the presShell) to perform the allocation.
 void* 
 nsStyleContext::operator new(size_t sz, nsPresContext* aPresContext) CPP_THROW_NEW
--- a/layout/style/nsStyleContext.h
+++ b/layout/style/nsStyleContext.h
@@ -390,17 +390,17 @@ public:
 
   /**
    * On each descendant of this style context, clears out any cached inherited
    * structs indicated in aStructs.
    */
   void ClearCachedInheritedStyleDataOnDescendants(uint32_t aStructs);
 
 #ifdef DEBUG
-  void List(FILE* out, int32_t aIndent);
+  void List(FILE* out, int32_t aIndent, bool aListDescendants = true);
   static void AssertStyleStructMaxDifferenceValid();
   static const char* StructName(nsStyleStructID aSID);
   static bool LookupStruct(const nsACString& aName, nsStyleStructID& aResult);
 #endif
 
 #ifdef RESTYLE_LOGGING
   nsCString GetCachedStyleDataAsString(uint32_t aStructs);
   void LogStyleContextTree(int32_t aLoggingDepth, uint32_t aStructs);