Bug 1485655 - Remove an assertion that doesn't hold in some cases. r=me, a=RyanVM
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 23 Aug 2018 16:56:27 +0200
changeset 450295 9055726e2d89e54a135b28d9c2dc4162a129fa1b
parent 450294 5e1a9644aeef3c38b34a81abb3ab2a931266b487
child 450296 9e641345e2ef5366cf6678b9eab23369aa777307
push id231
push userryanvm@gmail.com
push dateThu, 08 Nov 2018 23:06:09 +0000
treeherdermozilla-esr60@9055726e2d89 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme, RyanVM
bugs1485655
milestone60.3.1
Bug 1485655 - Remove an assertion that doesn't hold in some cases. r=me, a=RyanVM
servo/components/style/invalidation/element/state_and_attributes.rs
--- a/servo/components/style/invalidation/element/state_and_attributes.rs
+++ b/servo/components/style/invalidation/element/state_and_attributes.rs
@@ -167,23 +167,28 @@ where
         if !snapshot.has_attrs() && state_changes.is_empty() {
             return false;
         }
 
         // If we are sensitive to visitedness and the visited state changed, we
         // force a restyle here. Matching doesn't depend on the actual visited
         // state at all, so we can't look at matching results to decide what to
         // do for this case.
-        if state_changes.intersects(ElementState::IN_VISITED_OR_UNVISITED_STATE) {
+        if state_changes.intersects(ElementState::IN_VISITED_OR_UNVISITED_STATE) &&
+            self.shared_context.visited_styles_enabled
+        {
             trace!(" > visitedness change, force subtree restyle");
-            // If we get here with visited links disabled, we should probably
-            // just avoid the restyle and remove the state change here, not only
-            // as an optimization, but also because it kind of would kill the
+            // We shouldn't get here with visited links disabled, but it's hard
+            // to assert in cases where you record a visitedness change and
+            // afterwards you change some of the stuff (like the pref) that
+            // changes whether visited styles are enabled.
+            //
+            // So just avoid the restyle here, because it kind of would kill the
             // point of disabling visited links.
-            debug_assert!(self.shared_context.visited_styles_enabled);
+            //
             // We can't just return here because there may also be attribute
             // changes as well that imply additional hints for siblings.
             self.data.hint.insert(RestyleHint::restyle_subtree());
         }
 
         let mut classes_removed = SmallVec::<[Atom; 8]>::new();
         let mut classes_added = SmallVec::<[Atom; 8]>::new();
         if snapshot.class_changed() {