Commit 847a743f authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added fdexNameCaseInsensitive support.

parent cefb25c7
...@@ -368,11 +368,13 @@ static inline dispex_dynamic_data_t *get_dynamic_data(DispatchEx *This, BOOL all ...@@ -368,11 +368,13 @@ static inline dispex_dynamic_data_t *get_dynamic_data(DispatchEx *This, BOOL all
: (This->dynamic_data = heap_alloc_zero(sizeof(dispex_dynamic_data_t))); : (This->dynamic_data = heap_alloc_zero(sizeof(dispex_dynamic_data_t)));
} }
static HRESULT get_dynamic_prop(DispatchEx *This, const WCHAR *name, BOOL alloc, dynamic_prop_t **ret) static HRESULT get_dynamic_prop(DispatchEx *This, const WCHAR *name, DWORD flags, dynamic_prop_t **ret)
{ {
dispex_dynamic_data_t *data = get_dynamic_data(This, alloc); const BOOL alloc = flags & fdexNameEnsure;
dispex_dynamic_data_t *data;
unsigned i; unsigned i;
data = get_dynamic_data(This, alloc);
if(!data) { if(!data) {
if(alloc) if(alloc)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -382,7 +384,7 @@ static HRESULT get_dynamic_prop(DispatchEx *This, const WCHAR *name, BOOL alloc, ...@@ -382,7 +384,7 @@ static HRESULT get_dynamic_prop(DispatchEx *This, const WCHAR *name, BOOL alloc,
} }
for(i=0; i < data->prop_cnt; i++) { for(i=0; i < data->prop_cnt; i++) {
if(!strcmpW(data->props[i].name, name)) { if(flags & fdexNameCaseInsensitive ? !strcmpiW(data->props[i].name, name) : !strcmpW(data->props[i].name, name)) {
*ret = data->props+i; *ret = data->props+i;
return S_OK; return S_OK;
} }
...@@ -418,7 +420,7 @@ HRESULT dispex_get_dprop_ref(DispatchEx *This, const WCHAR *name, BOOL alloc, VA ...@@ -418,7 +420,7 @@ HRESULT dispex_get_dprop_ref(DispatchEx *This, const WCHAR *name, BOOL alloc, VA
dynamic_prop_t *prop; dynamic_prop_t *prop;
HRESULT hres; HRESULT hres;
hres = get_dynamic_prop(This, name, alloc, &prop); hres = get_dynamic_prop(This, name, alloc ? fdexNameEnsure : 0, &prop);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -746,7 +748,7 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW ...@@ -746,7 +748,7 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW
TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid); TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid);
if(grfdex & ~(fdexNameCaseSensitive|fdexNameEnsure|fdexNameImplicit|FDEX_VERSION_MASK)) if(grfdex & ~(fdexNameCaseSensitive|fdexNameCaseInsensitive|fdexNameEnsure|fdexNameImplicit|FDEX_VERSION_MASK))
FIXME("Unsupported grfdex %x\n", grfdex); FIXME("Unsupported grfdex %x\n", grfdex);
data = get_dispex_data(This); data = get_dispex_data(This);
...@@ -782,7 +784,7 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW ...@@ -782,7 +784,7 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW
return hres; return hres;
} }
hres = get_dynamic_prop(This, bstrName, grfdex&fdexNameEnsure, &dprop); hres = get_dynamic_prop(This, bstrName, grfdex, &dprop);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
......
...@@ -939,8 +939,9 @@ static void test_get_set_attr(IHTMLDocument2 *doc) ...@@ -939,8 +939,9 @@ static void test_get_set_attr(IHTMLDocument2 *doc)
bstr = a2bstr("newattribute"); bstr = a2bstr("newattribute");
hres = IHTMLElement_getAttribute(elem, bstr, 0, &val); hres = IHTMLElement_getAttribute(elem, bstr, 0, &val);
ok(hres == S_OK, "getAttribute failed: %08x\n", hres); ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
todo_wine ok(V_VT(&val) == VT_BOOL, "variant type should have been VT_BOOL (0x%x), was: 0x%x\n", VT_BOOL, V_VT(&val)); ok(V_VT(&val) == VT_BOOL, "variant type should have been VT_BOOL (0x%x), was: 0x%x\n", VT_BOOL, V_VT(&val));
todo_wine ok(V_BOOL(&val) == VARIANT_TRUE, "variant value should have been VARIANT_TRUE (0x%x), was %d\n", VARIANT_TRUE, V_BOOL(&val)); ok(V_BOOL(&val) == VARIANT_TRUE, "variant value should have been VARIANT_TRUE (0x%x), was %d\n",
VARIANT_TRUE, V_BOOL(&val));
VariantClear(&val); VariantClear(&val);
SysFreeString(bstr); SysFreeString(bstr);
......
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