Jacek Caban : mshtml: Expose IHTMLStyleElement2 to scripts.

Alexandre Julliard julliard at winehq.org
Mon Apr 5 16:28:25 CDT 2021


Module: wine
Branch: master
Commit: 4cd257d54d7ee11c7b1e7ce89502ba3c4d11c513
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4cd257d54d7ee11c7b1e7ce89502ba3c4d11c513

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Apr  5 16:05:19 2021 +0200

mshtml: Expose IHTMLStyleElement2 to scripts.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/htmlstyleelem.c       | 21 +++++++++++++++++++--
 dlls/mshtml/tests/documentmode.js |  9 +++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/htmlstyleelem.c b/dlls/mshtml/htmlstyleelem.c
index 9108cc4ca8b..538e79f0b5e 100644
--- a/dlls/mshtml/htmlstyleelem.c
+++ b/dlls/mshtml/htmlstyleelem.c
@@ -30,6 +30,7 @@
 #include "wine/debug.h"
 
 #include "mshtml_private.h"
+#include "mshtmdid.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
@@ -420,6 +421,23 @@ static void HTMLStyleElement_unlink(HTMLDOMNode *iface)
     }
 }
 
+static void HTMLStyleElement_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
+{
+    static const dispex_hook_t ie11_hooks[] = {
+        {DISPID_IHTMLSTYLEELEMENT_READYSTATE, NULL},
+        {DISPID_IHTMLSTYLEELEMENT_STYLESHEET, NULL},
+        {DISPID_UNKNOWN}
+    };
+
+    HTMLElement_init_dispex_info(info, mode);
+
+    dispex_info_add_interface(info, IHTMLStyleElement_tid,
+                              mode >= COMPAT_MODE_IE11 ? ie11_hooks : NULL);
+
+    if(mode >= COMPAT_MODE_IE9)
+        dispex_info_add_interface(info, IHTMLStyleElement2_tid, NULL);
+}
+
 static const NodeImplVtbl HTMLStyleElementImplVtbl = {
     &CLSID_HTMLStyleElement,
     HTMLStyleElement_QI,
@@ -442,14 +460,13 @@ static const NodeImplVtbl HTMLStyleElementImplVtbl = {
 
 static const tid_t HTMLStyleElement_iface_tids[] = {
     HTMLELEMENT_TIDS,
-    IHTMLStyleElement_tid,
     0
 };
 static dispex_static_data_t HTMLStyleElement_dispex = {
     NULL,
     DispHTMLStyleElement_tid,
     HTMLStyleElement_iface_tids,
-    HTMLElement_init_dispex_info
+    HTMLStyleElement_init_dispex_info
 };
 
 HRESULT HTMLStyleElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js
index f02840a1ff3..a8bcc611083 100644
--- a/dlls/mshtml/tests/documentmode.js
+++ b/dlls/mshtml/tests/documentmode.js
@@ -45,6 +45,15 @@ sync_test("elem_props", function() {
     test_exposed("dispatchEvent", v >= 9);
     test_exposed("msSetPointerCapture", v >= 10);
     if (v >= 9) test_exposed("spellcheck", v >= 10);
+
+    elem = document.createElement("style");
+    test_exposed("media", true);
+    test_exposed("type", true);
+    test_exposed("disabled", true);
+    test_exposed("media", true);
+    test_exposed("sheet", v >= 9);
+    test_exposed("readyState", v < 11);
+    test_exposed("styleSheet", v < 11);
 });
 
 sync_test("doc_props", function() {




More information about the wine-cvs mailing list