Jacek Caban : mshtml: Expose getComputedStyle to scripts.
Alexandre Julliard
julliard at winehq.org
Wed Mar 27 17:27:37 CDT 2019
Module: wine
Branch: master
Commit: 3886fa60e0fceff3f1f439445fdd886997a26985
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3886fa60e0fceff3f1f439445fdd886997a26985
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Mar 27 18:52:27 2019 +0100
mshtml: Expose getComputedStyle to scripts.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mshtml/htmlwindow.c | 8 +-------
dlls/mshtml/tests/documentmode.js | 16 ++++++++++++++++
dlls/mshtml/tests/elements.js | 17 +++++++++++++++++
3 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 55c03df..a2aa90a 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -3499,14 +3499,8 @@ static void HTMLWindow_bind_event(DispatchEx *dispex, eventid_t eid)
static void HTMLWindow_init_dispex_info(dispex_data_t *info, compat_mode_t compat_mode)
{
- /* FIXME: Expose getComputedStyle once it's implemented.
- * Stubs break existing web sites. */
- static const dispex_hook_t window7_hooks[] = {
- {DISPID_IHTMLWINDOW7_GETCOMPUTEDSTYLE, NULL},
- {DISPID_UNKNOWN}
- };
if(compat_mode >= COMPAT_MODE_IE9)
- dispex_info_add_interface(info, IHTMLWindow7_tid, window7_hooks);
+ dispex_info_add_interface(info, IHTMLWindow7_tid, NULL);
dispex_info_add_interface(info, IHTMLWindow5_tid, NULL);
EventTarget_init_dispex_info(info, compat_mode);
}
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js
index 63dad76..aa60cd4 100644
--- a/dlls/mshtml/tests/documentmode.js
+++ b/dlls/mshtml/tests/documentmode.js
@@ -105,6 +105,7 @@ function test_window_props() {
test_exposed("dispatchEvent", v >= 9);
test_exposed("getSelection", v >= 9);
test_exposed("onfocusout", v >= 9);
+ test_exposed("getComputedStyle", v >= 9);
if(v >= 9) /* FIXME: native exposes it in all compat modes */
test_exposed("performance", true);
@@ -167,6 +168,21 @@ function test_style_props() {
test_exposed("removeProperty", v >= 9);
test_exposed("background-clip", v >= 9);
+ if(window.getComputedStyle) {
+ style = window.getComputedStyle(document.body);
+
+ test_exposed("removeAttribute", false);
+ test_exposed("zIndex", true);
+ test_exposed("z-index", 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 47a8dcc..1498e1f 100644
--- a/dlls/mshtml/tests/elements.js
+++ b/dlls/mshtml/tests/elements.js
@@ -235,6 +235,7 @@ function test_document_owner() {
function test_style_properties() {
var style = document.body.style;
var current_style = document.body.currentStyle;
+ var computed_style = window.getComputedStyle(document.body);
var val;
style.cssFloat = "left";
@@ -300,6 +301,22 @@ function test_style_properties() {
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);
+ ok(computed_style.clip === "rect(1px, 1px, 10px, 10px)",
+ "computed_style.clip = " + current_style.clip);
+
+ document.body.style.zIndex = 2;
+ ok(current_style.zIndex === 2, "current_style.zIndex = " + current_style.zIndex);
+ ok(computed_style.zIndex === 2, "computed_style.zIndex = " + computed_style.zIndex);
+
+ try {
+ current_style.zIndex = 1;
+ ok(false, "expected exception");
+ }catch(e) {}
+
+ try {
+ computed_style.zIndex = 1;
+ ok(false, "expected exception");
+ }catch(e) {}
next_test();
}
More information about the wine-cvs
mailing list