mshtml: Forward IHTMLelement3::[get|put]_disabled to child object if possible.

This commit is contained in:
Jacek Caban 2008-10-09 15:26:41 -05:00 committed by Alexandre Julliard
parent 27eb80cc3a
commit cd345c10ba
6 changed files with 105 additions and 7 deletions

View File

@ -205,15 +205,26 @@ static HRESULT WINAPI HTMLElement3_get_hideFocus(IHTMLElement3 *iface, VARIANT_B
static HRESULT WINAPI HTMLElement3_put_disabled(IHTMLElement3 *iface, VARIANT_BOOL v)
{
HTMLElement *This = HTMLELEM3_THIS(iface);
FIXME("(%p)->(%x)\n", This, v);
return S_OK;
TRACE("(%p)->(%x)\n", This, v);
if(This->node.vtbl->put_disabled)
return This->node.vtbl->put_disabled(&This->node, v);
FIXME("No implementation for element\n");
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLElement3_get_disabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
{
HTMLElement *This = HTMLELEM3_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
TRACE("(%p)->(%p)\n", This, p);
if(This->node.vtbl->get_disabled)
return This->node.vtbl->get_disabled(&This->node, p);
FIXME("No implementation for element\n");
return E_NOTIMPL;
}

View File

@ -1064,11 +1064,25 @@ static void HTMLInputElement_destructor(HTMLDOMNode *iface)
HTMLElement_destructor(&This->element.node);
}
static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
{
HTMLInputElement *This = HTMLINPUT_NODE_THIS(iface);
return IHTMLInputElement_put_disabled(HTMLINPUT(This), v);
}
static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
{
HTMLInputElement *This = HTMLINPUT_NODE_THIS(iface);
return IHTMLInputElement_get_disabled(HTMLINPUT(This), p);
}
#undef HTMLINPUT_NODE_THIS
static const NodeImplVtbl HTMLInputElementImplVtbl = {
HTMLInputElement_QI,
HTMLInputElement_destructor
HTMLInputElement_destructor,
HTMLInputElementImpl_put_disabled,
HTMLInputElementImpl_get_disabled,
};
static const tid_t HTMLInputElement_iface_tids[] = {

View File

@ -442,11 +442,25 @@ static void HTMLSelectElement_destructor(HTMLDOMNode *iface)
HTMLElement_destructor(&This->element.node);
}
static HRESULT HTMLSelectElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
{
HTMLSelectElement *This = HTMLSELECT_NODE_THIS(iface);
return IHTMLSelectElement_put_disabled(HTMLSELECT(This), v);
}
static HRESULT HTMLSelectElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
{
HTMLSelectElement *This = HTMLSELECT_NODE_THIS(iface);
return IHTMLSelectElement_get_disabled(HTMLSELECT(This), p);
}
#undef HTMLSELECT_NODE_THIS
static const NodeImplVtbl HTMLSelectElementImplVtbl = {
HTMLSelectElement_QI,
HTMLSelectElement_destructor
HTMLSelectElement_destructor,
HTMLSelectElementImpl_put_disabled,
HTMLSelectElementImpl_get_disabled
};
static const tid_t HTMLSelectElement_tids[] = {

View File

@ -388,11 +388,25 @@ static void HTMLTextAreaElement_destructor(HTMLDOMNode *iface)
HTMLElement_destructor(&This->element.node);
}
static HRESULT HTMLTextAreaElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
{
HTMLTextAreaElement *This = HTMLTXTAREA_NODE_THIS(iface);
return IHTMLTextAreaElement_put_disabled(HTMLTXTAREA(This), v);
}
static HRESULT HTMLTextAreaElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
{
HTMLTextAreaElement *This = HTMLTXTAREA_NODE_THIS(iface);
return IHTMLTextAreaElement_get_disabled(HTMLTXTAREA(This), p);
}
#undef HTMLTXTAREA_NODE_THIS
static const NodeImplVtbl HTMLTextAreaElementImplVtbl = {
HTMLTextAreaElement_QI,
HTMLTextAreaElement_destructor
HTMLTextAreaElement_destructor,
HTMLTextAreaElementImpl_put_disabled,
HTMLTextAreaElementImpl_get_disabled
};
HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement *nselem)

View File

@ -361,6 +361,8 @@ typedef struct {
typedef struct {
HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
void (*destructor)(HTMLDOMNode*);
HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
} NodeImplVtbl;
struct HTMLDOMNode {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2007 Jacek Caban for CodeWeavers
* Copyright 2007-2008 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -471,6 +471,17 @@ static IHTMLElement2 *_get_elem2_iface(unsigned line, IUnknown *unk)
return elem;
}
#define get_elem3_iface(u) _get_elem3_iface(__LINE__,u)
static IHTMLElement3 *_get_elem3_iface(unsigned line, IUnknown *unk)
{
IHTMLElement3 *elem;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement3, (void**)&elem);
ok_(__FILE__,line) (hres == S_OK, "Coule not get IHTMLElement3: %08x\n", hres);
return elem;
}
#define get_node_iface(u) _get_node_iface(__LINE__,u)
static IHTMLDOMNode *_get_node_iface(unsigned line, IUnknown *unk)
{
@ -1059,6 +1070,32 @@ static IHTMLElement *_test_elem_get_parent(unsigned line, IUnknown *unk)
return parent;
}
#define test_elem3_get_disabled(i,b) _test_elem3_get_disabled(__LINE__,i,b)
static void _test_elem3_get_disabled(unsigned line, IUnknown *unk, VARIANT_BOOL exb)
{
IHTMLElement3 *elem3 = _get_elem3_iface(line, unk);
VARIANT_BOOL disabled = 100;
HRESULT hres;
hres = IHTMLElement3_get_disabled(elem3, &disabled);
ok_(__FILE__,line) (hres == S_OK, "get_disabled failed: %08x\n", hres);
ok_(__FILE__,line) (disabled == exb, "disabled=%x, expected %x\n", disabled, exb);
IHTMLElement3_Release(elem3);
}
#define test_elem3_set_disabled(i,b) _test_elem3_set_disabled(__LINE__,i,b)
static void _test_elem3_set_disabled(unsigned line, IUnknown *unk, VARIANT_BOOL b)
{
IHTMLElement3 *elem3 = _get_elem3_iface(line, unk);
HRESULT hres;
hres = IHTMLElement3_put_disabled(elem3, b);
ok_(__FILE__,line) (hres == S_OK, "get_disabled failed: %08x\n", hres);
IHTMLElement3_Release(elem3);
_test_elem3_get_disabled(line, unk, b);
}
#define elem_get_scroll_height(u) _elem_get_scroll_height(__LINE__,u)
static long _elem_get_scroll_height(unsigned line, IUnknown *unk)
{
@ -1206,6 +1243,8 @@ static void _test_input_get_disabled(unsigned line, IHTMLInputElement *input, VA
hres = IHTMLInputElement_get_disabled(input, &disabled);
ok_(__FILE__,line) (hres == S_OK, "get_disabled failed: %08x\n", hres);
ok_(__FILE__,line) (disabled == exb, "disabled=%x, expected %x\n", disabled, exb);
_test_elem3_get_disabled(line, (IUnknown*)input, exb);
}
#define test_input_set_disabled(i,b) _test_input_set_disabled(__LINE__,i,b)
@ -2838,6 +2877,10 @@ static void test_elems(IHTMLDocument2 *doc)
test_input_get_disabled(input, VARIANT_FALSE);
test_input_set_disabled(input, VARIANT_TRUE);
test_input_set_disabled(input, VARIANT_FALSE);
test_elem3_set_disabled((IUnknown*)input, VARIANT_TRUE);
test_input_get_disabled(input, VARIANT_TRUE);
test_elem3_set_disabled((IUnknown*)input, VARIANT_FALSE);
test_input_get_disabled(input, VARIANT_FALSE);
test_elem_client_size((IUnknown*)elem);
test_node_get_value_str((IUnknown*)elem, NULL);