зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1516853 - Merge nsIDocument and nsDocument. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D15498 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
179fb3b0a4
Коммит
63814207cb
|
@ -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<nsIURI> uri;
|
||||
nsresult rv = NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 <algorithm> // For std::stable_sort, std::min
|
||||
|
@ -224,7 +224,7 @@ static void DistributeRange(const Range<Keyframe>& 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);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "nsIAnonymousContentCreator.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsCSSAnonBoxes.h"
|
||||
#include "nsDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -271,10 +271,10 @@ already_AddRefed<DOMParser> DOMParser::CreateWithoutGlobal(ErrorResult& aRv) {
|
|||
|
||||
already_AddRefed<nsIDocument> 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<nsIScriptGlobalObject> scriptHandlingObject =
|
||||
do_QueryInterface(mOwner);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -59,7 +59,6 @@ class nsGlobalWindowInner;
|
|||
class nsGlobalWindowOuter;
|
||||
class nsDOMCSSAttributeDeclaration;
|
||||
class nsISMILAttr;
|
||||
class nsDocument;
|
||||
class nsDOMStringMap;
|
||||
struct ServoNodeData;
|
||||
|
||||
|
|
|
@ -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<nsIContent> 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<nsIContent> child = tmp->GetLastChild();
|
||||
tmp->DisconnectChild(child);
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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<nsDocument*>(doc.get())->ReportUseCounters(reportKind);
|
||||
nsIDocument::UseCounterReportKind::eIncludeExternalResources;
|
||||
doc->ReportUseCounters(reportKind);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<nsIPrincipal> principal = NodePrincipal();
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
@ -1453,7 +1439,7 @@ void nsIDocument::ConstructUbiNode(void* storage) {
|
|||
JS::ubi::Concrete<nsIDocument>::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<nsIContentSecurityPolicy> csp;
|
||||
rv =
|
||||
principal->EnsureCSP(static_cast<nsDocument*>(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<Element> 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<nsDocument*>(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> nsIDocument::CreateStaticClone(
|
||||
nsIDocShell* aCloneContainer) {
|
||||
nsDocument* thisAsDoc = static_cast<nsDocument*>(this);
|
||||
mCreatingStaticClone = true;
|
||||
|
||||
// Make document use different container during cloning.
|
||||
RefPtr<nsDocShell> originalShell = mDocumentContainer.get();
|
||||
SetContainer(static_cast<nsDocShell*>(aCloneContainer));
|
||||
ErrorResult rv;
|
||||
nsCOMPtr<nsINode> clonedNode = thisAsDoc->CloneNode(true, rv);
|
||||
nsCOMPtr<nsINode> clonedNode = this->CloneNode(true, rv);
|
||||
SetContainer(originalShell);
|
||||
|
||||
RefPtr<nsDocument> clonedDoc;
|
||||
nsCOMPtr<nsIDocument> clonedDoc;
|
||||
if (rv.Failed()) {
|
||||
// Don't return yet; we need to reset mCreatingStaticClone
|
||||
rv.SuppressException();
|
||||
} else {
|
||||
nsCOMPtr<nsIDocument> tmp = do_QueryInterface(clonedNode);
|
||||
if (tmp) {
|
||||
clonedDoc = static_cast<nsDocument*>(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<FullscreenRequest> aRequest) {
|
|||
}
|
||||
nsIDocument* parent = child->GetParentDocument();
|
||||
Element* element = parent->FindContentForSubDocument(child);
|
||||
if (static_cast<nsDocument*>(parent)->FullscreenStackPush(element)) {
|
||||
if (parent->FullscreenStackPush(element)) {
|
||||
changed.AppendElement(parent);
|
||||
child = parent;
|
||||
} else {
|
||||
|
@ -10761,18 +10754,17 @@ NS_IMETHODIMP
|
|||
PointerLockRequest::Run() {
|
||||
nsCOMPtr<Element> e = do_QueryReferent(mElement);
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
|
||||
nsDocument* d = static_cast<nsDocument*>(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<Element> 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<Element> pointerLockedElement =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedElement);
|
||||
|
@ -11189,8 +11181,7 @@ nsIDocument* nsIDocument::GetTopLevelContentDocument() {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsIDocument* candidate = parent->GetParentDocument();
|
||||
parent = static_cast<nsDocument*>(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<nsDocument*>(aDocument)->ReportUseCounters(reportKind);
|
||||
nsIDocument::UseCounterReportKind::eIncludeExternalResources;
|
||||
aDocument->ReportUseCounters(reportKind);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -11461,8 +11452,8 @@ void nsIDocument::ScheduleIntersectionObserverNotification() {
|
|||
}
|
||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||
nsCOMPtr<nsIRunnable> 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;
|
||||
|
|
|
@ -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___ */
|
|
@ -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()) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -451,6 +451,12 @@ class nsIDocument : public nsINode,
|
|||
template <typename T>
|
||||
using NotNull = mozilla::NotNull<T>;
|
||||
|
||||
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 <title> 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
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#ifdef DEBUG
|
||||
#include "nsRange.h"
|
||||
#endif
|
||||
#include "nsDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -55,7 +55,7 @@ dictionary ComputedEffectTiming : EffectTiming {
|
|||
unrestricted double? currentIteration = null;
|
||||
};
|
||||
|
||||
[Func="nsDocument::IsWebAnimationsEnabled"]
|
||||
[Func="nsIDocument::IsWebAnimationsEnabled"]
|
||||
interface AnimationEffect {
|
||||
EffectTiming getTiming();
|
||||
[BinaryName="getComputedTimingAsDict"]
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -14,7 +14,7 @@ dictionary DocumentTimelineOptions {
|
|||
DOMHighResTimeStamp originTime = 0;
|
||||
};
|
||||
|
||||
[Func="nsDocument::AreWebAnimationsTimelinesEnabled",
|
||||
[Func="nsIDocument::AreWebAnimationsTimelinesEnabled",
|
||||
Constructor (optional DocumentTimelineOptions options)]
|
||||
interface DocumentTimeline : AnimationTimeline {
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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() ?
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче