Module: wine Branch: master Commit: 1918d7223e8e093e936f09182399e8001a70b686 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1918d7223e8e093e936f091823...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Feb 14 11:20:14 2014 +0100
mshtml: Added IHTMLDocument2::get_activeElement implementation.
---
dlls/mshtml/htmldoc.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index a4a0fd7..a710d8e 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -186,8 +186,35 @@ static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement static HRESULT WINAPI HTMLDocument_get_activeElement(IHTMLDocument2 *iface, IHTMLElement **p) { HTMLDocument *This = impl_from_IHTMLDocument2(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsIDOMElement *nselem; + HTMLElement *elem; + nsresult nsres; + HRESULT hres; + + TRACE("(%p)->(%p)\n", This, p); + + if(!This->doc_node->nsdoc) { + *p = NULL; + return S_OK; + } + + /* + * NOTE: Gecko may return an active element even if the document is not visible. + * IE returns NULL in this case. + */ + nsres = nsIDOMHTMLDocument_GetActiveElement(This->doc_node->nsdoc, &nselem); + if(NS_FAILED(nsres)) { + ERR("GetActiveElement failed: %08x\n", nsres); + return E_FAIL; + } + + hres = get_elem(This->doc_node, nselem, &elem); + nsIDOMElement_Release(nselem); + if(FAILED(hres)) + return hres; + + *p = &elem->IHTMLElement_iface; + return S_OK; }
static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElementCollection **p)