diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-05-20 11:56:48 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-05-21 15:19:01 +0200 |
commit | 71dbc6c023320d29ae591e6010ece33b6e9c8d82 (patch) | |
tree | 384193722bfa9c0cf99b5b3442d05676213c2881 | |
parent | 3d40b516c8ac6e946cadace2378581cbac7b1e1b (diff) | |
download | servo-71dbc6c023320d29ae591e6010ece33b6e9c8d82.tar.gz servo-71dbc6c023320d29ae591e6010ece33b6e9c8d82.zip |
Bug 1366427: Make backdrop not inherit from the parent element. r=heycam
MozReview-Commit-ID: EnnmvDsgbdx
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
-rw-r--r-- | components/style/gecko/pseudo_element.rs | 9 | ||||
-rw-r--r-- | components/style/stylist.rs | 6 | ||||
-rw-r--r-- | ports/geckolib/glue.rs | 6 |
3 files changed, 17 insertions, 4 deletions
diff --git a/components/style/gecko/pseudo_element.rs b/components/style/gecko/pseudo_element.rs index b15e17e6f38..93da2b589d0 100644 --- a/components/style/gecko/pseudo_element.rs +++ b/components/style/gecko/pseudo_element.rs @@ -49,6 +49,15 @@ impl PseudoElement { PseudoElementCascadeType::Lazy } + /// Whether the pseudo-element should inherit from the default computed + /// values instead of from the parent element. + /// + /// This is not the common thing, but there are some pseudos (namely: + /// ::backdrop), that shouldn't inherit from the parent element. + pub fn inherits_from_default_values(&self) -> bool { + !matches!(*self, PseudoElement::Backdrop) + } + /// Gets the canonical index of this eagerly-cascaded pseudo-element. #[inline] pub fn eager_index(&self) -> usize { diff --git a/components/style/stylist.rs b/components/style/stylist.rs index a2f358b3f22..f1c541b8ef1 100644 --- a/components/style/stylist.rs +++ b/components/style/stylist.rs @@ -630,7 +630,7 @@ impl Stylist { guards: &StylesheetGuards, element: &E, pseudo: &PseudoElement, - parent: &Arc<ComputedValues>, + parent_style: &ComputedValues, font_metrics: &FontMetricsProvider) -> Option<ComputedStyle> where E: TElement, @@ -649,8 +649,8 @@ impl Stylist { properties::cascade(&self.device, &rule_node, guards, - Some(&**parent), - Some(&**parent), + Some(parent_style), + Some(parent_style), None, &RustLogReporter, font_metrics, diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 55c031351c8..362c5804427 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -1205,7 +1205,11 @@ fn get_pseudo_style(guard: &SharedRwLockReadGuard, PseudoElementCascadeType::Precomputed => unreachable!("No anonymous boxes"), PseudoElementCascadeType::Lazy => { let d = doc_data.borrow_mut(); - let base = styles.primary.values(); + let base = if pseudo.inherits_from_default_values() { + d.default_computed_values() + } else { + styles.primary.values() + }; let guards = StylesheetGuards::same(guard); let metrics = get_metrics_provider_for_product(); d.stylist.lazily_compute_pseudo_element_style(&guards, |