Bug 1394935: Assert that the new root is always higher up in the tree than the old root. r?bholley
The bug here is that we're clobbering a restyle root with another one which is
down in the tree, when calling NoteDirtyElement on the document element with the
flags already propagated.
This assertion would've catched it earlier, and make it more obvious.
MozReview-Commit-ID: 3mucQvr7A1x
--- a/dom/base/nsIDocumentInlines.h
+++ b/dom/base/nsIDocumentInlines.h
@@ -1,16 +1,17 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsIDocumentInlines_h
#define nsIDocumentInlines_h
+#include "nsContentUtils.h"
#include "nsIDocument.h"
#include "mozilla/dom/HTMLBodyElement.h"
#include "nsStyleSheetService.h"
inline mozilla::dom::HTMLBodyElement*
nsIDocument::GetBodyElement()
{
return static_cast<mozilla::dom::HTMLBodyElement*>(GetHtmlChildElement(nsGkAtoms::body));
@@ -59,15 +60,18 @@ nsIDocument::FindDocStyleSheetInsertionP
inline void
nsIDocument::SetServoRestyleRoot(nsINode* aRoot, uint32_t aDirtyBits)
{
MOZ_ASSERT(aRoot);
MOZ_ASSERT(aDirtyBits);
MOZ_ASSERT((aDirtyBits & ~Element::kAllServoDescendantBits) == 0);
+ MOZ_ASSERT(!mServoRestyleRoot ||
+ mServoRestyleRoot == aRoot ||
+ nsContentUtils::ContentIsFlattenedTreeDescendantOfForStyle(mServoRestyleRoot, aRoot));
MOZ_ASSERT(aRoot == aRoot->OwnerDocAsNode() ||
(aRoot->IsElement() && aRoot->IsInComposedDoc()));
mServoRestyleRoot = aRoot;
mServoRestyleRootDirtyBits = aDirtyBits;
}
#endif // nsIDocumentInlines_h