Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stylo: Fuse ServoStyleContext and ServoComputedValues #17767

Merged
merged 16 commits into from Jul 18, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

stylo: Stop using mStyleIfVisited in Servo

  • Loading branch information
Manishearth committed Jul 18, 2017
commit 2a49a73f91c7caf4673b7f7121a55e93a5751de0
@@ -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)
@@ -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<T> = ::stylearc::RawOffsetArc<T>;
pub type ServoStyleContextStrong = ::gecko_bindings::sugar::ownership::Strong<ServoStyleContext>;
@@ -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::<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 gecko: root::nsStyleFont,
}
}
#[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::<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 mFromKey: f32,
pub mToKey: f32,
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::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));
) ));
}
#[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 ! (
"Size of template specialization: " , stringify ! ( u8 )
));
@@ -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<T> = ::stylearc::RawOffsetArc<T>;
pub type ServoStyleContextStrong = ::gecko_bindings::sugar::ownership::Strong<ServoStyleContext>;
@@ -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::<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 gecko: root::nsStyleFont,
}
}
#[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::<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 mFromKey: f32,
pub mToKey: f32,
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::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));
) ));
}
#[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 ! (
"Size of template specialization: " , stringify ! ( u8 )
));
@@ -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<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).
@@ -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,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.