mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
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>
This commit is contained in:
parent
3d40b516c8
commit
71dbc6c023
3 changed files with 17 additions and 4 deletions
|
@ -49,6 +49,15 @@ impl PseudoElement {
|
||||||
PseudoElementCascadeType::Lazy
|
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.
|
/// Gets the canonical index of this eagerly-cascaded pseudo-element.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn eager_index(&self) -> usize {
|
pub fn eager_index(&self) -> usize {
|
||||||
|
|
|
@ -630,7 +630,7 @@ impl Stylist {
|
||||||
guards: &StylesheetGuards,
|
guards: &StylesheetGuards,
|
||||||
element: &E,
|
element: &E,
|
||||||
pseudo: &PseudoElement,
|
pseudo: &PseudoElement,
|
||||||
parent: &Arc<ComputedValues>,
|
parent_style: &ComputedValues,
|
||||||
font_metrics: &FontMetricsProvider)
|
font_metrics: &FontMetricsProvider)
|
||||||
-> Option<ComputedStyle>
|
-> Option<ComputedStyle>
|
||||||
where E: TElement,
|
where E: TElement,
|
||||||
|
@ -649,8 +649,8 @@ impl Stylist {
|
||||||
properties::cascade(&self.device,
|
properties::cascade(&self.device,
|
||||||
&rule_node,
|
&rule_node,
|
||||||
guards,
|
guards,
|
||||||
Some(&**parent),
|
Some(parent_style),
|
||||||
Some(&**parent),
|
Some(parent_style),
|
||||||
None,
|
None,
|
||||||
&RustLogReporter,
|
&RustLogReporter,
|
||||||
font_metrics,
|
font_metrics,
|
||||||
|
|
|
@ -1205,7 +1205,11 @@ fn get_pseudo_style(guard: &SharedRwLockReadGuard,
|
||||||
PseudoElementCascadeType::Precomputed => unreachable!("No anonymous boxes"),
|
PseudoElementCascadeType::Precomputed => unreachable!("No anonymous boxes"),
|
||||||
PseudoElementCascadeType::Lazy => {
|
PseudoElementCascadeType::Lazy => {
|
||||||
let d = doc_data.borrow_mut();
|
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 guards = StylesheetGuards::same(guard);
|
||||||
let metrics = get_metrics_provider_for_product();
|
let metrics = get_metrics_provider_for_product();
|
||||||
d.stylist.lazily_compute_pseudo_element_style(&guards,
|
d.stylist.lazily_compute_pseudo_element_style(&guards,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue