2 * Copyright 2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
36 HTMLTextContainer textcont
;
38 const IHTMLBodyElementVtbl
*lpHTMLBodyElementVtbl
;
40 ConnectionPoint cp_propnotif
;
42 nsIDOMHTMLBodyElement
*nsbody
;
45 #define HTMLBODY(x) (&(x)->lpHTMLBodyElementVtbl)
47 static const WCHAR aquaW
[] = {'a','q','u','a',0};
48 static const WCHAR blackW
[] = {'b','l','a','c','k',0};
49 static const WCHAR blueW
[] = {'b','l','u','e',0};
50 static const WCHAR fuchsiaW
[] = {'f','u','s','h','s','i','a',0};
51 static const WCHAR grayW
[] = {'g','r','a','y',0};
52 static const WCHAR greenW
[] = {'g','r','e','e','n',0};
53 static const WCHAR limeW
[] = {'l','i','m','e',0};
54 static const WCHAR maroonW
[] = {'m','a','r','o','o','n',0};
55 static const WCHAR navyW
[] = {'n','a','v','y',0};
56 static const WCHAR oliveW
[] = {'o','l','i','v','e',0};
57 static const WCHAR purpleW
[] = {'p','u','r','p','l','e',0};
58 static const WCHAR redW
[] = {'r','e','d',0};
59 static const WCHAR silverW
[] = {'s','i','l','v','e','r',0};
60 static const WCHAR tealW
[] = {'t','e','a','l',0};
61 static const WCHAR whiteW
[] = {'w','h','i','t','e',0};
62 static const WCHAR yellowW
[] = {'y','e','l','l','o','w',0};
86 static int comp_value(const WCHAR
*ptr
, int dpc
)
97 else if(isdigitW(ch
= *ptr
++))
98 ret
= ret
*16 + (ch
-'0');
99 else if('a' <= ch
&& ch
<= 'f')
100 ret
= ret
*16 + (ch
-'a') + 10;
101 else if('A' <= ch
&& ch
<= 'F')
102 ret
= ret
*16 + (ch
-'A') + 10;
110 /* Based on Gecko NS_LooseHexToRGB */
111 static int loose_hex_to_rgb(const WCHAR
*hex
)
123 dpc
= min(len
/3 + (len
%3 ? 1 : 0), 4);
124 return (comp_value(hex
, dpc
) << 16)
125 | (comp_value(hex
+dpc
, dpc
) << 8)
126 | comp_value(hex
+2*dpc
, dpc
);
129 static HRESULT
nscolor_to_str(LPCWSTR color
, BSTR
*ret
)
133 static const WCHAR formatW
[] = {'#','%','0','2','x','%','0','2','x','%','0','2','x',0};
135 if(!color
|| !*color
) {
141 for(i
=0; i
< sizeof(keyword_table
)/sizeof(keyword_table
[0]); i
++) {
142 if(!strcmpiW(color
, keyword_table
[i
].keyword
))
143 rgb
= keyword_table
[i
].rgb
;
147 rgb
= loose_hex_to_rgb(color
);
149 *ret
= SysAllocStringLen(NULL
, 7);
151 return E_OUTOFMEMORY
;
153 sprintfW(*ret
, formatW
, rgb
>>16, (rgb
>>8)&0xff, rgb
&0xff);
155 TRACE("%s -> %s\n", debugstr_w(color
), debugstr_w(*ret
));
159 static BOOL
variant_to_nscolor(const VARIANT
*v
, nsAString
*nsstr
)
163 nsAString_Init(nsstr
, V_BSTR(v
));
168 static const WCHAR formatW
[] = {'#','%','x',0};
170 wsprintfW(buf
, formatW
, V_I4(v
));
171 nsAString_Init(nsstr
, buf
);
176 FIXME("invalid vt=%d\n", V_VT(v
));
183 static void nscolor_to_variant(const nsAString
*nsstr
, VARIANT
*p
)
185 const PRUnichar
*color
;
187 nsAString_GetData(nsstr
, &color
);
191 V_I4(p
) = strtolW(color
+1, NULL
, 16);
194 V_BSTR(p
) = SysAllocString(color
);
198 #define HTMLBODY_THIS(iface) DEFINE_THIS(HTMLBodyElement, HTMLBodyElement, iface)
200 static HRESULT WINAPI
HTMLBodyElement_QueryInterface(IHTMLBodyElement
*iface
,
201 REFIID riid
, void **ppv
)
203 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
205 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This
->textcont
.element
.node
), riid
, ppv
);
208 static ULONG WINAPI
HTMLBodyElement_AddRef(IHTMLBodyElement
*iface
)
210 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
212 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This
->textcont
.element
.node
));
215 static ULONG WINAPI
HTMLBodyElement_Release(IHTMLBodyElement
*iface
)
217 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
219 return IHTMLDOMNode_Release(HTMLDOMNODE(&This
->textcont
.element
.node
));
222 static HRESULT WINAPI
HTMLBodyElement_GetTypeInfoCount(IHTMLBodyElement
*iface
, UINT
*pctinfo
)
224 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
225 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This
->textcont
.element
.node
.dispex
), pctinfo
);
228 static HRESULT WINAPI
HTMLBodyElement_GetTypeInfo(IHTMLBodyElement
*iface
, UINT iTInfo
,
229 LCID lcid
, ITypeInfo
**ppTInfo
)
231 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
232 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This
->textcont
.element
.node
.dispex
), iTInfo
, lcid
, ppTInfo
);
235 static HRESULT WINAPI
HTMLBodyElement_GetIDsOfNames(IHTMLBodyElement
*iface
, REFIID riid
,
236 LPOLESTR
*rgszNames
, UINT cNames
,
237 LCID lcid
, DISPID
*rgDispId
)
239 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
240 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This
->textcont
.element
.node
.dispex
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
243 static HRESULT WINAPI
HTMLBodyElement_Invoke(IHTMLBodyElement
*iface
, DISPID dispIdMember
,
244 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
245 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
247 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
248 return IDispatchEx_Invoke(DISPATCHEX(&This
->textcont
.element
.node
.dispex
), dispIdMember
, riid
, lcid
,
249 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
252 static HRESULT WINAPI
HTMLBodyElement_put_background(IHTMLBodyElement
*iface
, BSTR v
)
254 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
259 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
261 nsAString_Init(&nsstr
, v
);
263 nsres
= nsIDOMHTMLBodyElement_SetBackground(This
->nsbody
, &nsstr
);
264 if(!NS_SUCCEEDED(nsres
))
269 nsAString_Finish(&nsstr
);
274 static HRESULT WINAPI
HTMLBodyElement_get_background(IHTMLBodyElement
*iface
, BSTR
*p
)
276 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
277 nsAString background_str
;
280 TRACE("(%p)->(%p)\n", This
, p
);
282 nsAString_Init(&background_str
, NULL
);
284 nsres
= nsIDOMHTMLBodyElement_GetBackground(This
->nsbody
, &background_str
);
285 if(NS_SUCCEEDED(nsres
)) {
286 const PRUnichar
*background
;
287 nsAString_GetData(&background_str
, &background
);
288 *p
= *background
? SysAllocString(background
) : NULL
;
290 ERR("GetBackground failed: %08x\n", nsres
);
294 nsAString_Finish(&background_str
);
296 TRACE("*p = %s\n", debugstr_w(*p
));
300 static HRESULT WINAPI
HTMLBodyElement_put_bgProperties(IHTMLBodyElement
*iface
, BSTR v
)
302 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
303 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
307 static HRESULT WINAPI
HTMLBodyElement_get_bgProperties(IHTMLBodyElement
*iface
, BSTR
*p
)
309 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
310 FIXME("(%p)->(%p)\n", This
, p
);
314 static HRESULT WINAPI
HTMLBodyElement_put_leftMargin(IHTMLBodyElement
*iface
, VARIANT v
)
316 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
317 FIXME("(%p)->()\n", This
);
321 static HRESULT WINAPI
HTMLBodyElement_get_leftMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
323 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
324 FIXME("(%p)->(%p)\n", This
, p
);
328 static HRESULT WINAPI
HTMLBodyElement_put_topMargin(IHTMLBodyElement
*iface
, VARIANT v
)
330 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
331 FIXME("(%p)->()\n", This
);
335 static HRESULT WINAPI
HTMLBodyElement_get_topMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
337 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
338 FIXME("(%p)->(%p)\n", This
, p
);
342 static HRESULT WINAPI
HTMLBodyElement_put_rightMargin(IHTMLBodyElement
*iface
, VARIANT v
)
344 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
345 FIXME("(%p)->()\n", This
);
349 static HRESULT WINAPI
HTMLBodyElement_get_rightMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
351 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
352 FIXME("(%p)->(%p)\n", This
, p
);
356 static HRESULT WINAPI
HTMLBodyElement_put_bottomMargin(IHTMLBodyElement
*iface
, VARIANT v
)
358 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
359 FIXME("(%p)->()\n", This
);
363 static HRESULT WINAPI
HTMLBodyElement_get_bottomMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
365 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
366 FIXME("(%p)->(%p)\n", This
, p
);
370 static HRESULT WINAPI
HTMLBodyElement_put_noWrap(IHTMLBodyElement
*iface
, VARIANT_BOOL v
)
372 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
373 FIXME("(%p)->(%x)\n", This
, v
);
377 static HRESULT WINAPI
HTMLBodyElement_get_noWrap(IHTMLBodyElement
*iface
, VARIANT_BOOL
*p
)
379 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
380 FIXME("(%p)->(%p)\n", This
, p
);
384 static HRESULT WINAPI
HTMLBodyElement_put_bgColor(IHTMLBodyElement
*iface
, VARIANT v
)
386 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
390 TRACE("(%p)->()\n", This
);
392 if(!variant_to_nscolor(&v
, &strColor
))
395 nsres
= nsIDOMHTMLBodyElement_SetBgColor(This
->nsbody
, &strColor
);
396 nsAString_Finish(&strColor
);
398 ERR("SetBgColor failed: %08x\n", nsres
);
403 static HRESULT WINAPI
HTMLBodyElement_get_bgColor(IHTMLBodyElement
*iface
, VARIANT
*p
)
405 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
410 TRACE("(%p)->(%p)\n", This
, p
);
412 nsAString_Init(&strColor
, NULL
);
413 nsres
= nsIDOMHTMLBodyElement_GetBgColor(This
->nsbody
, &strColor
);
414 if(NS_SUCCEEDED(nsres
)) {
415 const PRUnichar
*color
;
417 nsAString_GetData(&strColor
, &color
);
419 hres
= nscolor_to_str(color
, &V_BSTR(p
));
421 ERR("SetBgColor failed: %08x\n", nsres
);
425 nsAString_Finish(&strColor
);
429 static HRESULT WINAPI
HTMLBodyElement_put_text(IHTMLBodyElement
*iface
, VARIANT v
)
431 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
435 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
437 if(!variant_to_nscolor(&v
, &text
))
440 nsres
= nsIDOMHTMLBodyElement_SetText(This
->nsbody
, &text
);
441 nsAString_Finish(&text
);
446 static HRESULT WINAPI
HTMLBodyElement_get_text(IHTMLBodyElement
*iface
, VARIANT
*p
)
448 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
453 TRACE("(%p)->(%p)\n", This
, p
);
455 nsAString_Init(&text
, NULL
);
456 nsres
= nsIDOMHTMLBodyElement_GetText(This
->nsbody
, &text
);
457 if(NS_SUCCEEDED(nsres
)) {
458 const PRUnichar
*color
;
460 nsAString_GetData(&text
, &color
);
462 hres
= nscolor_to_str(color
, &V_BSTR(p
));
464 ERR("GetText failed: %08x\n", nsres
);
468 nsAString_Finish(&text
);
473 static HRESULT WINAPI
HTMLBodyElement_put_link(IHTMLBodyElement
*iface
, VARIANT v
)
475 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
479 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
481 if(!variant_to_nscolor(&v
, &link_str
))
484 nsres
= nsIDOMHTMLBodyElement_SetLink(This
->nsbody
, &link_str
);
485 nsAString_Finish(&link_str
);
487 ERR("SetLink failed: %08x\n", nsres
);
492 static HRESULT WINAPI
HTMLBodyElement_get_link(IHTMLBodyElement
*iface
, VARIANT
*p
)
494 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
498 TRACE("(%p)->(%p)\n", This
, p
);
500 nsAString_Init(&link_str
, NULL
);
501 nsres
= nsIDOMHTMLBodyElement_GetLink(This
->nsbody
, &link_str
);
503 ERR("GetLink failed: %08x\n", nsres
);
505 nscolor_to_variant(&link_str
, p
);
506 nsAString_Finish(&link_str
);
511 static HRESULT WINAPI
HTMLBodyElement_put_vLink(IHTMLBodyElement
*iface
, VARIANT v
)
513 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
517 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
519 if(!variant_to_nscolor(&v
, &vlink_str
))
522 nsres
= nsIDOMHTMLBodyElement_SetVLink(This
->nsbody
, &vlink_str
);
523 nsAString_Finish(&vlink_str
);
525 ERR("SetLink failed: %08x\n", nsres
);
530 static HRESULT WINAPI
HTMLBodyElement_get_vLink(IHTMLBodyElement
*iface
, VARIANT
*p
)
532 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
536 TRACE("(%p)->(%p)\n", This
, p
);
538 nsAString_Init(&vlink_str
, NULL
);
539 nsres
= nsIDOMHTMLBodyElement_GetVLink(This
->nsbody
, &vlink_str
);
541 ERR("GetLink failed: %08x\n", nsres
);
543 nscolor_to_variant(&vlink_str
, p
);
544 nsAString_Finish(&vlink_str
);
549 static HRESULT WINAPI
HTMLBodyElement_put_aLink(IHTMLBodyElement
*iface
, VARIANT v
)
551 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
555 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
557 if(!variant_to_nscolor(&v
, &alink_str
))
560 nsres
= nsIDOMHTMLBodyElement_SetALink(This
->nsbody
, &alink_str
);
561 nsAString_Finish(&alink_str
);
563 ERR("SetALink failed: %08x\n", nsres
);
568 static HRESULT WINAPI
HTMLBodyElement_get_aLink(IHTMLBodyElement
*iface
, VARIANT
*p
)
570 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
574 TRACE("(%p)->(%p)\n", This
, p
);
576 nsAString_Init(&alink_str
, NULL
);
577 nsres
= nsIDOMHTMLBodyElement_GetALink(This
->nsbody
, &alink_str
);
579 ERR("GetALink failed: %08x\n", nsres
);
581 nscolor_to_variant(&alink_str
, p
);
582 nsAString_Finish(&alink_str
);
587 static HRESULT WINAPI
HTMLBodyElement_put_onload(IHTMLBodyElement
*iface
, VARIANT v
)
589 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
590 FIXME("(%p)->()\n", This
);
594 static HRESULT WINAPI
HTMLBodyElement_get_onload(IHTMLBodyElement
*iface
, VARIANT
*p
)
596 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
597 FIXME("(%p)->(%p)\n", This
, p
);
601 static HRESULT WINAPI
HTMLBodyElement_put_onunload(IHTMLBodyElement
*iface
, VARIANT v
)
603 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
604 FIXME("(%p)->()\n", This
);
608 static HRESULT WINAPI
HTMLBodyElement_get_onunload(IHTMLBodyElement
*iface
, VARIANT
*p
)
610 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
611 FIXME("(%p)->(%p)\n", This
, p
);
615 static HRESULT WINAPI
HTMLBodyElement_put_scroll(IHTMLBodyElement
*iface
, BSTR v
)
617 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
618 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
622 static HRESULT WINAPI
HTMLBodyElement_get_scroll(IHTMLBodyElement
*iface
, BSTR
*p
)
624 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
625 FIXME("(%p)->(%p)\n", This
, p
);
629 static HRESULT WINAPI
HTMLBodyElement_put_onselect(IHTMLBodyElement
*iface
, VARIANT v
)
631 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
632 FIXME("(%p)->()\n", This
);
636 static HRESULT WINAPI
HTMLBodyElement_get_onselect(IHTMLBodyElement
*iface
, VARIANT
*p
)
638 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
639 FIXME("(%p)->(%p)\n", This
, p
);
643 static HRESULT WINAPI
HTMLBodyElement_put_onbeforeunload(IHTMLBodyElement
*iface
, VARIANT v
)
645 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
646 FIXME("(%p)->()\n", This
);
650 static HRESULT WINAPI
HTMLBodyElement_get_onbeforeunload(IHTMLBodyElement
*iface
, VARIANT
*p
)
652 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
653 FIXME("(%p)->(%p)\n", This
, p
);
657 static HRESULT WINAPI
HTMLBodyElement_createTextRange(IHTMLBodyElement
*iface
, IHTMLTxtRange
**range
)
659 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
660 nsIDOMDocumentRange
*nsdocrange
;
661 nsIDOMRange
*nsrange
= NULL
;
665 TRACE("(%p)->(%p)\n", This
, range
);
667 if(!This
->textcont
.element
.node
.doc
->nsdoc
) {
672 nsres
= nsIDOMDocument_QueryInterface(This
->textcont
.element
.node
.doc
->nsdoc
, &IID_nsIDOMDocumentRange
,
673 (void**)&nsdocrange
);
674 if(NS_FAILED(nsres
)) {
675 ERR("Could not get nsIDOMDocumentRabge iface: %08x\n", nsres
);
679 nsres
= nsIDOMDocumentRange_CreateRange(nsdocrange
, &nsrange
);
680 if(NS_SUCCEEDED(nsres
)) {
681 nsres
= nsIDOMRange_SelectNodeContents(nsrange
, This
->textcont
.element
.node
.nsnode
);
683 ERR("SelectNodeContents failed: %08x\n", nsres
);
685 ERR("CreateRange failed: %08x\n", nsres
);
688 nsIDOMDocumentRange_Release(nsdocrange
);
690 hres
= HTMLTxtRange_Create(This
->textcont
.element
.node
.doc
->basedoc
.doc_node
, nsrange
, range
);
692 nsIDOMRange_Release(nsrange
);
698 static const IHTMLBodyElementVtbl HTMLBodyElementVtbl
= {
699 HTMLBodyElement_QueryInterface
,
700 HTMLBodyElement_AddRef
,
701 HTMLBodyElement_Release
,
702 HTMLBodyElement_GetTypeInfoCount
,
703 HTMLBodyElement_GetTypeInfo
,
704 HTMLBodyElement_GetIDsOfNames
,
705 HTMLBodyElement_Invoke
,
706 HTMLBodyElement_put_background
,
707 HTMLBodyElement_get_background
,
708 HTMLBodyElement_put_bgProperties
,
709 HTMLBodyElement_get_bgProperties
,
710 HTMLBodyElement_put_leftMargin
,
711 HTMLBodyElement_get_leftMargin
,
712 HTMLBodyElement_put_topMargin
,
713 HTMLBodyElement_get_topMargin
,
714 HTMLBodyElement_put_rightMargin
,
715 HTMLBodyElement_get_rightMargin
,
716 HTMLBodyElement_put_bottomMargin
,
717 HTMLBodyElement_get_bottomMargin
,
718 HTMLBodyElement_put_noWrap
,
719 HTMLBodyElement_get_noWrap
,
720 HTMLBodyElement_put_bgColor
,
721 HTMLBodyElement_get_bgColor
,
722 HTMLBodyElement_put_text
,
723 HTMLBodyElement_get_text
,
724 HTMLBodyElement_put_link
,
725 HTMLBodyElement_get_link
,
726 HTMLBodyElement_put_vLink
,
727 HTMLBodyElement_get_vLink
,
728 HTMLBodyElement_put_aLink
,
729 HTMLBodyElement_get_aLink
,
730 HTMLBodyElement_put_onload
,
731 HTMLBodyElement_get_onload
,
732 HTMLBodyElement_put_onunload
,
733 HTMLBodyElement_get_onunload
,
734 HTMLBodyElement_put_scroll
,
735 HTMLBodyElement_get_scroll
,
736 HTMLBodyElement_put_onselect
,
737 HTMLBodyElement_get_onselect
,
738 HTMLBodyElement_put_onbeforeunload
,
739 HTMLBodyElement_get_onbeforeunload
,
740 HTMLBodyElement_createTextRange
743 #define HTMLBODY_NODE_THIS(iface) DEFINE_THIS2(HTMLBodyElement, textcont.element.node, iface)
745 static HRESULT
HTMLBodyElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
747 HTMLBodyElement
*This
= HTMLBODY_NODE_THIS(iface
);
751 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
752 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
753 *ppv
= HTMLBODY(This
);
754 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
755 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
756 *ppv
= HTMLBODY(This
);
757 }else if(IsEqualGUID(&IID_IHTMLBodyElement
, riid
)) {
758 TRACE("(%p)->(IID_IHTMLBodyElement %p)\n", This
, ppv
);
759 *ppv
= HTMLBODY(This
);
760 }else if(IsEqualGUID(&IID_IHTMLTextContainer
, riid
)) {
761 TRACE("(%p)->(IID_IHTMLTextContainer %p)\n", &This
->textcont
, ppv
);
762 *ppv
= HTMLTEXTCONT(&This
->textcont
);
766 IUnknown_AddRef((IUnknown
*)*ppv
);
770 return HTMLElement_QI(&This
->textcont
.element
.node
, riid
, ppv
);
773 static void HTMLBodyElement_destructor(HTMLDOMNode
*iface
)
775 HTMLBodyElement
*This
= HTMLBODY_NODE_THIS(iface
);
777 nsIDOMHTMLBodyElement_Release(This
->nsbody
);
779 HTMLElement_destructor(&This
->textcont
.element
.node
);
782 static event_target_t
**HTMLBodyElement_get_event_target(HTMLDOMNode
*iface
)
784 HTMLBodyElement
*This
= HTMLBODY_NODE_THIS(iface
);
786 return This
->textcont
.element
.node
.doc
787 ? &This
->textcont
.element
.node
.doc
->body_event_target
788 : &This
->textcont
.element
.node
.event_target
;
791 #undef HTMLBODY_NODE_THIS
793 static const NodeImplVtbl HTMLBodyElementImplVtbl
= {
795 HTMLBodyElement_destructor
,
796 HTMLBodyElement_get_event_target
799 static const tid_t HTMLBodyElement_iface_tids
[] = {
800 IHTMLBodyElement_tid
,
801 IHTMLBodyElement2_tid
,
808 IHTMLTextContainer_tid
,
813 static dispex_static_data_t HTMLBodyElement_dispex
= {
817 HTMLBodyElement_iface_tids
820 HTMLElement
*HTMLBodyElement_Create(HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
)
822 HTMLBodyElement
*ret
= heap_alloc_zero(sizeof(HTMLBodyElement
));
825 TRACE("(%p)->(%p)\n", ret
, nselem
);
827 ret
->lpHTMLBodyElementVtbl
= &HTMLBodyElementVtbl
;
828 ret
->textcont
.element
.node
.vtbl
= &HTMLBodyElementImplVtbl
;
830 HTMLTextContainer_Init(&ret
->textcont
, doc
, nselem
, &HTMLBodyElement_dispex
);
832 ConnectionPoint_Init(&ret
->cp_propnotif
, &ret
->textcont
.element
.cp_container
, &IID_IPropertyNotifySink
, NULL
);
834 nsres
= nsIDOMHTMLElement_QueryInterface(nselem
, &IID_nsIDOMHTMLBodyElement
,
835 (void**)&ret
->nsbody
);
837 ERR("Could not get nsDOMHTMLBodyElement: %08x\n", nsres
);
839 return &ret
->textcont
.element
;