Commit c1afef34 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLElement::get_isTextEdit implementation.

parent 278daad3
......@@ -833,6 +833,11 @@ static event_target_t **HTMLBodyElement_get_event_target(HTMLDOMNode *iface)
: &This->textcont.element.node.event_target;
}
static BOOL HTMLBodyElement_is_text_edit(HTMLDOMNode *iface)
{
return TRUE;
}
static const cpc_entry_t HTMLBodyElement_cpc[] = {
{&DIID_HTMLTextContainerEvents},
{&IID_IPropertyNotifySink},
......@@ -857,7 +862,8 @@ static const NodeImplVtbl HTMLBodyElementImplVtbl = {
NULL,
NULL,
HTMLBodyElement_traverse,
HTMLBodyElement_unlink
HTMLBodyElement_unlink,
HTMLBodyElement_is_text_edit
};
static const tid_t HTMLBodyElement_iface_tids[] = {
......
......@@ -1665,8 +1665,12 @@ static HRESULT WINAPI HTMLElement_get_parentTextEdit(IHTMLElement *iface, IHTMLE
static HRESULT WINAPI HTMLElement_get_isTextEdit(IHTMLElement *iface, VARIANT_BOOL *p)
{
HTMLElement *This = impl_from_IHTMLElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
*p = This->node.vtbl->is_text_edit && This->node.vtbl->is_text_edit(&This->node)
? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
}
static HRESULT WINAPI HTMLElement_click(IHTMLElement *iface)
......
......@@ -1260,6 +1260,32 @@ static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOO
return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
}
static BOOL HTMLInputElement_is_text_edit(HTMLDOMNode *iface)
{
HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
const PRUnichar *type;
nsAString nsstr;
nsresult nsres;
BOOL ret = FALSE;
static const WCHAR buttonW[] = {'b','u','t','t','o','n',0};
static const WCHAR hiddenW[] = {'h','i','d','d','e','n',0};
static const WCHAR passwordW[] = {'p','a','s','s','w','o','r','d',0};
static const WCHAR resetW[] = {'r','e','s','e','t',0};
static const WCHAR submitW[] = {'s','u','b','m','i','t',0};
static const WCHAR textW[] = {'t','e','x','t',0};
nsAString_Init(&nsstr, NULL);
nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &nsstr);
if(NS_SUCCEEDED(nsres)) {
nsAString_GetData(&nsstr, &type);
ret = !strcmpW(type, buttonW) || !strcmpW(type, hiddenW) || !strcmpW(type, passwordW)
|| !strcmpW(type, resetW) || !strcmpW(type, submitW) || !strcmpW(type, textW);
}
nsAString_Finish(&nsstr);
return ret;
}
static void HTMLInputElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
{
HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
......@@ -1297,7 +1323,8 @@ static const NodeImplVtbl HTMLInputElementImplVtbl = {
NULL,
NULL,
HTMLInputElement_traverse,
HTMLInputElement_unlink
HTMLInputElement_unlink,
HTMLInputElement_is_text_edit
};
static const tid_t HTMLInputElement_iface_tids[] = {
......@@ -1764,6 +1791,11 @@ static HRESULT HTMLButtonElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BO
return IHTMLButtonElement_get_disabled(&This->IHTMLButtonElement_iface, p);
}
static BOOL HTMLButtonElement_is_text_edit(HTMLDOMNode *iface)
{
return TRUE;
}
static void HTMLButtonElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
{
HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
......@@ -1801,7 +1833,8 @@ static const NodeImplVtbl HTMLButtonElementImplVtbl = {
NULL,
NULL,
HTMLButtonElement_traverse,
HTMLButtonElement_unlink
HTMLButtonElement_unlink,
HTMLButtonElement_is_text_edit
};
static const tid_t HTMLButtonElement_iface_tids[] = {
......
......@@ -437,6 +437,11 @@ static HRESULT HTMLTextAreaElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_
return IHTMLTextAreaElement_get_disabled(&This->IHTMLTextAreaElement_iface, p);
}
static BOOL HTMLTextAreaElement_is_text_edit(HTMLDOMNode *iface)
{
return TRUE;
}
static void HTMLTextAreaElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
{
HTMLTextAreaElement *This = impl_from_HTMLDOMNode(iface);
......@@ -474,7 +479,8 @@ static const NodeImplVtbl HTMLTextAreaElementImplVtbl = {
NULL,
NULL,
HTMLTextAreaElement_traverse,
HTMLTextAreaElement_unlink
HTMLTextAreaElement_unlink,
HTMLTextAreaElement_is_text_edit
};
static const tid_t HTMLTextAreaElement_iface_tids[] = {
......
......@@ -646,6 +646,7 @@ typedef struct {
HRESULT (*bind_to_tree)(HTMLDOMNode*);
void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
void (*unlink)(HTMLDOMNode*);
BOOL (*is_text_edit)(HTMLDOMNode*);
} NodeImplVtbl;
struct HTMLDOMNode {
......
......@@ -2538,6 +2538,18 @@ static void _test_elem_contains(unsigned line, IHTMLElement *elem, IHTMLElement
ok_(__FILE__,line)(b == exval, "contains returned %x, expected %x\n", b, exval);
}
#define test_elem_istextedit(a,b) _test_elem_istextedit(__LINE__,a,b)
static void _test_elem_istextedit(unsigned line, IHTMLElement *elem, VARIANT_BOOL exval)
{
VARIANT_BOOL b;
HRESULT hres;
b = 100;
hres = IHTMLElement_get_isTextEdit(elem, &b);
ok_(__FILE__,line)(hres == S_OK, "isTextEdit failed: %08x\n", hres);
ok_(__FILE__,line)(b == exval, "isTextEdit = %x\n", b);
}
#define get_first_child(n) _get_first_child(__LINE__,n)
static IHTMLDOMNode *_get_first_child(unsigned line, IUnknown *unk)
{
......@@ -6122,6 +6134,8 @@ static void test_defaults(IHTMLDocument2 *doc)
test_body_funs(body);
IHTMLBodyElement_Release(body);
test_elem_istextedit(elem, VARIANT_TRUE);
hres = IHTMLElement_get_style(elem, &style);
ok(hres == S_OK, "get_style failed: %08x\n", hres);
......@@ -6264,6 +6278,8 @@ static void test_button_elem(IHTMLElement *elem)
{
test_button_name(elem, NULL);
set_button_name(elem, "button name");
test_elem_istextedit(elem, VARIANT_TRUE);
}
#define test_tr_possess(e,r,l,i) _test_tr_possess(__LINE__,e,r,l,i)
......@@ -7351,6 +7367,7 @@ static void test_elems(IHTMLDocument2 *doc)
test_plugins_col(doc);
elem = get_doc_elem(doc);
test_elem_istextedit(elem, VARIANT_FALSE);
test_elem_all((IUnknown*)elem, all_types+1, sizeof(all_types)/sizeof(all_types[0])-1);
IHTMLElement_Release(elem);
......@@ -7370,6 +7387,7 @@ static void test_elems(IHTMLDocument2 *doc)
test_elem_tabindex((IUnknown*)elem, 0);
test_elem_set_tabindex((IUnknown*)elem, 1);
test_elem_filters((IUnknown*)elem);
test_elem_istextedit(elem, VARIANT_FALSE);
node = test_node_get_parent((IUnknown*)elem);
ok(node != NULL, "node == NULL\n");
......@@ -7430,6 +7448,7 @@ static void test_elems(IHTMLDocument2 *doc)
test_select_elem(select);
test_elem_istextedit(elem, VARIANT_FALSE);
test_elem_title((IUnknown*)select, NULL);
test_elem_set_title((IUnknown*)select, "Title");
test_elem_title((IUnknown*)select, "Title");
......@@ -7467,6 +7486,7 @@ static void test_elems(IHTMLDocument2 *doc)
ok(hres == S_OK, "Could not get IHTMLScriptElement interface: %08x\n", hres);
test_elem_language(elem, NULL);
test_elem_istextedit(elem, VARIANT_FALSE);
if(hres == S_OK)
{
......@@ -7530,6 +7550,7 @@ static void test_elems(IHTMLDocument2 *doc)
test_input_get_disabled(input, VARIANT_FALSE);
test_elem_client_size((IUnknown*)elem);
test_input_type(input, "text");
test_elem_istextedit(elem, VARIANT_TRUE);
test_node_get_value_str((IUnknown*)elem, NULL);
test_node_put_value_str((IUnknown*)elem, "test");
......@@ -8122,6 +8143,8 @@ static void test_elems2(IHTMLDocument2 *doc)
form = get_textarea_form((IUnknown*)elem);
ok(!form, "form = %p\n", form);
test_elem_istextedit(elem, VARIANT_TRUE);
IHTMLElement_Release(elem);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment