Bug 1389385 - Require a presshell to set descendant bits. r=emilio
authorBobby Holley <bobbyholley@gmail.com>
Fri, 21 Jul 2017 08:47:11 -0700
changeset 374405 a3184c7e748a2432690ac6c5617b576dde065cdd
parent 374404 4a977fea2799d75b82dbd9cf4da8d0dabadee65d
child 374406 e534aae10ab199fe91159d32e5c25d447a03fda4
push id93678
push userarchaeopteryx@coole-files.de
push dateSat, 12 Aug 2017 23:17:05 +0000
treeherdermozilla-inbound@a79ccbfacad8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1389385
milestone57.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 1389385 - Require a presshell to set descendant bits. r=emilio We're going to start tracking the restyle root on the presshell, so we'll need one. This should be fine, since if the presshell doesn't exist yet we can't have done the initial style, and if it's already been destroyed we don't need restyle state anymore. MozReview-Commit-ID: EfNVloI9ENQ
dom/base/Element.cpp
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -4199,19 +4199,21 @@ BitIsPropagated(const Element* aElement)
   return true;
 }
 #endif
 
 template<typename Traits>
 void
 NoteDirtyContent(nsIContent* aContent)
 {
-  if (nsIPresShell* shell = aContent->OwnerDoc()->GetShell()) {
-    shell->EnsureStyleFlush();
-  }
+  MOZ_ASSERT(aContent->IsInComposedDoc());
+  nsIDocument* doc = aContent->GetComposedDoc();
+  nsIPresShell* shell = doc->GetShell();
+  NS_ENSURE_TRUE_VOID(shell);
+  shell->EnsureStyleFlush();
 
   Element* parent = aContent->GetFlattenedTreeParentElementForStyle();
   if (!parent || !parent->HasServoData()) {
     // The bits only apply to styled elements.
     return;
   }
 
   Element* curr = parent;