Bug 1363664 - Add bindings for StyleGridTemplate and nsTArray<nsString>; r?heycam draft
authorRavi Shankar <wafflespeanut@gmail.com>
Thu, 18 May 2017 23:26:21 +0530
changeset 580577 551c687298182f780fd094423b653b0a7a01b5fb
parent 580040 baf05f61bc14fdf45511bc1165ce76daa08c5c0f
child 580578 f88b4cc19ed934eeda94cfb782d38ea54f42eb01
child 580582 a54c07623901f6ab6efffc57daab5337cdb7a456
child 580601 939d40109725e86b56843d626463851d9b2a1607
child 580602 d38e2b8c591e2c4199f0f3f1c062eae29318b53c
child 580604 811b8f4da80e05f0e80267055ca8389834640e2d
push id59619
push userwafflespeanut@gmail.com
push dateThu, 18 May 2017 18:42:22 +0000
reviewersheycam
bugs1363664
milestone55.0a1
Bug 1363664 - Add bindings for StyleGridTemplate and nsTArray<nsString>; r?heycam MozReview-Commit-ID: AsVxzu4SUu9
js/src/devtools/rootAnalysis/analyzeHeapWrites.js
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
--- a/js/src/devtools/rootAnalysis/analyzeHeapWrites.js
+++ b/js/src/devtools/rootAnalysis/analyzeHeapWrites.js
@@ -175,16 +175,18 @@ function treatAsSafeArgument(entry, varN
         ["Gecko_DestroyClipPath", "aClip", null],
         ["Gecko_ResetFilters", "effects", null],
         ["Gecko_CopyFiltersFrom", "aDest", null],
         [/Gecko_CSSValue_Set/, "aCSSValue", null],
         ["Gecko_CSSValue_Drop", "aCSSValue", null],
         ["Gecko_CSSFontFaceRule_GetCssText", "aResult", null],
         ["Gecko_EnsureTArrayCapacity", "aArray", null],
         ["Gecko_ClearPODTArray", "aArray", null],
+        ["Gecko_SetStyleGridTemplateArrayLengths", "aValue", null],
+        ["Gecko_ResizeTArrayForStrings", "aArray", null],
         ["Gecko_ClearAndResizeStyleContents", "aContent", null],
         [/Gecko_ClearAndResizeCounter/, "aContent", null],
         [/Gecko_CopyCounter.*?From/, "aContent", null],
         [/Gecko_SetContentDataImageValue/, "aList", null],
         [/Gecko_SetContentData/, "aContent", null],
         [/Gecko_EnsureStyle.*?ArrayLength/, "aArray", null],
         ["Gecko_GetOrCreateKeyframeAtStart", "aKeyframes", null],
         ["Gecko_GetOrCreateInitialKeyframe", "aKeyframes", null],
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -1373,16 +1373,29 @@ Gecko_ClearPODTArray(void* aArray, size_
   auto base =
     reinterpret_cast<nsTArray_base<nsTArrayInfallibleAllocator,
                                    nsTArray_CopyWithMemutils>*>(aArray);
 
   base->template ShiftData<nsTArrayInfallibleAllocator>(0, base->Length(), 0,
                                                         aElementSize, aElementAlign);
 }
 
+void Gecko_SetStyleGridTemplateArrayLengths(nsStyleGridTemplate* aValue,
+                                            uint32_t aTrackSizes)
+{
+  aValue->mMinTrackSizingFunctions.SetLength(aTrackSizes);
+  aValue->mMaxTrackSizingFunctions.SetLength(aTrackSizes);
+  aValue->mLineNameLists.SetLength(aTrackSizes + 1);
+}
+
+void Gecko_ResizeTArrayForStrings(nsTArray<nsString>* aArray, uint32_t aLength)
+{
+  aArray->SetLength(aLength);
+}
+
 void
 Gecko_CopyStyleGridTemplateValues(nsStyleGridTemplate* aGridTemplate,
                                   const nsStyleGridTemplate* aOther)
 {
   *aGridTemplate = *aOther;
 }
 
 mozilla::css::GridTemplateAreasValue*
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -349,16 +349,21 @@ void Gecko_DropElementSnapshot(ServoElem
 void Gecko_EnsureTArrayCapacity(void* array, size_t capacity, size_t elem_size);
 
 // Same here, `array` must be an nsTArray<T>, for some T.
 //
 // Important note: Only valid for POD types, since destructors won't be run
 // otherwise. This is ensured with rust traits for the relevant structs.
 void Gecko_ClearPODTArray(void* array, size_t elem_size, size_t elem_align);
 
+void Gecko_ResizeTArrayForStrings(nsTArray<nsString>* array, uint32_t length);
+
+void Gecko_SetStyleGridTemplateArrayLengths(nsStyleGridTemplate* grid_template,
+                                            uint32_t track_sizes);
+
 void Gecko_CopyStyleGridTemplateValues(nsStyleGridTemplate* grid_template,
                                        const nsStyleGridTemplate* other);
 
 mozilla::css::GridTemplateAreasValue* Gecko_NewGridTemplateAreasValue(uint32_t areas,
                                                                       uint32_t templates,
                                                                       uint32_t columns);
 NS_DECL_THREADSAFE_FFI_REFCOUNTING(mozilla::css::GridTemplateAreasValue, GridTemplateAreasValue);