Bug 1295662 - stylo: Add bindings for StyleClipPath; r?heycam draft
authorManish Goregaokar <manishearth@gmail.com>
Mon, 15 Aug 2016 21:18:11 +0530
changeset 402422 38cf5b6806f5b1c8283d9dcd5820ae72e6f8e670
parent 402421 20e98f27bc2145d64b97c6c1724637f99099e8b8
child 528655 c9a257e568488536dfe8895a41f64fb9a21d70c3
push id26641
push userbmo:manishearth@gmail.com
push dateThu, 18 Aug 2016 05:54:41 +0000
reviewersheycam
bugs1295662
milestone51.0a1
Bug 1295662 - stylo: Add bindings for StyleClipPath; r?heycam MozReview-Commit-ID: E1ALXo7qd43
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
layout/style/nsStyleStruct.h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -730,16 +730,38 @@ Gecko_SetStyleCoordCalcValue(nsStyleUnit
   calcRef->mLength = aCalc.mLength;
   calcRef->mPercent = aCalc.mPercent;
   calcRef->mHasPercent = aCalc.mHasPercent;
   *aUnit = nsStyleUnit::eStyleUnit_Calc;
   aValue->mPointer = calcRef;
   calcRef->AddRef();
 }
 
+void
+Gecko_CopyClipPathValueFrom(mozilla::StyleClipPath* aDst, const mozilla::StyleClipPath* aSrc)
+{
+  MOZ_ASSERT(aDst);
+  MOZ_ASSERT(aSrc);
+
+  *aDst = *aSrc;
+}
+
+void
+Gecko_DestroyClipPath(mozilla::StyleClipPath* aClip)
+{
+  aClip->~StyleClipPath();
+}
+
+mozilla::StyleBasicShape*
+Gecko_NewBasicShape(mozilla::StyleBasicShapeType aType)
+{
+  RefPtr<StyleBasicShape> ptr = new mozilla::StyleBasicShape(aType);
+  return ptr.forget().take();
+}
+
 NS_IMPL_THREADSAFE_FFI_REFCOUNTING(nsStyleCoord::Calc, Calc);
 
 #define STYLE_STRUCT(name, checkdata_cb)                                      \
                                                                               \
 void                                                                          \
 Gecko_Construct_nsStyle##name(nsStyle##name* ptr)                             \
 {                                                                             \
   new (ptr) nsStyle##name(StyleStructContext::ServoContext());                \
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -210,16 +210,21 @@ void Gecko_InitializeImageLayer(nsStyleI
                                 nsStyleImageLayers::LayerType layer_type);
 
 // 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);
+
+void Gecko_DestroyClipPath(mozilla::StyleClipPath* clip);
+mozilla::StyleBasicShape* Gecko_NewBasicShape(mozilla::StyleBasicShapeType type);
+
 NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsStyleCoord::Calc, Calc);
 
 // Styleset and Stylesheet management.
 //
 // TODO: Make these return already_AddRefed and UniquePtr when the binding
 // generator is smart enough to handle them.
 RawServoStyleSheet* Servo_StylesheetFromUTF8Bytes(
     const uint8_t* bytes, uint32_t length,
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -2596,17 +2596,17 @@ public:
            mCoordinates == aOther.mCoordinates &&
            mPosition == aOther.mPosition &&
            mRadius == aOther.mRadius;
   }
   bool operator!=(const StyleBasicShape& aOther) const {
     return !(*this == aOther);
   }
 
-  NS_INLINE_DECL_REFCOUNTING(StyleBasicShape);
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(StyleBasicShape);
 
 private:
   ~StyleBasicShape() {}
 
   StyleBasicShapeType mType;
   int32_t mFillRule;
 
   // mCoordinates has coordinates for polygon or radii for