mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Don't inherit all properties for pre-computed pseudos if there are no matching rules.
This commit is contained in:
parent
6a9e2fd7fb
commit
3e0e2bcd2c
3 changed files with 27 additions and 27 deletions
|
@ -394,7 +394,7 @@ pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
|
|||
&context.default_computed_values,
|
||||
false);
|
||||
data.styles_mut().pseudos
|
||||
.insert(style_pseudo.clone(), new_style.unwrap());
|
||||
.insert(style_pseudo.clone(), new_style);
|
||||
}
|
||||
}
|
||||
PseudoElementCascadeType::Lazy => {
|
||||
|
|
|
@ -276,14 +276,18 @@ impl Stylist {
|
|||
parent: Option<&Arc<ComputedValues>>,
|
||||
default: &Arc<ComputedValues>,
|
||||
inherit_all: bool)
|
||||
-> Option<ComputedStyle> {
|
||||
-> ComputedStyle {
|
||||
debug_assert!(SelectorImpl::pseudo_element_cascade_type(pseudo).is_precomputed());
|
||||
if let Some(declarations) = self.precomputed_pseudo_element_decls.get(pseudo) {
|
||||
|
||||
let rule_node = match self.precomputed_pseudo_element_decls.get(pseudo) {
|
||||
Some(declarations) => {
|
||||
// FIXME(emilio): When we've taken rid of the cascade we can just
|
||||
// use into_iter.
|
||||
let rule_node =
|
||||
self.rule_tree.insert_ordered_rules(
|
||||
declarations.into_iter().map(|a| (a.source.clone(), a.importance)));
|
||||
declarations.into_iter().map(|a| (a.source.clone(), a.importance)))
|
||||
}
|
||||
None => self.rule_tree.root(),
|
||||
};
|
||||
|
||||
let mut flags = CascadeFlags::empty();
|
||||
if inherit_all {
|
||||
|
@ -298,10 +302,7 @@ impl Stylist {
|
|||
None,
|
||||
Box::new(StdoutErrorReporter),
|
||||
flags);
|
||||
Some(ComputedStyle::new(rule_node, Arc::new(computed)))
|
||||
} else {
|
||||
parent.map(|p| ComputedStyle::new(self.rule_tree.root(), p.clone()))
|
||||
}
|
||||
ComputedStyle::new(rule_node, Arc::new(computed))
|
||||
}
|
||||
|
||||
/// Returns the style for an anonymous box of the given type.
|
||||
|
@ -329,7 +330,6 @@ impl Stylist {
|
|||
}
|
||||
};
|
||||
self.precomputed_values_for_pseudo(&pseudo, Some(parent_style), default_style, inherit_all)
|
||||
.expect("style_for_anonymous_box(): No precomputed values for that pseudo!")
|
||||
.values
|
||||
}
|
||||
|
||||
|
|
|
@ -521,10 +521,10 @@ pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null:
|
|||
|
||||
|
||||
let maybe_parent = ComputedValues::arc_from_borrowed(&parent_style_or_null);
|
||||
let new_computed = data.stylist.precomputed_values_for_pseudo(&pseudo, maybe_parent,
|
||||
data.stylist.precomputed_values_for_pseudo(&pseudo, maybe_parent,
|
||||
&data.default_computed_values, false)
|
||||
.map(|styles| styles.values);
|
||||
new_computed.map_or(Strong::null(), |c| c.into_strong())
|
||||
.values
|
||||
.into_strong()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue