2011-02-24 13:04:08 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2011 Jacek Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
|
|
|
|
#include "mshtml_private.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|
|
|
|
|
|
|
static inline HTMLDOMAttribute *impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDOMAttribute, IHTMLDOMAttribute_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute_QueryInterface(IHTMLDOMAttribute *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface);
|
|
|
|
|
2014-05-06 10:41:19 +02:00
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
|
|
|
|
|
2011-02-24 13:04:08 +01:00
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
|
|
|
*ppv = &This->IHTMLDOMAttribute_iface;
|
|
|
|
}else if(IsEqualGUID(&IID_IHTMLDOMAttribute, riid)) {
|
|
|
|
*ppv = &This->IHTMLDOMAttribute_iface;
|
2015-03-09 15:35:55 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLDOMAttribute2, riid)) {
|
|
|
|
*ppv = &This->IHTMLDOMAttribute2_iface;
|
2011-02-24 13:04:18 +01:00
|
|
|
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
|
|
|
|
return *ppv ? S_OK : E_NOINTERFACE;
|
2011-02-24 13:04:08 +01:00
|
|
|
}else {
|
2014-05-06 10:41:19 +02:00
|
|
|
WARN("%s not supported\n", debugstr_mshtml_guid(riid));
|
2011-02-24 13:04:08 +01:00
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLDOMAttribute_AddRef(IHTMLDOMAttribute *iface)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface);
|
|
|
|
LONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLDOMAttribute_Release(IHTMLDOMAttribute *iface)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface);
|
|
|
|
LONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
if(!ref) {
|
2011-03-02 13:34:04 +01:00
|
|
|
assert(!This->elem);
|
2011-02-24 13:04:18 +01:00
|
|
|
release_dispex(&This->dispex);
|
2016-03-01 14:31:25 +01:00
|
|
|
VariantClear(&This->value);
|
2013-02-20 15:21:15 +01:00
|
|
|
heap_free(This->name);
|
2011-02-24 13:04:08 +01:00
|
|
|
heap_free(This);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute_GetTypeInfoCount(IHTMLDOMAttribute *iface, UINT *pctinfo)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface);
|
2011-02-24 13:04:18 +01:00
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
|
2011-02-24 13:04:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute_GetTypeInfo(IHTMLDOMAttribute *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface);
|
2011-02-24 13:04:18 +01:00
|
|
|
return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
|
2011-02-24 13:04:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute_GetIDsOfNames(IHTMLDOMAttribute *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames,
|
|
|
|
LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface);
|
2011-02-24 13:04:18 +01:00
|
|
|
return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
|
|
|
|
lcid, rgDispId);
|
2011-02-24 13:04:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute_Invoke(IHTMLDOMAttribute *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface);
|
2011-02-24 13:04:18 +01:00
|
|
|
return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
|
|
|
|
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
2011-02-24 13:04:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute_get_nodeName(IHTMLDOMAttribute *iface, BSTR *p)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface);
|
2011-08-25 15:25:35 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2013-02-20 15:21:15 +01:00
|
|
|
if(!This->elem) {
|
2013-02-20 15:21:27 +01:00
|
|
|
if(!This->name) {
|
|
|
|
FIXME("No name available\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*p = SysAllocString(This->name);
|
|
|
|
return *p ? S_OK : E_OUTOFMEMORY;
|
2013-02-20 15:21:15 +01:00
|
|
|
}
|
|
|
|
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_GetMemberName(&This->elem->node.event_target.dispex.IDispatchEx_iface, This->dispid, p);
|
2011-02-24 13:04:08 +01:00
|
|
|
}
|
|
|
|
|
2014-09-18 07:11:38 +02:00
|
|
|
static HRESULT WINAPI HTMLDOMAttribute_put_nodeValue(IHTMLDOMAttribute *iface, VARIANT v)
|
2011-02-24 13:04:08 +01:00
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface);
|
2014-09-18 07:11:38 +02:00
|
|
|
DISPID dispidNamed = DISPID_PROPERTYPUT;
|
|
|
|
DISPPARAMS dp = {&v, &dispidNamed, 1, 1};
|
|
|
|
EXCEPINFO ei;
|
|
|
|
VARIANT ret;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
2016-03-01 14:31:25 +01:00
|
|
|
if(!This->elem)
|
|
|
|
return VariantCopy(&This->value, &v);
|
2014-09-18 07:11:38 +02:00
|
|
|
|
|
|
|
memset(&ei, 0, sizeof(ei));
|
|
|
|
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_InvokeEx(&This->elem->node.event_target.dispex.IDispatchEx_iface, This->dispid, LOCALE_SYSTEM_DEFAULT,
|
2014-09-18 07:11:38 +02:00
|
|
|
DISPATCH_PROPERTYPUT, &dp, &ret, &ei, NULL);
|
2011-02-24 13:04:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute_get_nodeValue(IHTMLDOMAttribute *iface, VARIANT *p)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface);
|
2011-02-25 14:10:54 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2016-03-01 14:31:25 +01:00
|
|
|
if(!This->elem)
|
|
|
|
return VariantCopy(p, &This->value);
|
2011-02-25 14:10:54 +01:00
|
|
|
|
2016-03-30 14:38:44 +02:00
|
|
|
return get_elem_attr_value_by_dispid(This->elem, This->dispid, p);
|
2011-02-24 13:04:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute_get_specified(IHTMLDOMAttribute *iface, VARIANT_BOOL *p)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface);
|
2012-07-24 15:55:54 +02:00
|
|
|
nsIDOMAttr *nsattr;
|
|
|
|
nsAString nsname;
|
|
|
|
BSTR name;
|
|
|
|
nsresult nsres;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2018-02-12 23:28:15 +01:00
|
|
|
if(!This->elem || !This->elem->dom_element) {
|
2012-07-24 15:55:54 +02:00
|
|
|
FIXME("NULL This->elem\n");
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
2013-02-20 15:21:15 +01:00
|
|
|
if(get_dispid_type(This->dispid) != DISPEXPROP_BUILTIN) {
|
|
|
|
*p = VARIANT_TRUE;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2015-05-14 13:24:19 +02:00
|
|
|
hres = IDispatchEx_GetMemberName(&This->elem->node.event_target.dispex.IDispatchEx_iface, This->dispid, &name);
|
2012-07-24 15:55:54 +02:00
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
/* FIXME: This is not exactly right, we have some attributes that don't map directly to Gecko attributes. */
|
|
|
|
nsAString_InitDepend(&nsname, name);
|
2018-02-12 23:28:15 +01:00
|
|
|
nsres = nsIDOMElement_GetAttributeNode(This->elem->dom_element, &nsname, &nsattr);
|
2012-07-24 15:55:54 +02:00
|
|
|
nsAString_Finish(&nsname);
|
|
|
|
SysFreeString(name);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
/* If the Gecko attribute node can be found, we know that the attribute is specified.
|
|
|
|
There is no point in calling GetSpecified */
|
|
|
|
if(nsattr) {
|
|
|
|
nsIDOMAttr_Release(nsattr);
|
|
|
|
*p = VARIANT_TRUE;
|
|
|
|
}else {
|
|
|
|
*p = VARIANT_FALSE;
|
|
|
|
}
|
|
|
|
return S_OK;
|
2011-02-24 13:04:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IHTMLDOMAttributeVtbl HTMLDOMAttributeVtbl = {
|
|
|
|
HTMLDOMAttribute_QueryInterface,
|
|
|
|
HTMLDOMAttribute_AddRef,
|
|
|
|
HTMLDOMAttribute_Release,
|
|
|
|
HTMLDOMAttribute_GetTypeInfoCount,
|
|
|
|
HTMLDOMAttribute_GetTypeInfo,
|
|
|
|
HTMLDOMAttribute_GetIDsOfNames,
|
|
|
|
HTMLDOMAttribute_Invoke,
|
|
|
|
HTMLDOMAttribute_get_nodeName,
|
2014-09-18 07:11:38 +02:00
|
|
|
HTMLDOMAttribute_put_nodeValue,
|
2011-02-24 13:04:08 +01:00
|
|
|
HTMLDOMAttribute_get_nodeValue,
|
|
|
|
HTMLDOMAttribute_get_specified
|
|
|
|
};
|
|
|
|
|
2015-03-09 15:35:55 +01:00
|
|
|
static inline HTMLDOMAttribute *impl_from_IHTMLDOMAttribute2(IHTMLDOMAttribute2 *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDOMAttribute, IHTMLDOMAttribute2_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_QueryInterface(IHTMLDOMAttribute2 *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
return IHTMLDOMAttribute_QueryInterface(&This->IHTMLDOMAttribute_iface, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLDOMAttribute2_AddRef(IHTMLDOMAttribute2 *iface)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
return IHTMLDOMAttribute_AddRef(&This->IHTMLDOMAttribute_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLDOMAttribute2_Release(IHTMLDOMAttribute2 *iface)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
return IHTMLDOMAttribute_Release(&This->IHTMLDOMAttribute_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_GetTypeInfoCount(IHTMLDOMAttribute2 *iface, UINT *pctinfo)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_GetTypeInfo(IHTMLDOMAttribute2 *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_GetIDsOfNames(IHTMLDOMAttribute2 *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
|
|
|
|
lcid, rgDispId);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_Invoke(IHTMLDOMAttribute2 *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
|
|
|
|
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_get_name(IHTMLDOMAttribute2 *iface, BSTR *p)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_put_value(IHTMLDOMAttribute2 *iface, BSTR v)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
2015-11-25 11:56:59 +01:00
|
|
|
VARIANT var;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
|
|
|
V_VT(&var) = VT_BSTR;
|
|
|
|
V_BSTR(&var) = v;
|
|
|
|
return IHTMLDOMAttribute_put_nodeValue(&This->IHTMLDOMAttribute_iface, var);
|
2015-03-09 15:35:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_get_value(IHTMLDOMAttribute2 *iface, BSTR *p)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
2015-05-04 19:14:19 +02:00
|
|
|
VARIANT val;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2016-03-30 14:38:58 +02:00
|
|
|
V_VT(&val) = VT_EMPTY;
|
|
|
|
if(This->elem)
|
|
|
|
hres = get_elem_attr_value_by_dispid(This->elem, This->dispid, &val);
|
|
|
|
else
|
|
|
|
hres = VariantCopy(&val, &This->value);
|
2016-03-30 14:38:44 +02:00
|
|
|
if(SUCCEEDED(hres))
|
|
|
|
hres = attr_value_to_string(&val);
|
2015-05-04 19:14:19 +02:00
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
assert(V_VT(&val) == VT_BSTR);
|
|
|
|
*p = V_BSTR(&val);
|
|
|
|
if(!*p && !(*p = SysAllocStringLen(NULL, 0)))
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
return S_OK;
|
2015-03-09 15:35:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_get_expando(IHTMLDOMAttribute2 *iface, VARIANT_BOOL *p)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
2015-03-09 15:36:13 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2017-11-02 16:48:02 +01:00
|
|
|
*p = variant_bool(This->elem && get_dispid_type(This->dispid) != DISPEXPROP_BUILTIN);
|
2015-03-09 15:36:13 +01:00
|
|
|
return S_OK;
|
2015-03-09 15:35:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_get_nodeType(IHTMLDOMAttribute2 *iface, LONG *p)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_get_parentNode(IHTMLDOMAttribute2 *iface, IHTMLDOMNode **p)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
2016-03-30 14:39:08 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
*p = NULL;
|
|
|
|
return S_OK;
|
2015-03-09 15:35:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_get_childNodes(IHTMLDOMAttribute2 *iface, IDispatch **p)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_get_firstChild(IHTMLDOMAttribute2 *iface, IHTMLDOMNode **p)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_get_lastChild(IHTMLDOMAttribute2 *iface, IHTMLDOMNode **p)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_get_previousSibling(IHTMLDOMAttribute2 *iface, IHTMLDOMNode **p)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_get_nextSibling(IHTMLDOMAttribute2 *iface, IHTMLDOMNode **p)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_get_attributes(IHTMLDOMAttribute2 *iface, IDispatch **p)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_get_ownerDocument(IHTMLDOMAttribute2 *iface, IDispatch **p)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_insertBefore(IHTMLDOMAttribute2 *iface, IHTMLDOMNode *newChild,
|
|
|
|
VARIANT refChild, IHTMLDOMNode **node)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
FIXME("(%p)->(%p %s %p)\n", This, newChild, debugstr_variant(&refChild), node);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_replaceChild(IHTMLDOMAttribute2 *iface, IHTMLDOMNode *newChild,
|
|
|
|
IHTMLDOMNode *oldChild, IHTMLDOMNode **node)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
FIXME("(%p)->(%p %p %p)\n", This, newChild, oldChild, node);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_removeChild(IHTMLDOMAttribute2 *iface, IHTMLDOMNode *oldChild,
|
|
|
|
IHTMLDOMNode **node)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
FIXME("(%p)->(%p %p)\n", This, oldChild, node);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_appendChild(IHTMLDOMAttribute2 *iface, IHTMLDOMNode *newChild,
|
|
|
|
IHTMLDOMNode **node)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
FIXME("(%p)->(%p %p)\n", This, newChild, node);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_hasChildNodes(IHTMLDOMAttribute2 *iface, VARIANT_BOOL *fChildren)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, fChildren);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDOMAttribute2_cloneNode(IHTMLDOMAttribute2 *iface, VARIANT_BOOL fDeep,
|
|
|
|
IHTMLDOMAttribute **clonedNode)
|
|
|
|
{
|
|
|
|
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface);
|
|
|
|
FIXME("(%p)->(%x %p)\n", This, fDeep, clonedNode);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IHTMLDOMAttribute2Vtbl HTMLDOMAttribute2Vtbl = {
|
|
|
|
HTMLDOMAttribute2_QueryInterface,
|
|
|
|
HTMLDOMAttribute2_AddRef,
|
|
|
|
HTMLDOMAttribute2_Release,
|
|
|
|
HTMLDOMAttribute2_GetTypeInfoCount,
|
|
|
|
HTMLDOMAttribute2_GetTypeInfo,
|
|
|
|
HTMLDOMAttribute2_GetIDsOfNames,
|
|
|
|
HTMLDOMAttribute2_Invoke,
|
|
|
|
HTMLDOMAttribute2_get_name,
|
|
|
|
HTMLDOMAttribute2_put_value,
|
|
|
|
HTMLDOMAttribute2_get_value,
|
|
|
|
HTMLDOMAttribute2_get_expando,
|
|
|
|
HTMLDOMAttribute2_get_nodeType,
|
|
|
|
HTMLDOMAttribute2_get_parentNode,
|
|
|
|
HTMLDOMAttribute2_get_childNodes,
|
|
|
|
HTMLDOMAttribute2_get_firstChild,
|
|
|
|
HTMLDOMAttribute2_get_lastChild,
|
|
|
|
HTMLDOMAttribute2_get_previousSibling,
|
|
|
|
HTMLDOMAttribute2_get_nextSibling,
|
|
|
|
HTMLDOMAttribute2_get_attributes,
|
|
|
|
HTMLDOMAttribute2_get_ownerDocument,
|
|
|
|
HTMLDOMAttribute2_insertBefore,
|
|
|
|
HTMLDOMAttribute2_replaceChild,
|
|
|
|
HTMLDOMAttribute2_removeChild,
|
|
|
|
HTMLDOMAttribute2_appendChild,
|
|
|
|
HTMLDOMAttribute2_hasChildNodes,
|
|
|
|
HTMLDOMAttribute2_cloneNode
|
|
|
|
};
|
|
|
|
|
2011-02-24 13:04:18 +01:00
|
|
|
static const tid_t HTMLDOMAttribute_iface_tids[] = {
|
|
|
|
IHTMLDOMAttribute_tid,
|
2015-03-09 15:35:55 +01:00
|
|
|
IHTMLDOMAttribute2_tid,
|
2011-02-24 13:04:18 +01:00
|
|
|
0
|
|
|
|
};
|
|
|
|
static dispex_static_data_t HTMLDOMAttribute_dispex = {
|
2021-10-06 17:11:31 +02:00
|
|
|
L"Attr",
|
2011-02-24 13:04:18 +01:00
|
|
|
NULL,
|
|
|
|
DispHTMLDOMAttribute_tid,
|
|
|
|
HTMLDOMAttribute_iface_tids
|
|
|
|
};
|
|
|
|
|
2016-03-30 14:39:57 +02:00
|
|
|
HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute *iface)
|
|
|
|
{
|
|
|
|
return iface->lpVtbl == &HTMLDOMAttributeVtbl ? impl_from_IHTMLDOMAttribute(iface) : NULL;
|
|
|
|
}
|
|
|
|
|
2021-10-06 17:11:35 +02:00
|
|
|
HRESULT HTMLDOMAttribute_Create(const WCHAR *name, HTMLElement *elem, DISPID dispid, compat_mode_t compat_mode, HTMLDOMAttribute **attr)
|
2011-02-24 13:04:08 +01:00
|
|
|
{
|
2011-09-02 14:17:10 +02:00
|
|
|
HTMLAttributeCollection *col;
|
2011-02-24 13:04:08 +01:00
|
|
|
HTMLDOMAttribute *ret;
|
2011-09-02 14:17:10 +02:00
|
|
|
HRESULT hres;
|
2011-02-24 13:04:08 +01:00
|
|
|
|
|
|
|
ret = heap_alloc_zero(sizeof(*ret));
|
|
|
|
if(!ret)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
ret->IHTMLDOMAttribute_iface.lpVtbl = &HTMLDOMAttributeVtbl;
|
2015-03-09 15:35:55 +01:00
|
|
|
ret->IHTMLDOMAttribute2_iface.lpVtbl = &HTMLDOMAttribute2Vtbl;
|
2011-02-24 13:04:08 +01:00
|
|
|
ret->ref = 1;
|
2011-03-02 13:34:24 +01:00
|
|
|
ret->dispid = dispid;
|
2011-03-02 13:34:04 +01:00
|
|
|
ret->elem = elem;
|
|
|
|
|
2021-03-16 19:57:45 +01:00
|
|
|
init_dispatch(&ret->dispex, (IUnknown*)&ret->IHTMLDOMAttribute_iface,
|
|
|
|
&HTMLDOMAttribute_dispex, compat_mode);
|
2011-02-24 13:04:18 +01:00
|
|
|
|
2013-02-20 15:21:15 +01:00
|
|
|
/* For attributes attached to an element, (elem,dispid) pair should be valid used for its operation. */
|
|
|
|
if(elem) {
|
|
|
|
hres = HTMLElement_get_attr_col(&elem->node, &col);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
IHTMLDOMAttribute_Release(&ret->IHTMLDOMAttribute_iface);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
IHTMLAttributeCollection_Release(&col->IHTMLAttributeCollection_iface);
|
|
|
|
|
|
|
|
list_add_tail(&elem->attrs->attrs, &ret->entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* For detached attributes we may still do most operations if we have its name available. */
|
|
|
|
if(name) {
|
|
|
|
ret->name = heap_strdupW(name);
|
|
|
|
if(!ret->name) {
|
|
|
|
IHTMLDOMAttribute_Release(&ret->IHTMLDOMAttribute_iface);
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-24 13:04:08 +01:00
|
|
|
*attr = ret;
|
|
|
|
return S_OK;
|
|
|
|
}
|