From e8ffd9dbba4cf35e902a4800f3ed55efc572800f Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Thu, 13 Jul 2017 16:50:22 +0800 Subject: [PATCH 1/2] style: Add FFI function to compare ComputedValues for custom property differences. --- components/style/properties/gecko.mako.rs | 5 +++++ ports/geckolib/glue.rs | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 938cac51c84..72520d64be9 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -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> { self.custom_properties.clone() } diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 18c396d724e..e2b73602013 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -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) { From 69b839f22ef41d164653a0936bf4316dde76805d Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Fri, 14 Jul 2017 09:29:12 +0800 Subject: [PATCH 2/2] style: Update Gecko bindings. --- components/style/gecko/generated/bindings.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs index ab9e1f064e1..b1812da9a64 100644 --- a/components/style/gecko/generated/bindings.rs +++ b/components/style/gecko/generated/bindings.rs @@ -2684,6 +2684,13 @@ extern "C" { ServoComputedValuesBorrowed) -> u64; } +extern "C" { + pub fn Servo_ComputedValues_EqualCustomProperties(first: + ServoComputedValuesBorrowed, + second: + ServoComputedValuesBorrowed) + -> bool; +} extern "C" { pub fn Servo_ComputedValues_GetStyleRuleList(values: ServoComputedValuesBorrowed,