mshtml: Add IHTMLRectCollection::item implementation.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cbb70ff041
commit
4633304cde
|
@ -671,8 +671,34 @@ static HRESULT WINAPI HTMLRectCollection_get__newEnum(IHTMLRectCollection *iface
|
|||
static HRESULT WINAPI HTMLRectCollection_item(IHTMLRectCollection *iface, VARIANT *index, VARIANT *result)
|
||||
{
|
||||
HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
|
||||
FIXME("(%p)->(%s %p)\n", This, debugstr_variant(index), result);
|
||||
return E_NOTIMPL;
|
||||
nsIDOMClientRect *nsrect;
|
||||
IHTMLRect *rect;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%s %p)\n", This, debugstr_variant(index), result);
|
||||
|
||||
if(V_VT(index) != VT_I4 || V_I4(index) < 0) {
|
||||
FIXME("Unsupported for %s index\n", debugstr_variant(index));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
nsres = nsIDOMClientRectList_Item(This->rect_list, V_I4(index), &nsrect);
|
||||
if(NS_FAILED(nsres))
|
||||
return map_nsresult(nsres);
|
||||
if(!nsrect) {
|
||||
V_VT(result) = VT_NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
hres = create_html_rect(nsrect, &rect);
|
||||
nsIDOMClientRect_Release(nsrect);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
V_VT(result) = VT_DISPATCH;
|
||||
V_DISPATCH(result) = (IDispatch *)rect;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IHTMLRectCollectionVtbl HTMLRectCollectionVtbl = {
|
||||
|
|
|
@ -5144,6 +5144,7 @@ static void test_elem_bounding_client_rect(IUnknown *unk)
|
|||
IHTMLRectCollection *rects;
|
||||
IHTMLRect *rect, *rect2;
|
||||
IHTMLElement2 *elem2;
|
||||
VARIANT v, index;
|
||||
LONG l;
|
||||
HRESULT hres;
|
||||
|
||||
|
@ -5185,6 +5186,19 @@ static void test_elem_bounding_client_rect(IUnknown *unk)
|
|||
|
||||
test_disp((IUnknown*)rects, &IID_IHTMLRectCollection, NULL, L"[object]");
|
||||
|
||||
hres = IHTMLRectCollection_get_length(rects, &l);
|
||||
ok(hres == S_OK, "get_length failed: %08x\n", hres);
|
||||
ok(l == 1, "length = %u\n", l);
|
||||
|
||||
V_VT(&index) = VT_I4;
|
||||
V_I4(&index) = 0;
|
||||
V_VT(&v) = VT_ERROR;
|
||||
hres = IHTMLRectCollection_item(rects, &index, &v);
|
||||
ok(hres == S_OK, "item failed: %08x\n", hres);
|
||||
ok(V_VT(&v) == VT_DISPATCH, "V_VT(v) = %d\n", V_VT(&v));
|
||||
test_disp((IUnknown*)V_DISPATCH(&v), &IID_IHTMLRect, NULL, L"[object]");
|
||||
VariantClear(&v);
|
||||
|
||||
IHTMLRectCollection_Release(rects);
|
||||
IHTMLElement2_Release(elem2);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue