diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-07-07 16:11:50 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-07 16:11:50 -0700 |
commit | 1425ad1bab04c60f955270ded0044fd8d244cd9a (patch) | |
tree | b5302c992b4426720b0c3ade3c84c341bfcec303 | |
parent | 6e2e7151d84804d4d630cecb1bf0a5ea2fe70e2b (diff) | |
parent | 98075fcbfb367146c5264a96091a5eba7d7ee363 (diff) | |
download | servo-1425ad1bab04c60f955270ded0044fd8d244cd9a.tar.gz servo-1425ad1bab04c60f955270ded0044fd8d244cd9a.zip |
Auto merge of #17636 - upsuper:bug1378814, r=emilio
Don't return None in get_pseudo_style if not probing
This is the Servo side change of [bug 1378814](https://bugzilla.mozilla.org/show_bug.cgi?id=1378814).
-rw-r--r-- | ports/geckolib/glue.rs | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 56b99babed7..56b7b1a0a4c 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -1589,25 +1589,24 @@ fn get_pseudo_style( PseudoElementCascadeType::Eager => { match *pseudo { PseudoElement::FirstLetter => { - // inherited_styles can be None when doing lazy resolution - // (e.g. for computed style) or when probing. In that case - // we just inherit from our element, which is what Gecko - // does in that situation. What should actually happen in - // the computed style case is a bit unclear. - let inherited_styles = - inherited_styles.unwrap_or(styles.primary()); - let guards = StylesheetGuards::same(guard); - let metrics = get_metrics_provider_for_product(); - let inputs = match styles.pseudos.get(&pseudo) { - Some(styles) => CascadeInputs::new_from_style(styles), - None => return None, - }; - doc_data.stylist - .compute_pseudo_element_style_with_inputs( - &inputs, - &guards, - inherited_styles, - &metrics) + styles.pseudos.get(&pseudo).and_then(|pseudo_styles| { + // inherited_styles can be None when doing lazy resolution + // (e.g. for computed style) or when probing. In that case + // we just inherit from our element, which is what Gecko + // does in that situation. What should actually happen in + // the computed style case is a bit unclear. + let inherited_styles = + inherited_styles.unwrap_or(styles.primary()); + let guards = StylesheetGuards::same(guard); + let metrics = get_metrics_provider_for_product(); + let inputs = CascadeInputs::new_from_style(pseudo_styles); + doc_data.stylist + .compute_pseudo_element_style_with_inputs( + &inputs, + &guards, + inherited_styles, + &metrics) + }) }, _ => { debug_assert!(inherited_styles.is_none() || |