mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Pass through visited style for after change
When a transition update is needed during restyling, `get_after_change_style` is called to re-cascade without transition rules, and this style is then used for primary styling instead of the style just computed. `get_after_change_style` used to ignore visited styles, so this meant that if a transition update was needed, visited styles were effectively dropped. To fix the crash here, we pass through the existing visited styles when re-cascading as part of `get_after_change_style`. MozReview-Commit-ID: 4HBQAdeJ38B
This commit is contained in:
parent
2278a3f981
commit
3463a9c210
4 changed files with 28 additions and 3 deletions
|
@ -577,6 +577,12 @@ trait PrivateMatchMethods: TElement {
|
|||
}
|
||||
}
|
||||
|
||||
// If there were visited values to insert, ensure they do in fact exist
|
||||
// inside the new values.
|
||||
debug_assert!(!cascade_visited.visited_values_for_insertion() ||
|
||||
context.cascade_inputs().primary().has_visited_values() ==
|
||||
new_values.has_visited_style());
|
||||
|
||||
// Set the new computed values.
|
||||
let primary_inputs = context.cascade_inputs_mut().primary_mut();
|
||||
cascade_visited.set_primary_values(&mut data.styles,
|
||||
|
@ -661,8 +667,9 @@ trait PrivateMatchMethods: TElement {
|
|||
return None;
|
||||
}
|
||||
|
||||
// This currently ignores visited styles, which seems acceptable,
|
||||
// as existing browsers don't appear to transition visited styles.
|
||||
// This currently passes through visited styles, if they exist.
|
||||
// When fixing bug 868975, compute after change for visited styles as
|
||||
// well, along with updating the rest of the animation processing.
|
||||
Some(self.cascade_with_rules(context.shared,
|
||||
&context.thread_local.font_metrics_provider,
|
||||
&without_transition_rules,
|
||||
|
@ -670,7 +677,7 @@ trait PrivateMatchMethods: TElement {
|
|||
CascadeTarget::Normal,
|
||||
CascadeVisitedMode::Unvisited,
|
||||
/* parent_info = */ None,
|
||||
None))
|
||||
primary_style.get_visited_style().cloned()))
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
|
@ -716,6 +723,9 @@ trait PrivateMatchMethods: TElement {
|
|||
use context::{CASCADE_RESULTS, CSS_ANIMATIONS, CSS_TRANSITIONS, EFFECT_PROPERTIES};
|
||||
use context::UpdateAnimationsTasks;
|
||||
|
||||
// Bug 868975: These steps should examine and update the visited styles
|
||||
// in addition to the unvisited styles.
|
||||
|
||||
let mut tasks = UpdateAnimationsTasks::empty();
|
||||
if self.needs_animations_update(context, old_values.as_ref(), new_values) {
|
||||
tasks.insert(CSS_ANIMATIONS);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue