From 715d18d377fd85fb7a5960d6ac7ada72f29a5c05 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Sat, 20 May 2017 11:17:57 +0800 Subject: [PATCH] style: Add an outparam to Gecko_CalcStyleDifference that returns whether any style data changed. --- components/style/gecko/generated/bindings.rs | 3 ++- components/style/gecko/restyle_damage.rs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs index a07176ee208..101e9c89cad 100644 --- a/components/style/gecko/generated/bindings.rs +++ b/components/style/gecko/generated/bindings.rs @@ -961,7 +961,8 @@ extern "C" { } extern "C" { pub fn Gecko_CalcStyleDifference(oldstyle: *mut nsStyleContext, - newstyle: ServoComputedValuesBorrowed) + newstyle: ServoComputedValuesBorrowed, + any_style_changed: *mut bool) -> nsChangeHint; } extern "C" { diff --git a/components/style/gecko/restyle_damage.rs b/components/style/gecko/restyle_damage.rs index 39fdafebd5d..7cb66470403 100644 --- a/components/style/gecko/restyle_damage.rs +++ b/components/style/gecko/restyle_damage.rs @@ -49,9 +49,11 @@ impl GeckoRestyleDamage { new_style: &Arc) -> Self { // TODO(emilio): Const-ify this? let context = source as *const nsStyleContext as *mut nsStyleContext; + let mut any_style_changed: bool = false; let hint = unsafe { bindings::Gecko_CalcStyleDifference(context, - new_style.as_borrowed_opt().unwrap()) + new_style.as_borrowed_opt().unwrap(), + &mut any_style_changed) }; GeckoRestyleDamage(hint) }