Bug 739972 - Stop using GetChildAt in svg layout code. r=dholbert
authorRobert Longson <longsonr@gmail.com>
Thu, 29 Mar 2012 09:41:37 +0100
changeset 93917 55a95cfe5ab902ac4e03043a0c927a61681bd44c
parent 93916 b604d4e1916d87373f06b4209d7f0cb672c4fa17
child 93918 76d72796ceeea36db202b27966d3281f56f9b6b4
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs739972
milestone14.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 739972 - Stop using GetChildAt in svg layout code. r=dholbert
layout/svg/base/src/nsSVGFilterFrame.cpp
layout/svg/base/src/nsSVGFilterInstance.cpp
--- a/layout/svg/base/src/nsSVGFilterFrame.cpp
+++ b/layout/svg/base/src/nsSVGFilterFrame.cpp
@@ -298,19 +298,19 @@ nsSVGFilterFrame::GetLengthValue(PRUint3
   nsSVGFilterFrame *next = GetReferencedFilterIfNotInUse();
   return next ? next->GetLengthValue(aIndex, aDefault) :
     &static_cast<nsSVGFilterElement *>(aDefault)->mLengthAttributes[aIndex];
 }
 
 const nsSVGFilterElement *
 nsSVGFilterFrame::GetFilterContent(nsIContent *aDefault)
 {
-  PRUint32 count = mContent->GetChildCount();
-  for (PRUint32 i = 0; i < count; ++i) {
-    nsIContent* child = mContent->GetChildAt(i);
+  for (nsIContent* child = mContent->GetFirstChild();
+       child;
+       child = child->GetNextSibling()) {
     nsRefPtr<nsSVGFE> primitive;
     CallQueryInterface(child, (nsSVGFE**)getter_AddRefs(primitive));
     if (primitive) {
       return static_cast<nsSVGFilterElement *>(mContent);
     }
   }
 
   AutoFilterReferencer filterRef(this);
--- a/layout/svg/base/src/nsSVGFilterInstance.cpp
+++ b/layout/svg/base/src/nsSVGFilterInstance.cpp
@@ -194,34 +194,33 @@ nsSVGFilterInstance::BuildSources()
   return NS_OK;
 }
 
 nsresult
 nsSVGFilterInstance::BuildPrimitives()
 {
   // First build mFilterInfo. It's important that we don't change that
   // array after we start storing pointers to its elements!
-  PRUint32 count = mFilterElement->GetChildCount();
-  PRUint32 i;
-  for (i = 0; i < count; ++i) {
-    nsIContent* child = mFilterElement->GetChildAt(i);
+  for (nsIContent* child = mFilterElement->nsINode::GetFirstChild();
+       child;
+       child = child->GetNextSibling()) {
     nsRefPtr<nsSVGFE> primitive;
     CallQueryInterface(child, (nsSVGFE**)getter_AddRefs(primitive));
     if (!primitive)
       continue;
 
     PrimitiveInfo* info = mPrimitives.AppendElement();
     info->mFE = primitive;
   }
 
   // Now fill in all the links
   nsTHashtable<ImageAnalysisEntry> imageTable;
   imageTable.Init(10);
 
-  for (i = 0; i < mPrimitives.Length(); ++i) {
+  for (PRUint32 i = 0; i < mPrimitives.Length(); ++i) {
     PrimitiveInfo* info = &mPrimitives[i];
     nsSVGFE* filter = info->mFE;
     nsAutoTArray<nsSVGStringInfo,2> sources;
     filter->GetSourceImageNames(sources);
  
     for (PRUint32 j=0; j<sources.Length(); ++j) {
       nsAutoString str;
       sources[j].mString->GetAnimValue(str, sources[j].mElement);