mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Make cascade_internal() reusable with rule nodes.
A new function, cascade_with_rules, takes StrongRuleNode and computes cascading result values with the StrongRuleNode. This new function will be used for getting after-change-style for CSS Transitions.
This commit is contained in:
parent
aa6433b6d6
commit
dde46c5c90
1 changed files with 26 additions and 16 deletions
|
@ -469,24 +469,15 @@ trait PrivateMatchMethods: TElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cascade_internal(&self,
|
fn cascade_with_rules(&self,
|
||||||
context: &StyleContext<Self>,
|
context: &StyleContext<Self>,
|
||||||
primary_style: &ComputedStyle,
|
rule_node: &StrongRuleNode,
|
||||||
pseudo_style: &Option<(&PseudoElement, &mut ComputedStyle)>,
|
primary_style: &ComputedStyle,
|
||||||
booleans: &CascadeBooleans)
|
pseudo_style: &Option<(&PseudoElement, &mut ComputedStyle)>,
|
||||||
-> Arc<ComputedValues> {
|
cascade_flags: CascadeFlags)
|
||||||
|
-> Arc<ComputedValues> {
|
||||||
let shared_context = context.shared;
|
let shared_context = context.shared;
|
||||||
let mut cascade_info = CascadeInfo::new();
|
let mut cascade_info = CascadeInfo::new();
|
||||||
let mut cascade_flags = CascadeFlags::empty();
|
|
||||||
if booleans.shareable {
|
|
||||||
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;
|
|
||||||
|
|
||||||
// Grab the inherited values.
|
// Grab the inherited values.
|
||||||
let parent_el;
|
let parent_el;
|
||||||
|
@ -552,6 +543,25 @@ trait PrivateMatchMethods: TElement {
|
||||||
values
|
values
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn cascade_internal(&self,
|
||||||
|
context: &StyleContext<Self>,
|
||||||
|
primary_style: &ComputedStyle,
|
||||||
|
pseudo_style: &Option<(&PseudoElement, &mut ComputedStyle)>,
|
||||||
|
booleans: &CascadeBooleans)
|
||||||
|
-> Arc<ComputedValues> {
|
||||||
|
let mut cascade_flags = CascadeFlags::empty();
|
||||||
|
if booleans.shareable {
|
||||||
|
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, rule_node, primary_style, pseudo_style, cascade_flags)
|
||||||
|
}
|
||||||
|
|
||||||
/// Computes values and damage for the primary or pseudo style of an element,
|
/// Computes values and damage for the primary or pseudo style of an element,
|
||||||
/// setting them on the ElementData.
|
/// setting them on the ElementData.
|
||||||
fn cascade_primary_or_pseudo<'a>(&self,
|
fn cascade_primary_or_pseudo<'a>(&self,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue