Bug 1291863: Add some type replacements to fix the Servo binding generation. draft
authorEmilio Cobos Álvarez <ecoal95@gmail.com>
Wed, 03 Aug 2016 13:22:00 -0700
changeset 396425 fda9189d4ca209d63f32555d9a2b858e2b70ca9b
parent 396423 0d25af5ef2b4972348403b67ceef8200075e433a
child 527198 8ccb06ca27a947c9b7fd9deb4e14945e691afa86
push id24995
push userbmo:ealvarez@mozilla.com
push dateWed, 03 Aug 2016 20:27:27 +0000
bugs1291863
milestone51.0a1
Bug 1291863: Add some type replacements to fix the Servo binding generation. MozReview-Commit-ID: 63eXtp2otFa
layout/style/nsStyleStruct.h
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -3819,16 +3819,40 @@ struct nsRect_Simple {
 
 STATIC_ASSERT_TYPE_LAYOUTS_MATCH(nsRect, nsRect_Simple);
 STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsRect, nsRect_Simple, x);
 STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsRect, nsRect_Simple, y);
 STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsRect, nsRect_Simple, width);
 STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsRect, nsRect_Simple, height);
 
 /**
+ * <div rustbindgen="true" replaces="nsSize">
+ */
+struct nsSize_Simple {
+  nscoord width, height;
+};
+
+STATIC_ASSERT_TYPE_LAYOUTS_MATCH(nsSize, nsSize_Simple);
+STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsSize, nsSize_Simple, width);
+STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsSize, nsSize_Simple, height);
+
+/**
+ * <div rustbindgen="true" replaces="UniquePtr">
+ *
+ * TODO(Emilio): This is a workaround and we should be able to get rid of this
+ * one.
+ */
+template<typename T, typename Deleter = mozilla::DefaultDelete<T>>
+struct UniquePtr_Simple {
+  T* mPtr;
+};
+
+STATIC_ASSERT_TYPE_LAYOUTS_MATCH(mozilla::UniquePtr<int>, UniquePtr_Simple<int>);
+
+/**
  * <div rustbindgen replaces="nsTArray"></div>
  */
 template<typename T>
 class nsTArray_Simple {
   T* mBuffer;
 public:
   // The existence of a destructor here prevents bindgen from deriving the Clone
   // trait via a simple memory copy.