stylo: Flatten ServoComputedValues into ServoStyleContext

This patch also removes the duplication of style contexts during the
restyle, because otherwise pointer equality of ServoComputedValues stops
holding (and we assert on that in a few places)
This commit is contained in:
Manish Goregaokar 2017-07-17 11:42:08 -07:00 committed by Manish Goregaokar
parent cfad95bff0
commit ff4bc5a2c6
6 changed files with 82 additions and 45 deletions

View file

@ -7,6 +7,8 @@ type nsACString_internal = nsACString;
type nsAString_internal = nsAString;
pub type ServoStyleContextBorrowed<'a> = &'a ServoStyleContext;
pub type ServoStyleContextBorrowedOrNull<'a> = Option<&'a ::properties::ComputedValues>;
pub type ServoComputedValuesBorrowed<'a> = &'a ServoComputedValues;
pub type ServoComputedValuesBorrowedOrNull<'a> = Option<&'a ServoComputedValues>;
use gecko_bindings::structs::mozilla::css::GridTemplateAreasValue;
use gecko_bindings::structs::mozilla::css::ErrorReporter;
use gecko_bindings::structs::mozilla::css::ImageValue;
@ -319,9 +321,6 @@ pub struct ServoCssRules(ServoCssRulesVoid);
pub type RawServoStyleSheetContentsStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoStyleSheetContents>;
pub type RawServoStyleSheetContentsBorrowed<'a> = &'a RawServoStyleSheetContents;
pub type RawServoStyleSheetContentsBorrowedOrNull<'a> = Option<&'a RawServoStyleSheetContents>;
pub type ServoComputedValuesStrong = ::gecko_bindings::sugar::ownership::Strong<ServoComputedValues>;
pub type ServoComputedValuesBorrowed<'a> = &'a ServoComputedValues;
pub type ServoComputedValuesBorrowedOrNull<'a> = Option<&'a ServoComputedValues>;
pub type RawServoDeclarationBlockStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoDeclarationBlock>;
pub type RawServoDeclarationBlockBorrowed<'a> = &'a RawServoDeclarationBlock;
pub type RawServoDeclarationBlockBorrowedOrNull<'a> = Option<&'a RawServoDeclarationBlock>;
@ -402,12 +401,6 @@ extern "C" {
pub fn Servo_StyleSheetContents_Release(ptr:
RawServoStyleSheetContentsBorrowed);
}
extern "C" {
pub fn Servo_ComputedValues_AddRef(ptr: ServoComputedValuesBorrowed);
}
extern "C" {
pub fn Servo_ComputedValues_Release(ptr: ServoComputedValuesBorrowed);
}
extern "C" {
pub fn Servo_DeclarationBlock_AddRef(ptr:
RawServoDeclarationBlockBorrowed);
@ -537,7 +530,7 @@ extern "C" {
ServoStyleContextBorrowedOrNull,
pres_context:
RawGeckoPresContextBorrowed,
values: ServoComputedValuesStrong,
values: ServoComputedValuesBorrowed,
pseudo_type: CSSPseudoElementType,
pseudo_tag: *mut nsIAtom);
}

View file

@ -10847,11 +10847,11 @@ pub mod root {
pub struct ServoStyleContext {
pub _base: root::nsStyleContext,
pub mPresContext: *mut root::nsPresContext,
pub mSource: root::RefPtr<root::ServoComputedValues>,
pub mSource: root::ServoComputedValues,
}
#[test]
fn bindgen_test_layout_ServoStyleContext() {
assert_eq!(::std::mem::size_of::<ServoStyleContext>() , 56usize ,
assert_eq!(::std::mem::size_of::<ServoStyleContext>() , 280usize ,
concat ! (
"Size of: " , stringify ! ( ServoStyleContext ) ));
assert_eq! (::std::mem::align_of::<ServoStyleContext>() , 8usize ,
@ -20971,10 +20971,6 @@ pub mod root {
* 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>
*/
#[repr(C)]
#[derive(Debug)]
@ -21174,6 +21170,31 @@ pub mod root {
"Alignment of field: " , stringify ! ( ServoComputedValues
) , "::" , stringify ! ( flags ) ));
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct ServoComputedValuesForgotten {
pub mPtr: *const root::ServoComputedValues,
}
#[test]
fn bindgen_test_layout_ServoComputedValuesForgotten() {
assert_eq!(::std::mem::size_of::<ServoComputedValuesForgotten>() ,
8usize , concat ! (
"Size of: " , stringify ! ( ServoComputedValuesForgotten )
));
assert_eq! (::std::mem::align_of::<ServoComputedValuesForgotten>() ,
8usize , concat ! (
"Alignment of " , stringify ! (
ServoComputedValuesForgotten ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const ServoComputedValuesForgotten ) ) .
mPtr as * const _ as usize } , 0usize , concat ! (
"Alignment of field: " , stringify ! (
ServoComputedValuesForgotten ) , "::" , stringify ! ( mPtr
) ));
}
impl Clone for ServoComputedValuesForgotten {
fn clone(&self) -> Self { *self }
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum WeakMapTraceKind {
@ -38416,13 +38437,15 @@ pub mod root {
pub type RawGeckoGfxMatrix4x4 = [root::mozilla::gfx::Float; 16usize];
pub type RawGeckoStyleChildrenIterator =
root::mozilla::dom::StyleChildrenIterator;
pub type ServoComputedValuesBorrowed = *const root::ServoComputedValues;
pub type RawServoDeclarationBlockBorrowed =
*const root::RawServoDeclarationBlock;
pub type ServoStyleContextBorrowed =
*const root::mozilla::ServoStyleContext;
pub type ServoStyleContextBorrowedOrNull =
*const root::mozilla::ServoStyleContext;
pub type ServoComputedValuesBorrowed = *const root::ServoComputedValues;
pub type ServoComputedValuesBorrowedOrNull =
*const root::ServoComputedValues;
pub type RawServoAnimationValueMapBorrowedMut =
*mut root::RawServoAnimationValueMap;
pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode;
@ -40091,7 +40114,7 @@ pub mod root {
root::nsCharTraits ) ));
}
#[test]
fn __bindgen_test_layout__bindgen_ty_id_195909_instantiation_33() {
fn __bindgen_test_layout__bindgen_ty_id_195896_instantiation_33() {
assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));
@ -40100,7 +40123,7 @@ pub mod root {
) ));
}
#[test]
fn __bindgen_test_layout__bindgen_ty_id_195945_instantiation_34() {
fn __bindgen_test_layout__bindgen_ty_id_195932_instantiation_34() {
assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));

View file

@ -10584,11 +10584,11 @@ pub mod root {
pub struct ServoStyleContext {
pub _base: root::nsStyleContext,
pub mPresContext: *mut root::nsPresContext,
pub mSource: root::RefPtr<root::ServoComputedValues>,
pub mSource: root::ServoComputedValues,
}
#[test]
fn bindgen_test_layout_ServoStyleContext() {
assert_eq!(::std::mem::size_of::<ServoStyleContext>() , 56usize ,
assert_eq!(::std::mem::size_of::<ServoStyleContext>() , 280usize ,
concat ! (
"Size of: " , stringify ! ( ServoStyleContext ) ));
assert_eq! (::std::mem::align_of::<ServoStyleContext>() , 8usize ,
@ -20626,10 +20626,6 @@ pub mod root {
* 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>
*/
#[repr(C)]
#[derive(Debug)]
@ -20829,6 +20825,31 @@ pub mod root {
"Alignment of field: " , stringify ! ( ServoComputedValues
) , "::" , stringify ! ( flags ) ));
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct ServoComputedValuesForgotten {
pub mPtr: *const root::ServoComputedValues,
}
#[test]
fn bindgen_test_layout_ServoComputedValuesForgotten() {
assert_eq!(::std::mem::size_of::<ServoComputedValuesForgotten>() ,
8usize , concat ! (
"Size of: " , stringify ! ( ServoComputedValuesForgotten )
));
assert_eq! (::std::mem::align_of::<ServoComputedValuesForgotten>() ,
8usize , concat ! (
"Alignment of " , stringify ! (
ServoComputedValuesForgotten ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const ServoComputedValuesForgotten ) ) .
mPtr as * const _ as usize } , 0usize , concat ! (
"Alignment of field: " , stringify ! (
ServoComputedValuesForgotten ) , "::" , stringify ! ( mPtr
) ));
}
impl Clone for ServoComputedValuesForgotten {
fn clone(&self) -> Self { *self }
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum WeakMapTraceKind {
@ -37764,13 +37785,15 @@ pub mod root {
pub type RawGeckoGfxMatrix4x4 = [root::mozilla::gfx::Float; 16usize];
pub type RawGeckoStyleChildrenIterator =
root::mozilla::dom::StyleChildrenIterator;
pub type ServoComputedValuesBorrowed = *const root::ServoComputedValues;
pub type RawServoDeclarationBlockBorrowed =
*const root::RawServoDeclarationBlock;
pub type ServoStyleContextBorrowed =
*const root::mozilla::ServoStyleContext;
pub type ServoStyleContextBorrowedOrNull =
*const root::mozilla::ServoStyleContext;
pub type ServoComputedValuesBorrowed = *const root::ServoComputedValues;
pub type ServoComputedValuesBorrowedOrNull =
*const root::ServoComputedValues;
pub type RawServoAnimationValueMapBorrowedMut =
*mut root::RawServoAnimationValueMap;
pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode;
@ -39439,7 +39462,7 @@ pub mod root {
root::nsCharTraits ) ));
}
#[test]
fn __bindgen_test_layout__bindgen_ty_id_193431_instantiation_33() {
fn __bindgen_test_layout__bindgen_ty_id_193418_instantiation_33() {
assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));
@ -39448,7 +39471,7 @@ pub mod root {
) ));
}
#[test]
fn __bindgen_test_layout__bindgen_ty_id_193467_instantiation_34() {
fn __bindgen_test_layout__bindgen_ty_id_193454_instantiation_34() {
assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));