style: trivially cleanup the matching code.

I'm reworking this, and found this cleanup that I think is worth to land.
This commit is contained in:
Emilio Cobos Álvarez 2017-04-23 01:45:01 +02:00
parent 55e2caba4c
commit 7bdd614540
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 71 additions and 57 deletions

View file

@ -454,10 +454,17 @@ pub extern "C" fn Servo_StyleSet_GetBaseComputedValuesForElement(raw_data: RawSe
Some(PseudoElement::from_atom_unchecked(atom, /* anon_box = */ false))
};
let pseudos = &styles.pseudos;
let pseudo_style = pseudo.as_ref().map(|p| (p, pseudos.get(p).unwrap()));
let pseudo_style = match pseudo {
Some(ref p) => {
let style = pseudos.get(p);
debug_assert!(style.is_some());
style
}
None => None,
};
let provider = get_metrics_provider_for_product();
element.get_base_style(shared_context, &provider, &styles.primary, &pseudo_style)
element.get_base_style(shared_context, &provider, &styles.primary, pseudo_style)
.into_strong()
}