From 2c389667295f014168a9b0bfa72a9511801eae15 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 19 Apr 2019 16:37:32 +0200 Subject: [PATCH] mshtml: Support VT_R8 in variant_to_nsstr. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/mshtml/nsembed.c | 15 +++++++++++++++ dlls/mshtml/tests/elements.js | 2 ++ dlls/mshtml/tests/style.c | 10 ++++++++++ 3 files changed, 27 insertions(+) diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index 08e65076893..35e9bf0208f 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -962,6 +962,21 @@ HRESULT variant_to_nsstr(VARIANT *v, BOOL hex_int, nsAString *nsstr) nsAString_Init(nsstr, buf); break; + case VT_R8: { + VARIANT strv; + HRESULT hres; + + V_VT(&strv) = VT_EMPTY; + hres = VariantChangeTypeEx(&strv, v, MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), + 0, VT_BSTR); + if(FAILED(hres)) + return hres; + + nsAString_Init(nsstr, V_BSTR(&strv)); + SysFreeString(V_BSTR(&strv)); + break; + } + default: FIXME("not implemented for %s\n", debugstr_variant(v)); return E_NOTIMPL; diff --git a/dlls/mshtml/tests/elements.js b/dlls/mshtml/tests/elements.js index 4f0c80284d0..320a2f68755 100644 --- a/dlls/mshtml/tests/elements.js +++ b/dlls/mshtml/tests/elements.js @@ -81,6 +81,8 @@ function test_textContent() { ok(div.textContent === "", "div.textContent = " + div.textContent); div.textContent = 11; ok(div.textContent === "11", "div.textContent = " + div.textContent); + div.textContent = 10.5; + ok(div.textContent === "10.5", "div.textContent = " + div.textContent); ok(document.textContent === null, "document.textContent = " + document.textContent); diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c index a7b4506e7f6..52a3a5ccdff 100644 --- a/dlls/mshtml/tests/style.c +++ b/dlls/mshtml/tests/style.c @@ -852,6 +852,16 @@ static void test_css_style_declaration(IHTMLCSSStyleDeclaration *css_style) test_var_bstr(&v, "0"); VariantClear(&v); + V_VT(&v) = VT_R8; + V_R8(&v) = 0.5; + hres = IHTMLCSSStyleDeclaration_put_opacity(css_style, v); + ok(hres == S_OK, "put_opacity failed: %08x\n", hres); + + hres = IHTMLCSSStyleDeclaration_get_opacity(css_style, &v); + ok(hres == S_OK, "get_opacity failed: %08x\n", hres); + test_var_bstr(&v, "0.5"); + VariantClear(&v); + V_VT(&v) = VT_BSTR; V_BSTR(&v) = a2bstr("1"); hres = IHTMLCSSStyleDeclaration_put_opacity(css_style, v);