зеркало из https://github.com/mozilla/gecko-dev.git
Adding api to get DOM document interface through web widget.
This commit is contained in:
Родитель
92cfe5b226
Коммит
ba397d6ed5
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "nsweb.h"
|
||||
#include "nsIDocumentWidget.h"
|
||||
class nsIDOMDocument;
|
||||
class nsILinkHandler;
|
||||
class nsIPresContext;
|
||||
class nsIStyleSet;
|
||||
|
@ -72,8 +73,11 @@ public:
|
|||
|
||||
virtual PRBool GetShowFrameBorders() = 0;
|
||||
|
||||
virtual nsresult GetScriptContext(nsIScriptContext **aContext) = 0;
|
||||
virtual nsresult ReleaseScriptContext() = 0;
|
||||
NS_IMETHOD GetScriptContext(nsIScriptContext **aContext) = 0;
|
||||
|
||||
NS_IMETHOD GetDOMDocument(nsIDOMDocument** aDocument) = 0;
|
||||
|
||||
NS_IMETHOD ReleaseScriptContext() = 0;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsICSSParser.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
||||
#include "prprf.h"
|
||||
#include "prtime.h"
|
||||
|
@ -93,8 +94,9 @@ public:
|
|||
virtual void ShowFrameBorders(PRBool aEnable);
|
||||
virtual PRBool GetShowFrameBorders();
|
||||
virtual nsIWidget* GetWWWindow();
|
||||
virtual nsresult GetScriptContext(nsIScriptContext **aContext);
|
||||
virtual nsresult ReleaseScriptContext();
|
||||
NS_IMETHOD GetScriptContext(nsIScriptContext **aContext);
|
||||
NS_IMETHOD GetDOMDocument(nsIDOMDocument** aDocument);
|
||||
NS_IMETHOD ReleaseScriptContext();
|
||||
|
||||
NS_IMETHOD GetScriptObject(JSContext *aContext, void** aScriptObject);
|
||||
NS_IMETHOD ResetScriptObject();
|
||||
|
@ -703,6 +705,21 @@ nsresult WebWidgetImpl::GetScriptContext(nsIScriptContext **aContext)
|
|||
return res;
|
||||
}
|
||||
|
||||
nsresult WebWidgetImpl::GetDOMDocument(nsIDOMDocument** aDocument)
|
||||
{
|
||||
nsIDocument *doc = GetDocument();
|
||||
*aDocument = nsnull;
|
||||
|
||||
static NS_DEFINE_IID(kIDOMDocumentIID, NS_IDOMDOCUMENT_IID);
|
||||
|
||||
if (doc != nsnull) {
|
||||
return doc->QueryInterface(kIDOMDocumentIID, (void**)aDocument);
|
||||
NS_RELEASE(doc);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult WebWidgetImpl::ResetScriptObject()
|
||||
{
|
||||
mScriptObject = nsnull;
|
||||
|
|
Загрузка…
Ссылка в новой задаче