Bug 996796 patch 19 - Avoid reresolution for extra style contexts when the restyle hint is not eRestyle_Self or eRestyle_Subtree. r=heycam
authorL. David Baron <dbaron@dbaron.org>
Sun, 03 Aug 2014 13:11:55 -0700
changeset 197621 69c78fb96b8ab6e1fc71ccff46f9dc41354bcd95
parent 197620 2919311231ecd1bd53e18eee26bc7106b2ab806c
child 197622 dd86a9d3fd78d0e20c24623e0bb80c464d16c6ee
push id27249
push userryanvm@gmail.com
push dateMon, 04 Aug 2014 20:14:35 +0000
treeherdermozilla-central@7f81be7db528 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs996796
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 996796 patch 19 - Avoid reresolution for extra style contexts when the restyle hint is not eRestyle_Self or eRestyle_Subtree. r=heycam This is part of making reresolution not touch style that it was not asked to touch, so that we can use it for the animation-only restyle.
layout/base/RestyleManager.cpp
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -2578,21 +2578,25 @@ ElementRestyler::RestyleSelf(nsIFrame* a
        ++contextIndex) {
     nsRefPtr<nsStyleContext> newExtraContext;
     nsIAtom* const extraPseudoTag = oldExtraContext->GetPseudo();
     const nsCSSPseudoElements::Type extraPseudoType =
       oldExtraContext->GetPseudoType();
     NS_ASSERTION(extraPseudoTag &&
                  extraPseudoTag != nsCSSAnonBoxes::mozNonElement,
                  "extra style context is not pseudo element");
-    if (extraPseudoType == nsCSSPseudoElements::ePseudo_AnonBox) {
+    if (!(aRestyleHint & (eRestyle_Self | eRestyle_Subtree))) {
+      Element* element = extraPseudoType != nsCSSPseudoElements::ePseudo_AnonBox
+                           ? mContent->AsElement() : nullptr;
+      newExtraContext =
+        styleSet->ReparentStyleContext(oldExtraContext, newContext, element);
+    } else if (extraPseudoType == nsCSSPseudoElements::ePseudo_AnonBox) {
       newExtraContext = styleSet->ResolveAnonymousBoxStyle(extraPseudoTag,
                                                            newContext);
-    }
-    else {
+    } else {
       // Don't expect XUL tree stuff here, since it needs a comparator and
       // all.
       NS_ASSERTION(extraPseudoType <
                      nsCSSPseudoElements::ePseudo_PseudoElementCount,
                    "Unexpected type");
       newExtraContext = styleSet->ResolvePseudoElementStyle(mContent->AsElement(),
                                                             extraPseudoType,
                                                             newContext,