2008-04-24 18:25:34 +02:00
|
|
|
/*
|
|
|
|
* 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>
|
2012-06-26 12:34:06 +02:00
|
|
|
#include <assert.h>
|
2008-04-24 18:25:34 +02:00
|
|
|
|
|
|
|
#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);
|
|
|
|
|
2009-01-28 06:59:34 +01:00
|
|
|
struct HTMLDOMTextNode {
|
2008-04-24 18:25:34 +02:00
|
|
|
HTMLDOMNode node;
|
2011-01-04 01:53:03 +01:00
|
|
|
IHTMLDOMTextNode IHTMLDOMTextNode_iface;
|
2014-11-20 11:19:41 +01:00
|
|
|
IHTMLDOMTextNode2 IHTMLDOMTextNode2_iface;
|
2009-12-10 01:09:54 +01:00
|
|
|
|
|
|
|
nsIDOMText *nstext;
|
2009-01-28 06:59:34 +01:00
|
|
|
};
|
2008-04-24 18:25:34 +02:00
|
|
|
|
2011-01-04 01:53:03 +01:00
|
|
|
static inline HTMLDOMTextNode *impl_from_IHTMLDOMTextNode(IHTMLDOMTextNode *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDOMTextNode, IHTMLDOMTextNode_iface);
|
|
|
|
}
|
2008-04-24 18:25:34 +02:00
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode_QueryInterface(IHTMLDOMTextNode *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2011-01-04 01:53:03 +01:00
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface);
|
2008-04-24 18:25:34 +02:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_QueryInterface(&This->node.IHTMLDOMNode_iface, riid, ppv);
|
2008-04-24 18:25:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLDOMTextNode_AddRef(IHTMLDOMTextNode *iface)
|
|
|
|
{
|
2011-01-04 01:53:03 +01:00
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface);
|
2008-04-24 18:25:34 +02:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_AddRef(&This->node.IHTMLDOMNode_iface);
|
2008-04-24 18:25:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLDOMTextNode_Release(IHTMLDOMTextNode *iface)
|
|
|
|
{
|
2011-01-04 01:53:03 +01:00
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface);
|
2008-04-24 18:25:34 +02:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_Release(&This->node.IHTMLDOMNode_iface);
|
2008-04-24 18:25:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode_GetTypeInfoCount(IHTMLDOMTextNode *iface, UINT *pctinfo)
|
|
|
|
{
|
2011-01-04 01:53:03 +01:00
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface);
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
|
2008-04-24 18:25:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode_GetTypeInfo(IHTMLDOMTextNode *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
2011-01-04 01:53:03 +01:00
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface);
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
|
2008-04-24 18:25:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode_GetIDsOfNames(IHTMLDOMTextNode *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames,
|
|
|
|
LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
2011-01-04 01:53:03 +01:00
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface);
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
|
2010-12-31 11:07:33 +01:00
|
|
|
lcid, rgDispId);
|
2008-04-24 18:25:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode_Invoke(IHTMLDOMTextNode *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
2011-01-04 01:53:03 +01:00
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface);
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
|
2010-12-31 11:07:33 +01:00
|
|
|
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
2008-04-24 18:25:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode_put_data(IHTMLDOMTextNode *iface, BSTR v)
|
|
|
|
{
|
2011-01-04 01:53:03 +01:00
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface);
|
2013-04-17 13:00:04 +02:00
|
|
|
nsAString nsstr;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
|
|
|
nsAString_InitDepend(&nsstr, v);
|
|
|
|
nsres = nsIDOMText_SetData(This->nstext, &nsstr);
|
|
|
|
nsAString_Finish(&nsstr);
|
|
|
|
return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
|
2008-04-24 18:25:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode_get_data(IHTMLDOMTextNode *iface, BSTR *p)
|
|
|
|
{
|
2011-01-04 01:53:03 +01:00
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface);
|
2013-04-17 13:00:04 +02:00
|
|
|
nsAString nsstr;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&nsstr, NULL);
|
|
|
|
nsres = nsIDOMText_GetData(This->nstext, &nsstr);
|
|
|
|
return return_nsstr(nsres, &nsstr, p);
|
2008-04-24 18:25:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode_toString(IHTMLDOMTextNode *iface, BSTR *String)
|
|
|
|
{
|
2011-01-04 01:53:03 +01:00
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface);
|
2008-04-24 18:25:34 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, String);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-03-12 01:43:31 +01:00
|
|
|
static HRESULT WINAPI HTMLDOMTextNode_get_length(IHTMLDOMTextNode *iface, LONG *p)
|
2008-04-24 18:25:34 +02:00
|
|
|
{
|
2011-01-04 01:53:03 +01:00
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface);
|
2013-01-23 18:44:42 +01:00
|
|
|
UINT32 length = 0;
|
2009-12-10 01:09:54 +01:00
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsres = nsIDOMText_GetLength(This->nstext, &length);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("GetLength failed: %08x\n", nsres);
|
|
|
|
|
|
|
|
*p = length;
|
|
|
|
return S_OK;
|
2008-04-24 18:25:34 +02:00
|
|
|
}
|
|
|
|
|
2009-03-12 01:43:31 +01:00
|
|
|
static HRESULT WINAPI HTMLDOMTextNode_splitText(IHTMLDOMTextNode *iface, LONG offset, IHTMLDOMNode **pRetNode)
|
2008-04-24 18:25:34 +02:00
|
|
|
{
|
2011-01-04 01:53:03 +01:00
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface);
|
2014-12-21 16:32:48 +01:00
|
|
|
HTMLDOMNode *node;
|
|
|
|
nsIDOMText *text;
|
|
|
|
nsresult nsres;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%d %p)\n", This, offset, pRetNode);
|
|
|
|
|
|
|
|
nsres = nsIDOMText_SplitText(This->nstext, offset, &text);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("SplitText failed: %x08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!text) {
|
|
|
|
*pRetNode = NULL;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = get_node(This->node.doc, (nsIDOMNode*)text, TRUE, &node);
|
|
|
|
nsIDOMText_Release(text);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
*pRetNode = &node->IHTMLDOMNode_iface;
|
|
|
|
return S_OK;
|
2008-04-24 18:25:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2014-11-20 11:19:41 +01:00
|
|
|
static inline HTMLDOMTextNode *impl_from_IHTMLDOMTextNode2(IHTMLDOMTextNode2 *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDOMTextNode, IHTMLDOMTextNode2_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode2_QueryInterface(IHTMLDOMTextNode2 *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface);
|
|
|
|
|
|
|
|
return IHTMLDOMNode_QueryInterface(&This->node.IHTMLDOMNode_iface, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLDOMTextNode2_AddRef(IHTMLDOMTextNode2 *iface)
|
|
|
|
{
|
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface);
|
|
|
|
|
|
|
|
return IHTMLDOMNode_AddRef(&This->node.IHTMLDOMNode_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLDOMTextNode2_Release(IHTMLDOMTextNode2 *iface)
|
|
|
|
{
|
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface);
|
|
|
|
|
|
|
|
return IHTMLDOMNode_Release(&This->node.IHTMLDOMNode_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode2_GetTypeInfoCount(IHTMLDOMTextNode2 *iface, UINT *pctinfo)
|
|
|
|
{
|
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface);
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
|
2014-11-20 11:19:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode2_GetTypeInfo(IHTMLDOMTextNode2 *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface);
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
|
2014-11-20 11:19:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode2_GetIDsOfNames(IHTMLDOMTextNode2 *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface);
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
|
2014-11-20 11:19:41 +01:00
|
|
|
lcid, rgDispId);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode2_Invoke(IHTMLDOMTextNode2 *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
|
|
|
|
EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface);
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
|
2014-11-20 11:19:41 +01:00
|
|
|
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode2_substringData(IHTMLDOMTextNode2 *iface, LONG offset, LONG count, BSTR *string)
|
|
|
|
{
|
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface);
|
|
|
|
FIXME("(%p)->(%d %d %p)\n", This, offset, count, string);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode2_appendData(IHTMLDOMTextNode2 *iface, BSTR string)
|
|
|
|
{
|
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface);
|
2014-11-21 13:02:17 +01:00
|
|
|
nsAString nsstr;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(string));
|
|
|
|
|
|
|
|
nsAString_InitDepend(&nsstr, string);
|
|
|
|
nsres = nsIDOMText_AppendData(This->nstext, &nsstr);
|
|
|
|
nsAString_Finish(&nsstr);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("AppendData failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2014-11-20 11:19:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode2_insertData(IHTMLDOMTextNode2 *iface, LONG offset, BSTR string)
|
|
|
|
{
|
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface);
|
|
|
|
FIXME("(%p)->(%d %s)\n", This, offset, debugstr_w(string));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode2_deleteData(IHTMLDOMTextNode2 *iface, LONG offset, LONG count)
|
|
|
|
{
|
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface);
|
|
|
|
FIXME("(%p)->(%d %d)\n", This, offset, count);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMTextNode2_replaceData(IHTMLDOMTextNode2 *iface, LONG offset, LONG count, BSTR string)
|
|
|
|
{
|
|
|
|
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface);
|
|
|
|
FIXME("(%p)->(%d %d %s)\n", This, offset, count, debugstr_w(string));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IHTMLDOMTextNode2Vtbl HTMLDOMTextNode2Vtbl = {
|
|
|
|
HTMLDOMTextNode2_QueryInterface,
|
|
|
|
HTMLDOMTextNode2_AddRef,
|
|
|
|
HTMLDOMTextNode2_Release,
|
|
|
|
HTMLDOMTextNode2_GetTypeInfoCount,
|
|
|
|
HTMLDOMTextNode2_GetTypeInfo,
|
|
|
|
HTMLDOMTextNode2_GetIDsOfNames,
|
|
|
|
HTMLDOMTextNode2_Invoke,
|
|
|
|
HTMLDOMTextNode2_substringData,
|
|
|
|
HTMLDOMTextNode2_appendData,
|
|
|
|
HTMLDOMTextNode2_insertData,
|
|
|
|
HTMLDOMTextNode2_deleteData,
|
|
|
|
HTMLDOMTextNode2_replaceData
|
|
|
|
};
|
|
|
|
|
2010-12-27 20:13:09 +01:00
|
|
|
static inline HTMLDOMTextNode *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDOMTextNode, node);
|
|
|
|
}
|
2008-04-24 18:25:34 +02:00
|
|
|
|
2008-12-02 15:28:04 +01:00
|
|
|
static HRESULT HTMLDOMTextNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
|
2008-04-24 18:25:34 +02:00
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLDOMTextNode *This = impl_from_HTMLDOMNode(iface);
|
2008-04-24 18:25:34 +02:00
|
|
|
|
2014-11-20 11:19:41 +01:00
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
|
2008-04-24 18:25:34 +02:00
|
|
|
|
2014-11-20 11:19:41 +01:00
|
|
|
if(IsEqualGUID(&IID_IHTMLDOMTextNode, riid))
|
2011-01-04 01:53:03 +01:00
|
|
|
*ppv = &This->IHTMLDOMTextNode_iface;
|
2014-11-20 11:19:41 +01:00
|
|
|
else if(IsEqualGUID(&IID_IHTMLDOMTextNode2, riid))
|
|
|
|
*ppv = &This->IHTMLDOMTextNode2_iface;
|
|
|
|
else
|
2008-04-24 18:25:34 +02:00
|
|
|
return HTMLDOMNode_QI(&This->node, riid, ppv);
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-11-14 14:41:39 +01:00
|
|
|
static HRESULT HTMLDOMTextNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
|
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLDOMTextNode *This = impl_from_HTMLDOMNode(iface);
|
2010-12-01 22:42:03 +01:00
|
|
|
|
2012-06-26 12:33:35 +02:00
|
|
|
return HTMLDOMTextNode_Create(This->node.doc, nsnode, ret);
|
2010-11-14 14:41:39 +01:00
|
|
|
}
|
|
|
|
|
2013-03-15 15:01:53 +01:00
|
|
|
static const cpc_entry_t HTMLDOMTextNode_cpc[] = {{NULL}};
|
|
|
|
|
2008-04-24 18:25:34 +02:00
|
|
|
static const NodeImplVtbl HTMLDOMTextNodeImplVtbl = {
|
|
|
|
HTMLDOMTextNode_QI,
|
2012-06-26 12:34:06 +02:00
|
|
|
HTMLDOMNode_destructor,
|
2013-03-15 15:01:53 +01:00
|
|
|
HTMLDOMTextNode_cpc,
|
2010-11-14 14:41:39 +01:00
|
|
|
HTMLDOMTextNode_clone
|
2008-04-24 18:25:34 +02:00
|
|
|
};
|
|
|
|
|
2008-05-06 16:04:58 +02:00
|
|
|
static const tid_t HTMLDOMTextNode_iface_tids[] = {
|
|
|
|
IHTMLDOMNode_tid,
|
|
|
|
IHTMLDOMNode2_tid,
|
|
|
|
IHTMLDOMTextNode_tid,
|
2014-11-20 11:19:41 +01:00
|
|
|
IHTMLDOMTextNode2_tid,
|
2008-05-06 16:04:58 +02:00
|
|
|
0
|
|
|
|
};
|
2008-04-24 18:25:51 +02:00
|
|
|
static dispex_static_data_t HTMLDOMTextNode_dispex = {
|
2008-04-29 01:38:09 +02:00
|
|
|
NULL,
|
2008-04-24 18:25:51 +02:00
|
|
|
DispHTMLDOMTextNode_tid,
|
2008-05-06 16:04:58 +02:00
|
|
|
HTMLDOMTextNode_iface_tids
|
2008-04-24 18:25:51 +02:00
|
|
|
};
|
|
|
|
|
2010-12-01 22:42:03 +01:00
|
|
|
HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDOMNode **node)
|
2008-04-24 18:25:34 +02:00
|
|
|
{
|
2009-12-10 01:09:54 +01:00
|
|
|
HTMLDOMTextNode *ret;
|
|
|
|
nsresult nsres;
|
2008-04-24 18:25:34 +02:00
|
|
|
|
|
|
|
ret = heap_alloc_zero(sizeof(*ret));
|
2010-12-01 22:42:03 +01:00
|
|
|
if(!ret)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2008-04-24 18:25:34 +02:00
|
|
|
ret->node.vtbl = &HTMLDOMTextNodeImplVtbl;
|
2011-01-04 01:53:03 +01:00
|
|
|
ret->IHTMLDOMTextNode_iface.lpVtbl = &HTMLDOMTextNodeVtbl;
|
2014-11-20 11:19:41 +01:00
|
|
|
ret->IHTMLDOMTextNode2_iface.lpVtbl = &HTMLDOMTextNode2Vtbl;
|
2008-04-24 18:25:34 +02:00
|
|
|
|
2015-05-14 13:24:19 +02:00
|
|
|
init_dispex(&ret->node.event_target.dispex, (IUnknown*)&ret->IHTMLDOMTextNode_iface,
|
2011-01-04 01:53:03 +01:00
|
|
|
&HTMLDOMTextNode_dispex);
|
2012-06-26 12:34:06 +02:00
|
|
|
|
2010-12-01 22:42:03 +01:00
|
|
|
HTMLDOMNode_Init(doc, &ret->node, nsnode);
|
|
|
|
|
2012-06-26 12:34:06 +02:00
|
|
|
nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMText, (void**)&ret->nstext);
|
|
|
|
assert(nsres == NS_OK && (nsIDOMNode*)ret->nstext == ret->node.nsnode);
|
|
|
|
|
|
|
|
/* Share reference with nsnode */
|
|
|
|
nsIDOMNode_Release(ret->node.nsnode);
|
|
|
|
|
2010-12-01 22:42:03 +01:00
|
|
|
*node = &ret->node;
|
|
|
|
return S_OK;
|
2008-04-24 18:25:34 +02:00
|
|
|
}
|