Bug 1403073 - stylo: Fix some bindgen object layout issues. r?xidorn draft
authorCameron McCormack <cam@mcc.id.au>
Tue, 26 Sep 2017 15:06:33 +0800
changeset 670254 ebeff472c59da8d24e36b67b3461c1f53bc87d48
parent 669596 7e962631ba4298bcefa571008661983d77c3e652
child 733184 75d2793cfcf1bc151a9f5ba2f2a7d9612269c630
push id81575
push userbmo:cam@mcc.id.au
push dateTue, 26 Sep 2017 07:06:56 +0000
reviewersxidorn
bugs1403073
milestone58.0a1
Bug 1403073 - stylo: Fix some bindgen object layout issues. r?xidorn MozReview-Commit-ID: CnW4J2ZlmfJ
layout/style/ServoBindings.toml
layout/style/nsCSSValue.h
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -341,16 +341,17 @@ opaque-types = [
     "JS::Rooted",
     "mozilla::Maybe",
     "gfxSize",  # <- union { struct { T width; T height; }; T components[2] };
     "gfxSize_Super",  # Ditto.
     "mozilla::StyleAnimationValue",
     "StyleAnimationValue", # pulls in a whole bunch of stuff we don't need in the bindings
     "mozilla::dom::.*Callback", # Pulls in ErrorResult and other things that
                                 # don't align properly on Linux 32-bit
+    "mozilla::SchedulerGroup", # Non-standard-layout packing of field into superclass
 ]
 mapped-generic-types = [
     { generic = true, gecko = "mozilla::ServoUnsafeCell", servo = "::std::cell::UnsafeCell" },
     { generic = true, gecko = "mozilla::ServoCell", servo = "::std::cell::Cell" },
     { generic = false, gecko = "ServoNodeData", servo = "AtomicRefCell<ElementData>" },
     { generic = false, gecko = "mozilla::ServoWritingMode", servo = "::logical_geometry::WritingMode" },
     { generic = false, gecko = "mozilla::ServoCustomPropertiesMap", servo = "Option<::servo_arc::Arc<::custom_properties::CustomPropertiesMap>>" },
     { generic = false, gecko = "mozilla::ServoRuleNode", servo = "Option<::rule_tree::StrongRuleNode>" },
--- a/layout/style/nsCSSValue.h
+++ b/layout/style/nsCSSValue.h
@@ -194,16 +194,21 @@ private:
     : mRustString(aString) {}
     ~RustOrGeckoString() {}
     nsString mString;
     mozilla::ServoRawOffsetArc<RustString> mRustString;
   } mStrings;
   mutable bool mUsingRustString;
 
 protected:
+  // Only used by ImageValue.  Declared up here because otherwise bindgen gets
+  // confused by the non-standard-layout packing of the variable up into
+  // URLValueData.
+  bool mLoadedImage = false;
+
   virtual ~URLValueData();
 
   size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
 private:
   URLValueData(const URLValueData& aOther) = delete;
   URLValueData& operator=(const URLValueData& aOther) = delete;
 
@@ -262,19 +267,16 @@ struct ImageValue final : public URLValu
 
   void Initialize(nsIDocument* aDocument);
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
 protected:
   ~ImageValue();
 
-private:
-  bool mLoadedImage = false;
-
 public:
   // Inherit Equals from URLValueData
 
   nsRefPtrHashtable<nsPtrHashKey<nsIDocument>, imgRequestProxy> mRequests;
 };
 
 struct GridNamedArea {
   nsString mName;