--- a/servo/components/style/matching.rs
+++ b/servo/components/style/matching.rs
@@ -468,25 +468,25 @@ trait PrivateMatchMethods: TElement {
}
}
}
fn cascade_with_rules(&self,
shared_context: &SharedStyleContext,
rule_node: &StrongRuleNode,
primary_style: &ComputedStyle,
- pseudo_style: &Option<(&PseudoElement, &mut ComputedStyle)>,
- cascade_flags: CascadeFlags)
+ cascade_flags: CascadeFlags,
+ is_pseudo: bool)
-> Arc<ComputedValues> {
let mut cascade_info = CascadeInfo::new();
// Grab the inherited values.
let parent_el;
let parent_data;
- let inherited_values_ = if pseudo_style.is_none() {
+ let inherited_values_ = if !is_pseudo {
parent_el = self.parent_element();
parent_data = parent_el.as_ref().and_then(|e| e.borrow_data());
let parent_values = parent_data.as_ref().map(|d| {
// Sometimes Gecko eagerly styles things without processing
// pending restyles first. In general we'd like to avoid this,
// but there can be good reasons (for example, needing to
// construct a frame for some small piece of newly-added
// content in order to do something specific with that frame,
@@ -513,17 +513,17 @@ trait PrivateMatchMethods: TElement {
let inherited_values = inherited_values_.map(|x| &**x);
let layout_parent_style = layout_parent_style.map(|x| &**x);
// Propagate the "can be fragmented" bit. It would be nice to
// encapsulate this better.
//
// Note that this is not needed for pseudos since we already do that
// when we resolve the non-pseudo style.
- if pseudo_style.is_none() {
+ if !is_pseudo {
if let Some(ref p) = layout_parent_style {
let can_be_fragmented =
p.is_multicol() ||
layout_parent_el.as_ref().unwrap().as_node().can_be_fragmented();
unsafe { self.as_node().set_can_be_fragmented(can_be_fragmented); }
}
}
@@ -553,17 +553,17 @@ trait PrivateMatchMethods: TElement {
cascade_flags.insert(SHAREABLE)
}
if self.skip_root_and_item_based_display_fixup() {
cascade_flags.insert(SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP)
}
// Grab the rule node.
let rule_node = &pseudo_style.as_ref().map_or(primary_style, |p| &*p.1).rules;
- self.cascade_with_rules(context.shared, rule_node, primary_style, pseudo_style, cascade_flags)
+ self.cascade_with_rules(context.shared, rule_node, primary_style, cascade_flags, pseudo_style.is_some())
}
/// Computes values and damage for the primary or pseudo style of an element,
/// setting them on the ElementData.
fn cascade_primary_or_pseudo<'a>(&self,
context: &mut StyleContext<Self>,
data: &mut ElementData,
pseudo: Option<&PseudoElement>,
@@ -602,17 +602,17 @@ trait PrivateMatchMethods: TElement {
primary_style.values = Some(new_values);
}
}
#[cfg(feature = "gecko")]
fn get_after_change_style(&self,
context: &mut StyleContext<Self>,
primary_style: &ComputedStyle,
- pseudo_style: &Option<(&PseudoElement, &mut ComputedStyle)>)
+ pseudo_style: &Option<(&PseudoElement, &ComputedStyle)>)
-> Arc<ComputedValues> {
let style = &pseudo_style.as_ref().map_or(primary_style, |p| &*p.1);
let rule_node = &style.rules;
let without_transition_rules =
context.shared.stylist.rule_tree.remove_transition_rule_if_applicable(rule_node);
if without_transition_rules == *rule_node {
// Note that unwrapping here is fine, because the style is
// only incomplete during the styling process.
@@ -621,18 +621,18 @@ trait PrivateMatchMethods: TElement {
let mut cascade_flags = CascadeFlags::empty();
if self.skip_root_and_item_based_display_fixup() {
cascade_flags.insert(SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP)
}
self.cascade_with_rules(context.shared,
&without_transition_rules,
primary_style,
- &pseudo_style,
- cascade_flags)
+ cascade_flags,
+ pseudo_style.is_some())
}
#[cfg(feature = "gecko")]
fn process_animations(&self,
context: &mut StyleContext<Self>,
old_values: &mut Option<Arc<ComputedValues>>,
new_values: &mut Arc<ComputedValues>,
pseudo: Option<&PseudoElement>,