Jacek Caban : mshtml: Added IHTMLCurrentStyle::get_display implementation.

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


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

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

mshtml: Added IHTMLCurrentStyle::get_display implementation.

---

 dlls/mshtml/htmlcurstyle.c |   12 +++++++-----
 dlls/mshtml/htmlstyle.c    |   15 ++++++++++-----
 dlls/mshtml/htmlstyle.h    |    2 ++
 dlls/mshtml/tests/dom.c    |    8 ++++++++
 4 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/dlls/mshtml/htmlcurstyle.c b/dlls/mshtml/htmlcurstyle.c
index ffce224..8bb56f3 100644
--- a/dlls/mshtml/htmlcurstyle.c
+++ b/dlls/mshtml/htmlcurstyle.c
@@ -25,10 +25,10 @@
 #include "winuser.h"
 #include "ole2.h"
 
-#include "wine/debug.h"
-#include "wine/unicode.h"
-
 #include "mshtml_private.h"
+#include "htmlstyle.h"
+
+#include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
@@ -376,8 +376,10 @@ static HRESULT WINAPI HTMLCurrentStyle_get_textDecoration(IHTMLCurrentStyle *ifa
 static HRESULT WINAPI HTMLCurrentStyle_get_display(IHTMLCurrentStyle *iface, BSTR *p)
 {
     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    return get_nsstyle_attr(This->nsstyle, STYLEID_DISPLAY, p);
 }
 
 static HRESULT WINAPI HTMLCurrentStyle_get_visibility(IHTMLCurrentStyle *iface, BSTR *p)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 3805c74..f9ff883 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -185,14 +185,14 @@ static HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWO
     return S_OK;
 }
 
-static HRESULT get_style_attr_nsval(HTMLStyle *This, styleid_t sid, nsAString *value)
+static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, nsAString *value)
 {
     nsAString str_name;
     nsresult nsres;
 
     nsAString_Init(&str_name, style_strings[sid]);
 
-    nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(This->nsstyle, &str_name, value);
+    nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value);
     if(NS_FAILED(nsres)) {
         ERR("SetProperty failed: %08x\n", nsres);
         return E_FAIL;
@@ -203,14 +203,14 @@ static HRESULT get_style_attr_nsval(HTMLStyle *This, styleid_t sid, nsAString *v
     return NS_OK;
 }
 
-static HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p)
+HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, BSTR *p)
 {
     nsAString str_value;
     const PRUnichar *value;
 
     nsAString_Init(&str_value, NULL);
 
-    get_style_attr_nsval(This, sid, &str_value);
+    get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
 
     nsAString_GetData(&str_value, &value);
     *p = *value ? SysAllocString(value) : NULL;
@@ -221,6 +221,11 @@ static HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p)
     return S_OK;
 }
 
+static inline HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p)
+{
+    return get_nsstyle_attr(This->nsstyle, sid, p);
+}
+
 static HRESULT check_style_attr_value(HTMLStyle *This, styleid_t sid, LPCWSTR exval, VARIANT_BOOL *p)
 {
     nsAString str_value;
@@ -228,7 +233,7 @@ static HRESULT check_style_attr_value(HTMLStyle *This, styleid_t sid, LPCWSTR ex
 
     nsAString_Init(&str_value, NULL);
 
-    get_style_attr_nsval(This, sid, &str_value);
+    get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
 
     nsAString_GetData(&str_value, &value);
     *p = strcmpW(value, exval) ? VARIANT_FALSE : VARIANT_TRUE;
diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h
index 1295ab6..f12e072 100644
--- a/dlls/mshtml/htmlstyle.h
+++ b/dlls/mshtml/htmlstyle.h
@@ -51,3 +51,5 @@ typedef enum {
 } styleid_t;
 
 void HTMLStyle2_Init(HTMLStyle*);
+
+HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration*,styleid_t,BSTR*);
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 0753d15..689020c 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -1986,8 +1986,16 @@ static void test_navigator(IHTMLDocument2 *doc)
 
 static void test_current_style(IHTMLCurrentStyle *current_style)
 {
+    BSTR str;
+    HRESULT hres;
+
     test_disp((IUnknown*)current_style, &DIID_DispHTMLCurrentStyle);
     test_ifaces((IUnknown*)current_style, cstyle_iids);
+
+    hres = IHTMLCurrentStyle_get_display(current_style, &str);
+    ok(hres == S_OK, "get_display failed: %08x\n", hres);
+    ok(!strcmp_wa(str, "block"), "get_display returned %s\n", dbgstr_w(str));
+    SysFreeString(str);
 }
 
 static void test_default_style(IHTMLStyle *style)




More information about the wine-cvs mailing list