mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1455676 part 11. Remove use of nsIDOMNode from xpfe/. r=qdot
This commit is contained in:
parent
931b9e37ad
commit
5fa76e716f
@ -23,28 +23,22 @@ using mozilla::dom::Element;
|
||||
// static helper functions
|
||||
//
|
||||
|
||||
static nsCOMPtr<nsIDOMNode> GetDOMNodeFromDocShell(nsIDocShell *aShell);
|
||||
static void GetAttribute(nsIXULWindow *inWindow, const nsAString &inAttribute,
|
||||
nsAString &outValue);
|
||||
static void GetWindowType(nsIXULWindow* inWindow, nsString &outType);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> GetDOMNodeFromDocShell(nsIDocShell *aShell)
|
||||
static Element* GetElementFromDocShell(nsIDocShell *aShell)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
aShell->GetContentViewer(getter_AddRefs(cv));
|
||||
if (cv) {
|
||||
nsCOMPtr<nsIDocument> 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<nsIDocShell> shell;
|
||||
if (inWindow && NS_SUCCEEDED(inWindow->GetDocShell(getter_AddRefs(shell)))) {
|
||||
nsCOMPtr<nsIDOMNode> node(GetDOMNodeFromDocShell(shell));
|
||||
if (node) {
|
||||
nsCOMPtr<Element> webshellElement(do_QueryInterface(node));
|
||||
if (webshellElement)
|
||||
webshellElement->GetAttribute(inAttribute, outValue);
|
||||
RefPtr<Element> webshellElement = GetElementFromDocShell(shell);
|
||||
if (webshellElement) {
|
||||
webshellElement->GetAttribute(inAttribute, outValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIWindowMediator.h"
|
||||
#include "nsIDOMChromeWindow.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIXULBrowserWindow.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
// Interfaces needed to be included
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMChromeWindow.h"
|
||||
#include "nsIBrowserDOMWindow.h"
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "nsIWebProgressListener.h"
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDocumentLoaderFactory.h"
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user