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]");