2008-05-01 17:36:28 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2008 Jacek Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2012-06-27 10:56:54 +02:00
|
|
|
#include <assert.h>
|
2008-05-01 17:36:28 +02:00
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
#include "mshtml_private.h"
|
2010-03-18 01:06:05 +01:00
|
|
|
#include "htmlevent.h"
|
2008-05-01 17:36:28 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
HTMLElement element;
|
|
|
|
|
2010-12-06 23:31:37 +01:00
|
|
|
IHTMLImgElement IHTMLImgElement_iface;
|
2008-06-23 16:52:40 +02:00
|
|
|
|
|
|
|
nsIDOMHTMLImageElement *nsimg;
|
2008-05-01 17:36:28 +02:00
|
|
|
} HTMLImgElement;
|
|
|
|
|
2010-12-06 23:31:37 +01:00
|
|
|
static inline HTMLImgElement *impl_from_IHTMLImgElement(IHTMLImgElement *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLImgElement, IHTMLImgElement_iface);
|
|
|
|
}
|
2008-05-01 17:36:28 +02:00
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_QueryInterface(IHTMLImgElement *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLImgElement_AddRef(IHTMLImgElement *iface)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLImgElement_Release(IHTMLImgElement *iface)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_GetTypeInfoCount(IHTMLImgElement *iface, UINT *pctinfo)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_GetTypeInfo(IHTMLImgElement *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
|
2010-12-31 11:07:33 +01:00
|
|
|
ppTInfo);
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_GetIDsOfNames(IHTMLImgElement *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames,
|
|
|
|
LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
|
2010-12-31 11:07:33 +01:00
|
|
|
cNames, lcid, rgDispId);
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_Invoke(IHTMLImgElement *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
|
2010-12-31 11:07:33 +01:00
|
|
|
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_put_isMap(IHTMLImgElement *iface, VARIANT_BOOL v)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2014-08-18 11:01:55 +02:00
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%x)\n", This, v);
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLImageElement_SetIsMap(This->nsimg, v != VARIANT_FALSE);
|
|
|
|
if (NS_FAILED(nsres)) {
|
|
|
|
ERR("Set IsMap failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_isMap(IHTMLImgElement *iface, VARIANT_BOOL *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2014-08-18 11:01:55 +02:00
|
|
|
cpp_bool b;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
if (p == NULL)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLImageElement_GetIsMap(This->nsimg, &b);
|
|
|
|
if (NS_FAILED(nsres)) {
|
|
|
|
ERR("Get IsMap failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
*p = b ? VARIANT_TRUE : VARIANT_FALSE;
|
|
|
|
return S_OK;
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_put_useMap(IHTMLImgElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_useMap(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_mimeType(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_fileSize(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_fileCreatedDate(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_fileModifiedDate(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_fileUpdatedDate(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_protocol(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_href(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_nameProp(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_put_border(IHTMLImgElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_border(IHTMLImgElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-03-12 01:43:18 +01:00
|
|
|
static HRESULT WINAPI HTMLImgElement_put_vspace(IHTMLImgElement *iface, LONG v)
|
2008-05-01 17:36:28 +02:00
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2009-03-12 01:43:18 +01:00
|
|
|
FIXME("(%p)->(%d)\n", This, v);
|
2008-05-01 17:36:28 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-03-12 01:43:18 +01:00
|
|
|
static HRESULT WINAPI HTMLImgElement_get_vspace(IHTMLImgElement *iface, LONG *p)
|
2008-05-01 17:36:28 +02:00
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-03-12 01:43:18 +01:00
|
|
|
static HRESULT WINAPI HTMLImgElement_put_hspace(IHTMLImgElement *iface, LONG v)
|
2008-05-01 17:36:28 +02:00
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2009-03-12 01:43:18 +01:00
|
|
|
FIXME("(%p)->(%d)\n", This, v);
|
2008-05-01 17:36:28 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-03-12 01:43:18 +01:00
|
|
|
static HRESULT WINAPI HTMLImgElement_get_hspace(IHTMLImgElement *iface, LONG *p)
|
2008-05-01 17:36:28 +02:00
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_put_alt(IHTMLImgElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-06-30 21:39:36 +02:00
|
|
|
nsAString alt_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
2010-01-28 23:56:31 +01:00
|
|
|
nsAString_InitDepend(&alt_str, v);
|
2008-06-30 21:39:36 +02:00
|
|
|
nsres = nsIDOMHTMLImageElement_SetAlt(This->nsimg, &alt_str);
|
|
|
|
nsAString_Finish(&alt_str);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("SetAlt failed: %08x\n", nsres);
|
|
|
|
|
|
|
|
return S_OK;
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_alt(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-06-30 21:39:36 +02:00
|
|
|
nsAString alt_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&alt_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLImageElement_GetAlt(This->nsimg, &alt_str);
|
2012-04-13 12:20:25 +02:00
|
|
|
return return_nsstr(nsres, &alt_str, p);
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_put_src(IHTMLImgElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-06-23 16:52:40 +02:00
|
|
|
nsAString src_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
2010-01-28 23:56:31 +01:00
|
|
|
nsAString_InitDepend(&src_str, v);
|
2008-06-23 16:52:40 +02:00
|
|
|
nsres = nsIDOMHTMLImageElement_SetSrc(This->nsimg, &src_str);
|
|
|
|
nsAString_Finish(&src_str);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("SetSrc failed: %08x\n", nsres);
|
|
|
|
|
2016-09-13 20:54:20 +02:00
|
|
|
return S_OK;
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_src(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-10-13 21:50:37 +02:00
|
|
|
const PRUnichar *src;
|
|
|
|
nsAString src_str;
|
|
|
|
nsresult nsres;
|
2011-03-14 14:07:09 +01:00
|
|
|
HRESULT hres = S_OK;
|
|
|
|
|
|
|
|
static const WCHAR blockedW[] = {'B','L','O','C','K','E','D',':',':',0};
|
2008-10-13 21:50:37 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&src_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLImageElement_GetSrc(This->nsimg, &src_str);
|
2011-03-14 14:07:09 +01:00
|
|
|
if(NS_SUCCEEDED(nsres)) {
|
|
|
|
nsAString_GetData(&src_str, &src);
|
|
|
|
|
|
|
|
if(!strncmpiW(src, blockedW, sizeof(blockedW)/sizeof(WCHAR)-1)) {
|
|
|
|
TRACE("returning BLOCKED::\n");
|
|
|
|
*p = SysAllocString(blockedW);
|
|
|
|
if(!*p)
|
|
|
|
hres = E_OUTOFMEMORY;
|
|
|
|
}else {
|
|
|
|
hres = nsuri_to_url(src, TRUE, p);
|
|
|
|
}
|
|
|
|
}else {
|
2008-10-13 21:50:37 +02:00
|
|
|
ERR("GetSrc failed: %08x\n", nsres);
|
2011-03-14 14:07:09 +01:00
|
|
|
hres = E_FAIL;
|
2008-10-13 21:50:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
nsAString_Finish(&src_str);
|
|
|
|
return hres;
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_put_lowsrc(IHTMLImgElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_lowsrc(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_put_vrml(IHTMLImgElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_vrml(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_put_dynsrc(IHTMLImgElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_dynsrc(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_readyState(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_complete(IHTMLImgElement *iface, VARIANT_BOOL *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2012-10-17 12:20:24 +02:00
|
|
|
cpp_bool complete;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLImageElement_GetComplete(This->nsimg, &complete);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetComplete failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*p = complete ? VARIANT_TRUE : VARIANT_FALSE;
|
|
|
|
return S_OK;
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_put_loop(IHTMLImgElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_loop(IHTMLImgElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_put_align(IHTMLImgElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2014-08-18 11:03:11 +02:00
|
|
|
nsAString str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
|
|
|
nsAString_InitDepend(&str, v);
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLImageElement_SetAlign(This->nsimg, &str);
|
|
|
|
nsAString_Finish(&str);
|
|
|
|
if (NS_FAILED(nsres)){
|
|
|
|
ERR("Set Align(%s) failed: %08x\n", debugstr_w(v), nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_align(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2014-08-18 11:03:11 +02:00
|
|
|
nsAString str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&str, NULL);
|
|
|
|
nsres = nsIDOMHTMLImageElement_GetAlign(This->nsimg, &str);
|
|
|
|
|
|
|
|
return return_nsstr(nsres, &str, p);
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_put_onload(IHTMLImgElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2010-03-18 01:06:05 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_node_event(&This->element.node, EVENTID_LOAD, &v);
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_onload(IHTMLImgElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2010-03-18 01:06:05 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_node_event(&This->element.node, EVENTID_LOAD, p);
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_put_onerror(IHTMLImgElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2012-04-05 13:58:03 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->()\n", This);
|
|
|
|
|
|
|
|
return set_node_event(&This->element.node, EVENTID_ERROR, &v);
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_onerror(IHTMLImgElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2012-04-05 13:58:03 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_node_event(&This->element.node, EVENTID_ERROR, p);
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_put_onabort(IHTMLImgElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2012-10-17 12:18:30 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->()\n", This);
|
|
|
|
|
|
|
|
return set_node_event(&This->element.node, EVENTID_ABORT, &v);
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_onabort(IHTMLImgElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2012-10-17 12:18:30 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_node_event(&This->element.node, EVENTID_ABORT, p);
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_put_name(IHTMLImgElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_name(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2012-04-13 12:20:25 +02:00
|
|
|
nsAString name;
|
2009-12-13 11:15:28 +01:00
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2012-04-13 12:20:25 +02:00
|
|
|
nsAString_Init(&name, NULL);
|
|
|
|
nsres = nsIDOMHTMLImageElement_GetName(This->nsimg, &name);
|
|
|
|
return return_nsstr(nsres, &name, p);
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
2009-03-12 01:43:18 +01:00
|
|
|
static HRESULT WINAPI HTMLImgElement_put_width(IHTMLImgElement *iface, LONG v)
|
2008-05-01 17:36:28 +02:00
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2010-02-08 21:47:21 +01:00
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%d)\n", This, v);
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLImageElement_SetWidth(This->nsimg, v);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("SetWidth failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
2009-03-12 01:43:18 +01:00
|
|
|
static HRESULT WINAPI HTMLImgElement_get_width(IHTMLImgElement *iface, LONG *p)
|
2008-05-01 17:36:28 +02:00
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2013-01-23 18:44:42 +01:00
|
|
|
UINT32 width;
|
2010-02-08 21:47:21 +01:00
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLImageElement_GetWidth(This->nsimg, &width);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetWidth failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*p = width;
|
|
|
|
return S_OK;
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
2009-03-12 01:43:18 +01:00
|
|
|
static HRESULT WINAPI HTMLImgElement_put_height(IHTMLImgElement *iface, LONG v)
|
2008-05-01 17:36:28 +02:00
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2010-02-08 21:47:57 +01:00
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%d)\n", This, v);
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLImageElement_SetHeight(This->nsimg, v);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("SetHeight failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
2009-03-12 01:43:18 +01:00
|
|
|
static HRESULT WINAPI HTMLImgElement_get_height(IHTMLImgElement *iface, LONG *p)
|
2008-05-01 17:36:28 +02:00
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2013-01-23 18:44:42 +01:00
|
|
|
UINT32 height;
|
2010-02-08 21:47:57 +01:00
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLImageElement_GetHeight(This->nsimg, &height);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetHeight failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*p = height;
|
|
|
|
return S_OK;
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_put_start(IHTMLImgElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImgElement_get_start(IHTMLImgElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:37 +01:00
|
|
|
HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IHTMLImgElementVtbl HTMLImgElementVtbl = {
|
|
|
|
HTMLImgElement_QueryInterface,
|
|
|
|
HTMLImgElement_AddRef,
|
|
|
|
HTMLImgElement_Release,
|
|
|
|
HTMLImgElement_GetTypeInfoCount,
|
|
|
|
HTMLImgElement_GetTypeInfo,
|
|
|
|
HTMLImgElement_GetIDsOfNames,
|
|
|
|
HTMLImgElement_Invoke,
|
|
|
|
HTMLImgElement_put_isMap,
|
|
|
|
HTMLImgElement_get_isMap,
|
|
|
|
HTMLImgElement_put_useMap,
|
|
|
|
HTMLImgElement_get_useMap,
|
|
|
|
HTMLImgElement_get_mimeType,
|
|
|
|
HTMLImgElement_get_fileSize,
|
|
|
|
HTMLImgElement_get_fileCreatedDate,
|
|
|
|
HTMLImgElement_get_fileModifiedDate,
|
|
|
|
HTMLImgElement_get_fileUpdatedDate,
|
|
|
|
HTMLImgElement_get_protocol,
|
|
|
|
HTMLImgElement_get_href,
|
|
|
|
HTMLImgElement_get_nameProp,
|
|
|
|
HTMLImgElement_put_border,
|
|
|
|
HTMLImgElement_get_border,
|
|
|
|
HTMLImgElement_put_vspace,
|
|
|
|
HTMLImgElement_get_vspace,
|
|
|
|
HTMLImgElement_put_hspace,
|
|
|
|
HTMLImgElement_get_hspace,
|
|
|
|
HTMLImgElement_put_alt,
|
|
|
|
HTMLImgElement_get_alt,
|
|
|
|
HTMLImgElement_put_src,
|
|
|
|
HTMLImgElement_get_src,
|
|
|
|
HTMLImgElement_put_lowsrc,
|
|
|
|
HTMLImgElement_get_lowsrc,
|
|
|
|
HTMLImgElement_put_vrml,
|
|
|
|
HTMLImgElement_get_vrml,
|
|
|
|
HTMLImgElement_put_dynsrc,
|
|
|
|
HTMLImgElement_get_dynsrc,
|
|
|
|
HTMLImgElement_get_readyState,
|
|
|
|
HTMLImgElement_get_complete,
|
|
|
|
HTMLImgElement_put_loop,
|
|
|
|
HTMLImgElement_get_loop,
|
|
|
|
HTMLImgElement_put_align,
|
|
|
|
HTMLImgElement_get_align,
|
|
|
|
HTMLImgElement_put_onload,
|
|
|
|
HTMLImgElement_get_onload,
|
|
|
|
HTMLImgElement_put_onerror,
|
|
|
|
HTMLImgElement_get_onerror,
|
|
|
|
HTMLImgElement_put_onabort,
|
|
|
|
HTMLImgElement_get_onabort,
|
|
|
|
HTMLImgElement_put_name,
|
|
|
|
HTMLImgElement_get_name,
|
|
|
|
HTMLImgElement_put_width,
|
|
|
|
HTMLImgElement_get_width,
|
|
|
|
HTMLImgElement_put_height,
|
|
|
|
HTMLImgElement_get_height,
|
|
|
|
HTMLImgElement_put_start,
|
|
|
|
HTMLImgElement_get_start
|
|
|
|
};
|
|
|
|
|
2010-12-27 20:13:09 +01:00
|
|
|
static inline HTMLImgElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLImgElement, element.node);
|
|
|
|
}
|
2008-05-01 17:36:28 +02:00
|
|
|
|
|
|
|
static HRESULT HTMLImgElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLImgElement *This = impl_from_HTMLDOMNode(iface);
|
2008-05-01 17:36:28 +02:00
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IHTMLImgElement, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLImgElement %p)\n", This, ppv);
|
2010-12-06 23:31:37 +01:00
|
|
|
*ppv = &This->IHTMLImgElement_iface;
|
2008-05-01 17:36:28 +02:00
|
|
|
}else {
|
|
|
|
return HTMLElement_QI(&This->element.node, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2009-11-30 17:58:59 +01:00
|
|
|
static HRESULT HTMLImgElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
|
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLImgElement *This = impl_from_HTMLDOMNode(iface);
|
2009-11-30 17:58:59 +01:00
|
|
|
|
2010-12-06 23:31:37 +01:00
|
|
|
return IHTMLImgElement_get_readyState(&This->IHTMLImgElement_iface, p);
|
2009-11-30 17:58:59 +01:00
|
|
|
}
|
|
|
|
|
2014-09-26 15:11:28 +02:00
|
|
|
static void HTMLImgElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
|
|
|
|
{
|
|
|
|
HTMLImgElement *This = impl_from_HTMLDOMNode(iface);
|
|
|
|
|
|
|
|
if(This->nsimg)
|
|
|
|
note_cc_edge((nsISupports*)This->nsimg, "This->nsimg", cb);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void HTMLImgElement_unlink(HTMLDOMNode *iface)
|
|
|
|
{
|
|
|
|
HTMLImgElement *This = impl_from_HTMLDOMNode(iface);
|
|
|
|
|
|
|
|
if(This->nsimg) {
|
|
|
|
nsIDOMHTMLImageElement *nsimg = This->nsimg;
|
|
|
|
|
|
|
|
This->nsimg = NULL;
|
|
|
|
nsIDOMHTMLImageElement_Release(nsimg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-01 17:36:28 +02:00
|
|
|
static const NodeImplVtbl HTMLImgElementImplVtbl = {
|
|
|
|
HTMLImgElement_QI,
|
2012-06-27 10:56:54 +02:00
|
|
|
HTMLElement_destructor,
|
2013-03-15 15:01:53 +01:00
|
|
|
HTMLElement_cpc,
|
2010-11-14 14:41:39 +01:00
|
|
|
HTMLElement_clone,
|
2012-09-04 13:58:58 +02:00
|
|
|
HTMLElement_handle_event,
|
2011-08-25 15:23:35 +02:00
|
|
|
HTMLElement_get_attr_col,
|
2009-11-30 17:58:59 +01:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2014-09-26 15:11:28 +02:00
|
|
|
HTMLImgElement_get_readystate,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
HTMLImgElement_traverse,
|
|
|
|
HTMLImgElement_unlink
|
2008-05-01 17:36:28 +02:00
|
|
|
};
|
|
|
|
|
2008-05-06 16:04:58 +02:00
|
|
|
static const tid_t HTMLImgElement_iface_tids[] = {
|
2010-01-28 02:09:02 +01:00
|
|
|
HTMLELEMENT_TIDS,
|
2008-05-06 16:04:58 +02:00
|
|
|
IHTMLImgElement_tid,
|
|
|
|
0
|
|
|
|
};
|
2008-05-01 17:36:38 +02:00
|
|
|
static dispex_static_data_t HTMLImgElement_dispex = {
|
|
|
|
NULL,
|
|
|
|
DispHTMLImg_tid,
|
2016-07-07 12:50:18 +02:00
|
|
|
HTMLImgElement_iface_tids,
|
|
|
|
HTMLElement_init_dispex_info
|
2008-05-01 17:36:38 +02:00
|
|
|
};
|
|
|
|
|
2010-12-01 22:43:14 +01:00
|
|
|
HRESULT HTMLImgElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
|
2008-05-01 17:36:28 +02:00
|
|
|
{
|
2010-12-01 22:43:14 +01:00
|
|
|
HTMLImgElement *ret;
|
2008-06-23 16:52:40 +02:00
|
|
|
nsresult nsres;
|
2008-05-01 17:36:28 +02:00
|
|
|
|
2010-12-01 22:43:14 +01:00
|
|
|
ret = heap_alloc_zero(sizeof(HTMLImgElement));
|
|
|
|
if(!ret)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2010-12-06 23:31:37 +01:00
|
|
|
ret->IHTMLImgElement_iface.lpVtbl = &HTMLImgElementVtbl;
|
2008-05-01 17:36:28 +02:00
|
|
|
ret->element.node.vtbl = &HTMLImgElementImplVtbl;
|
|
|
|
|
2012-06-27 10:56:54 +02:00
|
|
|
HTMLElement_Init(&ret->element, doc, nselem, &HTMLImgElement_dispex);
|
|
|
|
|
2008-06-23 16:52:40 +02:00
|
|
|
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLImageElement, (void**)&ret->nsimg);
|
2014-09-26 15:11:28 +02:00
|
|
|
assert(nsres == NS_OK);
|
2008-05-01 17:36:28 +02:00
|
|
|
|
2010-12-01 22:43:14 +01:00
|
|
|
*elem = &ret->element;
|
|
|
|
return S_OK;
|
2008-05-01 17:36:28 +02:00
|
|
|
}
|
2009-10-20 23:04:34 +02:00
|
|
|
|
2011-01-03 01:05:51 +01:00
|
|
|
static inline HTMLImageElementFactory *impl_from_IHTMLImageElementFactory(IHTMLImageElementFactory *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLImageElementFactory, IHTMLImageElementFactory_iface);
|
|
|
|
}
|
2009-10-20 23:04:34 +02:00
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImageElementFactory_QueryInterface(IHTMLImageElementFactory *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2011-01-03 01:05:51 +01:00
|
|
|
HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface);
|
2009-10-20 23:04:34 +02:00
|
|
|
|
2014-05-08 11:48:32 +02:00
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
|
2009-10-20 23:04:34 +02:00
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
2011-01-03 01:05:51 +01:00
|
|
|
*ppv = &This->IHTMLImageElementFactory_iface;
|
2009-10-20 23:04:34 +02:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLImageElementFactory, riid)) {
|
2011-01-03 01:05:51 +01:00
|
|
|
*ppv = &This->IHTMLImageElementFactory_iface;
|
2014-05-08 11:48:32 +02:00
|
|
|
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
|
2009-10-20 23:05:03 +02:00
|
|
|
return *ppv ? S_OK : E_NOINTERFACE;
|
2014-05-08 11:48:32 +02:00
|
|
|
}else {
|
|
|
|
*ppv = NULL;
|
|
|
|
WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
|
|
|
|
return E_NOINTERFACE;
|
2009-10-20 23:04:34 +02:00
|
|
|
}
|
|
|
|
|
2014-05-08 11:48:32 +02:00
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
2009-10-20 23:04:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLImageElementFactory_AddRef(IHTMLImageElementFactory *iface)
|
|
|
|
{
|
2011-01-03 01:05:51 +01:00
|
|
|
HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface);
|
2009-10-20 23:04:34 +02:00
|
|
|
LONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLImageElementFactory_Release(IHTMLImageElementFactory *iface)
|
|
|
|
{
|
2011-01-03 01:05:51 +01:00
|
|
|
HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface);
|
2009-10-20 23:04:34 +02:00
|
|
|
LONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
if(!ref)
|
|
|
|
heap_free(This);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImageElementFactory_GetTypeInfoCount(IHTMLImageElementFactory *iface,
|
|
|
|
UINT *pctinfo)
|
|
|
|
{
|
2011-01-03 01:05:51 +01:00
|
|
|
HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface);
|
2014-05-08 11:48:43 +02:00
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
|
2009-10-20 23:04:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImageElementFactory_GetTypeInfo(IHTMLImageElementFactory *iface,
|
|
|
|
UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
2011-01-03 01:05:51 +01:00
|
|
|
HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface);
|
2014-05-08 11:48:43 +02:00
|
|
|
return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
|
2009-10-20 23:04:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImageElementFactory_GetIDsOfNames(IHTMLImageElementFactory *iface,
|
|
|
|
REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid,
|
|
|
|
DISPID *rgDispId)
|
|
|
|
{
|
2011-01-03 01:05:51 +01:00
|
|
|
HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface);
|
2014-05-08 11:48:43 +02:00
|
|
|
return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId);
|
2009-10-20 23:04:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLImageElementFactory_Invoke(IHTMLImageElementFactory *iface,
|
|
|
|
DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
|
|
|
|
DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
|
|
|
|
UINT *puArgErr)
|
|
|
|
{
|
2011-01-03 01:05:51 +01:00
|
|
|
HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface);
|
2014-05-08 11:48:43 +02:00
|
|
|
return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
|
|
|
|
pDispParams, pVarResult, pExcepInfo, puArgErr);
|
2009-10-20 23:04:34 +02:00
|
|
|
}
|
|
|
|
|
2010-02-08 21:46:45 +01:00
|
|
|
static LONG var_to_size(const VARIANT *v)
|
|
|
|
{
|
|
|
|
switch(V_VT(v)) {
|
|
|
|
case VT_EMPTY:
|
|
|
|
return 0;
|
|
|
|
case VT_I4:
|
|
|
|
return V_I4(v);
|
|
|
|
case VT_BSTR: {
|
|
|
|
LONG ret;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = VarI4FromStr(V_BSTR(v), 0, 0, &ret);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
FIXME("VarI4FromStr failed: %08x\n", hres);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
FIXME("unsupported size %s\n", debugstr_variant(v));
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-10-20 23:04:34 +02:00
|
|
|
static HRESULT WINAPI HTMLImageElementFactory_create(IHTMLImageElementFactory *iface,
|
2009-10-20 23:04:49 +02:00
|
|
|
VARIANT width, VARIANT height, IHTMLImgElement **img_elem)
|
2009-10-20 23:04:34 +02:00
|
|
|
{
|
2011-01-03 01:05:51 +01:00
|
|
|
HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface);
|
2012-06-25 14:05:17 +02:00
|
|
|
HTMLDocumentNode *doc;
|
2010-02-08 21:46:45 +01:00
|
|
|
IHTMLImgElement *img;
|
2009-10-20 23:04:49 +02:00
|
|
|
HTMLElement *elem;
|
|
|
|
nsIDOMHTMLElement *nselem;
|
2010-02-08 21:46:45 +01:00
|
|
|
LONG l;
|
2009-10-20 23:04:49 +02:00
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
static const PRUnichar imgW[] = {'I','M','G',0};
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s %s %p)\n", This, debugstr_variant(&width),
|
|
|
|
debugstr_variant(&height), img_elem);
|
|
|
|
|
2012-07-30 15:55:57 +02:00
|
|
|
if(!This->window || !This->window->doc) {
|
2009-10-20 23:04:49 +02:00
|
|
|
WARN("NULL doc\n");
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
2012-07-30 15:55:57 +02:00
|
|
|
doc = This->window->doc;
|
2012-06-25 14:05:17 +02:00
|
|
|
|
2009-10-20 23:04:49 +02:00
|
|
|
*img_elem = NULL;
|
|
|
|
|
2012-06-25 14:05:17 +02:00
|
|
|
hres = create_nselem(doc, imgW, &nselem);
|
2009-10-20 23:04:49 +02:00
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
2012-06-25 14:05:17 +02:00
|
|
|
hres = HTMLElement_Create(doc, (nsIDOMNode*)nselem, FALSE, &elem);
|
2010-12-01 22:42:51 +01:00
|
|
|
nsIDOMHTMLElement_Release(nselem);
|
|
|
|
if(FAILED(hres)) {
|
2009-10-20 23:04:49 +02:00
|
|
|
ERR("HTMLElement_Create failed\n");
|
2010-12-01 22:42:51 +01:00
|
|
|
return hres;
|
2009-10-20 23:04:49 +02:00
|
|
|
}
|
|
|
|
|
2010-12-30 01:24:59 +01:00
|
|
|
hres = IHTMLElement_QueryInterface(&elem->IHTMLElement_iface, &IID_IHTMLImgElement,
|
|
|
|
(void**)&img);
|
2012-06-26 12:33:35 +02:00
|
|
|
IHTMLElement_Release(&elem->IHTMLElement_iface);
|
2009-10-20 23:04:49 +02:00
|
|
|
if(FAILED(hres)) {
|
|
|
|
ERR("IHTMLElement_QueryInterface failed: 0x%08x\n", hres);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2010-02-08 21:46:45 +01:00
|
|
|
l = var_to_size(&width);
|
|
|
|
if(l)
|
|
|
|
IHTMLImgElement_put_width(img, l);
|
|
|
|
l = var_to_size(&height);
|
|
|
|
if(l)
|
|
|
|
IHTMLImgElement_put_height(img, l);
|
2009-10-20 23:04:49 +02:00
|
|
|
|
2010-02-08 21:46:45 +01:00
|
|
|
*img_elem = img;
|
2009-10-20 23:04:49 +02:00
|
|
|
return S_OK;
|
2009-10-20 23:04:34 +02:00
|
|
|
}
|
|
|
|
|
2010-12-27 18:34:39 +01:00
|
|
|
static const IHTMLImageElementFactoryVtbl HTMLImageElementFactoryVtbl = {
|
|
|
|
HTMLImageElementFactory_QueryInterface,
|
|
|
|
HTMLImageElementFactory_AddRef,
|
|
|
|
HTMLImageElementFactory_Release,
|
|
|
|
HTMLImageElementFactory_GetTypeInfoCount,
|
|
|
|
HTMLImageElementFactory_GetTypeInfo,
|
|
|
|
HTMLImageElementFactory_GetIDsOfNames,
|
|
|
|
HTMLImageElementFactory_Invoke,
|
|
|
|
HTMLImageElementFactory_create
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline HTMLImageElementFactory *impl_from_DispatchEx(DispatchEx *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLImageElementFactory, dispex);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT HTMLImageElementFactory_value(DispatchEx *dispex, LCID lcid,
|
2009-10-21 23:25:29 +02:00
|
|
|
WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei,
|
|
|
|
IServiceProvider *caller)
|
|
|
|
{
|
2010-12-27 18:34:39 +01:00
|
|
|
HTMLImageElementFactory *This = impl_from_DispatchEx(dispex);
|
2009-10-21 23:25:29 +02:00
|
|
|
IHTMLImgElement *img;
|
|
|
|
VARIANT empty, *width, *height;
|
|
|
|
HRESULT hres;
|
|
|
|
int argc = params->cArgs - params->cNamedArgs;
|
|
|
|
|
|
|
|
V_VT(res) = VT_NULL;
|
|
|
|
|
|
|
|
V_VT(&empty) = VT_EMPTY;
|
|
|
|
|
|
|
|
width = argc >= 1 ? params->rgvarg + (params->cArgs - 1) : ∅
|
|
|
|
height = argc >= 2 ? params->rgvarg + (params->cArgs - 2) : ∅
|
|
|
|
|
2011-01-03 01:05:51 +01:00
|
|
|
hres = IHTMLImageElementFactory_create(&This->IHTMLImageElementFactory_iface, *width, *height,
|
|
|
|
&img);
|
2009-10-21 23:25:29 +02:00
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
V_VT(res) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(res) = (IDispatch*)img;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2009-10-20 23:05:03 +02:00
|
|
|
static const tid_t HTMLImageElementFactory_iface_tids[] = {
|
|
|
|
IHTMLImageElementFactory_tid,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2009-10-21 23:25:29 +02:00
|
|
|
static const dispex_static_data_vtbl_t HTMLImageElementFactory_dispex_vtbl = {
|
|
|
|
HTMLImageElementFactory_value,
|
2009-10-20 23:05:03 +02:00
|
|
|
NULL,
|
2011-08-23 11:33:18 +02:00
|
|
|
NULL,
|
2009-10-21 23:25:29 +02:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
static dispex_static_data_t HTMLImageElementFactory_dispex = {
|
|
|
|
&HTMLImageElementFactory_dispex_vtbl,
|
2009-10-20 23:05:03 +02:00
|
|
|
IHTMLImageElementFactory_tid,
|
|
|
|
HTMLImageElementFactory_iface_tids
|
|
|
|
};
|
|
|
|
|
2012-06-26 12:32:27 +02:00
|
|
|
HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow *window, HTMLImageElementFactory **ret_val)
|
2009-10-20 23:04:34 +02:00
|
|
|
{
|
|
|
|
HTMLImageElementFactory *ret;
|
|
|
|
|
|
|
|
ret = heap_alloc(sizeof(HTMLImageElementFactory));
|
2012-06-26 12:32:27 +02:00
|
|
|
if(!ret)
|
|
|
|
return E_OUTOFMEMORY;
|
2009-10-20 23:04:34 +02:00
|
|
|
|
2011-01-03 01:05:51 +01:00
|
|
|
ret->IHTMLImageElementFactory_iface.lpVtbl = &HTMLImageElementFactoryVtbl;
|
2009-10-20 23:04:34 +02:00
|
|
|
ret->ref = 1;
|
|
|
|
ret->window = window;
|
|
|
|
|
2011-01-03 01:05:51 +01:00
|
|
|
init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLImageElementFactory_iface,
|
|
|
|
&HTMLImageElementFactory_dispex);
|
2009-10-20 23:05:03 +02:00
|
|
|
|
2012-06-26 12:32:27 +02:00
|
|
|
*ret_val = ret;
|
|
|
|
return S_OK;
|
2009-10-20 23:04:34 +02:00
|
|
|
}
|