Jacek Caban : mshtml: Expose IHTMLCSSStyleDeclaration interface to scripts.
Alexandre Julliard
julliard at winehq.org
Wed Sep 12 16:40:34 CDT 2018
Module: wine
Branch: master
Commit: 2e6598dc39d7f94e394598f6ceebe07f02e65e6d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=2e6598dc39d7f94e394598f6ceebe07f02e65e6d
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Sep 12 21:15:53 2018 +0200
mshtml: Expose IHTMLCSSStyleDeclaration interface to scripts.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mshtml/htmlstyle.c | 9 ++++++++-
dlls/mshtml/tests/documentmode.js | 27 +++++++++++++++++++++++++++
dlls/mshtml/tests/elements.js | 37 ++++++++++++++++++++++++++++++++++++-
3 files changed, 71 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 0c95951..bb62aec 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -9668,6 +9668,12 @@ static HRESULT HTMLStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags,
return DISP_E_UNKNOWNNAME;
}
+void HTMLStyle_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 = {
NULL,
HTMLStyle_get_dispid,
@@ -9687,7 +9693,8 @@ static const tid_t HTMLStyle_iface_tids[] = {
static dispex_static_data_t HTMLStyle_dispex = {
&HTMLStyle_dispex_vtbl,
DispHTMLStyle_tid,
- HTMLStyle_iface_tids
+ HTMLStyle_iface_tids,
+ HTMLStyle_init_dispex_info
};
static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration **ret)
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js
index 6ab301f..e8db6c2 100644
--- a/dlls/mshtml/tests/documentmode.js
+++ b/dlls/mshtml/tests/documentmode.js
@@ -128,6 +128,32 @@ function test_xhr_props() {
next_test();
}
+function test_style_props() {
+ var style = document.body.style;
+
+ function test_exposed(prop, expect) {
+ if(expect)
+ ok(prop in style, prop + " not found in style object.");
+ else
+ ok(!(prop in style), prop + " found in style object.");
+ }
+
+ var v = document.documentMode;
+
+ test_exposed("removeAttribute", true);
+ test_exposed("zIndex", true);
+ test_exposed("z-index", true);
+ test_exposed("filter", true);
+ test_exposed("pixelTop", true);
+ test_exposed("float", true);
+ test_exposed("css-float", false);
+ test_exposed("style-float", false);
+ test_exposed("setProperty", v >= 9);
+ test_exposed("removeProperty", v >= 9);
+
+ next_test();
+}
+
function test_javascript() {
var g = window;
@@ -270,6 +296,7 @@ var tests = [
test_window_props,
test_javascript,
test_xhr_props,
+ test_style_props,
test_elem_by_id,
test_conditional_comments
];
diff --git a/dlls/mshtml/tests/elements.js b/dlls/mshtml/tests/elements.js
index 53fdeab..50f19e5 100644
--- a/dlls/mshtml/tests/elements.js
+++ b/dlls/mshtml/tests/elements.js
@@ -208,6 +208,40 @@ function test_document_owner() {
next_test();
}
+function test_style_properties() {
+ var style = document.body.style;
+ var val;
+
+ style.cssFloat = "left";
+ ok(style.cssFloat === "left", "cssFloat = " + style.cssFloat);
+
+ val = style.removeProperty("float");
+ ok(val === "left", "removeProperty() returned " + val);
+ ok(style.cssFloat === "", "cssFloat = " + style.cssFloat);
+
+ style.cssFloat = "left";
+ val = style.removeProperty("FloaT");
+ ok(val === "left", "removeProperty() returned " + val);
+ ok(style.cssFloat === "", "cssFloat = " + style.cssFloat);
+
+ style.cssFloat = "left";
+ val = style.removeProperty("cssFloat");
+ ok(val === "", "removeProperty() returned " + val);
+ ok(style.cssFloat === "left", "cssFloat = " + style.cssFloat);
+ ok(style["float"] === "left", "float = " + style["float"]);
+
+ style.testVal = "test";
+ val = style.removeProperty("testVal");
+ ok(val === "", "removeProperty() returned " + val);
+ ok(style.testVal === "test", "testVal = " + style.testVal);
+
+ style["z-index"] = 1;
+ ok(style.zIndex === 1, "zIndex = " + style.zIndex);
+ ok(style["z-index"] === 1, "z-index = " + style["z-index"]);
+
+ next_test();
+}
+
var tests = [
test_input_selection,
test_textContent,
@@ -217,5 +251,6 @@ var tests = [
test_iframe,
test_query_selector,
test_compare_position,
- test_document_owner
+ test_document_owner,
+ test_style_properties
];
More information about the wine-cvs
mailing list