[Wine-patches] [2/2] mshtml: Add IHTMLBaseElement interface (eterbugs #, 2517, 3025, 3107, 3168, 3343, 3484)

Konstantin Kondratyuk =?iso-8859-1?q?kondratyuk_=CE=C1_etersoft=2Eru?=
Вт Апр 7 16:36:30 MSD 2009


-- 
Best regards,
Konstantin Kondratyuk.
----------- следующая часть -----------
From cb1ae0a571bca26ba9fdc468b95d21402e244aff Mon Sep 17 00:00:00 2001
From: Konstantin Kondratyuk <kondratyuk на etersoft.ru>
Date: Tue, 7 Apr 2009 16:31:24 +0400
Subject: [PATCH 2/2] mshtml: Add IHTMLBaseElement interface (eterbugs #,2517,3025,3107,3168,3343,3484)

---
 dlls/mshtml/Makefile.in      |    1 +
 dlls/mshtml/htmlbase.c       |  201 ++++++++++++++++++++++++++++++++++++++++++
 dlls/mshtml/htmlelem.c       |    3 +
 dlls/mshtml/mshtml_private.h |    1 +
 4 files changed, 206 insertions(+), 0 deletions(-)
 create mode 100644 dlls/mshtml/htmlbase.c

diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in
index 892036d..9b480d5 100644
--- a/dlls/mshtml/Makefile.in
+++ b/dlls/mshtml/Makefile.in
@@ -13,6 +13,7 @@ C_SRCS = \
 	editor.c \
 	hlink.c \
 	htmlanchor.c \
+	htmlbase.c \
 	htmlbody.c \
 	htmlcomment.c \
 	htmlcurstyle.c \
diff --git a/dlls/mshtml/htmlbase.c b/dlls/mshtml/htmlbase.c
new file mode 100644
index 0000000..abfc39a
--- /dev/null
+++ b/dlls/mshtml/htmlbase.c
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2007 Jacek Caban for CodeWeavers
+ * Copyright 2009 Konstantin Kondratyuk (Etersoft)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "ole2.h"
+
+#include "wine/debug.h"
+
+#include "mshtml_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
+
+typedef struct {
+    HTMLElement element;
+
+    const IHTMLBaseElementVtbl *lpHTMLBaseElementVtbl;
+} HTMLBaseElement;
+
+#define HTMLBASE(x)  (&(x)->lpHTMLBaseElementVtbl)
+
+#define HTMLBASE_THIS(iface) DEFINE_THIS(HTMLBaseElement, HTMLBaseElement, iface)
+
+static HRESULT WINAPI HTMLBaseElement_QueryInterface(IHTMLBaseElement *iface,
+        REFIID riid, void **ppv)
+{
+    HTMLBaseElement *This = HTMLBASE_THIS(iface);
+
+    return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
+}
+
+static ULONG WINAPI HTMLBaseElement_AddRef(IHTMLBaseElement *iface)
+{
+    HTMLBaseElement *This = HTMLBASE_THIS(iface);
+
+    return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
+}
+
+static ULONG WINAPI HTMLBaseElement_Release(IHTMLBaseElement *iface)
+{
+    HTMLBaseElement *This = HTMLBASE_THIS(iface);
+
+    return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
+}
+
+static HRESULT WINAPI HTMLBaseElement_GetTypeInfoCount(IHTMLBaseElement *iface, UINT *pctinfo)
+{
+    HTMLBaseElement *This = HTMLBASE_THIS(iface);
+    return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo);
+}
+
+static HRESULT WINAPI HTMLBaseElement_GetTypeInfo(IHTMLBaseElement *iface, UINT iTInfo,
+                                              LCID lcid, ITypeInfo **ppTInfo)
+{
+    HTMLBaseElement *This = HTMLBASE_THIS(iface);
+    return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo);
+}
+
+static HRESULT WINAPI HTMLBaseElement_GetIDsOfNames(IHTMLBaseElement *iface, REFIID riid,
+                                                LPOLESTR *rgszNames, UINT cNames,
+                                                LCID lcid, DISPID *rgDispId)
+{
+    HTMLBaseElement *This = HTMLBASE_THIS(iface);
+    return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
+}
+
+static HRESULT WINAPI HTMLBaseElement_Invoke(IHTMLBaseElement *iface, DISPID dispIdMember,
+                            REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
+                            VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+    HTMLBaseElement *This = HTMLBASE_THIS(iface);
+    return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid,
+            wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
+}
+
+    /*** IHTMLBaseElement methods ***/
+static HRESULT WINAPI HTMLBaseElement_put_href(
+                                               IHTMLBaseElement* iface,
+                                               BSTR v)
+{
+    HTMLBaseElement *This = HTMLBASE_THIS(iface);
+    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HTMLBaseElement_get_href(
+                                               IHTMLBaseElement* iface,
+                                               BSTR *p)
+{
+    HTMLBaseElement *This = HTMLBASE_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, p);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HTMLBaseElement_put_target(
+        IHTMLBaseElement* iface,
+        BSTR v)
+{
+    HTMLBaseElement *This = HTMLBASE_THIS(iface);
+    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HTMLBaseElement_get_target(
+        IHTMLBaseElement* iface,
+        BSTR *p)
+{
+    HTMLBaseElement *This = HTMLBASE_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, p);
+    return E_NOTIMPL;
+}
+
+#undef HTMLBASE_THIS
+
+static const IHTMLBaseElementVtbl HTMLBaseElementVtbl = {
+    HTMLBaseElement_QueryInterface,
+    HTMLBaseElement_AddRef,
+    HTMLBaseElement_Release,
+    HTMLBaseElement_GetTypeInfoCount,
+    HTMLBaseElement_GetTypeInfo,
+    HTMLBaseElement_GetIDsOfNames,
+    HTMLBaseElement_Invoke,
+    HTMLBaseElement_put_href,
+    HTMLBaseElement_get_href,
+    HTMLBaseElement_put_target,
+    HTMLBaseElement_get_target,
+};
+
+#define HTMLBASE_NODE_THIS(iface) DEFINE_THIS2(HTMLBaseElement, element.node, iface)
+
+static HRESULT HTMLBaseElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
+{
+    HTMLBaseElement *This = HTMLBASE_NODE_THIS(iface);
+
+    *ppv = NULL;
+
+    if(IsEqualGUID(&IID_IUnknown, riid)) {
+        TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
+        *ppv = HTMLBASE(This);
+    }else if(IsEqualGUID(&IID_IDispatch, riid)) {
+        TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
+        *ppv = HTMLBASE(This);
+    }else if(IsEqualGUID(&IID_IHTMLBaseElement, riid)) {
+        TRACE("(%p)->(IID_IHTMLBaseElement %p)\n", This, ppv);
+        *ppv = HTMLBASE(This);
+    }
+
+    if(*ppv) {
+        IUnknown_AddRef((IUnknown*)*ppv);
+        return S_OK;
+    }
+
+    return HTMLElement_QI(&This->element.node, riid, ppv);
+}
+
+static void HTMLBaseElement_destructor(HTMLDOMNode *iface)
+{
+    HTMLBaseElement *This = HTMLBASE_NODE_THIS(iface);
+    HTMLElement_destructor(&This->element.node);
+}
+
+#undef HTMLBASE_NODE_THIS
+
+static const NodeImplVtbl HTMLBaseElementImplVtbl = {
+    HTMLBaseElement_QI,
+    HTMLBaseElement_destructor
+};
+
+HTMLElement *HTMLBaseElement_Create(nsIDOMHTMLElement *nselem)
+{
+    HTMLBaseElement *ret = heap_alloc_zero(sizeof(HTMLBaseElement));
+
+    HTMLElement_Init(&ret->element);
+
+    ret->lpHTMLBaseElementVtbl = &HTMLBaseElementVtbl;
+    ret->element.node.vtbl = &HTMLBaseElementImplVtbl;
+
+    return &ret->element;
+}
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 5632c21..970b015 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -1510,6 +1510,7 @@ HTMLElement *HTMLElement_Create(HTMLDocument *doc, nsIDOMNode *nsnode, BOOL use_
     nsresult nsres;
 
     static const WCHAR wszA[]        = {'A',0};
+    static const WCHAR wszBASE[]     = {'B','A','S','E',0};
     static const WCHAR wszBODY[]     = {'B','O','D','Y',0};
     static const WCHAR wszIFRAME[]   = {'I','F','R','A','M','E',0};
     static const WCHAR wszIMG[]      = {'I','M','G',0};
@@ -1532,6 +1533,8 @@ HTMLElement *HTMLElement_Create(HTMLDocument *doc, nsIDOMNode *nsnode, BOOL use_
 
     if(!strcmpW(class_name, wszA))
         ret = HTMLAnchorElement_Create(nselem);
+    else if(!strcmpW(class_name, wszBASE))
+        ret = HTMLBaseElement_Create(nselem);
     else if(!strcmpW(class_name, wszBODY))
         ret = HTMLBodyElement_Create(nselem);
     else if(!strcmpW(class_name, wszIFRAME))
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index cf7d446..2e8abac 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -600,6 +600,7 @@ HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocument*,nsIDOMNode*);
 HTMLElement *HTMLElement_Create(HTMLDocument*,nsIDOMNode*,BOOL);
 HTMLElement *HTMLCommentElement_Create(HTMLDocument*,nsIDOMNode*);
 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
+HTMLElement *HTMLBaseElement_Create(nsIDOMHTMLElement*);
 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
 HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement*);
 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement*);
-- 
1.6.1.3.GIT



Подробная информация о списке рассылки Wine-patches