2006-03-09 00:20:19 +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-09 00:20:19 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
2016-03-31 14:50:33 +02:00
|
|
|
#include "mshtmdid.h"
|
2006-03-09 00:20:19 +01:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
#include "mshtml_private.h"
|
2012-10-16 17:07:10 +02:00
|
|
|
#include "htmlevent.h"
|
2013-11-11 14:36:43 +01:00
|
|
|
#include "htmlstyle.h"
|
2006-03-09 00:20:19 +01:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|
|
|
|
|
|
|
typedef struct {
|
2007-09-15 16:07:52 +02:00
|
|
|
HTMLTextContainer textcont;
|
2007-09-15 16:05:34 +02:00
|
|
|
|
2010-12-06 16:44:18 +01:00
|
|
|
IHTMLBodyElement IHTMLBodyElement_iface;
|
2006-03-09 00:20:19 +01:00
|
|
|
|
|
|
|
nsIDOMHTMLBodyElement *nsbody;
|
|
|
|
} HTMLBodyElement;
|
|
|
|
|
2009-08-02 00:09:09 +02:00
|
|
|
static const WCHAR aquaW[] = {'a','q','u','a',0};
|
|
|
|
static const WCHAR blackW[] = {'b','l','a','c','k',0};
|
|
|
|
static const WCHAR blueW[] = {'b','l','u','e',0};
|
|
|
|
static const WCHAR fuchsiaW[] = {'f','u','s','h','s','i','a',0};
|
|
|
|
static const WCHAR grayW[] = {'g','r','a','y',0};
|
|
|
|
static const WCHAR greenW[] = {'g','r','e','e','n',0};
|
|
|
|
static const WCHAR limeW[] = {'l','i','m','e',0};
|
|
|
|
static const WCHAR maroonW[] = {'m','a','r','o','o','n',0};
|
|
|
|
static const WCHAR navyW[] = {'n','a','v','y',0};
|
|
|
|
static const WCHAR oliveW[] = {'o','l','i','v','e',0};
|
|
|
|
static const WCHAR purpleW[] = {'p','u','r','p','l','e',0};
|
|
|
|
static const WCHAR redW[] = {'r','e','d',0};
|
|
|
|
static const WCHAR silverW[] = {'s','i','l','v','e','r',0};
|
|
|
|
static const WCHAR tealW[] = {'t','e','a','l',0};
|
|
|
|
static const WCHAR whiteW[] = {'w','h','i','t','e',0};
|
|
|
|
static const WCHAR yellowW[] = {'y','e','l','l','o','w',0};
|
|
|
|
|
|
|
|
static const struct {
|
|
|
|
LPCWSTR keyword;
|
2009-12-27 00:49:31 +01:00
|
|
|
DWORD rgb;
|
2009-08-02 00:09:09 +02:00
|
|
|
} keyword_table[] = {
|
2009-12-27 00:49:31 +01:00
|
|
|
{aquaW, 0x00ffff},
|
|
|
|
{blackW, 0x000000},
|
|
|
|
{blueW, 0x0000ff},
|
|
|
|
{fuchsiaW, 0xff00ff},
|
|
|
|
{grayW, 0x808080},
|
|
|
|
{greenW, 0x008000},
|
|
|
|
{limeW, 0x00ff00},
|
|
|
|
{maroonW, 0x800000},
|
|
|
|
{navyW, 0x000080},
|
|
|
|
{oliveW, 0x808000},
|
|
|
|
{purpleW, 0x800080},
|
|
|
|
{redW, 0xff0000},
|
|
|
|
{silverW, 0xc0c0c0},
|
|
|
|
{tealW, 0x008080},
|
|
|
|
{whiteW, 0xffffff},
|
|
|
|
{yellowW, 0xffff00}
|
2009-08-02 00:09:09 +02:00
|
|
|
};
|
|
|
|
|
2009-12-27 00:49:46 +01:00
|
|
|
static int comp_value(const WCHAR *ptr, int dpc)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
WCHAR ch;
|
|
|
|
|
|
|
|
if(dpc > 2)
|
|
|
|
dpc = 2;
|
|
|
|
|
|
|
|
while(dpc--) {
|
|
|
|
if(!*ptr)
|
|
|
|
ret *= 16;
|
|
|
|
else if(isdigitW(ch = *ptr++))
|
|
|
|
ret = ret*16 + (ch-'0');
|
|
|
|
else if('a' <= ch && ch <= 'f')
|
|
|
|
ret = ret*16 + (ch-'a') + 10;
|
|
|
|
else if('A' <= ch && ch <= 'F')
|
|
|
|
ret = ret*16 + (ch-'A') + 10;
|
|
|
|
else
|
|
|
|
ret *= 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Based on Gecko NS_LooseHexToRGB */
|
|
|
|
static int loose_hex_to_rgb(const WCHAR *hex)
|
|
|
|
{
|
|
|
|
int len, dpc;
|
|
|
|
|
|
|
|
len = strlenW(hex);
|
|
|
|
if(*hex == '#') {
|
|
|
|
hex++;
|
|
|
|
len--;
|
|
|
|
}
|
|
|
|
if(len <= 3)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
dpc = min(len/3 + (len%3 ? 1 : 0), 4);
|
|
|
|
return (comp_value(hex, dpc) << 16)
|
|
|
|
| (comp_value(hex+dpc, dpc) << 8)
|
|
|
|
| comp_value(hex+2*dpc, dpc);
|
|
|
|
}
|
|
|
|
|
2014-03-26 08:06:39 +01:00
|
|
|
HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret)
|
2009-08-02 00:09:09 +02:00
|
|
|
{
|
2013-02-16 22:09:13 +01:00
|
|
|
unsigned int i;
|
|
|
|
int rgb = -1;
|
2009-12-27 00:49:31 +01:00
|
|
|
|
|
|
|
static const WCHAR formatW[] = {'#','%','0','2','x','%','0','2','x','%','0','2','x',0};
|
2009-08-02 00:09:09 +02:00
|
|
|
|
2009-12-27 00:49:46 +01:00
|
|
|
if(!color || !*color) {
|
|
|
|
*ret = NULL;
|
|
|
|
return S_OK;
|
2009-12-27 00:49:10 +01:00
|
|
|
}
|
2009-08-02 00:09:09 +02:00
|
|
|
|
2009-12-27 00:49:31 +01:00
|
|
|
if(*color != '#') {
|
|
|
|
for(i=0; i < sizeof(keyword_table)/sizeof(keyword_table[0]); i++) {
|
|
|
|
if(!strcmpiW(color, keyword_table[i].keyword))
|
|
|
|
rgb = keyword_table[i].rgb;
|
2009-12-27 00:49:10 +01:00
|
|
|
}
|
2009-08-02 00:09:09 +02:00
|
|
|
}
|
2009-12-27 00:49:46 +01:00
|
|
|
if(rgb == -1)
|
|
|
|
rgb = loose_hex_to_rgb(color);
|
2009-12-27 00:49:31 +01:00
|
|
|
|
|
|
|
*ret = SysAllocStringLen(NULL, 7);
|
|
|
|
if(!*ret)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
sprintfW(*ret, formatW, rgb>>16, (rgb>>8)&0xff, rgb&0xff);
|
2009-08-02 00:09:09 +02:00
|
|
|
|
2009-12-27 00:49:31 +01:00
|
|
|
TRACE("%s -> %s\n", debugstr_w(color), debugstr_w(*ret));
|
|
|
|
return S_OK;
|
2009-08-02 00:09:09 +02:00
|
|
|
}
|
|
|
|
|
2014-03-26 08:06:39 +01:00
|
|
|
BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr)
|
2008-02-24 22:17:32 +01:00
|
|
|
{
|
|
|
|
switch(V_VT(v)) {
|
|
|
|
case VT_BSTR:
|
|
|
|
nsAString_Init(nsstr, V_BSTR(v));
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case VT_I4: {
|
|
|
|
PRUnichar buf[10];
|
|
|
|
static const WCHAR formatW[] = {'#','%','x',0};
|
|
|
|
|
|
|
|
wsprintfW(buf, formatW, V_I4(v));
|
|
|
|
nsAString_Init(nsstr, buf);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
2012-03-28 14:26:57 +02:00
|
|
|
FIXME("invalid color %s\n", debugstr_variant(v));
|
2008-02-24 22:17:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-04-13 12:00:55 +02:00
|
|
|
static HRESULT return_nscolor(nsresult nsres, nsAString *nsstr, VARIANT *p)
|
2008-02-24 22:17:55 +01:00
|
|
|
{
|
|
|
|
const PRUnichar *color;
|
|
|
|
|
2012-04-13 12:00:55 +02:00
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("failed: %08x\n", nsres);
|
|
|
|
nsAString_Finish(nsstr);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2008-02-24 22:17:55 +01:00
|
|
|
nsAString_GetData(nsstr, &color);
|
|
|
|
|
|
|
|
if(*color == '#') {
|
|
|
|
V_VT(p) = VT_I4;
|
|
|
|
V_I4(p) = strtolW(color+1, NULL, 16);
|
|
|
|
}else {
|
|
|
|
V_VT(p) = VT_BSTR;
|
|
|
|
V_BSTR(p) = SysAllocString(color);
|
2012-04-13 12:00:55 +02:00
|
|
|
if(!V_BSTR(p)) {
|
|
|
|
nsAString_Finish(nsstr);
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
2008-02-24 22:17:55 +01:00
|
|
|
}
|
2012-04-13 12:00:55 +02:00
|
|
|
|
|
|
|
nsAString_Finish(nsstr);
|
|
|
|
TRACE("ret %s\n", debugstr_variant(p));
|
|
|
|
return S_OK;
|
2008-02-24 22:17:55 +01:00
|
|
|
}
|
|
|
|
|
2010-12-06 16:44:18 +01:00
|
|
|
static inline HTMLBodyElement *impl_from_IHTMLBodyElement(IHTMLBodyElement *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLBodyElement, IHTMLBodyElement_iface);
|
|
|
|
}
|
2006-03-09 00:20:19 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_QueryInterface(IHTMLBodyElement *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2006-03-09 00:20:19 +01:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_QueryInterface(&This->textcont.element.node.IHTMLDOMNode_iface, riid, ppv);
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLBodyElement_AddRef(IHTMLBodyElement *iface)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2006-03-09 00:20:19 +01:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_AddRef(&This->textcont.element.node.IHTMLDOMNode_iface);
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLBodyElement_Release(IHTMLBodyElement *iface)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2006-03-09 00:20:19 +01:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_Release(&This->textcont.element.node.IHTMLDOMNode_iface);
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_GetTypeInfoCount(IHTMLBodyElement *iface, UINT *pctinfo)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->textcont.element.node.event_target.dispex.IDispatchEx_iface,
|
2010-12-31 11:07:33 +01:00
|
|
|
pctinfo);
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_GetTypeInfo(IHTMLBodyElement *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_GetTypeInfo(&This->textcont.element.node.event_target.dispex.IDispatchEx_iface, iTInfo,
|
2010-12-31 11:07:33 +01:00
|
|
|
lcid, ppTInfo);
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_GetIDsOfNames(IHTMLBodyElement *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames,
|
|
|
|
LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_GetIDsOfNames(&This->textcont.element.node.event_target.dispex.IDispatchEx_iface, riid,
|
2010-12-31 11:07:33 +01:00
|
|
|
rgszNames, cNames, lcid, rgDispId);
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_Invoke(IHTMLBodyElement *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2015-05-14 13:24:19 +02:00
|
|
|
return IDispatchEx_Invoke(&This->textcont.element.node.event_target.dispex.IDispatchEx_iface, dispIdMember,
|
2010-12-31 11:07:33 +01:00
|
|
|
riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_background(IHTMLBodyElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2008-09-23 12:03:58 +02:00
|
|
|
nsAString nsstr;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
2010-01-28 23:55:51 +01:00
|
|
|
nsAString_InitDepend(&nsstr, v);
|
2008-09-23 12:03:58 +02:00
|
|
|
nsres = nsIDOMHTMLBodyElement_SetBackground(This->nsbody, &nsstr);
|
|
|
|
nsAString_Finish(&nsstr);
|
2010-01-28 23:55:51 +01:00
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
return E_FAIL;
|
2008-09-23 12:03:58 +02:00
|
|
|
|
2010-01-28 23:55:51 +01:00
|
|
|
return S_OK;
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_background(IHTMLBodyElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2007-04-12 21:22:51 +02:00
|
|
|
nsAString background_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&background_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLBodyElement_GetBackground(This->nsbody, &background_str);
|
2012-04-13 12:02:11 +02:00
|
|
|
return return_nsstr(nsres, &background_str, p);
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_bgProperties(IHTMLBodyElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2007-04-12 21:21:49 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_bgProperties(IHTMLBodyElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2007-04-12 21:21:49 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_leftMargin(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2012-03-28 14:26:57 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_leftMargin(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2007-04-12 21:21:49 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_topMargin(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2012-03-28 14:26:57 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_topMargin(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2007-04-12 21:21:49 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_rightMargin(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2012-03-28 14:26:57 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_rightMargin(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2007-04-12 21:21:49 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_bottomMargin(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2012-03-28 14:26:57 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_bottomMargin(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2007-04-12 21:21:49 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_noWrap(IHTMLBodyElement *iface, VARIANT_BOOL v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2007-04-12 21:21:49 +02:00
|
|
|
FIXME("(%p)->(%x)\n", This, v);
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_noWrap(IHTMLBodyElement *iface, VARIANT_BOOL *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2007-04-12 21:21:49 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_bgColor(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2008-09-05 12:34:59 +02:00
|
|
|
nsAString strColor;
|
|
|
|
nsresult nsres;
|
|
|
|
|
2012-03-28 14:26:57 +02:00
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-09-05 12:34:59 +02:00
|
|
|
|
|
|
|
if(!variant_to_nscolor(&v, &strColor))
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLBodyElement_SetBgColor(This->nsbody, &strColor);
|
|
|
|
nsAString_Finish(&strColor);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("SetBgColor failed: %08x\n", nsres);
|
|
|
|
|
|
|
|
return S_OK;
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_bgColor(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2008-09-05 12:34:59 +02:00
|
|
|
nsAString strColor;
|
|
|
|
nsresult nsres;
|
2009-12-27 00:49:10 +01:00
|
|
|
HRESULT hres;
|
2008-09-05 12:34:59 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&strColor, NULL);
|
|
|
|
nsres = nsIDOMHTMLBodyElement_GetBgColor(This->nsbody, &strColor);
|
2009-12-27 00:49:10 +01:00
|
|
|
if(NS_SUCCEEDED(nsres)) {
|
|
|
|
const PRUnichar *color;
|
2008-09-05 12:34:59 +02:00
|
|
|
|
2009-12-27 00:49:10 +01:00
|
|
|
nsAString_GetData(&strColor, &color);
|
|
|
|
V_VT(p) = VT_BSTR;
|
|
|
|
hres = nscolor_to_str(color, &V_BSTR(p));
|
|
|
|
}else {
|
|
|
|
ERR("SetBgColor failed: %08x\n", nsres);
|
|
|
|
hres = E_FAIL;
|
|
|
|
}
|
2008-09-05 12:34:59 +02:00
|
|
|
|
|
|
|
nsAString_Finish(&strColor);
|
2009-12-27 00:49:10 +01:00
|
|
|
return hres;
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_text(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2008-09-17 12:41:47 +02:00
|
|
|
nsAString text;
|
|
|
|
nsresult nsres;
|
|
|
|
|
2012-03-28 14:26:57 +02:00
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-09-17 12:41:47 +02:00
|
|
|
|
|
|
|
if(!variant_to_nscolor(&v, &text))
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLBodyElement_SetText(This->nsbody, &text);
|
|
|
|
nsAString_Finish(&text);
|
2010-05-08 18:33:52 +02:00
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("SetText failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
2008-09-17 12:41:47 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_text(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2008-09-17 12:41:47 +02:00
|
|
|
nsAString text;
|
|
|
|
nsresult nsres;
|
2009-12-27 00:50:04 +01:00
|
|
|
HRESULT hres;
|
2008-09-17 12:41:47 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&text, NULL);
|
|
|
|
nsres = nsIDOMHTMLBodyElement_GetText(This->nsbody, &text);
|
2009-12-27 00:50:04 +01:00
|
|
|
if(NS_SUCCEEDED(nsres)) {
|
|
|
|
const PRUnichar *color;
|
2008-09-17 12:41:47 +02:00
|
|
|
|
2009-12-27 00:50:04 +01:00
|
|
|
nsAString_GetData(&text, &color);
|
2008-09-17 12:41:47 +02:00
|
|
|
V_VT(p) = VT_BSTR;
|
2009-12-27 00:50:04 +01:00
|
|
|
hres = nscolor_to_str(color, &V_BSTR(p));
|
|
|
|
}else {
|
|
|
|
ERR("GetText failed: %08x\n", nsres);
|
|
|
|
hres = E_FAIL;
|
2008-09-17 12:41:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
nsAString_Finish(&text);
|
|
|
|
|
2010-05-01 16:19:05 +02:00
|
|
|
return hres;
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_link(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2008-02-24 22:17:32 +01:00
|
|
|
nsAString link_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
2012-03-28 14:26:57 +02:00
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-02-24 22:17:32 +01:00
|
|
|
|
|
|
|
if(!variant_to_nscolor(&v, &link_str))
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLBodyElement_SetLink(This->nsbody, &link_str);
|
|
|
|
nsAString_Finish(&link_str);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("SetLink failed: %08x\n", nsres);
|
|
|
|
|
|
|
|
return S_OK;
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_link(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2008-02-24 22:17:55 +01:00
|
|
|
nsAString link_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&link_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLBodyElement_GetLink(This->nsbody, &link_str);
|
2012-04-13 12:00:55 +02:00
|
|
|
return return_nscolor(nsres, &link_str, p);
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_vLink(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2008-02-24 22:18:24 +01:00
|
|
|
nsAString vlink_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
2012-03-28 14:26:57 +02:00
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-02-24 22:18:24 +01:00
|
|
|
|
|
|
|
if(!variant_to_nscolor(&v, &vlink_str))
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLBodyElement_SetVLink(This->nsbody, &vlink_str);
|
|
|
|
nsAString_Finish(&vlink_str);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("SetLink failed: %08x\n", nsres);
|
|
|
|
|
|
|
|
return S_OK;
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_vLink(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2008-02-24 22:18:24 +01:00
|
|
|
nsAString vlink_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&vlink_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLBodyElement_GetVLink(This->nsbody, &vlink_str);
|
2012-04-13 12:00:55 +02:00
|
|
|
return return_nscolor(nsres, &vlink_str, p);
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_aLink(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2008-02-24 22:18:47 +01:00
|
|
|
nsAString alink_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
2012-03-28 14:26:57 +02:00
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-02-24 22:18:47 +01:00
|
|
|
|
|
|
|
if(!variant_to_nscolor(&v, &alink_str))
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLBodyElement_SetALink(This->nsbody, &alink_str);
|
|
|
|
nsAString_Finish(&alink_str);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("SetALink failed: %08x\n", nsres);
|
|
|
|
|
|
|
|
return S_OK;
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_aLink(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2008-02-24 22:18:47 +01:00
|
|
|
nsAString alink_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&alink_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLBodyElement_GetALink(This->nsbody, &alink_str);
|
2012-04-13 12:00:55 +02:00
|
|
|
return return_nscolor(nsres, &alink_str, p);
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_onload(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2012-10-16 17:07:10 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_node_event(&This->textcont.element.node, EVENTID_LOAD, &v);
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_onload(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2012-10-16 17:07:10 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_node_event(&This->textcont.element.node, EVENTID_LOAD, p);
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_onunload(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2012-03-28 14:26:57 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_onunload(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2007-04-12 21:21:49 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-11 14:36:43 +01:00
|
|
|
static const WCHAR autoW[] = {'a','u','t','o',0};
|
|
|
|
static const WCHAR hiddenW[] = {'h','i','d','d','e','n',0};
|
|
|
|
static const WCHAR scrollW[] = {'s','c','r','o','l','l',0};
|
|
|
|
static const WCHAR visibleW[] = {'v','i','s','i','b','l','e',0};
|
|
|
|
static const WCHAR yesW[] = {'y','e','s',0};
|
|
|
|
static const WCHAR noW[] = {'n','o',0};
|
|
|
|
|
2006-03-09 00:20:19 +01:00
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_scroll(IHTMLBodyElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2013-11-11 14:36:43 +01:00
|
|
|
static const WCHAR *val;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
|
|
|
/* Emulate with CSS visibility attribute */
|
|
|
|
if(!strcmpW(v, yesW)) {
|
|
|
|
val = scrollW;
|
|
|
|
}else if(!strcmpW(v, autoW)) {
|
|
|
|
val = visibleW;
|
|
|
|
}else if(!strcmpW(v, noW)) {
|
|
|
|
val = hiddenW;
|
|
|
|
}else {
|
|
|
|
WARN("Invalid argument %s\n", debugstr_w(v));
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
return set_elem_style(&This->textcont.element, STYLEID_OVERFLOW, val);
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_scroll(IHTMLBodyElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2013-11-30 20:17:31 +01:00
|
|
|
const WCHAR *ret = NULL;
|
2013-11-11 14:36:43 +01:00
|
|
|
BSTR overflow;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
/* Emulate with CSS visibility attribute */
|
|
|
|
hres = get_elem_style(&This->textcont.element, STYLEID_OVERFLOW, &overflow);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
if(!overflow || !*overflow) {
|
|
|
|
*p = NULL;
|
2013-11-30 20:17:31 +01:00
|
|
|
hres = S_OK;
|
2013-11-11 14:36:43 +01:00
|
|
|
}else if(!strcmpW(overflow, visibleW) || !strcmpW(overflow, autoW)) {
|
|
|
|
ret = autoW;
|
|
|
|
}else if(!strcmpW(overflow, scrollW)) {
|
|
|
|
ret = yesW;
|
|
|
|
}else if(!strcmpW(overflow, hiddenW)) {
|
|
|
|
ret = noW;
|
|
|
|
}else {
|
2013-11-14 10:02:33 +01:00
|
|
|
TRACE("Defaulting %s to NULL\n", debugstr_w(overflow));
|
2013-11-11 14:36:43 +01:00
|
|
|
*p = NULL;
|
2013-11-30 20:17:31 +01:00
|
|
|
hres = S_OK;
|
2013-11-11 14:36:43 +01:00
|
|
|
}
|
|
|
|
|
2013-11-30 20:17:31 +01:00
|
|
|
SysFreeString(overflow);
|
|
|
|
if(ret) {
|
|
|
|
*p = SysAllocString(ret);
|
|
|
|
hres = *p ? S_OK : E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
return hres;
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_onselect(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2012-03-28 14:26:57 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_onselect(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2007-04-12 21:21:49 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_onbeforeunload(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2012-03-28 14:26:57 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_onbeforeunload(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2007-04-12 21:21:49 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-09 00:20:19 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, IHTMLTxtRange **range)
|
|
|
|
{
|
2010-12-06 16:44:18 +01:00
|
|
|
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
2007-05-10 01:13:13 +02:00
|
|
|
nsIDOMRange *nsrange = NULL;
|
2008-10-08 20:28:27 +02:00
|
|
|
nsresult nsres;
|
2009-09-16 22:11:43 +02:00
|
|
|
HRESULT hres;
|
2007-05-10 01:13:13 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, range);
|
|
|
|
|
2009-10-21 21:27:42 +02:00
|
|
|
if(!This->textcont.element.node.doc->nsdoc) {
|
2008-10-08 20:28:27 +02:00
|
|
|
WARN("No nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
2011-08-23 14:07:02 +02:00
|
|
|
nsres = nsIDOMHTMLDocument_CreateRange(This->textcont.element.node.doc->nsdoc, &nsrange);
|
2008-10-08 20:28:27 +02:00
|
|
|
if(NS_SUCCEEDED(nsres)) {
|
|
|
|
nsres = nsIDOMRange_SelectNodeContents(nsrange, This->textcont.element.node.nsnode);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("SelectNodeContents failed: %08x\n", nsres);
|
|
|
|
}else {
|
|
|
|
ERR("CreateRange failed: %08x\n", nsres);
|
2007-05-10 01:13:13 +02:00
|
|
|
}
|
|
|
|
|
2009-09-16 22:13:31 +02:00
|
|
|
hres = HTMLTxtRange_Create(This->textcont.element.node.doc->basedoc.doc_node, nsrange, range);
|
2009-09-16 22:11:43 +02:00
|
|
|
|
|
|
|
nsIDOMRange_Release(nsrange);
|
|
|
|
return hres;
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IHTMLBodyElementVtbl HTMLBodyElementVtbl = {
|
|
|
|
HTMLBodyElement_QueryInterface,
|
|
|
|
HTMLBodyElement_AddRef,
|
|
|
|
HTMLBodyElement_Release,
|
|
|
|
HTMLBodyElement_GetTypeInfoCount,
|
|
|
|
HTMLBodyElement_GetTypeInfo,
|
|
|
|
HTMLBodyElement_GetIDsOfNames,
|
|
|
|
HTMLBodyElement_Invoke,
|
|
|
|
HTMLBodyElement_put_background,
|
|
|
|
HTMLBodyElement_get_background,
|
|
|
|
HTMLBodyElement_put_bgProperties,
|
|
|
|
HTMLBodyElement_get_bgProperties,
|
|
|
|
HTMLBodyElement_put_leftMargin,
|
|
|
|
HTMLBodyElement_get_leftMargin,
|
|
|
|
HTMLBodyElement_put_topMargin,
|
|
|
|
HTMLBodyElement_get_topMargin,
|
|
|
|
HTMLBodyElement_put_rightMargin,
|
|
|
|
HTMLBodyElement_get_rightMargin,
|
|
|
|
HTMLBodyElement_put_bottomMargin,
|
|
|
|
HTMLBodyElement_get_bottomMargin,
|
|
|
|
HTMLBodyElement_put_noWrap,
|
|
|
|
HTMLBodyElement_get_noWrap,
|
|
|
|
HTMLBodyElement_put_bgColor,
|
|
|
|
HTMLBodyElement_get_bgColor,
|
|
|
|
HTMLBodyElement_put_text,
|
|
|
|
HTMLBodyElement_get_text,
|
|
|
|
HTMLBodyElement_put_link,
|
|
|
|
HTMLBodyElement_get_link,
|
|
|
|
HTMLBodyElement_put_vLink,
|
|
|
|
HTMLBodyElement_get_vLink,
|
|
|
|
HTMLBodyElement_put_aLink,
|
|
|
|
HTMLBodyElement_get_aLink,
|
|
|
|
HTMLBodyElement_put_onload,
|
|
|
|
HTMLBodyElement_get_onload,
|
|
|
|
HTMLBodyElement_put_onunload,
|
|
|
|
HTMLBodyElement_get_onunload,
|
|
|
|
HTMLBodyElement_put_scroll,
|
|
|
|
HTMLBodyElement_get_scroll,
|
|
|
|
HTMLBodyElement_put_onselect,
|
|
|
|
HTMLBodyElement_get_onselect,
|
|
|
|
HTMLBodyElement_put_onbeforeunload,
|
|
|
|
HTMLBodyElement_get_onbeforeunload,
|
|
|
|
HTMLBodyElement_createTextRange
|
|
|
|
};
|
|
|
|
|
2010-12-27 20:13:09 +01:00
|
|
|
static inline HTMLBodyElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLBodyElement, textcont.element.node);
|
|
|
|
}
|
2007-10-04 02:08:56 +02:00
|
|
|
|
2007-10-04 02:10:36 +02:00
|
|
|
static HRESULT HTMLBodyElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLBodyElement *This = impl_from_HTMLDOMNode(iface);
|
2007-10-04 02:10:36 +02:00
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
|
2010-12-06 16:44:18 +01:00
|
|
|
*ppv = &This->IHTMLBodyElement_iface;
|
2007-10-04 02:10:36 +02:00
|
|
|
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
|
2010-12-06 16:44:18 +01:00
|
|
|
*ppv = &This->IHTMLBodyElement_iface;
|
2007-10-04 02:10:36 +02:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLBodyElement, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLBodyElement %p)\n", This, ppv);
|
2010-12-06 16:44:18 +01:00
|
|
|
*ppv = &This->IHTMLBodyElement_iface;
|
2007-10-04 02:10:36 +02:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLTextContainer, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLTextContainer %p)\n", &This->textcont, ppv);
|
2011-01-03 01:08:23 +01:00
|
|
|
*ppv = &This->textcont.IHTMLTextContainer_iface;
|
2007-10-04 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(*ppv) {
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return HTMLElement_QI(&This->textcont.element.node, riid, ppv);
|
|
|
|
}
|
|
|
|
|
2014-12-21 19:29:35 +01:00
|
|
|
static void HTMLBodyElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
|
2007-10-04 02:08:56 +02:00
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLBodyElement *This = impl_from_HTMLDOMNode(iface);
|
2007-10-04 02:08:56 +02:00
|
|
|
|
2014-12-21 19:29:35 +01:00
|
|
|
if(This->nsbody)
|
|
|
|
note_cc_edge((nsISupports*)This->nsbody, "This->nsbody", cb);
|
|
|
|
}
|
2007-10-04 02:09:48 +02:00
|
|
|
|
2014-12-21 19:29:35 +01:00
|
|
|
static void HTMLBodyElement_unlink(HTMLDOMNode *iface)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = impl_from_HTMLDOMNode(iface);
|
|
|
|
|
|
|
|
if(This->nsbody) {
|
|
|
|
nsIDOMHTMLBodyElement *nsbody = This->nsbody;
|
|
|
|
This->nsbody = NULL;
|
|
|
|
nsIDOMHTMLBodyElement_Release(nsbody);
|
|
|
|
}
|
2007-10-04 02:08:56 +02:00
|
|
|
}
|
|
|
|
|
2017-10-16 22:31:42 +02:00
|
|
|
static EventTarget *HTMLBodyElement_get_event_prop_target(HTMLDOMNode *iface, int event_id)
|
2009-09-08 22:29:39 +02:00
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLBodyElement *This = impl_from_HTMLDOMNode(iface);
|
2009-09-08 22:29:39 +02:00
|
|
|
|
2017-10-16 22:31:42 +02:00
|
|
|
switch(event_id) {
|
|
|
|
case EVENTID_BLUR:
|
|
|
|
case EVENTID_ERROR:
|
|
|
|
case EVENTID_FOCUS:
|
|
|
|
case EVENTID_LOAD:
|
|
|
|
case EVENTID_SCROLL:
|
|
|
|
return This->textcont.element.node.doc && This->textcont.element.node.doc->window
|
|
|
|
? &This->textcont.element.node.doc->window->event_target
|
|
|
|
: &This->textcont.element.node.event_target;
|
|
|
|
default:
|
|
|
|
return &This->textcont.element.node.event_target;
|
|
|
|
}
|
2009-09-08 22:29:39 +02:00
|
|
|
}
|
|
|
|
|
2014-12-21 19:29:46 +01:00
|
|
|
static BOOL HTMLBodyElement_is_text_edit(HTMLDOMNode *iface)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2016-03-31 14:50:33 +02:00
|
|
|
static BOOL HTMLBodyElement_is_settable(HTMLDOMNode *iface, DISPID dispid)
|
|
|
|
{
|
|
|
|
switch(dispid) {
|
|
|
|
case DISPID_IHTMLELEMENT_OUTERTEXT:
|
|
|
|
return FALSE;
|
|
|
|
default:
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-15 15:01:53 +01:00
|
|
|
static const cpc_entry_t HTMLBodyElement_cpc[] = {
|
|
|
|
{&DIID_HTMLTextContainerEvents},
|
|
|
|
{&IID_IPropertyNotifySink},
|
|
|
|
HTMLELEMENT_CPC,
|
|
|
|
{NULL}
|
|
|
|
};
|
|
|
|
|
2007-10-04 02:09:48 +02:00
|
|
|
static const NodeImplVtbl HTMLBodyElementImplVtbl = {
|
2017-04-21 13:50:49 +02:00
|
|
|
&CLSID_HTMLBody,
|
2007-10-04 02:10:36 +02:00
|
|
|
HTMLBodyElement_QI,
|
2014-12-21 19:29:35 +01:00
|
|
|
HTMLElement_destructor,
|
2013-03-15 15:01:53 +01:00
|
|
|
HTMLBodyElement_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,
|
2017-10-16 22:31:42 +02:00
|
|
|
HTMLBodyElement_get_event_prop_target,
|
2014-12-21 19:29:35 +01:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
HTMLBodyElement_traverse,
|
2014-12-21 19:29:46 +01:00
|
|
|
HTMLBodyElement_unlink,
|
2016-03-31 14:50:33 +02:00
|
|
|
HTMLBodyElement_is_text_edit,
|
|
|
|
HTMLBodyElement_is_settable
|
2007-10-04 02:09:48 +02:00
|
|
|
};
|
|
|
|
|
2008-09-01 14:21:21 +02:00
|
|
|
static const tid_t HTMLBodyElement_iface_tids[] = {
|
|
|
|
IHTMLBodyElement_tid,
|
|
|
|
IHTMLBodyElement2_tid,
|
2010-01-28 02:09:02 +01:00
|
|
|
HTMLELEMENT_TIDS,
|
2008-09-01 14:21:21 +02:00
|
|
|
IHTMLTextContainer_tid,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static dispex_static_data_t HTMLBodyElement_dispex = {
|
|
|
|
NULL,
|
|
|
|
DispHTMLBody_tid,
|
2016-07-07 12:50:18 +02:00
|
|
|
HTMLBodyElement_iface_tids,
|
|
|
|
HTMLElement_init_dispex_info
|
2008-09-01 14:21:21 +02:00
|
|
|
};
|
|
|
|
|
2010-12-01 22:43:14 +01:00
|
|
|
HRESULT HTMLBodyElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
|
2006-03-09 00:20:19 +01:00
|
|
|
{
|
2010-12-01 22:43:14 +01:00
|
|
|
HTMLBodyElement *ret;
|
2006-03-09 00:20:19 +01:00
|
|
|
nsresult nsres;
|
|
|
|
|
2010-12-01 22:43:14 +01:00
|
|
|
ret = heap_alloc_zero(sizeof(HTMLBodyElement));
|
|
|
|
if(!ret)
|
|
|
|
return E_OUTOFMEMORY;
|
2007-09-22 05:45:06 +02:00
|
|
|
|
2010-12-06 16:44:18 +01:00
|
|
|
ret->IHTMLBodyElement_iface.lpVtbl = &HTMLBodyElementVtbl;
|
2007-10-04 02:09:48 +02:00
|
|
|
ret->textcont.element.node.vtbl = &HTMLBodyElementImplVtbl;
|
2006-03-09 00:20:19 +01:00
|
|
|
|
2010-12-01 22:43:14 +01:00
|
|
|
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLBodyElement, (void**)&ret->nsbody);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Could not get nsDOMHTMLBodyElement: %08x\n", nsres);
|
|
|
|
heap_free(ret);
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2009-11-01 19:16:48 +01:00
|
|
|
HTMLTextContainer_Init(&ret->textcont, doc, nselem, &HTMLBodyElement_dispex);
|
2009-10-02 13:50:48 +02:00
|
|
|
|
2010-12-01 22:43:14 +01:00
|
|
|
*elem = &ret->textcont.element;
|
|
|
|
return S_OK;
|
2006-03-09 00:20:19 +01:00
|
|
|
}
|