aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-07-20 20:28:25 -0700
committerGitHub <noreply@github.com>2017-07-20 20:28:25 -0700
commita3c398b5dacae251f483775042b12ffb5e0ff01c (patch)
treebb27eb0d3b6d2cceccd6308921700551167eedc9
parentfafb8476e87af305d375a27fd0d8cf7e10c9d2d5 (diff)
parentef4fbfaa6b1ca0a2454cdfab5004e252fd55ece4 (diff)
downloadservo-a3c398b5dacae251f483775042b12ffb5e0ff01c.tar.gz
servo-a3c398b5dacae251f483775042b12ffb5e0ff01c.zip
Auto merge of #17802 - emilio:reland-stuff, r=heycam
Revert "Backed out changeset b10e6ba9cbdb because gecko part had to b… …e backed out." This reverts commit b96d96d448c8ff93f212f225013461999540a5d0. The fix on the Gecko side is trivial, and I can land it after this lands. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17802) <!-- Reviewable:end -->
-rw-r--r--components/layout/animation.rs4
-rw-r--r--components/style/gecko/generated/bindings.rs5
-rw-r--r--components/style/gecko/restyle_damage.rs10
-rw-r--r--components/style/matching.rs2
-rw-r--r--components/style/properties/gecko.mako.rs4
-rw-r--r--components/style/servo/restyle_damage.rs3
6 files changed, 18 insertions, 10 deletions
diff --git a/components/layout/animation.rs b/components/layout/animation.rs
index 5d7a1a87acc..e4a2782c127 100644
--- a/components/layout/animation.rs
+++ b/components/layout/animation.rs
@@ -161,7 +161,9 @@ pub fn recalc_style_for_animations(context: &LayoutContext,
&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;
}
}
diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs
index a5bc5d9b0ff..1f237d61566 100644
--- a/components/style/gecko/generated/bindings.rs
+++ b/components/style/gecko/generated/bindings.rs
@@ -1047,8 +1047,9 @@ extern "C" {
-> 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;
}
diff --git a/components/style/gecko/restyle_damage.rs b/components/style/gecko/restyle_damage.rs
index 2af898a28aa..62865e06b79 100644
--- a/components/style/gecko/restyle_damage.rs
+++ b/components/style/gecko/restyle_damage.rs
@@ -48,14 +48,14 @@ impl GeckoRestyleDamage {
/// 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 };
diff --git a/components/style/matching.rs b/components/style/matching.rs
index cc7d9415a1a..01c1fb53d1b 100644
--- a/components/style/matching.rs
+++ b/components/style/matching.rs
@@ -768,7 +768,7 @@ pub trait MatchMethods : TElement {
) -> 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();
diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs
index 6af189896d3..a6859238d83 100644
--- a/components/style/properties/gecko.mako.rs
+++ b/components/style/properties/gecko.mako.rs
@@ -137,6 +137,10 @@ impl ComputedValues {
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 {
diff --git a/components/style/servo/restyle_damage.rs b/components/style/servo/restyle_damage.rs
index f99e6120bb9..f85e8b6b13c 100644
--- a/components/style/servo/restyle_damage.rs
+++ b/components/style/servo/restyle_damage.rs
@@ -60,7 +60,8 @@ impl HeapSizeOf for ServoRestyleDamage {
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);