Commit 276accf5 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Expose IHTMLCSSStyleDeclaration2 to scripts.

parent dbc5dc89
......@@ -328,6 +328,7 @@ static const WCHAR *overflow_values[] = {
#define ATTR_HEX_INT 0x0008
#define ATTR_REMOVE_COMMA 0x0010
#define ATTR_NO_NULL 0x0020
#define ATTR_COMPAT_IE10 0x0040
static const WCHAR pxW[] = {'p','x',0};
......@@ -343,7 +344,8 @@ static const style_tbl_entry_t style_tbl[] = {
{
L"animation-name",
DISPID_IHTMLCSSSTYLEDECLARATION2_ANIMATIONNAME,
DISPID_UNKNOWN
DISPID_UNKNOWN,
ATTR_COMPAT_IE10
},
{
backgroundW,
......@@ -551,47 +553,56 @@ static const style_tbl_entry_t style_tbl[] = {
{
L"column-count",
DISPID_IHTMLCSSSTYLEDECLARATION2_COLUMNCOUNT,
DISPID_UNKNOWN
DISPID_UNKNOWN,
ATTR_COMPAT_IE10
},
{
L"column-fill",
DISPID_IHTMLCSSSTYLEDECLARATION2_COLUMNFILL,
DISPID_UNKNOWN
DISPID_UNKNOWN,
ATTR_COMPAT_IE10
},
{
L"column-gap",
DISPID_IHTMLCSSSTYLEDECLARATION2_COLUMNGAP,
DISPID_UNKNOWN
DISPID_UNKNOWN,
ATTR_COMPAT_IE10
},
{
L"column-rule",
DISPID_IHTMLCSSSTYLEDECLARATION2_COLUMNRULE,
DISPID_UNKNOWN
DISPID_UNKNOWN,
ATTR_COMPAT_IE10
},
{
L"column-rule-color",
DISPID_IHTMLCSSSTYLEDECLARATION2_COLUMNRULECOLOR,
DISPID_UNKNOWN
DISPID_UNKNOWN,
ATTR_COMPAT_IE10
},
{
L"column-rule-style",
DISPID_IHTMLCSSSTYLEDECLARATION2_COLUMNRULESTYLE,
DISPID_UNKNOWN
DISPID_UNKNOWN,
ATTR_COMPAT_IE10
},
{
L"column-rule-width",
DISPID_IHTMLCSSSTYLEDECLARATION2_COLUMNRULEWIDTH,
DISPID_UNKNOWN
DISPID_UNKNOWN,
ATTR_COMPAT_IE10
},
{
L"column-span",
DISPID_IHTMLCSSSTYLEDECLARATION2_COLUMNSPAN,
DISPID_UNKNOWN
DISPID_UNKNOWN,
ATTR_COMPAT_IE10
},
{
L"column-width",
DISPID_IHTMLCSSSTYLEDECLARATION2_COLUMNWIDTH,
DISPID_UNKNOWN
DISPID_UNKNOWN,
ATTR_COMPAT_IE10
},
{
cursorW,
......@@ -846,12 +857,14 @@ static const style_tbl_entry_t style_tbl[] = {
{
L"transform",
DISPID_IHTMLCSSSTYLEDECLARATION2_TRANSFORM,
DISPID_UNKNOWN
DISPID_UNKNOWN,
ATTR_COMPAT_IE10
},
{
L"transition",
DISPID_IHTMLCSSSTYLEDECLARATION2_TRANSITION,
DISPID_UNKNOWN
DISPID_UNKNOWN,
ATTR_COMPAT_IE10
},
{
vertical_alignW,
......@@ -898,7 +911,7 @@ C_ASSERT(ARRAY_SIZE(style_tbl) == STYLEID_MAX_VALUE);
static const WCHAR px_formatW[] = {'%','d','p','x',0};
static const WCHAR emptyW[] = {0};
static const style_tbl_entry_t *lookup_style_tbl(const WCHAR *name)
static const style_tbl_entry_t *lookup_style_tbl(CSSStyle *style, const WCHAR *name)
{
int c, i, min = 0, max = ARRAY_SIZE(style_tbl)-1;
......@@ -906,8 +919,11 @@ static const style_tbl_entry_t *lookup_style_tbl(const WCHAR *name)
i = (min+max)/2;
c = wcscmp(style_tbl[i].name, name);
if(!c)
if(!c) {
if((style_tbl[i].flags & ATTR_COMPAT_IE10) && dispex_compat_mode(&style->dispex) < COMPAT_MODE_IE10)
return NULL;
return style_tbl+i;
}
if(c > 0)
max = i-1;
......@@ -3175,7 +3191,7 @@ static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttri
TRACE("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName), lFlags, pfSuccess);
style_entry = lookup_style_tbl(strAttributeName);
style_entry = lookup_style_tbl(&This->css_style, strAttributeName);
if(!style_entry) {
compat_mode_t compat_mode = dispex_compat_mode(&This->css_style.dispex);
DISPID dispid;
......@@ -5037,7 +5053,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_getPropertyValue(IHTMLCSSStyleDecl
TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), value);
style_entry = lookup_style_tbl(name);
style_entry = lookup_style_tbl(This, name);
nsAString_InitDepend(&name_str, style_entry ? style_entry->name : name);
nsAString_InitDepend(&value_str, NULL);
nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(This->nsstyle, &name_str, &value_str);
......@@ -5061,7 +5077,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_removeProperty(IHTMLCSSStyleDeclar
TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrPropertyName), pbstrPropertyValue);
style_entry = lookup_style_tbl(bstrPropertyName);
style_entry = lookup_style_tbl(This, bstrPropertyName);
nsAString_InitDepend(&name_str, style_entry ? style_entry->name : bstrPropertyName);
nsAString_Init(&ret_str, NULL);
nsres = nsIDOMCSSStyleDeclaration_RemoveProperty(This->nsstyle, &name_str, &ret_str);
......@@ -5079,7 +5095,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_setProperty(IHTMLCSSStyleDeclarati
TRACE("(%p)->(%s %s %s)\n", This, debugstr_w(name), debugstr_variant(value), debugstr_variant(priority));
style_entry = lookup_style_tbl(name);
style_entry = lookup_style_tbl(This, name);
hres = var_to_styleval(This, value, style_entry, &value_str);
if(FAILED(hres))
return hres;
......@@ -10166,11 +10182,17 @@ static const IHTMLCSSStyleDeclaration2Vtbl HTMLCSSStyleDeclaration2Vtbl = {
HTMLCSSStyleDeclaration2_get_animationFillMode
};
static inline CSSStyle *impl_from_DispatchEx(DispatchEx *dispex)
{
return CONTAINING_RECORD(dispex, CSSStyle, dispex);
}
static HRESULT CSSStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
{
CSSStyle *This = impl_from_DispatchEx(dispex);
const style_tbl_entry_t *style_entry;
style_entry = lookup_style_tbl(name);
style_entry = lookup_style_tbl(This, name);
if(style_entry) {
DISPID id = dispex_compat_mode(dispex) >= COMPAT_MODE_IE9
? style_entry->dispid : style_entry->compat_dispid;
......@@ -10188,6 +10210,8 @@ 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);
if(mode >= COMPAT_MODE_IE10)
dispex_info_add_interface(info, IHTMLCSSStyleDeclaration2_tid, NULL);
}
const dispex_static_data_vtbl_t CSSStyle_dispex_vtbl = {
......
......@@ -154,6 +154,8 @@ function test_style_props() {
test_exposed("setProperty", v >= 9);
test_exposed("removeProperty", v >= 9);
test_exposed("background-clip", v >= 9);
test_exposed("msTransform", v >= 9);
test_exposed("transform", v >= 10);
style = document.body.currentStyle;
......@@ -167,6 +169,7 @@ function test_style_props() {
test_exposed("setProperty", v >= 9);
test_exposed("removeProperty", v >= 9);
test_exposed("background-clip", v >= 9);
test_exposed("transform", v >= 10);
if(window.getComputedStyle) {
style = window.getComputedStyle(document.body);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment