aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/incremental.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <ecoal95@gmail.com>2016-02-12 02:11:44 +0100
committerEmilio Cobos Álvarez <ecoal95@gmail.com>2016-02-13 16:05:17 +0100
commit61e04df2664725624f706327cd417fe24aff6e2d (patch)
treec1d70c0463a2acc1d9a62e485e3c670ca53e2f79 /components/layout/incremental.rs
parenta604d605edf1813cc129409babb819d26db90824 (diff)
downloadservo-61e04df2664725624f706327cd417fe24aff6e2d.tar.gz
servo-61e04df2664725624f706327cd417fe24aff6e2d.zip
style: Refactor the per_pseudo map from StyleData to avoid having an option value type.
This make the layout code way clearer.
Diffstat (limited to 'components/layout/incremental.rs')
-rw-r--r--components/layout/incremental.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/components/layout/incremental.rs b/components/layout/incremental.rs
index 6865d037651..9bf4aff2e14 100644
--- a/components/layout/incremental.rs
+++ b/components/layout/incremental.rs
@@ -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();