mshtml: Added IHTMLDOMTextNode stub implementation.

This commit is contained in:
Jacek Caban 2008-04-24 18:25:34 +02:00 committed by Alexandre Julliard
parent 6bf5ffbc3b
commit 754adce781
5 changed files with 231 additions and 3 deletions

View File

@ -30,8 +30,9 @@ C_SRCS = \
htmlstyle.c \
htmlstylesheet.c \
htmltable.c \
htmltextcont.c \
htmltextarea.c \
htmltextcont.c \
htmltextnode.c \
htmlwindow.c \
install.c \
loadopts.c \

View File

@ -452,6 +452,9 @@ static HTMLDOMNode *create_node(HTMLDocument *doc, nsIDOMNode *nsnode)
case ELEMENT_NODE:
ret = &HTMLElement_Create(nsnode)->node;
break;
case TEXT_NODE:
ret = HTMLDOMTextNode_Create(nsnode);
break;
default:
ret = heap_alloc_zero(sizeof(HTMLDOMNode));
ret->vtbl = &HTMLDOMNodeImplVtbl;

197
dlls/mshtml/htmltextnode.c Normal file
View File

@ -0,0 +1,197 @@
/*
* Copyright 2008 Jacek Caban for CodeWeavers
*
* 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>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "mshtml_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
typedef struct {
HTMLDOMNode node;
const IHTMLDOMTextNodeVtbl *lpIHTMLDOMTextNodeVtbl;
} HTMLDOMTextNode;
#define HTMLTEXT(x) ((IHTMLDOMTextNode*) &(x)->lpIHTMLDOMTextNodeVtbl)
#define HTMLTEXT_THIS(iface) DEFINE_THIS(HTMLDOMTextNode, IHTMLDOMTextNode, iface)
#define HTMLTEXT_NODE_THIS(iface) DEFINE_THIS2(HTMLDOMTextNode, node, iface)
static HRESULT WINAPI HTMLDOMTextNode_QueryInterface(IHTMLDOMTextNode *iface,
REFIID riid, void **ppv)
{
HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->node), riid, ppv);
}
static ULONG WINAPI HTMLDOMTextNode_AddRef(IHTMLDOMTextNode *iface)
{
HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->node));
}
static ULONG WINAPI HTMLDOMTextNode_Release(IHTMLDOMTextNode *iface)
{
HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
return IHTMLDOMNode_Release(HTMLDOMNODE(&This->node));
}
static HRESULT WINAPI HTMLDOMTextNode_GetTypeInfoCount(IHTMLDOMTextNode *iface, UINT *pctinfo)
{
HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
FIXME("(%p)->(%p)\n", This, pctinfo);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLDOMTextNode_GetTypeInfo(IHTMLDOMTextNode *iface, UINT iTInfo,
LCID lcid, ITypeInfo **ppTInfo)
{
HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLDOMTextNode_GetIDsOfNames(IHTMLDOMTextNode *iface, REFIID riid,
LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId)
{
HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
lcid, rgDispId);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLDOMTextNode_Invoke(IHTMLDOMTextNode *iface, DISPID dispIdMember,
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLDOMTextNode_put_data(IHTMLDOMTextNode *iface, BSTR v)
{
HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLDOMTextNode_get_data(IHTMLDOMTextNode *iface, BSTR *p)
{
HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLDOMTextNode_toString(IHTMLDOMTextNode *iface, BSTR *String)
{
HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
FIXME("(%p)->(%p)\n", This, String);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLDOMTextNode_get_length(IHTMLDOMTextNode *iface, long *p)
{
HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLDOMTextNode_splitText(IHTMLDOMTextNode *iface, long offset, IHTMLDOMNode **pRetNode)
{
HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
FIXME("(%p)->(%ld %p)\n", This, offset, pRetNode);
return E_NOTIMPL;
}
#undef HTMLTEXT_THIS
static const IHTMLDOMTextNodeVtbl HTMLDOMTextNodeVtbl = {
HTMLDOMTextNode_QueryInterface,
HTMLDOMTextNode_AddRef,
HTMLDOMTextNode_Release,
HTMLDOMTextNode_GetTypeInfoCount,
HTMLDOMTextNode_GetTypeInfo,
HTMLDOMTextNode_GetIDsOfNames,
HTMLDOMTextNode_Invoke,
HTMLDOMTextNode_put_data,
HTMLDOMTextNode_get_data,
HTMLDOMTextNode_toString,
HTMLDOMTextNode_get_length,
HTMLDOMTextNode_splitText
};
#define HTMLTEXT_NODE_THIS(iface) DEFINE_THIS2(HTMLDOMTextNode, node, iface)
HRESULT HTMLDOMTextNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
{
HTMLDOMTextNode *This = HTMLTEXT_NODE_THIS(iface);
*ppv = NULL;
if(IsEqualGUID(&IID_IHTMLDOMTextNode, riid)) {
TRACE("(%p)->(IID_IHTMLDOMTextNode %p)\n", This, ppv);
*ppv = HTMLTEXT(This);
}else {
return HTMLDOMNode_QI(&This->node, riid, ppv);
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
void HTMLDOMTextNode_destructor(HTMLDOMNode *iface)
{
HTMLDOMTextNode *This = HTMLTEXT_NODE_THIS(iface);
HTMLDOMNode_destructor(&This->node);
}
#undef HTMLTEXT_NODE_THIS
static const NodeImplVtbl HTMLDOMTextNodeImplVtbl = {
HTMLDOMTextNode_QI,
HTMLDOMTextNode_destructor
};
HTMLDOMNode *HTMLDOMTextNode_Create(nsIDOMNode *nsnode)
{
HTMLDOMTextNode *ret ;
ret = heap_alloc_zero(sizeof(*ret));
ret->node.vtbl = &HTMLDOMTextNodeImplVtbl;
ret->lpIHTMLDOMTextNodeVtbl = &HTMLDOMTextNodeVtbl;
return &ret->node;
}

View File

@ -490,6 +490,8 @@ IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetLis
void detach_selection(HTMLDocument*);
void detach_ranges(HTMLDocument*);
HTMLDOMNode *HTMLDOMTextNode_Create(nsIDOMNode*);
HTMLElement *HTMLElement_Create(nsIDOMNode*);
HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);

View File

@ -40,7 +40,7 @@ static const char range_test2_str[] =
"<html><body>abc<hr />123<br /><hr />def</body></html>";
static const char elem_test_str[] =
"<html><head><title>test</title><style>.body { margin-right: 0px; }</style>"
"<body><a href=\"http://test\" name=\"x\">link</a><input />"
"<body>text test<a href=\"http://test\" name=\"x\">link</a><input />"
"<select id=\"s\"><option id=\"x\">opt1</option><option id=\"y\">opt2</option></select>"
"<textarea id=\"X\">text text</textarea>"
"<table><tbody></tbody></table>"
@ -186,6 +186,13 @@ static REFIID const script_iids[] = {
NULL
};
static REFIID const text_iids[] = {
&IID_IHTMLDOMNode,
&IID_IHTMLDOMNode2,
&IID_IHTMLDOMTextNode,
NULL
};
static REFIID const location_iids[] = {
&IID_IDispatch,
&IID_IHTMLLocation,
@ -750,6 +757,7 @@ static IHTMLDOMNode *_get_first_child(unsigned line, IUnknown *unk)
return NULL;
hres = IHTMLDOMNode_get_firstChild(node, &child);
IHTMLDOMNode_Release(node);
ok_(__FILE__,line) (hres == S_OK, "get_firstChild failed: %08x\n", hres);
return child;
@ -1396,7 +1404,7 @@ static void test_elems(IHTMLDocument2 *doc)
{
IHTMLElementCollection *col;
IHTMLElement *elem;
IHTMLDOMNode *node;
IHTMLDOMNode *node, *node2;
IDispatch *disp;
HRESULT hres;
@ -1492,8 +1500,25 @@ static void test_elems(IHTMLDocument2 *doc)
ok(hres == S_OK, "get_type failed: %08x\n", hres);
ok(!lstrcmpW(type, text_javascriptW), "Unexpected type %s\n", dbgstr_w(type));
SysFreeString(type);
IHTMLScriptElement_Release(script);
}
hres = IHTMLDocument2_get_body(doc, &elem);
ok(hres == S_OK, "get_body failed: %08x\n", hres);
node = get_first_child((IUnknown*)elem);
ok(node != NULL, "node == NULL\n");
if(node) {
test_ifaces((IUnknown*)node, text_iids);
node2 = get_first_child((IUnknown*)node);
ok(!node2, "node2 != NULL\n");
IHTMLDOMNode_Release(node);
}
IHTMLElement_Release(elem);
test_stylesheets(doc);
test_create_option_elem(doc);
}