Jacek Caban : mshtml: Added support for non-pixel style values in IHTMLStyle:: get_pixel* functions.

Alexandre Julliard julliard at winehq.org
Fri Oct 7 14:46:47 CDT 2016


Module: wine
Branch: master
Commit: 1dedd90e8c56ff61772915d575a43ad6c95813cd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1dedd90e8c56ff61772915d575a43ad6c95813cd

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Oct  7 18:13:59 2016 +0200

mshtml: Added support for non-pixel style values in IHTMLStyle::get_pixel* functions.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/htmlstyle.c   | 11 +++--------
 dlls/mshtml/tests/style.c | 27 +++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index a445bc2..72fc1d3 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -700,7 +700,7 @@ static HRESULT get_nsstyle_pixel_val(HTMLStyle *This, styleid_t sid, LONG *p)
 
     hres = get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
     if(hres == S_OK) {
-        WCHAR *ptr;
+        WCHAR *ptr = NULL;
         const PRUnichar *value;
 
         nsAString_GetData(&str_value, &value);
@@ -711,15 +711,10 @@ static HRESULT get_nsstyle_pixel_val(HTMLStyle *This, styleid_t sid, LONG *p)
                 /* Skip all digits. We have tests showing that we should not round the value. */
                 while(isdigitW(*++ptr));
             }
+        }
 
-            if(*ptr && strcmpW(ptr, pxW)) {
-                nsAString_Finish(&str_value);
-                FIXME("%s: only px values are currently supported\n", debugstr_w(value));
-                hres = E_NOTIMPL;
-            }
-        }else {
+        if(!ptr || (*ptr && strcmpW(ptr, pxW)))
             *p = 0;
-        }
     }
 
     nsAString_Finish(&str_value);
diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c
index 7053a09..57207de 100644
--- a/dlls/mshtml/tests/style.c
+++ b/dlls/mshtml/tests/style.c
@@ -1099,6 +1099,11 @@ static void test_body_style(IHTMLStyle *style)
     ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
     VariantClear(&v);
 
+    l = 0xdeadbeef;
+    hres = IHTMLStyle_get_pixelWidth(style, &l);
+    ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
+    ok(!l, "pixelWidth = %d\n", l);
+
     V_VT(&v) = VT_I4;
     V_I4(&v) = 100;
     hres = IHTMLStyle_put_width(style, v);
@@ -1361,6 +1366,17 @@ static void test_body_style(IHTMLStyle *style)
     ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
     ok(l == 3, "pixelTop = %d\n", l);
 
+    V_VT(&v) = VT_BSTR;
+    V_BSTR(&v) = a2bstr("100%");
+    hres = IHTMLStyle_put_top(style, v);
+    ok(hres == S_OK, "put_top failed: %08x\n", hres);
+    VariantClear(&v);
+
+    l = 0xdeadbeef;
+    hres = IHTMLStyle_get_pixelTop(style, &l);
+    ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
+    ok(!l, "pixelTop = %d\n", l);
+
     V_VT(&v) = VT_NULL;
     hres = IHTMLStyle_put_top(style, v);
     ok(hres == S_OK, "put_top failed: %08x\n", hres);
@@ -1433,6 +1449,17 @@ static void test_body_style(IHTMLStyle *style)
     ok(l == 70, "pixelHeight = %d\n", l);
 
     V_VT(&v) = VT_BSTR;
+    V_BSTR(&v) = a2bstr("50%");
+    hres = IHTMLStyle_put_height(style, v);
+    ok(hres == S_OK, "put_height failed: %08x\n", hres);
+    VariantClear(&v);
+
+    l = 0xdeadbeef;
+    hres = IHTMLStyle_get_pixelHeight(style, &l);
+    ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
+    ok(!l, "pixelHeight = %d\n", l);
+
+    V_VT(&v) = VT_BSTR;
     V_BSTR(&v) = NULL;
     hres = IHTMLStyle_put_height(style, v);
     ok(hres == S_OK, "put_height failed: %08x\n", hres);




More information about the wine-cvs mailing list