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
@@ -145,28 +145,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
};
--- a/servo/components/style/gecko/generated/structs_debug.rs
+++ b/servo/components/style/gecko/generated/structs_debug.rs
@@ -8,16 +8,17 @@ use atomic_refcell::AtomicRefCell;
use data::ElementData;
pub type ServoUnsafeCell<T> = ::std::cell::UnsafeCell<T>;
pub type ServoCell<T> = ::std::cell::Cell<T>;
pub type ServoNodeData = AtomicRefCell<ElementData>;
pub type ServoWritingMode = ::logical_geometry::WritingMode;
pub type ServoFontComputationData = ::properties::FontComputationData;
pub type ServoCustomPropertiesMap = Option<::stylearc::Arc<::custom_properties::CustomPropertiesMap>>;
pub type ServoVisitedStyle = Option<::stylearc::Arc<ServoComputedValues2>>;
+pub type ServoRawOffsetArc<T> = ::stylearc::RawOffsetArc<T>;
#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
pub mod root {
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self {
@@ -7610,40 +7611,40 @@ pub mod root {
* 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>
*/
#[repr(C)]
#[derive(Debug)]
pub struct ServoComputedValues2 {
- pub Font: *mut root::nsStyleFont,
- pub Color: *mut root::nsStyleColor,
- pub List: *mut root::nsStyleList,
- pub Text: *mut root::nsStyleText,
- pub Visibility: *mut root::nsStyleVisibility,
- pub UserInterface: *mut root::nsStyleUserInterface,
- pub TableBorder: *mut root::nsStyleTableBorder,
- pub SVG: *mut root::nsStyleSVG,
- pub Variables: *mut root::nsStyleVariables,
- pub Background: *mut root::nsStyleBackground,
- pub Position: *mut root::nsStylePosition,
- pub TextReset: *mut root::nsStyleTextReset,
- pub Display: *mut root::nsStyleDisplay,
- pub Content: *mut root::nsStyleContent,
- pub UIReset: *mut root::nsStyleUIReset,
- pub Table: *mut root::nsStyleTable,
- pub Margin: *mut root::nsStyleMargin,
- pub Padding: *mut root::nsStylePadding,
- pub Border: *mut root::nsStyleBorder,
- pub Outline: *mut root::nsStyleOutline,
- pub XUL: *mut root::nsStyleXUL,
- pub SVGReset: *mut root::nsStyleSVGReset,
- pub Column: *mut root::nsStyleColumn,
- pub Effects: *mut root::nsStyleEffects,
+ pub Font: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleFont>,
+ pub Color: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleColor>,
+ pub List: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleList>,
+ pub Text: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleText>,
+ pub Visibility: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleVisibility>,
+ pub UserInterface: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleUserInterface>,
+ pub TableBorder: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleTableBorder>,
+ pub SVG: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleSVG>,
+ pub Variables: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleVariables>,
+ pub Background: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleBackground>,
+ pub Position: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStylePosition>,
+ pub TextReset: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleTextReset>,
+ pub Display: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleDisplay>,
+ pub Content: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleContent>,
+ pub UIReset: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleUIReset>,
+ pub Table: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleTable>,
+ pub Margin: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleMargin>,
+ pub Padding: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStylePadding>,
+ pub Border: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleBorder>,
+ pub Outline: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleOutline>,
+ pub XUL: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleXUL>,
+ pub SVGReset: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleSVGReset>,
+ pub Column: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleColumn>,
+ pub Effects: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleEffects>,
pub custom_properties: ::gecko_bindings::structs::ServoCustomPropertiesMap,
pub writing_mode: ::gecko_bindings::structs::ServoWritingMode,
pub font_computation_data: ::gecko_bindings::structs::ServoFontComputationData,
pub visited_style: ::gecko_bindings::structs::ServoVisitedStyle,
}
#[test]
fn bindgen_test_layout_ServoComputedValues2() {
assert_eq!(::std::mem::size_of::<ServoComputedValues2>() ,
@@ -39043,26 +39044,26 @@ pub mod root {
"Size of template specialization: " , stringify ! (
root::nsCharTraits ) ));
assert_eq!(::std::mem::align_of::<root::nsCharTraits>() , 1usize ,
concat ! (
"Alignment of template specialization: " , stringify ! (
root::nsCharTraits ) ));
}
#[test]
- fn __bindgen_test_layout__bindgen_ty_id_189479_instantiation_33() {
+ fn __bindgen_test_layout__bindgen_ty_id_189482_instantiation_33() {
assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));
assert_eq!(::std::mem::align_of::<u8>() , 1usize , concat ! (
"Alignment of template specialization: " , stringify ! ( u8
) ));
}
#[test]
- fn __bindgen_test_layout__bindgen_ty_id_189515_instantiation_34() {
+ fn __bindgen_test_layout__bindgen_ty_id_189518_instantiation_34() {
assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));
assert_eq!(::std::mem::align_of::<u8>() , 1usize , concat ! (
"Alignment of template specialization: " , stringify ! ( u8
) ));
}
#[test]
--- a/servo/components/style/gecko/generated/structs_release.rs
+++ b/servo/components/style/gecko/generated/structs_release.rs
@@ -8,16 +8,17 @@ use atomic_refcell::AtomicRefCell;
use data::ElementData;
pub type ServoUnsafeCell<T> = ::std::cell::UnsafeCell<T>;
pub type ServoCell<T> = ::std::cell::Cell<T>;
pub type ServoNodeData = AtomicRefCell<ElementData>;
pub type ServoWritingMode = ::logical_geometry::WritingMode;
pub type ServoFontComputationData = ::properties::FontComputationData;
pub type ServoCustomPropertiesMap = Option<::stylearc::Arc<::custom_properties::CustomPropertiesMap>>;
pub type ServoVisitedStyle = Option<::stylearc::Arc<ServoComputedValues2>>;
+pub type ServoRawOffsetArc<T> = ::stylearc::RawOffsetArc<T>;
#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
pub mod root {
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self {
@@ -7462,40 +7463,40 @@ pub mod root {
* 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>
*/
#[repr(C)]
#[derive(Debug)]
pub struct ServoComputedValues2 {
- pub Font: *mut root::nsStyleFont,
- pub Color: *mut root::nsStyleColor,
- pub List: *mut root::nsStyleList,
- pub Text: *mut root::nsStyleText,
- pub Visibility: *mut root::nsStyleVisibility,
- pub UserInterface: *mut root::nsStyleUserInterface,
- pub TableBorder: *mut root::nsStyleTableBorder,
- pub SVG: *mut root::nsStyleSVG,
- pub Variables: *mut root::nsStyleVariables,
- pub Background: *mut root::nsStyleBackground,
- pub Position: *mut root::nsStylePosition,
- pub TextReset: *mut root::nsStyleTextReset,
- pub Display: *mut root::nsStyleDisplay,
- pub Content: *mut root::nsStyleContent,
- pub UIReset: *mut root::nsStyleUIReset,
- pub Table: *mut root::nsStyleTable,
- pub Margin: *mut root::nsStyleMargin,
- pub Padding: *mut root::nsStylePadding,
- pub Border: *mut root::nsStyleBorder,
- pub Outline: *mut root::nsStyleOutline,
- pub XUL: *mut root::nsStyleXUL,
- pub SVGReset: *mut root::nsStyleSVGReset,
- pub Column: *mut root::nsStyleColumn,
- pub Effects: *mut root::nsStyleEffects,
+ pub Font: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleFont>,
+ pub Color: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleColor>,
+ pub List: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleList>,
+ pub Text: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleText>,
+ pub Visibility: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleVisibility>,
+ pub UserInterface: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleUserInterface>,
+ pub TableBorder: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleTableBorder>,
+ pub SVG: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleSVG>,
+ pub Variables: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleVariables>,
+ pub Background: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleBackground>,
+ pub Position: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStylePosition>,
+ pub TextReset: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleTextReset>,
+ pub Display: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleDisplay>,
+ pub Content: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleContent>,
+ pub UIReset: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleUIReset>,
+ pub Table: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleTable>,
+ pub Margin: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleMargin>,
+ pub Padding: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStylePadding>,
+ pub Border: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleBorder>,
+ pub Outline: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleOutline>,
+ pub XUL: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleXUL>,
+ pub SVGReset: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleSVGReset>,
+ pub Column: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleColumn>,
+ pub Effects: ::gecko_bindings::structs::ServoRawOffsetArc<root::nsStyleEffects>,
pub custom_properties: ::gecko_bindings::structs::ServoCustomPropertiesMap,
pub writing_mode: ::gecko_bindings::structs::ServoWritingMode,
pub font_computation_data: ::gecko_bindings::structs::ServoFontComputationData,
pub visited_style: ::gecko_bindings::structs::ServoVisitedStyle,
}
#[test]
fn bindgen_test_layout_ServoComputedValues2() {
assert_eq!(::std::mem::size_of::<ServoComputedValues2>() ,
@@ -38407,26 +38408,26 @@ pub mod root {
"Size of template specialization: " , stringify ! (
root::nsCharTraits ) ));
assert_eq!(::std::mem::align_of::<root::nsCharTraits>() , 1usize ,
concat ! (
"Alignment of template specialization: " , stringify ! (
root::nsCharTraits ) ));
}
#[test]
- fn __bindgen_test_layout__bindgen_ty_id_187138_instantiation_33() {
+ fn __bindgen_test_layout__bindgen_ty_id_187141_instantiation_33() {
assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));
assert_eq!(::std::mem::align_of::<u8>() , 1usize , concat ! (
"Alignment of template specialization: " , stringify ! ( u8
) ));
}
#[test]
- fn __bindgen_test_layout__bindgen_ty_id_187174_instantiation_34() {
+ fn __bindgen_test_layout__bindgen_ty_id_187177_instantiation_34() {
assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));
assert_eq!(::std::mem::align_of::<u8>() , 1usize , concat ! (
"Alignment of template specialization: " , stringify ! ( u8
) ));
}
#[test]