style: Use RestyleDamage to determine whether we must continue cascading style changes to children.

This commit is contained in:
Cameron McCormack 2017-05-19 17:39:15 +08:00 committed by Emilio Cobos Álvarez
parent 715d18d377
commit 8b7a414b1c
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
5 changed files with 221 additions and 109 deletions

View file

@ -9,6 +9,7 @@
use computed_values::display;
use heapsize::HeapSizeOf;
use matching::{StyleChange, StyleDifference};
use properties::ServoComputedValues;
use std::fmt;
@ -57,12 +58,14 @@ impl HeapSizeOf for ServoRestyleDamage {
}
impl ServoRestyleDamage {
/// Compute the appropriate restyle damage for a given style change between
/// `old` and `new`.
pub fn compute(old: &ServoComputedValues,
new: &ServoComputedValues)
-> ServoRestyleDamage {
compute_damage(old, new)
/// Compute the `StyleDifference` (including the appropriate restyle damage)
/// for a given style change between `old` and `new`.
pub fn compute_style_difference(old: &ServoComputedValues,
new: &ServoComputedValues)
-> 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