From 5fa76e716fa3c4bb1c794e8b2a5867b3145fa744 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 29 May 2018 22:58:49 -0400 Subject: [PATCH] Bug 1455676 part 11. Remove use of nsIDOMNode from xpfe/. r=qdot --- xpfe/appshell/nsAppShellWindowEnumerator.cpp | 20 ++++++-------------- xpfe/appshell/nsChromeTreeOwner.cpp | 1 - xpfe/appshell/nsContentTreeOwner.cpp | 1 - xpfe/appshell/nsWebShellWindow.cpp | 1 - 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/xpfe/appshell/nsAppShellWindowEnumerator.cpp b/xpfe/appshell/nsAppShellWindowEnumerator.cpp index 6b919705364a..0481fa10584a 100644 --- a/xpfe/appshell/nsAppShellWindowEnumerator.cpp +++ b/xpfe/appshell/nsAppShellWindowEnumerator.cpp @@ -23,28 +23,22 @@ using mozilla::dom::Element; // static helper functions // -static nsCOMPtr GetDOMNodeFromDocShell(nsIDocShell *aShell); static void GetAttribute(nsIXULWindow *inWindow, const nsAString &inAttribute, nsAString &outValue); static void GetWindowType(nsIXULWindow* inWindow, nsString &outType); -nsCOMPtr GetDOMNodeFromDocShell(nsIDocShell *aShell) +static Element* GetElementFromDocShell(nsIDocShell *aShell) { - nsCOMPtr node; - nsCOMPtr cv; aShell->GetContentViewer(getter_AddRefs(cv)); if (cv) { nsCOMPtr doc = cv->GetDocument(); if (doc) { - Element* element = doc->GetDocumentElement(); - if (element) { - node = element->AsDOMNode(); - } + return doc->GetDocumentElement(); } } - return node; + return nullptr; } // generic "retrieve the value of a XUL attribute" function @@ -53,11 +47,9 @@ void GetAttribute(nsIXULWindow *inWindow, const nsAString &inAttribute, { nsCOMPtr shell; if (inWindow && NS_SUCCEEDED(inWindow->GetDocShell(getter_AddRefs(shell)))) { - nsCOMPtr node(GetDOMNodeFromDocShell(shell)); - if (node) { - nsCOMPtr webshellElement(do_QueryInterface(node)); - if (webshellElement) - webshellElement->GetAttribute(inAttribute, outValue); + RefPtr webshellElement = GetElementFromDocShell(shell); + if (webshellElement) { + webshellElement->GetAttribute(inAttribute, outValue); } } } diff --git a/xpfe/appshell/nsChromeTreeOwner.cpp b/xpfe/appshell/nsChromeTreeOwner.cpp index ab77ad143893..d8a7f3e49342 100644 --- a/xpfe/appshell/nsChromeTreeOwner.cpp +++ b/xpfe/appshell/nsChromeTreeOwner.cpp @@ -22,7 +22,6 @@ #include "nsIWidget.h" #include "nsIWindowMediator.h" #include "nsIDOMChromeWindow.h" -#include "nsIDOMNode.h" #include "nsIXULBrowserWindow.h" #include "mozilla/dom/Element.h" diff --git a/xpfe/appshell/nsContentTreeOwner.cpp b/xpfe/appshell/nsContentTreeOwner.cpp index 243a84ae22ae..0e91600c2671 100644 --- a/xpfe/appshell/nsContentTreeOwner.cpp +++ b/xpfe/appshell/nsContentTreeOwner.cpp @@ -14,7 +14,6 @@ #include "nsAutoPtr.h" // Interfaces needed to be included -#include "nsIDOMNode.h" #include "nsIDOMWindow.h" #include "nsIDOMChromeWindow.h" #include "nsIBrowserDOMWindow.h" diff --git a/xpfe/appshell/nsWebShellWindow.cpp b/xpfe/appshell/nsWebShellWindow.cpp index b359aadee347..d694c8b7b9a1 100644 --- a/xpfe/appshell/nsWebShellWindow.cpp +++ b/xpfe/appshell/nsWebShellWindow.cpp @@ -41,7 +41,6 @@ #include "nsIWebProgressListener.h" #include "nsIDocument.h" -#include "nsIDOMNode.h" #include "nsIDocumentLoaderFactory.h" #include "nsIObserverService.h"