Bug 645203. Make sure we skip non-XUL nodes inside trees; r=neil
authorTimothy Nikkel <tnikkel@gmail.com>
Wed, 06 Apr 2011 10:52:07 -0700
changeset 67574 65281fbb49eca5ecb2452d057b43eb147a68cade
parent 67573 1bed280a15754fc5f1554f3f8ae6d59a8ef0a9a6
child 67575 e03e24a4f7fafb28830b038386f520a59a121a9a
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersneil
bugs645203
milestone2.2a1pre
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 645203. Make sure we skip non-XUL nodes inside trees; r=neil
layout/xul/base/src/tree/src/nsTreeContentView.cpp
--- a/layout/xul/base/src/tree/src/nsTreeContentView.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeContentView.cpp
@@ -1138,17 +1138,17 @@ nsTreeContentView::SerializeItem(nsICont
   if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::container,
                             nsGkAtoms::_true, eCaseMatters)) {
     row->SetContainer(PR_TRUE);
     if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
                               nsGkAtoms::_true, eCaseMatters)) {
       row->SetOpen(PR_TRUE);
       nsIContent* child =
         nsTreeUtils::GetImmediateChild(aContent, nsGkAtoms::treechildren);
-      if (child) {
+      if (child && child->IsXUL()) {
         // Now, recursively serialize our child.
         PRInt32 count = aRows.Length();
         PRInt32 index = 0;
         Serialize(child, aParentIndex + *aIndex + 1, &index, aRows);
         row->mSubtreeSize += aRows.Length() - count;
       }
       else
         row->SetEmpty(PR_TRUE);
@@ -1196,17 +1196,17 @@ nsTreeContentView::GetIndexInSubtree(nsI
                                    nsGkAtoms::_true, eCaseMatters)) {
           (*aIndex)++;
           if (content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::container,
                                    nsGkAtoms::_true, eCaseMatters) &&
               content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
                                    nsGkAtoms::_true, eCaseMatters)) {
             nsIContent* child =
               nsTreeUtils::GetImmediateChild(content, nsGkAtoms::treechildren);
-            if (child)
+            if (child && child->IsXUL())
               GetIndexInSubtree(child, aContent, aIndex);
           }
         }
       }
       else if (tag == nsGkAtoms::treeseparator) {
         if (! content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden,
                                    nsGkAtoms::_true, eCaseMatters))
           (*aIndex)++;
@@ -1217,17 +1217,17 @@ nsTreeContentView::GetIndexInSubtree(nsI
 
 PRInt32
 nsTreeContentView::EnsureSubtree(PRInt32 aIndex)
 {
   Row* row = mRows[aIndex];
 
   nsIContent* child;
   child = nsTreeUtils::GetImmediateChild(row->mContent, nsGkAtoms::treechildren);
-  if (! child) {
+  if (!child || !child->IsXUL()) {
     return 0;
   }
 
   nsAutoTArray<Row*, 8> rows;
   PRInt32 index = 0;
   Serialize(child, aIndex, &index, rows);
   mRows.InsertElementsAt(aIndex + 1, rows);
   PRInt32 count = rows.Length();