From: Jacek Caban jacek@codeweavers.com
--- dlls/mshtml/htmldoc.c | 18 +++++++------- dlls/mshtml/htmlelem.c | 8 +++---- dlls/mshtml/htmlelemcol.c | 39 +++++++++---------------------- dlls/mshtml/htmlform.c | 2 +- dlls/mshtml/htmltable.c | 6 ++--- dlls/mshtml/mshtml_private.h | 4 ++-- dlls/mshtml/tests/documentmode.js | 2 +- 7 files changed, 31 insertions(+), 48 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index eaf3b352006..57851f20b52 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -491,7 +491,7 @@ static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElemen }
if(nscoll) { - *p = create_collection_from_htmlcol(nscoll, This->document_mode); + *p = create_collection_from_htmlcol(nscoll, &This->node.event_target.dispex); nsIDOMHTMLCollection_Release(nscoll); }
@@ -528,7 +528,7 @@ static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLEleme }
if(nscoll) { - *p = create_collection_from_htmlcol(nscoll, This->document_mode); + *p = create_collection_from_htmlcol(nscoll, &This->node.event_target.dispex); nsIDOMHTMLCollection_Release(nscoll); }
@@ -565,7 +565,7 @@ static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElement }
if(nscoll) { - *p = create_collection_from_htmlcol(nscoll, This->document_mode); + *p = create_collection_from_htmlcol(nscoll, &This->node.event_target.dispex); nsIDOMHTMLCollection_Release(nscoll); }
@@ -602,7 +602,7 @@ static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElement }
if(nscoll) { - *p = create_collection_from_htmlcol(nscoll, This->document_mode); + *p = create_collection_from_htmlcol(nscoll, &This->node.event_target.dispex); nsIDOMHTMLCollection_Release(nscoll); }
@@ -639,7 +639,7 @@ static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLEleme }
if(nscoll) { - *p = create_collection_from_htmlcol(nscoll, This->document_mode); + *p = create_collection_from_htmlcol(nscoll, &This->node.event_target.dispex); nsIDOMHTMLCollection_Release(nscoll); }
@@ -729,7 +729,7 @@ static HRESULT WINAPI HTMLDocument_get_scripts(IHTMLDocument2 *iface, IHTMLEleme }
if(nscoll) { - *p = create_collection_from_htmlcol(nscoll, This->document_mode); + *p = create_collection_from_htmlcol(nscoll, &This->node.event_target.dispex); nsIDOMHTMLCollection_Release(nscoll); }
@@ -2601,7 +2601,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BST return E_FAIL; }
- *ppelColl = create_collection_from_nodelist(node_list, This->document_mode); + *ppelColl = create_collection_from_nodelist(node_list, &This->node.event_target.dispex); nsIDOMNodeList_Release(node_list); return S_OK; } @@ -2678,7 +2678,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface, }
- *pelColl = create_collection_from_nodelist(nslist, This->document_mode); + *pelColl = create_collection_from_nodelist(nslist, &This->node.event_target.dispex); nsIDOMNodeList_Release(nslist);
return S_OK; @@ -3487,7 +3487,7 @@ static HRESULT WINAPI HTMLDocument7_getElementsByClassName(IHTMLDocument7 *iface }
- *pel = create_collection_from_nodelist(nslist, This->document_mode); + *pel = create_collection_from_nodelist(nslist, &This->node.event_target.dispex); nsIDOMNodeList_Release(nslist); return S_OK; } diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index bc140b14984..24ecf145752 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -2611,7 +2611,7 @@ static HRESULT WINAPI HTMLElement_get_children(IHTMLElement *iface, IDispatch ** return E_FAIL; }
- *p = (IDispatch*)create_collection_from_nodelist(nsnode_list, This->node.doc->document_mode); + *p = (IDispatch*)create_collection_from_nodelist(nsnode_list, &This->node.event_target.dispex);
nsIDOMNodeList_Release(nsnode_list); return S_OK; @@ -3792,7 +3792,7 @@ static HRESULT WINAPI HTMLElement2_getElementsByTagName(IHTMLElement2 *iface, BS TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
if(!This->dom_element) { - *pelColl = create_collection_from_htmlcol(NULL, This->node.doc->document_mode); + *pelColl = create_collection_from_htmlcol(NULL, &This->node.event_target.dispex); return S_OK; }
@@ -3804,7 +3804,7 @@ static HRESULT WINAPI HTMLElement2_getElementsByTagName(IHTMLElement2 *iface, BS return E_FAIL; }
- *pelColl = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->node.event_target.dispex)); + *pelColl = create_collection_from_htmlcol(nscol, &This->node.event_target.dispex); nsIDOMHTMLCollection_Release(nscol); return S_OK; } @@ -4820,7 +4820,7 @@ static HRESULT WINAPI HTMLElement6_getElementsByClassName(IHTMLElement6 *iface, } }
- *pel = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->node.event_target.dispex)); + *pel = create_collection_from_htmlcol(nscol, &This->node.event_target.dispex); nsIDOMHTMLCollection_Release(nscol); return S_OK; } diff --git a/dlls/mshtml/htmlelemcol.c b/dlls/mshtml/htmlelemcol.c index a264813f9bb..625af9781b8 100644 --- a/dlls/mshtml/htmlelemcol.c +++ b/dlls/mshtml/htmlelemcol.c @@ -60,7 +60,7 @@ static inline HTMLElement *elem_from_HTMLDOMNode(HTMLDOMNode *iface) return CONTAINING_RECORD(iface, HTMLElement, node); }
-static IHTMLElementCollection *HTMLElementCollection_Create(HTMLElement**,DWORD,compat_mode_t); +static IHTMLElementCollection *HTMLElementCollection_Create(HTMLElement**,DWORD,DispatchEx*);
static void elem_vector_add(elem_vector_t *buf, HTMLElement *elem) { @@ -377,8 +377,7 @@ static HRESULT WINAPI HTMLElementCollection_item(IHTMLElementCollection *iface,
if(buf.len > 1) { elem_vector_normalize(&buf); - *pdisp = (IDispatch*)HTMLElementCollection_Create(buf.buf, buf.len, - dispex_compat_mode(&This->dispex)); + *pdisp = (IDispatch*)HTMLElementCollection_Create(buf.buf, buf.len, &This->dispex); }else { if(buf.len == 1) { /* Already AddRef-ed */ @@ -440,8 +439,7 @@ static HRESULT WINAPI HTMLElementCollection_tags(IHTMLElementCollection *iface,
TRACE("found %ld tags\n", buf.len);
- *pdisp = (IDispatch*)HTMLElementCollection_Create(buf.buf, buf.len, - dispex_compat_mode(&This->dispex)); + *pdisp = (IDispatch*)HTMLElementCollection_Create(buf.buf, buf.len, &This->dispex); return S_OK; }
@@ -535,20 +533,6 @@ static HRESULT HTMLElementCollection_get_dispid(DispatchEx *dispex, const WCHAR return S_OK; }
-static HRESULT HTMLElementCollection_get_name(DispatchEx *dispex, DISPID id, BSTR *name) -{ - HTMLElementCollection *This = impl_from_DispatchEx(dispex); - DWORD idx = id - MSHTML_DISPID_CUSTOM_MIN; - WCHAR buf[11]; - UINT len; - - if(idx >= This->len) - return DISP_E_MEMBERNOTFOUND; - - len = swprintf(buf, ARRAY_SIZE(buf), L"%u", idx); - return (*name = SysAllocStringLen(buf, len)) ? S_OK : E_OUTOFMEMORY; -} - static HRESULT HTMLElementCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { @@ -581,7 +565,7 @@ static const dispex_static_data_vtbl_t HTMLElementColection_dispex_vtbl = { .traverse = HTMLElementCollection_traverse, .unlink = HTMLElementCollection_unlink, .get_dispid = HTMLElementCollection_get_dispid, - .get_name = HTMLElementCollection_get_name, + .get_prop_desc = dispex_index_prop_desc, .invoke = HTMLElementCollection_invoke, };
@@ -653,11 +637,10 @@ IHTMLElementCollection *create_all_collection(HTMLDOMNode *node, BOOL include_ro create_all_list(node, &buf); elem_vector_normalize(&buf);
- return HTMLElementCollection_Create(buf.buf, buf.len, - dispex_compat_mode(&node->event_target.dispex)); + return HTMLElementCollection_Create(buf.buf, buf.len, &node->event_target.dispex); }
-IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList *nslist, compat_mode_t compat_mode) +IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList *nslist, DispatchEx *owner) { UINT32 length = 0, i; HTMLDOMNode *node; @@ -689,10 +672,10 @@ IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList *nslist, buf.buf = NULL; }
- return HTMLElementCollection_Create(buf.buf, buf.len, compat_mode); + return HTMLElementCollection_Create(buf.buf, buf.len, owner); }
-IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection *nscol, compat_mode_t compat_mode) +IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection *nscol, DispatchEx *owner) { UINT32 length = 0, i; elem_vector_t buf; @@ -725,7 +708,7 @@ IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection *nsc return NULL; }
- return HTMLElementCollection_Create(buf.buf, buf.len, compat_mode); + return HTMLElementCollection_Create(buf.buf, buf.len, owner); }
HRESULT get_elem_source_index(HTMLElement *elem, LONG *ret) @@ -801,7 +784,7 @@ HRESULT get_elem_source_index(HTMLElement *elem, LONG *ret) }
static IHTMLElementCollection *HTMLElementCollection_Create(HTMLElement **elems, DWORD len, - compat_mode_t compat_mode) + DispatchEx *owner) { HTMLElementCollection *ret = calloc(1, sizeof(HTMLElementCollection));
@@ -812,7 +795,7 @@ static IHTMLElementCollection *HTMLElementCollection_Create(HTMLElement **elems, ret->elems = elems; ret->len = len;
- init_dispatch(&ret->dispex, &HTMLElementCollection_dispex, NULL, compat_mode); + init_dispatch_with_owner(&ret->dispex, &HTMLElementCollection_dispex, owner);
TRACE("ret=%p len=%ld\n", ret, len);
diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c index a6a4bc0bce9..80a8d706054 100644 --- a/dlls/mshtml/htmlform.c +++ b/dlls/mshtml/htmlform.c @@ -401,7 +401,7 @@ static HRESULT WINAPI HTMLFormElement_get_elements(IHTMLFormElement *iface, IDis return E_FAIL; }
- *p = (IDispatch*)create_collection_from_htmlcol(elements, dispex_compat_mode(&This->element.node.event_target.dispex)); + *p = (IDispatch*)create_collection_from_htmlcol(elements, &This->element.node.event_target.dispex); nsIDOMHTMLCollection_Release(elements); return S_OK; } diff --git a/dlls/mshtml/htmltable.c b/dlls/mshtml/htmltable.c index 6c2d72cdcea..19d03387539 100644 --- a/dlls/mshtml/htmltable.c +++ b/dlls/mshtml/htmltable.c @@ -693,7 +693,7 @@ static HRESULT WINAPI HTMLTableRow_get_cells(IHTMLTableRow *iface, IHTMLElementC return E_FAIL; }
- *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex)); + *p = create_collection_from_htmlcol(nscol, &This->element.node.event_target.dispex);
nsIDOMHTMLCollection_Release(nscol); return S_OK; @@ -1224,7 +1224,7 @@ static HRESULT WINAPI HTMLTable_get_rows(IHTMLTable *iface, IHTMLElementCollecti return E_FAIL; }
- *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex)); + *p = create_collection_from_htmlcol(nscol, &This->element.node.event_target.dispex);
nsIDOMHTMLCollection_Release(nscol); return S_OK; @@ -1339,7 +1339,7 @@ static HRESULT WINAPI HTMLTable_get_tBodies(IHTMLTable *iface, IHTMLElementColle return E_FAIL; }
- *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex)); + *p = create_collection_from_htmlcol(nscol, &This->element.node.event_target.dispex);
nsIDOMHTMLCollection_Release(nscol); return S_OK; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index d48ba2f32ac..f245acc8d75 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -1300,8 +1300,8 @@ ULONG WINAPI wrapper_Release(IUnknown *iface); extern const void *iface_wrapper_vtbl[];
IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL); -IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList*,compat_mode_t); -IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection*,compat_mode_t); +IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList*,DispatchEx*); +IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection*,DispatchEx*); HRESULT create_child_collection(nsIDOMNodeList*,compat_mode_t,IHTMLDOMChildrenCollection**);
HRESULT attr_value_to_string(VARIANT*); diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 1586a7d5a4f..e676197d728 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -297,7 +297,7 @@ sync_test("builtin_toString", function() { if(clientRects) test("clientRects", clientRects, "ClientRectList"); if(currentStyle) test("currentStyle", currentStyle, "MSCurrentStyleCSSProperties", null, true); if(v >= 11 /* todo_wine */) test("document", document, v < 11 ? "Document" : "HTMLDocument"); - test("elements", document.getElementsByTagName("body"), "HTMLCollection", null, true); + test("elements", document.getElementsByTagName("body"), "HTMLCollection"); test("history", window.history, "History"); test("implementation", document.implementation, "DOMImplementation"); if(localStorage) test("localStorage", localStorage, "Storage");
From: Jacek Caban jacek@codeweavers.com
--- dlls/mshtml/htmldoc.c | 2 +- dlls/mshtml/htmlelem.c | 2 +- dlls/mshtml/htmlnode.c | 23 ++++------------------- dlls/mshtml/mshtml_private.h | 2 +- dlls/mshtml/tests/documentmode.js | 2 +- 5 files changed, 8 insertions(+), 23 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 57851f20b52..2c92b6e3d8f 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -4447,7 +4447,7 @@ static HRESULT WINAPI DocumentSelector_querySelectorAll(IDocumentSelector *iface return map_nsresult(nsres); }
- hres = create_child_collection(node_list, dispex_compat_mode(&This->node.event_target.dispex), pel); + hres = create_child_collection(node_list, &This->node.event_target.dispex, pel); nsIDOMNodeList_Release(node_list); return hres; } diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 24ecf145752..f6be9c8d35e 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -5964,7 +5964,7 @@ static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface, return map_nsresult(nsres); }
- hres = create_child_collection(node_list, dispex_compat_mode(&This->node.event_target.dispex), pel); + hres = create_child_collection(node_list, &This->node.event_target.dispex, pel); nsIDOMNodeList_Release(node_list); return hres; } diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index 3123e9dd72e..8f9de03fd93 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -338,21 +338,6 @@ static HRESULT HTMLDOMChildrenCollection_get_dispid(DispatchEx *dispex, const WC return S_OK; }
-static HRESULT HTMLDOMChildrenCollection_get_name(DispatchEx *dispex, DISPID id, BSTR *name) -{ - HTMLDOMChildrenCollection *This = impl_from_DispatchEx(dispex); - DWORD idx = id - DISPID_CHILDCOL_0; - UINT32 len = 0; - WCHAR buf[11]; - - nsIDOMNodeList_GetLength(This->nslist, &len); - if(idx >= len) - return DISP_E_MEMBERNOTFOUND; - - len = swprintf(buf, ARRAY_SIZE(buf), L"%u", idx); - return (*name = SysAllocStringLen(buf, len)) ? S_OK : E_OUTOFMEMORY; -} - static HRESULT HTMLDOMChildrenCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { @@ -389,7 +374,7 @@ static const dispex_static_data_vtbl_t HTMLDOMChildrenCollection_dispex_vtbl = { .traverse = HTMLDOMChildrenCollection_traverse, .unlink = HTMLDOMChildrenCollection_unlink, .get_dispid = HTMLDOMChildrenCollection_get_dispid, - .get_name = HTMLDOMChildrenCollection_get_name, + .get_prop_desc = dispex_index_prop_desc, .invoke = HTMLDOMChildrenCollection_invoke, };
@@ -406,7 +391,7 @@ static dispex_static_data_t HTMLDOMChildrenCollection_dispex = { HTMLDOMNode_init_dispex_info };
-HRESULT create_child_collection(nsIDOMNodeList *nslist, compat_mode_t compat_mode, IHTMLDOMChildrenCollection **ret) +HRESULT create_child_collection(nsIDOMNodeList *nslist, DispatchEx *owner, IHTMLDOMChildrenCollection **ret) { HTMLDOMChildrenCollection *collection;
@@ -418,7 +403,7 @@ HRESULT create_child_collection(nsIDOMNodeList *nslist, compat_mode_t compat_mod nsIDOMNodeList_AddRef(nslist); collection->nslist = nslist;
- init_dispatch(&collection->dispex, &HTMLDOMChildrenCollection_dispex, NULL, compat_mode); + init_dispatch_with_owner(&collection->dispex, &HTMLDOMChildrenCollection_dispex, owner);
*ret = &collection->IHTMLDOMChildrenCollection_iface; return S_OK; @@ -530,7 +515,7 @@ static HRESULT WINAPI HTMLDOMNode_get_childNodes(IHTMLDOMNode *iface, IDispatch return hres; }
- hres = create_child_collection(nslist, dispex_compat_mode(&This->event_target.dispex), + hres = create_child_collection(nslist, &This->event_target.dispex, (IHTMLDOMChildrenCollection**)p); nsIDOMNodeList_Release(nslist); return hres; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index f245acc8d75..1f6119eb339 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -1302,7 +1302,7 @@ extern const void *iface_wrapper_vtbl[]; IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL); IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList*,DispatchEx*); IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection*,DispatchEx*); -HRESULT create_child_collection(nsIDOMNodeList*,compat_mode_t,IHTMLDOMChildrenCollection**); +HRESULT create_child_collection(nsIDOMNodeList*,DispatchEx*,IHTMLDOMChildrenCollection**);
HRESULT attr_value_to_string(VARIANT*); HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,VARIANT*); diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index e676197d728..f529743d606 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -292,7 +292,7 @@ sync_test("builtin_toString", function() {
test("attribute", document.createAttribute("class"), "Attr"); if(false /* todo_wine */) test("attributes", e.attributes, "NamedNodeMap"); - test("childNodes", document.body.childNodes, "NodeList", null, true); + test("childNodes", document.body.childNodes, "NodeList"); if(clientRects) test("clientRect", clientRects[0], "ClientRect"); if(clientRects) test("clientRects", clientRects, "ClientRectList"); if(currentStyle) test("currentStyle", currentStyle, "MSCurrentStyleCSSProperties", null, true);
From: Jacek Caban jacek@codeweavers.com
--- dlls/mshtml/htmldoc.c | 3 +-- dlls/mshtml/htmlstylesheet.c | 22 ++++------------------ dlls/mshtml/mshtml_private.h | 2 +- dlls/mshtml/tests/documentmode.js | 2 +- 4 files changed, 7 insertions(+), 22 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 2c92b6e3d8f..537daeff6fa 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -1934,8 +1934,7 @@ static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface, return map_nsresult(nsres); }
- hres = create_style_sheet_collection(nsstylelist, - dispex_compat_mode(&This->node.event_target.dispex), p); + hres = create_style_sheet_collection(nsstylelist, This, p); nsIDOMStyleSheetList_Release(nsstylelist); return hres; } diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c index 1e8982ee098..9965b55dc79 100644 --- a/dlls/mshtml/htmlstylesheet.c +++ b/dlls/mshtml/htmlstylesheet.c @@ -690,21 +690,6 @@ static HRESULT HTMLStyleSheetsCollection_get_dispid(DispatchEx *dispex, const WC return S_OK; }
-static HRESULT HTMLStyleSheetsCollection_get_name(DispatchEx *dispex, DISPID id, BSTR *name) -{ - HTMLStyleSheetsCollection *This = HTMLStyleSheetsCollection_from_DispatchEx(dispex); - DWORD idx = id - MSHTML_DISPID_CUSTOM_MIN; - UINT32 len = 0; - WCHAR buf[11]; - - nsIDOMStyleSheetList_GetLength(This->nslist, &len); - if(idx >= len) - return DISP_E_MEMBERNOTFOUND; - - len = swprintf(buf, ARRAY_SIZE(buf), L"%u", idx); - return (*name = SysAllocStringLen(buf, len)) ? S_OK : E_OUTOFMEMORY; -} - static HRESULT HTMLStyleSheetsCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { @@ -751,7 +736,7 @@ static const dispex_static_data_vtbl_t HTMLStyleSheetsCollection_dispex_vtbl = { .traverse = HTMLStyleSheetsCollection_traverse, .unlink = HTMLStyleSheetsCollection_unlink, .get_dispid = HTMLStyleSheetsCollection_get_dispid, - .get_name = HTMLStyleSheetsCollection_get_name, + .get_prop_desc = dispex_index_prop_desc, .invoke = HTMLStyleSheetsCollection_invoke }; static const tid_t HTMLStyleSheetsCollection_iface_tids[] = { @@ -765,7 +750,7 @@ static dispex_static_data_t HTMLStyleSheetsCollection_dispex = { HTMLStyleSheetsCollection_iface_tids };
-HRESULT create_style_sheet_collection(nsIDOMStyleSheetList *nslist, compat_mode_t compat_mode, +HRESULT create_style_sheet_collection(nsIDOMStyleSheetList *nslist, HTMLDocumentNode *doc, IHTMLStyleSheetsCollection **ret) { HTMLStyleSheetsCollection *collection; @@ -779,7 +764,8 @@ HRESULT create_style_sheet_collection(nsIDOMStyleSheetList *nslist, compat_mode_ nsIDOMStyleSheetList_AddRef(nslist); collection->nslist = nslist;
- init_dispatch(&collection->dispex, &HTMLStyleSheetsCollection_dispex, NULL, compat_mode); + init_dispatch(&collection->dispex, &HTMLStyleSheetsCollection_dispex, doc->script_global, + dispex_compat_mode(&doc->node.event_target.dispex));
*ret = &collection->IHTMLStyleSheetsCollection_iface; return S_OK; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 1f6119eb339..96d7d590d36 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -1176,7 +1176,7 @@ HRESULT get_readystate_string(READYSTATE,BSTR*); HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**); HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**); HRESULT create_style_sheet(nsIDOMStyleSheet*,compat_mode_t,IHTMLStyleSheet**); -HRESULT create_style_sheet_collection(nsIDOMStyleSheetList*,compat_mode_t, +HRESULT create_style_sheet_collection(nsIDOMStyleSheetList*,HTMLDocumentNode*, IHTMLStyleSheetsCollection**); HRESULT create_dom_range(nsIDOMRange*,HTMLDocumentNode*,IHTMLDOMRange**); HRESULT create_markup_pointer(IMarkupPointer**); diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index f529743d606..56e6239f3f3 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -314,7 +314,7 @@ sync_test("builtin_toString", function() { test("styleSheet", sheet, "CSSStyleSheet", null, true); test("styleSheetRule", sheet.rules[0], "CSSStyleRule", null, true); test("styleSheetRules", sheet.rules, "MSCSSRuleList", null, true); - test("styleSheets", document.styleSheets, "StyleSheetList", null, true); + test("styleSheets", document.styleSheets, "StyleSheetList"); test("textNode", document.createTextNode("testNode"), "Text", v < 9 ? "testNode" : null); test("textRange", txtRange, "TextRange"); test("window", window, "Window", "[object Window]");
From: Jacek Caban jacek@codeweavers.com
--- dlls/mshtml/htmldoc.c | 3 +-- dlls/mshtml/htmlstyleelem.c | 3 +-- dlls/mshtml/htmlstylesheet.c | 8 ++++---- dlls/mshtml/mshtml_private.h | 2 +- dlls/mshtml/tests/documentmode.js | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 537daeff6fa..31d879de837 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -2003,8 +2003,7 @@ static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR
if(bstrHref && *bstrHref) { FIXME("semi-stub for href %s\n", debugstr_w(bstrHref)); - return create_style_sheet(NULL, dispex_compat_mode(&This->node.event_target.dispex), - ppnewStyleSheet); + return create_style_sheet(NULL, &This->node.event_target.dispex, ppnewStyleSheet); }
hres = create_element(This, L"style", &elem); diff --git a/dlls/mshtml/htmlstyleelem.c b/dlls/mshtml/htmlstyleelem.c index af5831dd85a..3d23bff5da8 100644 --- a/dlls/mshtml/htmlstyleelem.c +++ b/dlls/mshtml/htmlstyleelem.c @@ -150,8 +150,7 @@ static HRESULT WINAPI HTMLStyleElement_get_styleSheet(IHTMLStyleElement *iface, assert(nsres == NS_OK);
if(ss) { - HRESULT hres = create_style_sheet(ss, dispex_compat_mode(&This->element.node.event_target.dispex), - &This->style_sheet); + HRESULT hres = create_style_sheet(ss, &This->element.node.event_target.dispex, &This->style_sheet); nsIDOMStyleSheet_Release(ss); if(FAILED(hres)) return hres; diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c index 9965b55dc79..cf35d97f0ac 100644 --- a/dlls/mshtml/htmlstylesheet.c +++ b/dlls/mshtml/htmlstylesheet.c @@ -601,7 +601,7 @@ static HRESULT WINAPI HTMLStyleSheetsCollection_item(IHTMLStyleSheetsCollection return E_INVALIDARG; }
- hres = create_style_sheet(nsstylesheet, dispex_compat_mode(&This->dispex), &stylesheet); + hres = create_style_sheet(nsstylesheet, &This->dispex, &stylesheet); nsIDOMStyleSheet_Release(nsstylesheet); if(FAILED(hres)) return hres; @@ -712,7 +712,7 @@ static HRESULT HTMLStyleSheetsCollection_invoke(DispatchEx *dispex, DISPID id, L return S_OK; }
- hres = create_style_sheet(nsstylesheet, dispex_compat_mode(&This->dispex), &stylesheet); + hres = create_style_sheet(nsstylesheet, &This->dispex, &stylesheet); nsIDOMStyleSheet_Release(nsstylesheet); if(FAILED(hres)) return hres; @@ -1234,7 +1234,7 @@ static dispex_static_data_t HTMLStyleSheet_dispex = { HTMLStyleSheet_init_dispex_info };
-HRESULT create_style_sheet(nsIDOMStyleSheet *nsstylesheet, compat_mode_t compat_mode, IHTMLStyleSheet **ret) +HRESULT create_style_sheet(nsIDOMStyleSheet *nsstylesheet, DispatchEx *owner, IHTMLStyleSheet **ret) { HTMLStyleSheet *style_sheet; nsresult nsres; @@ -1246,7 +1246,7 @@ HRESULT create_style_sheet(nsIDOMStyleSheet *nsstylesheet, compat_mode_t compat_ style_sheet->IHTMLStyleSheet4_iface.lpVtbl = &HTMLStyleSheet4Vtbl; style_sheet->nsstylesheet = NULL;
- init_dispatch(&style_sheet->dispex, &HTMLStyleSheet_dispex, NULL, compat_mode); + init_dispatch_with_owner(&style_sheet->dispex, &HTMLStyleSheet_dispex, owner);
if(nsstylesheet) { nsres = nsIDOMStyleSheet_QueryInterface(nsstylesheet, &IID_nsIDOMCSSStyleSheet, diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 96d7d590d36..b130575418f 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -1175,7 +1175,7 @@ HRESULT get_readystate_string(READYSTATE,BSTR*);
HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**); HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**); -HRESULT create_style_sheet(nsIDOMStyleSheet*,compat_mode_t,IHTMLStyleSheet**); +HRESULT create_style_sheet(nsIDOMStyleSheet*,DispatchEx*,IHTMLStyleSheet**); HRESULT create_style_sheet_collection(nsIDOMStyleSheetList*,HTMLDocumentNode*, IHTMLStyleSheetsCollection**); HRESULT create_dom_range(nsIDOMRange*,HTMLDocumentNode*,IHTMLDOMRange**); diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 56e6239f3f3..a52df385523 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -311,7 +311,7 @@ sync_test("builtin_toString", function() { test("screen", window.screen, "Screen"); test("sessionStorage", window.sessionStorage, "Storage"); test("style", document.body.style, "MSStyleCSSProperties", null, true); - test("styleSheet", sheet, "CSSStyleSheet", null, true); + test("styleSheet", sheet, "CSSStyleSheet"); test("styleSheetRule", sheet.rules[0], "CSSStyleRule", null, true); test("styleSheetRules", sheet.rules, "MSCSSRuleList", null, true); test("styleSheets", document.styleSheets, "StyleSheetList");
From: Jacek Caban jacek@codeweavers.com
--- dlls/mshtml/htmlstylesheet.c | 23 ++++------------------- dlls/mshtml/tests/documentmode.js | 2 +- 2 files changed, 5 insertions(+), 20 deletions(-)
diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c index cf35d97f0ac..68de7e57526 100644 --- a/dlls/mshtml/htmlstylesheet.c +++ b/dlls/mshtml/htmlstylesheet.c @@ -313,21 +313,6 @@ static HRESULT HTMLStyleSheetRulesCollection_get_dispid(DispatchEx *dispex, cons return S_OK; }
-static HRESULT HTMLStyleSheetRulesCollection_get_name(DispatchEx *dispex, DISPID id, BSTR *name) -{ - HTMLStyleSheetRulesCollection *This = HTMLStyleSheetRulesCollection_from_DispatchEx(dispex); - DWORD idx = id - MSHTML_DISPID_CUSTOM_MIN; - UINT32 len = 0; - WCHAR buf[11]; - - nsIDOMCSSRuleList_GetLength(This->nslist, &len); - if(idx >= len) - return DISP_E_MEMBERNOTFOUND; - - len = swprintf(buf, ARRAY_SIZE(buf), L"%u", idx); - return (*name = SysAllocStringLen(buf, len)) ? S_OK : E_OUTOFMEMORY; -} - static HRESULT HTMLStyleSheetRulesCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { @@ -374,7 +359,7 @@ static const dispex_static_data_vtbl_t HTMLStyleSheetRulesCollection_dispex_vtbl .traverse = HTMLStyleSheetRulesCollection_traverse, .unlink = HTMLStyleSheetRulesCollection_unlink, .get_dispid = HTMLStyleSheetRulesCollection_get_dispid, - .get_name = HTMLStyleSheetRulesCollection_get_name, + .get_prop_desc = dispex_index_prop_desc, .invoke = HTMLStyleSheetRulesCollection_invoke }; static const tid_t HTMLStyleSheetRulesCollection_iface_tids[] = { @@ -388,7 +373,7 @@ static dispex_static_data_t HTMLStyleSheetRulesCollection_dispex = { HTMLStyleSheetRulesCollection_iface_tids };
-static HRESULT create_style_sheet_rules_collection(nsIDOMCSSRuleList *nslist, compat_mode_t compat_mode, +static HRESULT create_style_sheet_rules_collection(nsIDOMCSSRuleList *nslist, DispatchEx *owner, IHTMLStyleSheetRulesCollection **ret) { HTMLStyleSheetRulesCollection *collection; @@ -399,7 +384,7 @@ static HRESULT create_style_sheet_rules_collection(nsIDOMCSSRuleList *nslist, co collection->IHTMLStyleSheetRulesCollection_iface.lpVtbl = &HTMLStyleSheetRulesCollectionVtbl; collection->nslist = nslist;
- init_dispatch(&collection->dispex, &HTMLStyleSheetRulesCollection_dispex, NULL, compat_mode); + init_dispatch_with_owner(&collection->dispex, &HTMLStyleSheetRulesCollection_dispex, owner);
if(nslist) nsIDOMCSSRuleList_AddRef(nslist); @@ -1032,7 +1017,7 @@ static HRESULT WINAPI HTMLStyleSheet_get_rules(IHTMLStyleSheet *iface, return E_FAIL; }
- hres = create_style_sheet_rules_collection(nslist, dispex_compat_mode(&This->dispex), p); + hres = create_style_sheet_rules_collection(nslist, &This->dispex, p); nsIDOMCSSRuleList_Release(nslist); return hres; } diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index a52df385523..ba27db9f832 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -313,7 +313,7 @@ sync_test("builtin_toString", function() { test("style", document.body.style, "MSStyleCSSProperties", null, true); test("styleSheet", sheet, "CSSStyleSheet"); test("styleSheetRule", sheet.rules[0], "CSSStyleRule", null, true); - test("styleSheetRules", sheet.rules, "MSCSSRuleList", null, true); + test("styleSheetRules", sheet.rules, "MSCSSRuleList"); test("styleSheets", document.styleSheets, "StyleSheetList"); test("textNode", document.createTextNode("testNode"), "Text", v < 9 ? "testNode" : null); test("textRange", txtRange, "TextRange");
From: Jacek Caban jacek@codeweavers.com
--- dlls/mshtml/htmlstylesheet.c | 8 ++++---- dlls/mshtml/tests/documentmode.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c index 68de7e57526..fa674f08ccf 100644 --- a/dlls/mshtml/htmlstylesheet.c +++ b/dlls/mshtml/htmlstylesheet.c @@ -171,7 +171,7 @@ static dispex_static_data_t HTMLStyleSheetRule_dispex = { HTMLStyleSheetRule_iface_tids };
-static HRESULT create_style_sheet_rule(nsIDOMCSSRule *nsstylesheetrule, compat_mode_t compat_mode, +static HRESULT create_style_sheet_rule(nsIDOMCSSRule *nsstylesheetrule, DispatchEx *owner, IHTMLStyleSheetRule **ret) { HTMLStyleSheetRule *rule; @@ -183,7 +183,7 @@ static HRESULT create_style_sheet_rule(nsIDOMCSSRule *nsstylesheetrule, compat_m rule->IHTMLStyleSheetRule_iface.lpVtbl = &HTMLStyleSheetRuleVtbl; rule->nsstylesheetrule = NULL;
- init_dispatch(&rule->dispex, &HTMLStyleSheetRule_dispex, NULL, compat_mode); + init_dispatch_with_owner(&rule->dispex, &HTMLStyleSheetRule_dispex, owner);
if (nsstylesheetrule) { @@ -241,7 +241,7 @@ static HRESULT WINAPI HTMLStyleSheetRulesCollection_item(IHTMLStyleSheetRulesCol if(!nsstylesheetrule) return E_INVALIDARG;
- hres = create_style_sheet_rule(nsstylesheetrule, dispex_compat_mode(&This->dispex), p); + hres = create_style_sheet_rule(nsstylesheetrule, &This->dispex, p); nsIDOMCSSRule_Release(nsstylesheetrule); return hres; } @@ -335,7 +335,7 @@ static HRESULT HTMLStyleSheetRulesCollection_invoke(DispatchEx *dispex, DISPID i return S_OK; }
- hres = create_style_sheet_rule(nsstylesheetrule, dispex_compat_mode(&This->dispex), &stylesheetrule); + hres = create_style_sheet_rule(nsstylesheetrule, &This->dispex, &stylesheetrule); nsIDOMCSSRule_Release(nsstylesheetrule); if(FAILED(hres)) return hres; diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index ba27db9f832..5a40f39723c 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -312,7 +312,7 @@ sync_test("builtin_toString", function() { test("sessionStorage", window.sessionStorage, "Storage"); test("style", document.body.style, "MSStyleCSSProperties", null, true); test("styleSheet", sheet, "CSSStyleSheet"); - test("styleSheetRule", sheet.rules[0], "CSSStyleRule", null, true); + test("styleSheetRule", sheet.rules[0], "CSSStyleRule"); test("styleSheetRules", sheet.rules, "MSCSSRuleList"); test("styleSheets", document.styleSheets, "StyleSheetList"); test("textNode", document.createTextNode("testNode"), "Text", v < 9 ? "testNode" : null);
From: Jacek Caban jacek@codeweavers.com
And remove no longer needed get_name. --- dlls/mshtml/dispex.c | 40 +++++++++++++++++++----------------- dlls/mshtml/mshtml_private.h | 1 - 2 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 24cba0a9be7..b8ebf1ba5f4 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1021,14 +1021,18 @@ static HRESULT function_get_dispid(DispatchEx *dispex, const WCHAR *name, DWORD return DISP_E_UNKNOWNNAME; }
-static HRESULT function_get_name(DispatchEx *dispex, DISPID id, BSTR *name) +static HRESULT function_get_prop_desc(DispatchEx *dispex, DISPID id, struct property_info *desc) { DWORD idx = id - MSHTML_DISPID_CUSTOM_MIN;
if(idx >= ARRAY_SIZE(function_props)) return DISP_E_MEMBERNOTFOUND;
- return (*name = SysAllocString(function_props[idx].name)) ? S_OK : E_OUTOFMEMORY; + desc->id = id; + desc->flags = 0; + desc->name = function_props[idx].name; + desc->func_iid = 0; + return S_OK; }
static HRESULT function_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, @@ -1058,7 +1062,7 @@ static const dispex_static_data_vtbl_t function_dispex_vtbl = { .destructor = function_destructor, .value = function_value, .get_dispid = function_get_dispid, - .get_name = function_get_name, + .get_prop_desc = function_get_prop_desc, .invoke = function_invoke };
@@ -1079,7 +1083,7 @@ static func_disp_t *create_func_disp(DispatchEx *obj, func_info_t *info) if(!ret) return NULL;
- init_dispatch(&ret->dispex, &function_dispex, NULL, dispex_compat_mode(obj)); + init_dispatch_with_owner(&ret->dispex, &function_dispex, obj); ret->obj = obj; ret->info = info;
@@ -2188,23 +2192,21 @@ HRESULT dispex_prop_name(DispatchEx *dispex, DISPID id, BSTR *ret) HRESULT hres;
if(is_custom_dispid(id)) { - if(dispex->info->desc->vtbl->get_prop_desc) { - struct property_info desc; - WCHAR buf[12]; + struct property_info desc; + WCHAR buf[12];
- hres = dispex->info->desc->vtbl->get_prop_desc(dispex, id, &desc); - if(FAILED(hres)) - return hres; - if(!desc.name) { - swprintf(buf, ARRAYSIZE(buf), L"%u", desc.index); - desc.name = buf; - } - *ret = SysAllocString(desc.name); - return *ret ? S_OK : E_OUTOFMEMORY; + if(!dispex->info->desc->vtbl->get_prop_desc) + return DISP_E_MEMBERNOTFOUND; + + hres = dispex->info->desc->vtbl->get_prop_desc(dispex, id, &desc); + if(FAILED(hres)) + return hres; + if(!desc.name) { + swprintf(buf, ARRAYSIZE(buf), L"%u", desc.index); + desc.name = buf; } - if(dispex->info->desc->vtbl->get_name) - return dispex->info->desc->vtbl->get_name(dispex, id, ret); - return DISP_E_MEMBERNOTFOUND; + *ret = SysAllocString(desc.name); + return *ret ? S_OK : E_OUTOFMEMORY; }
if(is_dynamic_dispid(id)) { diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index b130575418f..f07d56b19fa 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -391,7 +391,6 @@ typedef struct { HRESULT (*lookup_dispid)(DispatchEx*,const WCHAR*,DWORD,DISPID*);
/* These are called when the object implements GetMemberName, InvokeEx, DeleteMemberByDispID and GetNextDispID for custom props */ - HRESULT (*get_name)(DispatchEx*,DISPID,BSTR*); HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); HRESULT (*delete)(DispatchEx*,DISPID); HRESULT (*next_dispid)(DispatchEx*,DISPID,DISPID*);
From: Jacek Caban jacek@codeweavers.com
Based on patch by Gabriel Ivăncescu. --- dlls/mshtml/htmlcurstyle.c | 2 +- dlls/mshtml/htmlstyle.c | 14 +++++++------- dlls/mshtml/htmlstyle.h | 4 ++-- dlls/mshtml/htmlwindow.c | 2 +- dlls/mshtml/tests/documentmode.js | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/dlls/mshtml/htmlcurstyle.c b/dlls/mshtml/htmlcurstyle.c index 7d87d965469..135b1b735ee 100644 --- a/dlls/mshtml/htmlcurstyle.c +++ b/dlls/mshtml/htmlcurstyle.c @@ -1198,7 +1198,7 @@ HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p) ret->IHTMLCurrentStyle3_iface.lpVtbl = &HTMLCurrentStyle3Vtbl; ret->IHTMLCurrentStyle4_iface.lpVtbl = &HTMLCurrentStyle4Vtbl;
- init_css_style(&ret->css_style, nsstyle, &HTMLCurrentStyle_dispex, dispex_compat_mode(&elem->node.event_target.dispex)); + init_css_style(&ret->css_style, nsstyle, &HTMLCurrentStyle_dispex, &elem->node.event_target.dispex); nsIDOMCSSStyleDeclaration_Release(nsstyle);
IHTMLElement_AddRef(&elem->IHTMLElement_iface); diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index f1e30b6872d..d916aecb420 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -2940,8 +2940,8 @@ static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttri DISPID dispid; unsigned i;
- hres = IWineJSDispatchHost_GetDispID(&This->css_style.dispex.IWineJSDispatchHost_iface, strAttributeName, - (lFlags&1) ? fdexNameCaseSensitive : fdexNameCaseInsensitive, &dispid); + hres = dispex_get_id(&This->css_style.dispex, strAttributeName, + (lFlags & 1) ? fdexNameCaseSensitive : fdexNameCaseInsensitive, &dispid); if(hres != S_OK) { *pfSuccess = VARIANT_FALSE; return S_OK; @@ -9714,14 +9714,14 @@ static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration return E_NOTIMPL; }
-void init_css_style(CSSStyle *style, nsIDOMCSSStyleDeclaration *nsstyle, dispex_static_data_t *dispex_info, compat_mode_t compat_mode) +void init_css_style(CSSStyle *style, nsIDOMCSSStyleDeclaration *nsstyle, dispex_static_data_t *dispex_info, DispatchEx *owner) { style->IHTMLCSSStyleDeclaration_iface.lpVtbl = &HTMLCSSStyleDeclarationVtbl; style->IHTMLCSSStyleDeclaration2_iface.lpVtbl = &HTMLCSSStyleDeclaration2Vtbl; style->nsstyle = nsstyle; nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
- init_dispatch(&style->dispex, dispex_info, NULL, compat_mode); + init_dispatch_with_owner(&style->dispex, dispex_info, owner); }
HRESULT HTMLStyle_Create(HTMLElement *elem, HTMLStyle **ret) @@ -9750,7 +9750,7 @@ HRESULT HTMLStyle_Create(HTMLElement *elem, HTMLStyle **ret) style->elem = elem; IHTMLDOMNode_AddRef(&elem->node.IHTMLDOMNode_iface);
- init_css_style(&style->css_style, nsstyle, &HTMLStyle_dispex, dispex_compat_mode(&elem->node.event_target.dispex)); + init_css_style(&style->css_style, nsstyle, &HTMLStyle_dispex, &elem->node.event_target.dispex); nsIDOMCSSStyleDeclaration_Release(nsstyle);
*ret = style; @@ -9775,14 +9775,14 @@ static dispex_static_data_t HTMLW3CComputedStyle_dispex = { CSSStyle_init_dispex_info };
-HRESULT create_computed_style(nsIDOMCSSStyleDeclaration *nsstyle, compat_mode_t compat_mode, IHTMLCSSStyleDeclaration **p) +HRESULT create_computed_style(nsIDOMCSSStyleDeclaration *nsstyle, DispatchEx *owner, IHTMLCSSStyleDeclaration **p) { CSSStyle *style;
if(!(style = calloc(1, sizeof(*style)))) return E_OUTOFMEMORY;
- init_css_style(style, nsstyle, &HTMLW3CComputedStyle_dispex, compat_mode); + init_css_style(style, nsstyle, &HTMLW3CComputedStyle_dispex, owner); *p = &style->IHTMLCSSStyleDeclaration_iface; return S_OK; } diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h index 66509147836..b37daf95fa6 100644 --- a/dlls/mshtml/htmlstyle.h +++ b/dlls/mshtml/htmlstyle.h @@ -150,8 +150,8 @@ typedef enum { } styleid_t;
HRESULT HTMLStyle_Create(HTMLElement*,HTMLStyle**); -HRESULT create_computed_style(nsIDOMCSSStyleDeclaration*,compat_mode_t,IHTMLCSSStyleDeclaration**); -void init_css_style(CSSStyle*,nsIDOMCSSStyleDeclaration*,dispex_static_data_t*,compat_mode_t); +HRESULT create_computed_style(nsIDOMCSSStyleDeclaration*,DispatchEx*,IHTMLCSSStyleDeclaration**); +void init_css_style(CSSStyle*,nsIDOMCSSStyleDeclaration*,dispex_static_data_t*,DispatchEx*);
void *CSSStyle_query_interface(DispatchEx*,REFIID); void CSSStyle_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*); diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 445be60fba8..52201715af8 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -2429,7 +2429,7 @@ static HRESULT WINAPI HTMLWindow7_getComputedStyle(IHTMLWindow7 *iface, IHTMLDOM return S_OK; }
- hres = create_computed_style(nsstyle, dispex_compat_mode(&This->inner_window->event_target.dispex), p); + hres = create_computed_style(nsstyle, &This->inner_window->event_target.dispex, p); nsIDOMCSSStyleDeclaration_Release(nsstyle); return hres; } diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 5a40f39723c..95c033f46dd 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -295,7 +295,7 @@ sync_test("builtin_toString", function() { test("childNodes", document.body.childNodes, "NodeList"); if(clientRects) test("clientRect", clientRects[0], "ClientRect"); if(clientRects) test("clientRects", clientRects, "ClientRectList"); - if(currentStyle) test("currentStyle", currentStyle, "MSCurrentStyleCSSProperties", null, true); + if(currentStyle) test("currentStyle", currentStyle, "MSCurrentStyleCSSProperties"); if(v >= 11 /* todo_wine */) test("document", document, v < 11 ? "Document" : "HTMLDocument"); test("elements", document.getElementsByTagName("body"), "HTMLCollection"); test("history", window.history, "History"); @@ -310,7 +310,7 @@ sync_test("builtin_toString", function() { if(v >= 11 /* todo_wine */) test("plugins", window.navigator.plugins, v < 11 ? "MSPluginsCollection" : "PluginArray"); test("screen", window.screen, "Screen"); test("sessionStorage", window.sessionStorage, "Storage"); - test("style", document.body.style, "MSStyleCSSProperties", null, true); + test("style", document.body.style, "MSStyleCSSProperties"); test("styleSheet", sheet, "CSSStyleSheet"); test("styleSheetRule", sheet.rules[0], "CSSStyleRule"); test("styleSheetRules", sheet.rules, "MSCSSRuleList"); @@ -327,7 +327,7 @@ sync_test("builtin_toString", function() { test("selection", document.selection, "MSSelection"); } if(v >= 9) { - test("computedStyle", window.getComputedStyle(e), "CSSStyleDeclaration", null, true); + test("computedStyle", window.getComputedStyle(e), "CSSStyleDeclaration"); test("doctype", document.doctype, "DocumentType");
test("Event", document.createEvent("Event"), "Event");
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147458
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/mshtml/htmlcurstyle.c:1198 error: patch failed: dlls/mshtml/htmlstyle.c:2940 error: patch failed: dlls/mshtml/htmlstyle.h:150 error: patch failed: dlls/mshtml/htmlwindow.c:2429 error: patch failed: dlls/mshtml/tests/documentmode.js:295 Task: Patch failed to apply
=== debian11 (build log) ===
error: patch failed: dlls/mshtml/htmldoc.c:491 error: patch failed: dlls/mshtml/htmlelem.c:2611 error: patch failed: dlls/mshtml/htmlelemcol.c:60 error: patch failed: dlls/mshtml/htmlform.c:401 error: patch failed: dlls/mshtml/htmltable.c:693 error: patch failed: dlls/mshtml/mshtml_private.h:1300 error: patch failed: dlls/mshtml/tests/documentmode.js:297 error: patch failed: dlls/mshtml/htmldoc.c:4447 error: patch failed: dlls/mshtml/htmlelem.c:5964 error: patch failed: dlls/mshtml/htmlnode.c:338 error: patch failed: dlls/mshtml/mshtml_private.h:1302 error: patch failed: dlls/mshtml/tests/documentmode.js:292 error: patch failed: dlls/mshtml/htmldoc.c:1934 error: patch failed: dlls/mshtml/htmlstylesheet.c:690 error: patch failed: dlls/mshtml/mshtml_private.h:1176 error: patch failed: dlls/mshtml/tests/documentmode.js:314 error: patch failed: dlls/mshtml/htmldoc.c:2003 error: patch failed: dlls/mshtml/htmlstyleelem.c:150 error: patch failed: dlls/mshtml/htmlstylesheet.c:601 error: patch failed: dlls/mshtml/mshtml_private.h:1175 error: patch failed: dlls/mshtml/tests/documentmode.js:311 error: patch failed: dlls/mshtml/htmlstylesheet.c:313 error: patch failed: dlls/mshtml/tests/documentmode.js:313 error: patch failed: dlls/mshtml/htmlstylesheet.c:171 error: patch failed: dlls/mshtml/tests/documentmode.js:312 error: patch failed: dlls/mshtml/dispex.c:1021 error: patch failed: dlls/mshtml/mshtml_private.h:391 error: patch failed: dlls/mshtml/htmlcurstyle.c:1198 error: patch failed: dlls/mshtml/htmlstyle.c:2940 error: patch failed: dlls/mshtml/htmlstyle.h:150 error: patch failed: dlls/mshtml/htmlwindow.c:2429 error: patch failed: dlls/mshtml/tests/documentmode.js:295 Task: Patch failed to apply
=== debian11b (build log) ===
error: patch failed: dlls/mshtml/htmlcurstyle.c:1198 error: patch failed: dlls/mshtml/htmlstyle.c:2940 error: patch failed: dlls/mshtml/htmlstyle.h:150 error: patch failed: dlls/mshtml/htmlwindow.c:2429 error: patch failed: dlls/mshtml/tests/documentmode.js:295 Task: Patch failed to apply