Bug 1295662 - stylo: Add bindings for StyleClipPath; r=heycam
authorManish Goregaokar <manishearth@gmail.com>
Mon, 15 Aug 2016 21:18:11 +0530
changeset 309913 8bb342dfaa0e8d44f6eefc35aa8e040c1e0a8b3c
parent 309912 751ab2b45ddce43b1ba342cc17e00c08ebeb1732
child 309914 6e47ce14d2b8ccbc1adfcfd6a0b984d7f2993ebb
push id31476
push usercmccormack@mozilla.com
push dateThu, 18 Aug 2016 07:41:31 +0000
treeherderautoland@8bb342dfaa0e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1295662
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
@@ -741,16 +741,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
@@ -232,16 +232,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.
 RawServoStyleSheetStrong Servo_StylesheetFromUTF8Bytes(
     const uint8_t* bytes, uint32_t length,
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -2600,17 +2600,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;
   StyleFillRule mFillRule;
 
   // mCoordinates has coordinates for polygon or radii for