diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-07-10 11:33:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-10 11:33:04 -0700 |
commit | 5010df627d481b95f449b90ff7500471b01ec600 (patch) | |
tree | 09c01582eafd497a77f49c95ed2a17b309bd8c43 | |
parent | 2278a3f9811cdb643f7b06c1c2f8c3772e3794e5 (diff) | |
parent | 3463a9c2109eab06b023fcd4909b9802c9e34e30 (diff) | |
download | servo-5010df627d481b95f449b90ff7500471b01ec600.tar.gz servo-5010df627d481b95f449b90ff7500471b01ec600.zip |
Auto merge of #17650 - jryans:link-transition-crash, r=hiikezoe
Pass through visited style for after change
https://bugzilla.mozilla.org/show_bug.cgi?id=1377975
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17650)
<!-- Reviewable:end -->
-rw-r--r-- | components/style/context.rs | 5 | ||||
-rw-r--r-- | components/style/matching.rs | 16 | ||||
-rw-r--r-- | components/style/properties/gecko.mako.rs | 5 | ||||
-rw-r--r-- | components/style/properties/properties.mako.rs | 5 |
4 files changed, 28 insertions, 3 deletions
diff --git a/components/style/context.rs b/components/style/context.rs index dfb657585e7..db320aa4753 100644 --- a/components/style/context.rs +++ b/components/style/context.rs @@ -297,6 +297,11 @@ impl CascadeInputs { self.visited_rules.take() } + /// Whether there are any visited values. + pub fn has_visited_values(&self) -> bool { + self.visited_values.is_some() + } + /// Gets a reference to the visited computed values. Panic if the element /// does not have visited computed values. pub fn visited_values(&self) -> &Arc<ComputedValues> { diff --git a/components/style/matching.rs b/components/style/matching.rs index 5629a0e8b97..9a8e1232bd4 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -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); diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 6823d6d5dba..13f7b130841 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -171,6 +171,11 @@ impl ComputedValues { self.rules.as_ref().unwrap() } + /// Whether there is a visited style. + pub fn has_visited_style(&self) -> bool { + self.visited_style.is_some() + } + /// Gets a reference to the visited style, if any. pub fn get_visited_style(&self) -> Option<<&Arc<ComputedValues>> { self.visited_style.as_ref() diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index cd6278167b9..04be2bf7e58 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -1908,6 +1908,11 @@ impl ComputedValues { self.rules.as_ref().unwrap() } + /// Whether there is a visited style. + pub fn has_visited_style(&self) -> bool { + self.visited_style.is_some() + } + /// Gets a reference to the visited style, if any. pub fn get_visited_style(&self) -> Option<<&Arc<ComputedValues>> { self.visited_style.as_ref() |