Chen Yuan : mshtml: Add IHTMLStyle5::maxHeight property implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Nov 6 09:22:40 CST 2014


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

Author: Chen Yuan <huddsinyuan2014 at gmail.com>
Date:   Wed Nov  5 01:36:10 2014 +0800

mshtml: Add IHTMLStyle5::maxHeight property implementation.

---

 dlls/mshtml/htmlstyle.c   |  3 +++
 dlls/mshtml/htmlstyle.h   |  1 +
 dlls/mshtml/htmlstyle3.c  | 12 ++++++++----
 dlls/mshtml/tests/style.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 755507c..d9898a9 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -144,6 +144,8 @@ static const WCHAR attrMarginRight[] =
     {'m','a','r','g','i','n','-','r','i','g','h','t',0};
 static const WCHAR attrMarginTop[] =
     {'m','a','r','g','i','n','-','t','o','p',0};
+static const WCHAR attrMaxHeight[] =
+    {'m','a','x','-','h','e','i','g','h','t',0};
 static const WCHAR attrMaxWidth[] =
     {'m','a','x','-','w','i','d','t','h',0};
 static const WCHAR attrMinHeight[] =
@@ -266,6 +268,7 @@ static const style_tbl_entry_t style_tbl[] = {
     {attrMarginLeft,           DISPID_IHTMLSTYLE_MARGINLEFT},
     {attrMarginRight,          DISPID_IHTMLSTYLE_MARGINRIGHT},
     {attrMarginTop,            DISPID_IHTMLSTYLE_MARGINTOP},
+    {attrMaxHeight,            DISPID_IHTMLSTYLE5_MAXHEIGHT},
     {attrMaxWidth,             DISPID_IHTMLSTYLE5_MAXWIDTH},
     {attrMinHeight,            DISPID_IHTMLSTYLE4_MINHEIGHT},
     {attrMinWidth,             DISPID_IHTMLSTYLE5_MINWIDTH},
diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h
index d2834ac..de6f37e 100644
--- a/dlls/mshtml/htmlstyle.h
+++ b/dlls/mshtml/htmlstyle.h
@@ -87,6 +87,7 @@ typedef enum {
     STYLEID_MARGIN_LEFT,
     STYLEID_MARGIN_RIGHT,
     STYLEID_MARGIN_TOP,
+    STYLEID_MAX_HEIGHT,
     STYLEID_MAX_WIDTH,
     STYLEID_MIN_HEIGHT,
     STYLEID_MIN_WIDTH,
diff --git a/dlls/mshtml/htmlstyle3.c b/dlls/mshtml/htmlstyle3.c
index 658f879..6532bf4 100644
--- a/dlls/mshtml/htmlstyle3.c
+++ b/dlls/mshtml/htmlstyle3.c
@@ -530,15 +530,19 @@ static HRESULT WINAPI HTMLStyle5_get_msInterpolationMode(IHTMLStyle5 *iface, BST
 static HRESULT WINAPI HTMLStyle5_put_maxHeight(IHTMLStyle5 *iface, VARIANT v)
 {
     HTMLStyle *This = impl_from_IHTMLStyle5(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
+
+    return set_nsstyle_attr_var(This->nsstyle, STYLEID_MAX_HEIGHT, &v, ATTR_FIX_PX);
 }
 
 static HRESULT WINAPI HTMLStyle5_get_maxHeight(IHTMLStyle5 *iface, VARIANT *p)
 {
     HTMLStyle *This = impl_from_IHTMLStyle5(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, debugstr_variant(p));
+
+    return get_nsstyle_attr_var(This->nsstyle, STYLEID_MAX_HEIGHT, p, 0);
 }
 
 static HRESULT WINAPI HTMLStyle5_put_minWidth(IHTMLStyle5 *iface, VARIANT v)
diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c
index 1c230f4..ec66a71 100644
--- a/dlls/mshtml/tests/style.c
+++ b/dlls/mshtml/tests/style.c
@@ -580,6 +580,50 @@ static void test_style5(IHTMLStyle5 *style5)
     hres = IHTMLStyle5_put_maxWidth(style5,vdefault);
     ok(hres == S_OK, "put_maxWidth failed: %08x\n", hres);
     VariantClear(&vdefault);
+
+    /* maxHeight */
+    hres = IHTMLStyle5_get_maxHeight(style5, &vdefault);
+    ok(hres == S_OK, "get maxHeight failed: %08x\n", hres);
+
+    V_VT(&v) = VT_BSTR;
+    V_BSTR(&v) = a2bstr("200px");
+    hres = IHTMLStyle5_put_maxHeight(style5, v);
+    ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
+    VariantClear(&v);
+
+    hres = IHTMLStyle5_get_maxHeight(style5, &v);
+    ok(hres == S_OK, "get maxHeight failed: %08x\n", hres);
+    ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
+    ok(!strcmp_wa(V_BSTR(&v), "200px"), "expect 200px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
+    VariantClear(&v);
+
+    V_VT(&v) = VT_BSTR;
+    V_BSTR(&v) = a2bstr("70%");
+    hres = IHTMLStyle5_put_maxHeight(style5, v);
+    ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
+    VariantClear(&v);
+
+    hres = IHTMLStyle5_get_maxHeight(style5, &v);
+    ok(hres == S_OK, "get_maxHeight failed: %08x\n", hres);
+    ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
+    ok(!strcmp_wa(V_BSTR(&v), "70%"), "expect 70%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
+    VariantClear(&v);
+
+    V_VT(&v) = VT_BSTR;
+    V_BSTR(&v) = a2bstr("100");
+    hres = IHTMLStyle5_put_maxHeight(style5, v);
+    ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
+    VariantClear(&v);
+
+    hres = IHTMLStyle5_get_maxHeight(style5, &v);
+    ok(hres == S_OK, "get_maxHeight failed: %08x\n", hres);
+    ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
+    ok(!strcmp_wa(V_BSTR(&v), "100px"), "expect 100 got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
+    VariantClear(&v);
+
+    hres = IHTMLStyle5_put_maxHeight(style5, vdefault);
+    ok(hres == S_OK, "put maxHeight failed:%08x\n", hres);
+    VariantClear(&vdefault);
 }
 
 static void test_style6(IHTMLStyle6 *style)




More information about the wine-cvs mailing list