diff --git a/caps/nsScriptSecurityManager.cpp b/caps/nsScriptSecurityManager.cpp index d155116bb766..e66d4cdb5ee3 100644 --- a/caps/nsScriptSecurityManager.cpp +++ b/caps/nsScriptSecurityManager.cpp @@ -390,7 +390,7 @@ nsScriptSecurityManager::GetChannelURIPrincipal(nsIChannel* aChannel, MOZ_ASSERT(aChannel, "Must have channel!"); // Get the principal from the URI. Make sure this does the same thing - // as nsDocument::Reset and XULDocument::StartDocumentLoad. + // as nsIDocument::Reset and XULDocument::StartDocumentLoad. nsCOMPtr uri; nsresult rv = NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 2b14a2e1d8fc..47f8cf69b565 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -2476,7 +2476,7 @@ void nsDocShell::MaybeCreateInitialClientSource(nsIPrincipal* aPrincipal) { // Sometimes there is no principal available when we are called from // CreateAboutBlankContentViewer. For example, sometimes the principal // is only extracted from the load context after the document is created - // in nsDocument::ResetToURI(). Ideally we would do something similar + // in nsIDocument::ResetToURI(). Ideally we would do something similar // here, but for now lets just avoid the issue by not preallocating the // client. if (!principal) { @@ -10885,7 +10885,7 @@ bool nsDocShell::OnLoadingSite(nsIChannel* aChannel, bool aFireOnLocationChange, // If this a redirect, use the final url (uri) // else use the original url // - // Note that this should match what documents do (see nsDocument::Reset). + // Note that this should match what documents do (see nsIDocument::Reset). NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri)); NS_ENSURE_TRUE(uri, false); diff --git a/docshell/base/nsPingListener.cpp b/docshell/base/nsPingListener.cpp index 2d2a6270aff4..7cdc3e2f1047 100644 --- a/docshell/base/nsPingListener.cpp +++ b/docshell/base/nsPingListener.cpp @@ -16,7 +16,7 @@ #include "nsIProtocolHandler.h" #include "nsIUploadChannel2.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "nsNetUtil.h" #include "nsStreamUtils.h" #include "nsStringStream.h" diff --git a/dom/animation/KeyframeUtils.cpp b/dom/animation/KeyframeUtils.cpp index 303b6abc6a9c..d45c75c3b110 100644 --- a/dom/animation/KeyframeUtils.cpp +++ b/dom/animation/KeyframeUtils.cpp @@ -27,7 +27,7 @@ #include "nsCSSPropertyIDSet.h" #include "nsCSSProps.h" #include "nsCSSPseudoElements.h" // For CSSPseudoElementType -#include "nsDocument.h" // For nsDocument::AreWebAnimationsImplicitKeyframesEnabled +#include "nsIDocument.h" // For nsIDocument::AreWebAnimationsImplicitKeyframesEnabled #include "nsIScriptError.h" #include "nsTArray.h" #include // For std::stable_sort, std::min @@ -224,7 +224,7 @@ static void DistributeRange(const Range& aRange); return keyframes; } - if (!nsDocument::AreWebAnimationsImplicitKeyframesEnabled(aCx, nullptr) && + if (!nsIDocument::AreWebAnimationsImplicitKeyframesEnabled(aCx, nullptr) && HasImplicitKeyframeValues(keyframes, aDocument)) { keyframes.Clear(); aRv.Throw(NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR); diff --git a/dom/base/ChildIterator.cpp b/dom/base/ChildIterator.cpp index 2b4d4fb93876..2dfc3491ed9c 100644 --- a/dom/base/ChildIterator.cpp +++ b/dom/base/ChildIterator.cpp @@ -12,7 +12,7 @@ #include "nsIAnonymousContentCreator.h" #include "nsIFrame.h" #include "nsCSSAnonBoxes.h" -#include "nsDocument.h" +#include "nsIDocument.h" namespace mozilla { namespace dom { diff --git a/dom/base/CustomElementRegistry.h b/dom/base/CustomElementRegistry.h index 4c8df302f473..b6e341c57e43 100644 --- a/dom/base/CustomElementRegistry.h +++ b/dom/base/CustomElementRegistry.h @@ -22,8 +22,6 @@ #include "nsWrapperCache.h" #include "nsContentUtils.h" -class nsDocument; - namespace mozilla { namespace dom { @@ -351,8 +349,6 @@ class CustomElementReactionsStack { }; class CustomElementRegistry final : public nsISupports, public nsWrapperCache { - // Allow nsDocument to access mCustomDefinitions and mCandidatesMap. - friend class ::nsDocument; public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/base/DOMParser.cpp b/dom/base/DOMParser.cpp index 14b6eb97f92d..4210197b0ddb 100644 --- a/dom/base/DOMParser.cpp +++ b/dom/base/DOMParser.cpp @@ -271,10 +271,10 @@ already_AddRefed DOMParser::CreateWithoutGlobal(ErrorResult& aRv) { already_AddRefed DOMParser::SetUpDocument(DocumentFlavor aFlavor, ErrorResult& aRv) { - // We should really just use mOwner here, but nsDocument gets confused + // We should really just use mOwner here, but nsIDocument gets confused // if we pass it a scriptHandlingObject that doesn't QI to // nsIScriptGlobalObject, and test_isequalnode.js (an xpcshell test without - // a window global) breaks. The correct solution is just to wean nsDocument + // a window global) breaks. The correct solution is just to wean nsIDocument // off of nsIScriptGlobalObject, but that's a yak to shave another day. nsCOMPtr scriptHandlingObject = do_QueryInterface(mOwner); diff --git a/dom/base/DocumentOrShadowRoot.cpp b/dom/base/DocumentOrShadowRoot.cpp index 21f9874b82ad..c67c1a22055c 100644 --- a/dom/base/DocumentOrShadowRoot.cpp +++ b/dom/base/DocumentOrShadowRoot.cpp @@ -9,7 +9,7 @@ #include "mozilla/dom/HTMLInputElement.h" #include "mozilla/dom/ShadowRoot.h" #include "mozilla/dom/StyleSheetList.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "nsFocusManager.h" #include "nsIRadioVisitor.h" #include "nsIFormControl.h" @@ -476,8 +476,8 @@ nsresult DocumentOrShadowRoot::GetNextRadioButton( const nsAString& aName, const bool aPrevious, HTMLInputElement* aFocusedRadio, HTMLInputElement** aRadioOut) { // XXX Can we combine the HTML radio button method impls of - // nsDocument and nsHTMLFormControl? - // XXX Why is HTML radio button stuff in nsDocument, as + // nsIDocument and nsHTMLFormControl? + // XXX Why is HTML radio button stuff in nsIDocument, as // opposed to nsHTMLDocument? *aRadioOut = nullptr; diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index ff3b92147a19..56c373ffabb3 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -76,7 +76,7 @@ #include "mozilla/TextEvents.h" #include "nsNodeUtils.h" #include "mozilla/dom/DirectionalityUtils.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "nsAttrValueOrString.h" #include "nsAttrValueInlines.h" #include "nsCSSPseudoElements.h" diff --git a/dom/base/Element.h b/dom/base/Element.h index 10667a471561..fe3e852be16d 100644 --- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -59,7 +59,6 @@ class nsGlobalWindowInner; class nsGlobalWindowOuter; class nsDOMCSSAttributeDeclaration; class nsISMILAttr; -class nsDocument; class nsDOMStringMap; struct ServoNodeData; diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index 53dbe3b22d50..e939877b6dc4 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -61,7 +61,7 @@ #include "mozilla/InternalMutationEvent.h" #include "mozilla/MouseEvents.h" #include "nsNodeUtils.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "nsAttrValueOrString.h" #include "nsQueryObject.h" #ifdef MOZ_XUL @@ -1143,7 +1143,7 @@ void FragmentOrElement::DestroyContent() { // around the flattened tree. // // TODO(emilio): I suspect this can be asserted against instead, with a bit of - // effort to avoid calling nsDocument::Destroy with a shell... + // effort to avoid calling nsIDocument::Destroy with a shell... if (IsElement()) { AsElement()->ClearServoData(); } @@ -1234,7 +1234,7 @@ class ContentUnbinder : public Runnable { // observers and they should really see consistent // tree state. // If this code changes, change the corresponding code in - // FragmentOrElement's and nsDocument's unlink impls. + // FragmentOrElement's and nsIDocument's unlink impls. nsCOMPtr child = container->GetLastChild(); container->DisconnectChild(child); UnbindSubtree(child); @@ -1340,7 +1340,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement) while (tmp->HasChildren()) { // Hold a strong ref to the node when we remove it, because we may be // the last reference to it. - // If this code changes, change the corresponding code in nsDocument's + // If this code changes, change the corresponding code in nsIDocument's // unlink impl and ContentUnbinder::UnbindSubtree. nsCOMPtr child = tmp->GetLastChild(); tmp->DisconnectChild(child); diff --git a/dom/base/InProcessTabChildMessageManager.cpp b/dom/base/InProcessTabChildMessageManager.cpp index a0ee48b05f56..a9ef37bf1666 100644 --- a/dom/base/InProcessTabChildMessageManager.cpp +++ b/dom/base/InProcessTabChildMessageManager.cpp @@ -183,7 +183,7 @@ uint64_t InProcessTabChildMessageManager::ChromeOuterWindowID() { } void InProcessTabChildMessageManager::FireUnloadEvent() { - // We're called from nsDocument::MaybeInitializeFinalizeFrameLoaders, so it + // We're called from nsIDocument::MaybeInitializeFinalizeFrameLoaders, so it // should be safe to run script. MOZ_ASSERT(nsContentUtils::IsSafeToRunScript()); diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 824ef091bb0d..2b3adfb58692 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -111,7 +111,7 @@ #include "nsCycleCollector.h" #include "nsDataHashtable.h" #include "nsDocShellCID.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "nsDOMCID.h" #include "mozilla/dom/DataTransfer.h" #include "nsDOMJSUtils.h" diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index e402f7c75d70..16f9246b782b 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -13,7 +13,6 @@ #include "nsError.h" #include "nsQueryContentEventResult.h" #include "nsGlobalWindow.h" -#include "nsIDocument.h" #include "nsFocusManager.h" #include "nsFrameManager.h" #include "nsRefreshDriver.h" @@ -104,7 +103,7 @@ #include "nsContentPermissionHelper.h" #include "nsCSSPseudoElements.h" // for CSSPseudoElementType #include "nsNetUtil.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "HTMLImageElement.h" #include "HTMLCanvasElement.h" #include "mozilla/css/ImageLoader.h" @@ -3793,8 +3792,8 @@ nsDOMWindowUtils::ForceUseCounterFlush(nsINode* aNode) { // Flush the document and any external documents that it depends on. const auto reportKind = - nsDocument::UseCounterReportKind::eIncludeExternalResources; - static_cast(doc.get())->ReportUseCounters(reportKind); + nsIDocument::UseCounterReportKind::eIncludeExternalResources; + doc->ReportUseCounters(reportKind); return NS_OK; } diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index daf8044c1fd6..7dd368c1946d 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -9,7 +9,7 @@ */ #include "AudioChannelService.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "nsIDocumentInlines.h" #include "mozilla/AnimationComparator.h" #include "mozilla/AntiTrackingCommon.h" @@ -295,6 +295,11 @@ #include "mozilla/net/RequestContextService.h" #include "StorageAccessPermissionRequest.h" +#define XML_DECLARATION_BITS_DECLARATION_EXISTS (1 << 0) +#define XML_DECLARATION_BITS_ENCODING_EXISTS (1 << 1) +#define XML_DECLARATION_BITS_STANDALONE_EXISTS (1 << 2) +#define XML_DECLARATION_BITS_STANDALONE_YES (1 << 3) + using namespace mozilla; using namespace mozilla::dom; @@ -1238,7 +1243,7 @@ struct nsIDocument::FrameRequest { // ================================================================== // = // ================================================================== -nsIDocument::nsIDocument() +nsIDocument::nsIDocument(const char* aContentType) : nsINode(nullptr), DocumentOrShadowRoot(*this), mReferrerPolicySet(false), @@ -1378,6 +1383,7 @@ nsIDocument::nsIDocument() mViewportOverflowType(ViewportOverflowType::NoOverflow), mSubDocuments(nullptr), mHeaderData(nullptr), + mPrincipalFlashClassifier(new PrincipalFlashClassifier()), mFlashClassification(FlashClassification::Unclassified), mBoxObjectTable(nullptr), mCurrentOrientationAngle(0), @@ -1387,27 +1393,22 @@ nsIDocument::nsIDocument() mIgnoreOpensDuringUnloadCounter(0), mDocLWTheme(Doc_Theme_Uninitialized), mSavedResolution(1.0f) { + MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug, ("DOCUMENT %p created", this)); + SetIsInDocument(); SetIsConnected(true); if (StaticPrefs::layout_css_use_counters_enabled()) { mStyleUseCounters.reset(Servo_UseCounters_Create()); } -} -nsDocument::nsDocument(const char* aContentType) : nsIDocument() { SetContentTypeInternal(nsDependentCString(aContentType)); - MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug, ("DOCUMENT %p created", this)); - // Start out mLastStyleSheetSet as null, per spec SetDOMStringToNull(mLastStyleSheetSet); // void state used to differentiate an empty source from an unselected source mPreloadPictureFoundSource.SetIsVoid(true); - // For determining if this is a flash document which should be - // blocked based on its principal. - mPrincipalFlashClassifier = new PrincipalFlashClassifier(); } void nsIDocument::ClearAllBoxObjects() { @@ -1423,21 +1424,6 @@ void nsIDocument::ClearAllBoxObjects() { } } -nsIDocument::~nsIDocument() { - MOZ_ASSERT(mDOMMediaQueryLists.isEmpty(), - "must not have media query lists left"); - - if (mNodeInfoManager) { - mNodeInfoManager->DropDocumentReference(); - } - - if (mDocGroup) { - mDocGroup->RemoveDocument(this); - } - - UnlinkOriginalDocumentIfStatic(); -} - bool nsIDocument::IsAboutPage() const { nsCOMPtr principal = NodePrincipal(); nsCOMPtr uri; @@ -1453,7 +1439,7 @@ void nsIDocument::ConstructUbiNode(void* storage) { JS::ubi::Concrete::construct(storage, this); } -nsDocument::~nsDocument() { +nsIDocument::~nsIDocument() { MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug, ("DOCUMENT %p destroyed", this)); MOZ_ASSERT(!IsTopLevelContentDocument() || !IsResourceDoc(), "Can't be top-level and a resource doc at the same time"); @@ -1638,6 +1624,19 @@ nsDocument::~nsDocument() { mPendingTitleChangeEvent.Revoke(); mPlugins.Clear(); + + MOZ_ASSERT(mDOMMediaQueryLists.isEmpty(), + "must not have media query lists left"); + + if (mNodeInfoManager) { + mNodeInfoManager->DropDocumentReference(); + } + + if (mDocGroup) { + mDocGroup->RemoveDocument(this); + } + + UnlinkOriginalDocumentIfStatic(); } NS_INTERFACE_TABLE_HEAD(nsIDocument) @@ -1754,7 +1753,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsIDocument) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mReadyForIdle) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocumentL10n) - // Traverse all nsDocument nsCOMPtrs. + // Traverse all nsIDocument nsCOMPtrs. NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParser) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mScriptGlobalObject) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mListenerManager) @@ -2749,8 +2748,7 @@ nsresult nsIDocument::InitCSP(nsIChannel* aChannel) { ("Document is an add-on or CSP header specified %p", this)); nsCOMPtr csp; - rv = - principal->EnsureCSP(static_cast(this), getter_AddRefs(csp)); + rv = principal->EnsureCSP(this, getter_AddRefs(csp)); NS_ENSURE_SUCCESS(rv, rv); // ----- if the doc is an addon, apply its CSP. @@ -4494,12 +4492,12 @@ void nsIDocument::SetScriptGlobalObject( // Some observers need the notification, for example HTMLMediaElement uses // it to update internal media resource allocation. // When video is loaded via VideoDocument, HTMLMediaElement and MediaDecoder - // creation are already done before nsDocument::SetScriptGlobalObject() call. + // creation are already done before nsIDocument::SetScriptGlobalObject() call. // MediaDecoder decides whether starting decoding is decided based on // document's visibility. When the MediaDecoder is created, - // nsDocument::SetScriptGlobalObject() is not yet called and document is + // nsIDocument::SetScriptGlobalObject() is not yet called and document is // hidden state. Therefore the MediaDecoder decides that decoding is - // not yet necessary. But soon after nsDocument::SetScriptGlobalObject() + // not yet necessary. But soon after nsIDocument::SetScriptGlobalObject() // call, the document becomes not hidden. At the time, MediaDecoder needs // to know it and needs to start updating decoding. if (oldState != mVisibilityState) { @@ -4616,8 +4614,8 @@ void nsIDocument::MaybeEndOutermostXBLUpdate() { } else if (!mInDestructor) { if (!mMaybeEndOutermostXBLUpdateRunner) { mMaybeEndOutermostXBLUpdateRunner = - NewRunnableMethod("nsDocument::MaybeEndOutermostXBLUpdate", this, - &nsDocument::MaybeEndOutermostXBLUpdate); + NewRunnableMethod("nsIDocument::MaybeEndOutermostXBLUpdate", this, + &nsIDocument::MaybeEndOutermostXBLUpdate); } nsContentUtils::AddScriptRunner(mMaybeEndOutermostXBLUpdateRunner); } @@ -7290,7 +7288,7 @@ already_AddRefed nsIDocument::CreateElem(const nsAString& aName, // which would cause an error if we just used true here. bool nsAware = aPrefix != nullptr || aNamespaceID != GetDefaultNamespaceID(); NS_ASSERTION(NS_SUCCEEDED(nsContentUtils::CheckQName(qName, nsAware)), - "Don't pass invalid prefixes to nsDocument::CreateElem, " + "Don't pass invalid prefixes to nsIDocument::CreateElem, " "check caller."); #endif @@ -7974,14 +7972,14 @@ void nsIDocument::OnPageHide(bool aPersisted, EventTarget* aDispatchStartTarget, // root document, as this will exit fullscreen in all the root's // descendant documents. Note that documents are removed from the // doctree by the time OnPageHide() is called, so we must store a - // reference to the root (in nsDocument::mFullscreenRoot) since we can't + // reference to the root (in nsIDocument::mFullscreenRoot) since we can't // just traverse the doctree to get the root. nsIDocument::ExitFullscreenInDocTree(this); // Since the document is removed from the doctree before OnPageHide() is // called, ExitFullscreen() can't traverse from the root down to *this* // document, so we must manually call CleanupFullscreenState() below too. - // Note that CleanupFullscreenState() clears nsDocument::mFullscreenRoot, + // Note that CleanupFullscreenState() clears nsIDocument::mFullscreenRoot, // so we *must* call it after ExitFullscreen(), not before. // OnPageHide() is called in every hidden (i.e. descendant) document, // so calling CleanupFullscreenState() here will ensure all hidden @@ -8157,7 +8155,7 @@ nsresult nsIDocument::CloneDocHelper(nsIDocument* clone) const { clone->SetContentTypeInternal(GetContentTypeInternal()); clone->mSecurityInfo = mSecurityInfo; - // State from nsDocument + // State from nsIDocument clone->mType = mType; clone->mXMLDeclarationBits = mXMLDeclarationBits; clone->mBaseTarget = mBaseTarget; @@ -8582,18 +8580,15 @@ nsIDocument* nsIDocument::GetTemplateContentsOwner() { mTemplateContentsOwner = document; NS_ENSURE_TRUE(mTemplateContentsOwner, nullptr); - nsDocument* doc = static_cast(mTemplateContentsOwner.get()); - if (!scriptObject) { mTemplateContentsOwner->SetScopeObject(GetScopeObject()); } - doc->mHasHadScriptHandlingObject = hasHadScriptObject; + mTemplateContentsOwner->mHasHadScriptHandlingObject = hasHadScriptObject; - // Set |doc| as the template contents owner of itself so that - // |doc| is the template contents owner of template elements created - // by |doc|. - doc->mTemplateContentsOwner = doc; + // Set |mTemplateContentsOwner| as the template contents owner of itself so + // that it is the template contents owner of nested template elements. + mTemplateContentsOwner->mTemplateContentsOwner = mTemplateContentsOwner; } return mTemplateContentsOwner; @@ -8877,24 +8872,22 @@ void nsIDocument::FlushPendingLinkUpdates() { already_AddRefed nsIDocument::CreateStaticClone( nsIDocShell* aCloneContainer) { - nsDocument* thisAsDoc = static_cast(this); mCreatingStaticClone = true; // Make document use different container during cloning. RefPtr originalShell = mDocumentContainer.get(); SetContainer(static_cast(aCloneContainer)); ErrorResult rv; - nsCOMPtr clonedNode = thisAsDoc->CloneNode(true, rv); + nsCOMPtr clonedNode = this->CloneNode(true, rv); SetContainer(originalShell); - RefPtr clonedDoc; + nsCOMPtr clonedDoc; if (rv.Failed()) { // Don't return yet; we need to reset mCreatingStaticClone rv.SuppressException(); } else { - nsCOMPtr tmp = do_QueryInterface(clonedNode); - if (tmp) { - clonedDoc = static_cast(tmp.get()); + clonedDoc = do_QueryInterface(clonedNode); + if (clonedDoc) { if (IsStaticDocument()) { clonedDoc->mOriginalDocument = mOriginalDocument; } else { @@ -9716,7 +9709,7 @@ bool FullscreenRoots::IsEmpty() { return !sInstance; } // Any fullscreen change waiting for the widget to finish transition // is queued here. This is declared static instead of a member of -// nsDocument because in the majority of time, there would be at most +// nsIDocument because in the majority of time, there would be at most // one document requesting or exiting fullscreen. We shouldn't waste // the space to hold for it in every document. class PendingFullscreenChangeList { @@ -10577,7 +10570,7 @@ bool nsIDocument::ApplyFullscreen(UniquePtr aRequest) { } nsIDocument* parent = child->GetParentDocument(); Element* element = parent->FindContentForSubDocument(child); - if (static_cast(parent)->FullscreenStackPush(element)) { + if (parent->FullscreenStackPush(element)) { changed.AppendElement(parent); child = parent; } else { @@ -10761,18 +10754,17 @@ NS_IMETHODIMP PointerLockRequest::Run() { nsCOMPtr e = do_QueryReferent(mElement); nsCOMPtr doc = do_QueryReferent(mDocument); - nsDocument* d = static_cast(doc.get()); const char* error = nullptr; - if (!e || !d || !e->GetComposedDoc()) { + if (!e || !doc || !e->GetComposedDoc()) { error = "PointerLockDeniedNotInDocument"; - } else if (e->GetComposedDoc() != d) { + } else if (e->GetComposedDoc() != doc) { error = "PointerLockDeniedMovedDocument"; } if (!error) { nsCOMPtr pointerLockedElement = do_QueryReferent(EventStateManager::sPointerLockedElement); if (e == pointerLockedElement) { - DispatchPointerLockChange(d); + DispatchPointerLockChange(doc); return NS_OK; } // Note, we must bypass focus change, so pass true as the last parameter! @@ -10780,7 +10772,7 @@ PointerLockRequest::Run() { // Another element in the same document is requesting pointer lock, // just grant it without user input check. if (!error && pointerLockedElement) { - ChangePointerLockedElement(e, d, pointerLockedElement); + ChangePointerLockedElement(e, doc, pointerLockedElement); return NS_OK; } } @@ -10789,15 +10781,15 @@ PointerLockRequest::Run() { if (!error && !mUserInputOrChromeCaller && !doc->GetFullscreenElement()) { error = "PointerLockDeniedNotInputDriven"; } - if (!error && !d->SetPointerLock(e, NS_STYLE_CURSOR_NONE)) { + if (!error && !doc->SetPointerLock(e, NS_STYLE_CURSOR_NONE)) { error = "PointerLockDeniedFailedToLock"; } if (error) { - DispatchPointerLockError(d, error); + DispatchPointerLockError(doc, error); return NS_OK; } - ChangePointerLockedElement(e, d, nullptr); + ChangePointerLockedElement(e, doc, nullptr); nsContentUtils::DispatchEventOnlyToChrome( doc, ToSupports(e), NS_LITERAL_STRING("MozDOMPointerLock:Entered"), CanBubble::eYes, Cancelable::eNo, /* DefaultAction */ nullptr); @@ -10807,7 +10799,7 @@ PointerLockRequest::Run() { void nsIDocument::RequestPointerLock(Element* aElement, CallerType aCallerType) { NS_ASSERTION(aElement, - "Must pass non-null element to nsDocument::RequestPointerLock"); + "Must pass non-null element to nsIDocument::RequestPointerLock"); nsCOMPtr pointerLockedElement = do_QueryReferent(EventStateManager::sPointerLockedElement); @@ -11189,8 +11181,7 @@ nsIDocument* nsIDocument::GetTopLevelContentDocument() { return nullptr; } - nsIDocument* candidate = parent->GetParentDocument(); - parent = static_cast(candidate); + parent = parent->GetParentDocument(); } while (parent); return parent; @@ -11306,8 +11297,8 @@ bool nsIDocument::InlineScriptAllowedByCSP() { static bool ReportExternalResourceUseCounters(nsIDocument* aDocument, void* aData) { const auto reportKind = - nsDocument::UseCounterReportKind::eIncludeExternalResources; - static_cast(aDocument)->ReportUseCounters(reportKind); + nsIDocument::UseCounterReportKind::eIncludeExternalResources; + aDocument->ReportUseCounters(reportKind); return true; } @@ -11461,8 +11452,8 @@ void nsIDocument::ScheduleIntersectionObserverNotification() { } MOZ_RELEASE_ASSERT(NS_IsMainThread()); nsCOMPtr notification = - NewRunnableMethod("nsDocument::NotifyIntersectionObservers", this, - &nsDocument::NotifyIntersectionObservers); + NewRunnableMethod("nsIDocument::NotifyIntersectionObservers", this, + &nsIDocument::NotifyIntersectionObservers); Dispatch(TaskCategory::Other, notification.forget()); } @@ -12065,7 +12056,7 @@ FlashClassification nsIDocument::PrincipalFlashClassification() { } /** - * Helper function for |nsDocument::PrincipalFlashClassification| + * Helper function for |nsIDocument::PrincipalFlashClassification| * * Adds a table name string to a table list (a comma separated string). The * table will not be added if the name is an empty string. @@ -12082,7 +12073,7 @@ static void MaybeAddTableToTableList(const nsACString& aTableNames, } /** - * Helper function for |nsDocument::PrincipalFlashClassification| + * Helper function for |nsIDocument::PrincipalFlashClassification| * * Takes an array of table names and a comma separated list of table names * Returns |true| if any table name in the array matches a table name in the @@ -12487,7 +12478,7 @@ FlashClassification nsIDocument::DocumentFlashClassification() { mFlashClassification = result; MOZ_ASSERT( result != FlashClassification::Unclassified, - "nsDocument::GetPluginClassification should never return Unclassified"); + "nsIDocument::GetPluginClassification should never return Unclassified"); } return mFlashClassification; diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h deleted file mode 100644 index 5aef98593d1e..000000000000 --- a/dom/base/nsDocument.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- 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/. */ - -/* - * Base class for all our document implementations. - */ - -#ifndef nsDocument_h___ -#define nsDocument_h___ - -#include "nsIDocument.h" - -#define XML_DECLARATION_BITS_DECLARATION_EXISTS (1 << 0) -#define XML_DECLARATION_BITS_ENCODING_EXISTS (1 << 1) -#define XML_DECLARATION_BITS_STANDALONE_EXISTS (1 << 2) -#define XML_DECLARATION_BITS_STANDALONE_YES (1 << 3) - -// Base class for our document implementations. -class nsDocument : public nsIDocument { - protected: - - explicit nsDocument(const char* aContentType); - virtual ~nsDocument(); - - // Don't add stuff here, add to nsIDocument instead. - - private: - nsDocument(const nsDocument& aOther) = delete; - nsDocument& operator=(const nsDocument& aOther) = delete; -}; - -#endif /* nsDocument_h___ */ diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index b2e5e9195b20..a9d430adf325 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -13,7 +13,7 @@ #include "nsGkAtoms.h" #include "nsGlobalWindow.h" #include "nsContentUtils.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "nsIContentParent.h" #include "nsPIDOMWindow.h" #include "nsIDOMChromeWindow.h" @@ -986,7 +986,7 @@ nsFocusManager::FireDelayedEvents(nsIDocument* aDocument) { !aDocument->GetInnerWindow()->IsCurrentInnerWindow()) { // If the document was navigated away from or is defunct, don't bother // firing events on it. Note the symmetry between this condition and - // the similar one in nsDocument.cpp:FireOrClearDelayedEvents. + // the similar one in nsIDocument.cpp:FireOrClearDelayedEvents. mDelayedBlurFocusEvents.RemoveElementAt(i); --i; } else if (!aDocument->EventHandlingSuppressed()) { diff --git a/dom/base/nsGlobalWindowInner.cpp b/dom/base/nsGlobalWindowInner.cpp index 6ba86bff9224..d6cf2971f1b0 100644 --- a/dom/base/nsGlobalWindowInner.cpp +++ b/dom/base/nsGlobalWindowInner.cpp @@ -1999,7 +1999,7 @@ nsresult nsGlobalWindowInner::PostHandleEvent(EventChainPostVisitor& aVisitor) { } else if (aVisitor.mEvent->mMessage == eLoad && aVisitor.mEvent->IsTrusted()) { // This is page load event since load events don't propagate to |window|. - // @see nsDocument::GetEventTargetParent. + // @see nsIDocument::GetEventTargetParent. mIsDocumentLoaded = true; mTimeoutManager->OnDocumentLoaded(); diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index 91313fd094d7..589dc4a43839 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -451,6 +451,12 @@ class nsIDocument : public nsINode, template using NotNull = mozilla::NotNull; + explicit nsIDocument(const char* aContentType); + virtual ~nsIDocument(); + + nsIDocument(const nsIDocument&) = delete; + nsIDocument& operator=(const nsIDocument&) = delete; + public: typedef nsExternalResourceMap::ExternalResourceLoad ExternalResourceLoad; typedef mozilla::FullscreenRequest FullscreenRequest; @@ -478,10 +484,6 @@ class nsIDocument : public nsINode, } \ } while (0) -#ifdef MOZILLA_INTERNAL_API - nsIDocument(); -#endif - // nsIApplicationCacheContainer NS_DECL_NSIAPPLICATIONCACHECONTAINER @@ -624,7 +626,7 @@ class nsIDocument : public nsINode, /** * Signal that the document title may have changed - * (see nsDocument::GetTitle). + * (see nsIDocument::GetTitle). * @param aBoundTitleElement true if an HTML or SVG element * has just been bound to the document. */ @@ -1902,7 +1904,7 @@ class nsIDocument : public nsINode, // Notify that a document state has changed. // This should only be called by callers whose state is also reflected in the - // implementation of nsDocument::GetDocumentState. + // implementation of nsIDocument::GetDocumentState. void DocumentStatesChanged(mozilla::EventStates aStateMask); // Observation hooks for style data to propagate notifications @@ -3624,8 +3626,6 @@ class nsIDocument : public nsINode, } } - ~nsIDocument(); - // Never ever call this. Only call GetWindow! nsPIDOMWindowOuter* GetWindowInternal() const; @@ -3813,7 +3813,7 @@ class nsIDocument : public nsINode, // This flag is only set in XMLDocument, for e.g. documents used in XBL. We // don't want animations to play in such documents, so we need to store the - // flag here so that we can check it in nsDocument::GetAnimationController. + // flag here so that we can check it in nsIDocument::GetAnimationController. bool mLoadedAsInteractiveData : 1; // If true, whoever is creating the document has gotten it to the @@ -4108,7 +4108,7 @@ class nsIDocument : public nsINode, nsCString mContentLanguage; - // The channel that got passed to nsDocument::StartDocumentLoad(), if any. + // The channel that got passed to nsIDocument::StartDocumentLoad(), if any. nsCOMPtr<nsIChannel> mChannel; private: @@ -4313,6 +4313,8 @@ class nsIDocument : public nsINode, nsDocHeaderData* mHeaderData; + // For determining if this is a flash document which should be + // blocked based on its principal. RefPtr<PrincipalFlashClassifier> mPrincipalFlashClassifier; mozilla::dom::FlashClassification mFlashClassification; // Do not use this value directly. Call the |IsThirdParty()| method, which diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp index f445faf38357..0295e5bd3a51 100644 --- a/dom/base/nsINode.cpp +++ b/dom/base/nsINode.cpp @@ -43,7 +43,7 @@ #include "nsContentList.h" #include "nsContentUtils.h" #include "nsCycleCollectionParticipant.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "mozilla/dom/Attr.h" #include "nsDOMAttributeMap.h" #include "nsDOMCID.h" @@ -1791,7 +1791,7 @@ void nsINode::RemoveChildNode(nsIContent* aKid, bool aNotify) { // nsIDocument::GetRootElement() calls until *after* it has removed aKid from // aChildArray. Any calls before then could potentially restore a stale // value for our cached root element, per note in - // nsDocument::RemoveChildNode(). + // nsIDocument::RemoveChildNode(). MOZ_ASSERT(aKid && aKid->GetParentNode() == this, "Bogus aKid"); MOZ_ASSERT(!IsAttr()); diff --git a/dom/base/nsNodeInfoManager.cpp b/dom/base/nsNodeInfoManager.cpp index 06af241b75d5..ae9641e85deb 100644 --- a/dom/base/nsNodeInfoManager.cpp +++ b/dom/base/nsNodeInfoManager.cpp @@ -29,7 +29,7 @@ #include "nsHashKeys.h" #include "nsCCUncollectableMarker.h" #include "nsNameSpaceManager.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "nsWindowSizes.h" using namespace mozilla; @@ -85,21 +85,21 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsNodeInfoManager, Release) NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsNodeInfoManager) if (tmp->mDocument) { - return NS_CYCLE_COLLECTION_PARTICIPANT(nsDocument) + return NS_CYCLE_COLLECTION_PARTICIPANT(nsIDocument) ->CanSkip(tmp->mDocument, aRemovingAllowed); } NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsNodeInfoManager) if (tmp->mDocument) { - return NS_CYCLE_COLLECTION_PARTICIPANT(nsDocument) + return NS_CYCLE_COLLECTION_PARTICIPANT(nsIDocument) ->CanSkipInCC(tmp->mDocument); } NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsNodeInfoManager) if (tmp->mDocument) { - return NS_CYCLE_COLLECTION_PARTICIPANT(nsDocument) + return NS_CYCLE_COLLECTION_PARTICIPANT(nsIDocument) ->CanSkipThis(tmp->mDocument); } NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END diff --git a/dom/base/nsNodeUtils.cpp b/dom/base/nsNodeUtils.cpp index 84660e17c16a..4152ee51540a 100644 --- a/dom/base/nsNodeUtils.cpp +++ b/dom/base/nsNodeUtils.cpp @@ -18,7 +18,7 @@ #include "PLDHashTable.h" #include "nsCOMArray.h" #include "nsPIDOMWindow.h" -#include "nsDocument.h" +#include "nsIDocument.h" #ifdef MOZ_XUL #include "nsXULElement.h" #endif diff --git a/dom/base/nsObjectLoadingContent.cpp b/dom/base/nsObjectLoadingContent.cpp index c880b6e41ae8..205bbeaa2ed4 100644 --- a/dom/base/nsObjectLoadingContent.cpp +++ b/dom/base/nsObjectLoadingContent.cpp @@ -918,7 +918,7 @@ nsresult nsObjectLoadingContent::BuildParametersArray() { void nsObjectLoadingContent::NotifyOwnerDocumentActivityChanged() { // XXX(johns): We cannot touch plugins or run arbitrary script from this call, - // as nsDocument is in a non-reentrant state. + // as nsIDocument is in a non-reentrant state. // If we have a plugin we want to queue an event to stop it unless we are // moved into an active document before returning to the event loop. diff --git a/dom/base/nsObjectLoadingContent.h b/dom/base/nsObjectLoadingContent.h index 5f5c3a5b0a48..86af042fe9e5 100644 --- a/dom/base/nsObjectLoadingContent.h +++ b/dom/base/nsObjectLoadingContent.h @@ -155,7 +155,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent, /** * Notify this class the document state has changed - * Called by nsDocument so we may suspend plugins in inactive documents) + * Called by nsIDocument so we may suspend plugins in inactive documents) */ void NotifyOwnerDocumentActivityChanged(); diff --git a/dom/base/nsTextNode.cpp b/dom/base/nsTextNode.cpp index de1f10327a7c..72def9f81b12 100644 --- a/dom/base/nsTextNode.cpp +++ b/dom/base/nsTextNode.cpp @@ -20,7 +20,7 @@ #ifdef DEBUG #include "nsRange.h" #endif -#include "nsDocument.h" +#include "nsIDocument.h" using namespace mozilla; using namespace mozilla::dom; diff --git a/dom/console/Console.cpp b/dom/console/Console.cpp index 1caa8b1ab80a..3ae2a69732f8 100644 --- a/dom/console/Console.cpp +++ b/dom/console/Console.cpp @@ -28,7 +28,7 @@ #include "mozilla/Maybe.h" #include "mozilla/StaticPrefs.h" #include "nsCycleCollectionParticipant.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "nsDOMNavigationTiming.h" #include "nsGlobalWindow.h" #include "nsJSUtils.h" diff --git a/dom/html/HTMLImageElement.cpp b/dom/html/HTMLImageElement.cpp index 7ae60b2b7757..8288edc4e6e2 100644 --- a/dom/html/HTMLImageElement.cpp +++ b/dom/html/HTMLImageElement.cpp @@ -11,7 +11,7 @@ #include "nsPresContext.h" #include "nsMappedAttributes.h" #include "nsSize.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "nsIDocument.h" #include "nsImageFrame.h" #include "nsIScriptContext.h" diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index 13f2a2f99313..210ba0a86e63 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -51,7 +51,7 @@ #include "nsIServiceManager.h" #include "nsError.h" #include "nsIEditor.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "nsAttrValueOrString.h" #include "nsDateTimeControlFrame.h" diff --git a/dom/html/HTMLSlotElement.cpp b/dom/html/HTMLSlotElement.cpp index 1124b9834307..d201da8d4d62 100644 --- a/dom/html/HTMLSlotElement.cpp +++ b/dom/html/HTMLSlotElement.cpp @@ -10,7 +10,7 @@ #include "mozilla/dom/HTMLUnknownElement.h" #include "mozilla/dom/ShadowRoot.h" #include "nsGkAtoms.h" -#include "nsDocument.h" +#include "nsIDocument.h" nsGenericHTMLElement* NS_NewHTMLSlotElement( already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, diff --git a/dom/html/HTMLUnknownElement.cpp b/dom/html/HTMLUnknownElement.cpp index 055de1f86b74..e85f822ec8ae 100644 --- a/dom/html/HTMLUnknownElement.cpp +++ b/dom/html/HTMLUnknownElement.cpp @@ -4,7 +4,7 @@ * 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/. */ -#include "nsDocument.h" +#include "nsIDocument.h" #include "mozilla/dom/HTMLUnknownElement.h" #include "mozilla/dom/HTMLElementBinding.h" #include "jsapi.h" diff --git a/dom/html/MediaDocument.cpp b/dom/html/MediaDocument.cpp index d421ad69633c..ed24e59a720c 100644 --- a/dom/html/MediaDocument.cpp +++ b/dom/html/MediaDocument.cpp @@ -143,7 +143,7 @@ nsresult MediaDocument::StartDocumentLoad(const char* aCommand, nsISupports* aContainer, nsIStreamListener** aDocListener, bool aReset, nsIContentSink* aSink) { - nsresult rv = nsDocument::StartDocumentLoad( + nsresult rv = nsIDocument::StartDocumentLoad( aCommand, aChannel, aLoadGroup, aContainer, aDocListener, aReset, aSink); if (NS_FAILED(rv)) { return rv; @@ -274,7 +274,7 @@ void MediaDocument::GetFileName(nsAString& aResult, nsIChannel* aChannel) { nsAutoCString docCharset; // Now that the charset is set in |StartDocumentLoad| to the charset of // the document viewer instead of a bogus value ("windows-1252" set in - // |nsDocument|'s ctor), the priority is given to the current charset. + // |nsIDocument|'s ctor), the priority is given to the current charset. // This is necessary to deal with a media document being opened in a new // window or a new tab. if (mCharacterSetSource != kCharsetUninitialized) { diff --git a/dom/html/nsHTMLDocument.cpp b/dom/html/nsHTMLDocument.cpp index 07d430b433ed..1c839aa380e4 100644 --- a/dom/html/nsHTMLDocument.cpp +++ b/dom/html/nsHTMLDocument.cpp @@ -165,7 +165,7 @@ nsresult NS_NewHTMLDocument(nsIDocument** aInstancePtrResult, } nsHTMLDocument::nsHTMLDocument() - : nsDocument("text/html"), + : nsIDocument("text/html"), mContentListHolder(nullptr), mNumForms(0), mWriteLevel(0), @@ -184,10 +184,10 @@ nsHTMLDocument::nsHTMLDocument() nsHTMLDocument::~nsHTMLDocument() {} -NS_IMPL_CYCLE_COLLECTION_INHERITED(nsHTMLDocument, nsDocument, mAll, +NS_IMPL_CYCLE_COLLECTION_INHERITED(nsHTMLDocument, nsIDocument, mAll, mWyciwygChannel, mMidasCommandManager) -NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(nsHTMLDocument, nsDocument, +NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(nsHTMLDocument, nsIDocument, nsIHTMLDocument) JSObject* nsHTMLDocument::WrapNode(JSContext* aCx, @@ -196,7 +196,7 @@ JSObject* nsHTMLDocument::WrapNode(JSContext* aCx, } nsresult nsHTMLDocument::Init() { - nsresult rv = nsDocument::Init(); + nsresult rv = nsIDocument::Init(); NS_ENSURE_SUCCESS(rv, rv); // Now reset the compatibility mode of the CSSLoader @@ -207,7 +207,7 @@ nsresult nsHTMLDocument::Init() { } void nsHTMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) { - nsDocument::Reset(aChannel, aLoadGroup); + nsIDocument::Reset(aChannel, aLoadGroup); if (aChannel) { aChannel->GetLoadFlags(&mLoadFlags); @@ -218,7 +218,7 @@ void nsHTMLDocument::ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup, nsIPrincipal* aPrincipal) { mLoadFlags = nsIRequest::LOAD_NORMAL; - nsDocument::ResetToURI(aURI, aLoadGroup, aPrincipal); + nsIDocument::ResetToURI(aURI, aLoadGroup, aPrincipal); mImages = nullptr; mApplets = nullptr; @@ -443,7 +443,7 @@ void nsHTMLDocument::TryFallback(int32_t& aCharsetSource, void nsHTMLDocument::SetDocumentCharacterSet( NotNull<const Encoding*> aEncoding) { - nsDocument::SetDocumentCharacterSet(aEncoding); + nsIDocument::SetDocumentCharacterSet(aEncoding); // Make sure to stash this charset on our channel as needed if it's a wyciwyg // channel. nsCOMPtr<nsIWyciwygChannel> wyciwygChannel = do_QueryInterface(mChannel); @@ -526,7 +526,7 @@ nsresult nsHTMLDocument::StartDocumentLoad(const char* aCommand, CSSLoader()->SetCompatibilityMode(mCompatMode); - nsresult rv = nsDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup, + nsresult rv = nsIDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener, aReset); if (NS_FAILED(rv)) { return rv; @@ -771,7 +771,7 @@ void nsHTMLDocument::StopDocumentLoad() { "nsHTMLDocument::StopDocumentLoad(): " "nsIWyciwygChannel could not be removed!"); - nsDocument::StopDocumentLoad(); + nsIDocument::StopDocumentLoad(); UnblockOnload(false); } @@ -785,14 +785,14 @@ void nsHTMLDocument::BeginLoad() { TurnEditingOff(); EditingStateChanged(); } - nsDocument::BeginLoad(); + nsIDocument::BeginLoad(); } void nsHTMLDocument::EndLoad() { bool turnOnEditing = mParser && (HasFlag(NODE_IS_EDITABLE) || mContentEditableCount > 0); - // Note: nsDocument::EndLoad nulls out mParser. - nsDocument::EndLoad(); + // Note: nsIDocument::EndLoad nulls out mParser. + nsIDocument::EndLoad(); if (turnOnEditing) { EditingStateChanged(); } @@ -816,7 +816,7 @@ nsIContent* nsHTMLDocument::GetUnfocusedKeyEventTarget() { if (nsGenericHTMLElement* body = GetBody()) { return body; } - return nsDocument::GetUnfocusedKeyEventTarget(); + return nsIDocument::GetUnfocusedKeyEventTarget(); } already_AddRefed<nsIURI> nsHTMLDocument::GetDomainURI() { @@ -2022,7 +2022,7 @@ void nsHTMLDocument::MaybeEditingStateChanged() { void nsHTMLDocument::EndUpdate() { const bool reset = !mPendingMaybeEditingStateChanged; mPendingMaybeEditingStateChanged = true; - nsDocument::EndUpdate(); + nsIDocument::EndUpdate(); if (reset) { mPendingMaybeEditingStateChanged = false; } @@ -3100,12 +3100,12 @@ bool nsHTMLDocument::IsEditingOnAfterFlush() { void nsHTMLDocument::RemovedFromDocShell() { mEditingState = eOff; - nsDocument::RemovedFromDocShell(); + nsIDocument::RemovedFromDocShell(); } /* virtual */ void nsHTMLDocument::DocAddSizeOfExcludingThis( nsWindowSizes& aWindowSizes) const { - nsDocument::DocAddSizeOfExcludingThis(aWindowSizes); + nsIDocument::DocAddSizeOfExcludingThis(aWindowSizes); // Measurement of the following members may be added later if DMD finds it is // worthwhile: diff --git a/dom/html/nsHTMLDocument.h b/dom/html/nsHTMLDocument.h index f65ed0037b91..2d706f179f76 100644 --- a/dom/html/nsHTMLDocument.h +++ b/dom/html/nsHTMLDocument.h @@ -8,7 +8,7 @@ #include "mozilla/Attributes.h" #include "nsContentList.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "nsIHTMLDocument.h" #include "nsIHTMLCollection.h" #include "nsIScriptElement.h" @@ -33,18 +33,18 @@ class HTMLAllCollection; } // namespace dom } // namespace mozilla -class nsHTMLDocument : public nsDocument, public nsIHTMLDocument { +class nsHTMLDocument : public nsIDocument, public nsIHTMLDocument { typedef mozilla::net::ReferrerPolicy ReferrerPolicy; public: - using nsDocument::GetPlugins; - using nsDocument::SetDocumentURI; + using nsIDocument::GetPlugins; + using nsIDocument::SetDocumentURI; nsHTMLDocument(); virtual nsresult Init() override; NS_DECL_ISUPPORTS_INHERITED - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLDocument, nsDocument) + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLDocument, nsIDocument) // nsIDocument virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) override; diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 28a8ee8a8e47..8acfcf5951d6 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -977,7 +977,7 @@ nsresult ContentChild::ProvideWindowCommon( // Set the opener window for this window before we start loading the // document inside of it. We have to do this before loading the remote - // scripts, because they can poke at the document and cause the nsDocument + // scripts, because they can poke at the document and cause the nsIDocument // to be created before the openerwindow nsCOMPtr<mozIDOMWindowProxy> windowProxy = do_GetInterface(newChild->WebNavigation()); diff --git a/dom/smil/SMILAnimationController.h b/dom/smil/SMILAnimationController.h index 3d27bca85368..7627c4410ed5 100644 --- a/dom/smil/SMILAnimationController.h +++ b/dom/smil/SMILAnimationController.h @@ -33,7 +33,7 @@ class SVGAnimationElement; // // The animation controller maintains the animation timer and determines the // sample times and sample rate for all SMIL animations in a document. There is -// at most one animation controller per nsDocument so that frame-rate tuning can +// at most one animation controller per document so that frame-rate tuning can // be performed at a document-level. // // The animation controller can contain many child time containers (timed diff --git a/dom/smil/nsSMILCompositorTable.h b/dom/smil/nsSMILCompositorTable.h index c8b8bf445509..0e0ecc5e0598 100644 --- a/dom/smil/nsSMILCompositorTable.h +++ b/dom/smil/nsSMILCompositorTable.h @@ -13,7 +13,7 @@ // nsSMILCompositorTable : A hashmap of nsSMILCompositors // // This is just a forward-declaration because it is included in -// SMILAnimationController which is used in nsDocument. We don't want to +// SMILAnimationController which is used in nsIDocument. We don't want to // expose all of nsSMILCompositor or otherwise any changes to it will mean the // whole world will need to be rebuilt. diff --git a/dom/webidl/Animatable.webidl b/dom/webidl/Animatable.webidl index 664ec8ea282a..17ffd8d0b47f 100644 --- a/dom/webidl/Animatable.webidl +++ b/dom/webidl/Animatable.webidl @@ -23,6 +23,6 @@ interface Animatable { [Throws] Animation animate(object? keyframes, optional UnrestrictedDoubleOrKeyframeAnimationOptions options); - [Func="nsDocument::IsWebAnimationsGetAnimationsEnabled"] + [Func="nsIDocument::IsWebAnimationsGetAnimationsEnabled"] sequence<Animation> getAnimations(optional AnimationFilter filter); }; diff --git a/dom/webidl/Animation.webidl b/dom/webidl/Animation.webidl index 54e586b01f98..4eadc85f590c 100644 --- a/dom/webidl/Animation.webidl +++ b/dom/webidl/Animation.webidl @@ -16,9 +16,9 @@ enum AnimationPlayState { "idle", "running", "paused", "finished" }; optional AnimationTimeline? timeline)] interface Animation : EventTarget { attribute DOMString id; - [Func="nsDocument::IsWebAnimationsEnabled", Pure] + [Func="nsIDocument::IsWebAnimationsEnabled", Pure] attribute AnimationEffect? effect; - [Func="nsDocument::AreWebAnimationsTimelinesEnabled"] + [Func="nsIDocument::AreWebAnimationsTimelinesEnabled"] attribute AnimationTimeline? timeline; [BinaryName="startTimeAsDouble"] attribute double? startTime; @@ -30,9 +30,9 @@ interface Animation : EventTarget { readonly attribute AnimationPlayState playState; [BinaryName="pendingFromJS"] readonly attribute boolean pending; - [Func="nsDocument::IsWebAnimationsEnabled", Throws] + [Func="nsIDocument::IsWebAnimationsEnabled", Throws] readonly attribute Promise<Animation> ready; - [Func="nsDocument::IsWebAnimationsEnabled", Throws] + [Func="nsIDocument::IsWebAnimationsEnabled", Throws] readonly attribute Promise<Animation> finished; attribute EventHandler onfinish; attribute EventHandler oncancel; diff --git a/dom/webidl/AnimationEffect.webidl b/dom/webidl/AnimationEffect.webidl index 81a04b2193f2..ae37ccf302a9 100644 --- a/dom/webidl/AnimationEffect.webidl +++ b/dom/webidl/AnimationEffect.webidl @@ -55,7 +55,7 @@ dictionary ComputedEffectTiming : EffectTiming { unrestricted double? currentIteration = null; }; -[Func="nsDocument::IsWebAnimationsEnabled"] +[Func="nsIDocument::IsWebAnimationsEnabled"] interface AnimationEffect { EffectTiming getTiming(); [BinaryName="getComputedTimingAsDict"] diff --git a/dom/webidl/AnimationPlaybackEvent.webidl b/dom/webidl/AnimationPlaybackEvent.webidl index db8136eae66e..329006037677 100644 --- a/dom/webidl/AnimationPlaybackEvent.webidl +++ b/dom/webidl/AnimationPlaybackEvent.webidl @@ -10,7 +10,7 @@ * liability, trademark and document use rules apply. */ -[Func="nsDocument::IsWebAnimationsEnabled", +[Func="nsIDocument::IsWebAnimationsEnabled", Constructor(DOMString type, optional AnimationPlaybackEventInit eventInitDict)] interface AnimationPlaybackEvent : Event { diff --git a/dom/webidl/AnimationTimeline.webidl b/dom/webidl/AnimationTimeline.webidl index 7a1bc0cb713c..d00aea7caca1 100644 --- a/dom/webidl/AnimationTimeline.webidl +++ b/dom/webidl/AnimationTimeline.webidl @@ -10,7 +10,7 @@ * liability, trademark and document use rules apply. */ -[Func="nsDocument::AreWebAnimationsTimelinesEnabled"] +[Func="nsIDocument::AreWebAnimationsTimelinesEnabled"] interface AnimationTimeline { [BinaryName="currentTimeAsDouble"] readonly attribute double? currentTime; diff --git a/dom/webidl/CSSAnimation.webidl b/dom/webidl/CSSAnimation.webidl index 63abf6c7a39a..ca5fc7d001c1 100644 --- a/dom/webidl/CSSAnimation.webidl +++ b/dom/webidl/CSSAnimation.webidl @@ -10,7 +10,7 @@ * liability, trademark and document use rules apply. */ -[Func="nsDocument::IsWebAnimationsGetAnimationsEnabled", +[Func="nsIDocument::IsWebAnimationsGetAnimationsEnabled", HeaderFile="nsAnimationManager.h"] interface CSSAnimation : Animation { [Constant] readonly attribute DOMString animationName; diff --git a/dom/webidl/CSSPseudoElement.webidl b/dom/webidl/CSSPseudoElement.webidl index 903cf3dd44f3..8659872c6b95 100644 --- a/dom/webidl/CSSPseudoElement.webidl +++ b/dom/webidl/CSSPseudoElement.webidl @@ -15,7 +15,7 @@ // this interface. // What we implement here is a minimal subset of the two definitions which we // ship behind a pref until the specification issues have been resolved. -[Func="nsDocument::IsWebAnimationsGetAnimationsEnabled"] +[Func="nsIDocument::IsWebAnimationsGetAnimationsEnabled"] interface CSSPseudoElement { readonly attribute DOMString type; readonly attribute Element parentElement; diff --git a/dom/webidl/CSSTransition.webidl b/dom/webidl/CSSTransition.webidl index 25a8ca92d9ed..2d477944423e 100644 --- a/dom/webidl/CSSTransition.webidl +++ b/dom/webidl/CSSTransition.webidl @@ -10,7 +10,7 @@ * liability, trademark and document use rules apply. */ -[Func="nsDocument::IsWebAnimationsGetAnimationsEnabled", +[Func="nsIDocument::IsWebAnimationsGetAnimationsEnabled", HeaderFile="nsTransitionManager.h"] interface CSSTransition : Animation { [Constant] readonly attribute DOMString transitionProperty; diff --git a/dom/webidl/Document.webidl b/dom/webidl/Document.webidl index 7e9015185172..d716b0ff0fe2 100644 --- a/dom/webidl/Document.webidl +++ b/dom/webidl/Document.webidl @@ -261,24 +261,24 @@ partial interface Document { partial interface Document { // Note: Per spec the 'S' in these two is lowercase, but the "Moz" // versions have it uppercase. - [LenientSetter, Unscopable, Func="nsDocument::IsUnprefixedFullscreenEnabled"] + [LenientSetter, Unscopable, Func="nsIDocument::IsUnprefixedFullscreenEnabled"] readonly attribute boolean fullscreen; [BinaryName="fullscreen"] readonly attribute boolean mozFullScreen; - [LenientSetter, Func="nsDocument::IsUnprefixedFullscreenEnabled", NeedsCallerType] + [LenientSetter, Func="nsIDocument::IsUnprefixedFullscreenEnabled", NeedsCallerType] readonly attribute boolean fullscreenEnabled; [BinaryName="fullscreenEnabled", NeedsCallerType] readonly attribute boolean mozFullScreenEnabled; - [Throws, Func="nsDocument::IsUnprefixedFullscreenEnabled"] + [Throws, Func="nsIDocument::IsUnprefixedFullscreenEnabled"] Promise<void> exitFullscreen(); [Throws, BinaryName="exitFullscreen"] Promise<void> mozCancelFullScreen(); // Events handlers - [Func="nsDocument::IsUnprefixedFullscreenEnabled"] + [Func="nsIDocument::IsUnprefixedFullscreenEnabled"] attribute EventHandler onfullscreenchange; - [Func="nsDocument::IsUnprefixedFullscreenEnabled"] + [Func="nsIDocument::IsUnprefixedFullscreenEnabled"] attribute EventHandler onfullscreenerror; }; @@ -329,9 +329,9 @@ partial interface Document { // https://drafts.csswg.org/web-animations/#extensions-to-the-document-interface partial interface Document { - [Func="nsDocument::AreWebAnimationsTimelinesEnabled"] + [Func="nsIDocument::AreWebAnimationsTimelinesEnabled"] readonly attribute DocumentTimeline timeline; - [Func="nsDocument::IsWebAnimationsGetAnimationsEnabled"] + [Func="nsIDocument::IsWebAnimationsGetAnimationsEnabled"] sequence<Animation> getAnimations(); }; @@ -528,7 +528,7 @@ partial interface Document { }; partial interface Document { - [Func="nsDocument::DocumentSupportsL10n"] readonly attribute DocumentL10n? l10n; + [Func="nsIDocument::DocumentSupportsL10n"] readonly attribute DocumentL10n? l10n; }; Document implements XPathEvaluator; diff --git a/dom/webidl/DocumentTimeline.webidl b/dom/webidl/DocumentTimeline.webidl index 4837bd2ec79c..c7b8dd25d7b4 100644 --- a/dom/webidl/DocumentTimeline.webidl +++ b/dom/webidl/DocumentTimeline.webidl @@ -14,7 +14,7 @@ dictionary DocumentTimelineOptions { DOMHighResTimeStamp originTime = 0; }; -[Func="nsDocument::AreWebAnimationsTimelinesEnabled", +[Func="nsIDocument::AreWebAnimationsTimelinesEnabled", Constructor (optional DocumentTimelineOptions options)] interface DocumentTimeline : AnimationTimeline { }; diff --git a/dom/webidl/Element.webidl b/dom/webidl/Element.webidl index 95ef2f0bf86d..2523f316417d 100644 --- a/dom/webidl/Element.webidl +++ b/dom/webidl/Element.webidl @@ -240,7 +240,7 @@ partial interface Element { [BinaryName="shadowRootByMode"] readonly attribute ShadowRoot? shadowRoot; - [Func="nsDocument::IsCallerChromeOrAddon", BinaryName="shadowRoot"] + [Func="nsIDocument::IsCallerChromeOrAddon", BinaryName="shadowRoot"] readonly attribute ShadowRoot? openOrClosedShadowRoot; [BinaryName="assignedSlotByMode"] @@ -261,15 +261,15 @@ Element implements GeometryUtils; // https://fullscreen.spec.whatwg.org/#api partial interface Element { - [Throws, Func="nsDocument::IsUnprefixedFullscreenEnabled", NeedsCallerType] + [Throws, Func="nsIDocument::IsUnprefixedFullscreenEnabled", NeedsCallerType] Promise<void> requestFullscreen(); [Throws, BinaryName="requestFullscreen", NeedsCallerType, Deprecated="MozRequestFullScreenDeprecatedPrefix"] Promise<void> mozRequestFullScreen(); // Events handlers - [Func="nsDocument::IsUnprefixedFullscreenEnabled"] + [Func="nsIDocument::IsUnprefixedFullscreenEnabled"] attribute EventHandler onfullscreenchange; - [Func="nsDocument::IsUnprefixedFullscreenEnabled"] + [Func="nsIDocument::IsUnprefixedFullscreenEnabled"] attribute EventHandler onfullscreenerror; }; diff --git a/dom/webidl/KeyframeEffect.webidl b/dom/webidl/KeyframeEffect.webidl index 4d7e1ba632f9..47e09caccb7f 100644 --- a/dom/webidl/KeyframeEffect.webidl +++ b/dom/webidl/KeyframeEffect.webidl @@ -22,7 +22,7 @@ dictionary KeyframeEffectOptions : EffectTiming { // KeyframeEffect should run in the caller's compartment to do custom // processing on the `keyframes` object. -[Func="nsDocument::IsWebAnimationsEnabled", +[Func="nsIDocument::IsWebAnimationsEnabled", RunConstructorInCallerCompartment, Constructor ((Element or CSSPseudoElement)? target, object? keyframes, diff --git a/dom/xml/XMLDocument.cpp b/dom/xml/XMLDocument.cpp index c5fe4bf622fa..d191c35b31d2 100644 --- a/dom/xml/XMLDocument.cpp +++ b/dom/xml/XMLDocument.cpp @@ -125,12 +125,11 @@ nsresult NS_NewDOMDocument(nsIDocument** aInstancePtrResult, htmlDoc->SetCompatibilityMode(eCompatibility_FullStandards); htmlDoc->SetIsXHTML(isXHTML); } - nsDocument* doc = static_cast<nsDocument*>(d.get()); - doc->SetLoadedAsData(aLoadedAsData); - doc->nsDocument::SetDocumentURI(aDocumentURI); + d->SetLoadedAsData(aLoadedAsData); + d->SetDocumentURI(aDocumentURI); // Must set the principal first, since SetBaseURI checks it. - doc->SetPrincipal(aPrincipal); - doc->SetBaseURI(aBaseURI); + d->SetPrincipal(aPrincipal); + d->SetBaseURI(aBaseURI); // We need to set the script handling object after we set the principal such // that the doc group is assigned correctly. @@ -142,7 +141,7 @@ nsresult NS_NewDOMDocument(nsIDocument** aInstancePtrResult, // XMLDocuments and documents "created in memory" get to be UTF-8 by default, // unlike the legacy HTML mess - doc->SetDocumentCharacterSet(UTF_8_ENCODING); + d->SetDocumentCharacterSet(UTF_8_ENCODING); if (aDoctype) { ErrorResult result; @@ -162,7 +161,7 @@ nsresult NS_NewDOMDocument(nsIDocument** aInstancePtrResult, options.SetAsString(); nsCOMPtr<Element> root = - doc->CreateElementNS(aNamespaceURI, aQualifiedName, options, result); + d->CreateElementNS(aNamespaceURI, aQualifiedName, options, result); if (NS_WARN_IF(result.Failed())) { return result.StealNSResult(); } @@ -209,14 +208,13 @@ nsresult NS_NewXBLDocument(nsIDocument** aInstancePtrResult, aPrincipal, false, nullptr, DocumentFlavorLegacyGuess); NS_ENSURE_SUCCESS(rv, rv); - nsIDocument* idoc = *aInstancePtrResult; + nsIDocument* doc = *aInstancePtrResult; // XBL documents must allow XUL and XBL elements in them but the usual check // only checks if the document is loaded in the system principal which is // sometimes not the case. - idoc->ForceEnableXULXBL(); + doc->ForceEnableXULXBL(); - nsDocument* doc = static_cast<nsDocument*>(idoc); doc->SetLoadedAsInteractiveData(true); doc->SetReadyStateInternal(nsIDocument::READYSTATE_COMPLETE); @@ -227,7 +225,7 @@ namespace mozilla { namespace dom { XMLDocument::XMLDocument(const char* aContentType) - : nsDocument(aContentType), + : nsIDocument(aContentType), mChannelIsPending(false), mAsync(true), mLoopingForSyncLoad(false), @@ -243,14 +241,14 @@ XMLDocument::~XMLDocument() { } nsresult XMLDocument::Init() { - nsresult rv = nsDocument::Init(); + nsresult rv = nsIDocument::Init(); NS_ENSURE_SUCCESS(rv, rv); return rv; } void XMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) { - nsDocument::Reset(aChannel, aLoadGroup); + nsIDocument::Reset(aChannel, aLoadGroup); } void XMLDocument::ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup, @@ -261,7 +259,7 @@ void XMLDocument::ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup, mChannelIsPending = false; } - nsDocument::ResetToURI(aURI, aLoadGroup, aPrincipal); + nsIDocument::ResetToURI(aURI, aLoadGroup, aPrincipal); } bool XMLDocument::Load(const nsAString& aUrl, CallerType aCallerType, @@ -479,7 +477,7 @@ nsresult XMLDocument::StartDocumentLoad(const char* aCommand, nsISupports* aContainer, nsIStreamListener** aDocListener, bool aReset, nsIContentSink* aSink) { - nsresult rv = nsDocument::StartDocumentLoad( + nsresult rv = nsIDocument::StartDocumentLoad( aCommand, aChannel, aLoadGroup, aContainer, aDocListener, aReset, aSink); if (NS_FAILED(rv)) return rv; @@ -537,10 +535,10 @@ void XMLDocument::EndLoad() { mLoopingForSyncLoad = false; mSynchronousDOMContentLoaded = (mLoadedAsData || mLoadedAsInteractiveData); - nsDocument::EndLoad(); + nsIDocument::EndLoad(); if (mSynchronousDOMContentLoaded) { mSynchronousDOMContentLoaded = false; - nsDocument::SetReadyStateInternal(nsIDocument::READYSTATE_COMPLETE); + nsIDocument::SetReadyStateInternal(nsIDocument::READYSTATE_COMPLETE); // Generate a document load event for the case when an XML // document was loaded as pure data without any presentation // attached to it. @@ -551,7 +549,7 @@ void XMLDocument::EndLoad() { /* virtual */ void XMLDocument::DocAddSizeOfExcludingThis( nsWindowSizes& aWindowSizes) const { - nsDocument::DocAddSizeOfExcludingThis(aWindowSizes); + nsIDocument::DocAddSizeOfExcludingThis(aWindowSizes); } // nsIDocument interface diff --git a/dom/xml/XMLDocument.h b/dom/xml/XMLDocument.h index 1381c6cdd8bc..5f4042350cea 100644 --- a/dom/xml/XMLDocument.h +++ b/dom/xml/XMLDocument.h @@ -9,7 +9,7 @@ #include "mozilla/Attributes.h" #include "mozilla/dom/BindingDeclarations.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "nsIScriptContext.h" class nsIURI; @@ -18,11 +18,11 @@ class nsIChannel; namespace mozilla { namespace dom { -class XMLDocument : public nsDocument { +class XMLDocument : public nsIDocument { public: explicit XMLDocument(const char* aContentType = "application/xml"); - NS_INLINE_DECL_REFCOUNTING_INHERITED(XMLDocument, nsDocument) + NS_INLINE_DECL_REFCOUNTING_INHERITED(XMLDocument, nsIDocument) virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) override; virtual void ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup, @@ -58,7 +58,7 @@ class XMLDocument : public nsDocument { // .location is [Unforgeable], so we have to make it clear that the // nsIDocument version applies to us (it's shadowed by the XPCOM thing on - // nsDocument). + // nsIDocument). using nsIDocument::GetLocation; protected: diff --git a/dom/xml/nsXMLContentSink.cpp b/dom/xml/nsXMLContentSink.cpp index 2e9cbd18a3db..b2f24b01eb6a 100644 --- a/dom/xml/nsXMLContentSink.cpp +++ b/dom/xml/nsXMLContentSink.cpp @@ -241,7 +241,7 @@ NS_IMETHODIMP nsXMLContentSink::DidBuildModel(bool aTerminated) { if (!mParser) { // If mParser is null, this parse has already been terminated and must - // not been terminated again. However, nsDocument may still think that + // not been terminated again. However, nsIDocument may still think that // the parse has not been terminated and call back into here in the case // where the XML parser has finished but the XSLT transform associated // with the document has not. diff --git a/dom/xul/XULDocument.cpp b/dom/xul/XULDocument.cpp index 005fc13f252f..0a2eff4c54be 100644 --- a/dom/xul/XULDocument.cpp +++ b/dom/xul/XULDocument.cpp @@ -140,7 +140,7 @@ XULDocument::XULDocument(void) mOffThreadCompileStringBuf(nullptr), mOffThreadCompileStringLength(0), mInitialLayoutComplete(false) { - // Override the default in nsDocument + // Override the default in nsIDocument mCharacterSet = UTF_8_ENCODING; mDefaultElementType = kNameSpaceID_XUL; @@ -254,7 +254,7 @@ nsresult XULDocument::StartDocumentLoad(const char* aCommand, } } } - // NOTE: If this ever starts calling nsDocument::StartDocumentLoad + // NOTE: If this ever starts calling nsIDocument::StartDocumentLoad // we'll possibly need to reset our content type afterwards. mStillWalking = true; mMayStartLayout = false; diff --git a/editor/composer/moz.build b/editor/composer/moz.build index e4d92a0308bb..f6b07087d6d9 100644 --- a/editor/composer/moz.build +++ b/editor/composer/moz.build @@ -27,7 +27,7 @@ EXPORTS.mozilla += [ 'ComposerCommandsUpdater.h', ] -# Needed because we include HTMLEditor.h which indirectly includes nsDocument.h +# Needed because we include HTMLEditor.h which indirectly includes nsIDocument.h LOCAL_INCLUDES += [ '/dom/base', '/dom/html', # For nsHTMLDocument diff --git a/gfx/layers/apz/util/DoubleTapToZoom.cpp b/gfx/layers/apz/util/DoubleTapToZoom.cpp index 0ee5328367d1..705be137d2ab 100644 --- a/gfx/layers/apz/util/DoubleTapToZoom.cpp +++ b/gfx/layers/apz/util/DoubleTapToZoom.cpp @@ -31,8 +31,8 @@ using FrameForPointOption = nsLayoutUtils::FrameForPointOption; // the root frame of |aShell|. If the point is inside a subdocument, returns // an element inside the subdocument, rather than the subdocument element // (and does so recursively). -// The implementation was adapted from nsDocument::ElementFromPoint(), with -// the notable exception that we don't pass nsLayoutUtils::IGNORE_CROSS_DOC +// The implementation was adapted from DocumentOrShadowRoot::ElementFromPoint(), +// with the notable exception that we don't pass nsLayoutUtils::IGNORE_CROSS_DOC // to GetFrameForPoint(), so as to get the behaviour described above in the // presence of subdocuments. static already_AddRefed<dom::Element> ElementFromPoint( diff --git a/image/SVGDocumentWrapper.cpp b/image/SVGDocumentWrapper.cpp index 3f2bd1e228ce..bd0d49ee1396 100644 --- a/image/SVGDocumentWrapper.cpp +++ b/image/SVGDocumentWrapper.cpp @@ -28,7 +28,7 @@ #include "mozilla/dom/SVGAnimatedLength.h" #include "nsMimeTypes.h" #include "DOMSVGLength.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "mozilla/dom/ImageTracker.h" namespace mozilla { diff --git a/intl/l10n/DocumentL10n.h b/intl/l10n/DocumentL10n.h index bae5e9e136c2..5301ba6c69c8 100644 --- a/intl/l10n/DocumentL10n.h +++ b/intl/l10n/DocumentL10n.h @@ -43,13 +43,13 @@ class PromiseResolver final : public PromiseNativeHandler { enum class DocumentL10nState { Initialized = 0, InitialTranslationTriggered }; /** - * This class maintains localization status of the nsDocument. + * This class maintains localization status of the document. * - * The nsDocument will initialize it lazily when a link with a - * localization resource is added to the document. + * The nsIDocument will initialize it lazily when a link with a localization + * resource is added to the document. * * Once initialized, DocumentL10n relays all API methods to an - * instance of mozIDOMLocalization and maintaines a single promise + * instance of mozIDOMLocalization and maintains a single promise * which gets resolved the first time the document gets translated. */ class DocumentL10n final : public nsIDOMEventListener, public nsWrapperCache { diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 8fc50f28d61c..467a0a49e0fa 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -4035,7 +4035,7 @@ void PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush) { bool didLayoutFlush = false; if (isSafeToFlush) { // Record that we are in a flush, so that our optimization in - // nsDocument::FlushPendingNotifications doesn't skip any re-entrant + // nsIDocument::FlushPendingNotifications doesn't skip any re-entrant // calls to us. Otherwise, we might miss some needed flushes, since // we clear mNeedStyleFlush / mNeedLayoutFlush here at the top of // the function but we might not have done the work yet. @@ -4047,7 +4047,7 @@ void PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush) { // need the frames in the external document to be constructed for the // filter to work). We only need external resources to be flushed when the // main document is flushing >= FlushType::Frames, so we flush external - // resources here instead of nsDocument::FlushPendingNotifications. + // resources here instead of nsIDocument::FlushPendingNotifications. mDocument->FlushExternalResources(flushType); // Force flushing of any pending content notifications that might have diff --git a/layout/base/ZoomConstraintsClient.cpp b/layout/base/ZoomConstraintsClient.cpp index 1da811cd002c..2c6fbece1d8c 100644 --- a/layout/base/ZoomConstraintsClient.cpp +++ b/layout/base/ZoomConstraintsClient.cpp @@ -15,7 +15,7 @@ #include "mozilla/Preferences.h" #include "mozilla/PresShell.h" #include "mozilla/dom/Event.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "nsIFrame.h" #include "nsLayoutUtils.h" #include "nsPoint.h" diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 5e21f430aa85..0b117dc162e4 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -2578,7 +2578,7 @@ NS_IMETHODIMP nsDocumentViewer::ClearSelection() { NS_IMETHODIMP nsDocumentViewer::SelectAll() { // XXX this is a temporary implementation copied from nsWebShell - // for now. I think nsDocument and friends should have some helper + // for now. I think nsIDocument and friends should have some helper // functions to make this easier. // use nsCopySupport::GetSelectionForCopy() ? diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 5150c3762852..3710139f69e3 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -24,7 +24,7 @@ #include "mozilla/StaticPrefs.h" #include "mozilla/Unused.h" #include "nsCharTraits.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "nsFontMetrics.h" #include "nsPresContext.h" #include "nsIContent.h" diff --git a/layout/inspector/ServoStyleRuleMap.cpp b/layout/inspector/ServoStyleRuleMap.cpp index dabbbb1a4663..cec81184bbb8 100644 --- a/layout/inspector/ServoStyleRuleMap.cpp +++ b/layout/inspector/ServoStyleRuleMap.cpp @@ -14,7 +14,7 @@ #include "mozilla/IntegerRange.h" #include "mozilla/ServoStyleSet.h" #include "mozilla/StyleSheetInlines.h" -#include "nsDocument.h" +#include "nsIDocument.h" #include "nsStyleSheetService.h" #include "nsXBLPrototypeResources.h" diff --git a/toolkit/content/contentAreaUtils.js b/toolkit/content/contentAreaUtils.js index ff541547c64b..8e83c5d7963b 100644 --- a/toolkit/content/contentAreaUtils.js +++ b/toolkit/content/contentAreaUtils.js @@ -193,7 +193,7 @@ function saveDocument(aDocument, aSkipPrompt) { contentDisposition = aDocument.contentDisposition; cacheKey = aDocument.cacheKey; } else if (aDocument.nodeType == 9 /* DOCUMENT_NODE */) { - // Otherwise it's an actual nsDocument (and possibly a CPOW). + // Otherwise it's an actual document (and possibly a CPOW). // We want to use cached data because the document is currently visible. let win = aDocument.defaultView;