Jacek Caban : mshtml: Expose IHTMLCSSStyleDeclaration to scripts from current style object.

Alexandre Julliard julliard at winehq.org
Tue Mar 26 16:43:15 CDT 2019


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Mar 26 17:27:16 2019 +0100

mshtml: Expose IHTMLCSSStyleDeclaration to scripts from current style object.

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

---

 dlls/mshtml/htmlcurstyle.c        |  5 +++--
 dlls/mshtml/htmlstyle.c           | 12 ++++++------
 dlls/mshtml/htmlstyle.h           |  3 +++
 dlls/mshtml/tests/documentmode.js | 15 +++++++++++++++
 dlls/mshtml/tests/elements.js     |  6 ++++++
 5 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/dlls/mshtml/htmlcurstyle.c b/dlls/mshtml/htmlcurstyle.c
index 63e8a25..85ac99a 100644
--- a/dlls/mshtml/htmlcurstyle.c
+++ b/dlls/mshtml/htmlcurstyle.c
@@ -1301,9 +1301,10 @@ static const tid_t HTMLCurrentStyle_iface_tids[] = {
     0
 };
 static dispex_static_data_t HTMLCurrentStyle_dispex = {
-    NULL,
+    &CSSStyle_dispex_vtbl,
     DispHTMLCurrentStyle_tid,
-    HTMLCurrentStyle_iface_tids
+    HTMLCurrentStyle_iface_tids,
+    CSSStyle_init_dispex_info
 };
 
 HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index f885cec..584ac59 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -10128,7 +10128,7 @@ static const IHTMLCSSStyleDeclaration2Vtbl HTMLCSSStyleDeclaration2Vtbl = {
     HTMLCSSStyleDeclaration2_get_animationFillMode
 };
 
-static HRESULT HTMLStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
+static HRESULT CSSStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
 {
     const style_tbl_entry_t *style_entry;
 
@@ -10146,15 +10146,15 @@ static HRESULT HTMLStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags,
     return DISP_E_UNKNOWNNAME;
 }
 
-static void HTMLStyle_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
+void CSSStyle_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
 {
     if(mode >= COMPAT_MODE_IE9)
         dispex_info_add_interface(info, IHTMLCSSStyleDeclaration_tid, NULL);
 }
 
-static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl = {
+const dispex_static_data_vtbl_t CSSStyle_dispex_vtbl = {
     NULL,
-    HTMLStyle_get_dispid,
+    CSSStyle_get_dispid,
     NULL,
     NULL
 };
@@ -10169,10 +10169,10 @@ static const tid_t HTMLStyle_iface_tids[] = {
     0
 };
 static dispex_static_data_t HTMLStyle_dispex = {
-    &HTMLStyle_dispex_vtbl,
+    &CSSStyle_dispex_vtbl,
     DispHTMLStyle_tid,
     HTMLStyle_iface_tids,
-    HTMLStyle_init_dispex_info
+    CSSStyle_init_dispex_info
 };
 
 static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration **ret)
diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h
index bb92a00..2c4b76b 100644
--- a/dlls/mshtml/htmlstyle.h
+++ b/dlls/mshtml/htmlstyle.h
@@ -140,6 +140,9 @@ HRESULT HTMLStyle_Create(HTMLElement*,HTMLStyle**) DECLSPEC_HIDDEN;
 void init_css_style(CSSStyle*,nsIDOMCSSStyleDeclaration*,style_qi_t,
                     dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
 
+void CSSStyle_init_dispex_info(dispex_data_t *info, compat_mode_t mode) DECLSPEC_HIDDEN;
+const dispex_static_data_vtbl_t CSSStyle_dispex_vtbl DECLSPEC_HIDDEN;
+
 HRESULT get_style_property(CSSStyle*,styleid_t,BSTR*) DECLSPEC_HIDDEN;
 HRESULT get_style_property_var(CSSStyle*,styleid_t,VARIANT*) DECLSPEC_HIDDEN;
 
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js
index 1cbf13e..63dad76 100644
--- a/dlls/mshtml/tests/documentmode.js
+++ b/dlls/mshtml/tests/documentmode.js
@@ -98,6 +98,8 @@ function test_window_props() {
     var v = document.documentMode;
 
     test_exposed("postMessage", true);
+    test_exposed("sessionStorage", true);
+    test_exposed("localStorage", true);
     test_exposed("addEventListener", v >= 9);
     test_exposed("removeEventListener", v >= 9);
     test_exposed("dispatchEvent", v >= 9);
@@ -152,6 +154,19 @@ function test_style_props() {
     test_exposed("removeProperty", v >= 9);
     test_exposed("background-clip", v >= 9);
 
+    style = document.body.currentStyle;
+
+    test_exposed("zIndex", true);
+    test_exposed("z-index", true);
+    test_exposed("filter", true);
+    test_exposed("pixelTop", false);
+    test_exposed("float", true);
+    test_exposed("css-float", false);
+    test_exposed("style-float", false);
+    test_exposed("setProperty", v >= 9);
+    test_exposed("removeProperty", v >= 9);
+    test_exposed("background-clip", v >= 9);
+
     next_test();
 }
 
diff --git a/dlls/mshtml/tests/elements.js b/dlls/mshtml/tests/elements.js
index 188a277..47a8dcc 100644
--- a/dlls/mshtml/tests/elements.js
+++ b/dlls/mshtml/tests/elements.js
@@ -234,6 +234,7 @@ function test_document_owner() {
 
 function test_style_properties() {
     var style = document.body.style;
+    var current_style = document.body.currentStyle;
     var val;
 
     style.cssFloat = "left";
@@ -295,6 +296,11 @@ function test_style_properties() {
     style.setProperty("border-width", "8px", undefined);
     ok(style.borderWidth === "7px", "style.borderWidth = " + style.borderWidth);
 
+    style.clip = "rect(1px 1px 10px 10px)";
+    ok(style.clip === "rect(1px, 1px, 10px, 10px)", "style.clip = " + style.clip);
+    ok(current_style.clip === "rect(1px, 1px, 10px, 10px)",
+       "current_style.clip = " + current_style.clip);
+
     next_test();
 }
 




More information about the wine-cvs mailing list