2006-03-05 20:39:59 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2006 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2006-03-05 20:39:59 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
2007-06-24 10:17:51 +02:00
|
|
|
#include "winreg.h"
|
2006-03-05 20:39:59 +01:00
|
|
|
#include "ole2.h"
|
2007-06-24 10:17:51 +02:00
|
|
|
#include "shlwapi.h"
|
2006-03-05 20:39:59 +01:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
#include "mshtml_private.h"
|
2008-10-09 22:36:01 +02:00
|
|
|
#include "htmlevent.h"
|
2011-02-28 13:13:12 +01:00
|
|
|
#include "htmlstyle.h"
|
2006-03-05 20:39:59 +01:00
|
|
|
|
2011-06-17 16:17:45 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|
|
|
|
2010-12-01 22:42:35 +01:00
|
|
|
static const WCHAR aW[] = {'A',0};
|
|
|
|
static const WCHAR bodyW[] = {'B','O','D','Y',0};
|
|
|
|
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};
|
2011-06-21 13:47:09 +02:00
|
|
|
static const WCHAR headW[] = {'H','E','A','D',0};
|
2010-12-01 22:42:35 +01:00
|
|
|
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};
|
|
|
|
static const WCHAR objectW[] = {'O','B','J','E','C','T',0};
|
|
|
|
static const WCHAR optionW[] = {'O','P','T','I','O','N',0};
|
|
|
|
static const WCHAR scriptW[] = {'S','C','R','I','P','T',0};
|
|
|
|
static const WCHAR selectW[] = {'S','E','L','E','C','T',0};
|
|
|
|
static const WCHAR styleW[] = {'S','T','Y','L','E',0};
|
|
|
|
static const WCHAR tableW[] = {'T','A','B','L','E',0};
|
|
|
|
static const WCHAR textareaW[] = {'T','E','X','T','A','R','E','A',0};
|
2011-06-21 13:48:00 +02:00
|
|
|
static const WCHAR title_tagW[]= {'T','I','T','L','E',0};
|
2010-12-01 22:42:35 +01:00
|
|
|
static const WCHAR trW[] = {'T','R',0};
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
const WCHAR *name;
|
2010-12-01 22:43:14 +01:00
|
|
|
HRESULT (*constructor)(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
|
2010-12-01 22:42:35 +01:00
|
|
|
} tag_desc_t;
|
|
|
|
|
|
|
|
static const tag_desc_t tag_descs[] = {
|
|
|
|
{aW, HTMLAnchorElement_Create},
|
|
|
|
{bodyW, HTMLBodyElement_Create},
|
|
|
|
{embedW, HTMLEmbedElement_Create},
|
|
|
|
{formW, HTMLFormElement_Create},
|
|
|
|
{frameW, HTMLFrameElement_Create},
|
2011-06-21 13:47:09 +02:00
|
|
|
{headW, HTMLHeadElement_Create},
|
2010-12-01 22:42:35 +01:00
|
|
|
{iframeW, HTMLIFrame_Create},
|
|
|
|
{imgW, HTMLImgElement_Create},
|
|
|
|
{inputW, HTMLInputElement_Create},
|
|
|
|
{objectW, HTMLObjectElement_Create},
|
|
|
|
{optionW, HTMLOptionElement_Create},
|
|
|
|
{scriptW, HTMLScriptElement_Create},
|
|
|
|
{selectW, HTMLSelectElement_Create},
|
|
|
|
{styleW, HTMLStyleElement_Create},
|
|
|
|
{tableW, HTMLTable_Create},
|
|
|
|
{textareaW, HTMLTextAreaElement_Create},
|
2011-06-21 13:48:00 +02:00
|
|
|
{title_tagW, HTMLTitleElement_Create},
|
2010-12-01 22:42:35 +01:00
|
|
|
{trW, HTMLTableRow_Create}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const tag_desc_t *get_tag_desc(const WCHAR *tag_name)
|
|
|
|
{
|
|
|
|
DWORD min=0, max=sizeof(tag_descs)/sizeof(*tag_descs)-1, i;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
while(min <= max) {
|
|
|
|
i = (min+max)/2;
|
|
|
|
r = strcmpW(tag_name, tag_descs[i].name);
|
|
|
|
if(!r)
|
|
|
|
return tag_descs+i;
|
|
|
|
|
|
|
|
if(r < 0)
|
|
|
|
max = i-1;
|
|
|
|
else
|
|
|
|
min = i+1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-06-17 16:18:05 +02:00
|
|
|
HRESULT replace_node_by_html(nsIDOMHTMLDocument *nsdoc, nsIDOMNode *nsnode, const WCHAR *html)
|
2011-06-17 16:17:45 +02:00
|
|
|
{
|
|
|
|
nsIDOMDocumentFragment *nsfragment;
|
|
|
|
nsIDOMNSRange *nsrange;
|
|
|
|
nsIDOMNode *nsparent;
|
|
|
|
nsIDOMRange *range;
|
|
|
|
nsAString html_str;
|
|
|
|
nsresult nsres;
|
|
|
|
HRESULT hres = S_OK;
|
|
|
|
|
2011-08-23 14:07:02 +02:00
|
|
|
nsres = nsIDOMHTMLDocument_CreateRange(nsdoc, &range);
|
2011-06-17 16:17:45 +02:00
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("CreateRange failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIDOMRange_QueryInterface(range, &IID_nsIDOMNSRange, (void**)&nsrange);
|
|
|
|
nsIDOMRange_Release(range);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Could not get nsIDOMNSRange: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAString_InitDepend(&html_str, html);
|
|
|
|
nsIDOMNSRange_CreateContextualFragment(nsrange, &html_str, &nsfragment);
|
|
|
|
nsIDOMNSRange_Release(nsrange);
|
|
|
|
nsAString_Finish(&html_str);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("CreateContextualFragment failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIDOMNode_GetParentNode(nsnode, &nsparent);
|
|
|
|
if(NS_SUCCEEDED(nsres) && nsparent) {
|
|
|
|
nsIDOMNode *nstmp;
|
|
|
|
|
|
|
|
nsres = nsIDOMNode_ReplaceChild(nsparent, (nsIDOMNode*)nsfragment, nsnode, &nstmp);
|
|
|
|
nsIDOMNode_Release(nsparent);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("ReplaceChild failed: %08x\n", nsres);
|
|
|
|
hres = E_FAIL;
|
|
|
|
}else if(nstmp) {
|
|
|
|
nsIDOMNode_Release(nstmp);
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
ERR("GetParentNode failed: %08x\n", nsres);
|
|
|
|
hres = E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIDOMDocumentFragment_Release(nsfragment);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2009-12-19 13:23:19 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
DispatchEx dispex;
|
2010-12-30 01:32:54 +01:00
|
|
|
IHTMLFiltersCollection IHTMLFiltersCollection_iface;
|
2009-12-19 13:23:19 +01:00
|
|
|
|
|
|
|
LONG ref;
|
|
|
|
} HTMLFiltersCollection;
|
|
|
|
|
2010-12-30 01:32:54 +01:00
|
|
|
static inline HTMLFiltersCollection *impl_from_IHTMLFiltersCollection(IHTMLFiltersCollection *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLFiltersCollection, IHTMLFiltersCollection_iface);
|
|
|
|
}
|
2009-12-19 13:23:19 +01:00
|
|
|
|
2011-04-10 18:46:08 +02:00
|
|
|
static IHTMLFiltersCollection *HTMLFiltersCollection_Create(void);
|
2009-12-19 13:23:19 +01:00
|
|
|
|
2010-12-30 01:24:59 +01:00
|
|
|
static inline HTMLElement *impl_from_IHTMLElement(IHTMLElement *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement_iface);
|
|
|
|
}
|
2006-03-05 20:39:59 +01:00
|
|
|
|
2009-10-19 23:04:19 +02:00
|
|
|
HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMHTMLElement **ret)
|
|
|
|
{
|
|
|
|
nsIDOMElement *nselem;
|
|
|
|
nsAString tag_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
2009-10-21 21:27:42 +02:00
|
|
|
if(!doc->nsdoc) {
|
2009-10-19 23:04:19 +02:00
|
|
|
WARN("NULL nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
2010-01-28 23:55:31 +01:00
|
|
|
nsAString_InitDepend(&tag_str, tag);
|
2009-10-21 21:27:42 +02:00
|
|
|
nsres = nsIDOMDocument_CreateElement(doc->nsdoc, &tag_str, &nselem);
|
2009-10-19 23:04:19 +02:00
|
|
|
nsAString_Finish(&tag_str);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("CreateElement failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLElement, (void**)ret);
|
|
|
|
nsIDOMElement_Release(nselem);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Could not get nsIDOMHTMLElement iface: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-03-05 20:39:59 +01:00
|
|
|
static HRESULT WINAPI HTMLElement_QueryInterface(IHTMLElement *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_QueryInterface(&This->node.IHTMLDOMNode_iface, riid, ppv);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLElement_AddRef(IHTMLElement *iface)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_AddRef(&This->node.IHTMLDOMNode_iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLElement_Release(IHTMLElement *iface)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_Release(&This->node.IHTMLDOMNode_iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_GetTypeInfoCount(IHTMLElement *iface, UINT *pctinfo)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2010-12-31 11:07:33 +01:00
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->node.dispex.IDispatchEx_iface, pctinfo);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_GetTypeInfo(IHTMLElement *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2010-12-31 11:07:33 +01:00
|
|
|
return IDispatchEx_GetTypeInfo(&This->node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_GetIDsOfNames(IHTMLElement *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames,
|
|
|
|
LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2010-12-31 11:07:33 +01:00
|
|
|
return IDispatchEx_GetIDsOfNames(&This->node.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
|
|
|
|
lcid, rgDispId);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_Invoke(IHTMLElement *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2010-12-31 11:07:33 +01:00
|
|
|
return IDispatchEx_Invoke(&This->node.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
|
2008-08-16 13:12:38 +02:00
|
|
|
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_setAttribute(IHTMLElement *iface, BSTR strAttributeName,
|
|
|
|
VARIANT AttributeValue, LONG lFlags)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2007-06-24 10:18:41 +02:00
|
|
|
HRESULT hres;
|
2009-09-21 19:29:55 +02:00
|
|
|
DISPID dispid, dispidNamed = DISPID_PROPERTYPUT;
|
|
|
|
DISPPARAMS dispParams;
|
|
|
|
EXCEPINFO excep;
|
2007-06-24 10:18:41 +02:00
|
|
|
|
2009-09-21 19:29:55 +02:00
|
|
|
TRACE("(%p)->(%s . %08x)\n", This, debugstr_w(strAttributeName), lFlags);
|
2007-06-24 10:18:41 +02:00
|
|
|
|
2010-12-31 11:07:33 +01:00
|
|
|
hres = IDispatchEx_GetDispID(&This->node.dispex.IDispatchEx_iface, strAttributeName,
|
2009-09-21 19:29:55 +02:00
|
|
|
fdexNameCaseInsensitive | fdexNameEnsure, &dispid);
|
|
|
|
if(FAILED(hres))
|
2007-06-24 10:18:41 +02:00
|
|
|
return hres;
|
|
|
|
|
2009-09-21 19:29:55 +02:00
|
|
|
dispParams.cArgs = 1;
|
|
|
|
dispParams.cNamedArgs = 1;
|
|
|
|
dispParams.rgdispidNamedArgs = &dispidNamed;
|
|
|
|
dispParams.rgvarg = &AttributeValue;
|
2007-06-24 10:18:41 +02:00
|
|
|
|
2010-12-31 11:07:33 +01:00
|
|
|
hres = IDispatchEx_InvokeEx(&This->node.dispex.IDispatchEx_iface, dispid,
|
|
|
|
LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT, &dispParams, NULL, &excep, NULL);
|
2007-06-24 10:18:41 +02:00
|
|
|
return hres;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttributeName,
|
|
|
|
LONG lFlags, VARIANT *AttributeValue)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2009-09-21 19:29:55 +02:00
|
|
|
DISPID dispid;
|
|
|
|
HRESULT hres;
|
|
|
|
DISPPARAMS dispParams = {NULL, NULL, 0, 0};
|
|
|
|
EXCEPINFO excep;
|
2006-03-09 08:35:58 +01:00
|
|
|
|
2009-09-21 19:29:55 +02:00
|
|
|
TRACE("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
|
2006-03-09 08:35:58 +01:00
|
|
|
|
2010-12-31 11:07:33 +01:00
|
|
|
hres = IDispatchEx_GetDispID(&This->node.dispex.IDispatchEx_iface, strAttributeName,
|
2009-09-21 19:29:55 +02:00
|
|
|
fdexNameCaseInsensitive, &dispid);
|
|
|
|
if(hres == DISP_E_UNKNOWNNAME) {
|
2008-06-19 00:08:14 +02:00
|
|
|
V_VT(AttributeValue) = VT_NULL;
|
|
|
|
return S_OK;
|
2008-04-30 18:18:46 +02:00
|
|
|
}
|
|
|
|
|
2009-09-21 19:29:55 +02:00
|
|
|
if(FAILED(hres)) {
|
|
|
|
V_VT(AttributeValue) = VT_NULL;
|
|
|
|
return hres;
|
2006-03-09 08:35:58 +01:00
|
|
|
}
|
|
|
|
|
2010-12-31 11:07:33 +01:00
|
|
|
hres = IDispatchEx_InvokeEx(&This->node.dispex.IDispatchEx_iface, dispid, LOCALE_SYSTEM_DEFAULT,
|
|
|
|
DISPATCH_PROPERTYGET, &dispParams, AttributeValue, &excep, NULL);
|
2006-03-09 08:35:58 +01:00
|
|
|
|
|
|
|
return hres;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_removeAttribute(IHTMLElement *iface, BSTR strAttributeName,
|
|
|
|
LONG lFlags, VARIANT_BOOL *pfSuccess)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2010-03-24 20:34:17 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(strAttributeName), lFlags, pfSuccess);
|
|
|
|
|
|
|
|
return remove_prop(&This->node.dispex, strAttributeName, pfSuccess);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_className(IHTMLElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-06-23 16:52:17 +02:00
|
|
|
nsAString classname_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
|
|
|
if(!This->nselem) {
|
|
|
|
FIXME("NULL nselem\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2010-01-28 23:55:31 +01:00
|
|
|
nsAString_InitDepend(&classname_str, v);
|
2008-06-23 16:52:17 +02:00
|
|
|
nsres = nsIDOMHTMLElement_SetClassName(This->nselem, &classname_str);
|
|
|
|
nsAString_Finish(&classname_str);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("SetClassName failed: %08x\n", nsres);
|
|
|
|
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_className(IHTMLElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-10-20 15:38:39 +02:00
|
|
|
nsAString class_str;
|
|
|
|
nsresult nsres;
|
|
|
|
HRESULT hres = S_OK;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2008-04-30 18:18:46 +02:00
|
|
|
if(!This->nselem) {
|
|
|
|
FIXME("NULL nselem\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2006-10-20 15:38:39 +02:00
|
|
|
nsAString_Init(&class_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLElement_GetClassName(This->nselem, &class_str);
|
|
|
|
|
|
|
|
if(NS_SUCCEEDED(nsres)) {
|
|
|
|
const PRUnichar *class;
|
2007-12-17 01:38:30 +01:00
|
|
|
nsAString_GetData(&class_str, &class);
|
2008-06-23 16:51:28 +02:00
|
|
|
*p = *class ? SysAllocString(class) : NULL;
|
2006-10-20 15:38:39 +02:00
|
|
|
}else {
|
|
|
|
ERR("GetClassName failed: %08x\n", nsres);
|
|
|
|
hres = E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAString_Finish(&class_str);
|
|
|
|
|
|
|
|
TRACE("className=%s\n", debugstr_w(*p));
|
|
|
|
return hres;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_id(IHTMLElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-06-18 00:09:25 +02:00
|
|
|
nsAString id_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
|
|
|
if(!This->nselem) {
|
|
|
|
FIXME("nselem == NULL\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-01-28 23:55:31 +01:00
|
|
|
nsAString_InitDepend(&id_str, v);
|
2008-06-18 00:09:25 +02:00
|
|
|
nsres = nsIDOMHTMLElement_SetId(This->nselem, &id_str);
|
|
|
|
nsAString_Finish(&id_str);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("SetId failed: %08x\n", nsres);
|
|
|
|
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_id(IHTMLElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-06-18 00:09:08 +02:00
|
|
|
const PRUnichar *id;
|
|
|
|
nsAString id_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
*p = NULL;
|
|
|
|
|
|
|
|
if(!This->nselem)
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
nsAString_Init(&id_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLElement_GetId(This->nselem, &id_str);
|
|
|
|
nsAString_GetData(&id_str, &id);
|
|
|
|
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("GetId failed: %08x\n", nsres);
|
|
|
|
else if(*id)
|
|
|
|
*p = SysAllocString(id);
|
|
|
|
|
|
|
|
nsAString_Finish(&id_str);
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_tagName(IHTMLElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2007-10-02 14:20:34 +02:00
|
|
|
const PRUnichar *tag;
|
|
|
|
nsAString tag_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2008-04-30 18:18:46 +02:00
|
|
|
if(!This->nselem) {
|
|
|
|
static const WCHAR comment_tagW[] = {'!',0};
|
|
|
|
|
|
|
|
WARN("NULL nselem, assuming comment\n");
|
|
|
|
|
|
|
|
*p = SysAllocString(comment_tagW);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2007-10-02 14:20:34 +02:00
|
|
|
nsAString_Init(&tag_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLElement_GetTagName(This->nselem, &tag_str);
|
|
|
|
if(NS_SUCCEEDED(nsres)) {
|
2007-12-17 01:38:30 +01:00
|
|
|
nsAString_GetData(&tag_str, &tag);
|
2007-10-02 14:20:34 +02:00
|
|
|
*p = SysAllocString(tag);
|
|
|
|
}else {
|
|
|
|
ERR("GetTagName failed: %08x\n", nsres);
|
|
|
|
*p = NULL;
|
|
|
|
}
|
|
|
|
nsAString_Finish(&tag_str);
|
|
|
|
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_parentElement(IHTMLElement *iface, IHTMLElement **p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-08-25 10:09:24 +02:00
|
|
|
IHTMLDOMNode *node;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
hres = IHTMLDOMNode_get_parentNode(&This->node.IHTMLDOMNode_iface, &node);
|
2008-08-25 10:09:24 +02:00
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
hres = IHTMLDOMNode_QueryInterface(node, &IID_IHTMLElement, (void**)p);
|
|
|
|
IHTMLDOMNode_Release(node);
|
|
|
|
if(FAILED(hres))
|
|
|
|
*p = NULL;
|
|
|
|
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_style(IHTMLElement *iface, IHTMLStyle **p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-11-17 13:04:06 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2011-02-28 13:13:12 +01:00
|
|
|
if(!This->style) {
|
|
|
|
nsIDOMElementCSSInlineStyle *nselemstyle;
|
|
|
|
nsIDOMCSSStyleDeclaration *nsstyle;
|
|
|
|
nsresult nsres;
|
|
|
|
HRESULT hres;
|
2008-04-30 18:18:46 +02:00
|
|
|
|
2011-02-28 13:13:12 +01:00
|
|
|
if(!This->nselem) {
|
|
|
|
FIXME("NULL nselem\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
2006-11-17 13:05:01 +01:00
|
|
|
|
2011-02-28 13:13:12 +01:00
|
|
|
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMElementCSSInlineStyle,
|
|
|
|
(void**)&nselemstyle);
|
|
|
|
if(NS_FAILED(nsres)) {
|
2011-08-03 23:50:18 +02:00
|
|
|
ERR("Could not get nsIDOMCSSStyleDeclaration interface: %08x\n", nsres);
|
2011-02-28 13:13:12 +01:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
2006-11-17 13:05:01 +01:00
|
|
|
|
2011-02-28 13:13:12 +01:00
|
|
|
nsres = nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle, &nsstyle);
|
|
|
|
nsIDOMElementCSSInlineStyle_Release(nselemstyle);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetStyle failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = HTMLStyle_Create(nsstyle, &This->style);
|
|
|
|
nsIDOMCSSStyleDeclaration_Release(nsstyle);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
}
|
2006-11-17 13:05:01 +01:00
|
|
|
|
2011-02-28 13:13:12 +01:00
|
|
|
*p = &This->style->IHTMLStyle_iface;
|
|
|
|
IHTMLStyle_AddRef(*p);
|
2006-11-17 13:04:06 +01:00
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onhelp(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onhelp(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onclick(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-06-23 16:54:51 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->()\n", This);
|
|
|
|
|
|
|
|
return set_node_event(&This->node, EVENTID_CLICK, &v);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onclick(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-10 22:49:33 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_node_event(&This->node, EVENTID_CLICK, p);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_ondblclick(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2009-09-08 22:32:47 +02:00
|
|
|
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_node_event(&This->node, EVENTID_DBLCLICK, &v);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_ondblclick(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2009-09-08 22:32:47 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_node_event(&This->node, EVENTID_DBLCLICK, p);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onkeydown(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-10 22:49:16 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_node_event(&This->node, EVENTID_KEYDOWN, &v);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onkeydown(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-10 22:49:16 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_node_event(&This->node, EVENTID_KEYDOWN, p);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onkeyup(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-06-24 03:01:25 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->()\n", This);
|
|
|
|
|
|
|
|
return set_node_event(&This->node, EVENTID_KEYUP, &v);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onkeyup(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onkeypress(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onkeypress(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onmouseout(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-10 22:49:33 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_node_event(&This->node, EVENTID_MOUSEOUT, &v);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onmouseout(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-10 22:49:33 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_node_event(&This->node, EVENTID_MOUSEOUT, p);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onmouseover(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-10 22:46:08 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->()\n", This);
|
|
|
|
|
|
|
|
return set_node_event(&This->node, EVENTID_MOUSEOVER, &v);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onmouseover(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-10 22:46:32 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_node_event(&This->node, EVENTID_MOUSEOVER, p);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onmousemove(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2011-02-21 10:23:48 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->()\n", This);
|
|
|
|
|
|
|
|
return set_node_event(&This->node, EVENTID_MOUSEMOVE, &v);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onmousemove(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2011-02-21 10:23:48 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_node_event(&This->node, EVENTID_MOUSEMOVE, p);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onmousedown(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-10 22:49:16 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->()\n", This);
|
|
|
|
|
|
|
|
return set_node_event(&This->node, EVENTID_MOUSEDOWN, &v);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onmousedown(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-10 22:49:16 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_node_event(&This->node, EVENTID_MOUSEDOWN, p);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onmouseup(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-10 22:49:16 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_node_event(&This->node, EVENTID_MOUSEUP, &v);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onmouseup(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-10 22:49:16 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_node_event(&This->node, EVENTID_MOUSEUP, p);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_document(IHTMLElement *iface, IDispatch **p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-30 11:38:23 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
if(!p)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2009-11-24 21:13:38 +01:00
|
|
|
if(This->node.vtbl->get_document)
|
|
|
|
return This->node.vtbl->get_document(&This->node, p);
|
|
|
|
|
2010-12-16 14:59:51 +01:00
|
|
|
*p = (IDispatch*)&This->node.doc->basedoc.IHTMLDocument2_iface;
|
2008-10-30 11:38:23 +01:00
|
|
|
IDispatch_AddRef(*p);
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
2010-02-08 21:50:08 +01:00
|
|
|
static const WCHAR titleW[] = {'t','i','t','l','e',0};
|
|
|
|
|
2006-03-05 20:39:59 +01:00
|
|
|
static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-06-24 22:24:06 +02:00
|
|
|
nsAString title_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
2010-02-08 21:50:08 +01:00
|
|
|
if(!This->nselem) {
|
|
|
|
VARIANT *var;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = dispex_get_dprop_ref(&This->node.dispex, titleW, TRUE, &var);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
VariantClear(var);
|
|
|
|
V_VT(var) = VT_BSTR;
|
|
|
|
V_BSTR(var) = v ? SysAllocString(v) : NULL;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-01-28 23:55:31 +01:00
|
|
|
nsAString_InitDepend(&title_str, v);
|
2008-06-24 22:24:06 +02:00
|
|
|
nsres = nsIDOMHTMLElement_SetTitle(This->nselem, &title_str);
|
|
|
|
nsAString_Finish(&title_str);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("SetTitle failed: %08x\n", nsres);
|
|
|
|
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-06-24 22:23:46 +02:00
|
|
|
nsAString title_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2010-02-08 21:50:08 +01:00
|
|
|
if(!This->nselem) {
|
|
|
|
VARIANT *var;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = dispex_get_dprop_ref(&This->node.dispex, titleW, FALSE, &var);
|
|
|
|
if(hres == DISP_E_UNKNOWNNAME) {
|
|
|
|
*p = NULL;
|
|
|
|
}else if(V_VT(var) != VT_BSTR) {
|
|
|
|
FIXME("title = %s\n", debugstr_variant(var));
|
|
|
|
return E_FAIL;
|
|
|
|
}else {
|
|
|
|
*p = V_BSTR(var) ? SysAllocString(V_BSTR(var)) : NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2008-06-24 22:23:46 +02:00
|
|
|
nsAString_Init(&title_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLElement_GetTitle(This->nselem, &title_str);
|
|
|
|
if(NS_SUCCEEDED(nsres)) {
|
|
|
|
const PRUnichar *title;
|
|
|
|
|
|
|
|
nsAString_GetData(&title_str, &title);
|
|
|
|
*p = *title ? SysAllocString(title) : NULL;
|
|
|
|
}else {
|
|
|
|
ERR("GetTitle failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_language(IHTMLElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_language(IHTMLElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onselectstart(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-10 22:49:33 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_node_event(&This->node, EVENTID_SELECTSTART, &v);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onselectstart(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-10 22:49:33 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_node_event(&This->node, EVENTID_SELECTSTART, p);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_scrollIntoView(IHTMLElement *iface, VARIANT varargStart)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_contains(IHTMLElement *iface, IHTMLElement *pChild,
|
|
|
|
VARIANT_BOOL *pfResult)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p %p)\n", This, pChild, pfResult);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-03-12 01:43:18 +01:00
|
|
|
static HRESULT WINAPI HTMLElement_get_sourceIndex(IHTMLElement *iface, LONG *p)
|
2006-03-05 20:39:59 +01:00
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_recordNumber(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_lang(IHTMLElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_lang(IHTMLElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-03-12 01:43:18 +01:00
|
|
|
static HRESULT WINAPI HTMLElement_get_offsetLeft(IHTMLElement *iface, LONG *p)
|
2006-03-05 20:39:59 +01:00
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2011-05-31 12:19:13 +02:00
|
|
|
nsIDOMNSHTMLElement *nselem;
|
|
|
|
PRInt32 off_left = 0;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIDOMNSHTMLElement_GetOffsetLeft(nselem, &off_left);
|
|
|
|
nsIDOMNSHTMLElement_Release(nselem);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetOffsetLeft failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*p = off_left;
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
2009-03-12 01:43:18 +01:00
|
|
|
static HRESULT WINAPI HTMLElement_get_offsetTop(IHTMLElement *iface, LONG *p)
|
2006-03-05 20:39:59 +01:00
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-06-26 02:28:05 +02:00
|
|
|
nsIDOMNSHTMLElement *nselem;
|
|
|
|
PRInt32 top = 0;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIDOMNSHTMLElement_GetOffsetTop(nselem, &top);
|
|
|
|
nsIDOMNSHTMLElement_Release(nselem);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetOffsetTop failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*p = top;
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
2009-03-12 01:43:18 +01:00
|
|
|
static HRESULT WINAPI HTMLElement_get_offsetWidth(IHTMLElement *iface, LONG *p)
|
2006-03-05 20:39:59 +01:00
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-07 21:43:30 +02:00
|
|
|
nsIDOMNSHTMLElement *nselem;
|
|
|
|
PRInt32 offset = 0;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIDOMNSHTMLElement_GetOffsetWidth(nselem, &offset);
|
|
|
|
nsIDOMNSHTMLElement_Release(nselem);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetOffsetWidth failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*p = offset;
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
2009-03-12 01:43:18 +01:00
|
|
|
static HRESULT WINAPI HTMLElement_get_offsetHeight(IHTMLElement *iface, LONG *p)
|
2006-03-05 20:39:59 +01:00
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-08-01 01:25:11 +02:00
|
|
|
nsIDOMNSHTMLElement *nselem;
|
|
|
|
PRInt32 offset = 0;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIDOMNSHTMLElement_GetOffsetHeight(nselem, &offset);
|
|
|
|
nsIDOMNSHTMLElement_Release(nselem);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetOffsetHeight failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*p = offset;
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_offsetParent(IHTMLElement *iface, IHTMLElement **p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2011-06-02 17:58:55 +02:00
|
|
|
nsIDOMNSHTMLElement *nselem;
|
|
|
|
nsIDOMElement *nsparent;
|
|
|
|
nsresult nsres;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIDOMNSHTMLElement_GetOffsetParent(nselem, &nsparent);
|
|
|
|
nsIDOMNSHTMLElement_Release(nselem);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetOffsetParent failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(nsparent) {
|
|
|
|
HTMLDOMNode *node;
|
|
|
|
|
|
|
|
hres = get_node(This->node.doc, (nsIDOMNode*)nsparent, TRUE, &node);
|
|
|
|
nsIDOMElement_Release(nsparent);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
|
|
|
|
}else {
|
|
|
|
*p = NULL;
|
|
|
|
hres = S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return hres;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_innerHTML(IHTMLElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-10-29 19:15:02 +01:00
|
|
|
nsIDOMNSHTMLElement *nselem;
|
|
|
|
nsAString html_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
2008-04-30 18:18:46 +02:00
|
|
|
if(!This->nselem) {
|
|
|
|
FIXME("NULL nselem\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2006-10-29 19:15:02 +01:00
|
|
|
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2010-01-28 23:55:31 +01:00
|
|
|
nsAString_InitDepend(&html_str, v);
|
2006-10-29 19:15:02 +01:00
|
|
|
nsres = nsIDOMNSHTMLElement_SetInnerHTML(nselem, &html_str);
|
|
|
|
nsAString_Finish(&html_str);
|
|
|
|
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
FIXME("SetInnerHtml failed %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_innerHTML(IHTMLElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2009-03-09 21:23:18 +01:00
|
|
|
nsIDOMNSHTMLElement *nselem;
|
|
|
|
nsAString html_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
if(!This->nselem) {
|
|
|
|
FIXME("NULL nselem\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAString_Init(&html_str, NULL);
|
|
|
|
nsres = nsIDOMNSHTMLElement_GetInnerHTML(nselem, &html_str);
|
|
|
|
if(NS_SUCCEEDED(nsres)) {
|
|
|
|
const PRUnichar *html;
|
|
|
|
|
|
|
|
nsAString_GetData(&html_str, &html);
|
|
|
|
*p = *html ? SysAllocString(html) : NULL;
|
|
|
|
}else {
|
|
|
|
FIXME("SetInnerHtml failed %08x\n", nsres);
|
|
|
|
*p = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAString_Finish(&html_str);
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_innerText(IHTMLElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-13 21:50:27 +02:00
|
|
|
nsIDOMNode *nschild, *tmp;
|
|
|
|
nsIDOMText *text_node;
|
|
|
|
nsAString text_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
|
|
|
while(1) {
|
|
|
|
nsres = nsIDOMHTMLElement_GetLastChild(This->nselem, &nschild);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetLastChild failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
if(!nschild)
|
|
|
|
break;
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLElement_RemoveChild(This->nselem, nschild, &tmp);
|
|
|
|
nsIDOMNode_Release(nschild);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("RemoveChild failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
nsIDOMNode_Release(tmp);
|
|
|
|
}
|
|
|
|
|
2010-01-28 23:55:31 +01:00
|
|
|
nsAString_InitDepend(&text_str, v);
|
2009-10-21 21:27:42 +02:00
|
|
|
nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &text_str, &text_node);
|
2008-10-13 21:50:27 +02:00
|
|
|
nsAString_Finish(&text_str);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("CreateTextNode failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLElement_AppendChild(This->nselem, (nsIDOMNode*)text_node, &tmp);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("AppendChild failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIDOMNode_Release(tmp);
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_innerText(IHTMLElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2008-10-13 21:49:58 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_node_text(&This->node, p);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_outerHTML(IHTMLElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2009-11-16 01:26:57 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
2011-06-17 16:17:45 +02:00
|
|
|
return replace_node_by_html(This->node.doc->nsdoc, This->node.nsnode, v);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_outerHTML(IHTMLElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2009-08-11 19:17:19 +02:00
|
|
|
nsAString html_str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
WARN("(%p)->(%p) semi-stub\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&html_str, NULL);
|
|
|
|
hres = nsnode_to_nsstring(This->node.nsnode, &html_str);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
const PRUnichar *html;
|
|
|
|
|
|
|
|
nsAString_GetData(&html_str, &html);
|
|
|
|
*p = SysAllocString(html);
|
|
|
|
if(!*p)
|
|
|
|
hres = E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAString_Finish(&html_str);
|
|
|
|
|
|
|
|
TRACE("ret %s\n", debugstr_w(*p));
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_outerText(IHTMLElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_outerText(IHTMLElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2007-07-12 16:37:06 +02:00
|
|
|
static HRESULT HTMLElement_InsertAdjacentNode(HTMLElement *This, BSTR where, nsIDOMNode *nsnode)
|
|
|
|
{
|
|
|
|
static const WCHAR wszBeforeBegin[] = {'b','e','f','o','r','e','B','e','g','i','n',0};
|
|
|
|
static const WCHAR wszAfterBegin[] = {'a','f','t','e','r','B','e','g','i','n',0};
|
|
|
|
static const WCHAR wszBeforeEnd[] = {'b','e','f','o','r','e','E','n','d',0};
|
|
|
|
static const WCHAR wszAfterEnd[] = {'a','f','t','e','r','E','n','d',0};
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
if (!strcmpiW(where, wszBeforeBegin))
|
|
|
|
{
|
|
|
|
nsIDOMNode *unused;
|
|
|
|
nsIDOMNode *parent;
|
2009-11-16 01:27:27 +01:00
|
|
|
nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &parent);
|
2007-07-12 16:37:06 +02:00
|
|
|
if (!parent) return E_INVALIDARG;
|
2009-11-16 01:27:27 +01:00
|
|
|
nsres = nsIDOMNode_InsertBefore(parent, nsnode, This->node.nsnode, &unused);
|
2007-07-12 16:37:06 +02:00
|
|
|
if (unused) nsIDOMNode_Release(unused);
|
|
|
|
nsIDOMNode_Release(parent);
|
|
|
|
}
|
|
|
|
else if (!strcmpiW(where, wszAfterBegin))
|
|
|
|
{
|
|
|
|
nsIDOMNode *unused;
|
|
|
|
nsIDOMNode *first_child;
|
2009-11-16 01:27:27 +01:00
|
|
|
nsIDOMNode_GetFirstChild(This->node.nsnode, &first_child);
|
|
|
|
nsres = nsIDOMNode_InsertBefore(This->node.nsnode, nsnode, first_child, &unused);
|
2007-07-12 16:37:06 +02:00
|
|
|
if (unused) nsIDOMNode_Release(unused);
|
|
|
|
if (first_child) nsIDOMNode_Release(first_child);
|
|
|
|
}
|
|
|
|
else if (!strcmpiW(where, wszBeforeEnd))
|
|
|
|
{
|
|
|
|
nsIDOMNode *unused;
|
2009-11-16 01:27:27 +01:00
|
|
|
nsres = nsIDOMNode_AppendChild(This->node.nsnode, nsnode, &unused);
|
2007-07-12 16:37:06 +02:00
|
|
|
if (unused) nsIDOMNode_Release(unused);
|
|
|
|
}
|
|
|
|
else if (!strcmpiW(where, wszAfterEnd))
|
|
|
|
{
|
|
|
|
nsIDOMNode *unused;
|
|
|
|
nsIDOMNode *next_sibling;
|
|
|
|
nsIDOMNode *parent;
|
2009-11-16 01:27:27 +01:00
|
|
|
nsIDOMNode_GetParentNode(This->node.nsnode, &parent);
|
2007-07-12 16:37:06 +02:00
|
|
|
if (!parent) return E_INVALIDARG;
|
|
|
|
|
2009-11-16 01:27:27 +01:00
|
|
|
nsIDOMNode_GetNextSibling(This->node.nsnode, &next_sibling);
|
2007-07-12 16:37:06 +02:00
|
|
|
if (next_sibling)
|
|
|
|
{
|
|
|
|
nsres = nsIDOMNode_InsertBefore(parent, nsnode, next_sibling, &unused);
|
|
|
|
nsIDOMNode_Release(next_sibling);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
nsres = nsIDOMNode_AppendChild(parent, nsnode, &unused);
|
|
|
|
nsIDOMNode_Release(parent);
|
|
|
|
if (unused) nsIDOMNode_Release(unused);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("invalid where: %s\n", debugstr_w(where));
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NS_FAILED(nsres))
|
|
|
|
return E_FAIL;
|
|
|
|
else
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-03-05 20:39:59 +01:00
|
|
|
static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR where,
|
|
|
|
BSTR html)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2007-07-12 16:37:06 +02:00
|
|
|
nsIDOMRange *range;
|
|
|
|
nsIDOMNSRange *nsrange;
|
|
|
|
nsIDOMNode *nsnode;
|
|
|
|
nsAString ns_html;
|
2008-10-09 22:25:31 +02:00
|
|
|
nsresult nsres;
|
2007-07-12 16:37:06 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(html));
|
|
|
|
|
2009-10-21 21:27:42 +02:00
|
|
|
if(!This->node.doc->nsdoc) {
|
2008-10-09 22:25:31 +02:00
|
|
|
WARN("NULL nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
2007-07-12 16:37:06 +02:00
|
|
|
}
|
|
|
|
|
2011-08-23 14:07:02 +02:00
|
|
|
nsres = nsIDOMHTMLDocument_CreateRange(This->node.doc->nsdoc, &range);
|
2007-07-12 16:37:06 +02:00
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
{
|
|
|
|
ERR("CreateRange failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2009-11-16 01:27:27 +01:00
|
|
|
nsIDOMRange_SetStartBefore(range, This->node.nsnode);
|
2007-07-12 16:37:06 +02:00
|
|
|
|
|
|
|
nsIDOMRange_QueryInterface(range, &IID_nsIDOMNSRange, (void **)&nsrange);
|
|
|
|
nsIDOMRange_Release(range);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
{
|
|
|
|
ERR("getting nsIDOMNSRange failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2010-01-28 23:55:31 +01:00
|
|
|
nsAString_InitDepend(&ns_html, html);
|
2007-07-12 16:37:06 +02:00
|
|
|
|
|
|
|
nsres = nsIDOMNSRange_CreateContextualFragment(nsrange, &ns_html, (nsIDOMDocumentFragment **)&nsnode);
|
|
|
|
nsIDOMNSRange_Release(nsrange);
|
|
|
|
nsAString_Finish(&ns_html);
|
|
|
|
|
|
|
|
if(NS_FAILED(nsres) || !nsnode)
|
|
|
|
{
|
|
|
|
ERR("CreateTextNode failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = HTMLElement_InsertAdjacentNode(This, where, nsnode);
|
|
|
|
nsIDOMNode_Release(nsnode);
|
|
|
|
|
|
|
|
return hr;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_insertAdjacentText(IHTMLElement *iface, BSTR where,
|
|
|
|
BSTR text)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2007-07-12 16:37:06 +02:00
|
|
|
nsIDOMNode *nsnode;
|
|
|
|
nsAString ns_text;
|
2008-10-09 22:25:39 +02:00
|
|
|
nsresult nsres;
|
2007-07-12 16:37:06 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(text));
|
|
|
|
|
2009-10-21 21:27:42 +02:00
|
|
|
if(!This->node.doc->nsdoc) {
|
2008-10-09 22:25:39 +02:00
|
|
|
WARN("NULL nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
2007-07-12 16:37:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-28 23:55:31 +01:00
|
|
|
nsAString_InitDepend(&ns_text, text);
|
2009-10-21 21:27:42 +02:00
|
|
|
nsres = nsIDOMDocument_CreateTextNode(This->node.doc->nsdoc, &ns_text, (nsIDOMText **)&nsnode);
|
2007-07-12 16:37:06 +02:00
|
|
|
nsAString_Finish(&ns_text);
|
|
|
|
|
|
|
|
if(NS_FAILED(nsres) || !nsnode)
|
|
|
|
{
|
|
|
|
ERR("CreateTextNode failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = HTMLElement_InsertAdjacentNode(This, where, nsnode);
|
|
|
|
nsIDOMNode_Release(nsnode);
|
|
|
|
|
|
|
|
return hr;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_parentTextEdit(IHTMLElement *iface, IHTMLElement **p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_isTextEdit(IHTMLElement *iface, VARIANT_BOOL *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_click(IHTMLElement *iface)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2009-10-13 00:42:22 +02:00
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
2011-08-02 11:07:12 +02:00
|
|
|
return call_fire_event(&This->node, EVENTID_CLICK);
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_filters(IHTMLElement *iface,
|
|
|
|
IHTMLFiltersCollection **p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2009-12-19 13:23:19 +01:00
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
if(!p)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
*p = HTMLFiltersCollection_Create();
|
|
|
|
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_ondragstart(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_ondragstart(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_toString(IHTMLElement *iface, BSTR *String)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, String);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onbeforeupdate(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onbeforeupdate(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onafterupdate(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onafterupdate(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onerrorupdate(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onerrorupdate(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onrowexit(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onrowexit(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onrowenter(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onrowenter(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_ondatasetchanged(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_ondatasetchanged(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_ondataavailable(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_ondataavailable(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_ondatasetcomplete(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_ondatasetcomplete(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_put_onfilterchange(IHTMLElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_onfilterchange(IHTMLElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 20:39:59 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2008-09-30 17:44:50 +02:00
|
|
|
static HRESULT WINAPI HTMLElement_get_children(IHTMLElement *iface, IDispatch **p)
|
2007-06-25 16:01:27 +02:00
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2007-06-25 16:01:27 +02:00
|
|
|
nsIDOMNodeList *nsnode_list;
|
|
|
|
nsresult nsres;
|
|
|
|
|
2008-09-30 17:44:50 +02:00
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsres = nsIDOMNode_GetChildNodes(This->node.nsnode, &nsnode_list);
|
2007-06-25 16:01:27 +02:00
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetChildNodes failed: %08x\n", nsres);
|
2008-09-30 17:44:50 +02:00
|
|
|
return E_FAIL;
|
2007-06-25 16:01:27 +02:00
|
|
|
}
|
|
|
|
|
2010-12-30 01:24:59 +01:00
|
|
|
*p = (IDispatch*)create_collection_from_nodelist(This->node.doc,
|
|
|
|
(IUnknown*)&This->IHTMLElement_iface, nsnode_list);
|
2007-06-25 16:01:27 +02:00
|
|
|
|
2008-09-30 17:44:50 +02:00
|
|
|
nsIDOMNodeList_Release(nsnode_list);
|
2007-10-04 02:12:02 +02:00
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLElement_get_all(IHTMLElement *iface, IDispatch **p)
|
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
HTMLElement *This = impl_from_IHTMLElement(iface);
|
2006-03-05 21:56:04 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2008-09-30 17:45:08 +02:00
|
|
|
*p = (IDispatch*)create_all_collection(&This->node, FALSE);
|
2007-10-04 02:12:02 +02:00
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IHTMLElementVtbl HTMLElementVtbl = {
|
|
|
|
HTMLElement_QueryInterface,
|
|
|
|
HTMLElement_AddRef,
|
|
|
|
HTMLElement_Release,
|
|
|
|
HTMLElement_GetTypeInfoCount,
|
|
|
|
HTMLElement_GetTypeInfo,
|
|
|
|
HTMLElement_GetIDsOfNames,
|
|
|
|
HTMLElement_Invoke,
|
|
|
|
HTMLElement_setAttribute,
|
|
|
|
HTMLElement_getAttribute,
|
|
|
|
HTMLElement_removeAttribute,
|
|
|
|
HTMLElement_put_className,
|
|
|
|
HTMLElement_get_className,
|
|
|
|
HTMLElement_put_id,
|
|
|
|
HTMLElement_get_id,
|
|
|
|
HTMLElement_get_tagName,
|
|
|
|
HTMLElement_get_parentElement,
|
|
|
|
HTMLElement_get_style,
|
|
|
|
HTMLElement_put_onhelp,
|
|
|
|
HTMLElement_get_onhelp,
|
|
|
|
HTMLElement_put_onclick,
|
|
|
|
HTMLElement_get_onclick,
|
|
|
|
HTMLElement_put_ondblclick,
|
|
|
|
HTMLElement_get_ondblclick,
|
|
|
|
HTMLElement_put_onkeydown,
|
|
|
|
HTMLElement_get_onkeydown,
|
|
|
|
HTMLElement_put_onkeyup,
|
|
|
|
HTMLElement_get_onkeyup,
|
|
|
|
HTMLElement_put_onkeypress,
|
|
|
|
HTMLElement_get_onkeypress,
|
|
|
|
HTMLElement_put_onmouseout,
|
|
|
|
HTMLElement_get_onmouseout,
|
|
|
|
HTMLElement_put_onmouseover,
|
|
|
|
HTMLElement_get_onmouseover,
|
|
|
|
HTMLElement_put_onmousemove,
|
|
|
|
HTMLElement_get_onmousemove,
|
|
|
|
HTMLElement_put_onmousedown,
|
|
|
|
HTMLElement_get_onmousedown,
|
|
|
|
HTMLElement_put_onmouseup,
|
|
|
|
HTMLElement_get_onmouseup,
|
|
|
|
HTMLElement_get_document,
|
|
|
|
HTMLElement_put_title,
|
|
|
|
HTMLElement_get_title,
|
|
|
|
HTMLElement_put_language,
|
|
|
|
HTMLElement_get_language,
|
|
|
|
HTMLElement_put_onselectstart,
|
|
|
|
HTMLElement_get_onselectstart,
|
|
|
|
HTMLElement_scrollIntoView,
|
|
|
|
HTMLElement_contains,
|
|
|
|
HTMLElement_get_sourceIndex,
|
|
|
|
HTMLElement_get_recordNumber,
|
|
|
|
HTMLElement_put_lang,
|
|
|
|
HTMLElement_get_lang,
|
|
|
|
HTMLElement_get_offsetLeft,
|
|
|
|
HTMLElement_get_offsetTop,
|
|
|
|
HTMLElement_get_offsetWidth,
|
|
|
|
HTMLElement_get_offsetHeight,
|
|
|
|
HTMLElement_get_offsetParent,
|
|
|
|
HTMLElement_put_innerHTML,
|
|
|
|
HTMLElement_get_innerHTML,
|
|
|
|
HTMLElement_put_innerText,
|
|
|
|
HTMLElement_get_innerText,
|
|
|
|
HTMLElement_put_outerHTML,
|
|
|
|
HTMLElement_get_outerHTML,
|
|
|
|
HTMLElement_put_outerText,
|
|
|
|
HTMLElement_get_outerText,
|
|
|
|
HTMLElement_insertAdjacentHTML,
|
|
|
|
HTMLElement_insertAdjacentText,
|
|
|
|
HTMLElement_get_parentTextEdit,
|
|
|
|
HTMLElement_get_isTextEdit,
|
|
|
|
HTMLElement_click,
|
|
|
|
HTMLElement_get_filters,
|
|
|
|
HTMLElement_put_ondragstart,
|
|
|
|
HTMLElement_get_ondragstart,
|
|
|
|
HTMLElement_toString,
|
|
|
|
HTMLElement_put_onbeforeupdate,
|
|
|
|
HTMLElement_get_onbeforeupdate,
|
|
|
|
HTMLElement_put_onafterupdate,
|
|
|
|
HTMLElement_get_onafterupdate,
|
|
|
|
HTMLElement_put_onerrorupdate,
|
|
|
|
HTMLElement_get_onerrorupdate,
|
|
|
|
HTMLElement_put_onrowexit,
|
|
|
|
HTMLElement_get_onrowexit,
|
|
|
|
HTMLElement_put_onrowenter,
|
|
|
|
HTMLElement_get_onrowenter,
|
|
|
|
HTMLElement_put_ondatasetchanged,
|
|
|
|
HTMLElement_get_ondatasetchanged,
|
|
|
|
HTMLElement_put_ondataavailable,
|
|
|
|
HTMLElement_get_ondataavailable,
|
|
|
|
HTMLElement_put_ondatasetcomplete,
|
|
|
|
HTMLElement_get_ondatasetcomplete,
|
|
|
|
HTMLElement_put_onfilterchange,
|
|
|
|
HTMLElement_get_onfilterchange,
|
|
|
|
HTMLElement_get_children,
|
|
|
|
HTMLElement_get_all
|
|
|
|
};
|
|
|
|
|
2010-12-27 20:13:09 +01:00
|
|
|
static inline HTMLElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLElement, node);
|
|
|
|
}
|
|
|
|
|
2007-10-04 02:10:36 +02:00
|
|
|
HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
|
2006-03-18 19:43:05 +01:00
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLElement *This = impl_from_HTMLDOMNode(iface);
|
2007-10-04 02:10:36 +02:00
|
|
|
|
2006-03-18 19:43:05 +01:00
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
|
2010-12-30 01:24:59 +01:00
|
|
|
*ppv = &This->IHTMLElement_iface;
|
2006-03-18 19:43:05 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
|
2010-12-30 01:24:59 +01:00
|
|
|
*ppv = &This->IHTMLElement_iface;
|
2006-03-18 19:43:05 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLElement, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLElement %p)\n", This, ppv);
|
2010-12-30 01:24:59 +01:00
|
|
|
*ppv = &This->IHTMLElement_iface;
|
2006-03-23 21:38:38 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLElement2, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLElement2 %p)\n", This, ppv);
|
2010-12-30 01:27:28 +01:00
|
|
|
*ppv = &This->IHTMLElement2_iface;
|
2008-10-07 21:44:18 +02:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLElement3, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLElement3 %p)\n", This, ppv);
|
2010-12-30 01:30:37 +01:00
|
|
|
*ppv = &This->IHTMLElement3_iface;
|
2011-02-24 13:03:42 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLElement4, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLElement4 %p)\n", This, ppv);
|
|
|
|
*ppv = &This->IHTMLElement4_iface;
|
2007-12-04 13:37:21 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
|
2011-01-03 01:02:57 +01:00
|
|
|
*ppv = &This->cp_container.IConnectionPointContainer_iface;
|
2006-03-18 19:43:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(*ppv) {
|
2010-12-30 01:24:59 +01:00
|
|
|
IHTMLElement_AddRef(&This->IHTMLElement_iface);
|
2006-03-18 19:43:05 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2007-09-12 23:39:17 +02:00
|
|
|
return HTMLDOMNode_QI(&This->node, riid, ppv);
|
2006-03-18 19:43:05 +01:00
|
|
|
}
|
|
|
|
|
2007-10-04 02:09:48 +02:00
|
|
|
void HTMLElement_destructor(HTMLDOMNode *iface)
|
2007-10-04 02:07:59 +02:00
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLElement *This = impl_from_HTMLDOMNode(iface);
|
2011-03-02 13:34:04 +01:00
|
|
|
HTMLDOMAttribute *attr;
|
|
|
|
|
2011-03-02 23:10:22 +01:00
|
|
|
while(!list_empty(&This->attrs)) {
|
|
|
|
attr = LIST_ENTRY(list_head(&This->attrs), HTMLDOMAttribute, entry);
|
|
|
|
|
|
|
|
list_remove(&attr->entry);
|
2011-03-02 13:34:04 +01:00
|
|
|
attr->elem = NULL;
|
|
|
|
IHTMLDOMAttribute_Release(&attr->IHTMLDOMAttribute_iface);
|
|
|
|
}
|
2007-10-04 02:07:59 +02:00
|
|
|
|
2007-12-04 13:37:21 +01:00
|
|
|
ConnectionPointContainer_Destroy(&This->cp_container);
|
|
|
|
|
2007-10-04 02:07:59 +02:00
|
|
|
if(This->nselem)
|
|
|
|
nsIDOMHTMLElement_Release(This->nselem);
|
2011-02-28 13:13:12 +01:00
|
|
|
if(This->style)
|
|
|
|
IHTMLStyle_Release(&This->style->IHTMLStyle_iface);
|
2007-10-04 02:07:59 +02:00
|
|
|
|
2007-10-04 02:09:48 +02:00
|
|
|
HTMLDOMNode_destructor(&This->node);
|
2007-10-04 02:07:59 +02:00
|
|
|
}
|
|
|
|
|
2010-11-14 14:41:39 +01:00
|
|
|
HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
|
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLElement *This = impl_from_HTMLDOMNode(iface);
|
2010-11-14 14:41:39 +01:00
|
|
|
HTMLElement *new_elem;
|
2010-12-01 22:42:51 +01:00
|
|
|
HRESULT hres;
|
2010-11-14 14:41:39 +01:00
|
|
|
|
2010-12-01 22:42:51 +01:00
|
|
|
hres = HTMLElement_Create(This->node.doc, nsnode, FALSE, &new_elem);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
2010-11-14 14:41:39 +01:00
|
|
|
|
2010-12-30 01:24:59 +01:00
|
|
|
IHTMLElement_AddRef(&new_elem->IHTMLElement_iface);
|
2010-11-14 14:41:39 +01:00
|
|
|
*ret = &new_elem->node;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2007-10-04 02:09:48 +02:00
|
|
|
static const NodeImplVtbl HTMLElementImplVtbl = {
|
2007-10-04 02:10:36 +02:00
|
|
|
HTMLElement_QI,
|
2010-11-14 14:41:39 +01:00
|
|
|
HTMLElement_destructor,
|
2011-08-25 15:23:35 +02:00
|
|
|
HTMLElement_clone,
|
|
|
|
HTMLElement_get_attr_col
|
2007-10-04 02:09:48 +02:00
|
|
|
};
|
|
|
|
|
2010-12-27 18:34:39 +01:00
|
|
|
static inline HTMLElement *impl_from_DispatchEx(DispatchEx *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLElement, node.dispex);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT HTMLElement_get_dispid(DispatchEx *dispex, BSTR name,
|
|
|
|
DWORD grfdex, DISPID *pid)
|
|
|
|
{
|
|
|
|
HTMLElement *This = impl_from_DispatchEx(dispex);
|
|
|
|
|
|
|
|
if(This->node.vtbl->get_dispid)
|
|
|
|
return This->node.vtbl->get_dispid(&This->node, name, grfdex, pid);
|
|
|
|
|
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT HTMLElement_invoke(DispatchEx *dispex, DISPID id, LCID lcid,
|
|
|
|
WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei,
|
|
|
|
IServiceProvider *caller)
|
|
|
|
{
|
|
|
|
HTMLElement *This = impl_from_DispatchEx(dispex);
|
|
|
|
|
|
|
|
if(This->node.vtbl->invoke)
|
|
|
|
return This->node.vtbl->invoke(&This->node, id, lcid, flags,
|
|
|
|
params, res, ei, caller);
|
|
|
|
|
|
|
|
ERR("(%p): element has no invoke method\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-08-23 11:33:18 +02:00
|
|
|
static HRESULT HTMLElement_populate_props(DispatchEx *dispex)
|
|
|
|
{
|
|
|
|
HTMLElement *This = impl_from_DispatchEx(dispex);
|
|
|
|
nsIDOMNamedNodeMap *attrs;
|
|
|
|
nsIDOMNode *node;
|
|
|
|
nsAString nsstr;
|
|
|
|
const PRUnichar *str;
|
|
|
|
BSTR name;
|
|
|
|
VARIANT value;
|
|
|
|
unsigned i;
|
|
|
|
PRUint32 len;
|
|
|
|
DISPID id;
|
|
|
|
nsresult nsres;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
if(!This->nselem)
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLElement_GetAttributes(This->nselem, &attrs);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
nsres = nsIDOMNamedNodeMap_GetLength(attrs, &len);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
nsIDOMNamedNodeMap_Release(attrs);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAString_Init(&nsstr, NULL);
|
|
|
|
for(i=0; i<len; i++) {
|
|
|
|
nsres = nsIDOMNamedNodeMap_Item(attrs, i, &node);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
nsres = nsIDOMNode_GetNodeName(node, &nsstr);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
nsIDOMNode_Release(node);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAString_GetData(&nsstr, &str);
|
|
|
|
name = SysAllocString(str);
|
|
|
|
if(!name) {
|
|
|
|
nsIDOMNode_Release(node);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = IDispatchEx_GetDispID(&dispex->IDispatchEx_iface, name, fdexNameCaseInsensitive, &id);
|
|
|
|
if(hres != DISP_E_UNKNOWNNAME) {
|
|
|
|
nsIDOMNode_Release(node);
|
|
|
|
SysFreeString(name);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIDOMNode_GetNodeValue(node, &nsstr);
|
|
|
|
nsIDOMNode_Release(node);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
SysFreeString(name);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAString_GetData(&nsstr, &str);
|
|
|
|
V_VT(&value) = VT_BSTR;
|
|
|
|
if(*str) {
|
|
|
|
V_BSTR(&value) = SysAllocString(str);
|
|
|
|
if(!V_BSTR(&value)) {
|
|
|
|
SysFreeString(name);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
V_BSTR(&value) = NULL;
|
|
|
|
|
|
|
|
IHTMLElement_setAttribute(&This->IHTMLElement_iface, name, value, 0);
|
|
|
|
SysFreeString(name);
|
|
|
|
VariantClear(&value);
|
|
|
|
}
|
|
|
|
nsAString_Finish(&nsstr);
|
|
|
|
|
|
|
|
nsIDOMNamedNodeMap_Release(attrs);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2008-05-06 16:04:58 +02:00
|
|
|
static const tid_t HTMLElement_iface_tids[] = {
|
2010-01-28 02:09:02 +01:00
|
|
|
HTMLELEMENT_TIDS,
|
2008-05-06 16:04:58 +02:00
|
|
|
0
|
|
|
|
};
|
2008-06-26 02:28:05 +02:00
|
|
|
|
2009-12-01 21:04:17 +01:00
|
|
|
static dispex_static_data_vtbl_t HTMLElement_dispex_vtbl = {
|
2008-04-29 01:38:09 +02:00
|
|
|
NULL,
|
2009-12-01 21:04:17 +01:00
|
|
|
HTMLElement_get_dispid,
|
2011-08-23 11:33:18 +02:00
|
|
|
HTMLElement_invoke,
|
|
|
|
HTMLElement_populate_props
|
2009-12-01 21:04:17 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static dispex_static_data_t HTMLElement_dispex = {
|
|
|
|
&HTMLElement_dispex_vtbl,
|
2008-04-23 16:45:52 +02:00
|
|
|
DispHTMLUnknownElement_tid,
|
|
|
|
NULL,
|
2008-05-06 16:04:58 +02:00
|
|
|
HTMLElement_iface_tids
|
2008-04-23 16:45:52 +02:00
|
|
|
};
|
|
|
|
|
2009-11-01 19:16:48 +01:00
|
|
|
void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, dispex_static_data_t *dispex_data)
|
2007-12-04 13:37:00 +01:00
|
|
|
{
|
2010-12-30 01:24:59 +01:00
|
|
|
This->IHTMLElement_iface.lpVtbl = &HTMLElementVtbl;
|
2007-12-04 13:37:00 +01:00
|
|
|
|
|
|
|
HTMLElement2_Init(This);
|
2008-10-07 21:44:18 +02:00
|
|
|
HTMLElement3_Init(This);
|
2008-04-30 18:18:24 +02:00
|
|
|
|
2009-12-01 21:04:17 +01:00
|
|
|
if(dispex_data && !dispex_data->vtbl)
|
|
|
|
dispex_data->vtbl = &HTMLElement_dispex_vtbl;
|
2010-12-30 01:24:59 +01:00
|
|
|
init_dispex(&This->node.dispex, (IUnknown*)&This->IHTMLElement_iface,
|
|
|
|
dispex_data ? dispex_data : &HTMLElement_dispex);
|
2009-11-01 19:16:48 +01:00
|
|
|
|
|
|
|
if(nselem)
|
|
|
|
nsIDOMHTMLElement_AddRef(nselem);
|
|
|
|
This->nselem = nselem;
|
2011-03-02 13:34:04 +01:00
|
|
|
list_init(&This->attrs);
|
2009-11-01 19:16:48 +01:00
|
|
|
|
|
|
|
HTMLDOMNode_Init(doc, &This->node, (nsIDOMNode*)nselem);
|
|
|
|
|
2010-12-30 01:24:59 +01:00
|
|
|
ConnectionPointContainer_Init(&This->cp_container, (IUnknown*)&This->IHTMLElement_iface);
|
2007-12-04 13:37:00 +01:00
|
|
|
}
|
|
|
|
|
2010-12-01 22:42:51 +01:00
|
|
|
HRESULT HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_generic, HTMLElement **ret)
|
2006-03-05 20:39:59 +01:00
|
|
|
{
|
2007-09-15 16:04:57 +02:00
|
|
|
nsIDOMHTMLElement *nselem;
|
2006-03-06 22:35:56 +01:00
|
|
|
nsAString class_name_str;
|
|
|
|
const PRUnichar *class_name;
|
2010-12-01 22:42:35 +01:00
|
|
|
const tag_desc_t *tag;
|
2010-12-01 22:42:51 +01:00
|
|
|
HTMLElement *elem;
|
2006-03-06 22:35:56 +01:00
|
|
|
nsresult nsres;
|
2010-12-01 22:42:51 +01:00
|
|
|
HRESULT hres;
|
2006-03-05 20:39:59 +01:00
|
|
|
|
2007-09-15 16:04:57 +02:00
|
|
|
nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMHTMLElement, (void**)&nselem);
|
2006-03-06 22:35:56 +01:00
|
|
|
if(NS_FAILED(nsres))
|
2010-12-01 22:42:51 +01:00
|
|
|
return E_FAIL;
|
2006-03-06 22:35:56 +01:00
|
|
|
|
|
|
|
nsAString_Init(&class_name_str, NULL);
|
2007-09-15 16:04:57 +02:00
|
|
|
nsIDOMHTMLElement_GetTagName(nselem, &class_name_str);
|
2006-03-06 22:35:56 +01:00
|
|
|
|
2007-12-17 01:38:30 +01:00
|
|
|
nsAString_GetData(&class_name_str, &class_name);
|
2006-03-06 22:35:56 +01:00
|
|
|
|
2010-12-01 22:42:35 +01:00
|
|
|
tag = get_tag_desc(class_name);
|
|
|
|
if(tag) {
|
2010-12-01 22:43:14 +01:00
|
|
|
hres = tag->constructor(doc, nselem, &elem);
|
2010-12-01 22:42:35 +01:00
|
|
|
}else if(use_generic) {
|
2010-12-01 22:42:51 +01:00
|
|
|
hres = HTMLGenericElement_Create(doc, nselem, &elem);
|
2010-12-01 22:42:35 +01:00
|
|
|
}else {
|
2010-12-01 22:42:51 +01:00
|
|
|
elem = heap_alloc_zero(sizeof(HTMLElement));
|
|
|
|
if(elem) {
|
|
|
|
HTMLElement_Init(elem, doc, nselem, &HTMLElement_dispex);
|
|
|
|
elem->node.vtbl = &HTMLElementImplVtbl;
|
|
|
|
hres = S_OK;
|
|
|
|
}else {
|
|
|
|
hres = E_OUTOFMEMORY;
|
|
|
|
}
|
2008-06-19 23:13:16 +02:00
|
|
|
}
|
|
|
|
|
2010-12-01 22:42:51 +01:00
|
|
|
TRACE("%s ret %p\n", debugstr_w(class_name), elem);
|
2006-03-06 22:35:56 +01:00
|
|
|
|
2009-11-01 19:16:48 +01:00
|
|
|
nsIDOMElement_Release(nselem);
|
2006-03-06 22:35:56 +01:00
|
|
|
nsAString_Finish(&class_name_str);
|
2010-12-01 22:42:51 +01:00
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
2007-09-12 23:39:17 +02:00
|
|
|
|
2010-12-01 22:42:51 +01:00
|
|
|
*ret = elem;
|
|
|
|
return S_OK;
|
2006-03-05 20:39:59 +01:00
|
|
|
}
|
2009-12-19 13:23:19 +01:00
|
|
|
|
2010-08-24 09:53:35 +02:00
|
|
|
/* interface IHTMLFiltersCollection */
|
2009-12-19 13:23:19 +01:00
|
|
|
static HRESULT WINAPI HTMLFiltersCollection_QueryInterface(IHTMLFiltersCollection *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2010-12-30 01:32:54 +01:00
|
|
|
HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
|
2009-12-19 13:23:19 +01:00
|
|
|
|
|
|
|
TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppv );
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
|
2010-12-30 01:32:54 +01:00
|
|
|
*ppv = &This->IHTMLFiltersCollection_iface;
|
2009-12-19 13:23:19 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLFiltersCollection, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLFiltersCollection %p)\n", This, ppv);
|
2010-12-30 01:32:54 +01:00
|
|
|
*ppv = &This->IHTMLFiltersCollection_iface;
|
2009-12-19 13:23:19 +01:00
|
|
|
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
|
|
|
|
return *ppv ? S_OK : E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(*ppv) {
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLFiltersCollection_AddRef(IHTMLFiltersCollection *iface)
|
|
|
|
{
|
2010-12-30 01:32:54 +01:00
|
|
|
HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
|
2009-12-19 13:23:19 +01:00
|
|
|
LONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLFiltersCollection_Release(IHTMLFiltersCollection *iface)
|
|
|
|
{
|
2010-12-30 01:32:54 +01:00
|
|
|
HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
|
2009-12-19 13:23:19 +01:00
|
|
|
LONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
if(!ref)
|
|
|
|
{
|
|
|
|
heap_free(This);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFiltersCollection_GetTypeInfoCount(IHTMLFiltersCollection *iface, UINT *pctinfo)
|
|
|
|
{
|
2010-12-30 01:32:54 +01:00
|
|
|
HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
|
2010-12-31 11:07:33 +01:00
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
|
2009-12-19 13:23:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFiltersCollection_GetTypeInfo(IHTMLFiltersCollection *iface,
|
|
|
|
UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
2010-12-30 01:32:54 +01:00
|
|
|
HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
|
2010-12-31 11:07:33 +01:00
|
|
|
return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
|
2009-12-19 13:23:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFiltersCollection_GetIDsOfNames(IHTMLFiltersCollection *iface,
|
|
|
|
REFIID riid, LPOLESTR *rgszNames, UINT cNames,
|
|
|
|
LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
2010-12-30 01:32:54 +01:00
|
|
|
HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
|
2010-12-31 11:07:33 +01:00
|
|
|
return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
|
|
|
|
lcid, rgDispId);
|
2009-12-19 13:23:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFiltersCollection_Invoke(IHTMLFiltersCollection *iface, DISPID dispIdMember, REFIID riid,
|
|
|
|
LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
|
|
|
|
EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
2010-12-30 01:32:54 +01:00
|
|
|
HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
|
2010-12-31 11:07:33 +01:00
|
|
|
return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
|
2009-12-19 13:23:19 +01:00
|
|
|
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFiltersCollection_get_length(IHTMLFiltersCollection *iface, LONG *p)
|
|
|
|
{
|
2010-12-30 01:32:54 +01:00
|
|
|
HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
|
2009-12-19 13:23:19 +01:00
|
|
|
|
2010-05-17 01:12:18 +02:00
|
|
|
if(!p)
|
|
|
|
return E_POINTER;
|
2009-12-19 13:23:19 +01:00
|
|
|
|
2010-05-17 01:12:18 +02:00
|
|
|
FIXME("(%p)->(%p) Always returning 0\n", This, p);
|
|
|
|
*p = 0;
|
2009-12-19 13:23:19 +01:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFiltersCollection_get__newEnum(IHTMLFiltersCollection *iface, IUnknown **p)
|
|
|
|
{
|
2010-12-30 01:32:54 +01:00
|
|
|
HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
|
2009-12-19 13:23:19 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFiltersCollection_item(IHTMLFiltersCollection *iface, VARIANT *pvarIndex, VARIANT *pvarResult)
|
|
|
|
{
|
2010-12-30 01:32:54 +01:00
|
|
|
HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
|
2009-12-19 13:23:19 +01:00
|
|
|
FIXME("(%p)->(%p, %p)\n", This, pvarIndex, pvarResult);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IHTMLFiltersCollectionVtbl HTMLFiltersCollectionVtbl = {
|
|
|
|
HTMLFiltersCollection_QueryInterface,
|
|
|
|
HTMLFiltersCollection_AddRef,
|
|
|
|
HTMLFiltersCollection_Release,
|
|
|
|
HTMLFiltersCollection_GetTypeInfoCount,
|
|
|
|
HTMLFiltersCollection_GetTypeInfo,
|
|
|
|
HTMLFiltersCollection_GetIDsOfNames,
|
|
|
|
HTMLFiltersCollection_Invoke,
|
|
|
|
HTMLFiltersCollection_get_length,
|
|
|
|
HTMLFiltersCollection_get__newEnum,
|
|
|
|
HTMLFiltersCollection_item
|
|
|
|
};
|
|
|
|
|
2010-12-27 18:34:39 +01:00
|
|
|
static HRESULT HTMLFiltersCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
|
2009-12-19 13:23:19 +01:00
|
|
|
{
|
|
|
|
WCHAR *ptr;
|
|
|
|
int idx = 0;
|
|
|
|
|
|
|
|
for(ptr = name; *ptr && isdigitW(*ptr); ptr++)
|
|
|
|
idx = idx*10 + (*ptr-'0');
|
|
|
|
if(*ptr)
|
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
|
|
|
|
*dispid = MSHTML_DISPID_CUSTOM_MIN + idx;
|
|
|
|
TRACE("ret %x\n", *dispid);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-12-27 18:34:39 +01:00
|
|
|
static HRESULT HTMLFiltersCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
|
2009-12-19 13:23:19 +01:00
|
|
|
VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
|
|
|
|
{
|
2010-12-27 18:34:39 +01:00
|
|
|
TRACE("(%p)->(%x %x %x %p %p %p)\n", dispex, id, lcid, flags, params, res, ei);
|
2009-12-19 13:23:19 +01:00
|
|
|
|
|
|
|
V_VT(res) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(res) = NULL;
|
|
|
|
|
|
|
|
FIXME("always returning NULL\n");
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const dispex_static_data_vtbl_t HTMLFiltersCollection_dispex_vtbl = {
|
|
|
|
NULL,
|
|
|
|
HTMLFiltersCollection_get_dispid,
|
2011-08-23 11:33:18 +02:00
|
|
|
HTMLFiltersCollection_invoke,
|
|
|
|
NULL
|
2009-12-19 13:23:19 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static const tid_t HTMLFiltersCollection_iface_tids[] = {
|
|
|
|
IHTMLFiltersCollection_tid,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
static dispex_static_data_t HTMLFiltersCollection_dispex = {
|
|
|
|
&HTMLFiltersCollection_dispex_vtbl,
|
|
|
|
IHTMLFiltersCollection_tid,
|
|
|
|
NULL,
|
|
|
|
HTMLFiltersCollection_iface_tids
|
|
|
|
};
|
|
|
|
|
2011-04-10 18:46:08 +02:00
|
|
|
static IHTMLFiltersCollection *HTMLFiltersCollection_Create(void)
|
2009-12-19 13:23:19 +01:00
|
|
|
{
|
|
|
|
HTMLFiltersCollection *ret = heap_alloc(sizeof(HTMLFiltersCollection));
|
|
|
|
|
2010-12-30 01:32:54 +01:00
|
|
|
ret->IHTMLFiltersCollection_iface.lpVtbl = &HTMLFiltersCollectionVtbl;
|
2009-12-19 13:23:19 +01:00
|
|
|
ret->ref = 1;
|
|
|
|
|
2010-12-30 01:32:54 +01:00
|
|
|
init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLFiltersCollection_iface,
|
|
|
|
&HTMLFiltersCollection_dispex);
|
2009-12-19 13:23:19 +01:00
|
|
|
|
2010-12-30 01:32:54 +01:00
|
|
|
return &ret->IHTMLFiltersCollection_iface;
|
2009-12-19 13:23:19 +01:00
|
|
|
}
|
2011-08-25 15:23:35 +02:00
|
|
|
|
|
|
|
/* interface IHTMLAttributeCollection */
|
|
|
|
static inline HTMLAttributeCollection *impl_from_IHTMLAttributeCollection(IHTMLAttributeCollection *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLAttributeCollection, IHTMLAttributeCollection_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection_QueryInterface(IHTMLAttributeCollection *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
|
|
|
|
*ppv = &This->IHTMLAttributeCollection_iface;
|
|
|
|
}else if(IsEqualGUID(&IID_IHTMLAttributeCollection, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLAttributeCollection %p)\n", This, ppv);
|
|
|
|
*ppv = &This->IHTMLAttributeCollection_iface;
|
|
|
|
}else if(IsEqualGUID(&IID_IHTMLAttributeCollection2, riid)) {
|
2011-08-25 15:24:52 +02:00
|
|
|
TRACE("(%p)->(IID_IHTMLAttributeCollection2 %p)\n", This, ppv);
|
|
|
|
*ppv = &This->IHTMLAttributeCollection2_iface;
|
2011-08-25 15:23:35 +02:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLAttributeCollection3, riid)) {
|
2011-08-25 15:25:01 +02:00
|
|
|
TRACE("(%p)->(IID_IHTMLAttributeCollection3 %p)\n", This, ppv);
|
|
|
|
*ppv = &This->IHTMLAttributeCollection3_iface;
|
2011-08-25 15:23:35 +02:00
|
|
|
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
|
|
|
|
return *ppv ? S_OK : E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(*ppv) {
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLAttributeCollection_AddRef(IHTMLAttributeCollection *iface)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
|
|
|
|
LONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLAttributeCollection_Release(IHTMLAttributeCollection *iface)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
|
|
|
|
LONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
if(!ref) {
|
|
|
|
IHTMLElement_Release(&This->elem->IHTMLElement_iface);
|
2011-08-25 15:25:17 +02:00
|
|
|
heap_free(This->collection);
|
2011-08-25 15:23:35 +02:00
|
|
|
heap_free(This);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection_GetTypeInfoCount(IHTMLAttributeCollection *iface, UINT *pctinfo)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
|
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection_GetTypeInfo(IHTMLAttributeCollection *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
|
|
|
|
return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection_GetIDsOfNames(IHTMLAttributeCollection *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
|
|
|
|
return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
|
|
|
|
lcid, rgDispId);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection_Invoke(IHTMLAttributeCollection *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
|
|
|
|
return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
|
|
|
|
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection_get_length(IHTMLAttributeCollection *iface, LONG *p)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
|
2011-08-25 15:25:17 +02:00
|
|
|
IDispatchEx *dispex = &This->elem->node.dispex.IDispatchEx_iface;
|
|
|
|
DISPID id;
|
|
|
|
LONG len;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
FIXME("filter non-enumerable attributes out\n");
|
|
|
|
|
|
|
|
heap_free(This->collection);
|
|
|
|
This->size = 0;
|
|
|
|
This->collection = NULL;
|
|
|
|
|
|
|
|
id = DISPID_STARTENUM;
|
|
|
|
len = 0;
|
|
|
|
while(1) {
|
|
|
|
hres = IDispatchEx_GetNextDispID(dispex, fdexEnumAll, id, &id);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
else if(hres == S_FALSE)
|
|
|
|
break;
|
|
|
|
|
|
|
|
len++;
|
|
|
|
}
|
|
|
|
|
|
|
|
This->collection = heap_alloc(len*sizeof(DISPID));
|
|
|
|
if(!This->collection)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
id = DISPID_STARTENUM;
|
|
|
|
len = 0;
|
|
|
|
while(1) {
|
|
|
|
hres = IDispatchEx_GetNextDispID(dispex, fdexEnumAll, id, &id);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
else if(hres == S_FALSE)
|
|
|
|
break;
|
|
|
|
|
|
|
|
This->collection[len++] = id;
|
|
|
|
}
|
|
|
|
|
|
|
|
*p = This->size = len;
|
|
|
|
return S_OK;
|
2011-08-25 15:23:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection__newEnum(IHTMLAttributeCollection *iface, IUnknown **p)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection_item(IHTMLAttributeCollection *iface, VARIANT *name, IDispatch **ppItem)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
|
|
|
|
FIXME("(%p)->(%s, %p)\n", This, debugstr_variant(name), ppItem);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IHTMLAttributeCollectionVtbl HTMLAttributeCollectionVtbl = {
|
|
|
|
HTMLAttributeCollection_QueryInterface,
|
|
|
|
HTMLAttributeCollection_AddRef,
|
|
|
|
HTMLAttributeCollection_Release,
|
|
|
|
HTMLAttributeCollection_GetTypeInfoCount,
|
|
|
|
HTMLAttributeCollection_GetTypeInfo,
|
|
|
|
HTMLAttributeCollection_GetIDsOfNames,
|
|
|
|
HTMLAttributeCollection_Invoke,
|
|
|
|
HTMLAttributeCollection_get_length,
|
|
|
|
HTMLAttributeCollection__newEnum,
|
|
|
|
HTMLAttributeCollection_item
|
|
|
|
};
|
|
|
|
|
2011-08-25 15:24:52 +02:00
|
|
|
static inline HTMLAttributeCollection *impl_from_IHTMLAttributeCollection2(IHTMLAttributeCollection2 *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLAttributeCollection, IHTMLAttributeCollection2_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection2_QueryInterface(IHTMLAttributeCollection2 *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
|
|
|
|
return IHTMLAttributeCollection_QueryInterface(&This->IHTMLAttributeCollection_iface, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLAttributeCollection2_AddRef(IHTMLAttributeCollection2 *iface)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
|
|
|
|
return IHTMLAttributeCollection_AddRef(&This->IHTMLAttributeCollection_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLAttributeCollection2_Release(IHTMLAttributeCollection2 *iface)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
|
|
|
|
return IHTMLAttributeCollection_Release(&This->IHTMLAttributeCollection_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection2_GetTypeInfoCount(IHTMLAttributeCollection2 *iface, UINT *pctinfo)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
|
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection2_GetTypeInfo(IHTMLAttributeCollection2 *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
|
|
|
|
return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection2_GetIDsOfNames(IHTMLAttributeCollection2 *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
|
|
|
|
return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
|
|
|
|
lcid, rgDispId);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection2_Invoke(IHTMLAttributeCollection2 *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
|
|
|
|
return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
|
|
|
|
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollection2 *iface, BSTR bstrName,
|
|
|
|
IHTMLDOMAttribute **newretNode)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
|
|
|
|
FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrName), newretNode);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection2_setNamedItem(IHTMLAttributeCollection2 *iface,
|
|
|
|
IHTMLDOMAttribute *ppNode, IHTMLDOMAttribute **newretNode)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
|
|
|
|
FIXME("(%p)->(%p %p)\n", This, ppNode, newretNode);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection2_removeNamedItem(IHTMLAttributeCollection2 *iface,
|
|
|
|
BSTR bstrName, IHTMLDOMAttribute **newretNode)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
|
|
|
|
FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrName), newretNode);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IHTMLAttributeCollection2Vtbl HTMLAttributeCollection2Vtbl = {
|
|
|
|
HTMLAttributeCollection2_QueryInterface,
|
|
|
|
HTMLAttributeCollection2_AddRef,
|
|
|
|
HTMLAttributeCollection2_Release,
|
|
|
|
HTMLAttributeCollection2_GetTypeInfoCount,
|
|
|
|
HTMLAttributeCollection2_GetTypeInfo,
|
|
|
|
HTMLAttributeCollection2_GetIDsOfNames,
|
|
|
|
HTMLAttributeCollection2_Invoke,
|
|
|
|
HTMLAttributeCollection2_getNamedItem,
|
|
|
|
HTMLAttributeCollection2_setNamedItem,
|
|
|
|
HTMLAttributeCollection2_removeNamedItem
|
|
|
|
};
|
|
|
|
|
2011-08-25 15:25:01 +02:00
|
|
|
static inline HTMLAttributeCollection *impl_from_IHTMLAttributeCollection3(IHTMLAttributeCollection3 *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLAttributeCollection, IHTMLAttributeCollection3_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection3_QueryInterface(IHTMLAttributeCollection3 *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
|
|
|
|
return IHTMLAttributeCollection_QueryInterface(&This->IHTMLAttributeCollection_iface, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLAttributeCollection3_AddRef(IHTMLAttributeCollection3 *iface)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
|
|
|
|
return IHTMLAttributeCollection_AddRef(&This->IHTMLAttributeCollection_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLAttributeCollection3_Release(IHTMLAttributeCollection3 *iface)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
|
|
|
|
return IHTMLAttributeCollection_Release(&This->IHTMLAttributeCollection_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection3_GetTypeInfoCount(IHTMLAttributeCollection3 *iface, UINT *pctinfo)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
|
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection3_GetTypeInfo(IHTMLAttributeCollection3 *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
|
|
|
|
return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection3_GetIDsOfNames(IHTMLAttributeCollection3 *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
|
|
|
|
return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
|
|
|
|
lcid, rgDispId);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection3_Invoke(IHTMLAttributeCollection3 *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
|
|
|
|
return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
|
|
|
|
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection3_getNamedItem(IHTMLAttributeCollection3 *iface, BSTR bstrName,
|
|
|
|
IHTMLDOMAttribute **ppNodeOut)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
|
|
|
|
FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrName), ppNodeOut);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection3_setNamedItem(IHTMLAttributeCollection3 *iface,
|
|
|
|
IHTMLDOMAttribute *pNodeIn, IHTMLDOMAttribute **ppNodeOut)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
|
|
|
|
FIXME("(%p)->(%p %p)\n", This, pNodeIn, ppNodeOut);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection3_removeNamedItem(IHTMLAttributeCollection3 *iface,
|
|
|
|
BSTR bstrName, IHTMLDOMAttribute **ppNodeOut)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
|
|
|
|
FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrName), ppNodeOut);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection3_item(IHTMLAttributeCollection3 *iface, LONG index, IHTMLDOMAttribute **ppNodeOut)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
|
|
|
|
FIXME("(%p)->(%d %p)\n", This, index, ppNodeOut);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAttributeCollection3_get_length(IHTMLAttributeCollection3 *iface, LONG *p)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
|
2011-08-25 15:25:17 +02:00
|
|
|
return IHTMLAttributeCollection_get_length(&This->IHTMLAttributeCollection_iface, p);
|
2011-08-25 15:25:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IHTMLAttributeCollection3Vtbl HTMLAttributeCollection3Vtbl = {
|
|
|
|
HTMLAttributeCollection3_QueryInterface,
|
|
|
|
HTMLAttributeCollection3_AddRef,
|
|
|
|
HTMLAttributeCollection3_Release,
|
|
|
|
HTMLAttributeCollection3_GetTypeInfoCount,
|
|
|
|
HTMLAttributeCollection3_GetTypeInfo,
|
|
|
|
HTMLAttributeCollection3_GetIDsOfNames,
|
|
|
|
HTMLAttributeCollection3_Invoke,
|
|
|
|
HTMLAttributeCollection3_getNamedItem,
|
|
|
|
HTMLAttributeCollection3_setNamedItem,
|
|
|
|
HTMLAttributeCollection3_removeNamedItem,
|
|
|
|
HTMLAttributeCollection3_item,
|
|
|
|
HTMLAttributeCollection3_get_length
|
|
|
|
};
|
|
|
|
|
2011-08-25 15:23:35 +02:00
|
|
|
static inline HTMLAttributeCollection *HTMLAttributeCollection_from_DispatchEx(DispatchEx *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLAttributeCollection, dispex);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT HTMLAttributeCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = HTMLAttributeCollection_from_DispatchEx(dispex);
|
|
|
|
FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(name), flags, dispid);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT HTMLAttributeCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
|
|
|
|
VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
|
|
|
|
{
|
|
|
|
HTMLAttributeCollection *This = HTMLAttributeCollection_from_DispatchEx(dispex);
|
|
|
|
FIXME("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const dispex_static_data_vtbl_t HTMLAttributeCollection_dispex_vtbl = {
|
|
|
|
NULL,
|
|
|
|
HTMLAttributeCollection_get_dispid,
|
|
|
|
HTMLAttributeCollection_invoke,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
static const tid_t HTMLAttributeCollection_iface_tids[] = {
|
|
|
|
IHTMLAttributeCollection_tid,
|
|
|
|
IHTMLAttributeCollection2_tid,
|
|
|
|
IHTMLAttributeCollection3_tid,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static dispex_static_data_t HTMLAttributeCollection_dispex = {
|
|
|
|
&HTMLAttributeCollection_dispex_vtbl,
|
|
|
|
DispHTMLAttributeCollection_tid,
|
|
|
|
NULL,
|
|
|
|
HTMLAttributeCollection_iface_tids
|
|
|
|
};
|
|
|
|
|
|
|
|
HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **ac)
|
|
|
|
{
|
|
|
|
HTMLElement *This = impl_from_HTMLDOMNode(iface);
|
|
|
|
HTMLAttributeCollection *ret;
|
|
|
|
|
|
|
|
ret = heap_alloc_zero(sizeof(*ret));
|
|
|
|
if(!ret)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
ret->IHTMLAttributeCollection_iface.lpVtbl = &HTMLAttributeCollectionVtbl;
|
2011-08-25 15:24:52 +02:00
|
|
|
ret->IHTMLAttributeCollection2_iface.lpVtbl = &HTMLAttributeCollection2Vtbl;
|
2011-08-25 15:25:01 +02:00
|
|
|
ret->IHTMLAttributeCollection3_iface.lpVtbl = &HTMLAttributeCollection3Vtbl;
|
2011-08-25 15:23:35 +02:00
|
|
|
ret->ref = 1;
|
|
|
|
|
|
|
|
IHTMLElement_AddRef(&This->IHTMLElement_iface);
|
|
|
|
ret->elem = This;
|
|
|
|
|
|
|
|
init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLAttributeCollection_iface,
|
|
|
|
&HTMLAttributeCollection_dispex);
|
|
|
|
|
|
|
|
*ac = ret;
|
|
|
|
return S_OK;
|
|
|
|
}
|