mshtml: Add IHTMLSelectElement::form property implementation.
This commit is contained in:
parent
f7b9dd9525
commit
a15751ab73
|
@ -371,8 +371,43 @@ static HRESULT WINAPI HTMLSelectElement_get_disabled(IHTMLSelectElement *iface,
|
|||
static HRESULT WINAPI HTMLSelectElement_get_form(IHTMLSelectElement *iface, IHTMLFormElement **p)
|
||||
{
|
||||
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
nsIDOMHTMLFormElement *nsform;
|
||||
nsIDOMNode *form_node;
|
||||
HTMLDOMNode *node;
|
||||
HRESULT hres;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(!p)
|
||||
return E_POINTER;
|
||||
|
||||
nsres = nsIDOMHTMLSelectElement_GetForm(This->nsselect, &nsform);
|
||||
FIXME("get form %08x : %p\n", nsres, nsform);
|
||||
if (NS_FAILED(nsres)) {
|
||||
ERR("GetForm failed: %08x, nsform: %p\n", nsres, nsform);
|
||||
*p = NULL;
|
||||
return E_FAIL;
|
||||
}
|
||||
if (nsform == NULL) {
|
||||
TRACE("nsform not found\n");
|
||||
*p = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
nsres = nsIDOMHTMLFormElement_QueryInterface(nsform, &IID_nsIDOMNode, (void**)&form_node);
|
||||
nsIDOMHTMLFormElement_Release(nsform);
|
||||
assert(nsres == NS_OK);
|
||||
|
||||
hres = get_node(This->element.node.doc, form_node, TRUE, &node);
|
||||
nsIDOMNode_Release(form_node);
|
||||
if (FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
|
||||
|
||||
node_release(node);
|
||||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLSelectElement_add(IHTMLSelectElement *iface, IHTMLElement *element,
|
||||
|
|
|
@ -4313,6 +4313,40 @@ static void test_form_target(IUnknown *unk)
|
|||
IHTMLFormElement_Release(form);
|
||||
}
|
||||
|
||||
static void test_select_form(IUnknown *uselect, IUnknown *uform)
|
||||
{
|
||||
IHTMLSelectElement *select = get_select_iface(uselect);
|
||||
IHTMLFormElement *form;
|
||||
HRESULT hres;
|
||||
|
||||
hres = IHTMLSelectElement_get_form(select, NULL);
|
||||
ok(hres == E_POINTER, "got %08x\n, expected E_POINTER\n", hres);
|
||||
|
||||
hres = IHTMLSelectElement_get_form(select, &form);
|
||||
ok(hres == S_OK, "get_form failed: %08x\n", hres);
|
||||
ok(form != NULL, "form == NULL\n");
|
||||
|
||||
test_form_length((IUnknown*)form, 1);
|
||||
test_form_elements((IUnknown*)form);
|
||||
test_form_name((IUnknown*)form, "form_name");
|
||||
|
||||
ok(iface_cmp(uform, (IUnknown*)form), "Expected %p, got %p\n", uform, form);
|
||||
|
||||
IHTMLSelectElement_Release(select);
|
||||
IHTMLFormElement_Release(form);
|
||||
}
|
||||
|
||||
static void test_select_form_notfound(IHTMLSelectElement *select)
|
||||
{
|
||||
IHTMLFormElement *form;
|
||||
HRESULT hres;
|
||||
|
||||
form = (IHTMLFormElement*)0xdeadbeef;
|
||||
hres = IHTMLSelectElement_get_form(select, &form);
|
||||
ok(hres == S_OK, "get_form failed: %08x\n", hres);
|
||||
ok(form == NULL, "got %p\n", form);
|
||||
}
|
||||
|
||||
#define test_meta_name(a,b) _test_meta_name(__LINE__,a,b)
|
||||
static void _test_meta_name(unsigned line, IUnknown *unk, const char *exname)
|
||||
{
|
||||
|
@ -4948,6 +4982,7 @@ static void test_select_elem(IHTMLSelectElement *select)
|
|||
test_select_name(select, NULL);
|
||||
test_select_set_name(select, "select-name");
|
||||
test_select_name(select, "select-name");
|
||||
test_select_form_notfound(select);
|
||||
|
||||
test_select_get_disabled(select, VARIANT_FALSE);
|
||||
test_select_set_disabled(select, VARIANT_TRUE);
|
||||
|
@ -8491,6 +8526,16 @@ static void test_elems2(IHTMLDocument2 *doc)
|
|||
IHTMLElement_Release(elem);
|
||||
}
|
||||
|
||||
test_elem_set_innerhtml((IUnknown*)div,
|
||||
"<form id=\"form\" name=\"form_name\"><select id=\"sform\"></select></form>");
|
||||
elem = get_elem_by_id(doc, "sform", TRUE);
|
||||
elem2 = get_elem_by_id(doc, "form", TRUE);
|
||||
if(elem && elem2) {
|
||||
test_select_form((IUnknown*)elem, (IUnknown*)elem2);
|
||||
IHTMLElement_Release(elem);
|
||||
IHTMLElement_Release(elem2);
|
||||
}
|
||||
|
||||
test_attr(div);
|
||||
test_blocked(doc, div);
|
||||
test_elem_names(doc);
|
||||
|
|
Loading…
Reference in New Issue