Bug 1361985 - Add Servo bindings for GridTemplateAreasValue draft
authorAnthony Ramine <n.oxyde@gmail.com>
Thu, 04 May 2017 12:24:01 +0200
changeset 572589 13182219ac507d584104fcfbb3509c9781dbdb1b
parent 571272 48c0fd9c9ec5d68061ea7b59358874ae8da72572
child 572590 b6da8390dbe3360cdecac9c5738a01c1c00a3081
push id57118
push userbmo:nox@mozilla.com
push dateThu, 04 May 2017 10:30:03 +0000
bugs1361985
milestone55.0a1
Bug 1361985 - Add Servo bindings for GridTemplateAreasValue MozReview-Commit-ID: fi5j076kwH
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
layout/style/nsCSSValue.h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -1323,16 +1323,28 @@ Gecko_ClearPODTArray(void* aArray, size_
 
 void
 Gecko_CopyStyleGridTemplateValues(nsStyleGridTemplate* aGridTemplate,
                                   const nsStyleGridTemplate* aOther)
 {
   *aGridTemplate = *aOther;
 }
 
+mozilla::css::GridTemplateAreasValue*
+Gecko_NewGridTemplateAreasValue(uint32_t aAreas, uint32_t aTemplates, uint32_t aColumns)
+{
+  RefPtr<mozilla::css::GridTemplateAreasValue> value = new mozilla::css::GridTemplateAreasValue;
+  value->mNamedAreas.SetLength(aAreas);
+  value->mTemplates.SetLength(aTemplates);
+  value->mNColumns = aColumns;
+  return value.forget().take();
+}
+
+NS_IMPL_THREADSAFE_FFI_REFCOUNTING(mozilla::css::GridTemplateAreasValue, GridTemplateAreasValue);
+
 void
 Gecko_ClearAndResizeStyleContents(nsStyleContent* aContent, uint32_t aHowMany)
 {
   aContent->AllocateContents(aHowMany);
 }
 
 void
 Gecko_CopyStyleContentsFrom(nsStyleContent* aContent, const nsStyleContent* aOther)
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -329,16 +329,21 @@ void Gecko_EnsureTArrayCapacity(void* ar
 //
 // 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_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);
+
 // Clear the mContents, mCounterIncrements, or mCounterResets field in nsStyleContent. This is
 // needed to run the destructors, otherwise we'd leak the images, strings, and whatnot.
 void Gecko_ClearAndResizeStyleContents(nsStyleContent* content,
                                        uint32_t how_many);
 void Gecko_ClearAndResizeCounterIncrements(nsStyleContent* content,
                                            uint32_t how_many);
 void Gecko_ClearAndResizeCounterResets(nsStyleContent* content,
                                        uint32_t how_many);
--- a/layout/style/nsCSSValue.h
+++ b/layout/style/nsCSSValue.h
@@ -272,17 +272,17 @@ struct GridTemplateAreasValue final {
     return mTemplates == aOther.mTemplates;
   }
 
   bool operator!=(const GridTemplateAreasValue& aOther) const
   {
     return !(*this == aOther);
   }
 
-  NS_INLINE_DECL_REFCOUNTING(GridTemplateAreasValue)
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GridTemplateAreasValue)
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
 private:
   // Private destructor to make sure this isn't used as a stack variable
   // or member variable.
   ~GridTemplateAreasValue()
   {