Bug 1188721 - Part 6: Remove cached struct pointer equality requirement for stopping restyles. r?dbaron draft
authorCameron McCormack <cam@mcc.id.au>
Wed, 23 Mar 2016 17:35:58 +1100
changeset 343756 c220e2fd6bfc01d666ac060e6cd4092455da35f6
parent 343755 49922b9487ab42f6824fbddbb93920790afa635a
child 343757 47a48195b5fcce2859abe7aaad535cc38e5a54e6
push id13680
push usercmccormack@mozilla.com
push dateWed, 23 Mar 2016 06:36:18 +0000
reviewersdbaron
bugs1188721
milestone48.0a1
Bug 1188721 - Part 6: Remove cached struct pointer equality requirement for stopping restyles. r?dbaron MozReview-Commit-ID: GW10C2tsEnu
layout/base/RestyleManager.cpp
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -4113,50 +4113,16 @@ ElementRestyler::RestyleSelf(nsIFrame* a
                    NS_STYLE_RESET_STRUCT_MASK &&
                  oldContext->HasChildThatUsesResetStyle()) {
         LOG_RESTYLE("can't return eRestyleResult_StopWithStyleChange since "
                     "there is different reset data and descendants use it");
         canStopWithStyleChange = false;
       }
     }
 
-    if (result == eRestyleResult_Stop) {
-      // Since we currently have eRestyleResult_Stop, we know at this
-      // point that all of our style structs are equal in terms of styles.
-      // However, some of them might be different pointers.  Since our
-      // descendants might share those pointers, we have to continue to
-      // restyling our descendants.
-      //
-      // However, because of the swapping of equal structs we've done on
-      // ancestors (later in this function), we've ensured that for structs
-      // that cannot be stored in the rule tree, we keep the old equal structs
-      // around rather than replacing them with new ones.  This means that we
-      // only time we hit this deoptimization is either
-      //
-      // (a) when at least one of the (old or new) equal structs could be stored
-      //     in the rule tree, and those structs are then inherited (by pointer
-      //     sharing) to descendant style contexts; or
-      //
-      // (b) when we were unable to swap the structs on the parent because
-      //     either or both of the old parent and new parent are shared.
-      //
-      // FIXME This loop could be rewritten as bit operations on
-      //       oldContext->mBits and samePointerStructs.
-      for (nsStyleStructID sid = nsStyleStructID(0);
-           sid < nsStyleStructID_Length;
-           sid = nsStyleStructID(sid + 1)) {
-        if (oldContext->HasCachedDependentStyleData(sid) &&
-            !(samePointerStructs & nsCachedStyleData::GetBitForSID(sid))) {
-          LOG_RESTYLE_CONTINUE("there are different struct pointers");
-          result = eRestyleResult_Continue;
-          break;
-        }
-      }
-    }
-
     // From this point we no longer do any assignments of
     // eRestyleResult_Continue to |result|.  If canStopWithStyleChange is true,
     // it means that we can convert |result| (whether it is
     // eRestyleResult_Continue or eRestyleResult_Stop) into
     // eRestyleResult_StopWithStyleChange.
     if (canStopWithStyleChange) {
       LOG_RESTYLE("converting %s into eRestyleResult_StopWithStyleChange",
                   RestyleResultToString(result).get());