[PATCH v2 5/8] mshtml: Implement IHTMLStyle::toString.

Gabriel Ivăncescu gabrielopcode at gmail.com
Fri Sep 24 08:45:34 CDT 2021


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/mshtml/htmlstyle.c           | 13 ++++++++++---
 dlls/mshtml/tests/documentmode.js |  2 ++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 4ee81ba..6c5135e 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -3025,8 +3025,14 @@ static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttri
 static HRESULT WINAPI HTMLStyle_toString(IHTMLStyle *iface, BSTR *String)
 {
     HTMLStyle *This = impl_from_IHTMLStyle(iface);
-    FIXME("(%p)->(%p)\n", This, String);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, String);
+
+    if(!String)
+        return E_INVALIDARG;
+
+    *String = SysAllocString(dispex_tostring(&This->css_style.dispex));
+    return *String ? S_OK : E_OUTOFMEMORY;
 }
 
 static const IHTMLStyleVtbl HTMLStyleVtbl = {
@@ -10009,7 +10015,8 @@ static dispex_static_data_t HTMLStyle_dispex = {
     &CSSStyle_dispex_vtbl,
     DispHTMLStyle_tid,
     HTMLStyle_iface_tids,
-    CSSStyle_init_dispex_info
+    CSSStyle_init_dispex_info,
+    L"[object MSStyleCSSProperties]"
 };
 
 static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration **ret)
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js
index 26f2373..037631b 100644
--- a/dlls/mshtml/tests/documentmode.js
+++ b/dlls/mshtml/tests/documentmode.js
@@ -164,6 +164,8 @@ sync_test("builtin_toString", function() {
     ok(s === "[object Window]", "window.toString returned " + s);
     s = document.toString();
     ok(s === (v < 9 ? "[object]" : (v < 11 ? "[object Document]" : "[object HTMLDocument]")), "document.toString returned " + s);
+    s = document.body.style.toString();
+    ok(s === (v < 9 ? "[object]" : "[object MSStyleCSSProperties]"), "document.body.style.toString returned " + s);
 });
 
 sync_test("elem_props", function() {
-- 
2.31.1




More information about the wine-devel mailing list