aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-05-23 02:25:07 -0500
committerGitHub <noreply@github.com>2017-05-23 02:25:07 -0500
commit17069f4876670d5a4f310e449f8bc78bbb45c827 (patch)
treeabb540fb19f93e85ff9d1032fded206479e2174a
parente8f9ab51cacf75d5d92c2b87a9c23eea5bd0aed3 (diff)
parent71dbc6c023320d29ae591e6010ece33b6e9c8d82 (diff)
downloadservo-17069f4876670d5a4f310e449f8bc78bbb45c827.tar.gz
servo-17069f4876670d5a4f310e449f8bc78bbb45c827.zip
Auto merge of #16981 - emilio:backdrop, r=heycam
Bug 1366427: Make backdrop not inherit from the parent element. r=heycam <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16981) <!-- Reviewable:end -->
-rw-r--r--components/style/gecko/pseudo_element.rs9
-rw-r--r--components/style/stylist.rs6
-rw-r--r--ports/geckolib/glue.rs6
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 24f9ec31b17..3189defd7b1 100644
--- a/components/style/stylist.rs
+++ b/components/style/stylist.rs
@@ -628,7 +628,7 @@ impl Stylist {
guards: &StylesheetGuards,
element: &E,
pseudo: &PseudoElement,
- parent: &Arc<ComputedValues>,
+ parent_style: &ComputedValues,
font_metrics: &FontMetricsProvider)
-> Option<ComputedStyle>
where E: TElement,
@@ -647,8 +647,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 4a1da29a071..572a523a59d 100644
--- a/ports/geckolib/glue.rs
+++ b/ports/geckolib/glue.rs
@@ -1203,7 +1203,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,