mshtml: Implement proper value for WineDOMTokenList.

It returns the classes as specified in className.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gabriel Ivăncescu 2021-10-01 16:12:43 +03:00 committed by Alexandre Julliard
parent f640a446e3
commit 31883ce4ac
2 changed files with 35 additions and 1 deletions

View File

@ -6624,12 +6624,42 @@ static const IWineDOMTokenListVtbl WineDOMTokenListVtbl = {
token_list_remove,
};
static inline struct token_list *token_list_from_DispatchEx(DispatchEx *iface)
{
return CONTAINING_RECORD(iface, struct token_list, dispex);
}
static HRESULT token_list_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *params,
VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
{
struct token_list *token_list = token_list_from_DispatchEx(dispex);
HRESULT hres;
switch(flags) {
case DISPATCH_PROPERTYGET:
hres = IHTMLElement_get_className(token_list->element, &V_BSTR(res));
if(FAILED(hres))
return hres;
V_VT(res) = VT_BSTR;
break;
default:
FIXME("Unimplemented flags %x\n", flags);
return E_NOTIMPL;
}
return S_OK;
}
static const dispex_static_data_vtbl_t token_list_dispex_vtbl = {
token_list_value
};
static const tid_t token_list_iface_tids[] = {
IWineDOMTokenList_tid,
0
};
static dispex_static_data_t token_list_dispex = {
NULL,
&token_list_dispex_vtbl,
IWineDOMTokenList_tid,
token_list_iface_tids
};

View File

@ -527,6 +527,7 @@ sync_test("classList", function() {
classList.add("c");
ok(elem.className === "a b c 4", "(2) Expected className 'a b c 4', got " + elem.className);
ok(("" + classList) === "a b c 4", "Expected classList value 'a b c 4', got " + classList);
var exception = false
@ -605,4 +606,7 @@ sync_test("classList", function() {
classList.remove("b");
ok(elem.className === "", "remove: expected className '', got " + elem.className);
elem.className = " testclass foobar ";
ok(("" + classList) === " testclass foobar ", "Expected classList value ' testclass foobar ', got " + classList);
});