Jacek Caban : mshtml: Added HTMLHtmlElement object implementation.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Mar 31 11:42:57 CDT 2016
Module: wine
Branch: master
Commit: baf9db63ed8f248c5674e408438dc6f28d70102d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=baf9db63ed8f248c5674e408438dc6f28d70102d
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Mar 31 14:51:08 2016 +0200
mshtml: Added HTMLHtmlElement object implementation.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mshtml/htmlelem.c | 2 +
dlls/mshtml/htmlhead.c | 184 +++++++++++++++++++++++++++++++++++++++++++
dlls/mshtml/mshtml_private.h | 3 +
dlls/mshtml/tests/dom.c | 11 ++-
4 files changed, 198 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index ce1ed8a..ac077f7 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -46,6 +46,7 @@ static const WCHAR embedW[] = {'E','M','B','E','D',0};
static const WCHAR formW[] = {'F','O','R','M',0};
static const WCHAR frameW[] = {'F','R','A','M','E',0};
static const WCHAR headW[] = {'H','E','A','D',0};
+static const WCHAR htmlW[] = {'H','T','M','L',0};
static const WCHAR iframeW[] = {'I','F','R','A','M','E',0};
static const WCHAR imgW[] = {'I','M','G',0};
static const WCHAR inputW[] = {'I','N','P','U','T',0};
@@ -81,6 +82,7 @@ static const tag_desc_t tag_descs[] = {
{formW, HTMLFormElement_Create},
{frameW, HTMLFrameElement_Create},
{headW, HTMLHeadElement_Create},
+ {htmlW, HTMLHtmlElement_Create},
{iframeW, HTMLIFrame_Create},
{imgW, HTMLImgElement_Create},
{inputW, HTMLInputElement_Create},
diff --git a/dlls/mshtml/htmlhead.c b/dlls/mshtml/htmlhead.c
index e64568c..fab6fa5 100644
--- a/dlls/mshtml/htmlhead.c
+++ b/dlls/mshtml/htmlhead.c
@@ -24,6 +24,7 @@
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
+#include "mshtmdid.h"
#include "wine/debug.h"
@@ -193,6 +194,189 @@ HRESULT HTMLTitleElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem
typedef struct {
HTMLElement element;
+ IHTMLHtmlElement IHTMLHtmlElement_iface;
+} HTMLHtmlElement;
+
+static inline HTMLHtmlElement *impl_from_IHTMLHtmlElement(IHTMLHtmlElement *iface)
+{
+ return CONTAINING_RECORD(iface, HTMLHtmlElement, IHTMLHtmlElement_iface);
+}
+
+static HRESULT WINAPI HTMLHtmlElement_QueryInterface(IHTMLHtmlElement *iface,
+ REFIID riid, void **ppv)
+{
+ HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
+
+ return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
+}
+
+static ULONG WINAPI HTMLHtmlElement_AddRef(IHTMLHtmlElement *iface)
+{
+ HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
+
+ return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
+}
+
+static ULONG WINAPI HTMLHtmlElement_Release(IHTMLHtmlElement *iface)
+{
+ HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
+
+ return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
+}
+
+static HRESULT WINAPI HTMLHtmlElement_GetTypeInfoCount(IHTMLHtmlElement *iface, UINT *pctinfo)
+{
+ HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
+
+ return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
+}
+
+static HRESULT WINAPI HTMLHtmlElement_GetTypeInfo(IHTMLHtmlElement *iface, UINT iTInfo,
+ LCID lcid, ITypeInfo **ppTInfo)
+{
+ HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
+
+ return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
+ ppTInfo);
+}
+
+static HRESULT WINAPI HTMLHtmlElement_GetIDsOfNames(IHTMLHtmlElement *iface, REFIID riid,
+ LPOLESTR *rgszNames, UINT cNames,
+ LCID lcid, DISPID *rgDispId)
+{
+ HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
+
+ return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
+ cNames, lcid, rgDispId);
+}
+
+static HRESULT WINAPI HTMLHtmlElement_Invoke(IHTMLHtmlElement *iface, DISPID dispIdMember,
+ REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
+ VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+ HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
+
+ return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
+ lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
+}
+
+static HRESULT WINAPI HTMLHtmlElement_put_version(IHTMLHtmlElement *iface, BSTR v)
+{
+ HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
+ FIXME("(%p)->(%s)\n", This, debugstr_w(v));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HTMLHtmlElement_get_version(IHTMLHtmlElement *iface, BSTR *p)
+{
+ HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
+ FIXME("(%p)->(%p)\n", This, p);
+ return E_NOTIMPL;
+}
+
+static const IHTMLHtmlElementVtbl HTMLHtmlElementVtbl = {
+ HTMLHtmlElement_QueryInterface,
+ HTMLHtmlElement_AddRef,
+ HTMLHtmlElement_Release,
+ HTMLHtmlElement_GetTypeInfoCount,
+ HTMLHtmlElement_GetTypeInfo,
+ HTMLHtmlElement_GetIDsOfNames,
+ HTMLHtmlElement_Invoke,
+ HTMLHtmlElement_put_version,
+ HTMLHtmlElement_get_version
+};
+
+static inline HTMLHtmlElement *HTMLHtmlElement_from_HTMLDOMNode(HTMLDOMNode *iface)
+{
+ return CONTAINING_RECORD(iface, HTMLHtmlElement, element.node);
+}
+
+static HRESULT HTMLHtmlElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
+{
+ HTMLHtmlElement *This = HTMLHtmlElement_from_HTMLDOMNode(iface);
+
+ TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
+
+ if(IsEqualGUID(&IID_IHTMLHtmlElement, riid))
+ *ppv = &This->IHTMLHtmlElement_iface;
+ else
+ return HTMLElement_QI(&This->element.node, riid, ppv);
+
+ IUnknown_AddRef((IUnknown*)*ppv);
+ return S_OK;
+}
+
+static void HTMLHtmlElement_destructor(HTMLDOMNode *iface)
+{
+ HTMLHtmlElement *This = HTMLHtmlElement_from_HTMLDOMNode(iface);
+
+ HTMLElement_destructor(&This->element.node);
+}
+
+static BOOL HTMLHtmlElement_is_settable(HTMLDOMNode *iface, DISPID dispid)
+{
+ switch(dispid) {
+ case DISPID_IHTMLELEMENT_OUTERTEXT:
+ return FALSE;
+ default:
+ return TRUE;
+ }
+}
+
+static const NodeImplVtbl HTMLHtmlElementImplVtbl = {
+ HTMLHtmlElement_QI,
+ HTMLHtmlElement_destructor,
+ HTMLElement_cpc,
+ HTMLElement_clone,
+ HTMLElement_handle_event,
+ HTMLElement_get_attr_col,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ HTMLHtmlElement_is_settable
+};
+
+static const tid_t HTMLHtmlElement_iface_tids[] = {
+ HTMLELEMENT_TIDS,
+ IHTMLHtmlElement_tid,
+ 0
+};
+static dispex_static_data_t HTMLHtmlElement_dispex = {
+ NULL,
+ DispHTMLHtmlElement_tid,
+ NULL,
+ HTMLHtmlElement_iface_tids
+};
+
+HRESULT HTMLHtmlElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
+{
+ HTMLHtmlElement *ret;
+
+ ret = heap_alloc_zero(sizeof(*ret));
+ if(!ret)
+ return E_OUTOFMEMORY;
+
+ ret->IHTMLHtmlElement_iface.lpVtbl = &HTMLHtmlElementVtbl;
+ ret->element.node.vtbl = &HTMLHtmlElementImplVtbl;
+
+ HTMLElement_Init(&ret->element, doc, nselem, &HTMLHtmlElement_dispex);
+
+ *elem = &ret->element;
+ return S_OK;
+}
+
+typedef struct {
+ HTMLElement element;
+
IHTMLHeadElement IHTMLHeadElement_iface;
} HTMLHeadElement;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index fe69487..9fe8a75 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -94,6 +94,7 @@ typedef struct event_target_t event_target_t;
XDIID(DispHTMLGenericElement) \
XDIID(DispHTMLFrameElement) \
XDIID(DispHTMLHeadElement) \
+ XDIID(DispHTMLHtmlElement) \
XDIID(DispHTMLHistory) \
XDIID(DispHTMLIFrame) \
XDIID(DispHTMLImg) \
@@ -162,6 +163,7 @@ typedef struct event_target_t event_target_t;
XIID(IHTMLFrameElement3) \
XIID(IHTMLGenericElement) \
XIID(IHTMLHeadElement) \
+ XIID(IHTMLHtmlElement) \
XIID(IHTMLIFrameElement) \
XIID(IHTMLIFrameElement2) \
XIID(IHTMLIFrameElement3) \
@@ -968,6 +970,7 @@ HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement
HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
+HRESULT HTMLHtmlElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 81fbad9..9e8d8b5 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -328,6 +328,13 @@ static const IID * const frame_iids[] = {
NULL
};
+static const IID * const html_iids[] = {
+ ELEM_IFACES,
+ &IID_IHTMLHtmlElement,
+ &IID_IConnectionPointContainer,
+ NULL
+};
+
static const IID * const head_iids[] = {
ELEM_IFACES,
&IID_IHTMLHeadElement,
@@ -449,7 +456,7 @@ typedef struct {
static const elem_type_info_t elem_type_infos[] = {
{"", none_iids, NULL},
- {"HTML", elem_iids, NULL},
+ {"HTML", html_iids, &DIID_DispHTMLHtmlElement},
{"HEAD", head_iids, &DIID_DispHTMLHeadElement},
{"TITLE", title_iids, &DIID_DispHTMLTitleElement},
{"BODY", body_iids, &DIID_DispHTMLBody},
@@ -6353,7 +6360,7 @@ static void test_doc_elem(IHTMLDocument2 *doc)
test_node_name((IUnknown*)elem, "HTML");
test_elem_tag((IUnknown*)elem, "HTML");
- todo_wine test_elem_set_outertext_fail(elem);
+ test_elem_set_outertext_fail(elem);
doc_node = get_doc_node(doc);
owner_doc = get_owner_doc((IUnknown*)elem);
More information about the wine-cvs
mailing list