Bug 1434318 part 4. Remove nsIDOMDocument's documentElement attribute. r=mystor

MozReview-Commit-ID: 2FUstFDF2lF
This commit is contained in:
Boris Zbarsky 2018-01-31 15:18:10 -05:00
parent 22839b2f74
commit 29c18cd07f
4 changed files with 10 additions and 33 deletions

View File

@ -27,8 +27,6 @@
#include "nsITooltipListener.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentType.h"
#include "nsIDOMElement.h"
#include "Link.h"
#include "mozilla/dom/Element.h"
@ -414,16 +412,12 @@ nsDocShellTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem,
return webBrowserChrome->SizeBrowserTo(aCX, aCY);
}
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(aShellItem));
NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
NS_ENSURE_TRUE(aShellItem, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMDocument> domDocument;
webNav->GetDocument(getter_AddRefs(domDocument));
NS_ENSURE_TRUE(domDocument, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocument> document = aShellItem->GetDocument();
NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMElement> domElement;
domDocument->GetDocumentElement(getter_AddRefs(domElement));
NS_ENSURE_TRUE(domElement, NS_ERROR_FAILURE);
NS_ENSURE_TRUE(document->GetDocumentElement(), NS_ERROR_FAILURE);
// Set the preferred Size
//XXX

View File

@ -5853,21 +5853,6 @@ nsDocument::GetImplementation(ErrorResult& rv)
return mDOMImplementation;
}
NS_IMETHODIMP
nsDocument::GetDocumentElement(nsIDOMElement** aDocumentElement)
{
NS_ENSURE_ARG_POINTER(aDocumentElement);
Element* root = GetRootElement();
if (root) {
return CallQueryInterface(root, aDocumentElement);
}
*aDocumentElement = nullptr;
return NS_OK;
}
NS_IMETHODIMP
nsDocument::CreateElement(const nsAString& aTagName,
nsIDOMElement** aReturn)

View File

@ -36,7 +36,6 @@ interface nsIDOMTreeWalker;
interface nsIDOMDocument : nsIDOMNode
{
readonly attribute nsIDOMDOMImplementation implementation;
readonly attribute nsIDOMElement documentElement;
nsIDOMElement createElement([Null(Stringify)] in DOMString tagName)
raises(DOMException);
nsIDOMDocumentFragment createDocumentFragment();

View File

@ -8,7 +8,6 @@
#include "nsIContentViewer.h"
#include "nsIDocShell.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMWindow.h"
#include "nsIFactory.h"
@ -37,12 +36,12 @@ nsCOMPtr<nsIDOMNode> GetDOMNodeFromDocShell(nsIDocShell *aShell)
nsCOMPtr<nsIContentViewer> cv;
aShell->GetContentViewer(getter_AddRefs(cv));
if (cv) {
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(cv->GetDocument()));
if (domdoc) {
nsCOMPtr<nsIDOMElement> element;
domdoc->GetDocumentElement(getter_AddRefs(element));
if (element)
node = element;
nsCOMPtr<nsIDocument> doc = cv->GetDocument();
if (doc) {
Element* element = doc->GetDocumentElement();
if (element) {
node = element->AsDOMNode();
}
}
}