mshtml: Expose getComputedStyle to scripts.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Jacek Caban 2019-03-27 18:52:27 +01:00 committed by Alexandre Julliard
parent 0893932970
commit 3886fa60e0
3 changed files with 34 additions and 7 deletions

View File

@ -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);
}

View File

@ -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();
}

View File

@ -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();
}