[PATCH] Implment IHTMLDocument2 elementFromPoint

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Sun Jul 17 23:08:14 CDT 2011


---
 dlls/mshtml/htmldoc.c |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 5ba48cd..9ee8c5c 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -1294,11 +1294,41 @@ static HRESULT WINAPI HTMLDocument_get_onselectstart(IHTMLDocument2 *iface, VARI
 }
 
 static HRESULT WINAPI HTMLDocument_elementFromPoint(IHTMLDocument2 *iface, LONG x, LONG y,
-                                                        IHTMLElement **elementHit)
+                                                        IHTMLElement **p)
 {
     HTMLDocument *This = impl_from_IHTMLDocument2(iface);
-    FIXME("(%p)->(%d %d %p)\n", This, x, y, elementHit);
-    return E_NOTIMPL;
+	nsIDOMElement *nselem = NULL;
+	nsresult nsres;
+	HRESULT hres;
+	HTMLDOMNode *node;
+	nsIDOMNSDocument *pNSDoc;
+	
+    TRACE("(%p)->(%d %d %p)\n", This, x, y, p);
+
+	nsres = nsIDOMHTMLDocument_QueryInterface(This->doc_node->nsdoc, &IID_nsIDOMNSDocument, (void**)&pNSDoc);
+	if(NS_FAILED(nsres)) {
+        ERR("GetDocumentElement failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+	
+	nsres = nsIDOMNSDocument_ElementFromPoint(pNSDoc, x, y, (nsIDOMElement **)&nselem);
+	nsIDOMNSDocument_Release(pNSDoc);
+    if(NS_FAILED(nsres)) {
+        ERR("GetDocumentElement failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+	if(!nselem) {
+        *p = NULL;
+        return S_OK;
+    }
+
+    hres = get_node(This->doc_node, (nsIDOMNode*)nselem, TRUE, &node);
+	nsIDOMElement_Release(nselem);
+    if(FAILED(hres))
+        return hres;
+    
+	return IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
 }
 
 static HRESULT WINAPI HTMLDocument_get_parentWindow(IHTMLDocument2 *iface, IHTMLWindow2 **p)
-- 
1.7.4.1


--------------070209010607000709030401--



More information about the wine-patches mailing list