Bug 1519193 part 5. Convert AssertNoStaleServoDataIn to using ShadowIncludingTreeIterator. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D16247

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-01-12 03:20:44 +00:00
Родитель 188ff78bd7
Коммит d2c80f84e7
1 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

@ -75,6 +75,7 @@
#include "mozilla/dom/Performance.h"
#include "mozilla/dom/ServiceWorkerContainer.h"
#include "mozilla/dom/ScriptLoader.h"
#include "mozilla/dom/ShadowIncludingTreeIterator.h"
#include "mozilla/dom/StyleSheetList.h"
#include "mozilla/dom/SVGUseElement.h"
#include "nsGenericHTMLElement.h"
@ -3547,21 +3548,21 @@ void Document::TryChannelCharset(nsIChannel* aChannel, int32_t& aCharsetSource,
}
}
static inline void AssertNoStaleServoDataIn(const nsINode& aSubtreeRoot) {
static inline void AssertNoStaleServoDataIn(nsINode& aSubtreeRoot) {
#ifdef DEBUG
for (const nsINode* node = &aSubtreeRoot; node;
node = node->GetNextNode(&aSubtreeRoot)) {
for (nsINode* node : ShadowIncludingTreeIterator(aSubtreeRoot)) {
const Element* element = Element::FromNode(node);
if (!element) {
continue;
}
MOZ_ASSERT(!element->HasServoData());
if (auto* shadow = element->GetShadowRoot()) {
AssertNoStaleServoDataIn(*shadow);
}
if (nsXBLBinding* binding = element->GetXBLBinding()) {
if (nsXBLBinding* bindingWithContent = binding->GetBindingWithContent()) {
nsIContent* content = bindingWithContent->GetAnonymousContent();
// Need to do this instead of just AssertNoStaleServoDataIn(*content),
// because the parent of the children of the <content> element isn't the
// <content> element, but the bound element, and that confuses
// GetNextNode a lot.
MOZ_ASSERT(!content->AsElement()->HasServoData());
for (nsINode* child = content->GetFirstChild(); child;
child = child->GetNextSibling()) {
@ -3581,7 +3582,7 @@ already_AddRefed<nsIPresShell> Document::CreateShell(
NS_ENSURE_FALSE(GetBFCacheEntry(), nullptr);
FillStyleSet(aStyleSet.get());
AssertNoStaleServoDataIn(static_cast<nsINode&>(*this));
AssertNoStaleServoDataIn(*this);
RefPtr<PresShell> shell = new PresShell;
// Note: we don't hold a ref to the shell (it holds a ref to us)
@ -3704,7 +3705,7 @@ void Document::DeleteShell() {
mStyleSetFilled = false;
ClearStaleServoData();
AssertNoStaleServoDataIn(static_cast<nsINode&>(*this));
AssertNoStaleServoDataIn(*this);
}
void Document::SetBFCacheEntry(nsIBFCacheEntry* aEntry) {