Port text-combine-upright writing mode fixup to Servo

Ports the Gecko fixup for text-combine-upright writing mode to Servo.  In
addition, this passes the current pseudo element (if any) down to the cascade
for use during the fixup process.

MozReview-Commit-ID: BkHd4AvSsOt
This commit is contained in:
J. Ryan Stinnett 2017-04-24 16:04:15 -05:00
parent 78a2e3be51
commit 978239927d
7 changed files with 57 additions and 12 deletions

View file

@ -408,7 +408,8 @@ trait PrivateMatchMethods: TElement {
font_metrics_provider: &FontMetricsProvider,
rule_node: &StrongRuleNode,
primary_style: &ComputedStyle,
inherit_mode: InheritMode)
inherit_mode: InheritMode,
pseudo: Option<&PseudoElement>)
-> Arc<ComputedValues> {
let mut cascade_info = CascadeInfo::new();
let mut cascade_flags = CascadeFlags::empty();
@ -473,6 +474,7 @@ trait PrivateMatchMethods: TElement {
let values =
Arc::new(cascade(&shared_context.stylist.device,
rule_node,
pseudo,
&shared_context.guards,
style_to_inherit_from,
layout_parent_style,
@ -488,6 +490,7 @@ trait PrivateMatchMethods: TElement {
fn cascade_internal(&self,
context: &StyleContext<Self>,
primary_style: &ComputedStyle,
pseudo: Option<&PseudoElement>,
eager_pseudo_style: Option<&ComputedStyle>)
-> Arc<ComputedValues> {
// Grab the rule node.
@ -502,7 +505,8 @@ trait PrivateMatchMethods: TElement {
&context.thread_local.font_metrics_provider,
rule_node,
primary_style,
inherit_mode)
inherit_mode,
pseudo)
}
/// Computes values and damage for the primary or pseudo style of an element,
@ -554,6 +558,7 @@ trait PrivateMatchMethods: TElement {
} else {
self.cascade_internal(context,
primary_style,
None,
None)
}
}
@ -562,6 +567,7 @@ trait PrivateMatchMethods: TElement {
// work.
self.cascade_internal(context,
primary_style,
pseudo,
pseudo_style.as_ref().map(|s| &**s))
}
};
@ -603,7 +609,8 @@ trait PrivateMatchMethods: TElement {
#[cfg(feature = "gecko")]
fn get_after_change_style(&self,
context: &mut StyleContext<Self>,
primary_style: &ComputedStyle)
primary_style: &ComputedStyle,
pseudo: Option<&PseudoElement>)
-> Option<Arc<ComputedValues>> {
let rule_node = &primary_style.rules;
let without_transition_rules =
@ -618,7 +625,8 @@ trait PrivateMatchMethods: TElement {
&context.thread_local.font_metrics_provider,
&without_transition_rules,
primary_style,
InheritMode::FromParentElement))
InheritMode::FromParentElement,
pseudo))
}
#[cfg(feature = "gecko")]
@ -663,7 +671,7 @@ trait PrivateMatchMethods: TElement {
let before_change_style = if self.might_need_transitions_update(old_values.as_ref().map(|s| &**s),
new_values) {
let after_change_style = if self.has_css_transitions() {
self.get_after_change_style(context, primary_style)
self.get_after_change_style(context, primary_style, None)
} else {
None
};
@ -1424,6 +1432,7 @@ pub trait MatchMethods : TElement {
shared_context: &SharedStyleContext,
font_metrics_provider: &FontMetricsProvider,
primary_style: &ComputedStyle,
pseudo: Option<&PseudoElement>,
pseudo_style: Option<&ComputedStyle>)
-> Arc<ComputedValues> {
let relevant_style = pseudo_style.unwrap_or(primary_style);
@ -1440,7 +1449,8 @@ pub trait MatchMethods : TElement {
font_metrics_provider,
&without_animation_rules,
primary_style,
InheritMode::FromParentElement)
InheritMode::FromParentElement,
pseudo)
}
}