Jacek Caban : mshtml: Added IHTMLStyleElement:: get_styleSheet imeplementation.

Alexandre Julliard julliard at winehq.org
Thu Oct 11 15:25:15 CDT 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Oct 11 14:07:26 2012 +0200

mshtml: Added IHTMLStyleElement::get_styleSheet imeplementation.

---

 dlls/mshtml/htmlstyleelem.c |   42 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/htmlstyleelem.c b/dlls/mshtml/htmlstyleelem.c
index bfc12b6..cbb2af4 100644
--- a/dlls/mshtml/htmlstyleelem.c
+++ b/dlls/mshtml/htmlstyleelem.c
@@ -39,6 +39,7 @@ typedef struct {
     IHTMLStyleElement IHTMLStyleElement_iface;
 
     nsIDOMHTMLStyleElement *nsstyle;
+    IHTMLStyleSheet *style_sheet;
 } HTMLStyleElement;
 
 static inline HTMLStyleElement *impl_from_IHTMLStyleElement(IHTMLStyleElement *iface)
@@ -183,8 +184,31 @@ static HRESULT WINAPI HTMLStyleElement_get_onerror(IHTMLStyleElement *iface, VAR
 static HRESULT WINAPI HTMLStyleElement_get_styleSheet(IHTMLStyleElement *iface, IHTMLStyleSheet **p)
 {
     HTMLStyleElement *This = impl_from_IHTMLStyleElement(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    if(!This->nsstyle)
+        return E_FAIL;
+
+    if(!This->style_sheet) {
+        nsIDOMStyleSheet *ss;
+        nsresult nsres;
+
+        nsres = nsIDOMHTMLStyleElement_GetDOMStyleSheet(This->nsstyle, &ss);
+        assert(nsres == NS_OK);
+
+        if(ss) {
+            This->style_sheet = HTMLStyleSheet_Create(ss);
+            nsIDOMStyleSheet_Release(ss);
+            if(!This->style_sheet)
+                return E_OUTOFMEMORY;
+        }
+    }
+
+    if(This->style_sheet)
+        IHTMLStyleSheet_AddRef(This->style_sheet);
+    *p = This->style_sheet;
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLStyleElement_put_disabled(IHTMLStyleElement *iface, VARIANT_BOOL v)
@@ -283,9 +307,21 @@ static HRESULT HTMLStyleElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
     return S_OK;
 }
 
+static void HTMLStyleElement_destructor(HTMLDOMNode *iface)
+{
+    HTMLStyleElement *This = impl_from_HTMLDOMNode(iface);
+
+    if(This->style_sheet) {
+        IHTMLStyleSheet_Release(This->style_sheet);
+        This->style_sheet = NULL;
+    }
+
+    HTMLElement_destructor(iface);
+}
+
 static const NodeImplVtbl HTMLStyleElementImplVtbl = {
     HTMLStyleElement_QI,
-    HTMLElement_destructor,
+    HTMLStyleElement_destructor,
     HTMLElement_clone,
     HTMLElement_handle_event,
     HTMLElement_get_attr_col




More information about the wine-cvs mailing list