Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug

Summary: Really sorry for the size of the patch. It's mostly automatic
s/nsIDocument/Document/ but I had to fix up in a bunch of places manually to
add the right namespacing and such.

Overall it's not a very interesting patch I think.

nsDocument.cpp turns into Document.cpp, nsIDocument.h into Document.h and
nsIDocumentInlines.h into DocumentInlines.h.

I also changed a bunch of nsCOMPtr usage to RefPtr, but not all of it.

While fixing up some of the bits I also removed some unneeded OwnerDoc() null
checks and such, but I didn't do anything riskier than that.
This commit is contained in:
Emilio Cobos Álvarez 2019-01-02 14:05:23 +01:00
parent ff20f2519a
commit d2ed260822
954 changed files with 5076 additions and 5120 deletions

View File

@ -22,7 +22,7 @@ const uint32_t kCacheRefreshInterval = 500;
// DocAccessibleWrap
////////////////////////////////////////////////////////////////////////////////
DocAccessibleWrap::DocAccessibleWrap(nsIDocument* aDocument,
DocAccessibleWrap::DocAccessibleWrap(Document* aDocument,
nsIPresShell* aPresShell)
: DocAccessible(aDocument, aPresShell) {
nsCOMPtr<nsIDocShellTreeItem> treeItem(aDocument->GetDocShell());

View File

@ -14,7 +14,7 @@ namespace a11y {
class DocAccessibleWrap : public DocAccessible {
public:
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
DocAccessibleWrap(Document* aDocument, nsIPresShell* aPresShell);
virtual ~DocAccessibleWrap();
virtual nsresult HandleAccEvent(AccEvent* aEvent) override;

View File

@ -13,7 +13,7 @@
using namespace mozilla::a11y;
RootAccessibleWrap::RootAccessibleWrap(nsIDocument* aDoc,
RootAccessibleWrap::RootAccessibleWrap(mozilla::dom::Document* aDoc,
nsIPresShell* aPresShell)
: RootAccessible(aDoc, aPresShell) {}

View File

@ -15,7 +15,7 @@ class DocProxyAccessibleWrap;
class RootAccessibleWrap : public RootAccessible {
public:
RootAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
RootAccessibleWrap(dom::Document* aDocument, nsIPresShell* aPresShell);
virtual ~RootAccessibleWrap();
AccessibleWrap* GetContentAccessible();

View File

@ -13,7 +13,7 @@ using namespace mozilla::a11y;
// DocAccessibleWrap
////////////////////////////////////////////////////////////////////////////////
DocAccessibleWrap::DocAccessibleWrap(nsIDocument* aDocument,
DocAccessibleWrap::DocAccessibleWrap(dom::Document* aDocument,
nsIPresShell* aPresShell)
: DocAccessible(aDocument, aPresShell), mActivated(false) {}

View File

@ -18,7 +18,7 @@ namespace a11y {
class DocAccessibleWrap : public DocAccessible {
public:
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
DocAccessibleWrap(dom::Document* aDocument, nsIPresShell* aPresShell);
virtual ~DocAccessibleWrap();
bool mActivated;

View File

@ -52,7 +52,7 @@ DocManager::DocManager() : mDocAccessibleCache(2), mXPCDocumentCache(0) {}
////////////////////////////////////////////////////////////////////////////////
// DocManager public
DocAccessible* DocManager::GetDocAccessible(nsIDocument* aDocument) {
DocAccessible* DocManager::GetDocAccessible(Document* aDocument) {
if (!aDocument) return nullptr;
DocAccessible* docAcc = GetExistingDocAccessible(aDocument);
@ -90,7 +90,7 @@ void DocManager::RemoveFromXPCDocumentCache(DocAccessible* aDocument) {
}
void DocManager::NotifyOfDocumentShutdown(DocAccessible* aDocument,
nsIDocument* aDOMDocument) {
Document* aDOMDocument) {
// We need to remove listeners in both cases, when document is being shutdown
// or when accessibility service is being shut down as well.
RemoveListeners(aDOMDocument);
@ -218,7 +218,7 @@ DocManager::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
nsPIDOMWindowOuter* piWindow = nsPIDOMWindowOuter::From(DOMWindow);
MOZ_ASSERT(piWindow);
nsCOMPtr<nsIDocument> document = piWindow->GetDoc();
nsCOMPtr<Document> document = piWindow->GetDoc();
NS_ENSURE_STATE(document);
// Document was loaded.
@ -316,7 +316,7 @@ DocManager::HandleEvent(Event* aEvent) {
nsAutoString type;
aEvent->GetType(type);
nsCOMPtr<nsIDocument> document = do_QueryInterface(aEvent->GetTarget());
nsCOMPtr<Document> document = do_QueryInterface(aEvent->GetTarget());
NS_ASSERTION(document, "pagehide or DOMContentLoaded for non document!");
if (!document) return NS_OK;
@ -361,7 +361,7 @@ DocManager::HandleEvent(Event* aEvent) {
////////////////////////////////////////////////////////////////////////////////
// DocManager private
void DocManager::HandleDOMDocumentLoad(nsIDocument* aDocument,
void DocManager::HandleDOMDocumentLoad(Document* aDocument,
uint32_t aLoadEventType) {
// Document accessible can be created before we were notified the DOM document
// was loaded completely. However if it's not created yet then create it.
@ -374,7 +374,7 @@ void DocManager::HandleDOMDocumentLoad(nsIDocument* aDocument,
docAcc->NotifyOfLoad(aLoadEventType);
}
void DocManager::AddListeners(nsIDocument* aDocument,
void DocManager::AddListeners(Document* aDocument,
bool aAddDOMContentLoadedListener) {
nsPIDOMWindowOuter* window = aDocument->GetWindow();
EventTarget* target = window->GetChromeEventHandler();
@ -397,7 +397,7 @@ void DocManager::AddListeners(nsIDocument* aDocument,
}
}
void DocManager::RemoveListeners(nsIDocument* aDocument) {
void DocManager::RemoveListeners(Document* aDocument) {
nsPIDOMWindowOuter* window = aDocument->GetWindow();
if (!window) return;
@ -412,7 +412,7 @@ void DocManager::RemoveListeners(nsIDocument* aDocument) {
TrustedEventsAtCapture());
}
DocAccessible* DocManager::CreateDocOrRootAccessible(nsIDocument* aDocument) {
DocAccessible* DocManager::CreateDocOrRootAccessible(Document* aDocument) {
// Ignore hidden documents, resource documents, static clone
// (printing) documents and documents without a docshell.
if (!aDocument->IsVisibleConsideringAncestors() ||

View File

@ -6,7 +6,7 @@
#define mozilla_a11_DocManager_h_
#include "mozilla/ClearOnShutdown.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIDOMEventListener.h"
#include "nsRefPtrHashtable.h"
#include "nsIWebProgressListener.h"
@ -36,7 +36,7 @@ class DocManager : public nsIWebProgressListener,
/**
* Return document accessible for the given DOM node.
*/
DocAccessible* GetDocAccessible(nsIDocument* aDocument);
DocAccessible* GetDocAccessible(dom::Document* aDocument);
/**
* Return document accessible for the given presshell.
@ -60,7 +60,7 @@ class DocManager : public nsIWebProgressListener,
* Called by document accessible when it gets shutdown.
*/
void NotifyOfDocumentShutdown(DocAccessible* aDocument,
nsIDocument* aDOMDocument);
dom::Document* aDOMDocument);
void RemoveFromXPCDocumentCache(DocAccessible* aDocument);
@ -142,25 +142,25 @@ class DocManager : public nsIWebProgressListener,
* @param aLoadEventType [in] specifies the event type to fire load event,
* if 0 then no event is fired
*/
void HandleDOMDocumentLoad(nsIDocument* aDocument, uint32_t aLoadEventType);
void HandleDOMDocumentLoad(dom::Document* aDocument, uint32_t aLoadEventType);
/**
* Add/remove 'pagehide' and 'DOMContentLoaded' event listeners.
*/
void AddListeners(nsIDocument* aDocument, bool aAddPageShowListener);
void RemoveListeners(nsIDocument* aDocument);
void AddListeners(dom::Document* aDocument, bool aAddPageShowListener);
void RemoveListeners(dom::Document* aDocument);
/**
* Create document or root accessible.
*/
DocAccessible* CreateDocOrRootAccessible(nsIDocument* aDocument);
DocAccessible* CreateDocOrRootAccessible(dom::Document* aDocument);
/**
* Clear the cache and shutdown the document accessibles.
*/
void ClearDocCache();
typedef nsRefPtrHashtable<nsPtrHashKey<const nsIDocument>, DocAccessible>
typedef nsRefPtrHashtable<nsPtrHashKey<const dom::Document>, DocAccessible>
DocAccessibleHashtable;
DocAccessibleHashtable mDocAccessibleCache;
@ -182,7 +182,7 @@ class DocManager : public nsIWebProgressListener,
* Note this returns the doc accessible for the primary pres shell if there is
* more than one.
*/
inline DocAccessible* GetExistingDocAccessible(const nsIDocument* aDocument) {
inline DocAccessible* GetExistingDocAccessible(const dom::Document* aDocument) {
nsIPresShell* ps = aDocument->GetShell();
return ps ? ps->GetDocAccessible() : nullptr;
}

View File

@ -134,7 +134,7 @@ void FocusManager::NotifyOfDOMBlur(nsISupports* aTarget) {
// the case when no element within this DOM document will be focused.
nsCOMPtr<nsINode> targetNode(do_QueryInterface(aTarget));
if (targetNode && targetNode->OwnerDoc() == FocusedDOMDocument()) {
nsIDocument* DOMDoc = targetNode->OwnerDoc();
dom::Document* DOMDoc = targetNode->OwnerDoc();
DocAccessible* document = GetAccService()->GetDocAccessible(DOMDoc);
if (document) {
// Clear selection listener for previously focused element.
@ -376,7 +376,7 @@ nsINode* FocusManager::FocusedDOMNode() const {
return focusedWnd ? focusedWnd->GetExtantDoc() : nullptr;
}
nsIDocument* FocusManager::FocusedDOMDocument() const {
dom::Document* FocusManager::FocusedDOMDocument() const {
nsINode* focusedNode = FocusedDOMNode();
return focusedNode ? focusedNode->OwnerDoc() : nullptr;
}

View File

@ -8,10 +8,13 @@
#include "mozilla/RefPtr.h"
class nsINode;
class nsIDocument;
class nsISupports;
namespace mozilla {
namespace dom {
class Document;
}
namespace a11y {
class AccEvent;
@ -117,7 +120,7 @@ class FocusManager {
/**
* Return DOM document having DOM focus.
*/
nsIDocument* FocusedDOMDocument() const;
dom::Document* FocusedDOMDocument() const;
private:
RefPtr<Accessible> mActiveItem;

View File

@ -82,11 +82,11 @@ static void EnableLogging(const char* aModulesStr) {
}
}
static void LogDocURI(nsIDocument* aDocumentNode) {
static void LogDocURI(dom::Document* aDocumentNode) {
printf("uri: %s", aDocumentNode->GetDocumentURI()->GetSpecOrDefault().get());
}
static void LogDocShellState(nsIDocument* aDocumentNode) {
static void LogDocShellState(dom::Document* aDocumentNode) {
printf("docshell busy: ");
nsAutoCString docShellBusy;
@ -107,7 +107,7 @@ static void LogDocShellState(nsIDocument* aDocumentNode) {
}
}
static void LogDocType(nsIDocument* aDocumentNode) {
static void LogDocType(dom::Document* aDocumentNode) {
if (aDocumentNode->IsActive()) {
bool isContent = nsCoreUtils::IsContentDocument(aDocumentNode);
printf("%s document", (isContent ? "content" : "chrome"));
@ -116,7 +116,7 @@ static void LogDocType(nsIDocument* aDocumentNode) {
}
}
static void LogDocShellTree(nsIDocument* aDocumentNode) {
static void LogDocShellTree(dom::Document* aDocumentNode) {
if (aDocumentNode->IsActive()) {
nsCOMPtr<nsIDocShellTreeItem> treeItem(aDocumentNode->GetDocShell());
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
@ -129,20 +129,20 @@ static void LogDocShellTree(nsIDocument* aDocumentNode) {
}
}
static void LogDocState(nsIDocument* aDocumentNode) {
static void LogDocState(dom::Document* aDocumentNode) {
const char* docState = nullptr;
nsIDocument::ReadyState docStateFlag = aDocumentNode->GetReadyStateEnum();
dom::Document::ReadyState docStateFlag = aDocumentNode->GetReadyStateEnum();
switch (docStateFlag) {
case nsIDocument::READYSTATE_UNINITIALIZED:
case dom::Document::READYSTATE_UNINITIALIZED:
docState = "uninitialized";
break;
case nsIDocument::READYSTATE_LOADING:
case dom::Document::READYSTATE_LOADING:
docState = "loading";
break;
case nsIDocument::READYSTATE_INTERACTIVE:
case dom::Document::READYSTATE_INTERACTIVE:
docState = "interactive";
break;
case nsIDocument::READYSTATE_COMPLETE:
case dom::Document::READYSTATE_COMPLETE:
docState = "complete";
break;
}
@ -163,7 +163,7 @@ static void LogDocState(nsIDocument* aDocumentNode) {
printf(", has %srole content", rootEl ? "" : "no ");
}
static void LogPresShell(nsIDocument* aDocumentNode) {
static void LogPresShell(dom::Document* aDocumentNode) {
nsIPresShell* ps = aDocumentNode->GetShell();
printf("presshell: %p", static_cast<void*>(ps));
@ -175,13 +175,13 @@ static void LogPresShell(nsIDocument* aDocumentNode) {
printf(", root scroll frame: %p", static_cast<void*>(sf));
}
static void LogDocLoadGroup(nsIDocument* aDocumentNode) {
static void LogDocLoadGroup(dom::Document* aDocumentNode) {
nsCOMPtr<nsILoadGroup> loadGroup = aDocumentNode->GetDocumentLoadGroup();
printf("load group: %p", static_cast<void*>(loadGroup));
}
static void LogDocParent(nsIDocument* aDocumentNode) {
nsIDocument* parentDoc = aDocumentNode->GetParentDocument();
static void LogDocParent(dom::Document* aDocumentNode) {
dom::Document* parentDoc = aDocumentNode->GetParentDocument();
printf("parent DOM document: %p", static_cast<void*>(parentDoc));
if (parentDoc) {
printf(", parent acc document: %p",
@ -192,7 +192,7 @@ static void LogDocParent(nsIDocument* aDocumentNode) {
}
}
static void LogDocInfo(nsIDocument* aDocumentNode, DocAccessible* aDocument) {
static void LogDocInfo(dom::Document* aDocumentNode, DocAccessible* aDocument) {
printf(" DOM document: %p, acc document: %p\n ",
static_cast<void*>(aDocumentNode), static_cast<void*>(aDocument));
@ -370,7 +370,7 @@ void logging::DocLoad(const char* aMsg, nsIWebProgress* aWebProgress,
return;
}
nsCOMPtr<nsIDocument> documentNode = window->GetDoc();
nsCOMPtr<dom::Document> documentNode = window->GetDoc();
if (!documentNode) {
MsgEnd();
return;
@ -394,7 +394,7 @@ void logging::DocLoad(const char* aMsg, nsIWebProgress* aWebProgress,
MsgEnd();
}
void logging::DocLoad(const char* aMsg, nsIDocument* aDocumentNode) {
void logging::DocLoad(const char* aMsg, dom::Document* aDocumentNode) {
MsgBegin(sDocLoadTitle, "%s", aMsg);
DocAccessible* document = GetExistingDocAccessible(aDocumentNode);
@ -444,7 +444,7 @@ void logging::DocLoadEventHandled(AccEvent* aEvent) {
MsgEnd();
}
void logging::DocCreate(const char* aMsg, nsIDocument* aDocumentNode,
void logging::DocCreate(const char* aMsg, dom::Document* aDocumentNode,
DocAccessible* aDocument) {
DocAccessible* document =
aDocument ? aDocument : GetExistingDocAccessible(aDocumentNode);
@ -454,7 +454,7 @@ void logging::DocCreate(const char* aMsg, nsIDocument* aDocumentNode,
MsgEnd();
}
void logging::DocDestroy(const char* aMsg, nsIDocument* aDocumentNode,
void logging::DocDestroy(const char* aMsg, dom::Document* aDocumentNode,
DocAccessible* aDocument) {
DocAccessible* document =
aDocument ? aDocument : GetExistingDocAccessible(aDocumentNode);
@ -713,7 +713,7 @@ void logging::Address(const char* aDescr, Accessible* aAcc) {
}
DocAccessible* doc = aAcc->Document();
nsIDocument* docNode = doc->DocumentNode();
dom::Document* docNode = doc->DocumentNode();
printf(" document: %p, node: %p\n", static_cast<void*>(doc),
static_cast<void*>(docNode));

View File

@ -11,7 +11,6 @@
#include "nsStringFwd.h"
#include "mozilla/Attributes.h"
class nsIDocument;
class nsINode;
class nsIRequest;
class nsISupports;
@ -20,6 +19,7 @@ class nsIWebProgress;
namespace mozilla {
namespace dom {
class Document;
class Selection;
} // namespace dom
@ -74,7 +74,7 @@ bool IsEnabled(const nsAString& aModules);
*/
void DocLoad(const char* aMsg, nsIWebProgress* aWebProgress,
nsIRequest* aRequest, uint32_t aStateFlags);
void DocLoad(const char* aMsg, nsIDocument* aDocumentNode);
void DocLoad(const char* aMsg, dom::Document* aDocumentNode);
void DocCompleteLoad(DocAccessible* aDocument, bool aIsLoadEventTarget);
/**
@ -90,13 +90,13 @@ void DocLoadEventHandled(AccEvent* aEvent);
/**
* Log the document was created.
*/
void DocCreate(const char* aMsg, nsIDocument* aDocumentNode,
void DocCreate(const char* aMsg, dom::Document* aDocumentNode,
DocAccessible* aDocument = nullptr);
/**
* Log the document was destroyed.
*/
void DocDestroy(const char* aMsg, nsIDocument* aDocumentNode,
void DocDestroy(const char* aMsg, dom::Document* aDocumentNode,
DocAccessible* aDocument = nullptr);
/**

View File

@ -15,7 +15,7 @@
#include "nsFrameSelection.h"
#include "nsIAccessibleTypes.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIPresShell.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/Element.h"
@ -138,7 +138,7 @@ void SelectionManager::ProcessTextSelChangeEvent(AccEvent* aEvent) {
}
NS_IMETHODIMP
SelectionManager::NotifySelectionChanged(nsIDocument* aDocument,
SelectionManager::NotifySelectionChanged(dom::Document* aDocument,
Selection* aSelection,
int16_t aReason) {
if (NS_WARN_IF(!aDocument) || NS_WARN_IF(!aSelection)) {

View File

@ -449,7 +449,7 @@ bool nsAccUtils::IsARIALive(const Accessible* aAccessible) {
nsAutoString live;
nsIContent* startContent = aAccessible->GetContent();
while (startContent) {
nsIDocument* doc = startContent->GetComposedDoc();
dom::Document* doc = startContent->GetComposedDoc();
if (!doc) {
break;
}
@ -495,7 +495,7 @@ bool nsAccUtils::IsARIALive(const Accessible* aAccessible) {
break;
}
nsIDocument* parentDoc = doc->GetParentDocument();
dom::Document* parentDoc = doc->GetParentDocument();
if (!parentDoc) {
break;
}

View File

@ -282,7 +282,7 @@ nsAccessibilityService::ListenersChanged(nsIArray* aEventChanges) {
NS_ENSURE_SUCCESS(rv, rv);
for (uint32_t i = 0; i < changeCount; i++) {
nsIDocument* ownerDoc = node->OwnerDoc();
Document* ownerDoc = node->OwnerDoc();
DocAccessible* document = GetExistingDocAccessible(ownerDoc);
// Create an accessible for a inaccessible element having click event
@ -318,7 +318,7 @@ nsAccessibilityService::Observe(nsISupports* aSubject, const char* aTopic,
}
void nsAccessibilityService::NotifyOfAnchorJumpTo(nsIContent* aTargetNode) {
nsIDocument* documentNode = aTargetNode->GetUncomposedDoc();
Document* documentNode = aTargetNode->GetUncomposedDoc();
if (documentNode) {
DocAccessible* document = GetDocAccessible(documentNode);
if (document) document->SetAnchorJump(aTargetNode);
@ -333,7 +333,7 @@ void nsAccessibilityService::FireAccessibleEvent(uint32_t aEvent,
Accessible* nsAccessibilityService::GetRootDocumentAccessible(
nsIPresShell* aPresShell, bool aCanCreate) {
nsIPresShell* ps = aPresShell;
nsIDocument* documentNode = aPresShell->GetDocument();
Document* documentNode = aPresShell->GetDocument();
if (documentNode) {
nsCOMPtr<nsIDocShellTreeItem> treeItem(documentNode->GetDocShell());
if (treeItem) {

View File

@ -9,7 +9,7 @@
#include "nsIBaseWindow.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsRange.h"
#include "nsIBoxObject.h"
#include "nsXULElement.h"
@ -70,7 +70,7 @@ void nsCoreUtils::DispatchClickEvent(nsITreeBoxObject *aTreeBoxObj,
aTreeBoxObj->GetTreeBody(getter_AddRefs(tcElm));
if (!tcElm) return;
nsIDocument *document = tcElm->GetUncomposedDoc();
Document *document = tcElm->GetUncomposedDoc();
if (!document) return;
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
@ -340,7 +340,7 @@ already_AddRefed<nsIDocShell> nsCoreUtils::GetDocShellFor(nsINode *aNode) {
return docShell.forget();
}
bool nsCoreUtils::IsRootDocument(nsIDocument *aDocument) {
bool nsCoreUtils::IsRootDocument(Document *aDocument) {
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = aDocument->GetDocShell();
NS_ASSERTION(docShellTreeItem, "No document shell for document!");
@ -350,14 +350,14 @@ bool nsCoreUtils::IsRootDocument(nsIDocument *aDocument) {
return !parentTreeItem;
}
bool nsCoreUtils::IsContentDocument(nsIDocument *aDocument) {
bool nsCoreUtils::IsContentDocument(Document *aDocument) {
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = aDocument->GetDocShell();
NS_ASSERTION(docShellTreeItem, "No document shell tree item for document!");
return (docShellTreeItem->ItemType() == nsIDocShellTreeItem::typeContent);
}
bool nsCoreUtils::IsTabDocument(nsIDocument *aDocumentNode) {
bool nsCoreUtils::IsTabDocument(Document *aDocumentNode) {
nsCOMPtr<nsIDocShellTreeItem> treeItem(aDocumentNode->GetDocShell());
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
@ -373,7 +373,7 @@ bool nsCoreUtils::IsTabDocument(nsIDocument *aDocumentNode) {
return parentTreeItem == rootTreeItem;
}
bool nsCoreUtils::IsErrorPage(nsIDocument *aDocument) {
bool nsCoreUtils::IsErrorPage(Document *aDocument) {
nsIURI *uri = aDocument->GetDocumentURI();
bool isAboutScheme = false;
uri->SchemeIs("about", &isAboutScheme);

View File

@ -10,7 +10,7 @@
#include "mozilla/dom/Element.h"
#include "nsIAccessibleEvent.h"
#include "nsIContent.h"
#include "nsIDocument.h" // for GetShell()
#include "mozilla/dom/Document.h" // for GetShell()
#include "nsIPresShell.h"
#include "nsPoint.h"
@ -29,6 +29,8 @@ class nsIWidget;
*/
class nsCoreUtils {
public:
typedef mozilla::dom::Document Document;
/**
* Return true if the given node is a label of a control.
*/
@ -185,22 +187,22 @@ class nsCoreUtils {
/**
* Return true if the given document is root document.
*/
static bool IsRootDocument(nsIDocument *aDocument);
static bool IsRootDocument(Document *aDocument);
/**
* Return true if the given document is content document (not chrome).
*/
static bool IsContentDocument(nsIDocument *aDocument);
static bool IsContentDocument(Document *aDocument);
/**
* Return true if the given document node is for tab document accessible.
*/
static bool IsTabDocument(nsIDocument *aDocumentNode);
static bool IsTabDocument(Document *aDocumentNode);
/**
* Return true if the given document is an error page.
*/
static bool IsErrorPage(nsIDocument *aDocument);
static bool IsErrorPage(Document *aDocument);
/**
* Return presShell for the document containing the given DOM node.

View File

@ -37,7 +37,7 @@
#include "nsINodeList.h"
#include "nsPIDOMWindow.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIContent.h"
#include "nsIForm.h"
#include "nsIFormControl.h"
@ -265,7 +265,7 @@ KeyBinding Accessible::AccessKey() const {
}
// Determine the access modifier used in this context.
nsIDocument* document = mContent->GetUncomposedDoc();
dom::Document* document = mContent->GetUncomposedDoc();
if (!document) return KeyBinding();
nsCOMPtr<nsIDocShellTreeItem> treeItem(document->GetDocShell());
@ -1025,7 +1025,7 @@ already_AddRefed<nsIPersistentProperties> Accessible::NativeAttributes() {
// override properties on a widget they used in an iframe.
nsIContent* startContent = mContent;
while (startContent) {
nsIDocument* doc = startContent->GetComposedDoc();
dom::Document* doc = startContent->GetComposedDoc();
if (!doc) break;
nsAccUtils::SetLiveContainerAttributes(attributes, startContent,
@ -1039,7 +1039,7 @@ already_AddRefed<nsIPersistentProperties> Accessible::NativeAttributes() {
docShellTreeItem->GetSameTypeParent(getter_AddRefs(sameTypeParent));
if (!sameTypeParent || sameTypeParent == docShellTreeItem) break;
nsIDocument* parentDoc = doc->GetParentDocument();
dom::Document* parentDoc = doc->GetParentDocument();
if (!parentDoc) break;
startContent = parentDoc->FindContentForSubDocument(doc);
@ -1687,7 +1687,7 @@ Relation Accessible::RelationByType(RelationType aType) const {
}
} else {
// In XUL, use first <button default="true" .../> in the document
nsIDocument* doc = mContent->OwnerDoc();
dom::Document* doc = mContent->OwnerDoc();
nsIContent* buttonEl = nullptr;
if (doc->IsXULDocument()) {
dom::XULDocument* xulDoc = doc->AsXULDocument();
@ -2393,7 +2393,7 @@ Accessible* Accessible::CurrentItem() const {
if (HasOwnContent() && mContent->IsElement() &&
mContent->AsElement()->GetAttr(kNameSpaceID_None,
nsGkAtoms::aria_activedescendant, id)) {
nsIDocument* DOMDoc = mContent->OwnerDoc();
dom::Document* DOMDoc = mContent->OwnerDoc();
dom::Element* activeDescendantElm = DOMDoc->GetElementById(id);
if (activeDescendantElm) {
DocAccessible* document = Document();

View File

@ -125,9 +125,7 @@ void ApplicationAccessible::Init() {
for (auto iter = windowsById->Iter(); !iter.Done(); iter.Next()) {
nsGlobalWindowOuter* window = iter.Data();
if (window->GetDocShell() && window->IsRootOuterWindow()) {
nsCOMPtr<nsIDocument> docNode = window->GetExtantDoc();
if (docNode) {
if (RefPtr<dom::Document> docNode = window->GetExtantDoc()) {
GetAccService()->GetDocAccessible(docNode); // ensure creation
}
}

View File

@ -13,7 +13,7 @@
#include "NotificationController.h"
#include "States.h"
#include "nsIScrollableFrame.h"
#include "nsIDocumentInlines.h"
#include "mozilla/dom/DocumentInlines.h"
#ifdef A11Y_LOG
#include "Logging.h"

View File

@ -23,7 +23,7 @@
#include "nsIMutableArray.h"
#include "nsICommandManager.h"
#include "nsIDocShell.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsPIDOMWindow.h"
#include "nsIEditingSession.h"
#include "nsIFrame.h"
@ -70,7 +70,7 @@ static const uint32_t kRelationAttrsLen = ArrayLength(kRelationAttrs);
////////////////////////////////////////////////////////////////////////////////
// Constructor/desctructor
DocAccessible::DocAccessible(nsIDocument* aDocument, nsIPresShell* aPresShell)
DocAccessible::DocAccessible(dom::Document* aDocument, nsIPresShell* aPresShell)
: // XXX don't pass a document to the Accessible constructor so that we
// don't set mDoc until our vtable is fully setup. If we set mDoc before
// setting up the vtable we will call Accessible::AddRef() but not the
@ -372,7 +372,7 @@ void DocAccessible::Init() {
// Mark the document accessible as loaded if its DOM document was loaded at
// this point (this can happen because a11y is started late or DOM document
// having no container was loaded.
if (mDocumentNode->GetReadyStateEnum() == nsIDocument::READYSTATE_COMPLETE)
if (mDocumentNode->GetReadyStateEnum() == dom::Document::READYSTATE_COMPLETE)
mLoadState |= eDOMLoaded;
AddEventListeners();
@ -461,8 +461,8 @@ nsIFrame* DocAccessible::GetFrame() const {
nsRect DocAccessible::RelativeBounds(nsIFrame** aRelativeFrame) const {
*aRelativeFrame = GetFrame();
nsIDocument* document = mDocumentNode;
nsIDocument* parentDoc = nullptr;
dom::Document* document = mDocumentNode;
dom::Document* parentDoc = nullptr;
nsRect bounds;
while (document) {
@ -1020,7 +1020,7 @@ void DocAccessible::ARIAActiveDescendantChanged(Accessible* aAccessible) {
void DocAccessible::ContentAppended(nsIContent* aFirstNewContent) {}
void DocAccessible::ContentStateChanged(nsIDocument* aDocument,
void DocAccessible::ContentStateChanged(dom::Document* aDocument,
nsIContent* aContent,
EventStates aStateMask) {
Accessible* accessible = GetAccessible(aContent);
@ -1058,7 +1058,7 @@ void DocAccessible::ContentStateChanged(nsIDocument* aDocument,
}
}
void DocAccessible::DocumentStatesChanged(nsIDocument* aDocument,
void DocAccessible::DocumentStatesChanged(dom::Document* aDocument,
EventStates aStateMask) {}
void DocAccessible::CharacterDataWillChange(nsIContent* aContent,

View File

@ -14,7 +14,7 @@
#include "nsAutoPtr.h"
#include "nsClassHashtable.h"
#include "nsDataHashtable.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIDocumentObserver.h"
#include "nsIObserver.h"
#include "nsIScrollPositionListener.h"
@ -29,6 +29,10 @@ namespace mozilla {
class TextEditor;
namespace dom {
class Document;
}
namespace a11y {
class DocManager;
@ -50,8 +54,11 @@ class DocAccessible : public HyperTextAccessibleWrap,
NS_DECL_NSIOBSERVER
NS_DECL_NSIACCESSIBLEPIVOTOBSERVER
protected:
typedef mozilla::dom::Document Document;
public:
DocAccessible(nsIDocument* aDocument, nsIPresShell* aPresShell);
DocAccessible(Document* aDocument, nsIPresShell* aPresShell);
// nsIScrollPositionListener
virtual void ScrollPositionWillChange(nscoord aX, nscoord aY) override {}
@ -65,7 +72,7 @@ class DocAccessible : public HyperTextAccessibleWrap,
virtual void Shutdown() override;
virtual nsIFrame* GetFrame() const override;
virtual nsINode* GetNode() const override { return mDocumentNode; }
nsIDocument* DocumentNode() const { return mDocumentNode; }
Document* DocumentNode() const { return mDocumentNode; }
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) const override;
virtual void Description(nsString& aDescription) override;
@ -133,7 +140,7 @@ class DocAccessible : public HyperTextAccessibleWrap,
bool IsContentLoaded() const {
// eDOMLoaded flag check is used for error pages as workaround to make this
// method return correct result since error pages do not receive 'pageshow'
// event and as consequence nsIDocument::IsShowing() returns false.
// event and as consequence Document::IsShowing() returns false.
return mDocumentNode && mDocumentNode->IsVisible() &&
(mDocumentNode->IsShowing() || HasLoadState(eDOMLoaded));
}
@ -596,7 +603,7 @@ class DocAccessible : public HyperTextAccessibleWrap,
nsDataHashtable<nsPtrHashKey<const nsINode>, Accessible*>
mNodeToAccessibleMap;
nsIDocument* mDocumentNode;
Document* mDocumentNode;
nsCOMPtr<nsITimer> mScrollWatchTimer;
uint16_t mScrollPositionChangedTicks; // Used for tracking scroll events
TimeStamp mLastScrollingDispatch;

View File

@ -1238,7 +1238,7 @@ already_AddRefed<TextEditor> HyperTextAccessible::GetEditor() const {
docShell->GetEditingSession(getter_AddRefs(editingSession));
if (!editingSession) return nullptr; // No editing session interface
nsIDocument* docNode = mDoc->DocumentNode();
dom::Document* docNode = mDoc->DocumentNode();
RefPtr<HTMLEditor> htmlEditor =
editingSession->GetHTMLEditorForWindow(docNode->GetWindow());
return htmlEditor.forget();
@ -1288,7 +1288,7 @@ nsresult HyperTextAccessible::SetSelectionRange(int32_t aStartPos,
nsFocusManager* DOMFocusManager = nsFocusManager::GetFocusManager();
if (DOMFocusManager) {
NS_ENSURE_TRUE(mDoc, NS_ERROR_FAILURE);
nsIDocument* docNode = mDoc->DocumentNode();
dom::Document* docNode = mDoc->DocumentNode();
NS_ENSURE_TRUE(docNode, NS_ERROR_FAILURE);
nsCOMPtr<nsPIDOMWindowOuter> window = docNode->GetWindow();
RefPtr<dom::Element> result;

View File

@ -13,7 +13,7 @@
#include "imgIContainer.h"
#include "imgIRequest.h"
#include "nsGenericHTMLElement.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIImageLoadingContent.h"
#include "nsIPresShell.h"
#include "nsIServiceManager.h"
@ -106,7 +106,7 @@ bool ImageAccessible::DoAction(uint8_t aIndex) const {
uri->GetSpec(utf8spec);
NS_ConvertUTF8toUTF16 spec(utf8spec);
nsIDocument* document = mContent->OwnerDoc();
dom::Document* document = mContent->OwnerDoc();
nsCOMPtr<nsPIDOMWindowOuter> piWindow = document->GetWindow();
if (!piWindow) return false;

View File

@ -37,9 +37,9 @@ OuterDocAccessible::OuterDocAccessible(nsIContent* aContent,
// Request document accessible for the content document to make sure it's
// created. It will appended to outerdoc accessible children asynchronously.
nsIDocument* outerDoc = mContent->GetUncomposedDoc();
dom::Document* outerDoc = mContent->GetUncomposedDoc();
if (outerDoc) {
nsIDocument* innerDoc = outerDoc->GetSubDocumentFor(mContent);
dom::Document* innerDoc = outerDoc->GetSubDocumentFor(mContent);
if (innerDoc) GetAccService()->GetDocAccessible(innerDoc);
}
}

View File

@ -32,7 +32,7 @@
#include "mozilla/dom/Event.h"
#include "mozilla/dom/EventTarget.h"
#include "nsIDOMXULMultSelectCntrlEl.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIPropertyBag2.h"
#include "nsIServiceManager.h"
@ -58,7 +58,7 @@ NS_IMPL_ISUPPORTS_INHERITED(RootAccessible, DocAccessible, nsIDOMEventListener)
////////////////////////////////////////////////////////////////////////////////
// Constructor/destructor
RootAccessible::RootAccessible(nsIDocument* aDocument, nsIPresShell* aPresShell)
RootAccessible::RootAccessible(Document* aDocument, nsIPresShell* aPresShell)
: DocAccessibleWrap(aDocument, aPresShell) {
mType = eRootType;
}
@ -448,7 +448,7 @@ Relation RootAccessible::RelationByType(RelationType aType) const {
nsCOMPtr<nsPIDOMWindowOuter> contentWindow =
nsGlobalWindowOuter::Cast(rootWindow)->GetContent();
if (contentWindow) {
nsCOMPtr<nsIDocument> contentDocumentNode = contentWindow->GetDoc();
RefPtr<Document> contentDocumentNode = contentWindow->GetDoc();
if (contentDocumentNode) {
DocAccessible* contentDocument =
GetAccService()->GetDocAccessible(contentDocumentNode);

View File

@ -11,8 +11,6 @@
#include "nsIDOMEventListener.h"
class nsIDocument;
namespace mozilla {
namespace a11y {
@ -20,7 +18,7 @@ class RootAccessible : public DocAccessibleWrap, public nsIDOMEventListener {
NS_DECL_ISUPPORTS_INHERITED
public:
RootAccessible(nsIDocument* aDocument, nsIPresShell* aPresShell);
RootAccessible(dom::Document* aDocument, nsIPresShell* aPresShell);
// nsIDOMEventListener
NS_DECL_NSIDOMEVENTLISTENER

View File

@ -19,7 +19,7 @@
#include "mozilla/dom/HTMLTableElement.h"
#include "nsIHTMLCollection.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIMutableArray.h"
#include "nsIPersistentProperties2.h"
#include "nsIPresShell.h"

View File

@ -13,7 +13,7 @@ namespace a11y {
class DocAccessibleWrap : public DocAccessible {
public:
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
DocAccessibleWrap(dom::Document* aDocument, nsIPresShell* aPresShell);
virtual ~DocAccessibleWrap();
};

View File

@ -10,7 +10,7 @@
using namespace mozilla::a11y;
DocAccessibleWrap::
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell) :
DocAccessibleWrap(mozilla::dom::Document* aDocument, nsIPresShell* aPresShell) :
DocAccessible(aDocument, aPresShell)
{
}

View File

@ -17,7 +17,7 @@ namespace a11y {
class RootAccessibleWrap : public RootAccessible {
public:
RootAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
RootAccessibleWrap(dom::Document* aDocument, nsIPresShell* aPresShell);
virtual ~RootAccessibleWrap();
Class GetNativeType();

View File

@ -16,7 +16,7 @@
using namespace mozilla::a11y;
RootAccessibleWrap::
RootAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell) :
RootAccessibleWrap(mozilla::dom::Document* aDocument, nsIPresShell* aPresShell) :
RootAccessible(aDocument, aPresShell)
{
}

View File

@ -481,7 +481,7 @@ AccessibleWrap::get_accRole(
if (roleString.IsEmpty()) {
// No role attribute (or it is an empty string).
// Use the tag name.
nsIDocument* document = content->GetUncomposedDoc();
dom::Document* document = content->GetUncomposedDoc();
if (!document) return E_FAIL;
dom::NodeInfo* nodeInfo = content->NodeInfo();

View File

@ -25,7 +25,7 @@ using namespace mozilla::a11y;
// DocAccessibleWrap
////////////////////////////////////////////////////////////////////////////////
DocAccessibleWrap::DocAccessibleWrap(nsIDocument* aDocument,
DocAccessibleWrap::DocAccessibleWrap(dom::Document* aDocument,
nsIPresShell* aPresShell)
: DocAccessible(aDocument, aPresShell), mHWND(nullptr) {}

View File

@ -14,7 +14,7 @@ namespace a11y {
class DocAccessibleWrap : public DocAccessible {
public:
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
DocAccessibleWrap(dom::Document* aDocument, nsIPresShell* aPresShell);
virtual ~DocAccessibleWrap();
DECL_IUNKNOWN_INHERITED

View File

@ -15,7 +15,7 @@ using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// Constructor/destructor
RootAccessibleWrap::RootAccessibleWrap(nsIDocument* aDocument,
RootAccessibleWrap::RootAccessibleWrap(dom::Document* aDocument,
nsIPresShell* aPresShell)
: RootAccessible(aDocument, aPresShell), mOuter(&mInternalUnknown) {}

View File

@ -14,7 +14,7 @@ namespace a11y {
class RootAccessibleWrap : public RootAccessible {
public:
RootAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
RootAccessibleWrap(dom::Document* aDocument, nsIPresShell* aPresShell);
virtual ~RootAccessibleWrap();
// RootAccessible

View File

@ -17,7 +17,7 @@
#include "nsArrayUtils.h"
#include "nsIArray.h"
#include "nsICSSDeclaration.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIDocShellTreeItem.h"
#include "mozilla/dom/Element.h"
#include "nsXULAppAPI.h"

View File

@ -192,11 +192,8 @@ xpcAccessibilityService::GetAccessibleFromCache(nsINode* aNode,
// "unofficially" shutdown document (i.e. not from DocManager) can still
// exist in the document cache.
Accessible* accessible = accService->FindAccessibleInCache(aNode);
if (!accessible) {
nsCOMPtr<nsIDocument> document(do_QueryInterface(aNode));
if (document) {
accessible = mozilla::a11y::GetExistingDocAccessible(document);
}
if (!accessible && aNode->IsDocument()) {
accessible = mozilla::a11y::GetExistingDocAccessible(aNode->AsDocument());
}
NS_IF_ADDREF(*aAccessible = ToXPC(accessible));

View File

@ -76,7 +76,7 @@ xpcAccessibleDocument::GetDocType(nsAString& aType) {
}
NS_IMETHODIMP
xpcAccessibleDocument::GetDOMDocument(nsIDocument** aDOMDocument) {
xpcAccessibleDocument::GetDOMDocument(dom::Document** aDOMDocument) {
NS_ENSURE_ARG_POINTER(aDOMDocument);
*aDOMDocument = nullptr;

View File

@ -40,7 +40,7 @@ class xpcAccessibleDocument : public xpcAccessibleHyperText,
NS_IMETHOD GetTitle(nsAString& aTitle) final;
NS_IMETHOD GetMimeType(nsAString& aType) final;
NS_IMETHOD GetDocType(nsAString& aType) final;
NS_IMETHOD GetDOMDocument(nsIDocument** aDOMDocument) final;
NS_IMETHOD GetDOMDocument(dom::Document** aDOMDocument) final;
NS_IMETHOD GetWindow(mozIDOMWindowProxy** aDOMWindow) final;
NS_IMETHOD GetParentDocument(nsIAccessibleDocument** aDocument) final;
NS_IMETHOD GetChildDocumentCount(uint32_t* aCount) final;

View File

@ -206,7 +206,7 @@ already_AddRefed<nsIURI> XULLinkAccessible::AnchorURIAt(
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
nsIDocument* document = mContent->OwnerDoc();
dom::Document* document = mContent->OwnerDoc();
nsCOMPtr<nsIURI> anchorURI;
NS_NewURI(getter_AddRefs(anchorURI), href,

View File

@ -12,7 +12,7 @@
#include "States.h"
// NOTE: alphabetically ordered
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIDOMXULSelectCntrlEl.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDOMXULRelatedElement.h"

View File

@ -5,7 +5,7 @@
#include "nsDirectoryServiceDefs.h"
#include "nsIImageLoadingContent.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIContent.h"
#include "nsILocalFileMac.h"
#include "nsIObserverService.h"

View File

@ -185,7 +185,7 @@ BasePrincipal::SetCsp(nsIContentSecurityPolicy* aCsp) {
}
NS_IMETHODIMP
BasePrincipal::EnsureCSP(nsIDocument* aDocument,
BasePrincipal::EnsureCSP(dom::Document* aDocument,
nsIContentSecurityPolicy** aCSP) {
if (mCSP) {
// if there is a CSP already associated with this principal
@ -213,7 +213,7 @@ BasePrincipal::GetPreloadCsp(nsIContentSecurityPolicy** aPreloadCSP) {
}
NS_IMETHODIMP
BasePrincipal::EnsurePreloadCSP(nsIDocument* aDocument,
BasePrincipal::EnsurePreloadCSP(dom::Document* aDocument,
nsIContentSecurityPolicy** aPreloadCSP) {
if (mPreloadCSP) {
// if there is a speculative CSP already associated with this principal

View File

@ -21,6 +21,9 @@ class nsIURI;
class ExpandedPrincipal;
namespace mozilla {
namespace dom {
class Document;
}
namespace extensions {
class WebExtensionPolicy;
}
@ -105,10 +108,10 @@ class BasePrincipal : public nsJSPrincipals {
NS_IMETHOD GetAddonPolicy(nsISupports** aResult) final;
NS_IMETHOD GetCsp(nsIContentSecurityPolicy** aCsp) override;
NS_IMETHOD SetCsp(nsIContentSecurityPolicy* aCsp) override;
NS_IMETHOD EnsureCSP(nsIDocument* aDocument,
NS_IMETHOD EnsureCSP(dom::Document* aDocument,
nsIContentSecurityPolicy** aCSP) override;
NS_IMETHOD GetPreloadCsp(nsIContentSecurityPolicy** aPreloadCSP) override;
NS_IMETHOD EnsurePreloadCSP(nsIDocument* aDocument,
NS_IMETHOD EnsurePreloadCSP(dom::Document* aDocument,
nsIContentSecurityPolicy** aCSP) override;
NS_IMETHOD GetCspJSON(nsAString& outCSPinJSON) override;
NS_IMETHOD GetIsNullPrincipal(bool* aResult) override;

View File

@ -66,7 +66,7 @@ SystemPrincipal::SetCsp(nsIContentSecurityPolicy* aCsp) {
}
NS_IMETHODIMP
SystemPrincipal::EnsureCSP(nsIDocument* aDocument,
SystemPrincipal::EnsureCSP(dom::Document* aDocument,
nsIContentSecurityPolicy** aCSP) {
// CSP on a system principal makes no sense
return NS_ERROR_FAILURE;
@ -79,7 +79,7 @@ SystemPrincipal::GetPreloadCsp(nsIContentSecurityPolicy** aPreloadCSP) {
}
NS_IMETHODIMP
SystemPrincipal::EnsurePreloadCSP(nsIDocument* aDocument,
SystemPrincipal::EnsurePreloadCSP(dom::Document* aDocument,
nsIContentSecurityPolicy** aPreloadCSP) {
// CSP on a system principal makes no sense
return NS_ERROR_FAILURE;

View File

@ -40,10 +40,10 @@ class SystemPrincipal final : public BasePrincipal {
NS_IMETHOD SetDomain(nsIURI* aDomain) override;
NS_IMETHOD GetCsp(nsIContentSecurityPolicy** aCsp) override;
NS_IMETHOD SetCsp(nsIContentSecurityPolicy* aCsp) override;
NS_IMETHOD EnsureCSP(nsIDocument* aDocument,
NS_IMETHOD EnsureCSP(dom::Document* aDocument,
nsIContentSecurityPolicy** aCSP) override;
NS_IMETHOD GetPreloadCsp(nsIContentSecurityPolicy** aPreloadCSP) override;
NS_IMETHOD EnsurePreloadCSP(nsIDocument* aDocument,
NS_IMETHOD EnsurePreloadCSP(dom::Document* aDocument,
nsIContentSecurityPolicy** aCSP) override;
NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override;
NS_IMETHOD GetAddonId(nsAString& aAddonId) override;

View File

@ -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 nsIDocument::Reset and XULDocument::StartDocumentLoad.
// as Document::Reset and XULDocument::StartDocumentLoad.
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri));
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -18,7 +18,7 @@
#include "mozilla/dom/URL.h"
#include "nsDOMWindowList.h"
#include "nsIConsoleService.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIDOMWindow.h"
#include "nsIObserverService.h"
#include "nsIPresShell.h"
@ -39,6 +39,7 @@ nsChromeRegistry* nsChromeRegistry::gChromeRegistry;
// DO NOT use namespace mozilla; it'll break due to a naming conflict between
// mozilla::TextRange and a TextRange in OSX headers.
using mozilla::StyleSheet;
using mozilla::dom::Document;
using mozilla::dom::IsChromeURI;
using mozilla::dom::Location;
@ -275,7 +276,7 @@ nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURI, nsIURI** aResult) {
static void FlushSkinBindingsForWindow(nsPIDOMWindowOuter* aWindow) {
// Get the document.
nsCOMPtr<nsIDocument> document = aWindow->GetDoc();
RefPtr<Document> document = aWindow->GetDoc();
if (!document) return;
// Annihilate all XBL bindings.
@ -339,7 +340,7 @@ nsresult nsChromeRegistry::RefreshWindow(nsPIDOMWindowOuter* aWindow) {
nsresult rv;
// Get the document.
nsCOMPtr<nsIDocument> document = aWindow->GetDoc();
RefPtr<Document> document = aWindow->GetDoc();
if (!document) return NS_OK;
// Deal with the agent sheets first. Have to do all the style sets by hand.

View File

@ -74,7 +74,7 @@ function PieTableChart(node, pie, table) {
/**
* Creates the DOM for a pie+table chart.
*
* @param nsIDocument document
* @param Document document
* The document responsible with creating the DOM.
* @param object
* An object containing all or some of the following properties:
@ -161,7 +161,7 @@ function createPieTableChart(document,
/**
* Creates the DOM for a pie chart based on the specified properties.
*
* @param nsIDocument document
* @param Document document
* The document responsible with creating the DOM.
* @param object
* An object containing all or some of the following properties:
@ -293,7 +293,7 @@ function createPieChart(document, { data, width, height, centerX, centerY, radiu
/**
* Creates the DOM for a table chart based on the specified properties.
*
* @param nsIDocument document
* @param Document document
* The document responsible with creating the DOM.
* @param object
* An object containing all or some of the following properties:

View File

@ -7,6 +7,6 @@
## Additional documentation
* [MDN Web Docs](http://developer.mozilla.org/) (also known as *MDN*) has a lot of information about XUL elements, HTML, JS, DOM, Web APIs, Gecko-specific APIs, and more.
* [DXR](http://dxr.mozilla.org/mozilla-central/source/) is a source code search engine - search for symbols you want to learn about, eg. `nsIDocument`. [Searchfox](http://searchfox.org/mozilla-central/source) is an alternative.
* [DXR](http://dxr.mozilla.org/mozilla-central/source/) is a source code search engine - search for symbols you want to learn about, eg. `Document`. [Searchfox](http://searchfox.org/mozilla-central/source) is an alternative.
It is a good idea to [add smart keyword searches](https://support.mozilla.org/en-US/kb/how-search-from-address-bar) for DXR and MDN, so you can search faster.

View File

@ -10,7 +10,7 @@
#include "nsServiceManagerUtils.h"
#include "nsDocShellCID.h"
#include "nsIWebNavigationInfo.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIDOMWindow.h"
#include "nsIHttpChannel.h"
#include "nsError.h"

View File

@ -82,7 +82,7 @@
#include "nsICookieService.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIDocumentLoaderFactory.h"
#include "nsIDOMWindow.h"
#include "nsIEditingSession.h"
@ -568,9 +568,9 @@ nsDocShell::GetInterface(const nsIID& aIID, void** aSink) {
aIID.Equals(NS_GET_IID(nsIDOMWindow))) &&
NS_SUCCEEDED(EnsureScriptEnvironment())) {
return mScriptGlobal->QueryInterface(aIID, aSink);
} else if (aIID.Equals(NS_GET_IID(nsIDocument)) &&
} else if (aIID.Equals(NS_GET_IID(Document)) &&
NS_SUCCEEDED(EnsureContentViewer())) {
nsCOMPtr<nsIDocument> doc = mContentViewer->GetDocument();
RefPtr<Document> doc = mContentViewer->GetDocument();
doc.forget(aSink);
return *aSink ? NS_OK : NS_NOINTERFACE;
} else if (aIID.Equals(NS_GET_IID(nsIApplicationCacheContainer))) {
@ -584,7 +584,7 @@ nsDocShell::GetInterface(const nsIID& aIID, void** aSink) {
return NS_ERROR_NO_INTERFACE;
}
nsCOMPtr<nsIDocument> doc = contentViewer->GetDocument();
RefPtr<Document> doc = contentViewer->GetDocument();
NS_ASSERTION(doc, "Should have a document.");
if (!doc) {
return NS_ERROR_NO_INTERFACE;
@ -1030,11 +1030,11 @@ nsDOMNavigationTiming* nsDocShell::GetNavigationTiming() const {
MOZ_ASSERT(aOriginTreeItem && aTargetTreeItem, "need two docshells");
// Get origin document principal
nsCOMPtr<nsIDocument> originDocument = aOriginTreeItem->GetDocument();
RefPtr<Document> originDocument = aOriginTreeItem->GetDocument();
NS_ENSURE_TRUE(originDocument, false);
// Get target principal
nsCOMPtr<nsIDocument> targetDocument = aTargetTreeItem->GetDocument();
RefPtr<Document> targetDocument = aTargetTreeItem->GetDocument();
NS_ENSURE_TRUE(targetDocument, false);
bool equal;
@ -1209,7 +1209,7 @@ nsDocShell::GetCharset(nsACString& aCharset) {
nsIPresShell* presShell = GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
nsIDocument* doc = presShell->GetDocument();
Document* doc = presShell->GetDocument();
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
doc->GetDocumentCharacterSet()->Name(aCharset);
return NS_OK;
@ -1223,7 +1223,7 @@ nsDocShell::GatherCharsetMenuTelemetry() {
return NS_OK;
}
nsIDocument* doc = viewer->GetDocument();
Document* doc = viewer->GetDocument();
if (!doc || doc->WillIgnoreCharsetOverride()) {
return NS_OK;
}
@ -1346,7 +1346,7 @@ void nsDocShell::GetParentCharset(const Encoding*& aCharset,
NS_IMETHODIMP
nsDocShell::GetHasMixedActiveContentLoaded(bool* aHasMixedActiveContentLoaded) {
nsCOMPtr<nsIDocument> doc(GetDocument());
RefPtr<Document> doc(GetDocument());
*aHasMixedActiveContentLoaded = doc && doc->GetHasMixedActiveContentLoaded();
return NS_OK;
}
@ -1354,7 +1354,7 @@ nsDocShell::GetHasMixedActiveContentLoaded(bool* aHasMixedActiveContentLoaded) {
NS_IMETHODIMP
nsDocShell::GetHasMixedActiveContentBlocked(
bool* aHasMixedActiveContentBlocked) {
nsCOMPtr<nsIDocument> doc(GetDocument());
RefPtr<Document> doc(GetDocument());
*aHasMixedActiveContentBlocked =
doc && doc->GetHasMixedActiveContentBlocked();
return NS_OK;
@ -1363,7 +1363,7 @@ nsDocShell::GetHasMixedActiveContentBlocked(
NS_IMETHODIMP
nsDocShell::GetHasMixedDisplayContentLoaded(
bool* aHasMixedDisplayContentLoaded) {
nsCOMPtr<nsIDocument> doc(GetDocument());
RefPtr<Document> doc(GetDocument());
*aHasMixedDisplayContentLoaded =
doc && doc->GetHasMixedDisplayContentLoaded();
return NS_OK;
@ -1372,7 +1372,7 @@ nsDocShell::GetHasMixedDisplayContentLoaded(
NS_IMETHODIMP
nsDocShell::GetHasMixedDisplayContentBlocked(
bool* aHasMixedDisplayContentBlocked) {
nsCOMPtr<nsIDocument> doc(GetDocument());
RefPtr<Document> doc(GetDocument());
*aHasMixedDisplayContentBlocked =
doc && doc->GetHasMixedDisplayContentBlocked();
return NS_OK;
@ -1380,14 +1380,14 @@ nsDocShell::GetHasMixedDisplayContentBlocked(
NS_IMETHODIMP
nsDocShell::GetHasTrackingContentBlocked(bool* aHasTrackingContentBlocked) {
nsCOMPtr<nsIDocument> doc(GetDocument());
RefPtr<Document> doc(GetDocument());
*aHasTrackingContentBlocked = doc && doc->GetHasTrackingContentBlocked();
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetHasTrackingContentLoaded(bool* aHasTrackingContentLoaded) {
nsCOMPtr<nsIDocument> doc(GetDocument());
RefPtr<Document> doc(GetDocument());
*aHasTrackingContentLoaded = doc && doc->GetHasTrackingContentLoaded();
return NS_OK;
}
@ -1395,7 +1395,7 @@ nsDocShell::GetHasTrackingContentLoaded(bool* aHasTrackingContentLoaded) {
NS_IMETHODIMP
nsDocShell::GetHasCookiesBlockedByPermission(
bool* aHasCookiesBlockedByPermission) {
nsCOMPtr<nsIDocument> doc(GetDocument());
RefPtr<Document> doc(GetDocument());
*aHasCookiesBlockedByPermission =
doc && doc->GetHasCookiesBlockedByPermission();
return NS_OK;
@ -1404,14 +1404,14 @@ nsDocShell::GetHasCookiesBlockedByPermission(
NS_IMETHODIMP
nsDocShell::GetHasCookiesBlockedDueToTrackers(
bool* aHasCookiesBlockedDueToTrackers) {
nsCOMPtr<nsIDocument> doc(GetDocument());
RefPtr<Document> doc(GetDocument());
*aHasCookiesBlockedDueToTrackers = doc && doc->GetHasTrackingCookiesBlocked();
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetHasAllCookiesBeenBlocked(bool* aHasAllCookiesBeenBlocked) {
nsCOMPtr<nsIDocument> doc(GetDocument());
RefPtr<Document> doc(GetDocument());
*aHasAllCookiesBeenBlocked = doc && doc->GetHasAllCookiesBlocked();
return NS_OK;
}
@ -1419,14 +1419,14 @@ nsDocShell::GetHasAllCookiesBeenBlocked(bool* aHasAllCookiesBeenBlocked) {
NS_IMETHODIMP
nsDocShell::GetHasForeignCookiesBeenBlocked(
bool* aHasForeignCookiesBeenBlocked) {
nsCOMPtr<nsIDocument> doc(GetDocument());
RefPtr<Document> doc(GetDocument());
*aHasForeignCookiesBeenBlocked = doc && doc->GetHasForeignCookiesBlocked();
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetHasCookiesLoaded(bool* aHasCookiesLoaded) {
nsCOMPtr<nsIDocument> doc(GetDocument());
RefPtr<Document> doc(GetDocument());
*aHasCookiesLoaded = doc && doc->GetHasCookiesLoaded();
return NS_OK;
}
@ -1879,7 +1879,7 @@ nsDocShell::GetMayEnableCharacterEncodingMenu(
if (!mContentViewer) {
return NS_OK;
}
nsIDocument* doc = mContentViewer->GetDocument();
Document* doc = mContentViewer->GetDocument();
if (!doc) {
return NS_OK;
}
@ -2238,7 +2238,7 @@ nsDocShell::GetCurrentDocumentChannel(nsIChannel** aResult) {
nsIChannel* nsDocShell::GetCurrentDocChannel() {
if (mContentViewer) {
nsIDocument* doc = mContentViewer->GetDocument();
Document* doc = mContentViewer->GetDocument();
if (doc) {
return doc->GetChannel();
}
@ -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 nsIDocument::ResetToURI(). Ideally we would do something similar
// in Document::ResetToURI(). Ideally we would do something similar
// here, but for now lets just avoid the issue by not preallocating the
// client.
if (!principal) {
@ -2531,7 +2531,7 @@ Maybe<ClientInfo> nsDocShell::GetInitialClientInfo() const {
nsGlobalWindowInner* innerWindow =
mScriptGlobal ? mScriptGlobal->GetCurrentInnerWindowInternal() : nullptr;
nsIDocument* doc = innerWindow ? innerWindow->GetExtantDoc() : nullptr;
Document* doc = innerWindow ? innerWindow->GetExtantDoc() : nullptr;
if (!doc || !doc->IsInitialDocument()) {
return Maybe<ClientInfo>();
@ -2855,7 +2855,7 @@ bool nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
if (OriginAttributes::IsFirstPartyEnabled()) {
if (aAccessingItem->ItemType() == nsIDocShellTreeItem::typeContent &&
(accessingDS == accessingRootDS || accessingDS->GetIsMozBrowser())) {
nsCOMPtr<nsIDocument> accessingDoc = aAccessingItem->GetDocument();
RefPtr<Document> accessingDoc = aAccessingItem->GetDocument();
if (accessingDoc) {
nsCOMPtr<nsIPrincipal> accessingPrincipal =
@ -2868,7 +2868,7 @@ bool nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
if (aTargetItem->ItemType() == nsIDocShellTreeItem::typeContent &&
(targetDS == targetRootDS || targetDS->GetIsMozBrowser())) {
nsCOMPtr<nsIDocument> targetDoc = aAccessingItem->GetDocument();
RefPtr<Document> targetDoc = aAccessingItem->GetDocument();
if (targetDoc) {
nsCOMPtr<nsIPrincipal> targetPrincipal = targetDoc->NodePrincipal();
@ -3090,7 +3090,7 @@ bool nsDocShell::IsSandboxedFrom(nsIDocShell* aTargetDocShell) {
// active document, we will still enforce our own.
uint32_t sandboxFlags = mSandboxFlags;
if (mContentViewer) {
nsCOMPtr<nsIDocument> doc = mContentViewer->GetDocument();
RefPtr<Document> doc = mContentViewer->GetDocument();
if (doc) {
sandboxFlags = doc->GetSandboxFlags();
}
@ -3327,7 +3327,7 @@ nsDocShell::AddChild(nsIDocShellTreeItem* aChild) {
if (!mContentViewer) {
return NS_OK;
}
nsIDocument* doc = mContentViewer->GetDocument();
Document* doc = mContentViewer->GetDocument();
if (!doc) {
return NS_OK;
}
@ -3667,7 +3667,7 @@ nsIScriptGlobalObject* nsDocShell::GetScriptGlobalObject() {
return mScriptGlobal;
}
nsIDocument* nsDocShell::GetDocument() {
Document* nsDocShell::GetDocument() {
NS_ENSURE_SUCCESS(EnsureContentViewer(), nullptr);
return mContentViewer->GetDocument();
}
@ -3712,7 +3712,7 @@ nsDocShell::GetContentBlockingLog(Promise** aPromise) {
return NS_ERROR_FAILURE;
}
nsIDocument* doc = mContentViewer->GetDocument();
Document* doc = mContentViewer->GetDocument();
ErrorResult rv;
RefPtr<Promise> promise = Promise::Create(doc->GetOwnerGlobal(), rv);
if (NS_WARN_IF(rv.Failed())) {
@ -4614,7 +4614,7 @@ nsDocShell::Reload(uint32_t aReloadFlags) {
// done
rv = LoadHistoryEntry(mLSHE, loadType);
} else {
nsCOMPtr<nsIDocument> doc(GetDocument());
RefPtr<Document> doc(GetDocument());
if (!doc) {
return NS_OK;
@ -4740,11 +4740,11 @@ nsDocShell::Stop(uint32_t aStopFlags) {
}
NS_IMETHODIMP
nsDocShell::GetDocument(nsIDocument** aDocument) {
nsDocShell::GetDocument(Document** aDocument) {
NS_ENSURE_ARG_POINTER(aDocument);
NS_ENSURE_SUCCESS(EnsureContentViewer(), NS_ERROR_FAILURE);
nsCOMPtr<nsIDocument> doc = mContentViewer->GetDocument();
RefPtr<Document> doc = mContentViewer->GetDocument();
if (!doc) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -5178,7 +5178,7 @@ nsDocShell::GetPositionAndSize(int32_t* aX, int32_t* aY, int32_t* aWidth,
if (aWidth || aHeight) {
// Caller wants to know our size; make sure to give them up to
// date information.
nsCOMPtr<nsIDocument> doc(do_GetInterface(GetAsSupports(mParent)));
RefPtr<Document> doc(do_GetInterface(GetAsSupports(mParent)));
if (doc) {
doc->FlushPendingNotifications(FlushType::Layout);
}
@ -5371,7 +5371,7 @@ nsDocShell::SetIsActive(bool aIsActive) {
// Tell the window about it
if (mScriptGlobal) {
mScriptGlobal->SetIsBackground(!aIsActive);
if (nsCOMPtr<nsIDocument> doc = mScriptGlobal->GetExtantDoc()) {
if (RefPtr<Document> doc = mScriptGlobal->GetExtantDoc()) {
// Update orientation when the top-level browsing context becomes active.
if (aIsActive) {
nsCOMPtr<nsIDocShellTreeItem> parent;
@ -5390,7 +5390,7 @@ nsDocShell::SetIsActive(bool aIsActive) {
// Tell the nsDOMNavigationTiming about it
RefPtr<nsDOMNavigationTiming> timing = mTiming;
if (!timing && mContentViewer) {
nsIDocument* doc = mContentViewer->GetDocument();
Document* doc = mContentViewer->GetDocument();
if (doc) {
timing = doc->GetNavigationTiming();
}
@ -5538,7 +5538,7 @@ nsDocShell::SetMixedContentChannel(nsIChannel* aMixedContentChannel) {
NS_IMETHODIMP
nsDocShell::GetFailedChannel(nsIChannel** aFailedChannel) {
NS_ENSURE_ARG_POINTER(aFailedChannel);
nsIDocument* doc = GetDocument();
Document* doc = GetDocument();
if (!doc) {
*aFailedChannel = nullptr;
return NS_OK;
@ -5571,7 +5571,7 @@ nsDocShell::GetAllowMixedContentAndConnectionData(
sameTypeRoot.get() == static_cast<nsIDocShellTreeItem*>(this);
// now get the document from sameTypeRoot
nsCOMPtr<nsIDocument> rootDoc = sameTypeRoot->GetDocument();
RefPtr<Document> rootDoc = sameTypeRoot->GetDocument();
if (rootDoc) {
nsCOMPtr<nsIPrincipal> rootPrincipal = rootDoc->NodePrincipal();
@ -5891,7 +5891,7 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
// document's principal otherwise.
nsCOMPtr<nsIPrincipal> principal = aPrincipal;
if (!principal) {
nsCOMPtr<nsIDocument> doc = GetDocument();
RefPtr<Document> doc = GetDocument();
if (!doc) {
return NS_ERROR_FAILURE;
}
@ -6804,7 +6804,7 @@ nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
return NS_OK;
}
nsCOMPtr<nsIDocument> parentDoc;
RefPtr<Document> parentDoc;
parentDoc = parentItem->GetDocument();
if (!parentDoc) {
return NS_OK;
@ -7051,7 +7051,7 @@ nsresult nsDocShell::EnsureContentViewer() {
NS_ENSURE_STATE(mContentViewer);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIDocument> doc(GetDocument());
RefPtr<Document> doc(GetDocument());
NS_ASSERTION(doc,
"Should have doc if CreateAboutBlankContentViewer "
"succeeded!");
@ -7074,7 +7074,7 @@ nsresult nsDocShell::EnsureContentViewer() {
nsresult nsDocShell::CreateAboutBlankContentViewer(
nsIPrincipal* aPrincipal, nsIURI* aBaseURI, bool aTryToSaveOldPresentation,
bool aCheckPermitUnload) {
nsCOMPtr<nsIDocument> blankDoc;
RefPtr<Document> blankDoc;
nsCOMPtr<nsIContentViewer> viewer;
nsresult rv = NS_ERROR_FAILURE;
@ -7222,7 +7222,7 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal) {
bool nsDocShell::CanSavePresentation(uint32_t aLoadType,
nsIRequest* aNewRequest,
nsIDocument* aNewDocument) {
Document* aNewDocument) {
if (!mOSHE) {
return false; // no entry to save into
}
@ -7272,7 +7272,7 @@ bool nsDocShell::CanSavePresentation(uint32_t aLoadType,
}
// If the document does not want its presentation cached, then don't.
nsCOMPtr<nsIDocument> doc = mScriptGlobal->GetExtantDoc();
RefPtr<Document> doc = mScriptGlobal->GetExtantDoc();
return doc && doc->CanSavePresentation(aNewRequest);
}
@ -7407,7 +7407,7 @@ nsDocShell::BeginRestore(nsIContentViewer* aContentViewer, bool aTop) {
// the document's channel to the loadgroup to initiate stateChange
// notifications.
nsCOMPtr<nsIDocument> doc = aContentViewer->GetDocument();
RefPtr<Document> doc = aContentViewer->GetDocument();
if (doc) {
nsIChannel* channel = doc->GetChannel();
if (channel) {
@ -7465,7 +7465,7 @@ nsDocShell::FinishRestore() {
ReattachEditorToWindow(mOSHE);
}
nsCOMPtr<nsIDocument> doc = GetDocument();
RefPtr<Document> doc = GetDocument();
if (doc) {
// Finally, we remove the request from the loadgroup. This will
// cause onStateChange(STATE_STOP) to fire, which will fire the
@ -7610,7 +7610,7 @@ nsresult nsDocShell::RestoreFromHistory() {
// at the time we initiated the new load. We need to check whether
// it's still safe to do so, since there may have been DOM mutations
// or new requests initiated.
nsCOMPtr<nsIDocument> doc = viewer->GetDocument();
RefPtr<Document> doc = viewer->GetDocument();
nsIRequest* request = nullptr;
if (doc) {
request = doc->GetChannel();
@ -7746,7 +7746,7 @@ nsresult nsDocShell::RestoreFromHistory() {
}
nsCOMPtr<nsIContent> container;
nsCOMPtr<nsIDocument> sibling;
RefPtr<Document> sibling;
if (rootViewParent && rootViewParent->GetParent()) {
nsIFrame* frame = rootViewParent->GetParent()->GetFrame();
container = frame ? frame->GetContent() : nullptr;
@ -7787,7 +7787,7 @@ nsresult nsDocShell::RestoreFromHistory() {
bool sticky = mLSHE->GetSticky();
nsCOMPtr<nsIDocument> document = mContentViewer->GetDocument();
RefPtr<Document> document = mContentViewer->GetDocument();
nsCOMArray<nsIDocShellTreeItem> childShells;
int32_t i = 0;
@ -7868,7 +7868,7 @@ nsresult nsDocShell::RestoreFromHistory() {
if (document) {
RefPtr<nsDocShell> parent = GetParentDocshell();
if (parent) {
nsCOMPtr<nsIDocument> d = parent->GetDocument();
RefPtr<Document> d = parent->GetDocument();
if (d) {
if (d->EventHandlingSuppressed()) {
document->SuppressEventHandling(d->EventHandlingSuppressed());
@ -8123,7 +8123,7 @@ nsresult nsDocShell::CreateContentViewer(const nsACString& aContentType,
// at the time we initiated the new load. We need to check whether
// it's still safe to do so, since there may have been DOM mutations
// or new requests initiated.
nsCOMPtr<nsIDocument> doc = viewer->GetDocument();
RefPtr<Document> doc = viewer->GetDocument();
mSavingOldViewer = CanSavePresentation(mLoadType, aRequest, doc);
}
@ -8162,7 +8162,7 @@ nsresult nsDocShell::CreateContentViewer(const nsACString& aContentType,
// following function calls need it.
mLoadType = mFailedLoadType;
nsIDocument* doc = viewer->GetDocument();
Document* doc = viewer->GetDocument();
if (doc) {
doc->SetFailedChannel(failedChannel);
}
@ -8268,7 +8268,7 @@ nsresult nsDocShell::CreateContentViewer(const nsACString& aContentType,
if (multiPartChannel) {
nsCOMPtr<nsIPresShell> shell = GetPresShell();
if (NS_SUCCEEDED(rv) && shell) {
nsIDocument* doc = shell->GetDocument();
Document* doc = shell->GetDocument();
if (doc) {
uint32_t partID;
multiPartChannel->GetPartID(&partID);
@ -8492,7 +8492,7 @@ nsresult nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer) {
nsresult nsDocShell::SetDocCurrentStateObj(nsISHEntry* aShEntry) {
NS_ENSURE_STATE(mContentViewer);
nsCOMPtr<nsIDocument> document = GetDocument();
RefPtr<Document> document = GetDocument();
NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);
nsCOMPtr<nsIStructuredCloneContainer> scContainer;
@ -8804,7 +8804,7 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
}
}
nsIDocument* doc = mContentViewer ? mContentViewer->GetDocument() : nullptr;
Document* doc = mContentViewer ? mContentViewer->GetDocument() : nullptr;
const bool isDocumentAuxSandboxed =
doc && (doc->GetSandboxFlags() & SANDBOXED_AUXILIARY_NAVIGATION);
@ -8937,7 +8937,7 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
// document in |newWin|, if any.
nsCOMPtr<nsPIDOMWindowOuter> piNewWin = newWin;
if (piNewWin) {
nsCOMPtr<nsIDocument> newDoc = piNewWin->GetExtantDoc();
RefPtr<Document> newDoc = piNewWin->GetExtantDoc();
if (!newDoc || newDoc->IsInitialDocument()) {
isNewWindow = true;
aLoadState->SetLoadFlag(INTERNAL_LOAD_FLAGS_FIRST_LOAD);
@ -9090,7 +9090,7 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
// possible frameloader initialization before loading a new page.
nsCOMPtr<nsIDocShellTreeItem> parent = GetParentDocshell();
if (parent) {
nsCOMPtr<nsIDocument> doc = parent->GetDocument();
RefPtr<Document> doc = parent->GetDocument();
if (doc) {
doc->TryCancelFrameLoaderInitialization(this);
}
@ -9240,7 +9240,7 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
SetHistoryEntry(&mLSHE, aLoadState->SHEntry());
// Set the doc's URI according to the new history entry's URI.
nsCOMPtr<nsIDocument> doc = GetDocument();
RefPtr<Document> doc = GetDocument();
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
doc->SetDocumentURI(aLoadState->URI());
@ -9621,7 +9621,7 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
}
nsIPrincipal* nsDocShell::GetInheritedPrincipal(bool aConsiderCurrentDocument) {
nsCOMPtr<nsIDocument> document;
RefPtr<Document> document;
bool inheritedFromCurrent = false;
if (aConsiderCurrentDocument && mContentViewer) {
@ -9820,7 +9820,7 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState,
loadingPrincipal = loadingNode->NodePrincipal();
#ifdef DEBUG
// Get the docshell type for requestingElement.
nsCOMPtr<nsIDocument> requestingDoc = loadingNode->OwnerDoc();
RefPtr<Document> requestingDoc = loadingNode->OwnerDoc();
nsCOMPtr<nsIDocShell> elementDocShell = requestingDoc->GetDocShell();
// requestingElement docshell type = current docshell type.
MOZ_ASSERT(
@ -10558,7 +10558,7 @@ nsresult nsDocShell::ScrollToAnchor(bool aCurHasRef, bool aNewHasRef,
if (NS_FAILED(rv)) {
// Get a document charset
NS_ENSURE_TRUE(mContentViewer, NS_ERROR_FAILURE);
nsIDocument* doc = mContentViewer->GetDocument();
Document* doc = mContentViewer->GetDocument();
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
nsAutoCString charset;
doc->GetDocumentCharacterSet()->Name(charset);
@ -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 nsIDocument::Reset).
// Note that this should match what documents do (see Document::Reset).
NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri));
NS_ENSURE_TRUE(uri, false);
@ -10956,7 +10956,7 @@ nsDocShell::AddState(JS::Handle<JS::Value> aData, const nsAString& aTitle,
aReplace = true;
}
nsCOMPtr<nsIDocument> document = GetDocument();
RefPtr<Document> document = GetDocument();
NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);
// Step 1: Serialize aData using structured clone.
@ -10967,7 +10967,7 @@ nsDocShell::AddState(JS::Handle<JS::Value> aData, const nsAString& aTitle,
// 634834) To protect against this, we abort if our principal changes due
// to the InitFromJSVal() call.
{
nsCOMPtr<nsIDocument> origDocument = GetDocument();
RefPtr<Document> origDocument = GetDocument();
if (!origDocument) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -10977,7 +10977,7 @@ nsDocShell::AddState(JS::Handle<JS::Value> aData, const nsAString& aTitle,
rv = scContainer->InitFromJSVal(aData, aCx);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocument> newDocument = GetDocument();
RefPtr<Document> newDocument = GetDocument();
if (!newDocument) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -12212,7 +12212,7 @@ nsresult nsDocShell::SetBaseUrlForWyciwyg(nsIContentViewer* aContentViewer) {
// Get the current document and set the base uri
if (baseURI) {
nsIDocument* document = aContentViewer->GetDocument();
Document* document = aContentViewer->GetDocument();
if (document) {
document->SetBaseURI(baseURI);
}
@ -12349,7 +12349,7 @@ bool nsDocShell::IsOKToLoadURI(nsIURI* aURI) {
}
bool isPrivateWin = false;
nsIDocument* doc = GetDocument();
Document* doc = GetDocument();
if (doc) {
isPrivateWin =
doc->NodePrincipal()->OriginAttributesRef().mPrivateBrowsingId > 0;
@ -12678,7 +12678,7 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent, nsIURI* aURI,
// link was in. From that document, we'll get the URI to use as the
// referer, since the current URI in this docshell may be a
// new document that we're in the process of loading.
nsCOMPtr<nsIDocument> refererDoc = aContent->OwnerDoc();
RefPtr<Document> refererDoc = aContent->OwnerDoc();
NS_ENSURE_TRUE(refererDoc, NS_ERROR_UNEXPECTED);
// Now check that the refererDoc's inner window is the current inner
@ -12817,7 +12817,7 @@ bool nsDocShell::PluginsAllowedInCurrentDoc() {
return false;
}
nsIDocument* doc = mContentViewer->GetDocument();
Document* doc = mContentViewer->GetDocument();
if (!doc) {
return false;
}
@ -13015,7 +13015,7 @@ bool nsDocShell::CanSetOriginAttributes() {
// TODO: Bug 1273058 - mContentViewer should be null when setting origin
// attributes.
if (mContentViewer) {
nsIDocument* doc = mContentViewer->GetDocument();
Document* doc = mContentViewer->GetDocument();
if (doc) {
nsIURI* uri = doc->GetDocumentURI();
if (!uri) {
@ -13255,9 +13255,9 @@ UniquePtr<ClientSource> nsDocShell::TakeInitialClientSource() {
NS_IMETHODIMP
nsDocShell::IssueWarning(uint32_t aWarning, bool aAsError) {
if (mContentViewer) {
nsCOMPtr<nsIDocument> doc = mContentViewer->GetDocument();
RefPtr<Document> doc = mContentViewer->GetDocument();
if (doc) {
doc->WarnOnceAbout(nsIDocument::DeprecatedOperations(aWarning), aAsError);
doc->WarnOnceAbout(Document::DeprecatedOperations(aWarning), aAsError);
}
}
return NS_OK;

View File

@ -77,7 +77,6 @@ class nsICommandManager;
class nsIContentViewer;
class nsIController;
class nsIDocShellTreeOwner;
class nsIDocument;
class nsIHttpChannel;
class nsIMutableArray;
class nsIPrompt;
@ -729,7 +728,7 @@ class nsDocShell final : public nsDocLoader,
// has not been created yet. |aNewDocument| should be the document that will
// replace the current document.
bool CanSavePresentation(uint32_t aLoadType, nsIRequest* aNewRequest,
nsIDocument* aNewDocument);
mozilla::dom::Document* aNewDocument);
// Captures the state of the supporting elements of the presentation
// (the "window" object, docshell tree, meta-refresh loads, and security

View File

@ -129,7 +129,7 @@ nsresult nsDocShellEditorData::DetachFromWindow() {
mDetachedMakeEditable = mMakeEditable;
mMakeEditable = false;
nsCOMPtr<nsIDocument> doc = domWindow->GetDoc();
nsCOMPtr<dom::Document> doc = domWindow->GetDoc();
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(doc);
if (htmlDoc) {
mDetachedEditingState = htmlDoc->GetEditingState();
@ -151,7 +151,7 @@ nsresult nsDocShellEditorData::ReattachToWindow(nsIDocShell* aDocShell) {
mIsDetached = false;
mMakeEditable = mDetachedMakeEditable;
nsCOMPtr<nsIDocument> doc = domWindow->GetDoc();
RefPtr<dom::Document> doc = domWindow->GetDoc();
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(doc);
if (htmlDoc) {
htmlDoc->SetEditingState(mDetachedEditingState);

View File

@ -378,7 +378,7 @@ nsDocShellTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem, int32_t aCX,
NS_ENSURE_TRUE(aShellItem, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocument> document = aShellItem->GetDocument();
RefPtr<Document> document = aShellItem->GetDocument();
NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);
NS_ENSURE_TRUE(document->GetDocumentElement(), NS_ERROR_FAILURE);

View File

@ -8,9 +8,10 @@
interface mozIDOMWindowProxy;
interface nsIDocShellTreeOwner;
interface nsIDocument;
interface nsPIDOMWindowOuter;
webidl Document;
/**
* The nsIDocShellTreeItem supplies the methods that are required of any item
* that wishes to be able to live within the docshell tree either as a middle
@ -184,7 +185,7 @@ interface nsIDocShellTreeItem : nsISupports
*/
readonly attribute mozIDOMWindowProxy domWindow;
[noscript,nostdcall,notxpcom] nsIDocument getDocument();
[noscript,nostdcall,notxpcom] Document getDocument();
[noscript,nostdcall,notxpcom] nsPIDOMWindowOuter getWindow();
};

View File

@ -10,10 +10,11 @@ interface nsIChannel;
interface nsIContentViewer;
interface nsIStreamListener;
interface nsIDocShell;
interface nsIDocument;
interface nsILoadGroup;
interface nsIPrincipal;
webidl Document;
/**
* To get a component that implements nsIDocumentLoaderFactory
* for a given mimetype, use nsICategoryManager to find an entry
@ -33,6 +34,6 @@ interface nsIDocumentLoaderFactory : nsISupports {
out nsIStreamListener aDocListenerResult);
nsIContentViewer createInstanceForDocument(in nsISupports aContainer,
in nsIDocument aDocument,
in Document aDocument,
in string aCommand);
};

View File

@ -9,14 +9,13 @@
#include "mozilla/Preferences.h"
#include "mozilla/dom/DocGroup.h"
#include "mozilla/dom/Document.h"
#include "nsIDocument.h"
#include "nsIHttpChannelInternal.h"
#include "nsIInputStream.h"
#include "nsIProtocolHandler.h"
#include "nsIUploadChannel2.h"
#include "nsIDocument.h"
#include "nsNetUtil.h"
#include "nsStreamUtils.h"
#include "nsStringStream.h"
@ -92,7 +91,7 @@ static void SendPing(void* aClosure, nsIContent* aContent, nsIURI* aURI,
return;
}
nsIDocument* doc = aContent->OwnerDoc();
Document* doc = aContent->OwnerDoc();
nsCOMPtr<nsIChannel> chan;
NS_NewChannel(getter_AddRefs(chan), aURI, doc,
@ -267,7 +266,7 @@ static void ForEachPing(nsIContent* aContent, ForEachPingCallback aCallback,
return;
}
nsIDocument* doc = aContent->OwnerDoc();
Document* doc = aContent->OwnerDoc();
nsAutoCString charset;
doc->GetDocumentCharacterSet()->Name(charset);

View File

@ -11,7 +11,7 @@
#include "nsIContentViewer.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsILayoutHistoryState.h"
#include "nsISHistory.h"
#include "nsIWebNavigation.h"
@ -190,7 +190,7 @@ nsresult nsSHEntryShared::RemoveFromBFCacheAsync() {
// release the references asynchronously so that the document doesn't get
// nuked mid-mutation.
nsCOMPtr<nsIContentViewer> viewer = mContentViewer;
nsCOMPtr<nsIDocument> document = mDocument;
RefPtr<dom::Document> document = mDocument;
RefPtr<nsSHEntryShared> self = this;
nsresult rv = mDocument->Dispatch(
mozilla::TaskCategory::Other,

View File

@ -21,13 +21,18 @@
class nsSHEntry;
class nsISHEntry;
class nsIDocument;
class nsIContentViewer;
class nsIDocShellTreeItem;
class nsILayoutHistoryState;
class nsDocShellEditorData;
class nsIMutableArray;
namespace mozilla {
namespace dom {
class Document;
}
} // namespace mozilla
// A document may have multiple SHEntries, either due to hash navigations or
// calls to history.pushState. SHEntries corresponding to the same document
// share many members; in particular, they share state related to the
@ -84,7 +89,7 @@ class nsSHEntryShared final : public nsIBFCacheEntry,
// they're specific to a particular content viewer.
uint64_t mID;
nsCOMPtr<nsIContentViewer> mContentViewer;
nsCOMPtr<nsIDocument> mDocument;
RefPtr<mozilla::dom::Document> mDocument;
nsCOMPtr<nsILayoutHistoryState> mLayoutHistoryState;
nsCOMPtr<nsISupports> mWindowState;
nsIntRect mViewerBounds;

View File

@ -16,7 +16,7 @@
#include "mozilla/TypeTraits.h" // For std::forward<>
#include "nsAnimationManager.h" // For CSSAnimation
#include "nsDOMMutationObserver.h" // For nsAutoAnimationMutationBatch
#include "nsIDocument.h" // For nsIDocument
#include "mozilla/dom/Document.h"
#include "nsIPresShell.h" // For nsIPresShell
#include "nsThreadUtils.h" // For nsRunnableMethod and nsRevocableEventPtr
#include "nsTransitionManager.h" // For CSSTransition
@ -63,12 +63,7 @@ class MOZ_RAII AutoMutationBatchForAnimation {
}
// For mutation observers, we use the OwnerDoc.
nsIDocument* doc = target->mElement->OwnerDoc();
if (!doc) {
return;
}
mAutoBatch.emplace(doc);
mAutoBatch.emplace(target->mElement->OwnerDoc());
}
private:
@ -92,7 +87,7 @@ class MOZ_RAII AutoMutationBatchForAnimation {
if (aTimeline.WasPassed()) {
timeline = aTimeline.Value();
} else {
nsIDocument* document =
Document* document =
AnimationUtils::GetCurrentRealmDocument(aGlobal.Context());
if (!document) {
aRv.Throw(NS_ERROR_FAILURE);
@ -1077,8 +1072,7 @@ void Animation::PlayNoUpdate(ErrorResult& aRv, LimitBehavior aLimitBehavior) {
// animations if it applies.
mSyncWithGeometricAnimations = false;
nsIDocument* doc = GetRenderedDocument();
if (doc) {
if (Document* doc = GetRenderedDocument()) {
PendingAnimationTracker* tracker =
doc->GetOrCreatePendingAnimationTracker();
tracker->AddPlayPending(*this);
@ -1126,8 +1120,7 @@ void Animation::Pause(ErrorResult& aRv) {
mPendingState = PendingState::PausePending;
nsIDocument* doc = GetRenderedDocument();
if (doc) {
if (Document* doc = GetRenderedDocument()) {
PendingAnimationTracker* tracker =
doc->GetOrCreatePendingAnimationTracker();
tracker->AddPausePending(*this);
@ -1284,8 +1277,7 @@ void Animation::UpdateEffect() {
}
void Animation::FlushUnanimatedStyle() const {
nsIDocument* doc = GetRenderedDocument();
if (doc) {
if (Document* doc = GetRenderedDocument()) {
doc->FlushPendingNotifications(
ChangesToFlush(FlushType::Style, false /* flush animations */));
}
@ -1308,8 +1300,7 @@ void Animation::CancelPendingTasks() {
return;
}
nsIDocument* doc = GetRenderedDocument();
if (doc) {
if (Document* doc = GetRenderedDocument()) {
PendingAnimationTracker* tracker = doc->GetPendingAnimationTracker();
if (tracker) {
if (mPendingState == PendingState::PlayPending) {
@ -1346,8 +1337,7 @@ void Animation::ReschedulePendingTasks() {
mPendingReadyTime.SetNull();
nsIDocument* doc = GetRenderedDocument();
if (doc) {
if (Document* doc = GetRenderedDocument()) {
PendingAnimationTracker* tracker =
doc->GetOrCreatePendingAnimationTracker();
if (mPendingState == PendingState::PlayPending &&
@ -1401,7 +1391,7 @@ bool Animation::IsPossiblyOrphanedPendingAnimation() const {
// If we're wrong and another document is tracking us then, at worst, we'll
// simply start/pause the animation one tick too soon. That's better than
// never starting/pausing the animation and is unlikely.
nsIDocument* doc = GetRenderedDocument();
Document* doc = GetRenderedDocument();
if (!doc) {
return true;
}
@ -1419,7 +1409,7 @@ StickyTimeDuration Animation::EffectEnd() const {
return mEffect->SpecifiedTiming().EndTime();
}
nsIDocument* Animation::GetRenderedDocument() const {
Document* Animation::GetRenderedDocument() const {
if (!mEffect || !mEffect->AsKeyframeEffect()) {
return nullptr;
}
@ -1427,7 +1417,7 @@ nsIDocument* Animation::GetRenderedDocument() const {
return mEffect->AsKeyframeEffect()->GetRenderedDocument();
}
nsIDocument* Animation::GetTimelineDocument() const {
Document* Animation::GetTimelineDocument() const {
return mTimeline ? mTimeline->GetDocument() : nullptr;
}
@ -1495,7 +1485,7 @@ void Animation::QueuePlaybackEvent(const nsAString& aName,
TimeStamp&& aScheduledEventTime) {
// Use document for timing.
// https://drafts.csswg.org/web-animations-1/#document-for-timing
nsIDocument* doc = GetTimelineDocument();
Document* doc = GetTimelineDocument();
if (!doc) {
return;
}

View File

@ -30,7 +30,6 @@
struct JSContext;
class nsCSSPropertyIDSet;
class nsIDocument;
class nsIFrame;
namespace mozilla {
@ -42,6 +41,7 @@ namespace dom {
class AsyncFinishNotification;
class CSSAnimation;
class CSSTransition;
class Document;
class Animation : public DOMEventTargetHelper,
public LinkedListElement<Animation> {
@ -501,8 +501,8 @@ class Animation : public DOMEventTargetHelper,
return mTimeline ? mTimeline->GetCurrentTimeAsTimeStamp() : TimeStamp();
}
nsIDocument* GetRenderedDocument() const;
nsIDocument* GetTimelineDocument() const;
Document* GetRenderedDocument() const;
Document* GetTimelineDocument() const;
RefPtr<AnimationTimeline> mTimeline;
RefPtr<AnimationEffect> mEffect;

View File

@ -35,7 +35,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AnimationEffect)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
AnimationEffect::AnimationEffect(nsIDocument* aDocument, TimingParams&& aTiming)
AnimationEffect::AnimationEffect(Document* aDocument, TimingParams&& aTiming)
: mDocument(aDocument), mTiming(std::move(aTiming)) {}
AnimationEffect::~AnimationEffect() = default;

View File

@ -26,13 +26,14 @@ namespace dom {
class Animation;
class KeyframeEffect;
struct ComputedEffectTiming;
class Document;
class AnimationEffect : public nsISupports, public nsWrapperCache {
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(AnimationEffect)
AnimationEffect(nsIDocument* aDocument, TimingParams&& aTiming);
AnimationEffect(Document* aDocument, TimingParams&& aTiming);
virtual KeyframeEffect* AsKeyframeEffect() { return nullptr; }
@ -91,7 +92,7 @@ class AnimationEffect : public nsISupports, public nsWrapperCache {
Nullable<TimeDuration> GetLocalTime() const;
protected:
RefPtr<nsIDocument> mDocument;
RefPtr<Document> mDocument;
RefPtr<Animation> mAnimation;
TimingParams mTiming;
};

View File

@ -17,12 +17,11 @@
#include "nsIGlobalObject.h"
#include "nsTHashtable.h"
class nsIDocument;
namespace mozilla {
namespace dom {
class Animation;
class Document;
class AnimationTimeline : public nsISupports, public nsWrapperCache {
public:
@ -96,7 +95,7 @@ class AnimationTimeline : public nsISupports, public nsWrapperCache {
virtual void RemoveAnimation(Animation* aAnimation);
virtual nsIDocument* GetDocument() const = 0;
virtual Document* GetDocument() const = 0;
protected:
nsCOMPtr<nsIGlobalObject> mWindow;

View File

@ -9,7 +9,7 @@
#include "nsDebug.h"
#include "nsAtom.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsGlobalWindow.h"
#include "nsString.h"
#include "xpcpublic.h" // For xpc::NativeGlobal
@ -17,6 +17,8 @@
#include "mozilla/dom/KeyframeEffect.h"
#include "mozilla/Preferences.h"
using namespace mozilla::dom;
namespace mozilla {
/* static */ void AnimationUtils::LogAsyncAnimationFailure(
@ -37,8 +39,7 @@ namespace mozilla {
printf_stderr("%s", aMessage.get());
}
/* static */ nsIDocument* AnimationUtils::GetCurrentRealmDocument(
JSContext* aCx) {
/* static */ Document* AnimationUtils::GetCurrentRealmDocument(JSContext* aCx) {
nsGlobalWindowInner* win = xpc::CurrentWindowOrNull(aCx);
if (!win) {
return nullptr;
@ -46,7 +47,7 @@ namespace mozilla {
return win->GetDoc();
}
/* static */ nsIDocument* AnimationUtils::GetDocumentFromGlobal(
/* static */ Document* AnimationUtils::GetDocumentFromGlobal(
JSObject* aGlobalObject) {
nsGlobalWindowInner* win = xpc::WindowOrNull(aGlobalObject);
if (!win) {

View File

@ -14,7 +14,6 @@
#include "nsStringFwd.h"
class nsIContent;
class nsIDocument;
class nsIFrame;
struct JSContext;
@ -23,8 +22,14 @@ namespace mozilla {
class ComputedTimingFunction;
class EffectSet;
namespace dom {
class Document;
}
class AnimationUtils {
public:
typedef dom::Document Document;
static dom::Nullable<double> TimeDurationToDouble(
const dom::Nullable<TimeDuration>& aTime) {
dom::Nullable<double> result;
@ -58,14 +63,14 @@ class AnimationUtils {
/**
* Get the document from the JS context to use when parsing CSS properties.
*/
static nsIDocument* GetCurrentRealmDocument(JSContext* aCx);
static Document* GetCurrentRealmDocument(JSContext* aCx);
/**
* Get the document from the global object, or nullptr if the document has
* no window, to use when constructing DOM object without entering the
* target window's compartment (see KeyframeEffect constructor).
*/
static nsIDocument* GetDocumentFromGlobal(JSObject* aGlobalObject);
static Document* GetDocumentFromGlobal(JSObject* aGlobalObject);
/**
* Checks if offscreen animation throttling is enabled.

View File

@ -46,7 +46,7 @@ JSObject* CSSPseudoElement::WrapObject(JSContext* aCx,
void CSSPseudoElement::GetAnimations(const AnimationFilter& filter,
nsTArray<RefPtr<Animation>>& aRetVal) {
nsIDocument* doc = mParentElement->GetComposedDoc();
Document* doc = mParentElement->GetComposedDoc();
if (doc) {
// We don't need to explicitly flush throttled animations here, since
// updating the animation style of (pseudo-)elements will never affect the

View File

@ -50,7 +50,7 @@ JSObject* DocumentTimeline::WrapObject(JSContext* aCx,
/* static */ already_AddRefed<DocumentTimeline> DocumentTimeline::Constructor(
const GlobalObject& aGlobal, const DocumentTimelineOptions& aOptions,
ErrorResult& aRv) {
nsIDocument* doc = AnimationUtils::GetCurrentRealmDocument(aGlobal.Context());
Document* doc = AnimationUtils::GetCurrentRealmDocument(aGlobal.Context());
if (!doc) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;

View File

@ -11,7 +11,7 @@
#include "mozilla/LinkedList.h"
#include "mozilla/TimeStamp.h"
#include "AnimationTimeline.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsDOMNavigationTiming.h" // for DOMHighResTimeStamp
#include "nsRefreshDriver.h"
@ -25,7 +25,7 @@ class DocumentTimeline final : public AnimationTimeline,
public nsATimerAdjustmentObserver,
public LinkedListElement<DocumentTimeline> {
public:
DocumentTimeline(nsIDocument* aDocument, const TimeDuration& aOriginTime)
DocumentTimeline(Document* aDocument, const TimeDuration& aOriginTime)
: AnimationTimeline(aDocument->GetParentObject()),
mDocument(aDocument),
mIsObservingRefreshDriver(false),
@ -84,7 +84,7 @@ class DocumentTimeline final : public AnimationTimeline,
void NotifyRefreshDriverCreated(nsRefreshDriver* aDriver);
void NotifyRefreshDriverDestroying(nsRefreshDriver* aDriver);
nsIDocument* GetDocument() const override { return mDocument; }
Document* GetDocument() const override { return mDocument; }
protected:
TimeStamp GetCurrentTimeStamp() const;
@ -94,7 +94,7 @@ class DocumentTimeline final : public AnimationTimeline,
void ObserveRefreshDriver(nsRefreshDriver* aDriver);
void DisconnectRefreshDriver(nsRefreshDriver* aDriver);
nsCOMPtr<nsIDocument> mDocument;
RefPtr<Document> mDocument;
// The most recently used refresh driver time. This is used in cases where
// we don't have a refresh driver (e.g. because we are in a display:none

View File

@ -63,7 +63,7 @@ NS_INTERFACE_MAP_END_INHERITING(AnimationEffect)
NS_IMPL_ADDREF_INHERITED(KeyframeEffect, AnimationEffect)
NS_IMPL_RELEASE_INHERITED(KeyframeEffect, AnimationEffect)
KeyframeEffect::KeyframeEffect(nsIDocument* aDocument,
KeyframeEffect::KeyframeEffect(Document* aDocument,
const Maybe<OwningAnimationTarget>& aTarget,
TimingParams&& aTiming,
const KeyframeEffectParams& aOptions)
@ -631,7 +631,7 @@ KeyframeEffect::ConstructKeyframeEffect(
// In Xray case, the new objects should be created using the document of
// the target global, but the KeyframeEffect constructors are called in the
// caller's compartment to access `aKeyframes` object.
nsIDocument* doc = AnimationUtils::GetDocumentFromGlobal(aGlobal.Get());
Document* doc = AnimationUtils::GetDocumentFromGlobal(aGlobal.Get());
if (!doc) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
@ -819,7 +819,7 @@ void DumpAnimationProperties(
/* static */ already_AddRefed<KeyframeEffect> KeyframeEffect::Constructor(
const GlobalObject& aGlobal, KeyframeEffect& aSource, ErrorResult& aRv) {
nsIDocument* doc = AnimationUtils::GetCurrentRealmDocument(aGlobal.Context());
Document* doc = AnimationUtils::GetCurrentRealmDocument(aGlobal.Context());
if (!doc) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
@ -1241,7 +1241,7 @@ bool KeyframeEffect::CanThrottleOverflowChangesInScrollable(
nsIFrame& aFrame) const {
// If the target element is not associated with any documents, we don't care
// it.
nsIDocument* doc = GetRenderedDocument();
Document* doc = GetRenderedDocument();
if (!doc) {
return true;
}
@ -1314,7 +1314,7 @@ nsIFrame* KeyframeEffect::GetPrimaryFrame() const {
return frame;
}
nsIDocument* KeyframeEffect::GetRenderedDocument() const {
Document* KeyframeEffect::GetRenderedDocument() const {
if (!mTarget) {
return nullptr;
}
@ -1322,7 +1322,7 @@ nsIDocument* KeyframeEffect::GetRenderedDocument() const {
}
nsIPresShell* KeyframeEffect::GetPresShell() const {
nsIDocument* doc = GetRenderedDocument();
Document* doc = GetRenderedDocument();
if (!doc) {
return nullptr;
}

View File

@ -33,7 +33,6 @@
struct JSContext;
class JSObject;
class nsIContent;
class nsIDocument;
class nsIFrame;
class nsIPresShell;
@ -106,10 +105,11 @@ struct ElementPropertyTransition;
namespace dom {
class Animation;
class Document;
class KeyframeEffect : public AnimationEffect {
public:
KeyframeEffect(nsIDocument* aDocument,
KeyframeEffect(Document* aDocument,
const Maybe<OwningAnimationTarget>& aTarget,
TimingParams&& aTiming, const KeyframeEffectParams& aOptions);
@ -257,7 +257,7 @@ class KeyframeEffect : public AnimationEffect {
return GetTarget() && HasGeometricProperties();
}
nsIDocument* GetRenderedDocument() const;
Document* GetRenderedDocument() const;
nsIPresShell* GetPresShell() const;
// Associates a warning with the animated property on the specified frame

View File

@ -27,7 +27,7 @@
#include "nsCSSPropertyIDSet.h"
#include "nsCSSProps.h"
#include "nsCSSPseudoElements.h" // For CSSPseudoElementType
#include "nsIDocument.h" // For nsIDocument::AreWebAnimationsImplicitKeyframesEnabled
#include "mozilla/dom/Document.h" // For Document::AreWebAnimationsImplicitKeyframesEnabled
#include "nsIScriptError.h"
#include "nsTArray.h"
#include <algorithm> // For std::stable_sort, std::min
@ -133,12 +133,12 @@ class ComputedOffsetComparator {
// ------------------------------------------------------------------
static void GetKeyframeListFromKeyframeSequence(JSContext* aCx,
nsIDocument* aDocument,
Document* aDocument,
JS::ForOfIterator& aIterator,
nsTArray<Keyframe>& aResult,
ErrorResult& aRv);
static bool ConvertKeyframeSequence(JSContext* aCx, nsIDocument* aDocument,
static bool ConvertKeyframeSequence(JSContext* aCx, Document* aDocument,
JS::ForOfIterator& aIterator,
nsTArray<Keyframe>& aResult);
@ -157,7 +157,7 @@ static bool AppendValueAsString(JSContext* aCx, nsTArray<nsString>& aValues,
static Maybe<PropertyValuePair> MakePropertyValuePair(
nsCSSPropertyID aProperty, const nsAString& aStringValue,
nsIDocument* aDocument);
Document* aDocument);
static bool HasValidOffsets(const nsTArray<Keyframe>& aKeyframes);
@ -175,11 +175,11 @@ static void BuildSegmentsFromValueEntries(
nsTArray<AnimationProperty>& aResult);
static void GetKeyframeListFromPropertyIndexedKeyframe(
JSContext* aCx, nsIDocument* aDocument, JS::Handle<JS::Value> aValue,
JSContext* aCx, Document* aDocument, JS::Handle<JS::Value> aValue,
nsTArray<Keyframe>& aResult, ErrorResult& aRv);
static bool HasImplicitKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
nsIDocument* aDocument);
Document* aDocument);
static void DistributeRange(const Range<Keyframe>& aRange);
@ -190,7 +190,7 @@ static void DistributeRange(const Range<Keyframe>& aRange);
// ------------------------------------------------------------------
/* static */ nsTArray<Keyframe> KeyframeUtils::GetKeyframesFromObject(
JSContext* aCx, nsIDocument* aDocument, JS::Handle<JSObject*> aFrames,
JSContext* aCx, Document* aDocument, JS::Handle<JSObject*> aFrames,
ErrorResult& aRv) {
MOZ_ASSERT(!aRv.Failed());
@ -224,7 +224,7 @@ static void DistributeRange(const Range<Keyframe>& aRange);
return keyframes;
}
if (!nsIDocument::AreWebAnimationsImplicitKeyframesEnabled(aCx, nullptr) &&
if (!Document::AreWebAnimationsImplicitKeyframesEnabled(aCx, nullptr) &&
HasImplicitKeyframeValues(keyframes, aDocument)) {
keyframes.Clear();
aRv.Throw(NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR);
@ -340,7 +340,7 @@ KeyframeUtils::GetAnimationPropertiesFromKeyframes(
* @param aRv Out param to store any errors thrown by this function.
*/
static void GetKeyframeListFromKeyframeSequence(JSContext* aCx,
nsIDocument* aDocument,
Document* aDocument,
JS::ForOfIterator& aIterator,
nsTArray<Keyframe>& aResult,
ErrorResult& aRv) {
@ -375,7 +375,7 @@ static void GetKeyframeListFromKeyframeSequence(JSContext* aCx,
* IDL sequence<Keyframe> and stores the resulting Keyframe objects in
* aResult.
*/
static bool ConvertKeyframeSequence(JSContext* aCx, nsIDocument* aDocument,
static bool ConvertKeyframeSequence(JSContext* aCx, Document* aDocument,
JS::ForOfIterator& aIterator,
nsTArray<Keyframe>& aResult) {
JS::Rooted<JS::Value> value(aCx);
@ -589,7 +589,7 @@ static bool AppendValueAsString(JSContext* aCx, nsTArray<nsString>& aValues,
static void ReportInvalidPropertyValueToConsole(
nsCSSPropertyID aProperty, const nsAString& aInvalidPropertyValue,
nsIDocument* aDoc) {
Document* aDoc) {
const nsString& invalidValue = PromiseFlatString(aInvalidPropertyValue);
const NS_ConvertASCIItoUTF16 propertyName(
nsCSSProps::GetStringValue(aProperty));
@ -612,7 +612,7 @@ static void ReportInvalidPropertyValueToConsole(
*/
static Maybe<PropertyValuePair> MakePropertyValuePair(
nsCSSPropertyID aProperty, const nsAString& aStringValue,
nsIDocument* aDocument) {
Document* aDocument) {
MOZ_ASSERT(aDocument);
Maybe<PropertyValuePair> result;
@ -942,7 +942,7 @@ static void BuildSegmentsFromValueEntries(
* @param aRv Out param to store any errors thrown by this function.
*/
static void GetKeyframeListFromPropertyIndexedKeyframe(
JSContext* aCx, nsIDocument* aDocument, JS::Handle<JS::Value> aValue,
JSContext* aCx, Document* aDocument, JS::Handle<JS::Value> aValue,
nsTArray<Keyframe>& aResult, ErrorResult& aRv) {
MOZ_ASSERT(aValue.isObject());
MOZ_ASSERT(aResult.IsEmpty());
@ -1144,7 +1144,7 @@ static void GetKeyframeListFromPropertyIndexedKeyframe(
* try to detect where we have an invalid value at 0%/100%.
*/
static bool HasImplicitKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
nsIDocument* aDocument) {
Document* aDocument) {
// We are looking to see if that every property referenced in |aKeyframes|
// has a valid property at offset 0.0 and 1.0. The check as to whether a
// property is valid or not, however, is not precise. We only check if the

View File

@ -14,7 +14,6 @@
struct JSContext;
class JSObject;
class nsIDocument;
class ComputedStyle;
struct RawServoDeclarationBlock;
@ -26,6 +25,7 @@ struct Keyframe;
struct PropertyStyleAnimationValuePair;
namespace dom {
class Document;
class Element;
} // namespace dom
} // namespace mozilla
@ -56,7 +56,7 @@ class KeyframeUtils {
* returned.
*/
static nsTArray<Keyframe> GetKeyframesFromObject(
JSContext* aCx, nsIDocument* aDocument, JS::Handle<JSObject*> aFrames,
JSContext* aCx, dom::Document* aDocument, JS::Handle<JSObject*> aFrames,
ErrorResult& aRv);
/**

View File

@ -10,16 +10,20 @@
#include "mozilla/dom/Animation.h"
#include "mozilla/TypedEnumBits.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsTHashtable.h"
class nsIFrame;
namespace mozilla {
namespace dom {
class Document;
}
class PendingAnimationTracker final {
public:
explicit PendingAnimationTracker(nsIDocument* aDocument)
explicit PendingAnimationTracker(dom::Document* aDocument)
: mDocument(aDocument) {}
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PendingAnimationTracker)
@ -86,7 +90,7 @@ class PendingAnimationTracker final {
AnimationSet mPlayPendingSet;
AnimationSet mPausePendingSet;
nsCOMPtr<nsIDocument> mDocument;
RefPtr<dom::Document> mDocument;
public:
enum class CheckState {

View File

@ -11,7 +11,7 @@
#include "mozilla/dom/KeyframeAnimationOptionsBinding.h"
#include "mozilla/dom/KeyframeEffectBinding.h"
#include "mozilla/ServoCSSParser.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
namespace mozilla {
@ -35,7 +35,7 @@ template <>
template <class OptionsType>
/* static */ TimingParams TimingParams::FromOptionsType(
const OptionsType& aOptions, nsIDocument* aDocument, ErrorResult& aRv) {
const OptionsType& aOptions, Document* aDocument, ErrorResult& aRv) {
TimingParams result;
if (aOptions.IsUnrestrictedDouble()) {
@ -58,18 +58,18 @@ template <class OptionsType>
/* static */ TimingParams TimingParams::FromOptionsUnion(
const dom::UnrestrictedDoubleOrKeyframeEffectOptions& aOptions,
nsIDocument* aDocument, ErrorResult& aRv) {
Document* aDocument, ErrorResult& aRv) {
return FromOptionsType(aOptions, aDocument, aRv);
}
/* static */ TimingParams TimingParams::FromOptionsUnion(
const dom::UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
nsIDocument* aDocument, ErrorResult& aRv) {
Document* aDocument, ErrorResult& aRv) {
return FromOptionsType(aOptions, aDocument, aRv);
}
/* static */ TimingParams TimingParams::FromEffectTiming(
const dom::EffectTiming& aEffectTiming, nsIDocument* aDocument,
const dom::EffectTiming& aEffectTiming, Document* aDocument,
ErrorResult& aRv) {
TimingParams result;
@ -108,7 +108,7 @@ template <class OptionsType>
/* static */ TimingParams TimingParams::MergeOptionalEffectTiming(
const TimingParams& aSource, const dom::OptionalEffectTiming& aEffectTiming,
nsIDocument* aDocument, ErrorResult& aRv) {
Document* aDocument, ErrorResult& aRv) {
MOZ_ASSERT(!aRv.Failed(), "Initially return value should be ok");
TimingParams result = aSource;
@ -183,7 +183,7 @@ template <class OptionsType>
}
/* static */ Maybe<ComputedTimingFunction> TimingParams::ParseEasing(
const nsAString& aEasing, nsIDocument* aDocument, ErrorResult& aRv) {
const nsAString& aEasing, Document* aDocument, ErrorResult& aRv) {
MOZ_ASSERT(aDocument);
nsTimingFunction timingFunction;

View File

@ -18,11 +18,10 @@
#include "mozilla/dom/AnimationEffectBinding.h" // for FillMode
// and PlaybackDirection
class nsIDocument;
namespace mozilla {
namespace dom {
class Document;
class UnrestrictedDoubleOrKeyframeEffectOptions;
class UnrestrictedDoubleOrKeyframeAnimationOptions;
} // namespace dom
@ -56,15 +55,16 @@ struct TimingParams {
template <class OptionsType>
static TimingParams FromOptionsType(const OptionsType& aOptions,
nsIDocument* aDocument, ErrorResult& aRv);
dom::Document* aDocument,
ErrorResult& aRv);
static TimingParams FromOptionsUnion(
const dom::UnrestrictedDoubleOrKeyframeEffectOptions& aOptions,
nsIDocument* aDocument, ErrorResult& aRv);
dom::Document* aDocument, ErrorResult& aRv);
static TimingParams FromOptionsUnion(
const dom::UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
nsIDocument* aDocument, ErrorResult& aRv);
dom::Document* aDocument, ErrorResult& aRv);
static TimingParams FromEffectTiming(const dom::EffectTiming& aEffectTiming,
nsIDocument* aDocument,
dom::Document* aDocument,
ErrorResult& aRv);
// Returns a copy of |aSource| where each timing property in |aSource| that
// is also specified in |aEffectTiming| is replaced with the value from
@ -74,7 +74,7 @@ struct TimingParams {
// true and an unmodified copy of |aSource| will be returned.
static TimingParams MergeOptionalEffectTiming(
const TimingParams& aSource,
const dom::OptionalEffectTiming& aEffectTiming, nsIDocument* aDocument,
const dom::OptionalEffectTiming& aEffectTiming, dom::Document* aDocument,
ErrorResult& aRv);
// Range-checks and validates an UnrestrictedDoubleOrString or
@ -115,7 +115,7 @@ struct TimingParams {
}
static Maybe<ComputedTimingFunction> ParseEasing(const nsAString& aEasing,
nsIDocument* aDocument,
dom::Document* aDocument,
ErrorResult& aRv);
static StickyTimeDuration CalcActiveDuration(

View File

@ -6,7 +6,7 @@
#include "AudioChannelService.h"
#include "mozilla/Preferences.h"
#include "nsContentUtils.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIDOMWindow.h"
#include "nsPIDOMWindow.h"
#include "nsIURI.h"
@ -86,7 +86,7 @@ nsresult AudioChannelAgent::FindCorrectWindow(nsPIDOMWindowInner* aWindow) {
return NS_OK;
}
nsCOMPtr<nsIDocument> doc = parent->GetExtantDoc();
nsCOMPtr<Document> doc = parent->GetExtantDoc();
if (!doc) {
return NS_OK;
}

View File

@ -877,7 +877,7 @@ void AudioChannelService::AudioChannelWindow::MaybeNotifyMediaBlockStart(
return;
}
nsCOMPtr<nsIDocument> doc = inner->GetExtantDoc();
nsCOMPtr<Document> doc = inner->GetExtantDoc();
if (!doc) {
return;
}

View File

@ -9,7 +9,7 @@
#include "mozilla/dom/AnonymousContentBinding.h"
#include "nsComputedDOMStyle.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIFrame.h"
#include "nsStyledElement.h"
#include "HTMLCanvasElement.h"

View File

@ -10,7 +10,7 @@
#include "mozilla/dom/Element.h"
#include "nsCycleCollectionParticipant.h"
#include "nsICSSDeclaration.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
namespace mozilla {
namespace dom {

View File

@ -18,7 +18,7 @@
#include "nsUnicharUtils.h"
#include "nsDOMString.h"
#include "nsIContentInlines.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsGkAtoms.h"
#include "nsCOMArray.h"
#include "nsNameSpaceManager.h"
@ -115,10 +115,10 @@ Element* Attr::GetElement() const {
return content ? content->AsElement() : nullptr;
}
nsresult Attr::SetOwnerDocument(nsIDocument* aDocument) {
nsresult Attr::SetOwnerDocument(Document* aDocument) {
NS_ASSERTION(aDocument, "Missing document");
nsIDocument* doc = OwnerDoc();
Document* doc = OwnerDoc();
NS_ASSERTION(doc != aDocument, "bad call to Attr::SetOwnerDocument");
doc->DeleteAllPropertiesFor(this);

View File

@ -18,12 +18,12 @@
#include "nsCycleCollectionParticipant.h"
#include "nsStubMutationObserver.h"
class nsIDocument;
namespace mozilla {
class EventChainPreVisitor;
namespace dom {
class Document;
// Attribute helper class used to wrap up an attribute with a dom
// object that implements the DOM Attr interface.
class Attr final : public nsINode {
@ -61,7 +61,7 @@ class Attr final : public nsINode {
* Called when our ownerElement is moved into a new document.
* Updates the nodeinfo of this node.
*/
nsresult SetOwnerDocument(nsIDocument* aDocument);
nsresult SetOwnerDocument(Document* aDocument);
// nsINode interface
virtual bool IsNodeOfType(uint32_t aFlags) const override;

View File

@ -23,6 +23,7 @@
#include "nsContentUtils.h" // nsAutoScriptBlocker
using mozilla::CheckedUint32;
using mozilla::dom::Document;
AttrArray::Impl::~Impl() {
for (InternalAttr& attr : NonMappedAttrs()) {
@ -358,7 +359,7 @@ uint32_t AttrArray::DoGetMappedAttrCount() const {
}
nsresult AttrArray::ForceMapped(nsMappedAttributeElement* aContent,
nsIDocument* aDocument) {
Document* aDocument) {
nsHTMLStyleSheet* sheet = aDocument->GetAttributeStyleSheet();
RefPtr<nsMappedAttributes> mapped =
GetModifiableMapped(aContent, sheet, false, 0);

View File

@ -110,7 +110,7 @@ class AttrArray {
// Force this to have mapped attributes, even if those attributes are empty.
nsresult ForceMapped(nsMappedAttributeElement* aContent,
nsIDocument* aDocument);
mozilla::dom::Document* aDocument);
// Clear the servo declaration block on the mapped attributes, if any
// Will assert off main thread

View File

@ -18,7 +18,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLSlotElement.h"
#include "mozilla/dom/ShadowRoot.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsReadableUtils.h"
#include "mozilla/InternalMutationEvent.h"
#include "nsIURI.h"
@ -230,7 +230,7 @@ nsresult CharacterData::SetTextInternal(
return NS_ERROR_OUT_OF_MEMORY;
}
nsIDocument* document = GetComposedDoc();
Document* document = GetComposedDoc();
mozAutoDocUpdate updateBatch(document, aNotify);
bool haveMutationListeners =
@ -390,7 +390,7 @@ void CharacterData::ToCString(nsAString& aBuf, int32_t aOffset,
}
#endif
nsresult CharacterData::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsresult CharacterData::BindToTree(Document* aDocument, nsIContent* aParent,
nsIContent* aBindingParent) {
MOZ_ASSERT(aParent || aDocument, "Must have document if no parent!");
MOZ_ASSERT(NODE_FROM(aParent, aDocument)->OwnerDoc() == OwnerDoc(),
@ -500,7 +500,7 @@ void CharacterData::UnbindFromTree(bool aDeep, bool aNullParent) {
// Unset frame flags; if we need them again later, they'll get set again.
UnsetFlags(NS_CREATE_FRAME_IF_NON_WHITESPACE | NS_REFRAME_IF_WHITESPACE);
nsIDocument* document = GetComposedDoc();
Document* document = GetComposedDoc();
if (aNullParent) {
if (this->IsRootOfNativeAnonymousSubtree()) {

View File

@ -23,8 +23,6 @@
#include "nsISMILAttr.h"
#include "mozilla/dom/ShadowRoot.h"
class nsIDocument;
namespace mozilla {
namespace dom {
class HTMLSlotElement;
@ -110,7 +108,7 @@ class CharacterData : public nsIContent {
}
// Implementation for nsIContent
nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsresult BindToTree(Document* aDocument, nsIContent* aParent,
nsIContent* aBindingParent) override;
void UnbindFromTree(bool aDeep = true, bool aNullParent = true) override;

View File

@ -6,13 +6,13 @@
#include "ChildIterator.h"
#include "nsContentUtils.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/HTMLSlotElement.h"
#include "mozilla/dom/XBLChildrenElement.h"
#include "mozilla/dom/ShadowRoot.h"
#include "nsIAnonymousContentCreator.h"
#include "nsIFrame.h"
#include "nsCSSAnonBoxes.h"
#include "nsIDocument.h"
namespace mozilla {
namespace dom {

View File

@ -13,7 +13,7 @@ using namespace mozilla::dom;
already_AddRefed<ChromeNodeList> ChromeNodeList::Constructor(
const GlobalObject& aGlobal, ErrorResult& aRv) {
nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aGlobal.GetAsSupports());
nsIDocument* root = win ? win->GetExtantDoc() : nullptr;
Document* root = win ? win->GetExtantDoc() : nullptr;
RefPtr<ChromeNodeList> list = new ChromeNodeList(root);
return list.forget();
}

View File

@ -98,25 +98,25 @@ size_t LifecycleCallbackArgs::SizeOfExcludingThis(
void CustomElementCallback::Call() {
switch (mType) {
case nsIDocument::eConnected:
case Document::eConnected:
static_cast<LifecycleConnectedCallback*>(mCallback.get())
->Call(mThisObject);
break;
case nsIDocument::eDisconnected:
case Document::eDisconnected:
static_cast<LifecycleDisconnectedCallback*>(mCallback.get())
->Call(mThisObject);
break;
case nsIDocument::eAdopted:
case Document::eAdopted:
static_cast<LifecycleAdoptedCallback*>(mCallback.get())
->Call(mThisObject, mAdoptedCallbackArgs.mOldDocument,
mAdoptedCallbackArgs.mNewDocument);
break;
case nsIDocument::eAttributeChanged:
case Document::eAttributeChanged:
static_cast<LifecycleAttributeChangedCallback*>(mCallback.get())
->Call(mThisObject, mArgs.name, mArgs.oldValue, mArgs.newValue,
mArgs.namespaceURI);
break;
case nsIDocument::eGetCustomInterface:
case Document::eGetCustomInterface:
MOZ_ASSERT_UNREACHABLE("Don't call GetCustomInterface through callback");
break;
}
@ -149,7 +149,7 @@ size_t CustomElementCallback::SizeOfIncludingThis(
}
CustomElementCallback::CustomElementCallback(
Element* aThisObject, nsIDocument::ElementCallbackType aCallbackType,
Element* aThisObject, Document::ElementCallbackType aCallbackType,
mozilla::dom::CallbackFunction* aCallback)
: mThisObject(aThisObject), mCallback(aCallback), mType(aCallbackType) {}
//-----------------------------------------------------
@ -446,7 +446,7 @@ void CustomElementRegistry::UnregisterUnresolvedElement(Element* aElement,
/* static */ UniquePtr<CustomElementCallback>
CustomElementRegistry::CreateCustomElementCallback(
nsIDocument::ElementCallbackType aType, Element* aCustomElement,
Document::ElementCallbackType aType, Element* aCustomElement,
LifecycleCallbackArgs* aArgs,
LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs,
CustomElementDefinition* aDefinition) {
@ -457,31 +457,31 @@ CustomElementRegistry::CreateCustomElementCallback(
// Let CALLBACK be the callback associated with the key NAME in CALLBACKS.
CallbackFunction* func = nullptr;
switch (aType) {
case nsIDocument::eConnected:
case Document::eConnected:
if (aDefinition->mCallbacks->mConnectedCallback.WasPassed()) {
func = aDefinition->mCallbacks->mConnectedCallback.Value();
}
break;
case nsIDocument::eDisconnected:
case Document::eDisconnected:
if (aDefinition->mCallbacks->mDisconnectedCallback.WasPassed()) {
func = aDefinition->mCallbacks->mDisconnectedCallback.Value();
}
break;
case nsIDocument::eAdopted:
case Document::eAdopted:
if (aDefinition->mCallbacks->mAdoptedCallback.WasPassed()) {
func = aDefinition->mCallbacks->mAdoptedCallback.Value();
}
break;
case nsIDocument::eAttributeChanged:
case Document::eAttributeChanged:
if (aDefinition->mCallbacks->mAttributeChangedCallback.WasPassed()) {
func = aDefinition->mCallbacks->mAttributeChangedCallback.Value();
}
break;
case nsIDocument::eGetCustomInterface:
case Document::eGetCustomInterface:
MOZ_ASSERT_UNREACHABLE("Don't call GetCustomInterface through callback");
break;
}
@ -506,7 +506,7 @@ CustomElementRegistry::CreateCustomElementCallback(
}
/* static */ void CustomElementRegistry::EnqueueLifecycleCallback(
nsIDocument::ElementCallbackType aType, Element* aCustomElement,
Document::ElementCallbackType aType, Element* aCustomElement,
LifecycleCallbackArgs* aArgs,
LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs,
CustomElementDefinition* aDefinition) {
@ -535,7 +535,7 @@ CustomElementRegistry::CreateCustomElementCallback(
return;
}
if (aType == nsIDocument::eAttributeChanged) {
if (aType == Document::eAttributeChanged) {
RefPtr<nsAtom> attrName = NS_Atomize(aArgs->name);
if (definition->mObservedAttributes.IsEmpty() ||
!definition->mObservedAttributes.Contains(attrName)) {
@ -553,19 +553,19 @@ namespace {
class CandidateFinder {
public:
CandidateFinder(nsTHashtable<nsRefPtrHashKey<nsIWeakReference>>& aCandidates,
nsIDocument* aDoc);
Document* aDoc);
nsTArray<nsCOMPtr<Element>> OrderedCandidates();
private:
bool Traverse(Element* aRoot, nsTArray<nsCOMPtr<Element>>& aOrderedElements);
nsCOMPtr<nsIDocument> mDoc;
nsCOMPtr<Document> mDoc;
nsInterfaceHashtable<nsPtrHashKey<Element>, Element> mCandidates;
};
CandidateFinder::CandidateFinder(
nsTHashtable<nsRefPtrHashKey<nsIWeakReference>>& aCandidates,
nsIDocument* aDoc)
Document* aDoc)
: mDoc(aDoc), mCandidates(aCandidates.Count()) {
MOZ_ASSERT(mDoc);
for (auto iter = aCandidates.Iter(); !iter.Done(); iter.Next()) {
@ -714,7 +714,7 @@ void CustomElementRegistry::Define(JSContext* aCx, const nsAString& aName,
* 2. If name is not a valid custom element name, then throw a "SyntaxError"
* DOMException and abort these steps.
*/
nsIDocument* doc = mWindow->GetExtantDoc();
Document* doc = mWindow->GetExtantDoc();
RefPtr<nsAtom> nameAtom(NS_Atomize(aName));
if (!nsContentUtils::IsCustomElementName(nameAtom, nameSpaceID)) {
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
@ -1060,7 +1060,7 @@ already_AddRefed<Promise> CustomElementRegistry::WhenDefined(
}
RefPtr<nsAtom> nameAtom(NS_Atomize(aName));
nsIDocument* doc = mWindow->GetExtantDoc();
Document* doc = mWindow->GetExtantDoc();
uint32_t nameSpaceID =
doc ? doc->GetDefaultNamespaceID() : kNameSpaceID_XHTML;
if (!nsContentUtils::IsCustomElementName(nameAtom, nameSpaceID)) {
@ -1134,16 +1134,15 @@ static void DoUpgrade(Element* aElement, CustomElementConstructor* aConstructor,
LifecycleCallbackArgs args = {
nsDependentAtomString(attrName), VoidString(), attrValue,
(namespaceURI.IsEmpty() ? VoidString() : namespaceURI)};
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAttributeChanged,
aElement, &args, nullptr,
aDefinition);
nsContentUtils::EnqueueLifecycleCallback(
Document::eAttributeChanged, aElement, &args, nullptr, aDefinition);
}
}
}
// Step 4.
if (aElement->IsInComposedDoc()) {
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eConnected, aElement,
nsContentUtils::EnqueueLifecycleCallback(Document::eConnected, aElement,
nullptr, nullptr, aDefinition);
}

View File

@ -43,27 +43,27 @@ struct LifecycleCallbackArgs {
};
struct LifecycleAdoptedCallbackArgs {
nsCOMPtr<nsIDocument> mOldDocument;
nsCOMPtr<nsIDocument> mNewDocument;
RefPtr<Document> mOldDocument;
RefPtr<Document> mNewDocument;
};
class CustomElementCallback {
public:
CustomElementCallback(Element* aThisObject,
nsIDocument::ElementCallbackType aCallbackType,
Document::ElementCallbackType aCallbackType,
CallbackFunction* aCallback);
void Traverse(nsCycleCollectionTraversalCallback& aCb) const;
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
void Call();
void SetArgs(LifecycleCallbackArgs& aArgs) {
MOZ_ASSERT(mType == nsIDocument::eAttributeChanged,
MOZ_ASSERT(mType == Document::eAttributeChanged,
"Arguments are only used by attribute changed callback.");
mArgs = aArgs;
}
void SetAdoptedCallbackArgs(
LifecycleAdoptedCallbackArgs& aAdoptedCallbackArgs) {
MOZ_ASSERT(mType == nsIDocument::eAdopted,
MOZ_ASSERT(mType == Document::eAdopted,
"Arguments are only used by adopted callback.");
mAdoptedCallbackArgs = aAdoptedCallbackArgs;
}
@ -73,7 +73,7 @@ class CustomElementCallback {
RefPtr<Element> mThisObject;
RefPtr<CallbackFunction> mCallback;
// The type of callback (eCreated, eAttached, etc.)
nsIDocument::ElementCallbackType mType;
Document::ElementCallbackType mType;
// Arguments to be passed to the callback,
// used by the attribute changed callback.
LifecycleCallbackArgs mArgs;
@ -349,7 +349,6 @@ class CustomElementReactionsStack {
};
class CustomElementRegistry final : public nsISupports, public nsWrapperCache {
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CustomElementRegistry)
@ -399,7 +398,7 @@ class CustomElementRegistry final : public nsISupports, public nsWrapperCache {
JSContext* aCx, JSObject* aConstructor) const;
static void EnqueueLifecycleCallback(
nsIDocument::ElementCallbackType aType, Element* aCustomElement,
Document::ElementCallbackType aType, Element* aCustomElement,
LifecycleCallbackArgs* aArgs,
LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs,
CustomElementDefinition* aDefinition);
@ -474,7 +473,7 @@ class CustomElementRegistry final : public nsISupports, public nsWrapperCache {
~CustomElementRegistry();
static UniquePtr<CustomElementCallback> CreateCustomElementCallback(
nsIDocument::ElementCallbackType aType, Element* aCustomElement,
Document::ElementCallbackType aType, Element* aCustomElement,
LifecycleCallbackArgs* aArgs,
LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs,
CustomElementDefinition* aDefinition);

View File

@ -8,7 +8,7 @@
#include "mozilla/dom/DOMErrorBinding.h"
#include "mozilla/dom/DOMException.h"
#include "mozilla/UseCounter.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsPIDOMWindow.h"
namespace mozilla {
@ -55,7 +55,7 @@ JSObject* DOMError::WrapObject(JSContext* aCx,
do_QueryInterface(aGlobal.GetAsSupports());
if (window) {
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
nsCOMPtr<Document> doc = window->GetExtantDoc();
if (doc) {
doc->SetDocumentAndPageUseCounter(eUseCounter_custom_DOMErrorConstructor);
}

View File

@ -11,7 +11,7 @@
#include "mozilla/dom/Exceptions.h"
#include "nsContentUtils.h"
#include "nsCOMPtr.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIException.h"
#include "nsMemory.h"
#include "xpcprivate.h"

View File

@ -60,7 +60,7 @@ already_AddRefed<DocumentType> DOMImplementation::CreateDocumentType(
nsresult DOMImplementation::CreateDocument(const nsAString& aNamespaceURI,
const nsAString& aQualifiedName,
DocumentType* aDoctype,
nsIDocument** aDocument) {
Document** aDocument) {
*aDocument = nullptr;
nsresult rv;
@ -83,7 +83,7 @@ nsresult DOMImplementation::CreateDocument(const nsAString& aNamespaceURI,
NS_ENSURE_STATE(!mScriptObject || scriptHandlingObject);
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<Document> doc;
rv = NS_NewDOMDocument(getter_AddRefs(doc), aNamespaceURI, aQualifiedName,
aDoctype, mDocumentURI, mBaseURI,
@ -103,23 +103,23 @@ nsresult DOMImplementation::CreateDocument(const nsAString& aNamespaceURI,
doc->SetContentType(NS_LITERAL_STRING("application/xml"));
}
doc->SetReadyStateInternal(nsIDocument::READYSTATE_COMPLETE);
doc->SetReadyStateInternal(Document::READYSTATE_COMPLETE);
doc.forget(aDocument);
return NS_OK;
}
already_AddRefed<nsIDocument> DOMImplementation::CreateDocument(
already_AddRefed<Document> DOMImplementation::CreateDocument(
const nsAString& aNamespaceURI, const nsAString& aQualifiedName,
DocumentType* aDoctype, ErrorResult& aRv) {
nsCOMPtr<nsIDocument> document;
nsCOMPtr<Document> document;
aRv = CreateDocument(aNamespaceURI, aQualifiedName, aDoctype,
getter_AddRefs(document));
return document.forget();
}
nsresult DOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
nsIDocument** aDocument) {
Document** aDocument) {
*aDocument = nullptr;
NS_ENSURE_STATE(mOwner);
@ -137,7 +137,7 @@ nsresult DOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
NS_ENSURE_STATE(!mScriptObject || scriptHandlingObject);
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<Document> doc;
nsresult rv = NS_NewDOMDocument(
getter_AddRefs(doc), EmptyString(), EmptyString(), doctype, mDocumentURI,
mBaseURI, mOwner->NodePrincipal(), true, scriptHandlingObject,
@ -172,15 +172,15 @@ nsresult DOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
rv = root->AppendChildTo(body, false);
NS_ENSURE_SUCCESS(rv, rv);
doc->SetReadyStateInternal(nsIDocument::READYSTATE_COMPLETE);
doc->SetReadyStateInternal(Document::READYSTATE_COMPLETE);
doc.forget(aDocument);
return NS_OK;
}
already_AddRefed<nsIDocument> DOMImplementation::CreateHTMLDocument(
already_AddRefed<Document> DOMImplementation::CreateHTMLDocument(
const Optional<nsAString>& aTitle, ErrorResult& aRv) {
nsCOMPtr<nsIDocument> document;
nsCOMPtr<Document> document;
aRv = CreateHTMLDocument(aTitle.WasPassed() ? aTitle.Value() : VoidString(),
getter_AddRefs(document));
return document.forget();

View File

@ -13,7 +13,7 @@
#include "mozilla/ErrorResult.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIDocument.h"
#include "mozilla/dom/Document.h"
#include "nsIScriptGlobalObject.h"
#include "nsIURI.h"
#include "nsIWeakReferenceUtils.h"
@ -21,13 +21,14 @@
namespace mozilla {
namespace dom {
class Document;
class DocumentType;
class DOMImplementation final : public nsISupports, public nsWrapperCache {
~DOMImplementation() {}
public:
DOMImplementation(nsIDocument* aOwner, nsIGlobalObject* aScriptObject,
DOMImplementation(Document* aOwner, nsIGlobalObject* aScriptObject,
nsIURI* aDocumentURI, nsIURI* aBaseURI)
: mOwner(aOwner),
mScriptObject(do_GetWeakReference(aScriptObject)),
@ -39,7 +40,7 @@ class DOMImplementation final : public nsISupports, public nsWrapperCache {
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMImplementation)
nsIDocument* GetParentObject() const { return mOwner; }
Document* GetParentObject() const { return mOwner; }
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
@ -50,21 +51,21 @@ class DOMImplementation final : public nsISupports, public nsWrapperCache {
const nsAString& aQualifiedName, const nsAString& aPublicId,
const nsAString& aSystemId, ErrorResult& aRv);
already_AddRefed<nsIDocument> CreateDocument(const nsAString& aNamespaceURI,
const nsAString& aQualifiedName,
DocumentType* aDoctype,
ErrorResult& aRv);
already_AddRefed<Document> CreateDocument(const nsAString& aNamespaceURI,
const nsAString& aQualifiedName,
DocumentType* aDoctype,
ErrorResult& aRv);
already_AddRefed<nsIDocument> CreateHTMLDocument(
already_AddRefed<Document> CreateHTMLDocument(
const Optional<nsAString>& aTitle, ErrorResult& aRv);
private:
nsresult CreateDocument(const nsAString& aNamespaceURI,
const nsAString& aQualifiedName,
DocumentType* aDoctype, nsIDocument** aDocument);
nsresult CreateHTMLDocument(const nsAString& aTitle, nsIDocument** aDocument);
DocumentType* aDoctype, Document** aDocument);
nsresult CreateHTMLDocument(const nsAString& aTitle, Document** aDocument);
nsCOMPtr<nsIDocument> mOwner;
nsCOMPtr<Document> mOwner;
nsWeakPtr mScriptObject;
nsCOMPtr<nsIURI> mDocumentURI;
nsCOMPtr<nsIURI> mBaseURI;

View File

@ -226,7 +226,7 @@ enum class BrowsingContextInfo {
UnknownBrowsingContext
};
void DOMIntersectionObserver::Update(nsIDocument* aDocument,
void DOMIntersectionObserver::Update(Document* aDocument,
DOMHighResTimeStamp time) {
Element* root = nullptr;
nsIFrame* rootFrame = nullptr;

View File

@ -131,7 +131,7 @@ class DOMIntersectionObserver final : public nsISupports,
bool SetRootMargin(const nsAString& aString);
void Update(nsIDocument* aDocument, DOMHighResTimeStamp time);
void Update(Document* aDocument, DOMHighResTimeStamp time);
void Notify();
protected:
@ -144,7 +144,7 @@ class DOMIntersectionObserver final : public nsISupports,
double aIntersectionRatio);
nsCOMPtr<nsPIDOMWindowInner> mOwner;
RefPtr<nsIDocument> mDocument;
RefPtr<Document> mDocument;
RefPtr<mozilla::dom::IntersectionCallback> mCallback;
RefPtr<Element> mRoot;
nsStyleSides mRootMargin;

View File

@ -55,11 +55,11 @@ static const char* StringFromSupportedType(SupportedType aType) {
return SupportedTypeValues::strings[static_cast<int>(aType)].value;
}
already_AddRefed<nsIDocument> DOMParser::ParseFromString(const nsAString& aStr,
SupportedType aType,
ErrorResult& aRv) {
already_AddRefed<Document> DOMParser::ParseFromString(const nsAString& aStr,
SupportedType aType,
ErrorResult& aRv) {
if (aType == SupportedType::Text_html) {
nsCOMPtr<nsIDocument> document = SetUpDocument(DocumentFlavorHTML, aRv);
nsCOMPtr<Document> document = SetUpDocument(DocumentFlavorHTML, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
@ -98,15 +98,16 @@ already_AddRefed<nsIDocument> DOMParser::ParseFromString(const nsAString& aStr,
aType, aRv);
}
already_AddRefed<nsIDocument> DOMParser::ParseFromBuffer(const Uint8Array& aBuf,
SupportedType aType,
ErrorResult& aRv) {
already_AddRefed<Document> DOMParser::ParseFromBuffer(const Uint8Array& aBuf,
SupportedType aType,
ErrorResult& aRv) {
aBuf.ComputeLengthAndData();
return ParseFromBuffer(MakeSpan(aBuf.Data(), aBuf.Length()), aType, aRv);
}
already_AddRefed<nsIDocument> DOMParser::ParseFromBuffer(
Span<const uint8_t> aBuf, SupportedType aType, ErrorResult& aRv) {
already_AddRefed<Document> DOMParser::ParseFromBuffer(Span<const uint8_t> aBuf,
SupportedType aType,
ErrorResult& aRv) {
// The new stream holds a reference to the buffer
nsCOMPtr<nsIInputStream> stream;
nsresult rv = NS_NewByteInputStream(
@ -120,9 +121,11 @@ already_AddRefed<nsIDocument> DOMParser::ParseFromBuffer(
return ParseFromStream(stream, VoidString(), aBuf.Length(), aType, aRv);
}
already_AddRefed<nsIDocument> DOMParser::ParseFromStream(
nsIInputStream* aStream, const nsAString& aCharset, int32_t aContentLength,
SupportedType aType, ErrorResult& aRv) {
already_AddRefed<Document> DOMParser::ParseFromStream(nsIInputStream* aStream,
const nsAString& aCharset,
int32_t aContentLength,
SupportedType aType,
ErrorResult& aRv) {
bool svg = (aType == SupportedType::Image_svg_xml);
// For now, we can only create XML documents.
@ -149,7 +152,7 @@ already_AddRefed<nsIDocument> DOMParser::ParseFromStream(
stream = bufferedStream;
}
nsCOMPtr<nsIDocument> document =
nsCOMPtr<Document> document =
SetUpDocument(svg ? DocumentFlavorSVG : DocumentFlavorLegacyGuess, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
@ -269,13 +272,13 @@ already_AddRefed<DOMParser> DOMParser::CreateWithoutGlobal(ErrorResult& aRv) {
return domParser.forget();
}
already_AddRefed<nsIDocument> DOMParser::SetUpDocument(DocumentFlavor aFlavor,
ErrorResult& aRv) {
// We should really just use mOwner here, but nsIDocument gets confused
already_AddRefed<Document> DOMParser::SetUpDocument(DocumentFlavor aFlavor,
ErrorResult& aRv) {
// We should really just use mOwner here, but Document 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 nsIDocument
// off of nsIScriptGlobalObject, but that's a yak to shave another day.
// a window global) breaks. The correct solution is just to wean Document off
// of nsIScriptGlobalObject, but that's a yak to shave another day.
nsCOMPtr<nsIScriptGlobalObject> scriptHandlingObject =
do_QueryInterface(mOwner);
@ -283,7 +286,7 @@ already_AddRefed<nsIDocument> DOMParser::SetUpDocument(DocumentFlavor aFlavor,
NS_ASSERTION(mPrincipal, "Must have principal by now");
NS_ASSERTION(mDocumentURI, "Must have document URI by now");
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<Document> doc;
nsresult rv = NS_NewDOMDocument(
getter_AddRefs(doc), EmptyString(), EmptyString(), nullptr, mDocumentURI,
mBaseURI, mPrincipal, true, scriptHandlingObject, aFlavor);

Some files were not shown because too many files have changed in this diff Show More