diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 5c38ebb7a91..02551dbbe9c 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 45506816fea..e2e5c139db6 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 3d67402414c..1e068b1ffa9 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 abc97945a28..91cbbfe008b 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;