style: Refactor the per_pseudo map from StyleData to avoid having an option value type.

This make the layout code way clearer.
This commit is contained in:
Emilio Cobos Álvarez 2016-02-12 02:11:44 +01:00
parent a604d605ed
commit 61e04df266
7 changed files with 52 additions and 52 deletions

View file

@ -49,7 +49,7 @@ bitflags! {
}
impl TRestyleDamage for RestyleDamage {
fn compute(old: &Option<Arc<ComputedValues>>, new: &ComputedValues) -> RestyleDamage { compute_damage(old, new) }
fn compute(old: Option<&Arc<ComputedValues>>, new: &ComputedValues) -> RestyleDamage { compute_damage(old, new) }
/// Returns a bitmask that represents a flow that needs to be rebuilt and reflowed.
///
@ -143,12 +143,11 @@ macro_rules! add_if_not_equal(
})
);
pub fn compute_damage(old: &Option<Arc<ComputedValues>>, new: &ComputedValues) -> RestyleDamage {
let old: &ComputedValues =
match old.as_ref() {
None => return RestyleDamage::rebuild_and_reflow(),
Some(cv) => &**cv,
};
pub fn compute_damage(old: Option<&Arc<ComputedValues>>, new: &ComputedValues) -> RestyleDamage {
let old: &ComputedValues = match old {
None => return RestyleDamage::rebuild_and_reflow(),
Some(cv) => &**cv,
};
let mut damage = RestyleDamage::empty();