From: Esme Povirk esme@codeweavers.com
--- dlls/comctl32/syslink.c | 42 +++++++++++++++++++++++++++++++++-- dlls/comctl32/tests/syslink.c | 6 ++--- 2 files changed, 43 insertions(+), 5 deletions(-)
diff --git a/dlls/comctl32/syslink.c b/dlls/comctl32/syslink.c index 77e16285287..7d2ed8674b8 100644 --- a/dlls/comctl32/syslink.c +++ b/dlls/comctl32/syslink.c @@ -432,8 +432,46 @@ static HRESULT WINAPI Accessible_accSelect(IAccessible *iface, LONG flags, VARIA
static HRESULT WINAPI Accessible_accLocation(IAccessible *iface, LONG *left, LONG *top, LONG *width, LONG *height, VARIANT childid) { - FIXME("%p\n", iface); - return E_NOTIMPL; + SYSLINK_ACC *This = impl_from_IAccessible(iface); + HRESULT hr; + DOC_ITEM* item; + RECT rc = {0}; + POINT point; + + TRACE("%p, %s\n", iface, debugstr_variant(&childid)); + + hr = Accessible_FindChild(This, childid, &item); + if (FAILED(hr)) + return hr; + + if (item) + { + int n = item->nText; + PDOC_TEXTBLOCK block = item->Blocks; + + while (n > 0) + { + UnionRect(&rc, &rc, &block->rc); + n -= block->nChars + block->nSkip; + block++; + } + } + else + { + GetClientRect(This->infoPtr->Self, &rc); + } + + point.x = rc.left; + point.y = rc.top; + MapWindowPoints(This->infoPtr->Self, NULL, &point, 1); + *left = point.x; + *top = point.y; + *width = rc.right - rc.left; + *height = rc.bottom - rc.top; + + TRACE("<-- (%li,%li,%li,%li)\n", *left, *top, *width, *height); + + return S_OK; }
static HRESULT WINAPI Accessible_accNavigate(IAccessible *iface, LONG dir, VARIANT start, VARIANT *end) diff --git a/dlls/comctl32/tests/syslink.c b/dlls/comctl32/tests/syslink.c index 91954096382..5eca972aa6d 100644 --- a/dlls/comctl32/tests/syslink.c +++ b/dlls/comctl32/tests/syslink.c @@ -335,10 +335,10 @@ static void test_msaa(void) if (SUCCEEDED(hr)) ok(!name, "unexpected default action %s\n", debugstr_w(name));
-todo_wine { hr = IAccessible_accLocation(acc, &left, &top, &width, &height, varChild); ok(hr == S_OK, "accLocation failed, hr=%lx\n", hr);
+todo_wine { hr = IAccessible_get_accChildCount(acc, &count); ok(hr == S_OK, "accChildCount failed, hr=%lx\n", hr); ok(count == 2, "accChildCount returned %li\n", count); @@ -385,10 +385,10 @@ todo_wine { SysFreeString(name); }
-todo_wine { hr = IAccessible_accLocation(acc, &left, &top, &width, &height, varChild); ok(hr == S_OK, "accLocation failed, hr=%lx\n", hr);
+todo_wine { /* child 2 */ V_I4(&varChild) = 2; hr = IAccessible_get_accChild(acc, varChild, &child); @@ -431,10 +431,10 @@ todo_wine { SysFreeString(name); }
-todo_wine { hr = IAccessible_accLocation(acc, &left, &top, &width, &height, varChild); ok(hr == S_OK, "accLocation failed, hr=%lx\n", hr);
+todo_wine { hr = IAccessible_QueryInterface(acc, &IID_IOleWindow, (void**)&ole_window); ok(hr == S_OK, "QueryInterface failed, hr=%lx\n", hr); }