Bug 1343751 - ensure_len() for nsStyleAutoArray<StyleTransition>. r=emilio
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Fri, 03 Mar 2017 08:35:33 +0900
changeset 346178 a88ced8a00c12f83510cc451a24d4ec5e8411bd3
parent 346177 6fd0547de79f79e01eae62498659902cff82a45b
child 346179 cf95c2d49e1ca52fdddb86a808682a4b675c0eae
push id31459
push usercbook@mozilla.com
push dateTue, 07 Mar 2017 14:05:14 +0000
treeherdermozilla-central@1fb56ba248d5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1343751
milestone54.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 1343751 - ensure_len() for nsStyleAutoArray<StyleTransition>. r=emilio MozReview-Commit-ID: 2xCExdpldWQ
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -988,16 +988,31 @@ Gecko_EnsureStyleAnimationArrayLength(vo
 
   base->EnsureLengthAtLeast(aLen);
 
   for (size_t i = oldLength; i < aLen; ++i) {
     (*base)[i].SetInitialValues();
   }
 }
 
+void
+Gecko_EnsureStyleTransitionArrayLength(void* aArray, size_t aLen)
+{
+  auto base =
+    reinterpret_cast<nsStyleAutoArray<StyleTransition>*>(aArray);
+
+  size_t oldLength = base->Length();
+
+  base->EnsureLengthAtLeast(aLen);
+
+  for (size_t i = oldLength; i < aLen; ++i) {
+    (*base)[i].SetInitialValues();
+  }
+}
+
 Keyframe*
 Gecko_AnimationAppendKeyframe(RawGeckoKeyframeListBorrowedMut aKeyframes,
                               float aOffset,
                               const nsTimingFunction* aTimingFunction)
 {
   Keyframe* keyframe = aKeyframes->AppendElement();
   keyframe->mOffset.emplace(aOffset);
   if (aTimingFunction &&
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -269,16 +269,17 @@ void Gecko_ClearPODTArray(void* array, s
 void Gecko_ClearAndResizeStyleContents(nsStyleContent* content,
                                        uint32_t how_many);
 void Gecko_CopyStyleContentsFrom(nsStyleContent* content, const nsStyleContent* other);
 
 void Gecko_EnsureImageLayersLength(nsStyleImageLayers* layers, size_t len,
                                    nsStyleImageLayers::LayerType layer_type);
 
 void Gecko_EnsureStyleAnimationArrayLength(void* array, size_t len);
+void Gecko_EnsureStyleTransitionArrayLength(void* array, size_t len);
 
 mozilla::Keyframe* Gecko_AnimationAppendKeyframe(RawGeckoKeyframeListBorrowedMut keyframes,
                                                  float offset,
                                                  const nsTimingFunction* timingFunction);
 
 // Clean up pointer-based coordinates
 void Gecko_ResetStyleCoord(nsStyleUnit* unit, nsStyleUnion* value);