mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Make cascade_with_rules() take a boolean representing whether the cascade is for pseudo element or not.
cascade_with_rules() doesn't mutate any already-computed styles.
This commit is contained in:
parent
c22d4e518c
commit
2c0b821564
1 changed files with 8 additions and 8 deletions
|
@ -471,15 +471,15 @@ trait PrivateMatchMethods: TElement {
|
|||
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| {
|
||||
|
@ -516,7 +516,7 @@ trait PrivateMatchMethods: TElement {
|
|||
//
|
||||
// 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() ||
|
||||
|
@ -556,7 +556,7 @@ trait PrivateMatchMethods: TElement {
|
|||
|
||||
// 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,
|
||||
|
@ -605,7 +605,7 @@ trait PrivateMatchMethods: TElement {
|
|||
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;
|
||||
|
@ -624,8 +624,8 @@ trait PrivateMatchMethods: TElement {
|
|||
self.cascade_with_rules(context.shared,
|
||||
&without_transition_rules,
|
||||
primary_style,
|
||||
&pseudo_style,
|
||||
cascade_flags)
|
||||
cascade_flags,
|
||||
pseudo_style.is_some())
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue