Bug 1367904 - Part 3: stylo: Use RawOffsetArc in ComputedValues; r?bholley
MozReview-Commit-ID: 1zexSgkcQv0
--- 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
};