Jacek Caban : mshtml: Added IHTMLStyle::[get|put]_left implementation.

Alexandre Julliard julliard at winehq.org
Tue Oct 7 08:53:52 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Oct  6 09:50:28 2008 -0500

mshtml: Added IHTMLStyle::[get|put]_left implementation.

---

 dlls/mshtml/htmlstyle.c |   31 +++++++++++++++++++++++++++----
 dlls/mshtml/htmlstyle.h |    1 +
 dlls/mshtml/tests/dom.c |   21 +++++++++++++++++++++
 3 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 0beef50..f42b4d0 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -55,6 +55,8 @@ static const WCHAR attrFontStyle[] =
     {'f','o','n','t','-','s','t','y','l','e',0};
 static const WCHAR attrFontWeight[] =
     {'f','o','n','t','-','w','e','i','g','h','t',0};
+static const WCHAR attrLeft[] =
+    {'l','e','f','t',0};
 static const WCHAR attrMargin[] =
     {'m','a','r','g','i','n',0};
 static const WCHAR attrMarginLeft[] =
@@ -82,6 +84,7 @@ static const LPCWSTR style_strings[] = {
     attrFontSize,
     attrFontStyle,
     attrFontWeight,
+    attrLeft,
     attrMargin,
     attrMarginLeft,
     attrMarginRight,
@@ -1459,15 +1462,35 @@ static HRESULT WINAPI HTMLStyle_get_top(IHTMLStyle *iface, VARIANT *p)
 static HRESULT WINAPI HTMLStyle_put_left(IHTMLStyle *iface, VARIANT v)
 {
     HTMLStyle *This = HTMLSTYLE_THIS(iface);
-    FIXME("(%p)->(v%d)\n", This, V_VT(&v));
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
+
+    switch(V_VT(&v)) {
+    case VT_BSTR:
+        return set_style_attr(This, STYLEID_LEFT, V_BSTR(&v), 0);
+    default:
+        FIXME("unimplemented vt %d\n", V_VT(&v));
+        return E_NOTIMPL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLStyle_get_left(IHTMLStyle *iface, VARIANT *p)
 {
     HTMLStyle *This = HTMLSTYLE_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    BSTR ret;
+    HRESULT hres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    hres = get_style_attr(This, STYLEID_LEFT, &ret);
+    if(FAILED(hres))
+        return hres;
+
+    V_VT(p) = VT_BSTR;
+    V_BSTR(p) = ret;
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLStyle_get_position(IHTMLStyle *iface, BSTR *p)
diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h
index ed3cba7..902cc9a 100644
--- a/dlls/mshtml/htmlstyle.h
+++ b/dlls/mshtml/htmlstyle.h
@@ -42,6 +42,7 @@ typedef enum {
     STYLEID_FONT_SIZE,
     STYLEID_FONT_STYLE,
     STYLEID_FONT_WEIGHT,
+    STYLEID_LEFT,
     STYLEID_MARGIN,
     STYLEID_MARGIN_LEFT,
     STYLEID_MARGIN_RIGHT,
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 13364c0..1105f0f 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -2097,6 +2097,27 @@ static void test_default_style(IHTMLStyle *style)
     hres = IHTMLStyle_put_border(style, str);
     ok(hres == S_OK, "get_border failed: %08x\n", hres);
     SysFreeString(str);
+
+    V_VT(&v) = VT_EMPTY;
+    hres = IHTMLStyle_get_left(style, &v);
+    ok(hres == S_OK, "get_left failed: %08x\n", hres);
+    ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+    ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
+    VariantClear(&v);
+
+    V_VT(&v) = VT_BSTR;
+    V_BSTR(&v) = a2bstr("3px");
+    hres = IHTMLStyle_put_left(style, v);
+    ok(hres == S_OK, "put_left failed: %08x\n", hres);
+    VariantClear(&v);
+
+    V_VT(&v) = VT_EMPTY;
+    hres = IHTMLStyle_get_left(style, &v);
+    ok(hres == S_OK, "get_left failed: %08x\n", hres);
+    ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+    ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", dbgstr_w(V_BSTR(&v)));
+    VariantClear(&v);
+
 }
 
 static void test_default_selection(IHTMLDocument2 *doc)




More information about the wine-cvs mailing list