From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlstyle.c | 42 +++++++++++++++++++++++-------- dlls/mshtml/htmlstyle.h | 1 + dlls/mshtml/tests/documentmode.js | 2 ++ dlls/mshtml/tests/dom.js | 14 +++++++++++ 4 files changed, 49 insertions(+), 10 deletions(-)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index 5e278a8808d..a1df442115c 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -119,6 +119,12 @@ typedef struct { } style_tbl_entry_t;
static const style_tbl_entry_t style_tbl[] = { + { + L"-ms-transition", + DISPID_IHTMLCSSSTYLEDECLARATION2_MSTRANSITION, + DISPID_UNKNOWN, + ATTR_COMPAT_IE10 + }, { L"animation", DISPID_IHTMLCSSSTYLEDECLARATION2_ANIMATION, @@ -702,6 +708,18 @@ static const style_tbl_entry_t style_tbl[] = {
C_ASSERT(ARRAY_SIZE(style_tbl) == STYLEID_MAX_VALUE);
+static const WCHAR *get_style_nsname(const style_tbl_entry_t *style_entry) +{ + if(style_entry->name[0] == '-') + return style_entry->name + sizeof("-ms-")-1; + return style_entry->name; +} + +static const WCHAR *get_style_prop_nsname(const style_tbl_entry_t *style_entry, const WCHAR *orig_name) +{ + return style_entry ? get_style_nsname(style_entry) : orig_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; @@ -788,7 +806,7 @@ static HRESULT set_nsstyle_property(nsIDOMCSSStyleDeclaration *nsstyle, styleid_ nsAString str_name, str_empty; nsresult nsres;
- nsAString_InitDepend(&str_name, style_tbl[sid].name); + nsAString_InitDepend(&str_name, get_style_nsname(&style_tbl[sid])); nsAString_InitDepend(&str_empty, L""); nsres = nsIDOMCSSStyleDeclaration_SetProperty(nsstyle, &str_name, value, &str_empty); nsAString_Finish(&str_name); @@ -867,7 +885,7 @@ static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, stylei nsAString str_name; nsresult nsres;
- nsAString_InitDepend(&str_name, style_tbl[sid].name); + nsAString_InitDepend(&str_name, get_style_nsname(&style_tbl[sid])); nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value); nsAString_Finish(&str_name); if(NS_FAILED(nsres)) @@ -2946,7 +2964,7 @@ static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttri return S_OK; }
- nsAString_InitDepend(&name_str, style_entry->name); + nsAString_InitDepend(&name_str, get_style_nsname(style_entry)); nsAString_Init(&ret_str, NULL); nsres = nsIDOMCSSStyleDeclaration_RemoveProperty(This->css_style.nsstyle, &name_str, &ret_str); if(NS_SUCCEEDED(nsres)) { @@ -4443,7 +4461,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_getPropertyValue(IHTMLCSSStyleDecl TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), value);
style_entry = lookup_style_tbl(This, name); - nsAString_InitDepend(&name_str, style_entry ? style_entry->name : name); + nsAString_InitDepend(&name_str, get_style_prop_nsname(style_entry, name)); nsAString_InitDepend(&value_str, NULL); nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(This->nsstyle, &name_str, &value_str); nsAString_Finish(&name_str); @@ -4467,7 +4485,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_removeProperty(IHTMLCSSStyleDeclar TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrPropertyName), pbstrPropertyValue);
style_entry = lookup_style_tbl(This, bstrPropertyName); - nsAString_InitDepend(&name_str, style_entry ? style_entry->name : bstrPropertyName); + nsAString_InitDepend(&name_str, get_style_prop_nsname(style_entry, bstrPropertyName)); nsAString_Init(&ret_str, NULL); nsres = nsIDOMCSSStyleDeclaration_RemoveProperty(This->nsstyle, &name_str, &ret_str); nsAString_Finish(&name_str); @@ -4500,7 +4518,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_setProperty(IHTMLCSSStyleDeclarati nsAString_InitDepend(&priority_str, NULL); }
- nsAString_InitDepend(&name_str, style_entry ? style_entry->name : name); + nsAString_InitDepend(&name_str, get_style_prop_nsname(style_entry, name)); nsres = nsIDOMCSSStyleDeclaration_SetProperty(This->nsstyle, &name_str, &value_str, &priority_str); nsAString_Finish(&name_str); nsAString_Finish(&value_str); @@ -8760,15 +8778,19 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration2_get_msTransitionDelay(IHTMLCSSSty static HRESULT WINAPI HTMLCSSStyleDeclaration2_put_msTransition(IHTMLCSSStyleDeclaration2 *iface, BSTR v) { CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration2(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + return set_style_property(This, STYLEID_MSTRANSITION, v); }
static HRESULT WINAPI HTMLCSSStyleDeclaration2_get_msTransition(IHTMLCSSStyleDeclaration2 *iface, BSTR *p) { CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration2(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_style_property(This, STYLEID_MSTRANSITION, p); }
static HRESULT WINAPI HTMLCSSStyleDeclaration2_put_msTouchAction(IHTMLCSSStyleDeclaration2 *iface, BSTR v) diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h index 0818e555cb9..47b006a9105 100644 --- a/dlls/mshtml/htmlstyle.h +++ b/dlls/mshtml/htmlstyle.h @@ -40,6 +40,7 @@ struct HTMLStyle {
/* NOTE: Make sure to keep in sync with style_tbl in htmlstyle.c */ typedef enum { + STYLEID_MSTRANSITION, STYLEID_ANIMATION, STYLEID_ANIMATION_NAME, STYLEID_BACKGROUND, diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 6cc4edf0c63..16f2056ba93 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -693,7 +693,9 @@ sync_test("style_props", function() { test_exposed("removeProperty", v >= 9, v >= 9, v >= 9); test_exposed("background-clip", v >= 9, v >= 9, v >= 9); test_exposed("msTransform", v >= 9, v >= 9, v >= 9); + test_exposed("msTransition", v >= 10, v >= 10, v >= 10); test_exposed("transform", v >= 10, v >= 10, v >= 10); + test_exposed("transition", v >= 10, v >= 10, v >= 10); });
sync_test("createElement_inline_attr", function() { diff --git a/dlls/mshtml/tests/dom.js b/dlls/mshtml/tests/dom.js index 63baf691d43..2199829a6d9 100644 --- a/dlls/mshtml/tests/dom.js +++ b/dlls/mshtml/tests/dom.js @@ -472,6 +472,20 @@ sync_test("style_properties", function() { ok(computed_style.zIndex === 4, "computed_style.zIndex = " + computed_style.zIndex);
window.getComputedStyle(elem, null); + + /* ms* prefixed styles alias */ + var list = [ + [ "transition", "background-color 0.5s linear 0.1s" ] + ]; + for(var i = 0; i < list.length; i++) { + var s = list[i][0], v = list[i][1], ms = "ms" + s[0].toUpperCase() + s.substring(1); + style[s] = v; + ok(style[s] === v, "style." + s + " = " + style[s] + ", expected " + v); + ok(style[ms] === v, "style." + ms + " = " + style[ms] + ", expected " + v); + elem.style[ms] = v; + ok(elem.style[s] === v, "elem.style." + s + " = " + elem.style[s] + ", expected " + v); + ok(elem.style[ms] === v, "elem.style." + ms + " = " + elem.style[ms] + ", expected " + v); + } });
sync_test("stylesheets", function() {