Bug 1259734 - use AppendElements in DisplayItemClip::AppendRoundedRects; r=dholbert
authorNathan Froyd <froydnj.com>
Fri, 25 Mar 2016 09:34:37 -0400
changeset 291078 c24b873c12cb8a1c3753d725fe649e3848672b8d
parent 291077 364b20e86805a62113e5262a0292a6a15dbfff1b
child 291079 3f5ed1912b14b7a1f2ae9d9697f9a65f3ec516a1
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1259734
milestone48.0a1
Bug 1259734 - use AppendElements in DisplayItemClip::AppendRoundedRects; r=dholbert It is shorter and nicer than writing out the loop ourselves.
layout/base/DisplayItemClip.cpp
--- a/layout/base/DisplayItemClip.cpp
+++ b/layout/base/DisplayItemClip.cpp
@@ -398,20 +398,18 @@ DisplayItemClip::GetCommonRoundedRectCou
     }
   }
   return clipCount;
 }
 
 void
 DisplayItemClip::AppendRoundedRects(nsTArray<RoundedRect>* aArray, uint32_t aCount) const
 {
-  uint32_t count = std::min(mRoundedClipRects.Length(), size_t(aCount));
-  for (uint32_t i = 0; i < count; ++i) {
-    *aArray->AppendElement() = mRoundedClipRects[i];
-  }
+  size_t count = std::min(mRoundedClipRects.Length(), size_t(aCount));
+  aArray->AppendElements(mRoundedClipRects.Elements(), count);
 }
 
 bool
 DisplayItemClip::ComputeRegionInClips(DisplayItemClip* aOldClip,
                                       const nsPoint& aShift,
                                       nsRegion* aCombined) const
 {
   if (!mHaveClipRect || (aOldClip && !aOldClip->mHaveClipRect)) {