Bug 1295662 - stylo: Add bindings for StyleClipPath; r?heycam
MozReview-Commit-ID: E1ALXo7qd43
--- 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