2006-03-08 23:20:19 +00: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 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2006-03-08 23:20:19 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
#include "mshtml_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|
|
|
|
|
|
|
typedef struct {
|
2007-09-15 14:07:52 +00:00
|
|
|
HTMLTextContainer textcont;
|
2007-09-15 14:05:34 +00:00
|
|
|
|
2006-03-08 23:20:19 +00:00
|
|
|
const IHTMLBodyElementVtbl *lpHTMLBodyElementVtbl;
|
|
|
|
|
2007-06-29 00:58:42 +00:00
|
|
|
ConnectionPoint cp_propnotif;
|
2007-06-29 00:50:39 +00:00
|
|
|
|
2006-03-08 23:20:19 +00:00
|
|
|
nsIDOMHTMLBodyElement *nsbody;
|
|
|
|
} HTMLBodyElement;
|
|
|
|
|
2009-02-16 08:53:46 +00:00
|
|
|
#define HTMLBODY(x) (&(x)->lpHTMLBodyElementVtbl)
|
2006-03-08 23:20:19 +00:00
|
|
|
|
2009-08-01 22:09:09 +00: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-26 23:49:31 +00:00
|
|
|
DWORD rgb;
|
2009-08-01 22:09:09 +00:00
|
|
|
} keyword_table[] = {
|
2009-12-26 23:49:31 +00: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-01 22:09:09 +00:00
|
|
|
};
|
|
|
|
|
2009-12-26 23:49:46 +00: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);
|
|
|
|
}
|
|
|
|
|
2009-12-26 23:49:10 +00:00
|
|
|
static HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret)
|
2009-08-01 22:09:09 +00:00
|
|
|
{
|
2009-12-26 23:49:31 +00:00
|
|
|
int i, rgb = -1;
|
|
|
|
|
|
|
|
static const WCHAR formatW[] = {'#','%','0','2','x','%','0','2','x','%','0','2','x',0};
|
2009-08-01 22:09:09 +00:00
|
|
|
|
2009-12-26 23:49:46 +00:00
|
|
|
if(!color || !*color) {
|
|
|
|
*ret = NULL;
|
|
|
|
return S_OK;
|
2009-12-26 23:49:10 +00:00
|
|
|
}
|
2009-08-01 22:09:09 +00:00
|
|
|
|
2009-12-26 23:49:31 +00: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-26 23:49:10 +00:00
|
|
|
}
|
2009-08-01 22:09:09 +00:00
|
|
|
}
|
2009-12-26 23:49:46 +00:00
|
|
|
if(rgb == -1)
|
|
|
|
rgb = loose_hex_to_rgb(color);
|
2009-12-26 23:49:31 +00:00
|
|
|
|
|
|
|
*ret = SysAllocStringLen(NULL, 7);
|
|
|
|
if(!*ret)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
sprintfW(*ret, formatW, rgb>>16, (rgb>>8)&0xff, rgb&0xff);
|
2009-08-01 22:09:09 +00:00
|
|
|
|
2009-12-26 23:49:31 +00:00
|
|
|
TRACE("%s -> %s\n", debugstr_w(color), debugstr_w(*ret));
|
|
|
|
return S_OK;
|
2009-08-01 22:09:09 +00:00
|
|
|
}
|
|
|
|
|
2008-02-24 21:17:32 +00:00
|
|
|
static BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr)
|
|
|
|
{
|
|
|
|
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:
|
|
|
|
FIXME("invalid vt=%d\n", V_VT(v));
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-02-24 21:17:55 +00:00
|
|
|
static void nscolor_to_variant(const nsAString *nsstr, VARIANT *p)
|
|
|
|
{
|
|
|
|
const PRUnichar *color;
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-08 23:20:19 +00:00
|
|
|
#define HTMLBODY_THIS(iface) DEFINE_THIS(HTMLBodyElement, HTMLBodyElement, iface)
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_QueryInterface(IHTMLBodyElement *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
|
|
|
|
2007-10-04 00:10:36 +00:00
|
|
|
return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->textcont.element.node), riid, ppv);
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLBodyElement_AddRef(IHTMLBodyElement *iface)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
|
|
|
|
2007-09-19 10:40:41 +00:00
|
|
|
return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->textcont.element.node));
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLBodyElement_Release(IHTMLBodyElement *iface)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
|
|
|
|
2007-09-19 10:40:41 +00:00
|
|
|
return IHTMLDOMNode_Release(HTMLDOMNODE(&This->textcont.element.node));
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_GetTypeInfoCount(IHTMLBodyElement *iface, UINT *pctinfo)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2008-08-27 12:01:35 +00:00
|
|
|
return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->textcont.element.node.dispex), pctinfo);
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_GetTypeInfo(IHTMLBodyElement *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2008-08-27 12:01:35 +00:00
|
|
|
return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->textcont.element.node.dispex), iTInfo, lcid, ppTInfo);
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_GetIDsOfNames(IHTMLBodyElement *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames,
|
|
|
|
LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2008-08-27 12:01:35 +00:00
|
|
|
return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->textcont.element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_Invoke(IHTMLBodyElement *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2008-08-27 12:01:35 +00:00
|
|
|
return IDispatchEx_Invoke(DISPATCHEX(&This->textcont.element.node.dispex), dispIdMember, riid, lcid,
|
|
|
|
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_background(IHTMLBodyElement *iface, BSTR v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2008-09-23 10:03:58 +00:00
|
|
|
nsAString nsstr;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
2010-01-28 22:55:51 +00:00
|
|
|
nsAString_InitDepend(&nsstr, v);
|
2008-09-23 10:03:58 +00:00
|
|
|
nsres = nsIDOMHTMLBodyElement_SetBackground(This->nsbody, &nsstr);
|
|
|
|
nsAString_Finish(&nsstr);
|
2010-01-28 22:55:51 +00:00
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
return E_FAIL;
|
2008-09-23 10:03:58 +00:00
|
|
|
|
2010-01-28 22:55:51 +00:00
|
|
|
return S_OK;
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_background(IHTMLBodyElement *iface, BSTR *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:22:51 +00:00
|
|
|
nsAString background_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&background_str, NULL);
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLBodyElement_GetBackground(This->nsbody, &background_str);
|
|
|
|
if(NS_SUCCEEDED(nsres)) {
|
|
|
|
const PRUnichar *background;
|
2007-12-17 00:38:30 +00:00
|
|
|
nsAString_GetData(&background_str, &background);
|
2007-12-05 01:04:43 +00:00
|
|
|
*p = *background ? SysAllocString(background) : NULL;
|
2007-04-12 19:22:51 +00:00
|
|
|
}else {
|
|
|
|
ERR("GetBackground failed: %08x\n", nsres);
|
|
|
|
*p = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAString_Finish(&background_str);
|
|
|
|
|
|
|
|
TRACE("*p = %s\n", debugstr_w(*p));
|
|
|
|
return S_OK;
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_bgProperties(IHTMLBodyElement *iface, BSTR v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_bgProperties(IHTMLBodyElement *iface, BSTR *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_leftMargin(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->()\n", This);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_leftMargin(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_topMargin(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->()\n", This);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_topMargin(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_rightMargin(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->()\n", This);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_rightMargin(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_bottomMargin(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->()\n", This);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_bottomMargin(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_noWrap(IHTMLBodyElement *iface, VARIANT_BOOL v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->(%x)\n", This, v);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_noWrap(IHTMLBodyElement *iface, VARIANT_BOOL *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_bgColor(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2008-09-05 10:34:59 +00:00
|
|
|
nsAString strColor;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->()\n", This);
|
|
|
|
|
|
|
|
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-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_bgColor(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2008-09-05 10:34:59 +00:00
|
|
|
nsAString strColor;
|
|
|
|
nsresult nsres;
|
2009-12-26 23:49:10 +00:00
|
|
|
HRESULT hres;
|
2008-09-05 10:34:59 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&strColor, NULL);
|
|
|
|
nsres = nsIDOMHTMLBodyElement_GetBgColor(This->nsbody, &strColor);
|
2009-12-26 23:49:10 +00:00
|
|
|
if(NS_SUCCEEDED(nsres)) {
|
|
|
|
const PRUnichar *color;
|
2008-09-05 10:34:59 +00:00
|
|
|
|
2009-12-26 23:49:10 +00: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 10:34:59 +00:00
|
|
|
|
|
|
|
nsAString_Finish(&strColor);
|
2009-12-26 23:49:10 +00:00
|
|
|
return hres;
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_text(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2008-09-17 10:41:47 +00:00
|
|
|
nsAString text;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(v%d)\n", This, V_VT(&v));
|
|
|
|
|
|
|
|
if(!variant_to_nscolor(&v, &text))
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLBodyElement_SetText(This->nsbody, &text);
|
|
|
|
nsAString_Finish(&text);
|
2010-05-08 16:33:52 +00:00
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("SetText failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
2008-09-17 10:41:47 +00:00
|
|
|
|
|
|
|
return S_OK;
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_text(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2008-09-17 10:41:47 +00:00
|
|
|
nsAString text;
|
|
|
|
nsresult nsres;
|
2009-12-26 23:50:04 +00:00
|
|
|
HRESULT hres;
|
2008-09-17 10:41:47 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&text, NULL);
|
|
|
|
nsres = nsIDOMHTMLBodyElement_GetText(This->nsbody, &text);
|
2009-12-26 23:50:04 +00:00
|
|
|
if(NS_SUCCEEDED(nsres)) {
|
|
|
|
const PRUnichar *color;
|
2008-09-17 10:41:47 +00:00
|
|
|
|
2009-12-26 23:50:04 +00:00
|
|
|
nsAString_GetData(&text, &color);
|
2008-09-17 10:41:47 +00:00
|
|
|
V_VT(p) = VT_BSTR;
|
2009-12-26 23:50:04 +00:00
|
|
|
hres = nscolor_to_str(color, &V_BSTR(p));
|
|
|
|
}else {
|
|
|
|
ERR("GetText failed: %08x\n", nsres);
|
|
|
|
hres = E_FAIL;
|
2008-09-17 10:41:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsAString_Finish(&text);
|
|
|
|
|
2010-05-01 14:19:05 +00:00
|
|
|
return hres;
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_link(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2008-02-24 21:17:32 +00:00
|
|
|
nsAString link_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(v%d)\n", This, V_VT(&v));
|
|
|
|
|
|
|
|
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-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_link(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2008-02-24 21:17:55 +00:00
|
|
|
nsAString link_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&link_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLBodyElement_GetLink(This->nsbody, &link_str);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("GetLink failed: %08x\n", nsres);
|
|
|
|
|
|
|
|
nscolor_to_variant(&link_str, p);
|
|
|
|
nsAString_Finish(&link_str);
|
|
|
|
|
|
|
|
return S_OK;
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_vLink(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2008-02-24 21:18:24 +00:00
|
|
|
nsAString vlink_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(v%d)\n", This, V_VT(&v));
|
|
|
|
|
|
|
|
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-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_vLink(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2008-02-24 21:18:24 +00:00
|
|
|
nsAString vlink_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&vlink_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLBodyElement_GetVLink(This->nsbody, &vlink_str);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("GetLink failed: %08x\n", nsres);
|
|
|
|
|
|
|
|
nscolor_to_variant(&vlink_str, p);
|
|
|
|
nsAString_Finish(&vlink_str);
|
|
|
|
|
|
|
|
return S_OK;
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_aLink(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2008-02-24 21:18:47 +00:00
|
|
|
nsAString alink_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(v%d)\n", This, V_VT(&v));
|
|
|
|
|
|
|
|
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-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_aLink(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2008-02-24 21:18:47 +00:00
|
|
|
nsAString alink_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&alink_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLBodyElement_GetALink(This->nsbody, &alink_str);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("GetALink failed: %08x\n", nsres);
|
|
|
|
|
|
|
|
nscolor_to_variant(&alink_str, p);
|
|
|
|
nsAString_Finish(&alink_str);
|
|
|
|
|
|
|
|
return S_OK;
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_onload(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->()\n", This);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_onload(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_onunload(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->()\n", This);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_onunload(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_scroll(IHTMLBodyElement *iface, BSTR v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_scroll(IHTMLBodyElement *iface, BSTR *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_onselect(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->()\n", This);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_onselect(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_put_onbeforeunload(IHTMLBodyElement *iface, VARIANT v)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->()\n", This);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_get_onbeforeunload(IHTMLBodyElement *iface, VARIANT *p)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2007-04-12 19:21:49 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2006-03-08 23:20:19 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, IHTMLTxtRange **range)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
2008-10-08 18:28:27 +00:00
|
|
|
nsIDOMDocumentRange *nsdocrange;
|
2007-05-09 23:13:13 +00:00
|
|
|
nsIDOMRange *nsrange = NULL;
|
2008-10-08 18:28:27 +00:00
|
|
|
nsresult nsres;
|
2009-09-16 20:11:43 +00:00
|
|
|
HRESULT hres;
|
2007-05-09 23:13:13 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, range);
|
|
|
|
|
2009-10-21 19:27:42 +00:00
|
|
|
if(!This->textcont.element.node.doc->nsdoc) {
|
2008-10-08 18:28:27 +00:00
|
|
|
WARN("No nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
2009-10-21 19:27:42 +00:00
|
|
|
nsres = nsIDOMDocument_QueryInterface(This->textcont.element.node.doc->nsdoc, &IID_nsIDOMDocumentRange,
|
2008-10-08 18:28:27 +00:00
|
|
|
(void**)&nsdocrange);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Could not get nsIDOMDocumentRabge iface: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIDOMDocumentRange_CreateRange(nsdocrange, &nsrange);
|
|
|
|
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-09 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
2008-10-08 18:28:27 +00:00
|
|
|
nsIDOMDocumentRange_Release(nsdocrange);
|
|
|
|
|
2009-09-16 20:13:31 +00:00
|
|
|
hres = HTMLTxtRange_Create(This->textcont.element.node.doc->basedoc.doc_node, nsrange, range);
|
2009-09-16 20:11:43 +00:00
|
|
|
|
|
|
|
nsIDOMRange_Release(nsrange);
|
|
|
|
return hres;
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|
|
|
|
|
2007-10-04 00:08:56 +00:00
|
|
|
#undef HTMLBODY_THIS
|
2006-03-08 23:20:19 +00: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
|
|
|
|
};
|
|
|
|
|
2007-10-04 00:08:56 +00:00
|
|
|
#define HTMLBODY_NODE_THIS(iface) DEFINE_THIS2(HTMLBodyElement, textcont.element.node, iface)
|
|
|
|
|
2007-10-04 00:10:36 +00:00
|
|
|
static HRESULT HTMLBodyElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_NODE_THIS(iface);
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
|
|
|
|
*ppv = HTMLBODY(This);
|
|
|
|
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
|
|
|
|
*ppv = HTMLBODY(This);
|
|
|
|
}else if(IsEqualGUID(&IID_IHTMLBodyElement, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLBodyElement %p)\n", This, ppv);
|
|
|
|
*ppv = HTMLBODY(This);
|
|
|
|
}else if(IsEqualGUID(&IID_IHTMLTextContainer, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLTextContainer %p)\n", &This->textcont, ppv);
|
|
|
|
*ppv = HTMLTEXTCONT(&This->textcont);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(*ppv) {
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return HTMLElement_QI(&This->textcont.element.node, riid, ppv);
|
|
|
|
}
|
|
|
|
|
2007-10-04 00:08:56 +00:00
|
|
|
static void HTMLBodyElement_destructor(HTMLDOMNode *iface)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_NODE_THIS(iface);
|
|
|
|
|
|
|
|
nsIDOMHTMLBodyElement_Release(This->nsbody);
|
2007-10-04 00:09:48 +00:00
|
|
|
|
|
|
|
HTMLElement_destructor(&This->textcont.element.node);
|
2007-10-04 00:08:56 +00:00
|
|
|
}
|
|
|
|
|
2009-09-08 20:29:39 +00:00
|
|
|
static event_target_t **HTMLBodyElement_get_event_target(HTMLDOMNode *iface)
|
|
|
|
{
|
|
|
|
HTMLBodyElement *This = HTMLBODY_NODE_THIS(iface);
|
|
|
|
|
2010-01-03 23:39:31 +00:00
|
|
|
return This->textcont.element.node.doc
|
|
|
|
? &This->textcont.element.node.doc->body_event_target
|
2009-09-08 20:29:39 +00:00
|
|
|
: &This->textcont.element.node.event_target;
|
|
|
|
}
|
|
|
|
|
2007-10-04 00:08:56 +00:00
|
|
|
#undef HTMLBODY_NODE_THIS
|
|
|
|
|
2007-10-04 00:09:48 +00:00
|
|
|
static const NodeImplVtbl HTMLBodyElementImplVtbl = {
|
2007-10-04 00:10:36 +00:00
|
|
|
HTMLBodyElement_QI,
|
2009-09-08 20:29:39 +00:00
|
|
|
HTMLBodyElement_destructor,
|
|
|
|
HTMLBodyElement_get_event_target
|
2007-10-04 00:09:48 +00:00
|
|
|
};
|
|
|
|
|
2008-09-01 12:21:21 +00:00
|
|
|
static const tid_t HTMLBodyElement_iface_tids[] = {
|
|
|
|
IHTMLBodyElement_tid,
|
|
|
|
IHTMLBodyElement2_tid,
|
2010-01-28 01:09:02 +00:00
|
|
|
HTMLELEMENT_TIDS,
|
2008-09-01 12:21:21 +00:00
|
|
|
IHTMLTextContainer_tid,
|
|
|
|
IHTMLUniqueName_tid,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static dispex_static_data_t HTMLBodyElement_dispex = {
|
|
|
|
NULL,
|
|
|
|
DispHTMLBody_tid,
|
|
|
|
NULL,
|
|
|
|
HTMLBodyElement_iface_tids
|
|
|
|
};
|
|
|
|
|
2009-11-01 18:16:48 +00:00
|
|
|
HTMLElement *HTMLBodyElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
|
2006-03-08 23:20:19 +00:00
|
|
|
{
|
2008-04-23 14:44:21 +00:00
|
|
|
HTMLBodyElement *ret = heap_alloc_zero(sizeof(HTMLBodyElement));
|
2006-03-08 23:20:19 +00:00
|
|
|
nsresult nsres;
|
|
|
|
|
2007-09-22 03:45:06 +00:00
|
|
|
TRACE("(%p)->(%p)\n", ret, nselem);
|
|
|
|
|
2006-03-08 23:20:19 +00:00
|
|
|
ret->lpHTMLBodyElementVtbl = &HTMLBodyElementVtbl;
|
2007-10-04 00:09:48 +00:00
|
|
|
ret->textcont.element.node.vtbl = &HTMLBodyElementImplVtbl;
|
2006-03-08 23:20:19 +00:00
|
|
|
|
2009-11-01 18:16:48 +00:00
|
|
|
HTMLTextContainer_Init(&ret->textcont, doc, nselem, &HTMLBodyElement_dispex);
|
2009-10-02 11:50:48 +00:00
|
|
|
|
2009-11-23 18:28:43 +00:00
|
|
|
ConnectionPoint_Init(&ret->cp_propnotif, &ret->textcont.element.cp_container, &IID_IPropertyNotifySink, NULL);
|
2007-06-29 00:50:39 +00:00
|
|
|
|
2007-09-15 14:05:34 +00:00
|
|
|
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLBodyElement,
|
2006-03-08 23:20:19 +00:00
|
|
|
(void**)&ret->nsbody);
|
|
|
|
if(NS_FAILED(nsres))
|
2006-10-05 21:50:39 +00:00
|
|
|
ERR("Could not get nsDOMHTMLBodyElement: %08x\n", nsres);
|
2006-03-08 23:20:19 +00:00
|
|
|
|
2007-09-15 14:07:52 +00:00
|
|
|
return &ret->textcont.element;
|
2006-03-08 23:20:19 +00:00
|
|
|
}
|