Jacek Caban : mshtml: Added get_body implementation.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri May 5 12:10:29 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 77bb544c51ee3fcdaec4b73db9be82f7d9cbd21e
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=77bb544c51ee3fcdaec4b73db9be82f7d9cbd21e
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Apr 28 19:58:38 2006 +0200
mshtml: Added get_body implementation.
---
dlls/mshtml/htmldoc.c | 43 +++++++++++++++++++++++++++++++++++++++++--
dlls/mshtml/nsiface.idl | 28 ++++++++++++++++++++++++++++
2 files changed, 69 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 25bb780..52035cc 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -204,8 +204,47 @@ static HRESULT WINAPI HTMLDocument_get_a
static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement **p)
{
- FIXME("(%p)->(%p)\n", iface, p);
- return E_NOTIMPL;
+ HTMLDocument *This = HTMLDOC_THIS(iface);
+ nsIDOMDocument *nsdoc;
+ nsIDOMHTMLDocument *nshtmldoc;
+ nsIDOMHTMLElement *nsbody = NULL;
+ HTMLDOMNode *node;
+ nsresult nsres;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ *p = NULL;
+
+ if(!This->nscontainer)
+ return S_OK;
+
+ nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
+ if(NS_FAILED(nsres)) {
+ ERR("GetDocument failed: %08lx\n", nsres);
+ return S_OK;
+ }
+
+ if(NS_FAILED(nsres) || !nsdoc)
+ return S_OK;
+
+ nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&nshtmldoc);
+ nsIDOMDocument_Release(nsdoc);
+
+ nsres = nsIDOMHTMLDocument_GetBody(nshtmldoc, &nsbody);
+ nsIDOMHTMLDocument_Release(nshtmldoc);
+
+ if(NS_FAILED(nsres) || !nsbody) {
+ TRACE("Could not get body: %08lx\n", nsres);
+ return S_OK;
+ }
+
+ node = get_node(This, (nsIDOMNode*)nsbody);
+ nsIDOMHTMLElement_Release(nsbody);
+
+ IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p);
+
+ TRACE("*p = %p\n", *p);
+ return S_OK;
}
static HRESULT WINAPI HTMLDocument_get_activeElement(IHTMLDocument2 *iface, IHTMLElement **p)
diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl
index e77090b..21b456e 100644
--- a/dlls/mshtml/nsiface.idl
+++ b/dlls/mshtml/nsiface.idl
@@ -107,6 +107,7 @@ typedef nsISupports nsIDOMProcessingInst
typedef nsISupports nsIDOMEntityReference;
typedef nsISupports nsIDOMHTMLFormElement;
typedef nsISupports nsIDOMHTMLOptionsCollection;
+typedef nsISupports nsIDOMHTMLCollection;
[
object,
@@ -475,6 +476,33 @@ interface nsIDOMDocument : nsIDOMNode
[
object,
+ uuid(a6cf9084-15b3-11d2-932e-00805f8add32)
+]
+interface nsIDOMHTMLDocument : nsIDOMDocument
+{
+ nsresult GetTitle(nsAString *aTitle);
+ nsresult SetTitle(const nsAString *aTitle);
+ nsresult GetReferrer(nsAString *aReferrer);
+ nsresult GetDomain(nsAString *aDomain);
+ nsresult GetURL(nsAString *aURL);
+ nsresult GetBody(nsIDOMHTMLElement **aBody);
+ nsresult SetBody(nsIDOMHTMLElement *aBody);
+ nsresult GetImages(nsIDOMHTMLCollection **aImages);
+ nsresult GetApplets(nsIDOMHTMLCollection **aApplets);
+ nsresult GetLinks(nsIDOMHTMLCollection **aLinks);
+ nsresult GetForms(nsIDOMHTMLCollection **aForms);
+ nsresult GetAnchors(nsIDOMHTMLCollection **aAnchors);
+ nsresult GetCookie(nsAString *aCookie);
+ nsresult SetCookie(const nsAString *aCookie);
+ nsresult Open(void);
+ nsresult Close(void);
+ nsresult Write(const nsAString *text);
+ nsresult Writeln(const nsAString *text);
+ nsresult GetElementsByName(const nsAString *elementName, nsIDOMNodeList **_retval);
+}
+
+[
+ object,
uuid(a6cf906b-15b3-11d2-932e-00805f8add32)
]
interface nsIDOMWindow : nsISupports
More information about the wine-cvs
mailing list