Bug 1643721: part 3) Factor initializing `mRangeSerializer`'s members out to `RangeSerializer::Initialize`. r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D79112
This commit is contained in:
Mirko Brodesser 2020-06-12 08:53:54 +00:00
Родитель 56c83e7372
Коммит 4ec81aed90
1 изменённых файлов: 12 добавлений и 6 удалений

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

@ -408,6 +408,8 @@ class nsDocumentEncoder : public nsIDocumentEncoder {
mFlags{aFlags},
mNodeSerializer{aNodeSerializer} {}
void Initialize();
RangeBoundariesInclusiveAncestorsAndOffsets
mRangeBoundariesInclusiveAncestorsAndOffsets;
/**
@ -431,6 +433,15 @@ class nsDocumentEncoder : public nsIDocumentEncoder {
RangeSerializer mRangeSerializer;
};
void nsDocumentEncoder::RangeSerializer::Initialize() {
mContextInfoDepth = {};
mStartRootIndex = 0;
mEndRootIndex = 0;
mHaltRangeHint = false;
mClosestCommonInclusiveAncestorOfRange = nullptr;
mRangeBoundariesInclusiveAncestorsAndOffsets = {};
}
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDocumentEncoder)
NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(
nsDocumentEncoder, ReleaseDocumentReferenceAndInitialize(true))
@ -466,16 +477,11 @@ nsDocumentEncoder::nsDocumentEncoder()
void nsDocumentEncoder::Initialize(bool aClearCachedSerializer) {
mFlags = 0;
mWrapColumn = 72;
mRangeSerializer.mContextInfoDepth = {};
mRangeSerializer.mStartRootIndex = 0;
mRangeSerializer.mEndRootIndex = 0;
mRangeSerializer.Initialize();
mNeedsPreformatScanning = false;
mRangeSerializer.mHaltRangeHint = false;
mDisableContextSerialize = false;
mEncodingScope = {};
mRangeSerializer.mClosestCommonInclusiveAncestorOfRange = nullptr;
mNodeFixup = nullptr;
mRangeSerializer.mRangeBoundariesInclusiveAncestorsAndOffsets = {};
if (aClearCachedSerializer) {
mSerializer = nullptr;
}