diff --git a/components/servo_arc/lib.rs b/components/servo_arc/lib.rs index dacd0cebd2a..6d031802961 100644 --- a/components/servo_arc/lib.rs +++ b/components/servo_arc/lib.rs @@ -771,11 +771,30 @@ impl RawOffsetArc { // Forward the result. result } + + /// If uniquely owned, provide a mutable reference + /// Else create a copy, and mutate that + pub fn make_mut(&mut self) -> &mut T where T: Clone { + unsafe { + // extract the RawOffsetArc as an owned variable + let this = ptr::read(self); + // treat it as a real Arc + let mut arc = Arc::from_raw_offset(this); + // obtain the mutable reference. Cast away the lifetime + // This may mutate `arc` + let ret = Arc::make_mut(&mut arc) as *mut _; + // Store the possibly-mutated arc back inside, after converting + // it to a RawOffsetArc again + ptr::write(self, Arc::into_raw_offset(arc)); + &mut *ret + } + } } impl Arc { /// Converts an Arc into a RawOffsetArc. This consumes the Arc, so the refcount /// is not modified. + #[inline] pub fn into_raw_offset(a: Self) -> RawOffsetArc { RawOffsetArc { ptr: NonZeroPtrMut::new(Arc::into_raw(a) as *mut T), @@ -784,6 +803,7 @@ impl Arc { /// Converts a RawOffsetArc into an Arc. This consumes the RawOffsetArc, so the refcount /// is not modified. + #[inline] pub fn from_raw_offset(a: RawOffsetArc) -> Self { let ptr = a.ptr.ptr(); mem::forget(a); diff --git a/components/style/gecko/generated/structs_debug.rs b/components/style/gecko/generated/structs_debug.rs index ef3f7dbe87e..9c3c06c4fa9 100644 --- a/components/style/gecko/generated/structs_debug.rs +++ b/components/style/gecko/generated/structs_debug.rs @@ -12,7 +12,9 @@ pub type ServoNodeData = AtomicRefCell; pub type ServoWritingMode = ::logical_geometry::WritingMode; pub type ServoFontComputationData = ::properties::FontComputationData; pub type ServoCustomPropertiesMap = Option<::stylearc::Arc<::custom_properties::CustomPropertiesMap>>; +pub type ServoRuleNode = Option<::rule_tree::StrongRuleNode>; pub type ServoVisitedStyle = Option<::stylearc::Arc>; +pub type ServoComputedValueFlags = ::properties::computed_value_flags::ComputedValueFlags; pub type ServoRawOffsetArc = ::stylearc::RawOffsetArc; #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] @@ -7603,6 +7605,429 @@ pub mod root { FirstLetterContinuation = 1, PlaceholderFrame = 2, } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoFont { + pub gecko: root::nsStyleFont, + } + #[test] + fn bindgen_test_layout_GeckoFont() { + assert_eq!(::std::mem::size_of::() , 120usize , concat + ! ( "Size of: " , stringify ! ( GeckoFont ) )); + assert_eq! (::std::mem::align_of::() , 8usize , concat + ! ( "Alignment of " , stringify ! ( GeckoFont ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoFont ) ) . gecko as * const + _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoFont ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoColor { + pub gecko: root::nsStyleColor, + } + #[test] + fn bindgen_test_layout_GeckoColor() { + assert_eq!(::std::mem::size_of::() , 4usize , concat ! + ( "Size of: " , stringify ! ( GeckoColor ) )); + assert_eq! (::std::mem::align_of::() , 4usize , concat + ! ( "Alignment of " , stringify ! ( GeckoColor ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoColor ) ) . gecko as * const + _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoColor ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoList { + pub gecko: root::nsStyleList, + } + #[test] + fn bindgen_test_layout_GeckoList() { + assert_eq!(::std::mem::size_of::() , 48usize , concat ! + ( "Size of: " , stringify ! ( GeckoList ) )); + assert_eq! (::std::mem::align_of::() , 8usize , concat + ! ( "Alignment of " , stringify ! ( GeckoList ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoList ) ) . gecko as * const + _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoList ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoText { + pub gecko: root::nsStyleText, + } + #[test] + fn bindgen_test_layout_GeckoText() { + assert_eq!(::std::mem::size_of::() , 160usize , concat + ! ( "Size of: " , stringify ! ( GeckoText ) )); + assert_eq! (::std::mem::align_of::() , 8usize , concat + ! ( "Alignment of " , stringify ! ( GeckoText ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoText ) ) . gecko as * const + _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoText ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoVisibility { + pub gecko: root::nsStyleVisibility, + } + #[test] + fn bindgen_test_layout_GeckoVisibility() { + assert_eq!(::std::mem::size_of::() , 7usize , + concat ! ( + "Size of: " , stringify ! ( GeckoVisibility ) )); + assert_eq! (::std::mem::align_of::() , 1usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoVisibility ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoVisibility ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoVisibility + ) , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoUserInterface { + pub gecko: root::nsStyleUserInterface, + } + #[test] + fn bindgen_test_layout_GeckoUserInterface() { + assert_eq!(::std::mem::size_of::() , 24usize , + concat ! ( + "Size of: " , stringify ! ( GeckoUserInterface ) )); + assert_eq! (::std::mem::align_of::() , 8usize + , concat ! ( + "Alignment of " , stringify ! ( GeckoUserInterface ) + )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoUserInterface ) ) . gecko as + * const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( + GeckoUserInterface ) , "::" , stringify ! ( gecko ) + )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoTableBorder { + pub gecko: root::nsStyleTableBorder, + } + #[test] + fn bindgen_test_layout_GeckoTableBorder() { + assert_eq!(::std::mem::size_of::() , 12usize , + concat ! ( + "Size of: " , stringify ! ( GeckoTableBorder ) )); + assert_eq! (::std::mem::align_of::() , 4usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoTableBorder ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoTableBorder ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( + GeckoTableBorder ) , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoSVG { + pub gecko: root::nsStyleSVG, + } + #[test] + fn bindgen_test_layout_GeckoSVG() { + assert_eq!(::std::mem::size_of::() , 128usize , concat ! + ( "Size of: " , stringify ! ( GeckoSVG ) )); + assert_eq! (::std::mem::align_of::() , 8usize , concat ! + ( "Alignment of " , stringify ! ( GeckoSVG ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoSVG ) ) . gecko as * const _ + as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoSVG ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoBackground { + pub gecko: root::nsStyleBackground, + } + #[test] + fn bindgen_test_layout_GeckoBackground() { + assert_eq!(::std::mem::size_of::() , 160usize , + concat ! ( + "Size of: " , stringify ! ( GeckoBackground ) )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoBackground ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoBackground ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoBackground + ) , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoPosition { + pub gecko: root::nsStylePosition, + } + #[test] + fn bindgen_test_layout_GeckoPosition() { + assert_eq!(::std::mem::size_of::() , 520usize , + concat ! ( "Size of: " , stringify ! ( GeckoPosition ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoPosition ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoPosition ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoPosition ) + , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoTextReset { + pub gecko: root::nsStyleTextReset, + } + #[test] + fn bindgen_test_layout_GeckoTextReset() { + assert_eq!(::std::mem::size_of::() , 80usize , + concat ! ( "Size of: " , stringify ! ( GeckoTextReset ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoTextReset ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoTextReset ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoTextReset + ) , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoDisplay { + pub gecko: root::nsStyleDisplay, + } + #[test] + fn bindgen_test_layout_GeckoDisplay() { + assert_eq!(::std::mem::size_of::() , 416usize , + concat ! ( "Size of: " , stringify ! ( GeckoDisplay ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoDisplay ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoDisplay ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoDisplay ) + , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoContent { + pub gecko: root::nsStyleContent, + } + #[test] + fn bindgen_test_layout_GeckoContent() { + assert_eq!(::std::mem::size_of::() , 24usize , + concat ! ( "Size of: " , stringify ! ( GeckoContent ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoContent ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoContent ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoContent ) + , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoUIReset { + pub gecko: root::nsStyleUIReset, + } + #[test] + fn bindgen_test_layout_GeckoUIReset() { + assert_eq!(::std::mem::size_of::() , 56usize , + concat ! ( "Size of: " , stringify ! ( GeckoUIReset ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoUIReset ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoUIReset ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoUIReset ) + , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoTable { + pub gecko: root::nsStyleTable, + } + #[test] + fn bindgen_test_layout_GeckoTable() { + assert_eq!(::std::mem::size_of::() , 8usize , concat ! + ( "Size of: " , stringify ! ( GeckoTable ) )); + assert_eq! (::std::mem::align_of::() , 4usize , concat + ! ( "Alignment of " , stringify ! ( GeckoTable ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoTable ) ) . gecko as * const + _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoTable ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoMargin { + pub gecko: root::nsStyleMargin, + } + #[test] + fn bindgen_test_layout_GeckoMargin() { + assert_eq!(::std::mem::size_of::() , 40usize , concat + ! ( "Size of: " , stringify ! ( GeckoMargin ) )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoMargin ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoMargin ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoMargin ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoPadding { + pub gecko: root::nsStylePadding, + } + #[test] + fn bindgen_test_layout_GeckoPadding() { + assert_eq!(::std::mem::size_of::() , 40usize , + concat ! ( "Size of: " , stringify ! ( GeckoPadding ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoPadding ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoPadding ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoPadding ) + , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoBorder { + pub gecko: root::nsStyleBorder, + } + #[test] + fn bindgen_test_layout_GeckoBorder() { + assert_eq!(::std::mem::size_of::() , 312usize , + concat ! ( "Size of: " , stringify ! ( GeckoBorder ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoBorder ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoBorder ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoBorder ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoOutline { + pub gecko: root::nsStyleOutline, + } + #[test] + fn bindgen_test_layout_GeckoOutline() { + assert_eq!(::std::mem::size_of::() , 104usize , + concat ! ( "Size of: " , stringify ! ( GeckoOutline ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoOutline ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoOutline ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoOutline ) + , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoXUL { + pub gecko: root::nsStyleXUL, + } + #[test] + fn bindgen_test_layout_GeckoXUL() { + assert_eq!(::std::mem::size_of::() , 16usize , concat ! + ( "Size of: " , stringify ! ( GeckoXUL ) )); + assert_eq! (::std::mem::align_of::() , 4usize , concat ! + ( "Alignment of " , stringify ! ( GeckoXUL ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoXUL ) ) . gecko as * const _ + as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoXUL ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoSVGReset { + pub gecko: root::nsStyleSVGReset, + } + #[test] + fn bindgen_test_layout_GeckoSVGReset() { + assert_eq!(::std::mem::size_of::() , 192usize , + concat ! ( "Size of: " , stringify ! ( GeckoSVGReset ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoSVGReset ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoSVGReset ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoSVGReset ) + , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoColumn { + pub gecko: root::nsStyleColumn, + } + #[test] + fn bindgen_test_layout_GeckoColumn() { + assert_eq!(::std::mem::size_of::() , 64usize , concat + ! ( "Size of: " , stringify ! ( GeckoColumn ) )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoColumn ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoColumn ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoColumn ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoEffects { + pub gecko: root::nsStyleEffects, + } + #[test] + fn bindgen_test_layout_GeckoEffects() { + assert_eq!(::std::mem::size_of::() , 40usize , + concat ! ( "Size of: " , stringify ! ( GeckoEffects ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoEffects ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoEffects ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoEffects ) + , "::" , stringify ! ( gecko ) )); + } /** * 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 @@ -7616,39 +8041,46 @@ pub mod root { #[repr(C)] #[derive(Debug)] pub struct ServoComputedValues2 { - pub Font: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Color: ::gecko_bindings::structs::ServoRawOffsetArc, - pub List: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Text: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Visibility: ::gecko_bindings::structs::ServoRawOffsetArc, - pub UserInterface: ::gecko_bindings::structs::ServoRawOffsetArc, - pub TableBorder: ::gecko_bindings::structs::ServoRawOffsetArc, - pub SVG: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Variables: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Background: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Position: ::gecko_bindings::structs::ServoRawOffsetArc, - pub TextReset: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Display: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Content: ::gecko_bindings::structs::ServoRawOffsetArc, - pub UIReset: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Table: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Margin: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Padding: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Border: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Outline: ::gecko_bindings::structs::ServoRawOffsetArc, - pub XUL: ::gecko_bindings::structs::ServoRawOffsetArc, - pub SVGReset: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Column: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Effects: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Font: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Color: ::gecko_bindings::structs::ServoRawOffsetArc, + pub List: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Text: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Visibility: ::gecko_bindings::structs::ServoRawOffsetArc, + pub UserInterface: ::gecko_bindings::structs::ServoRawOffsetArc, + pub TableBorder: ::gecko_bindings::structs::ServoRawOffsetArc, + pub SVG: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Background: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Position: ::gecko_bindings::structs::ServoRawOffsetArc, + pub TextReset: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Display: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Content: ::gecko_bindings::structs::ServoRawOffsetArc, + pub UIReset: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Table: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Margin: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Padding: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Border: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Outline: ::gecko_bindings::structs::ServoRawOffsetArc, + pub XUL: ::gecko_bindings::structs::ServoRawOffsetArc, + pub SVGReset: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Column: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Effects: ::gecko_bindings::structs::ServoRawOffsetArc, pub custom_properties: ::gecko_bindings::structs::ServoCustomPropertiesMap, pub writing_mode: ::gecko_bindings::structs::ServoWritingMode, pub font_computation_data: ::gecko_bindings::structs::ServoFontComputationData, + /// The rule node representing the ordered list of rules matched for this + /// node. Can be None for default values and text nodes. This is + /// essentially an optimization to avoid referencing the root rule node. + pub rules: ::gecko_bindings::structs::ServoRuleNode, + /// The element's computed values if visited, only computed if there's a + /// relevant link for this element. A element's "relevant link" is the + /// element being matched if it is a link or the nearest ancestor link. pub visited_style: ::gecko_bindings::structs::ServoVisitedStyle, + pub flags: ::gecko_bindings::structs::ServoComputedValueFlags, } #[test] fn bindgen_test_layout_ServoComputedValues2() { assert_eq!(::std::mem::size_of::() , - 224usize , concat ! ( + 232usize , concat ! ( "Size of: " , stringify ! ( ServoComputedValues2 ) )); assert_eq! (::std::mem::align_of::() , 8usize , concat ! ( @@ -7707,120 +8139,112 @@ pub mod root { )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - Variables as * const _ as usize } , 64usize , concat ! - ( - "Alignment of field: " , stringify ! ( - ServoComputedValues2 ) , "::" , stringify ! ( - Variables ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const ServoComputedValues2 ) ) . - Background as * const _ as usize } , 72usize , concat + Background as * const _ as usize } , 64usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Background ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - Position as * const _ as usize } , 80usize , concat ! + Position as * const _ as usize } , 72usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Position ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - TextReset as * const _ as usize } , 88usize , concat ! + TextReset as * const _ as usize } , 80usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( TextReset ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - Display as * const _ as usize } , 96usize , concat ! ( + Display as * const _ as usize } , 88usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Display ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - Content as * const _ as usize } , 104usize , concat ! - ( + Content as * const _ as usize } , 96usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Content ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - UIReset as * const _ as usize } , 112usize , concat ! + UIReset as * const _ as usize } , 104usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( UIReset ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . Table - as * const _ as usize } , 120usize , concat ! ( + as * const _ as usize } , 112usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Table ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . Margin - as * const _ as usize } , 128usize , concat ! ( + as * const _ as usize } , 120usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Margin ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - Padding as * const _ as usize } , 136usize , concat ! + Padding as * const _ as usize } , 128usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Padding ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . Border - as * const _ as usize } , 144usize , concat ! ( + as * const _ as usize } , 136usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Border ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - Outline as * const _ as usize } , 152usize , concat ! + Outline as * const _ as usize } , 144usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Outline ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . XUL as - * const _ as usize } , 160usize , concat ! ( + * const _ as usize } , 152usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( XUL ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - SVGReset as * const _ as usize } , 168usize , concat ! + SVGReset as * const _ as usize } , 160usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( SVGReset ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . Column - as * const _ as usize } , 176usize , concat ! ( + as * const _ as usize } , 168usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Column ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - Effects as * const _ as usize } , 184usize , concat ! + Effects as * const _ as usize } , 176usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Effects ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - custom_properties as * const _ as usize } , 192usize , + custom_properties as * const _ as usize } , 184usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( custom_properties ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - writing_mode as * const _ as usize } , 200usize , + writing_mode as * const _ as usize } , 192usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( @@ -7828,10 +8252,16 @@ pub mod root { assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . font_computation_data as * const _ as usize } , - 204usize , concat ! ( + 196usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( font_computation_data ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const ServoComputedValues2 ) ) . rules + as * const _ as usize } , 208usize , concat ! ( + "Alignment of field: " , stringify ! ( + ServoComputedValues2 ) , "::" , stringify ! ( rules ) + )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . visited_style as * const _ as usize } , 216usize , @@ -7839,6 +8269,12 @@ pub mod root { "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( visited_style ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const ServoComputedValues2 ) ) . flags + as * const _ as usize } , 224usize , concat ! ( + "Alignment of field: " , stringify ! ( + ServoComputedValues2 ) , "::" , stringify ! ( flags ) + )); } #[repr(u8)] /** @@ -39049,7 +39485,7 @@ pub mod root { root::nsCharTraits ) )); } #[test] - fn __bindgen_test_layout__bindgen_ty_id_189482_instantiation_33() { + fn __bindgen_test_layout__bindgen_ty_id_189816_instantiation_33() { assert_eq!(::std::mem::size_of::() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( u8 ) )); @@ -39058,7 +39494,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout__bindgen_ty_id_189518_instantiation_34() { + fn __bindgen_test_layout__bindgen_ty_id_189852_instantiation_34() { assert_eq!(::std::mem::size_of::() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( u8 ) )); diff --git a/components/style/gecko/generated/structs_release.rs b/components/style/gecko/generated/structs_release.rs index 4fde7c30529..b85f5b652cf 100644 --- a/components/style/gecko/generated/structs_release.rs +++ b/components/style/gecko/generated/structs_release.rs @@ -12,7 +12,9 @@ pub type ServoNodeData = AtomicRefCell; pub type ServoWritingMode = ::logical_geometry::WritingMode; pub type ServoFontComputationData = ::properties::FontComputationData; pub type ServoCustomPropertiesMap = Option<::stylearc::Arc<::custom_properties::CustomPropertiesMap>>; +pub type ServoRuleNode = Option<::rule_tree::StrongRuleNode>; pub type ServoVisitedStyle = Option<::stylearc::Arc>; +pub type ServoComputedValueFlags = ::properties::computed_value_flags::ComputedValueFlags; pub type ServoRawOffsetArc = ::stylearc::RawOffsetArc; #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] @@ -7455,6 +7457,429 @@ pub mod root { FirstLetterContinuation = 1, PlaceholderFrame = 2, } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoFont { + pub gecko: root::nsStyleFont, + } + #[test] + fn bindgen_test_layout_GeckoFont() { + assert_eq!(::std::mem::size_of::() , 120usize , concat + ! ( "Size of: " , stringify ! ( GeckoFont ) )); + assert_eq! (::std::mem::align_of::() , 8usize , concat + ! ( "Alignment of " , stringify ! ( GeckoFont ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoFont ) ) . gecko as * const + _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoFont ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoColor { + pub gecko: root::nsStyleColor, + } + #[test] + fn bindgen_test_layout_GeckoColor() { + assert_eq!(::std::mem::size_of::() , 4usize , concat ! + ( "Size of: " , stringify ! ( GeckoColor ) )); + assert_eq! (::std::mem::align_of::() , 4usize , concat + ! ( "Alignment of " , stringify ! ( GeckoColor ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoColor ) ) . gecko as * const + _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoColor ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoList { + pub gecko: root::nsStyleList, + } + #[test] + fn bindgen_test_layout_GeckoList() { + assert_eq!(::std::mem::size_of::() , 48usize , concat ! + ( "Size of: " , stringify ! ( GeckoList ) )); + assert_eq! (::std::mem::align_of::() , 8usize , concat + ! ( "Alignment of " , stringify ! ( GeckoList ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoList ) ) . gecko as * const + _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoList ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoText { + pub gecko: root::nsStyleText, + } + #[test] + fn bindgen_test_layout_GeckoText() { + assert_eq!(::std::mem::size_of::() , 160usize , concat + ! ( "Size of: " , stringify ! ( GeckoText ) )); + assert_eq! (::std::mem::align_of::() , 8usize , concat + ! ( "Alignment of " , stringify ! ( GeckoText ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoText ) ) . gecko as * const + _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoText ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoVisibility { + pub gecko: root::nsStyleVisibility, + } + #[test] + fn bindgen_test_layout_GeckoVisibility() { + assert_eq!(::std::mem::size_of::() , 7usize , + concat ! ( + "Size of: " , stringify ! ( GeckoVisibility ) )); + assert_eq! (::std::mem::align_of::() , 1usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoVisibility ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoVisibility ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoVisibility + ) , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoUserInterface { + pub gecko: root::nsStyleUserInterface, + } + #[test] + fn bindgen_test_layout_GeckoUserInterface() { + assert_eq!(::std::mem::size_of::() , 24usize , + concat ! ( + "Size of: " , stringify ! ( GeckoUserInterface ) )); + assert_eq! (::std::mem::align_of::() , 8usize + , concat ! ( + "Alignment of " , stringify ! ( GeckoUserInterface ) + )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoUserInterface ) ) . gecko as + * const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( + GeckoUserInterface ) , "::" , stringify ! ( gecko ) + )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoTableBorder { + pub gecko: root::nsStyleTableBorder, + } + #[test] + fn bindgen_test_layout_GeckoTableBorder() { + assert_eq!(::std::mem::size_of::() , 12usize , + concat ! ( + "Size of: " , stringify ! ( GeckoTableBorder ) )); + assert_eq! (::std::mem::align_of::() , 4usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoTableBorder ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoTableBorder ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( + GeckoTableBorder ) , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoSVG { + pub gecko: root::nsStyleSVG, + } + #[test] + fn bindgen_test_layout_GeckoSVG() { + assert_eq!(::std::mem::size_of::() , 128usize , concat ! + ( "Size of: " , stringify ! ( GeckoSVG ) )); + assert_eq! (::std::mem::align_of::() , 8usize , concat ! + ( "Alignment of " , stringify ! ( GeckoSVG ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoSVG ) ) . gecko as * const _ + as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoSVG ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoBackground { + pub gecko: root::nsStyleBackground, + } + #[test] + fn bindgen_test_layout_GeckoBackground() { + assert_eq!(::std::mem::size_of::() , 160usize , + concat ! ( + "Size of: " , stringify ! ( GeckoBackground ) )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoBackground ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoBackground ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoBackground + ) , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoPosition { + pub gecko: root::nsStylePosition, + } + #[test] + fn bindgen_test_layout_GeckoPosition() { + assert_eq!(::std::mem::size_of::() , 520usize , + concat ! ( "Size of: " , stringify ! ( GeckoPosition ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoPosition ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoPosition ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoPosition ) + , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoTextReset { + pub gecko: root::nsStyleTextReset, + } + #[test] + fn bindgen_test_layout_GeckoTextReset() { + assert_eq!(::std::mem::size_of::() , 80usize , + concat ! ( "Size of: " , stringify ! ( GeckoTextReset ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoTextReset ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoTextReset ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoTextReset + ) , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoDisplay { + pub gecko: root::nsStyleDisplay, + } + #[test] + fn bindgen_test_layout_GeckoDisplay() { + assert_eq!(::std::mem::size_of::() , 416usize , + concat ! ( "Size of: " , stringify ! ( GeckoDisplay ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoDisplay ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoDisplay ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoDisplay ) + , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoContent { + pub gecko: root::nsStyleContent, + } + #[test] + fn bindgen_test_layout_GeckoContent() { + assert_eq!(::std::mem::size_of::() , 24usize , + concat ! ( "Size of: " , stringify ! ( GeckoContent ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoContent ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoContent ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoContent ) + , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoUIReset { + pub gecko: root::nsStyleUIReset, + } + #[test] + fn bindgen_test_layout_GeckoUIReset() { + assert_eq!(::std::mem::size_of::() , 56usize , + concat ! ( "Size of: " , stringify ! ( GeckoUIReset ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoUIReset ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoUIReset ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoUIReset ) + , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoTable { + pub gecko: root::nsStyleTable, + } + #[test] + fn bindgen_test_layout_GeckoTable() { + assert_eq!(::std::mem::size_of::() , 8usize , concat ! + ( "Size of: " , stringify ! ( GeckoTable ) )); + assert_eq! (::std::mem::align_of::() , 4usize , concat + ! ( "Alignment of " , stringify ! ( GeckoTable ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoTable ) ) . gecko as * const + _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoTable ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoMargin { + pub gecko: root::nsStyleMargin, + } + #[test] + fn bindgen_test_layout_GeckoMargin() { + assert_eq!(::std::mem::size_of::() , 40usize , concat + ! ( "Size of: " , stringify ! ( GeckoMargin ) )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoMargin ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoMargin ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoMargin ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoPadding { + pub gecko: root::nsStylePadding, + } + #[test] + fn bindgen_test_layout_GeckoPadding() { + assert_eq!(::std::mem::size_of::() , 40usize , + concat ! ( "Size of: " , stringify ! ( GeckoPadding ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoPadding ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoPadding ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoPadding ) + , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoBorder { + pub gecko: root::nsStyleBorder, + } + #[test] + fn bindgen_test_layout_GeckoBorder() { + assert_eq!(::std::mem::size_of::() , 312usize , + concat ! ( "Size of: " , stringify ! ( GeckoBorder ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoBorder ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoBorder ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoBorder ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoOutline { + pub gecko: root::nsStyleOutline, + } + #[test] + fn bindgen_test_layout_GeckoOutline() { + assert_eq!(::std::mem::size_of::() , 104usize , + concat ! ( "Size of: " , stringify ! ( GeckoOutline ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoOutline ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoOutline ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoOutline ) + , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoXUL { + pub gecko: root::nsStyleXUL, + } + #[test] + fn bindgen_test_layout_GeckoXUL() { + assert_eq!(::std::mem::size_of::() , 16usize , concat ! + ( "Size of: " , stringify ! ( GeckoXUL ) )); + assert_eq! (::std::mem::align_of::() , 4usize , concat ! + ( "Alignment of " , stringify ! ( GeckoXUL ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoXUL ) ) . gecko as * const _ + as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoXUL ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoSVGReset { + pub gecko: root::nsStyleSVGReset, + } + #[test] + fn bindgen_test_layout_GeckoSVGReset() { + assert_eq!(::std::mem::size_of::() , 192usize , + concat ! ( "Size of: " , stringify ! ( GeckoSVGReset ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoSVGReset ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoSVGReset ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoSVGReset ) + , "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoColumn { + pub gecko: root::nsStyleColumn, + } + #[test] + fn bindgen_test_layout_GeckoColumn() { + assert_eq!(::std::mem::size_of::() , 64usize , concat + ! ( "Size of: " , stringify ! ( GeckoColumn ) )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoColumn ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoColumn ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoColumn ) , + "::" , stringify ! ( gecko ) )); + } + #[repr(C)] + #[derive(Debug)] + pub struct GeckoEffects { + pub gecko: root::nsStyleEffects, + } + #[test] + fn bindgen_test_layout_GeckoEffects() { + assert_eq!(::std::mem::size_of::() , 40usize , + concat ! ( "Size of: " , stringify ! ( GeckoEffects ) + )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( GeckoEffects ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const GeckoEffects ) ) . gecko as * + const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( GeckoEffects ) + , "::" , stringify ! ( gecko ) )); + } /** * 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 @@ -7468,39 +7893,46 @@ pub mod root { #[repr(C)] #[derive(Debug)] pub struct ServoComputedValues2 { - pub Font: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Color: ::gecko_bindings::structs::ServoRawOffsetArc, - pub List: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Text: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Visibility: ::gecko_bindings::structs::ServoRawOffsetArc, - pub UserInterface: ::gecko_bindings::structs::ServoRawOffsetArc, - pub TableBorder: ::gecko_bindings::structs::ServoRawOffsetArc, - pub SVG: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Variables: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Background: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Position: ::gecko_bindings::structs::ServoRawOffsetArc, - pub TextReset: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Display: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Content: ::gecko_bindings::structs::ServoRawOffsetArc, - pub UIReset: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Table: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Margin: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Padding: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Border: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Outline: ::gecko_bindings::structs::ServoRawOffsetArc, - pub XUL: ::gecko_bindings::structs::ServoRawOffsetArc, - pub SVGReset: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Column: ::gecko_bindings::structs::ServoRawOffsetArc, - pub Effects: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Font: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Color: ::gecko_bindings::structs::ServoRawOffsetArc, + pub List: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Text: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Visibility: ::gecko_bindings::structs::ServoRawOffsetArc, + pub UserInterface: ::gecko_bindings::structs::ServoRawOffsetArc, + pub TableBorder: ::gecko_bindings::structs::ServoRawOffsetArc, + pub SVG: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Background: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Position: ::gecko_bindings::structs::ServoRawOffsetArc, + pub TextReset: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Display: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Content: ::gecko_bindings::structs::ServoRawOffsetArc, + pub UIReset: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Table: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Margin: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Padding: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Border: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Outline: ::gecko_bindings::structs::ServoRawOffsetArc, + pub XUL: ::gecko_bindings::structs::ServoRawOffsetArc, + pub SVGReset: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Column: ::gecko_bindings::structs::ServoRawOffsetArc, + pub Effects: ::gecko_bindings::structs::ServoRawOffsetArc, pub custom_properties: ::gecko_bindings::structs::ServoCustomPropertiesMap, pub writing_mode: ::gecko_bindings::structs::ServoWritingMode, pub font_computation_data: ::gecko_bindings::structs::ServoFontComputationData, + /// The rule node representing the ordered list of rules matched for this + /// node. Can be None for default values and text nodes. This is + /// essentially an optimization to avoid referencing the root rule node. + pub rules: ::gecko_bindings::structs::ServoRuleNode, + /// The element's computed values if visited, only computed if there's a + /// relevant link for this element. A element's "relevant link" is the + /// element being matched if it is a link or the nearest ancestor link. pub visited_style: ::gecko_bindings::structs::ServoVisitedStyle, + pub flags: ::gecko_bindings::structs::ServoComputedValueFlags, } #[test] fn bindgen_test_layout_ServoComputedValues2() { assert_eq!(::std::mem::size_of::() , - 224usize , concat ! ( + 232usize , concat ! ( "Size of: " , stringify ! ( ServoComputedValues2 ) )); assert_eq! (::std::mem::align_of::() , 8usize , concat ! ( @@ -7559,120 +7991,112 @@ pub mod root { )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - Variables as * const _ as usize } , 64usize , concat ! - ( - "Alignment of field: " , stringify ! ( - ServoComputedValues2 ) , "::" , stringify ! ( - Variables ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const ServoComputedValues2 ) ) . - Background as * const _ as usize } , 72usize , concat + Background as * const _ as usize } , 64usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Background ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - Position as * const _ as usize } , 80usize , concat ! + Position as * const _ as usize } , 72usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Position ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - TextReset as * const _ as usize } , 88usize , concat ! + TextReset as * const _ as usize } , 80usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( TextReset ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - Display as * const _ as usize } , 96usize , concat ! ( + Display as * const _ as usize } , 88usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Display ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - Content as * const _ as usize } , 104usize , concat ! - ( + Content as * const _ as usize } , 96usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Content ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - UIReset as * const _ as usize } , 112usize , concat ! + UIReset as * const _ as usize } , 104usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( UIReset ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . Table - as * const _ as usize } , 120usize , concat ! ( + as * const _ as usize } , 112usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Table ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . Margin - as * const _ as usize } , 128usize , concat ! ( + as * const _ as usize } , 120usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Margin ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - Padding as * const _ as usize } , 136usize , concat ! + Padding as * const _ as usize } , 128usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Padding ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . Border - as * const _ as usize } , 144usize , concat ! ( + as * const _ as usize } , 136usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Border ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - Outline as * const _ as usize } , 152usize , concat ! + Outline as * const _ as usize } , 144usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Outline ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . XUL as - * const _ as usize } , 160usize , concat ! ( + * const _ as usize } , 152usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( XUL ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - SVGReset as * const _ as usize } , 168usize , concat ! + SVGReset as * const _ as usize } , 160usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( SVGReset ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . Column - as * const _ as usize } , 176usize , concat ! ( + as * const _ as usize } , 168usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Column ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - Effects as * const _ as usize } , 184usize , concat ! + Effects as * const _ as usize } , 176usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( Effects ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - custom_properties as * const _ as usize } , 192usize , + custom_properties as * const _ as usize } , 184usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( custom_properties ) )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . - writing_mode as * const _ as usize } , 200usize , + writing_mode as * const _ as usize } , 192usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( @@ -7680,10 +8104,16 @@ pub mod root { assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . font_computation_data as * const _ as usize } , - 204usize , concat ! ( + 196usize , concat ! ( "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( font_computation_data ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const ServoComputedValues2 ) ) . rules + as * const _ as usize } , 208usize , concat ! ( + "Alignment of field: " , stringify ! ( + ServoComputedValues2 ) , "::" , stringify ! ( rules ) + )); assert_eq! (unsafe { & ( * ( 0 as * const ServoComputedValues2 ) ) . visited_style as * const _ as usize } , 216usize , @@ -7691,6 +8121,12 @@ pub mod root { "Alignment of field: " , stringify ! ( ServoComputedValues2 ) , "::" , stringify ! ( visited_style ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const ServoComputedValues2 ) ) . flags + as * const _ as usize } , 224usize , concat ! ( + "Alignment of field: " , stringify ! ( + ServoComputedValues2 ) , "::" , stringify ! ( flags ) + )); } #[repr(u8)] /** @@ -38413,7 +38849,7 @@ pub mod root { root::nsCharTraits ) )); } #[test] - fn __bindgen_test_layout__bindgen_ty_id_187141_instantiation_33() { + fn __bindgen_test_layout__bindgen_ty_id_187475_instantiation_33() { assert_eq!(::std::mem::size_of::() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( u8 ) )); @@ -38422,7 +38858,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout__bindgen_ty_id_187177_instantiation_34() { + fn __bindgen_test_layout__bindgen_ty_id_187511_instantiation_34() { assert_eq!(::std::mem::size_of::() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( u8 ) )); diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 13ca780ee9f..23717b3daa7 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -58,10 +58,9 @@ use properties::computed_value_flags::ComputedValueFlags; use properties::{longhands, FontComputationData, Importance, LonghandId}; use properties::{PropertyDeclaration, PropertyDeclarationBlock, PropertyDeclarationId}; use rule_tree::StrongRuleNode; -use std::fmt::{self, Debug}; use std::mem::{forget, transmute, zeroed}; use std::ptr; -use stylearc::Arc; +use stylearc::{Arc, RawOffsetArc}; use std::cmp; use values::{Auto, CustomIdent, Either, KeyframesName}; use values::computed::ToComputedValue; @@ -75,25 +74,23 @@ pub mod style_structs { % endfor } -// FIXME(emilio): Unify both definitions, since they're equal now. -#[derive(Clone)] -pub struct ComputedValues { - % for style_struct in data.style_structs: - ${style_struct.ident}: Arc, - % endfor - custom_properties: Option>, - pub writing_mode: WritingMode, - pub font_computation_data: FontComputationData, - pub flags: ComputedValueFlags, - /// The rule node representing the ordered list of rules matched for this - /// node. Can be None for default values and text nodes. This is - /// essentially an optimization to avoid referencing the root rule node. - pub rules: Option, - /// The element's computed values if visited, only computed if there's a - /// relevant link for this element. A element's "relevant link" is the - /// element being matched if it is a link or the nearest ancestor link. - visited_style: Option>, +pub use ::gecko_bindings::structs::mozilla::ServoComputedValues2 as ComputedValues; + +impl Clone for ComputedValues { + fn clone(&self) -> Self { + ComputedValues { + % for style_struct in data.style_structs: + ${style_struct.gecko_name}: self.${style_struct.gecko_name}.clone(), + % endfor + custom_properties: self.custom_properties.clone(), + writing_mode: self.writing_mode.clone(), + font_computation_data: self.font_computation_data.clone(), + flags: self.flags.clone(), + rules: self.rules.clone(), + visited_style: self.visited_style.clone(), + } + } } impl ComputedValues { @@ -115,7 +112,7 @@ impl ComputedValues { rules, visited_style: visited_style, % for style_struct in data.style_structs: - ${style_struct.ident}, + ${style_struct.gecko_name}: Arc::into_raw_offset(${style_struct.ident}), % endfor } } @@ -129,7 +126,7 @@ impl ComputedValues { rules: None, visited_style: None, % for style_struct in data.style_structs: - ${style_struct.ident}: style_structs::${style_struct.name}::default(pres_context), + ${style_struct.gecko_name}: Arc::into_raw_offset(style_structs::${style_struct.name}::default(pres_context)), % endfor }) } @@ -149,20 +146,21 @@ impl ComputedValues { % for style_struct in data.style_structs: #[inline] pub fn clone_${style_struct.name_lower}(&self) -> Arc { - self.${style_struct.ident}.clone() + Arc::from_raw_offset(self.${style_struct.gecko_name}.clone()) } #[inline] pub fn get_${style_struct.name_lower}(&self) -> &style_structs::${style_struct.name} { - &self.${style_struct.ident} + &self.${style_struct.gecko_name} } - pub fn ${style_struct.name_lower}_arc(&self) -> &Arc { - &self.${style_struct.ident} + + pub fn ${style_struct.name_lower}_arc(&self) -> &RawOffsetArc { + &self.${style_struct.gecko_name} } #[inline] pub fn mutate_${style_struct.name_lower}(&mut self) -> &mut style_structs::${style_struct.name} { - Arc::make_mut(&mut self.${style_struct.ident}) + RawOffsetArc::make_mut(&mut self.${style_struct.gecko_name}) } % endfor @@ -238,9 +236,7 @@ impl ComputedValues { } <%def name="declare_style_struct(style_struct)"> -pub struct ${style_struct.gecko_struct_name} { - gecko: ${style_struct.gecko_ffi_name}, -} +pub use ::gecko_bindings::structs::mozilla::Gecko${style_struct.gecko_name} as ${style_struct.gecko_struct_name}; impl ${style_struct.gecko_struct_name} { pub fn gecko(&self) -> &${style_struct.gecko_ffi_name} { &self.gecko @@ -737,20 +733,6 @@ impl Clone for ${style_struct.gecko_struct_name} { } } -// FIXME(bholley): Make bindgen generate Debug for all types. -%if style_struct.gecko_ffi_name in ("nsStyle" + x for x in "Border Display List Background Font SVGReset".split()): -impl Debug for ${style_struct.gecko_struct_name} { - // FIXME(bholley): Generate this. - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "Gecko style struct: ${style_struct.gecko_struct_name}") - } -} -%else: -impl Debug for ${style_struct.gecko_struct_name} { - // FIXME(bholley): Generate this. - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.gecko.fmt(f) } -} -%endif <%def name="impl_simple_type_with_conversion(ident, gecko_ffi_name=None)"> diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 9c6a017ced3..c2d0289b606 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -1886,7 +1886,7 @@ pub type ServoComputedValues = ComputedValues; /// /// When needed, the structs may be copied in order to get mutated. #[cfg(feature = "servo")] -#[cfg_attr(feature = "servo", derive(Clone))] +#[cfg_attr(feature = "servo", derive(Clone, Debug))] pub struct ComputedValues { % for style_struct in data.active_style_structs(): ${style_struct.ident}: Arc, @@ -2237,14 +2237,6 @@ impl ComputedValues { } } -// We manually implement Debug for ComputedValues so that we can avoid the -// verbose stringification of every property and instead focus on a few values. -impl fmt::Debug for ComputedValues { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "ComputedValues {{ rules: {:?}, .. }}", self.rules) - } -} - /// Return a WritingMode bitflags from the relevant CSS properties. pub fn get_writing_mode(inheritedbox_style: &style_structs::InheritedBox) -> WritingMode { use logical_geometry; @@ -2296,10 +2288,24 @@ pub fn get_writing_mode(inheritedbox_style: &style_structs::InheritedBox) -> Wri flags } +% if product == "gecko": + pub use ::stylearc::RawOffsetArc as BuilderArc; + /// Clone an arc, returning a regular arc + fn clone_arc(x: &BuilderArc) -> Arc { + Arc::from_raw_offset(x.clone()) + } +% else: + pub use ::stylearc::Arc as BuilderArc; + /// Clone an arc, returning a regular arc + fn clone_arc(x: &BuilderArc) -> Arc { + x.clone() + } +% endif + /// A reference to a style struct of the parent, or our own style struct. pub enum StyleStructRef<'a, T: 'static> { /// A borrowed struct from the parent, for example, for inheriting style. - Borrowed(&'a Arc), + Borrowed(&'a BuilderArc), /// An owned struct, that we've already mutated. Owned(UniqueArc), /// Temporarily vacated, will panic if accessed @@ -2360,7 +2366,7 @@ impl<'a, T: 'a> StyleStructRef<'a, T> pub fn build(self) -> Arc { match self { StyleStructRef::Owned(v) => v.shareable(), - StyleStructRef::Borrowed(v) => v.clone(), + StyleStructRef::Borrowed(v) => clone_arc(v), StyleStructRef::Vacated => panic!("Accessed vacated style struct") } }