mshtml: Expose IHTMLCSSStyleDeclaration to scripts from current style object.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-03-26 17:27:16 +01:00 committed by Alexandre Julliard
parent 9d35d09e89
commit 2cd8ff3751
5 changed files with 33 additions and 8 deletions

View File

@ -1301,9 +1301,10 @@ static const tid_t HTMLCurrentStyle_iface_tids[] = {
0 0
}; };
static dispex_static_data_t HTMLCurrentStyle_dispex = { static dispex_static_data_t HTMLCurrentStyle_dispex = {
NULL, &CSSStyle_dispex_vtbl,
DispHTMLCurrentStyle_tid, DispHTMLCurrentStyle_tid,
HTMLCurrentStyle_iface_tids HTMLCurrentStyle_iface_tids,
CSSStyle_init_dispex_info
}; };
HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p) HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p)

View File

@ -10128,7 +10128,7 @@ static const IHTMLCSSStyleDeclaration2Vtbl HTMLCSSStyleDeclaration2Vtbl = {
HTMLCSSStyleDeclaration2_get_animationFillMode 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; 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; 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) if(mode >= COMPAT_MODE_IE9)
dispex_info_add_interface(info, IHTMLCSSStyleDeclaration_tid, NULL); 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, NULL,
HTMLStyle_get_dispid, CSSStyle_get_dispid,
NULL, NULL,
NULL NULL
}; };
@ -10169,10 +10169,10 @@ static const tid_t HTMLStyle_iface_tids[] = {
0 0
}; };
static dispex_static_data_t HTMLStyle_dispex = { static dispex_static_data_t HTMLStyle_dispex = {
&HTMLStyle_dispex_vtbl, &CSSStyle_dispex_vtbl,
DispHTMLStyle_tid, DispHTMLStyle_tid,
HTMLStyle_iface_tids, HTMLStyle_iface_tids,
HTMLStyle_init_dispex_info CSSStyle_init_dispex_info
}; };
static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration **ret) static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration **ret)

View File

@ -140,6 +140,9 @@ HRESULT HTMLStyle_Create(HTMLElement*,HTMLStyle**) DECLSPEC_HIDDEN;
void init_css_style(CSSStyle*,nsIDOMCSSStyleDeclaration*,style_qi_t, void init_css_style(CSSStyle*,nsIDOMCSSStyleDeclaration*,style_qi_t,
dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN; 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(CSSStyle*,styleid_t,BSTR*) DECLSPEC_HIDDEN;
HRESULT get_style_property_var(CSSStyle*,styleid_t,VARIANT*) DECLSPEC_HIDDEN; HRESULT get_style_property_var(CSSStyle*,styleid_t,VARIANT*) DECLSPEC_HIDDEN;

View File

@ -98,6 +98,8 @@ function test_window_props() {
var v = document.documentMode; var v = document.documentMode;
test_exposed("postMessage", true); test_exposed("postMessage", true);
test_exposed("sessionStorage", true);
test_exposed("localStorage", true);
test_exposed("addEventListener", v >= 9); test_exposed("addEventListener", v >= 9);
test_exposed("removeEventListener", v >= 9); test_exposed("removeEventListener", v >= 9);
test_exposed("dispatchEvent", v >= 9); test_exposed("dispatchEvent", v >= 9);
@ -152,6 +154,19 @@ function test_style_props() {
test_exposed("removeProperty", v >= 9); test_exposed("removeProperty", v >= 9);
test_exposed("background-clip", 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(); next_test();
} }

View File

@ -234,6 +234,7 @@ function test_document_owner() {
function test_style_properties() { function test_style_properties() {
var style = document.body.style; var style = document.body.style;
var current_style = document.body.currentStyle;
var val; var val;
style.cssFloat = "left"; style.cssFloat = "left";
@ -295,6 +296,11 @@ function test_style_properties() {
style.setProperty("border-width", "8px", undefined); style.setProperty("border-width", "8px", undefined);
ok(style.borderWidth === "7px", "style.borderWidth = " + style.borderWidth); 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(); next_test();
} }