зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1444580: Devirtualize more nsIDocument bits. r=smaug
MozReview-Commit-ID: 5y1FgNb2NMB
This commit is contained in:
Родитель
afb2edbbe3
Коммит
92ca1ace1b
|
@ -357,7 +357,7 @@ public:
|
|||
|
||||
// Would block if the result hasn't come out.
|
||||
mozilla::dom::FlashClassification ClassifyMaybeSync(nsIPrincipal* aPrincipal,
|
||||
bool aIsThirdParty);
|
||||
bool aIsThirdParty);
|
||||
|
||||
private:
|
||||
~PrincipalFlashClassifier() = default;
|
||||
|
@ -1423,6 +1423,9 @@ nsIDocument::nsIDocument()
|
|||
mParentDocument(nullptr),
|
||||
mCachedRootElement(nullptr),
|
||||
mNodeInfoManager(nullptr),
|
||||
#ifdef DEBUG
|
||||
mStyledLinksCleared(false),
|
||||
#endif
|
||||
mBidiEnabled(false),
|
||||
mMathMLEnabled(false),
|
||||
mIsInitialDocumentInWindow(false),
|
||||
|
@ -1486,6 +1489,7 @@ nsIDocument::nsIDocument()
|
|||
mNeedsReleaseAfterStackRefCntRelease(false),
|
||||
mStyleSetFilled(false),
|
||||
mSSApplicableStateNotificationPending(false),
|
||||
mMayHaveTitleElement(false),
|
||||
mIsScopedStyleEnabled(eScopedStyle_Unknown),
|
||||
mCompatMode(eCompatibility_FullStandards),
|
||||
mReadyState(ReadyState::READYSTATE_UNINITIALIZED),
|
||||
|
@ -1520,6 +1524,10 @@ nsIDocument::nsIDocument()
|
|||
mUserHasActivatedInteraction(false),
|
||||
mStackRefCnt(0),
|
||||
mUpdateNestLevel(0),
|
||||
mViewportType(Unknown),
|
||||
mSubDocuments(nullptr),
|
||||
mHeaderData(nullptr),
|
||||
mFlashClassification(FlashClassification::Unclassified),
|
||||
mServoRestyleRootDirtyBits(0),
|
||||
mThrowOnDynamicMarkupInsertionCounter(0),
|
||||
mIgnoreOpensDuringUnloadCounter(0)
|
||||
|
@ -1532,10 +1540,6 @@ nsIDocument::nsIDocument()
|
|||
|
||||
nsDocument::nsDocument(const char* aContentType)
|
||||
: nsIDocument()
|
||||
, mSubDocuments(nullptr)
|
||||
, mFlashClassification(FlashClassification::Unclassified)
|
||||
, mHeaderData(nullptr)
|
||||
, mMayHaveTitleElement(false)
|
||||
, mHasWarnedAboutBoxObjects(false)
|
||||
, mDelayFrameLoaderInitialization(false)
|
||||
, mSynchronousDOMContentLoaded(false)
|
||||
|
@ -1548,13 +1552,9 @@ nsDocument::nsDocument(const char* aContentType)
|
|||
, mBoxObjectTable(nullptr)
|
||||
, mOnloadBlockCount(0)
|
||||
, mAsyncOnloadBlockCount(0)
|
||||
#ifdef DEBUG
|
||||
, mStyledLinksCleared(false)
|
||||
#endif
|
||||
, mPreloadPictureDepth(0)
|
||||
, mScrolledToRefAlready(0)
|
||||
, mChangeScrollPosWhenScrollingToRef(0)
|
||||
, mViewportType(Unknown)
|
||||
, mValidWidth(false)
|
||||
, mValidHeight(false)
|
||||
, mAutoSize(false)
|
||||
|
@ -2867,7 +2867,7 @@ nsDocument::SendToConsole(nsCOMArray<nsISecurityConsoleMessage>& aMessages)
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::ApplySettingsFromCSP(bool aSpeculative)
|
||||
nsIDocument::ApplySettingsFromCSP(bool aSpeculative)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!aSpeculative) {
|
||||
|
@ -2882,7 +2882,7 @@ nsDocument::ApplySettingsFromCSP(bool aSpeculative)
|
|||
rv = csp->GetReferrerPolicy(&referrerPolicy, &hasReferrerPolicy);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
if (hasReferrerPolicy) {
|
||||
mReferrerPolicy = static_cast<ReferrerPolicy>(referrerPolicy);
|
||||
mReferrerPolicy = static_cast<enum ReferrerPolicy>(referrerPolicy);
|
||||
mReferrerPolicySet = true;
|
||||
}
|
||||
|
||||
|
@ -3082,7 +3082,7 @@ nsDocument::StopDocumentLoad()
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::SetDocumentURI(nsIURI* aURI)
|
||||
nsIDocument::SetDocumentURI(nsIURI* aURI)
|
||||
{
|
||||
nsCOMPtr<nsIURI> oldBase = GetDocBaseURI();
|
||||
mDocumentURI = NS_TryToMakeImmutable(aURI);
|
||||
|
@ -3111,18 +3111,6 @@ nsDocument::SetDocumentURI(nsIURI* aURI)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::SetChromeXHRDocURI(nsIURI* aURI)
|
||||
{
|
||||
mChromeXHRDocURI = aURI;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::SetChromeXHRDocBaseURI(nsIURI* aURI)
|
||||
{
|
||||
mChromeXHRDocBaseURI = aURI;
|
||||
}
|
||||
|
||||
static void
|
||||
GetFormattedTimeString(PRTime aTime, nsAString& aFormattedTimeString)
|
||||
{
|
||||
|
@ -3237,7 +3225,7 @@ nsDocument::GetPrincipal()
|
|||
extern bool sDisablePrefetchHTTPSPref;
|
||||
|
||||
void
|
||||
nsDocument::SetPrincipal(nsIPrincipal *aNewPrincipal)
|
||||
nsIDocument::SetPrincipal(nsIPrincipal *aNewPrincipal)
|
||||
{
|
||||
if (aNewPrincipal && mAllowDNSPrefetch && sDisablePrefetchHTTPSPref) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
@ -3360,7 +3348,7 @@ nsDocument::SetContentType(const nsAString& aContentType)
|
|||
}
|
||||
|
||||
bool
|
||||
nsDocument::GetAllowPlugins()
|
||||
nsIDocument::GetAllowPlugins()
|
||||
{
|
||||
// First, we ask our docshell if it allows plugins.
|
||||
nsCOMPtr<nsIDocShell> docShell(mDocumentContainer);
|
||||
|
@ -3692,7 +3680,7 @@ nsIDocument::GetBaseURI(bool aTryUseXHRDocBaseURI) const
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::SetBaseURI(nsIURI* aURI)
|
||||
nsIDocument::SetBaseURI(nsIURI* aURI)
|
||||
{
|
||||
if (!aURI && !mDocumentBaseURI) {
|
||||
return;
|
||||
|
@ -3736,12 +3724,6 @@ nsIDocument::DefaultStyleAttrURLData()
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::GetBaseTarget(nsAString &aBaseTarget)
|
||||
{
|
||||
aBaseTarget = mBaseTarget;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::SetDocumentCharacterSet(NotNull<const Encoding*> aEncoding)
|
||||
{
|
||||
|
@ -3761,7 +3743,7 @@ nsIDocument::GetSandboxFlagsAsString(nsAString& aFlags)
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::GetHeaderData(nsAtom* aHeaderField, nsAString& aData) const
|
||||
nsIDocument::GetHeaderData(nsAtom* aHeaderField, nsAString& aData) const
|
||||
{
|
||||
aData.Truncate();
|
||||
const nsDocHeaderData* data = mHeaderData;
|
||||
|
@ -3776,7 +3758,7 @@ nsDocument::GetHeaderData(nsAtom* aHeaderField, nsAString& aData) const
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::SetHeaderData(nsAtom* aHeaderField, const nsAString& aData)
|
||||
nsIDocument::SetHeaderData(nsAtom* aHeaderField, const nsAString& aData)
|
||||
{
|
||||
if (!aHeaderField) {
|
||||
NS_ERROR("null headerField");
|
||||
|
@ -3867,7 +3849,7 @@ nsDocument::SetHeaderData(nsAtom* aHeaderField, const nsAString& aData)
|
|||
|
||||
// Referrer policy spec says to ignore any empty referrer policies.
|
||||
if (aHeaderField == nsGkAtoms::referrer && !aData.IsEmpty()) {
|
||||
ReferrerPolicy policy = mozilla::net::ReferrerPolicyFromString(aData);
|
||||
enum ReferrerPolicy policy = mozilla::net::ReferrerPolicyFromString(aData);
|
||||
// If policy is not the empty string, then set element's node document's
|
||||
// referrer policy to policy
|
||||
if (policy != mozilla::net::RP_Unset) {
|
||||
|
@ -3879,7 +3861,7 @@ nsDocument::SetHeaderData(nsAtom* aHeaderField, const nsAString& aData)
|
|||
}
|
||||
|
||||
if (aHeaderField == nsGkAtoms::headerReferrerPolicy && !aData.IsEmpty()) {
|
||||
ReferrerPolicy policy = nsContentUtils::GetReferrerPolicyFromHeader(aData);
|
||||
enum ReferrerPolicy policy = nsContentUtils::GetReferrerPolicyFromHeader(aData);
|
||||
if (policy != mozilla::net::RP_Unset) {
|
||||
mReferrerPolicy = policy;
|
||||
mReferrerPolicySet = true;
|
||||
|
@ -4108,7 +4090,7 @@ nsDocument::SetAllowPaymentRequest(bool aAllowPaymentRequest)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsDocument::SetSubDocumentFor(Element* aElement, nsIDocument* aSubDoc)
|
||||
nsIDocument::SetSubDocumentFor(Element* aElement, nsIDocument* aSubDoc)
|
||||
{
|
||||
NS_ENSURE_TRUE(aElement, NS_ERROR_UNEXPECTED);
|
||||
|
||||
|
@ -4181,7 +4163,7 @@ nsDocument::SetSubDocumentFor(Element* aElement, nsIDocument* aSubDoc)
|
|||
}
|
||||
|
||||
nsIDocument*
|
||||
nsDocument::GetSubDocumentFor(nsIContent *aContent) const
|
||||
nsIDocument::GetSubDocumentFor(nsIContent *aContent) const
|
||||
{
|
||||
if (mSubDocuments && aContent->IsElement()) {
|
||||
auto entry = static_cast<SubDocMapEntry*>
|
||||
|
@ -4196,7 +4178,7 @@ nsDocument::GetSubDocumentFor(nsIContent *aContent) const
|
|||
}
|
||||
|
||||
Element*
|
||||
nsDocument::FindContentForSubDocument(nsIDocument *aDocument) const
|
||||
nsIDocument::FindContentForSubDocument(nsIDocument *aDocument) const
|
||||
{
|
||||
NS_ENSURE_TRUE(aDocument, nullptr);
|
||||
|
||||
|
@ -5101,7 +5083,7 @@ nsDocument::ScriptLoader()
|
|||
}
|
||||
|
||||
bool
|
||||
nsDocument::InternalAllowXULXBL()
|
||||
nsIDocument::InternalAllowXULXBL()
|
||||
{
|
||||
if (nsContentUtils::AllowXULXBLForPrincipal(NodePrincipal())) {
|
||||
mAllowXULXBL = eTriTrue;
|
||||
|
@ -5216,13 +5198,13 @@ nsDocument::BeginLoad()
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::ReportEmptyGetElementByIdArg()
|
||||
nsIDocument::ReportEmptyGetElementByIdArg()
|
||||
{
|
||||
nsContentUtils::ReportEmptyGetElementByIdArg(this);
|
||||
}
|
||||
|
||||
Element*
|
||||
nsDocument::AddIDTargetObserver(nsAtom* aID, IDTargetObserver aObserver,
|
||||
nsIDocument::AddIDTargetObserver(nsAtom* aID, IDTargetObserver aObserver,
|
||||
void* aData, bool aForImage)
|
||||
{
|
||||
nsDependentAtomString id(aID);
|
||||
|
@ -5238,7 +5220,7 @@ nsDocument::AddIDTargetObserver(nsAtom* aID, IDTargetObserver aObserver,
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::RemoveIDTargetObserver(nsAtom* aID, IDTargetObserver aObserver,
|
||||
nsIDocument::RemoveIDTargetObserver(nsAtom* aID, IDTargetObserver aObserver,
|
||||
void* aData, bool aForImage)
|
||||
{
|
||||
nsDependentAtomString id(aID);
|
||||
|
@ -5255,7 +5237,7 @@ nsDocument::RemoveIDTargetObserver(nsAtom* aID, IDTargetObserver aObserver,
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::MozSetImageElement(const nsAString& aImageElementId,
|
||||
nsIDocument::MozSetImageElement(const nsAString& aImageElementId,
|
||||
Element* aElement)
|
||||
{
|
||||
if (aImageElementId.IsEmpty())
|
||||
|
@ -5265,7 +5247,7 @@ nsDocument::MozSetImageElement(const nsAString& aImageElementId,
|
|||
// out to id-observers
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.PutEntry(aImageElementId);
|
||||
nsIdentifierMapEntry* entry = mIdentifierMap.PutEntry(aImageElementId);
|
||||
if (entry) {
|
||||
entry->SetImageElement(aElement);
|
||||
if (entry->IsEmpty()) {
|
||||
|
@ -5275,12 +5257,12 @@ nsDocument::MozSetImageElement(const nsAString& aImageElementId,
|
|||
}
|
||||
|
||||
Element*
|
||||
nsDocument::LookupImageElement(const nsAString& aId)
|
||||
nsIDocument::LookupImageElement(const nsAString& aId)
|
||||
{
|
||||
if (aId.IsEmpty())
|
||||
return nullptr;
|
||||
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.GetEntry(aId);
|
||||
nsIdentifierMapEntry* entry = mIdentifierMap.GetEntry(aId);
|
||||
return entry ? entry->GetImageIdElement() : nullptr;
|
||||
}
|
||||
|
||||
|
@ -5304,7 +5286,7 @@ nsDocument::DispatchContentLoadedEvents()
|
|||
// Dispatch observer notification to notify observers document is interactive.
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
if (os) {
|
||||
nsIPrincipal *principal = GetPrincipal();
|
||||
nsIPrincipal* principal = GetPrincipal();
|
||||
os->NotifyObservers(static_cast<nsIDocument*>(this),
|
||||
nsContentUtils::IsSystemPrincipal(principal) ?
|
||||
"chrome-document-interactive" :
|
||||
|
@ -6362,7 +6344,7 @@ nsIDocument::SetBody(nsGenericHTMLElement* newBody, ErrorResult& rv)
|
|||
}
|
||||
|
||||
Element*
|
||||
nsDocument::GetTitleElement()
|
||||
nsIDocument::GetTitleElement()
|
||||
{
|
||||
// mMayHaveTitleElement will have been set to true if any HTML or SVG
|
||||
// <title> element has been bound to this document. So if it's false,
|
||||
|
@ -6399,7 +6381,7 @@ nsDocument::GetTitleElement()
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::GetTitle(nsAString& aTitle)
|
||||
nsIDocument::GetTitle(nsAString& aTitle)
|
||||
{
|
||||
aTitle.Truncate();
|
||||
|
||||
|
@ -6428,7 +6410,7 @@ nsDocument::GetTitle(nsAString& aTitle)
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::SetTitle(const nsAString& aTitle, ErrorResult& aRv)
|
||||
nsIDocument::SetTitle(const nsAString& aTitle, ErrorResult& aRv)
|
||||
{
|
||||
Element* rootElement = GetRootElement();
|
||||
if (!rootElement) {
|
||||
|
@ -6486,7 +6468,7 @@ nsDocument::SetTitle(const nsAString& aTitle, ErrorResult& aRv)
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::NotifyPossibleTitleChange(bool aBoundTitleElement)
|
||||
nsIDocument::NotifyPossibleTitleChange(bool aBoundTitleElement)
|
||||
{
|
||||
NS_ASSERTION(!mInUnlinkOrDeletion || !aBoundTitleElement,
|
||||
"Setting a title while unlinking or destroying the element?");
|
||||
|
@ -6501,10 +6483,10 @@ nsDocument::NotifyPossibleTitleChange(bool aBoundTitleElement)
|
|||
return;
|
||||
|
||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||
RefPtr<nsRunnableMethod<nsDocument, void, false>> event =
|
||||
NewNonOwningRunnableMethod("nsDocument::DoNotifyPossibleTitleChange",
|
||||
RefPtr<nsRunnableMethod<nsIDocument, void, false>> event =
|
||||
NewNonOwningRunnableMethod("nsIDocument::DoNotifyPossibleTitleChange",
|
||||
this,
|
||||
&nsDocument::DoNotifyPossibleTitleChange);
|
||||
&nsIDocument::DoNotifyPossibleTitleChange);
|
||||
nsresult rv = Dispatch(TaskCategory::Other, do_AddRef(event));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mPendingTitleChangeEvent = Move(event);
|
||||
|
@ -6512,7 +6494,7 @@ nsDocument::NotifyPossibleTitleChange(bool aBoundTitleElement)
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::DoNotifyPossibleTitleChange()
|
||||
nsIDocument::DoNotifyPossibleTitleChange()
|
||||
{
|
||||
mPendingTitleChangeEvent.Forget();
|
||||
mHaveFiredTitleChange = true;
|
||||
|
@ -8792,30 +8774,6 @@ nsDocument::MutationEventDispatched(nsINode* aTarget)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::AddStyleRelevantLink(Link* aLink)
|
||||
{
|
||||
NS_ASSERTION(aLink, "Passing in a null link. Expect crashes RSN!");
|
||||
#ifdef DEBUG
|
||||
nsPtrHashKey<Link>* entry = mStyledLinks.GetEntry(aLink);
|
||||
NS_ASSERTION(!entry, "Document already knows about this Link!");
|
||||
mStyledLinksCleared = false;
|
||||
#endif
|
||||
(void)mStyledLinks.PutEntry(aLink);
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::ForgetLink(Link* aLink)
|
||||
{
|
||||
NS_ASSERTION(aLink, "Passing in a null link. Expect crashes RSN!");
|
||||
#ifdef DEBUG
|
||||
nsPtrHashKey<Link>* entry = mStyledLinks.GetEntry(aLink);
|
||||
NS_ASSERTION(entry || mStyledLinksCleared,
|
||||
"Document knows nothing about this Link!");
|
||||
#endif
|
||||
mStyledLinks.RemoveEntry(aLink);
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::DestroyElementMaps()
|
||||
{
|
||||
|
@ -8828,7 +8786,7 @@ nsDocument::DestroyElementMaps()
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::RefreshLinkHrefs()
|
||||
nsIDocument::RefreshLinkHrefs()
|
||||
{
|
||||
// Get a list of all links we know about. We will reset them, which will
|
||||
// remove them from the document, so we need a copy of what is in the
|
||||
|
@ -12868,10 +12826,10 @@ nsIDocument::GetSameTypeParentDocument()
|
|||
* toolkit/components/url-classifier/flash-block-lists.rst
|
||||
*/
|
||||
FlashClassification
|
||||
nsDocument::PrincipalFlashClassification()
|
||||
nsIDocument::PrincipalFlashClassification()
|
||||
{
|
||||
MOZ_ASSERT(mPrincipalFlashClassifier);
|
||||
return mPrincipalFlashClassifier->ClassifyMaybeSync(GetPrincipal(),
|
||||
return mPrincipalFlashClassifier->ClassifyMaybeSync(NodePrincipal(),
|
||||
IsThirdParty());
|
||||
}
|
||||
|
||||
|
@ -13272,7 +13230,7 @@ PrincipalFlashClassifier::AsyncClassifyInternal(nsIPrincipal* aPrincipal)
|
|||
}
|
||||
|
||||
FlashClassification
|
||||
nsDocument::ComputeFlashClassification()
|
||||
nsIDocument::ComputeFlashClassification()
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeItem> current = this->GetDocShell();
|
||||
if (!current) {
|
||||
|
@ -13321,7 +13279,7 @@ nsDocument::ComputeFlashClassification()
|
|||
* This function will NOT return FlashClassification::Unclassified
|
||||
*/
|
||||
FlashClassification
|
||||
nsDocument::DocumentFlashClassification()
|
||||
nsIDocument::DocumentFlashClassification()
|
||||
{
|
||||
if (mFlashClassification == FlashClassification::Unclassified) {
|
||||
FlashClassification result = ComputeFlashClassification();
|
||||
|
@ -13349,7 +13307,7 @@ nsDocument::DocumentFlashClassification()
|
|||
* it will be assumed to be Third-Party for security reasons.
|
||||
*/
|
||||
bool
|
||||
nsDocument::IsThirdParty()
|
||||
nsIDocument::IsThirdParty()
|
||||
{
|
||||
if (mIsThirdParty.isSome()) {
|
||||
return mIsThirdParty.value();
|
||||
|
@ -13384,7 +13342,7 @@ nsDocument::IsThirdParty()
|
|||
return mIsThirdParty.value();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal = GetPrincipal();
|
||||
nsCOMPtr<nsIPrincipal> principal = NodePrincipal();
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(parentDocument,
|
||||
&rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv) || !sop)) {
|
||||
|
|
|
@ -129,24 +129,6 @@ public:
|
|||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
class nsDocHeaderData
|
||||
{
|
||||
public:
|
||||
nsDocHeaderData(nsAtom* aField, const nsAString& aData)
|
||||
: mField(aField), mData(aData), mNext(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
~nsDocHeaderData(void)
|
||||
{
|
||||
delete mNext;
|
||||
}
|
||||
|
||||
RefPtr<nsAtom> mField;
|
||||
nsString mData;
|
||||
nsDocHeaderData* mNext;
|
||||
};
|
||||
|
||||
class nsOnloadBlocker final : public nsIRequest
|
||||
{
|
||||
public:
|
||||
|
@ -315,9 +297,6 @@ protected:
|
|||
bool mHaveShutDown;
|
||||
};
|
||||
|
||||
// For classifying a flash document based on its principal.
|
||||
class PrincipalFlashClassifier;
|
||||
|
||||
// Base class for our document implementations.
|
||||
class nsDocument : public nsIDocument,
|
||||
public nsIDOMDocument,
|
||||
|
@ -356,33 +335,11 @@ public:
|
|||
|
||||
virtual void StopDocumentLoad() override;
|
||||
|
||||
virtual void NotifyPossibleTitleChange(bool aBoundTitleElement) override;
|
||||
|
||||
virtual void SetDocumentURI(nsIURI* aURI) override;
|
||||
|
||||
virtual void SetChromeXHRDocURI(nsIURI* aURI) override;
|
||||
|
||||
virtual void SetChromeXHRDocBaseURI(nsIURI* aURI) override;
|
||||
|
||||
virtual void ApplySettingsFromCSP(bool aSpeculative) override;
|
||||
|
||||
/**
|
||||
* Set the principal responsible for this document.
|
||||
*/
|
||||
virtual void SetPrincipal(nsIPrincipal *aPrincipal) override;
|
||||
|
||||
/**
|
||||
* Set the Content-Type of this document.
|
||||
*/
|
||||
virtual void SetContentType(const nsAString& aContentType) override;
|
||||
|
||||
virtual void SetBaseURI(nsIURI* aURI) override;
|
||||
|
||||
/**
|
||||
* Get/Set the base target of a link in a document.
|
||||
*/
|
||||
virtual void GetBaseTarget(nsAString &aBaseTarget) override;
|
||||
|
||||
/**
|
||||
* Set the document's character encoding. This will
|
||||
* trigger a startDocumentLoad if necessary to answer the question.
|
||||
|
@ -390,19 +347,6 @@ public:
|
|||
virtual void
|
||||
SetDocumentCharacterSet(NotNull<const Encoding*> aEncoding) override;
|
||||
|
||||
virtual Element* AddIDTargetObserver(nsAtom* aID, IDTargetObserver aObserver,
|
||||
void* aData, bool aForImage) override;
|
||||
virtual void RemoveIDTargetObserver(nsAtom* aID, IDTargetObserver aObserver,
|
||||
void* aData, bool aForImage) override;
|
||||
|
||||
/**
|
||||
* Access HTTP header data (this may also get set from other sources, like
|
||||
* HTML META tags).
|
||||
*/
|
||||
virtual void GetHeaderData(nsAtom* aHeaderField, nsAString& aData) const override;
|
||||
virtual void SetHeaderData(nsAtom* aheaderField,
|
||||
const nsAString& aData) override;
|
||||
|
||||
/**
|
||||
* Create a new presentation shell that will use aContext for
|
||||
* its presentation context (presentation contexts <b>must not</b> be
|
||||
|
@ -414,8 +358,6 @@ public:
|
|||
final;
|
||||
virtual void DeleteShell() override;
|
||||
|
||||
virtual bool GetAllowPlugins() override;
|
||||
|
||||
static bool CallerIsTrustedAboutPage(JSContext* aCx, JSObject* aObject);
|
||||
static bool IsElementAnimateEnabled(JSContext* aCx, JSObject* aObject);
|
||||
static bool IsWebAnimationsEnabled(JSContext* aCx, JSObject* aObject);
|
||||
|
@ -428,10 +370,6 @@ public:
|
|||
return mTimelines;
|
||||
}
|
||||
|
||||
virtual nsresult SetSubDocumentFor(Element* aContent,
|
||||
nsIDocument* aSubDoc) override;
|
||||
virtual nsIDocument* GetSubDocumentFor(nsIContent* aContent) const override;
|
||||
virtual Element* FindContentForSubDocument(nsIDocument *aDocument) const override;
|
||||
virtual Element* GetRootElementInternal() const override;
|
||||
|
||||
virtual nsIChannel* GetChannel() const override {
|
||||
|
@ -615,9 +553,6 @@ public:
|
|||
virtual void BlockOnload() override;
|
||||
virtual void UnblockOnload(bool aFireSync) override;
|
||||
|
||||
virtual void AddStyleRelevantLink(mozilla::dom::Link* aLink) override;
|
||||
virtual void ForgetLink(mozilla::dom::Link* aLink) override;
|
||||
|
||||
virtual void ClearBoxObjectFor(nsIContent* aContent) override;
|
||||
|
||||
virtual already_AddRefed<mozilla::dom::BoxObject>
|
||||
|
@ -676,8 +611,6 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDocument,
|
||||
nsIDocument)
|
||||
|
||||
void DoNotifyPossibleTitleChange();
|
||||
|
||||
nsExternalResourceMap& ExternalResourceMap()
|
||||
{
|
||||
return mExternalResourceMap;
|
||||
|
@ -734,10 +667,6 @@ public:
|
|||
virtual void ResetScrolledToRefAlready() override;
|
||||
virtual void SetChangeScrollPosWhenScrollingToRef(bool aValue) override;
|
||||
|
||||
virtual Element* LookupImageElement(const nsAString& aElementId) override;
|
||||
virtual void MozSetImageElement(const nsAString& aImageElementId,
|
||||
Element* aElement) override;
|
||||
|
||||
// AddPlugin adds a plugin-related element to mPlugins when the element is
|
||||
// added to the tree.
|
||||
virtual nsresult AddPlugin(nsIObjectLoadingContent* aPlugin) override;
|
||||
|
@ -878,22 +807,6 @@ public:
|
|||
protected:
|
||||
friend class nsNodeUtils;
|
||||
|
||||
/**
|
||||
* Check that aId is not empty and log a message to the console
|
||||
* service if it is.
|
||||
* @returns true if aId looks correct, false otherwise.
|
||||
*/
|
||||
inline bool CheckGetElementByIdArg(const nsAString& aId)
|
||||
{
|
||||
if (aId.IsEmpty()) {
|
||||
ReportEmptyGetElementByIdArg();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ReportEmptyGetElementByIdArg();
|
||||
|
||||
void DispatchContentLoadedEvents();
|
||||
|
||||
void RetrieveRelevantHeaders(nsIChannel *aChannel);
|
||||
|
@ -907,26 +820,10 @@ protected:
|
|||
// That will stop us from doing a lot of work as each element is removed.
|
||||
void DestroyElementMaps();
|
||||
|
||||
// Refreshes the hrefs of all the links in the document.
|
||||
void RefreshLinkHrefs();
|
||||
|
||||
nsIContent* GetFirstBaseNodeWithHref();
|
||||
nsresult SetFirstBaseNodeWithHref(nsIContent *node);
|
||||
|
||||
/**
|
||||
* Returns the title element of the document as defined by the HTML
|
||||
* specification, or null if there isn't one. For documents whose root
|
||||
* element is an <svg:svg>, this is the first <svg:title> element that's a
|
||||
* child of the root. For other documents, it's the first HTML title element
|
||||
* in the document.
|
||||
*/
|
||||
Element* GetTitleElement();
|
||||
|
||||
public:
|
||||
// Get our title
|
||||
virtual void GetTitle(nsAString& aTitle) override;
|
||||
// Set our title
|
||||
virtual void SetTitle(const nsAString& aTitle, mozilla::ErrorResult& rv) override;
|
||||
|
||||
js::ExpandoAndGeneration mExpandoAndGeneration;
|
||||
|
||||
|
@ -942,13 +839,9 @@ protected:
|
|||
|
||||
virtual nsPIDOMWindowOuter* GetWindowInternal() const override;
|
||||
virtual nsIScriptGlobalObject* GetScriptHandlingObjectInternal() const override;
|
||||
virtual bool InternalAllowXULXBL() override;
|
||||
|
||||
void UpdateScreenOrientation();
|
||||
|
||||
virtual mozilla::dom::FlashClassification DocumentFlashClassification() override;
|
||||
virtual bool IsThirdParty() override;
|
||||
|
||||
#define NS_DOCUMENT_NOTIFY_OBSERVERS(func_, params_) do { \
|
||||
NS_OBSERVER_ARRAY_NOTIFY_XPCOM_OBSERVERS(mObservers, nsIDocumentObserver, \
|
||||
func_, params_); \
|
||||
|
@ -973,16 +866,6 @@ protected:
|
|||
// fails and nothing gets changed.
|
||||
bool ApplyFullscreen(const FullscreenRequest& aRequest);
|
||||
|
||||
// Retrieves the classification of the Flash plugins in the document based on
|
||||
// the classification lists.
|
||||
mozilla::dom::FlashClassification PrincipalFlashClassification();
|
||||
|
||||
// Attempts to determine the Flash classification of this page based on the
|
||||
// the classification lists and the classification of parent documents.
|
||||
mozilla::dom::FlashClassification ComputeFlashClassification();
|
||||
|
||||
PLDHashTable *mSubDocuments;
|
||||
|
||||
// Array of owning references to all children
|
||||
nsAttrAndChildArray mChildren;
|
||||
|
||||
|
@ -1008,26 +891,15 @@ protected:
|
|||
// non-null when this document is in fullscreen mode.
|
||||
nsWeakPtr mFullscreenRoot;
|
||||
|
||||
RefPtr<PrincipalFlashClassifier> mPrincipalFlashClassifier;
|
||||
mozilla::dom::FlashClassification mFlashClassification;
|
||||
// Do not use this value directly. Call the |IsThirdParty()| method, which
|
||||
// caches its result here.
|
||||
mozilla::Maybe<bool> mIsThirdParty;
|
||||
|
||||
public:
|
||||
RefPtr<mozilla::EventListenerManager> mListenerManager;
|
||||
RefPtr<mozilla::dom::ScriptLoader> mScriptLoader;
|
||||
nsDocHeaderData* mHeaderData;
|
||||
|
||||
nsClassHashtable<nsStringHashKey, nsRadioGroupStruct> mRadioGroups;
|
||||
|
||||
// Recorded time of change to 'loading' state.
|
||||
mozilla::TimeStamp mLoadingTimeStamp;
|
||||
|
||||
// True if this document has ever had an HTML or SVG <title> element
|
||||
// bound to it
|
||||
bool mMayHaveTitleElement:1;
|
||||
|
||||
bool mHasWarnedAboutBoxObjects:1;
|
||||
|
||||
bool mDelayFrameLoaderInitialization:1;
|
||||
|
@ -1103,15 +975,6 @@ private:
|
|||
uint32_t mAsyncOnloadBlockCount;
|
||||
nsCOMPtr<nsIRequest> mOnloadBlocker;
|
||||
|
||||
// A hashtable of styled links keyed by address pointer.
|
||||
nsTHashtable<nsPtrHashKey<mozilla::dom::Link> > mStyledLinks;
|
||||
#ifdef DEBUG
|
||||
// Indicates whether mStyledLinks was cleared or not. This is used to track
|
||||
// state so we can provide useful assertions to consumers of ForgetLink and
|
||||
// AddStyleRelevantLink.
|
||||
bool mStyledLinksCleared;
|
||||
#endif
|
||||
|
||||
// A set of responsive images keyed by address pointer.
|
||||
nsTHashtable< nsPtrHashKey<nsIContent> > mResponsiveContent;
|
||||
|
||||
|
@ -1121,9 +984,6 @@ private:
|
|||
|
||||
nsCOMPtr<nsIRunnable> mMaybeEndOutermostXBLUpdateRunner;
|
||||
|
||||
nsRevocableEventPtr<nsRunnableMethod<nsDocument, void, false> >
|
||||
mPendingTitleChangeEvent;
|
||||
|
||||
nsExternalResourceMap mExternalResourceMap;
|
||||
|
||||
// All images in process of being preloaded. This is a hashtable so
|
||||
|
@ -1135,7 +995,7 @@ private:
|
|||
// A list of preconnects initiated by the preloader. This prevents
|
||||
// the same uri from being used more than once, and allows the dom
|
||||
// builder to not repeat the work of the preloader.
|
||||
nsDataHashtable< nsURIHashKey, bool> mPreloadedPreconnects;
|
||||
nsDataHashtable<nsURIHashKey, bool> mPreloadedPreconnects;
|
||||
|
||||
// Current depth of picture elements from parser
|
||||
int32_t mPreloadPictureDepth;
|
||||
|
@ -1159,14 +1019,6 @@ private:
|
|||
RefPtr<mozilla::dom::DocumentTimeline> mDocumentTimeline;
|
||||
mozilla::LinkedList<mozilla::dom::DocumentTimeline> mTimelines;
|
||||
|
||||
enum ViewportType {
|
||||
DisplayWidthHeight,
|
||||
Specified,
|
||||
Unknown
|
||||
};
|
||||
|
||||
ViewportType mViewportType;
|
||||
|
||||
// These member variables cache information about the viewport so we don't have to
|
||||
// recalculate it each time.
|
||||
bool mValidWidth, mValidHeight;
|
||||
|
|
|
@ -213,8 +213,29 @@ enum DocumentFlavor {
|
|||
class nsContentList;
|
||||
class nsDocumentOnStack;
|
||||
|
||||
class nsDocHeaderData
|
||||
{
|
||||
public:
|
||||
nsDocHeaderData(nsAtom* aField, const nsAString& aData)
|
||||
: mField(aField), mData(aData), mNext(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
~nsDocHeaderData(void)
|
||||
{
|
||||
delete mNext;
|
||||
}
|
||||
|
||||
RefPtr<nsAtom> mField;
|
||||
nsString mData;
|
||||
nsDocHeaderData* mNext;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// For classifying a flash document based on its principal.
|
||||
class PrincipalFlashClassifier;
|
||||
|
||||
// Document interface. This is implemented by all document objects in
|
||||
// Gecko.
|
||||
class nsIDocument : public nsINode,
|
||||
|
@ -319,7 +340,7 @@ public:
|
|||
* @param aBoundTitleElement true if an HTML or SVG <title> element
|
||||
* has just been bound to the document.
|
||||
*/
|
||||
virtual void NotifyPossibleTitleChange(bool aBoundTitleElement) = 0;
|
||||
void NotifyPossibleTitleChange(bool aBoundTitleElement);
|
||||
|
||||
/**
|
||||
* Return the URI for the document. May return null.
|
||||
|
@ -356,24 +377,30 @@ public:
|
|||
* Set the URI for the document. This also sets the document's original URI,
|
||||
* if it's null.
|
||||
*/
|
||||
virtual void SetDocumentURI(nsIURI* aURI) = 0;
|
||||
void SetDocumentURI(nsIURI* aURI);
|
||||
|
||||
/**
|
||||
* Set the URI for the document loaded via XHR, when accessed from
|
||||
* chrome privileged script.
|
||||
*/
|
||||
virtual void SetChromeXHRDocURI(nsIURI* aURI) = 0;
|
||||
void SetChromeXHRDocURI(nsIURI* aURI)
|
||||
{
|
||||
mChromeXHRDocURI = aURI;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the base URI for the document loaded via XHR, when accessed from
|
||||
* chrome privileged script.
|
||||
*/
|
||||
virtual void SetChromeXHRDocBaseURI(nsIURI* aURI) = 0;
|
||||
void SetChromeXHRDocBaseURI(nsIURI* aURI)
|
||||
{
|
||||
mChromeXHRDocBaseURI = aURI;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set referrer policy and upgrade-insecure-requests flags
|
||||
*/
|
||||
virtual void ApplySettingsFromCSP(bool aSpeculative) = 0;
|
||||
void ApplySettingsFromCSP(bool aSpeculative);
|
||||
|
||||
already_AddRefed<nsIParser> CreatorParserOrNull()
|
||||
{
|
||||
|
@ -434,7 +461,7 @@ public:
|
|||
* Set the principal responsible for this document. Chances are,
|
||||
* you do not want to be using this.
|
||||
*/
|
||||
virtual void SetPrincipal(nsIPrincipal *aPrincipal) = 0;
|
||||
void SetPrincipal(nsIPrincipal* aPrincipal);
|
||||
|
||||
/**
|
||||
* Get the list of ancestor principals for a document. This is the same as
|
||||
|
@ -495,9 +522,10 @@ public:
|
|||
}
|
||||
return GetFallbackBaseURI();
|
||||
}
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI(bool aTryUseXHRDocBaseURI = false) const override;
|
||||
|
||||
virtual void SetBaseURI(nsIURI* aURI) = 0;
|
||||
already_AddRefed<nsIURI> GetBaseURI(bool aTryUseXHRDocBaseURI = false) const final;
|
||||
|
||||
void SetBaseURI(nsIURI* aURI);
|
||||
|
||||
/**
|
||||
* Return the URL data which style system needs for resolving url value.
|
||||
|
@ -511,7 +539,11 @@ public:
|
|||
/**
|
||||
* Get/Set the base target of a link in a document.
|
||||
*/
|
||||
virtual void GetBaseTarget(nsAString &aBaseTarget) = 0;
|
||||
void GetBaseTarget(nsAString& aBaseTarget) const
|
||||
{
|
||||
aBaseTarget = mBaseTarget;
|
||||
}
|
||||
|
||||
void SetBaseTarget(const nsString& aBaseTarget) {
|
||||
mBaseTarget = aBaseTarget;
|
||||
}
|
||||
|
@ -563,14 +595,30 @@ public:
|
|||
* registered for each ID.
|
||||
* @return the content currently associated with the ID.
|
||||
*/
|
||||
virtual Element* AddIDTargetObserver(nsAtom* aID, IDTargetObserver aObserver,
|
||||
void* aData, bool aForImage) = 0;
|
||||
Element* AddIDTargetObserver(nsAtom* aID, IDTargetObserver aObserver,
|
||||
void* aData, bool aForImage);
|
||||
/**
|
||||
* Remove the (aObserver, aData, aForImage) triple for a specific ID, if
|
||||
* registered.
|
||||
*/
|
||||
virtual void RemoveIDTargetObserver(nsAtom* aID, IDTargetObserver aObserver,
|
||||
void* aData, bool aForImage) = 0;
|
||||
void RemoveIDTargetObserver(nsAtom* aID, IDTargetObserver aObserver,
|
||||
void* aData, bool aForImage);
|
||||
|
||||
/**
|
||||
* Check that aId is not empty and log a message to the console
|
||||
* service if it is.
|
||||
* @returns true if aId looks correct, false otherwise.
|
||||
*/
|
||||
inline bool CheckGetElementByIdArg(const nsAString& aId)
|
||||
{
|
||||
if (aId.IsEmpty()) {
|
||||
ReportEmptyGetElementByIdArg();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ReportEmptyGetElementByIdArg();
|
||||
|
||||
/**
|
||||
* Get the Content-Type of this document.
|
||||
|
@ -893,8 +941,8 @@ public:
|
|||
* Access HTTP header data (this may also get set from other
|
||||
* sources, like HTML META tags).
|
||||
*/
|
||||
virtual void GetHeaderData(nsAtom* aHeaderField, nsAString& aData) const = 0;
|
||||
virtual void SetHeaderData(nsAtom* aheaderField, const nsAString& aData) = 0;
|
||||
void GetHeaderData(nsAtom* aHeaderField, nsAString& aData) const;
|
||||
void SetHeaderData(nsAtom* aheaderField, const nsAString& aData);
|
||||
|
||||
/**
|
||||
* Create a new presentation shell that will use aContext for its
|
||||
|
@ -984,23 +1032,22 @@ public:
|
|||
/**
|
||||
* Are plugins allowed in this document ?
|
||||
*/
|
||||
virtual bool GetAllowPlugins () = 0;
|
||||
bool GetAllowPlugins ();
|
||||
|
||||
/**
|
||||
* Set the sub document for aContent to aSubDoc.
|
||||
*/
|
||||
virtual nsresult SetSubDocumentFor(Element* aContent,
|
||||
nsIDocument* aSubDoc) = 0;
|
||||
nsresult SetSubDocumentFor(Element* aContent, nsIDocument* aSubDoc);
|
||||
|
||||
/**
|
||||
* Get the sub document for aContent
|
||||
*/
|
||||
virtual nsIDocument *GetSubDocumentFor(nsIContent *aContent) const = 0;
|
||||
nsIDocument* GetSubDocumentFor(nsIContent* aContent) const;
|
||||
|
||||
/**
|
||||
* Find the content node for which aDocument is a sub document.
|
||||
*/
|
||||
virtual Element* FindContentForSubDocument(nsIDocument* aDocument) const = 0;
|
||||
Element* FindContentForSubDocument(nsIDocument* aDocument) const;
|
||||
|
||||
/**
|
||||
* Return the doctype for this document.
|
||||
|
@ -1131,7 +1178,8 @@ public:
|
|||
mozilla::Maybe<mozilla::dom::ServiceWorkerDescriptor> GetController() const;
|
||||
|
||||
protected:
|
||||
virtual Element *GetRootElementInternal() const = 0;
|
||||
virtual Element* GetRootElementInternal() const = 0;
|
||||
void DoNotifyPossibleTitleChange();
|
||||
|
||||
void SetPageUnloadingEventTimeStamp()
|
||||
{
|
||||
|
@ -2063,14 +2111,36 @@ public:
|
|||
/**
|
||||
* Notification that an element is a link that is relevant to style.
|
||||
*/
|
||||
virtual void AddStyleRelevantLink(mozilla::dom::Link* aLink) = 0;
|
||||
void AddStyleRelevantLink(mozilla::dom::Link* aLink)
|
||||
{
|
||||
NS_ASSERTION(aLink, "Passing in a null link. Expect crashes RSN!");
|
||||
#ifdef DEBUG
|
||||
nsPtrHashKey<mozilla::dom::Link>* entry = mStyledLinks.GetEntry(aLink);
|
||||
NS_ASSERTION(!entry, "Document already knows about this Link!");
|
||||
mStyledLinksCleared = false;
|
||||
#endif
|
||||
mStyledLinks.PutEntry(aLink);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that an element is a link and its URI might have been
|
||||
* changed or the element removed. If the element is still a link relevant
|
||||
* to style, then someone must ensure that AddStyleRelevantLink is
|
||||
* (eventually) called on it again.
|
||||
*/
|
||||
virtual void ForgetLink(mozilla::dom::Link* aLink) = 0;
|
||||
void ForgetLink(mozilla::dom::Link* aLink)
|
||||
{
|
||||
NS_ASSERTION(aLink, "Passing in a null link. Expect crashes RSN!");
|
||||
#ifdef DEBUG
|
||||
nsPtrHashKey<mozilla::dom::Link>* entry = mStyledLinks.GetEntry(aLink);
|
||||
NS_ASSERTION(entry || mStyledLinksCleared,
|
||||
"Document knows nothing about this Link!");
|
||||
#endif
|
||||
mStyledLinks.RemoveEntry(aLink);
|
||||
}
|
||||
|
||||
// Refreshes the hrefs of all the links in the document.
|
||||
void RefreshLinkHrefs();
|
||||
|
||||
/**
|
||||
* Resets and removes a box object from the document's box object cache
|
||||
|
@ -2110,7 +2180,8 @@ public:
|
|||
* Check whether we've ever fired a DOMTitleChanged event for this
|
||||
* document.
|
||||
*/
|
||||
bool HaveFiredDOMTitleChange() const {
|
||||
bool HaveFiredDOMTitleChange() const
|
||||
{
|
||||
return mHaveFiredTitleChange;
|
||||
}
|
||||
|
||||
|
@ -2656,7 +2727,7 @@ public:
|
|||
* @param aId the ID associated the element we want to lookup
|
||||
* @return the element associated with |aId|
|
||||
*/
|
||||
virtual Element* LookupImageElement(const nsAString& aElementId) = 0;
|
||||
Element* LookupImageElement(const nsAString& aElementId);
|
||||
|
||||
virtual mozilla::dom::DocumentTimeline* Timeline() = 0;
|
||||
virtual mozilla::LinkedList<mozilla::dom::DocumentTimeline>& Timelines() = 0;
|
||||
|
@ -2897,8 +2968,8 @@ public:
|
|||
already_AddRefed<mozilla::dom::AboutCapabilities> GetAboutCapabilities(
|
||||
ErrorResult& aRv);
|
||||
|
||||
virtual void GetTitle(nsAString& aTitle) = 0;
|
||||
virtual void SetTitle(const nsAString& aTitle, mozilla::ErrorResult& rv) = 0;
|
||||
void GetTitle(nsAString& aTitle);
|
||||
void SetTitle(const nsAString& aTitle, mozilla::ErrorResult& rv);
|
||||
void GetDir(nsAString& aDirection) const;
|
||||
void SetDir(const nsAString& aDirection);
|
||||
already_AddRefed<nsContentList> GetElementsByName(const nsAString& aName)
|
||||
|
@ -2924,8 +2995,7 @@ public:
|
|||
}
|
||||
Element* GetCurrentScript();
|
||||
void ReleaseCapture() const;
|
||||
virtual void MozSetImageElement(const nsAString& aImageElementId,
|
||||
Element* aElement) = 0;
|
||||
void MozSetImageElement(const nsAString& aImageElementId, Element* aElement);
|
||||
nsIURI* GetDocumentURIObject() const;
|
||||
// Not const because all the full-screen goop is not const
|
||||
virtual bool FullscreenEnabled(mozilla::dom::CallerType aCallerType) = 0;
|
||||
|
@ -3143,8 +3213,8 @@ public:
|
|||
|
||||
// For more information on Flash classification, see
|
||||
// toolkit/components/url-classifier/flash-block-lists.rst
|
||||
virtual mozilla::dom::FlashClassification DocumentFlashClassification() = 0;
|
||||
virtual bool IsThirdParty() = 0;
|
||||
mozilla::dom::FlashClassification DocumentFlashClassification();
|
||||
bool IsThirdParty();
|
||||
|
||||
bool IsScopedStyleEnabled();
|
||||
|
||||
|
@ -3222,6 +3292,23 @@ public:
|
|||
nsIContent* GetContentInThisDocument(nsIFrame* aFrame) const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Returns the title element of the document as defined by the HTML
|
||||
* specification, or null if there isn't one. For documents whose root
|
||||
* element is an <svg:svg>, this is the first <svg:title> element that's a
|
||||
* child of the root. For other documents, it's the first HTML title element
|
||||
* in the document.
|
||||
*/
|
||||
Element* GetTitleElement();
|
||||
|
||||
// Retrieves the classification of the Flash plugins in the document based on
|
||||
// the classification lists.
|
||||
mozilla::dom::FlashClassification PrincipalFlashClassification();
|
||||
|
||||
// Attempts to determine the Flash classification of this page based on the
|
||||
// the classification lists and the classification of parent documents.
|
||||
mozilla::dom::FlashClassification ComputeFlashClassification();
|
||||
|
||||
bool GetUseCounter(mozilla::UseCounter aUseCounter)
|
||||
{
|
||||
return mUseCounters[aUseCounter];
|
||||
|
@ -3296,7 +3383,7 @@ protected:
|
|||
virtual nsIScriptGlobalObject* GetScriptHandlingObjectInternal() const = 0;
|
||||
|
||||
// Never ever call this. Only call AllowXULXBL!
|
||||
virtual bool InternalAllowXULXBL() = 0;
|
||||
bool InternalAllowXULXBL();
|
||||
|
||||
/**
|
||||
* These methods should be called before and after dispatching
|
||||
|
@ -3404,6 +3491,15 @@ protected:
|
|||
// themselves when they go away.
|
||||
nsAutoPtr<nsTHashtable<nsPtrHashKey<nsISupports> > > mActivityObservers;
|
||||
|
||||
// A hashtable of styled links keyed by address pointer.
|
||||
nsTHashtable<nsPtrHashKey<mozilla::dom::Link>> mStyledLinks;
|
||||
#ifdef DEBUG
|
||||
// Indicates whether mStyledLinks was cleared or not. This is used to track
|
||||
// state so we can provide useful assertions to consumers of ForgetLink and
|
||||
// AddStyleRelevantLink.
|
||||
bool mStyledLinksCleared;
|
||||
#endif
|
||||
|
||||
// The array of all links that need their status resolved. Links must add themselves
|
||||
// to this set by calling RegisterPendingLinkUpdate when added to a document.
|
||||
static const size_t kSegmentSize = 128;
|
||||
|
@ -3637,6 +3733,10 @@ protected:
|
|||
// 'style-sheet-applicable-state-changed' notification.
|
||||
bool mSSApplicableStateNotificationPending: 1;
|
||||
|
||||
// True if this document has ever had an HTML or SVG <title> element
|
||||
// bound to it
|
||||
bool mMayHaveTitleElement: 1;
|
||||
|
||||
// Whether <style scoped> support is enabled in this document.
|
||||
enum { eScopedStyle_Unknown, eScopedStyle_Disabled, eScopedStyle_Enabled };
|
||||
unsigned int mIsScopedStyleEnabled : 2;
|
||||
|
@ -3839,6 +3939,27 @@ protected:
|
|||
// Our update nesting level
|
||||
uint32_t mUpdateNestLevel;
|
||||
|
||||
enum ViewportType {
|
||||
DisplayWidthHeight,
|
||||
Specified,
|
||||
Unknown
|
||||
};
|
||||
|
||||
ViewportType mViewportType;
|
||||
|
||||
PLDHashTable* mSubDocuments;
|
||||
|
||||
nsDocHeaderData* mHeaderData;
|
||||
|
||||
RefPtr<PrincipalFlashClassifier> mPrincipalFlashClassifier;
|
||||
mozilla::dom::FlashClassification mFlashClassification;
|
||||
// Do not use this value directly. Call the |IsThirdParty()| method, which
|
||||
// caches its result here.
|
||||
mozilla::Maybe<bool> mIsThirdParty;
|
||||
|
||||
nsRevocableEventPtr<nsRunnableMethod<nsIDocument, void, false>>
|
||||
mPendingTitleChangeEvent;
|
||||
|
||||
nsTArray<RefPtr<mozilla::StyleSheet>> mOnDemandBuiltInUASheets;
|
||||
nsTArray<RefPtr<mozilla::StyleSheet>> mAdditionalSheets[AdditionalSheetTypeCount];
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
void AddSizeOfIncludingThis(nsWindowSizes& aSizes) const;
|
||||
|
||||
protected:
|
||||
friend class nsDocument;
|
||||
friend class nsIDocument;
|
||||
friend class nsXULPrototypeDocument;
|
||||
friend nsresult NS_NewDOMDocumentType(nsIDOMDocumentType** ,
|
||||
nsNodeInfoManager *,
|
||||
|
|
Загрузка…
Ссылка в новой задаче