style: Skip custom properties comparison if other inherited properties changed. draft
authorCameron McCormack <cam@mcc.id.au>
Thu, 12 Oct 2017 09:13:38 +0800
changeset 678901 6d3b934401fc8a57eb4027d8f46f09a5158d55f0
parent 678900 52c465b408253ae14ead2316426b8453f5912e39
child 735464 68df94d8534bb48b0cf191b7836e9402942d93af
push id84069
push userbmo:cam@mcc.id.au
push dateThu, 12 Oct 2017 01:15:15 +0000
milestone58.0a1
style: Skip custom properties comparison if other inherited properties changed. MozReview-Commit-ID: 5Wc51VygLAo
servo/components/style/gecko/restyle_damage.rs
--- a/servo/components/style/gecko/restyle_damage.rs
+++ b/servo/components/style/gecko/restyle_damage.rs
@@ -52,16 +52,24 @@ impl GeckoRestyleDamage {
         let hint = unsafe {
             bindings::Gecko_CalcStyleDifference(
                 old_style,
                 new_style,
                 &mut any_style_changed,
                 &mut reset_only,
             )
         };
+        if reset_only {
+            // The Gecko_CalcStyleDifference call only checks the non-custom
+            // property structs. Check the custom properties here.
+            if old_style.custom_properties() != new_style.custom_properties() {
+                any_style_changed = true;
+                reset_only = false;
+            }
+        }
         let change = if any_style_changed {
             StyleChange::Changed { reset_only }
         } else {
             StyleChange::Unchanged
         };
         StyleDifference::new(GeckoRestyleDamage(nsChangeHint(hint)), change)
     }