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

@ -1735,7 +1735,7 @@ pub extern "C" fn Servo_ComputedValues_Inherit(
#[no_mangle]
pub extern "C" fn Servo_ComputedValues_GetVisitedStyle(values: ServoComputedValuesBorrowed)
-> ServoStyleContextStrong {
match ComputedValuesInner::as_arc(&values).clone_visited_style() {
match values.clone_visited_style() {
Some(v) => v.into_strong(),
None => Strong::null(),
}
@ -1748,10 +1748,9 @@ pub extern "C" fn Servo_StyleContext_NewContext(values: ServoComputedValuesBorro
pseudo_type: CSSPseudoElementType,
pseudo_tag: *mut nsIAtom)
-> ServoStyleContextStrong {
let arc = ComputedValuesInner::as_arc(&values);
unsafe {
ComputedValuesInner::to_outer_from_arc(arc.clone_arc(), pres_context, parent,
pseudo_type, pseudo_tag).into_strong()
(*values).clone().to_outer_helper(pres_context, parent,
pseudo_type, pseudo_tag).into_strong()
}
}
@ -3386,7 +3385,7 @@ pub extern "C" fn Servo_GetCustomPropertyValue(computed_values: ServoComputedVal
#[no_mangle]
pub extern "C" fn Servo_GetCustomPropertiesCount(computed_values: ServoComputedValuesBorrowed) -> u32 {
match ComputedValuesInner::as_arc(&computed_values).custom_properties() {
match computed_values.custom_properties() {
Some(p) => p.len() as u32,
None => 0,
}
@ -3396,7 +3395,7 @@ pub extern "C" fn Servo_GetCustomPropertiesCount(computed_values: ServoComputedV
pub extern "C" fn Servo_GetCustomPropertyNameAt(computed_values: ServoComputedValuesBorrowed,
index: u32,
name: *mut nsAString) -> bool {
let custom_properties = match ComputedValuesInner::as_arc(&computed_values).custom_properties() {
let custom_properties = match computed_values.custom_properties() {
Some(p) => p,
None => return false,
};