Jacek Caban : mshtml: Added IHTMLStyle::get_pixelLeft implementation.

Alexandre Julliard julliard at winehq.org
Mon Jan 7 13:42:22 CST 2013


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Jan  7 14:32:56 2013 +0100

mshtml: Added IHTMLStyle::get_pixelLeft implementation.

---

 dlls/mshtml/htmlstyle.c   |   40 +++++++++++++++++++++++++++++++++++++---
 dlls/mshtml/tests/style.c |   16 ++++++++++++++++
 2 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 95d7a88..2496077 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -180,6 +180,9 @@ static const WCHAR attrWordWrap[] =
 static const WCHAR attrZIndex[] =
     {'z','-','i','n','d','e','x',0};
 
+
+static const WCHAR pxW[] = {'p','x',0};
+
 typedef struct {
     const WCHAR *name;
     DISPID dispid;
@@ -612,7 +615,6 @@ static HRESULT get_nsstyle_pos(HTMLStyle *This, styleid_t sid, float *p)
 {
     nsAString str_value;
     HRESULT hres;
-    WCHAR pxW[] = {'p','x',0};
 
     TRACE("%p %d %p\n", This, sid, p);
 
@@ -647,6 +649,36 @@ static HRESULT get_nsstyle_pos(HTMLStyle *This, styleid_t sid, float *p)
     return hres;
 }
 
+static HRESULT get_nsstyle_pixel_val(HTMLStyle *This, styleid_t sid, LONG *p)
+{
+    nsAString str_value;
+    HRESULT hres;
+
+    nsAString_Init(&str_value, NULL);
+
+    hres = get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
+    if(hres == S_OK) {
+        WCHAR *ptr;
+        const PRUnichar *value;
+
+        nsAString_GetData(&str_value, &value);
+        if(value) {
+            *p = strtolW(value, &ptr, 10);
+
+            if(*ptr && strcmpW(ptr, pxW)) {
+                nsAString_Finish(&str_value);
+                FIXME("only px values are currently supported\n");
+                hres = E_NOTIMPL;
+            }
+        }else {
+            *p = 0;
+        }
+    }
+
+    nsAString_Finish(&str_value);
+    return hres;
+}
+
 static BOOL is_valid_border_style(BSTR v)
 {
     static const WCHAR styleDotted[] = {'d','o','t','t','e','d',0};
@@ -2387,8 +2419,10 @@ static HRESULT WINAPI HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v)
 static HRESULT WINAPI HTMLStyle_get_pixelLeft(IHTMLStyle *iface, LONG *p)
 {
     HTMLStyle *This = impl_from_IHTMLStyle(iface);
-    FIXME("(%p)->()\n", This);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    return get_nsstyle_pixel_val(This, STYLEID_LEFT, p);
 }
 
 static HRESULT WINAPI HTMLStyle_put_pixelWidth(IHTMLStyle *iface, LONG v)
diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c
index 08b3a3c..bcfd0e4 100644
--- a/dlls/mshtml/tests/style.c
+++ b/dlls/mshtml/tests/style.c
@@ -465,6 +465,7 @@ static void test_body_style(IHTMLStyle *style)
     float f;
     BSTR sOverflowDefault;
     BSTR sDefault;
+    LONG l;
     VARIANT vDefault;
 
     test_style_csstext(style, NULL);
@@ -904,6 +905,11 @@ static void test_body_style(IHTMLStyle *style)
     ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
     VariantClear(&v);
 
+    l = 0xdeadbeef;
+    hres = IHTMLStyle_get_pixelLeft(style, &l);
+    ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
+    ok(!l, "pixelLeft = %d\n", l);
+
     /* Test posLeft */
     hres = IHTMLStyle_get_posLeft(style, NULL);
     ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
@@ -943,6 +949,11 @@ static void test_body_style(IHTMLStyle *style)
     ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
     ok(f == 3.0, "expected 3.0 got %f\n", f);
 
+    l = 0xdeadbeef;
+    hres = IHTMLStyle_get_pixelLeft(style, &l);
+    ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
+    ok(l == 3, "pixelLeft = %d\n", l);
+
     V_VT(&v) = VT_EMPTY;
     hres = IHTMLStyle_get_left(style, &v);
     ok(hres == S_OK, "get_left failed: %08x\n", hres);
@@ -968,6 +979,11 @@ static void test_body_style(IHTMLStyle *style)
     ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
     VariantClear(&v);
 
+    l = 0xdeadbeef;
+    hres = IHTMLStyle_get_pixelLeft(style, &l);
+    ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
+    ok(!l, "pixelLeft = %d\n", l);
+
     /* Test posTop */
     hres = IHTMLStyle_get_posTop(style, NULL);
     ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);




More information about the wine-cvs mailing list