mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
style: Pass old ComputedValues and old cached struct bits to Gecko_CalcStyleDifference.
This commit is contained in:
parent
25dc352d7c
commit
914ba609c0
4 changed files with 10 additions and 7 deletions
|
@ -161,7 +161,9 @@ pub fn recalc_style_for_animations(context: &LayoutContext,
|
||||||
&mut fragment.style,
|
&mut fragment.style,
|
||||||
&ServoMetricsProvider);
|
&ServoMetricsProvider);
|
||||||
let difference =
|
let difference =
|
||||||
RestyleDamage::compute_style_difference(&old_style, &fragment.style);
|
RestyleDamage::compute_style_difference(&old_style,
|
||||||
|
&old_style,
|
||||||
|
&fragment.style);
|
||||||
damage |= difference.damage;
|
damage |= difference.damage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,14 +48,14 @@ impl GeckoRestyleDamage {
|
||||||
/// accessed from layout.
|
/// accessed from layout.
|
||||||
pub fn compute_style_difference(
|
pub fn compute_style_difference(
|
||||||
source: &nsStyleContext,
|
source: &nsStyleContext,
|
||||||
new_style: &Arc<ComputedValues>
|
old_style: &ComputedValues,
|
||||||
|
new_style: &Arc<ComputedValues>,
|
||||||
) -> StyleDifference {
|
) -> StyleDifference {
|
||||||
// TODO(emilio): Const-ify this?
|
|
||||||
let context = source as *const nsStyleContext as *mut nsStyleContext;
|
|
||||||
let mut any_style_changed: bool = false;
|
let mut any_style_changed: bool = false;
|
||||||
let hint = unsafe {
|
let hint = unsafe {
|
||||||
bindings::Gecko_CalcStyleDifference(context,
|
bindings::Gecko_CalcStyleDifference(old_style.as_style_context(),
|
||||||
new_style.as_style_context(),
|
new_style.as_style_context(),
|
||||||
|
source.mBits,
|
||||||
&mut any_style_changed)
|
&mut any_style_changed)
|
||||||
};
|
};
|
||||||
let change = if any_style_changed { StyleChange::Changed } else { StyleChange::Unchanged };
|
let change = if any_style_changed { StyleChange::Changed } else { StyleChange::Unchanged };
|
||||||
|
|
|
@ -768,7 +768,7 @@ pub trait MatchMethods : TElement {
|
||||||
) -> StyleDifference {
|
) -> StyleDifference {
|
||||||
debug_assert!(pseudo.map_or(true, |p| p.is_eager()));
|
debug_assert!(pseudo.map_or(true, |p| p.is_eager()));
|
||||||
if let Some(source) = self.existing_style_for_restyle_damage(old_values, pseudo) {
|
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 new_display = new_values.get_box().clone_display();
|
||||||
|
|
|
@ -60,7 +60,8 @@ impl HeapSizeOf for ServoRestyleDamage {
|
||||||
impl ServoRestyleDamage {
|
impl ServoRestyleDamage {
|
||||||
/// Compute the `StyleDifference` (including the appropriate restyle damage)
|
/// Compute the `StyleDifference` (including the appropriate restyle damage)
|
||||||
/// for a given style change between `old` and `new`.
|
/// 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)
|
new: &ComputedValues)
|
||||||
-> StyleDifference {
|
-> StyleDifference {
|
||||||
let damage = compute_damage(old, new);
|
let damage = compute_damage(old, new);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue