Jacek Caban : mshtml: Added IHTMLElement2:: get_runtimeStyle hackish implementation.

Alexandre Julliard julliard at winehq.org
Wed Jul 25 16:06:54 CDT 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Jul 25 14:47:13 2012 +0200

mshtml: Added IHTMLElement2::get_runtimeStyle hackish implementation.

---

 dlls/mshtml/htmlelem.c       |    4 ++++
 dlls/mshtml/htmlelem2.c      |   20 ++++++++++++++++++--
 dlls/mshtml/htmlstyle.c      |    1 +
 dlls/mshtml/mshtml_private.h |    1 +
 4 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 5c38ebb..02551db 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -1563,6 +1563,10 @@ void HTMLElement_destructor(HTMLDOMNode *iface)
         This->style->elem = NULL;
         IHTMLStyle_Release(&This->style->IHTMLStyle_iface);
     }
+    if(This->runtime_style) {
+        This->runtime_style->elem = NULL;
+        IHTMLStyle_Release(&This->runtime_style->IHTMLStyle_iface);
+    }
     if(This->attrs) {
         HTMLDOMAttribute *attr;
 
diff --git a/dlls/mshtml/htmlelem2.c b/dlls/mshtml/htmlelem2.c
index 4550681..e2e5c13 100644
--- a/dlls/mshtml/htmlelem2.c
+++ b/dlls/mshtml/htmlelem2.c
@@ -30,6 +30,7 @@
 
 #include "mshtml_private.h"
 #include "htmlevent.h"
+#include "htmlstyle.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
@@ -1188,8 +1189,23 @@ static HRESULT WINAPI HTMLElement2_removeBehavior(IHTMLElement2 *iface, LONG coo
 static HRESULT WINAPI HTMLElement2_get_runtimeStyle(IHTMLElement2 *iface, IHTMLStyle **p)
 {
     HTMLElement *This = impl_from_IHTMLElement2(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+
+    FIXME("(%p)->(%p): hack\n", This, p);
+
+    /* We can't implement correct behavior on top of Gecko (although we could
+       try a bit harder). Making runtimeStyle behave like regular style is
+       enough for most use cases. */
+    if(!This->runtime_style) {
+        HRESULT hres;
+
+        hres = HTMLStyle_Create(This, &This->runtime_style);
+        if(FAILED(hres))
+            return hres;
+    }
+
+    *p = &This->runtime_style->IHTMLStyle_iface;
+    IHTMLStyle_AddRef(*p);
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLElement2_get_behaviorUrns(IHTMLElement2 *iface, IDispatch **p)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 3d67402..1e068b1 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -721,6 +721,7 @@ static ULONG WINAPI HTMLStyle_Release(IHTMLStyle *iface)
     TRACE("(%p) ref=%d\n", This, ref);
 
     if(!ref) {
+        assert(!This->elem);
         if(This->nsstyle)
             nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
         release_dispex(&This->dispex);
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index abc9794..91cbbfe 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -634,6 +634,7 @@ typedef struct {
 
     nsIDOMHTMLElement *nselem;
     HTMLStyle *style;
+    HTMLStyle *runtime_style;
     HTMLAttributeCollection *attrs;
     WCHAR *filter;
 } HTMLElement;




More information about the wine-cvs mailing list