From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlstyle.c | 29 +++++++++++++++++++++++------ dlls/mshtml/htmlstyle.h | 1 + dlls/mshtml/tests/documentmode.js | 2 ++ dlls/mshtml/tests/dom.js | 14 ++++++++++++++ 4 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index def56f7aedb..cda3af595a5 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, @@ -783,12 +789,19 @@ static LPWSTR fix_url_value(LPCWSTR val) return ret; }
+static const WCHAR *skip_name_prefix(const WCHAR *name) +{ + if(name[0] == '-') + name += sizeof("-ms-") - 1; + return name; +} + static HRESULT set_nsstyle_property(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, const nsAString *value) { nsAString str_name, str_empty; nsresult nsres;
- nsAString_InitDepend(&str_name, style_tbl[sid].name); + nsAString_InitDepend(&str_name, skip_name_prefix(style_tbl[sid].name)); nsAString_InitDepend(&str_empty, L""); nsres = nsIDOMCSSStyleDeclaration_SetProperty(nsstyle, &str_name, value, &str_empty); nsAString_Finish(&str_name); @@ -867,7 +880,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, skip_name_prefix(style_tbl[sid].name)); nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value); nsAString_Finish(&str_name); if(NS_FAILED(nsres)) @@ -8760,15 +8773,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 f6d5ea7c5bb..d3e9a2401bc 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 867130aec3d..422facdca18 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -683,7 +683,9 @@ sync_test("style_props", function() { test_exposed("removeProperty", v >= 9); test_exposed("background-clip", v >= 9); test_exposed("msTransform", v >= 9); + test_exposed("msTransition", v >= 10); test_exposed("transform", v >= 10); + test_exposed("transition", v >= 10);
style = document.body.currentStyle;
diff --git a/dlls/mshtml/tests/dom.js b/dlls/mshtml/tests/dom.js index 325cacf4823..5580e5e9cd4 100644 --- a/dlls/mshtml/tests/dom.js +++ b/dlls/mshtml/tests/dom.js @@ -458,6 +458,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() {