Bug 1367904 - Part 3: stylo: Use RawOffsetArc in ComputedValues; r?bholley draft
authorManish Goregaokar <manishearth@gmail.com>
Thu, 15 Jun 2017 22:49:50 -0700
changeset 609392 b562033c87bce4bc5aa5a334f6cccdc178fe9d91
parent 609391 5b7815530a134baf533faa254d04a10225c96c07
child 609393 800c7605c752bab0d2d4b5bb9d78683605619351
push id68565
push userbmo:manishearth@gmail.com
push dateSun, 16 Jul 2017 03:07:34 +0000
reviewersbholley
bugs1367904
milestone56.0a1
Bug 1367904 - Part 3: stylo: Use RawOffsetArc in ComputedValues; r?bholley MozReview-Commit-ID: 1zexSgkcQv0
layout/style/ServoBindings.toml
layout/style/ServoTypes.h
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -310,16 +310,17 @@ opaque-types = [
 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::ServoFontComputationData", servo = "::properties::FontComputationData" },
     { generic = false, gecko = "mozilla::ServoCustomPropertiesMap", servo = "Option<::stylearc::Arc<::custom_properties::CustomPropertiesMap>>" },
     { generic = false, gecko = "mozilla::ServoVisitedStyle", servo = "Option<::stylearc::Arc<ServoComputedValues2>>" },
+    { generic = true, gecko = "mozilla::ServoRawOffsetArc", servo = "::stylearc::RawOffsetArc" },
 ]
 fixups = [
     { pat = "root::nsString", rep = "::nsstring::nsStringRepr" },
 ]
 
 [bindings]
 headers = ["mozilla/ServoBindings.h"]
 hide-types = [
--- a/layout/style/ServoTypes.h
+++ b/layout/style/ServoTypes.h
@@ -141,28 +141,33 @@ struct ServoFontComputationData {
 struct ServoCustomPropertiesMap {
   uintptr_t mPtr;
 };
 
 struct ServoVisitedStyle {
   uintptr_t mPtr;
 };
 
+template <typename T>
+struct ServoRawOffsetArc {
+  T* mPtr;
+};
+
 /**
  * We want C++ to be abe to read the style struct fields of ComputedValues
  * so we define this type on the C++ side and use the bindgenned version
  * on the Rust side.
  *
  * C++ just sees pointers and opaque types here, so bindgen will attempt to generate a Copy
  * impl. This will fail because the bindgenned version contains owned types. Opt out.
  *
  * <div rustbindgen nocopy></div>
  */
 struct ServoComputedValues2 {
-#define STYLE_STRUCT(name_, checkdata_cb_) nsStyle##name_* name_;
+#define STYLE_STRUCT(name_, checkdata_cb_) ServoRawOffsetArc<nsStyle##name_> name_;
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
   ServoCustomPropertiesMap custom_properties;
   ServoWritingMode writing_mode;
   ServoFontComputationData font_computation_data;
   ServoVisitedStyle visited_style;
   ~ServoComputedValues2() {} // do nothing, but prevent Copy from being impl'd by bindgen
 };