Bug 1381083: Don't hold the style context if we had a frame and re-resolved the style. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 27 Jul 2017 00:45:29 +0200
changeset 422751 b8755e706ea7ca93ba444ecfc3eb0fdf60e17131
parent 422750 dc839a86967dafca35021b3744f6dfb39264179f
child 422752 a20bd8c1a22de3e2d02c8f9ad93fb3a2062ccb19
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1381083
milestone56.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 1381083: Don't hold the style context if we had a frame and re-resolved the style. r=heycam Otherwise we risk losing track of the frame if we hit the cache. MozReview-Commit-ID: ByHGhcBwIfX
layout/style/nsComputedDOMStyle.cpp
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -955,26 +955,27 @@ nsComputedDOMStyle::UpdateCurrentStyleSo
       mStyleContext = styleIfVisited;
     }
   }
 }
 
 void
 nsComputedDOMStyle::ClearCurrentStyleSources()
 {
+  // Release the current style context if we got it off the frame.
+  // For a style context we resolved, keep it around so that we
+  // can re-use it next time this object is queried, but not if it-s a
+  // re-resolved style context because we were inside a pseudo-element.
+  if (!mResolvedStyleContext || mOuterFrame) {
+    ClearStyleContext();
+  }
+
   mOuterFrame = nullptr;
   mInnerFrame = nullptr;
   mPresShell = nullptr;
-
-  // Release the current style context if we got it off the frame.
-  // For a style context we resolved, keep it around so that we
-  // can re-use it next time this object is queried.
-  if (!mResolvedStyleContext) {
-    mStyleContext = nullptr;
-  }
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName, ErrorResult& aRv)
 {
   nsCSSPropertyID prop =
     nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eForAllContent);