style: Add FFI function to compare ComputedValues for custom property differences.

This commit is contained in:
Cameron McCormack 2017-07-13 16:50:22 +08:00
parent 18c5ba108d
commit e8ffd9dbba
2 changed files with 15 additions and 0 deletions

View file

@ -192,6 +192,11 @@ impl ComputedValues {
self.visited_style.clone()
}
/// Gets a reference to the custom properties map (if one exists).
pub fn get_custom_properties(&self) -> Option<<&::custom_properties::CustomPropertiesMap> {
self.custom_properties.as_ref().map(|x| &**x)
}
pub fn custom_properties(&self) -> Option<Arc<CustomPropertiesMap>> {
self.custom_properties.clone()
}

View file

@ -1741,6 +1741,16 @@ pub extern "C" fn Servo_ComputedValues_SpecifiesAnimationsOrTransitions(values:
b.specifies_animations() || b.specifies_transitions()
}
#[no_mangle]
pub extern "C" fn Servo_ComputedValues_EqualCustomProperties(
first: ServoComputedValuesBorrowed,
second: ServoComputedValuesBorrowed
) -> bool {
let first = ComputedValues::as_arc(&first);
let second = ComputedValues::as_arc(&second);
first.get_custom_properties() == second.get_custom_properties()
}
#[no_mangle]
pub extern "C" fn Servo_ComputedValues_GetStyleRuleList(values: ServoComputedValuesBorrowed,
rules: RawGeckoServoStyleRuleListBorrowedMut) {