Bug 1363664 - Add bindings for StyleGridTemplate and nsTArray<nsString>; r?heycam
MozReview-Commit-ID: AsVxzu4SUu9
--- 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);