Bug 1444580: Move mExpandoAndGeneration back to nsDocument for now. r=smaug

MozReview-Commit-ID: EArKdxEoXaJ
This commit is contained in:
Emilio Cobos Álvarez 2018-03-11 20:07:33 +01:00
Родитель a21c8d80eb
Коммит 4224552ed9
3 изменённых файлов: 20 добавлений и 11 удалений

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

@ -3139,6 +3139,12 @@ nsIDocument::GetLastModified(nsAString& aLastModified) const
}
}
static void
IncrementExpandoGeneration(nsIDocument& aDoc)
{
++static_cast<nsDocument&>(aDoc).mExpandoAndGeneration.generation;
}
void
nsIDocument::AddToNameTable(Element* aElement, nsAtom* aName)
{
@ -3152,7 +3158,7 @@ nsIDocument::AddToNameTable(Element* aElement, nsAtom* aName)
if (entry) {
if (!entry->HasNameElement() &&
!entry->HasIdElementExposedAsHTMLDocumentProperty()) {
++mExpandoAndGeneration.generation;
IncrementExpandoGeneration(*this);
}
entry->AddNameElement(this, aElement);
}
@ -3172,7 +3178,7 @@ nsIDocument::RemoveFromNameTable(Element* aElement, nsAtom* aName)
entry->RemoveNameElement(aElement);
if (!entry->HasNameElement() &&
!entry->HasIdElementExposedAsHTMLDocumentProperty()) {
++mExpandoAndGeneration.generation;
IncrementExpandoGeneration(*this);
}
}
@ -3185,7 +3191,7 @@ nsIDocument::AddToIdTable(Element* aElement, nsAtom* aId)
if (nsGenericHTMLElement::ShouldExposeIdAsHTMLDocumentProperty(aElement) &&
!entry->HasNameElement() &&
!entry->HasIdElementExposedAsHTMLDocumentProperty()) {
++mExpandoAndGeneration.generation;
IncrementExpandoGeneration(*this);
}
entry->AddIdElement(aElement);
}
@ -3209,7 +3215,7 @@ nsIDocument::RemoveFromIdTable(Element* aElement, nsAtom* aId)
if (nsGenericHTMLElement::ShouldExposeIdAsHTMLDocumentProperty(aElement) &&
!entry->HasNameElement() &&
!entry->HasIdElementExposedAsHTMLDocumentProperty()) {
++mExpandoAndGeneration.generation;
IncrementExpandoGeneration(*this);
}
if (entry->IsEmpty()) {
mIdentifierMap.RemoveEntry(entry);
@ -8747,7 +8753,7 @@ nsIDocument::DestroyElementMaps()
#endif
mStyledLinks.Clear();
mIdentifierMap.Clear();
++mExpandoAndGeneration.generation;
IncrementExpandoGeneration(*this);
}
void

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

@ -13,6 +13,7 @@
#include "nsIDocument.h"
#include "jsfriendapi.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsCRT.h"
@ -377,6 +378,14 @@ protected:
void EnsureOnloadBlocker();
public:
// FIXME(emilio): This needs to be here instead of in nsIDocument because Rust
// can't represent alignas(8) values on 32-bit architectures, which would
// cause nsIDocument's layout to be wrong in the Rust side.
//
// This can be fixed after updating to rust 1.25 and updating bindgen to
// include https://github.com/rust-lang-nursery/rust-bindgen/pull/1271.
js::ExpandoAndGeneration mExpandoAndGeneration;
RefPtr<mozilla::EventListenerManager> mListenerManager;
nsClassHashtable<nsStringHashKey, nsRadioGroupStruct> mRadioGroups;

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

@ -6,7 +6,6 @@
#ifndef nsIDocument_h___
#define nsIDocument_h___
#include "jsfriendapi.h"
#include "mozilla/FlushType.h" // for enum
#include "nsAttrAndChildArray.h"
#include "nsAutoPtr.h" // for member
@ -4423,11 +4422,6 @@ protected:
// 2) We haven't had Destroy() called on us yet.
nsCOMPtr<nsILayoutHistoryState> mLayoutHistoryState;
public:
js::ExpandoAndGeneration mExpandoAndGeneration;
protected:
nsTArray<RefPtr<mozilla::StyleSheet>> mOnDemandBuiltInUASheets;
nsTArray<RefPtr<mozilla::StyleSheet>> mAdditionalSheets[AdditionalSheetTypeCount];