Bug 1328786 - Part 1: Add an FFI function for expanding nsStyleAutoArray. r?heycam draft
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Fri, 06 Jan 2017 19:06:53 +0900
changeset 456837 092af97191fd21925efa20b08960c8a4e9e88c01
parent 455592 fc0633f43b5bde982c04cdf3a1aea8d43a150636
child 456838 90bed2e59e5f9958ce238ef4e37414c84a582f8f
push id40619
push userhiikezoe@mozilla-japan.org
push dateFri, 06 Jan 2017 10:07:41 +0000
reviewersheycam
bugs1328786
milestone53.0a1
Bug 1328786 - Part 1: Add an FFI function for expanding nsStyleAutoArray. r?heycam MozReview-Commit-ID: 5Scwfcwrj6T
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -882,16 +882,25 @@ Gecko_EnsureImageLayersLength(nsStyleIma
   aLayers->mLayers.EnsureLengthAtLeast(aLen);
 
   for (size_t i = oldLength; i < aLen; ++i) {
     aLayers->mLayers[i].Initialize(aLayerType);
   }
 }
 
 void
+Gecko_EnsureStyleAnimationArrayLength(void* aArray, size_t aLen)
+{
+  auto base =
+    reinterpret_cast<nsStyleAutoArray<StyleAnimation>*>(aArray);
+
+  base->EnsureLengthAtLeast(aLen);
+}
+
+void
 Gecko_ResetStyleCoord(nsStyleUnit* aUnit, nsStyleUnion* aValue)
 {
   nsStyleCoord::Reset(*aUnit, *aValue);
 }
 
 void
 Gecko_SetStyleCoordCalcValue(nsStyleUnit* aUnit, nsStyleUnion* aValue, nsStyleCoord::CalcValue aCalc)
 {
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -250,16 +250,18 @@ void Gecko_ClearPODTArray(void* array, s
 // destructors, otherwise we'd leak the images (though we still don't support
 // those), strings, and whatnot.
 void Gecko_ClearStyleContents(nsStyleContent* content);
 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);
+
 // Clean up pointer-based coordinates
 void Gecko_ResetStyleCoord(nsStyleUnit* unit, nsStyleUnion* value);
 
 // Set an nsStyleCoord to a computed `calc()` value
 void Gecko_SetStyleCoordCalcValue(nsStyleUnit* unit, nsStyleUnion* value, nsStyleCoord::CalcValue calc);
 
 void Gecko_CopyClipPathValueFrom(mozilla::StyleClipPath* dst, const mozilla::StyleClipPath* src);