diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 25bb78004d8..52035cc3f0e 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -204,8 +204,47 @@ static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCo 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 e77090b0e74..21b456e6f84 100644 --- a/dlls/mshtml/nsiface.idl +++ b/dlls/mshtml/nsiface.idl @@ -107,6 +107,7 @@ typedef nsISupports nsIDOMProcessingInstruction; typedef nsISupports nsIDOMEntityReference; typedef nsISupports nsIDOMHTMLFormElement; typedef nsISupports nsIDOMHTMLOptionsCollection; +typedef nsISupports nsIDOMHTMLCollection; [ object, @@ -473,6 +474,33 @@ interface nsIDOMDocument : nsIDOMNode nsresult GetElementById(const nsAString *elementId, nsIDOMElement **_retval); } +[ + 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)