From 2a49a73f91c7caf4673b7f7121a55e93a5751de0 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 17 Jul 2017 11:42:20 -0700 Subject: [PATCH] stylo: Stop using mStyleIfVisited in Servo --- components/style/gecko/generated/bindings.rs | 5 -- .../style/gecko/generated/structs_debug.rs | 66 +++++++++---------- .../style/gecko/generated/structs_release.rs | 66 +++++++++---------- components/style/properties/gecko.mako.rs | 4 +- ports/geckolib/glue.rs | 9 --- 5 files changed, 68 insertions(+), 82 deletions(-) diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs index e7b5f75cb1ab..fb2cf3bcfc98 100644 --- a/components/style/gecko/generated/bindings.rs +++ b/components/style/gecko/generated/bindings.rs @@ -2687,11 +2687,6 @@ extern "C" { target: InheritTarget) -> ServoStyleContextStrong; } -extern "C" { - pub fn Servo_ComputedValues_GetVisitedStyle(values: - ServoComputedValuesBorrowed) - -> ServoStyleContextStrong; -} extern "C" { pub fn Servo_ComputedValues_GetStyleBits(values: ServoComputedValuesBorrowed) diff --git a/components/style/gecko/generated/structs_debug.rs b/components/style/gecko/generated/structs_debug.rs index 1f92b314da30..ecdcdbf18022 100644 --- a/components/style/gecko/generated/structs_debug.rs +++ b/components/style/gecko/generated/structs_debug.rs @@ -13,7 +13,7 @@ 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<::properties::ComputedValues>>; +pub type ServoVisitedStyle = Option<::stylearc::RawOffsetArc<::properties::ComputedValues>>; pub type ServoComputedValueFlags = ::properties::computed_value_flags::ComputedValueFlags; pub type ServoRawOffsetArc = ::stylearc::RawOffsetArc; pub type ServoStyleContextStrong = ::gecko_bindings::sugar::ownership::Strong; @@ -7603,6 +7603,36 @@ pub mod root { } #[repr(C)] #[derive(Debug)] + pub struct ServoStyleContext { + pub _base: root::nsStyleContext, + pub mPresContext: *mut root::nsPresContext, + pub mSource: root::ServoComputedValues, + } + #[test] + fn bindgen_test_layout_ServoStyleContext() { + assert_eq!(::std::mem::size_of::() , 280usize , + concat ! ( + "Size of: " , stringify ! ( ServoStyleContext ) )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( ServoStyleContext ) + )); + assert_eq! (unsafe { + & ( * ( 0 as * const ServoStyleContext ) ) . + mPresContext as * const _ as usize } , 40usize , + concat ! ( + "Alignment of field: " , stringify ! ( + ServoStyleContext ) , "::" , stringify ! ( + mPresContext ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const ServoStyleContext ) ) . mSource + as * const _ as usize } , 48usize , concat ! ( + "Alignment of field: " , stringify ! ( + ServoStyleContext ) , "::" , stringify ! ( mSource ) + )); + } + #[repr(C)] + #[derive(Debug)] pub struct GeckoFont { pub gecko: root::nsStyleFont, } @@ -10844,36 +10874,6 @@ pub mod root { } #[repr(C)] #[derive(Debug)] - pub struct ServoStyleContext { - pub _base: root::nsStyleContext, - pub mPresContext: *mut root::nsPresContext, - pub mSource: root::ServoComputedValues, - } - #[test] - fn bindgen_test_layout_ServoStyleContext() { - assert_eq!(::std::mem::size_of::() , 280usize , - concat ! ( - "Size of: " , stringify ! ( ServoStyleContext ) )); - assert_eq! (::std::mem::align_of::() , 8usize , - concat ! ( - "Alignment of " , stringify ! ( ServoStyleContext ) - )); - assert_eq! (unsafe { - & ( * ( 0 as * const ServoStyleContext ) ) . - mPresContext as * const _ as usize } , 40usize , - concat ! ( - "Alignment of field: " , stringify ! ( - ServoStyleContext ) , "::" , stringify ! ( - mPresContext ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const ServoStyleContext ) ) . mSource - as * const _ as usize } , 48usize , concat ! ( - "Alignment of field: " , stringify ! ( - ServoStyleContext ) , "::" , stringify ! ( mSource ) - )); - } - #[repr(C)] - #[derive(Debug)] pub struct AnimationPropertySegment { pub mFromKey: f32, pub mToKey: f32, @@ -40114,7 +40114,7 @@ pub mod root { root::nsCharTraits ) )); } #[test] - fn __bindgen_test_layout__bindgen_ty_id_195320_instantiation_33() { + fn __bindgen_test_layout__bindgen_ty_id_195318_instantiation_33() { assert_eq!(::std::mem::size_of::() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( u8 ) )); @@ -40123,7 +40123,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout__bindgen_ty_id_195356_instantiation_34() { + fn __bindgen_test_layout__bindgen_ty_id_195354_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 5e12a86f6c28..8889de35eed8 100644 --- a/components/style/gecko/generated/structs_release.rs +++ b/components/style/gecko/generated/structs_release.rs @@ -13,7 +13,7 @@ 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<::properties::ComputedValues>>; +pub type ServoVisitedStyle = Option<::stylearc::RawOffsetArc<::properties::ComputedValues>>; pub type ServoComputedValueFlags = ::properties::computed_value_flags::ComputedValueFlags; pub type ServoRawOffsetArc = ::stylearc::RawOffsetArc; pub type ServoStyleContextStrong = ::gecko_bindings::sugar::ownership::Strong; @@ -7455,6 +7455,36 @@ pub mod root { } #[repr(C)] #[derive(Debug)] + pub struct ServoStyleContext { + pub _base: root::nsStyleContext, + pub mPresContext: *mut root::nsPresContext, + pub mSource: root::ServoComputedValues, + } + #[test] + fn bindgen_test_layout_ServoStyleContext() { + assert_eq!(::std::mem::size_of::() , 280usize , + concat ! ( + "Size of: " , stringify ! ( ServoStyleContext ) )); + assert_eq! (::std::mem::align_of::() , 8usize , + concat ! ( + "Alignment of " , stringify ! ( ServoStyleContext ) + )); + assert_eq! (unsafe { + & ( * ( 0 as * const ServoStyleContext ) ) . + mPresContext as * const _ as usize } , 40usize , + concat ! ( + "Alignment of field: " , stringify ! ( + ServoStyleContext ) , "::" , stringify ! ( + mPresContext ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const ServoStyleContext ) ) . mSource + as * const _ as usize } , 48usize , concat ! ( + "Alignment of field: " , stringify ! ( + ServoStyleContext ) , "::" , stringify ! ( mSource ) + )); + } + #[repr(C)] + #[derive(Debug)] pub struct GeckoFont { pub gecko: root::nsStyleFont, } @@ -10581,36 +10611,6 @@ pub mod root { } #[repr(C)] #[derive(Debug)] - pub struct ServoStyleContext { - pub _base: root::nsStyleContext, - pub mPresContext: *mut root::nsPresContext, - pub mSource: root::ServoComputedValues, - } - #[test] - fn bindgen_test_layout_ServoStyleContext() { - assert_eq!(::std::mem::size_of::() , 280usize , - concat ! ( - "Size of: " , stringify ! ( ServoStyleContext ) )); - assert_eq! (::std::mem::align_of::() , 8usize , - concat ! ( - "Alignment of " , stringify ! ( ServoStyleContext ) - )); - assert_eq! (unsafe { - & ( * ( 0 as * const ServoStyleContext ) ) . - mPresContext as * const _ as usize } , 40usize , - concat ! ( - "Alignment of field: " , stringify ! ( - ServoStyleContext ) , "::" , stringify ! ( - mPresContext ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const ServoStyleContext ) ) . mSource - as * const _ as usize } , 48usize , concat ! ( - "Alignment of field: " , stringify ! ( - ServoStyleContext ) , "::" , stringify ! ( mSource ) - )); - } - #[repr(C)] - #[derive(Debug)] pub struct AnimationPropertySegment { pub mFromKey: f32, pub mToKey: f32, @@ -39462,7 +39462,7 @@ pub mod root { root::nsCharTraits ) )); } #[test] - fn __bindgen_test_layout__bindgen_ty_id_192842_instantiation_33() { + fn __bindgen_test_layout__bindgen_ty_id_192840_instantiation_33() { assert_eq!(::std::mem::size_of::() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( u8 ) )); @@ -39471,7 +39471,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout__bindgen_ty_id_192878_instantiation_34() { + fn __bindgen_test_layout__bindgen_ty_id_192876_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 542b4ca6d04e..d6024e4a55a6 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -131,7 +131,7 @@ impl ComputedValuesInner { writing_mode: writing_mode, font_computation_data: FontComputationData::new(font_size_keyword), rules: rules, - visited_style: visited_style, + visited_style: visited_style.map(|x| Arc::into_raw_offset(x)), flags: flags, % for style_struct in data.style_structs: ${style_struct.gecko_name}: Arc::into_raw_offset(${style_struct.ident}), @@ -250,7 +250,7 @@ impl ComputedValuesInner { /// Clone the visited style. Used for inheriting parent styles in /// StyleBuilder::for_inheritance. pub fn clone_visited_style(&self) -> Option> { - self.visited_style.clone() + self.visited_style.as_ref().map(|x| x.clone_arc()) } /// Gets a reference to the custom properties map (if one exists). diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 40d8969f0a23..045c37c1acd2 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -1732,15 +1732,6 @@ pub extern "C" fn Servo_ComputedValues_Inherit( style.to_outer(data.stylist.device(), parent_style_context, pseudo_info).into_strong() } -#[no_mangle] -pub extern "C" fn Servo_ComputedValues_GetVisitedStyle(values: ServoComputedValuesBorrowed) - -> ServoStyleContextStrong { - match values.clone_visited_style() { - Some(v) => v.into_strong(), - None => Strong::null(), - } -} - #[no_mangle] pub extern "C" fn Servo_StyleContext_NewContext(values: ServoComputedValuesBorrowed, parent: ServoStyleContextBorrowedOrNull,