forked from mirrors/gecko-dev
Bug 1455676 part 11. Remove use of nsIDOMNode from xpfe/. r=qdot
This commit is contained in:
parent
931b9e37ad
commit
5fa76e716f
4 changed files with 6 additions and 17 deletions
|
|
@ -23,28 +23,22 @@ using mozilla::dom::Element;
|
||||||
// static helper functions
|
// static helper functions
|
||||||
//
|
//
|
||||||
|
|
||||||
static nsCOMPtr<nsIDOMNode> GetDOMNodeFromDocShell(nsIDocShell *aShell);
|
|
||||||
static void GetAttribute(nsIXULWindow *inWindow, const nsAString &inAttribute,
|
static void GetAttribute(nsIXULWindow *inWindow, const nsAString &inAttribute,
|
||||||
nsAString &outValue);
|
nsAString &outValue);
|
||||||
static void GetWindowType(nsIXULWindow* inWindow, nsString &outType);
|
static void GetWindowType(nsIXULWindow* inWindow, nsString &outType);
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> GetDOMNodeFromDocShell(nsIDocShell *aShell)
|
static Element* GetElementFromDocShell(nsIDocShell *aShell)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMNode> node;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIContentViewer> cv;
|
nsCOMPtr<nsIContentViewer> cv;
|
||||||
aShell->GetContentViewer(getter_AddRefs(cv));
|
aShell->GetContentViewer(getter_AddRefs(cv));
|
||||||
if (cv) {
|
if (cv) {
|
||||||
nsCOMPtr<nsIDocument> doc = cv->GetDocument();
|
nsCOMPtr<nsIDocument> doc = cv->GetDocument();
|
||||||
if (doc) {
|
if (doc) {
|
||||||
Element* element = doc->GetDocumentElement();
|
return doc->GetDocumentElement();
|
||||||
if (element) {
|
|
||||||
node = element->AsDOMNode();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// generic "retrieve the value of a XUL attribute" function
|
// generic "retrieve the value of a XUL attribute" function
|
||||||
|
|
@ -53,11 +47,9 @@ void GetAttribute(nsIXULWindow *inWindow, const nsAString &inAttribute,
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDocShell> shell;
|
nsCOMPtr<nsIDocShell> shell;
|
||||||
if (inWindow && NS_SUCCEEDED(inWindow->GetDocShell(getter_AddRefs(shell)))) {
|
if (inWindow && NS_SUCCEEDED(inWindow->GetDocShell(getter_AddRefs(shell)))) {
|
||||||
nsCOMPtr<nsIDOMNode> node(GetDOMNodeFromDocShell(shell));
|
RefPtr<Element> webshellElement = GetElementFromDocShell(shell);
|
||||||
if (node) {
|
if (webshellElement) {
|
||||||
nsCOMPtr<Element> webshellElement(do_QueryInterface(node));
|
webshellElement->GetAttribute(inAttribute, outValue);
|
||||||
if (webshellElement)
|
|
||||||
webshellElement->GetAttribute(inAttribute, outValue);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
#include "nsIWindowMediator.h"
|
#include "nsIWindowMediator.h"
|
||||||
#include "nsIDOMChromeWindow.h"
|
#include "nsIDOMChromeWindow.h"
|
||||||
#include "nsIDOMNode.h"
|
|
||||||
#include "nsIXULBrowserWindow.h"
|
#include "nsIXULBrowserWindow.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
|
|
||||||
// Interfaces needed to be included
|
// Interfaces needed to be included
|
||||||
#include "nsIDOMNode.h"
|
|
||||||
#include "nsIDOMWindow.h"
|
#include "nsIDOMWindow.h"
|
||||||
#include "nsIDOMChromeWindow.h"
|
#include "nsIDOMChromeWindow.h"
|
||||||
#include "nsIBrowserDOMWindow.h"
|
#include "nsIBrowserDOMWindow.h"
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@
|
||||||
#include "nsIWebProgressListener.h"
|
#include "nsIWebProgressListener.h"
|
||||||
|
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIDOMNode.h"
|
|
||||||
#include "nsIDocumentLoaderFactory.h"
|
#include "nsIDocumentLoaderFactory.h"
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue