servo: Merge #17802 - Revert "Backed out changeset b10e6ba9cbdb because gecko part had to b… (from emilio:reland-stuff); r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 20 Jul 2017 20:28:25 -0700
changeset 418828 fabd4d584c01f82ce691205ecbf8dccfe44aa5fa
parent 418827 44c251302acc511b366b890fe7baa7095d62d49d
child 418829 f779a8d870bbf9146ff530ff2f2293936a72e0f9
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs17802
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #17802 - Revert "Backed out changeset b10e6ba9cbdb because gecko part had to b… (from emilio:reland-stuff); r=heycam …e backed out." This reverts commit b96d96d448c8ff93f212f225013461999540a5d0. The fix on the Gecko side is trivial, and I can land it after this lands. Source-Repo: https://github.com/servo/servo Source-Revision: a3c398b5dacae251f483775042b12ffb5e0ff01c
servo/components/layout/animation.rs
servo/components/style/gecko/generated/bindings.rs
servo/components/style/gecko/restyle_damage.rs
servo/components/style/matching.rs
servo/components/style/properties/gecko.mako.rs
servo/components/style/servo/restyle_damage.rs
--- a/servo/components/layout/animation.rs
+++ b/servo/components/layout/animation.rs
@@ -156,17 +156,19 @@ pub fn recalc_style_for_animations(conte
         if let Some(ref animations) = animations.get(&fragment.node) {
             for animation in animations.iter() {
                 let old_style = fragment.style.clone();
                 update_style_for_animation(&context.style_context,
                                            animation,
                                            &mut fragment.style,
                                            &ServoMetricsProvider);
                 let difference =
-                    RestyleDamage::compute_style_difference(&old_style, &fragment.style);
+                    RestyleDamage::compute_style_difference(&old_style,
+                                                            &old_style,
+                                                            &fragment.style);
                 damage |= difference.damage;
             }
         }
     });
 
     let base = flow::mut_base(flow);
     base.restyle_damage.insert(damage);
     for kid in base.children.iter_mut() {
--- a/servo/components/style/gecko/generated/bindings.rs
+++ b/servo/components/style/gecko/generated/bindings.rs
@@ -1042,18 +1042,19 @@ extern "C" {
                                  aPseudoTagOrNull: *mut nsIAtom)
      -> *mut nsStyleContext;
 }
 extern "C" {
     pub fn Gecko_GetImplementedPseudo(element: RawGeckoElementBorrowed)
      -> CSSPseudoElementType;
 }
 extern "C" {
-    pub fn Gecko_CalcStyleDifference(oldstyle: *mut nsStyleContext,
-                                     newstyle: ServoComputedValuesBorrowed,
+    pub fn Gecko_CalcStyleDifference(old_style: *const ServoStyleContext,
+                                     new_style: *const ServoStyleContext,
+                                     old_style_bits: u64,
                                      any_style_changed: *mut bool)
      -> nsChangeHint;
 }
 extern "C" {
     pub fn Gecko_HintsHandledForDescendants(aHint: nsChangeHint)
      -> nsChangeHint;
 }
 extern "C" {
--- a/servo/components/style/gecko/restyle_damage.rs
+++ b/servo/components/style/gecko/restyle_damage.rs
@@ -43,24 +43,24 @@ impl GeckoRestyleDamage {
     /// (in the form of `ComputedValues`).
     ///
     /// Note that we could in theory just get two `ComputedValues` here and diff
     /// them, but Gecko has an interesting optimization when they mark accessed
     /// structs, so they effectively only diff structs that have ever been
     /// accessed from layout.
     pub fn compute_style_difference(
         source: &nsStyleContext,
-        new_style: &Arc<ComputedValues>
+        old_style: &ComputedValues,
+        new_style: &Arc<ComputedValues>,
     ) -> StyleDifference {
-        // 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,
+            bindings::Gecko_CalcStyleDifference(old_style.as_style_context(),
+                                                new_style.as_style_context(),
+                                                source.mBits,
                                                 &mut any_style_changed)
         };
         let change = if any_style_changed { StyleChange::Changed } else { StyleChange::Unchanged };
         StyleDifference::new(GeckoRestyleDamage(hint), change)
     }
 
     /// Returns true if this restyle damage contains all the damage of |other|.
     pub fn contains(self, other: Self) -> bool {
--- a/servo/components/style/matching.rs
+++ b/servo/components/style/matching.rs
@@ -763,17 +763,17 @@ pub trait MatchMethods : TElement {
     fn compute_style_difference(
         &self,
         old_values: &ComputedValues,
         new_values: &Arc<ComputedValues>,
         pseudo: Option<&PseudoElement>
     ) -> StyleDifference {
         debug_assert!(pseudo.map_or(true, |p| p.is_eager()));
         if let Some(source) = self.existing_style_for_restyle_damage(old_values, pseudo) {
-            return RestyleDamage::compute_style_difference(source, new_values)
+            return RestyleDamage::compute_style_difference(source, old_values, new_values)
         }
 
         let new_display = new_values.get_box().clone_display();
         let old_display = old_values.get_box().clone_display();
 
         let new_style_is_display_none = new_display == display::T::none;
         let old_style_is_display_none = old_display == display::T::none;
 
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -132,16 +132,20 @@ impl ComputedValues {
         let atom = (self.0)._base.mPseudoTag.raw::<structs::nsIAtom>();
         if atom.is_null() {
             return None;
         }
 
         let atom = Atom::from(atom);
         PseudoElement::from_atom(&atom)
     }
+
+    pub fn as_style_context(&self) -> &::gecko_bindings::structs::mozilla::ServoStyleContext {
+        &self.0
+    }
 }
 
 impl Drop for ComputedValues {
     fn drop(&mut self) {
         unsafe {
             bindings::Gecko_ServoStyleContext_Destroy(&mut self.0);
         }
     }
--- a/servo/components/style/servo/restyle_damage.rs
+++ b/servo/components/style/servo/restyle_damage.rs
@@ -55,17 +55,18 @@ bitflags! {
 
 impl HeapSizeOf for ServoRestyleDamage {
     fn heap_size_of_children(&self) -> usize { 0 }
 }
 
 impl ServoRestyleDamage {
     /// Compute the `StyleDifference` (including the appropriate restyle damage)
     /// for a given style change between `old` and `new`.
-    pub fn compute_style_difference(old: &ComputedValues,
+    pub fn compute_style_difference(_source: &ComputedValues,
+                                    old: &ComputedValues,
                                     new: &ComputedValues)
                                     -> StyleDifference {
         let damage = compute_damage(old, new);
         let change = if damage.is_empty() { StyleChange::Unchanged } else { StyleChange::Changed };
         StyleDifference::new(damage, change)
     }
 
     /// Returns a bitmask that represents a flow that needs to be rebuilt and