stylo: Stop using mStyleIfVisited in Servo

This commit is contained in:
Manish Goregaokar 2017-07-17 11:42:20 -07:00 committed by Manish Goregaokar
parent e78947f8b5
commit 2a49a73f91
5 changed files with 68 additions and 82 deletions

View file

@ -2687,11 +2687,6 @@ extern "C" {
target: InheritTarget) target: InheritTarget)
-> ServoStyleContextStrong; -> ServoStyleContextStrong;
} }
extern "C" {
pub fn Servo_ComputedValues_GetVisitedStyle(values:
ServoComputedValuesBorrowed)
-> ServoStyleContextStrong;
}
extern "C" { extern "C" {
pub fn Servo_ComputedValues_GetStyleBits(values: pub fn Servo_ComputedValues_GetStyleBits(values:
ServoComputedValuesBorrowed) ServoComputedValuesBorrowed)

View file

@ -13,7 +13,7 @@ pub type ServoWritingMode = ::logical_geometry::WritingMode;
pub type ServoFontComputationData = ::properties::FontComputationData; pub type ServoFontComputationData = ::properties::FontComputationData;
pub type ServoCustomPropertiesMap = Option<::stylearc::Arc<::custom_properties::CustomPropertiesMap>>; pub type ServoCustomPropertiesMap = Option<::stylearc::Arc<::custom_properties::CustomPropertiesMap>>;
pub type ServoRuleNode = Option<::rule_tree::StrongRuleNode>; 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 ServoComputedValueFlags = ::properties::computed_value_flags::ComputedValueFlags;
pub type ServoRawOffsetArc<T> = ::stylearc::RawOffsetArc<T>; pub type ServoRawOffsetArc<T> = ::stylearc::RawOffsetArc<T>;
pub type ServoStyleContextStrong = ::gecko_bindings::sugar::ownership::Strong<ServoStyleContext>; pub type ServoStyleContextStrong = ::gecko_bindings::sugar::ownership::Strong<ServoStyleContext>;
@ -7603,6 +7603,36 @@ pub mod root {
} }
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[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::<ServoStyleContext>() , 280usize ,
concat ! (
"Size of: " , stringify ! ( ServoStyleContext ) ));
assert_eq! (::std::mem::align_of::<ServoStyleContext>() , 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 struct GeckoFont {
pub gecko: root::nsStyleFont, pub gecko: root::nsStyleFont,
} }
@ -10844,36 +10874,6 @@ pub mod root {
} }
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[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::<ServoStyleContext>() , 280usize ,
concat ! (
"Size of: " , stringify ! ( ServoStyleContext ) ));
assert_eq! (::std::mem::align_of::<ServoStyleContext>() , 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 struct AnimationPropertySegment {
pub mFromKey: f32, pub mFromKey: f32,
pub mToKey: f32, pub mToKey: f32,
@ -40114,7 +40114,7 @@ pub mod root {
root::nsCharTraits ) )); root::nsCharTraits ) ));
} }
#[test] #[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::<u8>() , 1usize , concat ! ( assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 ) "Size of template specialization: " , stringify ! ( u8 )
)); ));
@ -40123,7 +40123,7 @@ pub mod root {
) )); ) ));
} }
#[test] #[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::<u8>() , 1usize , concat ! ( assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 ) "Size of template specialization: " , stringify ! ( u8 )
)); ));

View file

@ -13,7 +13,7 @@ pub type ServoWritingMode = ::logical_geometry::WritingMode;
pub type ServoFontComputationData = ::properties::FontComputationData; pub type ServoFontComputationData = ::properties::FontComputationData;
pub type ServoCustomPropertiesMap = Option<::stylearc::Arc<::custom_properties::CustomPropertiesMap>>; pub type ServoCustomPropertiesMap = Option<::stylearc::Arc<::custom_properties::CustomPropertiesMap>>;
pub type ServoRuleNode = Option<::rule_tree::StrongRuleNode>; 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 ServoComputedValueFlags = ::properties::computed_value_flags::ComputedValueFlags;
pub type ServoRawOffsetArc<T> = ::stylearc::RawOffsetArc<T>; pub type ServoRawOffsetArc<T> = ::stylearc::RawOffsetArc<T>;
pub type ServoStyleContextStrong = ::gecko_bindings::sugar::ownership::Strong<ServoStyleContext>; pub type ServoStyleContextStrong = ::gecko_bindings::sugar::ownership::Strong<ServoStyleContext>;
@ -7455,6 +7455,36 @@ pub mod root {
} }
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[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::<ServoStyleContext>() , 280usize ,
concat ! (
"Size of: " , stringify ! ( ServoStyleContext ) ));
assert_eq! (::std::mem::align_of::<ServoStyleContext>() , 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 struct GeckoFont {
pub gecko: root::nsStyleFont, pub gecko: root::nsStyleFont,
} }
@ -10581,36 +10611,6 @@ pub mod root {
} }
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[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::<ServoStyleContext>() , 280usize ,
concat ! (
"Size of: " , stringify ! ( ServoStyleContext ) ));
assert_eq! (::std::mem::align_of::<ServoStyleContext>() , 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 struct AnimationPropertySegment {
pub mFromKey: f32, pub mFromKey: f32,
pub mToKey: f32, pub mToKey: f32,
@ -39462,7 +39462,7 @@ pub mod root {
root::nsCharTraits ) )); root::nsCharTraits ) ));
} }
#[test] #[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::<u8>() , 1usize , concat ! ( assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 ) "Size of template specialization: " , stringify ! ( u8 )
)); ));
@ -39471,7 +39471,7 @@ pub mod root {
) )); ) ));
} }
#[test] #[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::<u8>() , 1usize , concat ! ( assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 ) "Size of template specialization: " , stringify ! ( u8 )
)); ));

View file

@ -131,7 +131,7 @@ impl ComputedValuesInner {
writing_mode: writing_mode, writing_mode: writing_mode,
font_computation_data: FontComputationData::new(font_size_keyword), font_computation_data: FontComputationData::new(font_size_keyword),
rules: rules, rules: rules,
visited_style: visited_style, visited_style: visited_style.map(|x| Arc::into_raw_offset(x)),
flags: flags, flags: flags,
% for style_struct in data.style_structs: % for style_struct in data.style_structs:
${style_struct.gecko_name}: Arc::into_raw_offset(${style_struct.ident}), ${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 /// Clone the visited style. Used for inheriting parent styles in
/// StyleBuilder::for_inheritance. /// StyleBuilder::for_inheritance.
pub fn clone_visited_style(&self) -> Option<Arc<ComputedValues>> { pub fn clone_visited_style(&self) -> Option<Arc<ComputedValues>> {
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). /// Gets a reference to the custom properties map (if one exists).

View file

@ -1732,15 +1732,6 @@ pub extern "C" fn Servo_ComputedValues_Inherit(
style.to_outer(data.stylist.device(), parent_style_context, pseudo_info).into_strong() 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] #[no_mangle]
pub extern "C" fn Servo_StyleContext_NewContext(values: ServoComputedValuesBorrowed, pub extern "C" fn Servo_StyleContext_NewContext(values: ServoComputedValuesBorrowed,
parent: ServoStyleContextBorrowedOrNull, parent: ServoStyleContextBorrowedOrNull,