Module: wine Branch: master Commit: 7b52ece404dacae83a19235f3c981d4e0bef50fd URL: https://source.winehq.org/git/wine.git/?a=commit;h=7b52ece404dacae83a19235f3...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Mar 29 13:21:55 2021 +0200
mshtml: Implement IHTMLElement2::accessKey property on top of nsIDOMHTMLElement.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40821 Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/mshtml/htmlelem.c | 32 ++++++++++++++++++++++++-------- dlls/mshtml/tests/dom.js | 8 ++++++++ 2 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 16e200239f3..9e5d184ff3f 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -2790,22 +2790,38 @@ static HRESULT WINAPI HTMLElement2_focus(IHTMLElement2 *iface) static HRESULT WINAPI HTMLElement2_put_accessKey(IHTMLElement2 *iface, BSTR v) { HTMLElement *This = impl_from_IHTMLElement2(iface); - VARIANT var; - - static WCHAR accessKeyW[] = L"accessKey"; + nsAString nsstr; + nsresult nsres;
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- V_VT(&var) = VT_BSTR; - V_BSTR(&var) = v; - return IHTMLElement_setAttribute(&This->IHTMLElement_iface, accessKeyW, var, 0); + if(!This->html_element) { + FIXME("non-HTML element\n"); + return E_NOTIMPL; + } + + nsAString_InitDepend(&nsstr, v); + nsres = nsIDOMHTMLElement_SetAccessKey(This->html_element, &nsstr); + nsAString_Finish(&nsstr); + return map_nsresult(nsres); }
static HRESULT WINAPI HTMLElement2_get_accessKey(IHTMLElement2 *iface, BSTR *p) { HTMLElement *This = impl_from_IHTMLElement2(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsAString nsstr; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + if(!This->html_element) { + FIXME("non-HTML element\n"); + return E_NOTIMPL; + } + + nsAString_InitDepend(&nsstr, NULL); + nsres = nsIDOMHTMLElement_GetAccessKey(This->html_element, &nsstr); + return return_nsstr(nsres, &nsstr, p); }
static HRESULT WINAPI HTMLElement2_put_onblur(IHTMLElement2 *iface, VARIANT v) diff --git a/dlls/mshtml/tests/dom.js b/dlls/mshtml/tests/dom.js index a18ce409a9b..4db743241a0 100644 --- a/dlls/mshtml/tests/dom.js +++ b/dlls/mshtml/tests/dom.js @@ -425,3 +425,11 @@ sync_test("navigator", function() { v.testProp = true; ok(window.navigator.testProp, "window.navigator.testProp = " + window.navigator.testProp); }); + +sync_test("elem_props", function() { + var elem = document.body; + + ok(elem.accessKey === "", "accessKey = " + elem.accessKey); + elem.accessKey = "q"; + ok(elem.accessKey === "q", "accessKey = " + elem.accessKey + " expected q"); +});