Bug 1446568: Move a few of the remaining nsDocument members to nsIDocument. r=smaug
MozReview-Commit-ID: 3FdiyHLFOh
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -1505,18 +1505,25 @@ nsIDocument::nsIDocument()
mValidHeight(false),
mAutoSize(false),
mAllowZoom(false),
mAllowDoubleTapZoom(false),
mValidScaleFloat(false),
mValidMaxScale(false),
mScaleStrEmpty(false),
mWidthStrEmpty(false),
+ mParserAborted(false),
+ mReportedUseCounters(false),
+#ifdef DEBUG
+ mWillReparent(false),
+#endif
mPendingFullscreenRequests(0),
mXMLDeclarationBits(0),
+ mOnloadBlockCount(0),
+ mAsyncOnloadBlockCount(0),
mCompatMode(eCompatibility_FullStandards),
mReadyState(ReadyState::READYSTATE_UNINITIALIZED),
mStyleBackendType(StyleBackendType::None),
#ifdef MOZILLA_INTERNAL_API
mVisibilityState(dom::VisibilityState::Hidden),
#else
mDummy(0),
#endif
@@ -1560,23 +1567,16 @@ nsIDocument::nsIDocument()
SetIsInDocument();
for (auto& cnt : mIncCounters) {
cnt = 0;
}
}
nsDocument::nsDocument(const char* aContentType)
: nsIDocument()
- , mParserAborted(false)
- , mReportedUseCounters(false)
- , mOnloadBlockCount(0)
- , mAsyncOnloadBlockCount(0)
-#ifdef DEBUG
- , mWillReparent(false)
-#endif
{
SetContentTypeInternal(nsDependentCString(aContentType));
MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug, ("DOCUMENT %p created", this));
// Start out mLastStyleSheetSet as null, per spec
SetDOMStringToNull(mLastStyleSheetSet);
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -335,30 +335,18 @@ public:
// 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;
nsClassHashtable<nsStringHashKey, nsRadioGroupStruct> mRadioGroups;
- // Parser aborted. True if the parser of this document was forcibly
- // terminated instead of letting it finish at its own pace.
- bool mParserAborted:1;
-
friend class nsCallRequestFullScreen;
- // Whether we have reported use counters for this document with Telemetry yet.
- // Normally this is only done at document destruction time, but for image
- // documents (SVG documents) that are not guaranteed to be destroyed, we
- // report use counters when the image cache no longer has any imgRequestProxys
- // pointing to them. We track whether we ever reported use counters so
- // that we only report them once for the document.
- bool mReportedUseCounters:1;
-
// The application cache that this document is associated with, if
// any. This can change during the lifetime of the document.
nsCOMPtr<nsIApplicationCache> mApplicationCache;
nsCOMPtr<nsIContent> mFirstBaseNodeWithHref;
private:
friend class nsUnblockOnloadEvent;
@@ -367,29 +355,16 @@ private:
nsresult InitCSP(nsIChannel* aChannel);
void ClearAllBoxObjects();
// These are not implemented and not supported.
nsDocument(const nsDocument& aOther);
nsDocument& operator=(const nsDocument& aOther);
-
- // Currently active onload blockers
- uint32_t mOnloadBlockCount;
- // Onload blockers which haven't been activated yet
- uint32_t mAsyncOnloadBlockCount;
- nsCOMPtr<nsIRequest> mOnloadBlocker;
-
- nsCOMPtr<nsIRunnable> mMaybeEndOutermostXBLUpdateRunner;
-
-#ifdef DEBUG
-public:
- bool mWillReparent;
-#endif
};
class nsDocumentOnStack
{
public:
explicit nsDocumentOnStack(nsIDocument* aDoc) : mDoc(aDoc)
{
mDoc->IncreaseStackRefCnt();
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -4167,20 +4167,44 @@ protected:
bool mAutoSize: 1;
bool mAllowZoom: 1;
bool mAllowDoubleTapZoom: 1;
bool mValidScaleFloat: 1;
bool mValidMaxScale: 1;
bool mScaleStrEmpty: 1;
bool mWidthStrEmpty: 1;
+ // Parser aborted. True if the parser of this document was forcibly
+ // terminated instead of letting it finish at its own pace.
+ bool mParserAborted: 1;
+
+ // Whether we have reported use counters for this document with Telemetry yet.
+ // Normally this is only done at document destruction time, but for image
+ // documents (SVG documents) that are not guaranteed to be destroyed, we
+ // report use counters when the image cache no longer has any imgRequestProxys
+ // pointing to them. We track whether we ever reported use counters so
+ // that we only report them once for the document.
+ bool mReportedUseCounters: 1;
+
+#ifdef DEBUG
+public:
+ bool mWillReparent: 1;
+protected:
+#endif
+
uint8_t mPendingFullscreenRequests;
uint8_t mXMLDeclarationBits;
+ // Currently active onload blockers.
+ uint32_t mOnloadBlockCount;
+
+ // Onload blockers which haven't been activated yet.
+ uint32_t mAsyncOnloadBlockCount;
+
// Compatibility mode
nsCompatibility mCompatMode;
// Our readyState
ReadyState mReadyState;
// Whether this document has (or will have, once we have a pres shell) a
// Gecko- or Servo-backed style system.
@@ -4492,16 +4516,19 @@ protected:
mozilla::LayoutDeviceToScreenScale mScaleMinFloat;
mozilla::LayoutDeviceToScreenScale mScaleMaxFloat;
mozilla::LayoutDeviceToScreenScale mScaleFloat;
mozilla::CSSToLayoutDeviceScale mPixelRatio;
mozilla::CSSSize mViewportSize;
RefPtr<mozilla::EventListenerManager> mListenerManager;
+ nsCOMPtr<nsIRunnable> mMaybeEndOutermostXBLUpdateRunner;
+ nsCOMPtr<nsIRequest> mOnloadBlocker;
+
nsTArray<RefPtr<mozilla::StyleSheet>> mOnDemandBuiltInUASheets;
nsTArray<RefPtr<mozilla::StyleSheet>> mAdditionalSheets[AdditionalSheetTypeCount];
// Member to store out last-selected stylesheet set.
nsString mLastStyleSheetSet;
RefPtr<nsDOMStyleSheetSetList> mStyleSheetSetList;
// We lazily calculate declaration blocks for SVG elements with mapped
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -1425,18 +1425,17 @@ nsHTMLDocument::Open(JSContext* cx,
if (nsPIDOMWindowInner *window = GetInnerWindow()) {
// Remember the old scope in case the call to SetNewDocument changes it.
nsCOMPtr<nsIScriptGlobalObject> oldScope(do_QueryReferent(mScopeObject));
#ifdef DEBUG
bool willReparent = mWillReparent;
mWillReparent = true;
- nsDocument* templateContentsOwner =
- static_cast<nsDocument*>(mTemplateContentsOwner.get());
+ nsIDocument* templateContentsOwner = mTemplateContentsOwner.get();
if (templateContentsOwner) {
templateContentsOwner->mWillReparent = true;
}
#endif
// Set our ready state to uninitialized before setting the new document so
// that window creation listeners don't use the document in its intermediate