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 HRESULT
nscolor_to_str(LPCWSTR color
, BSTR
*ret
)
90 static const WCHAR formatW
[] = {'#','%','0','2','x','%','0','2','x','%','0','2','x',0};
92 if(!color
|| *color
== '#') {
93 *ret
= SysAllocString(color
);
94 return *ret
? S_OK
: E_OUTOFMEMORY
;
98 for(i
=0; i
< sizeof(keyword_table
)/sizeof(keyword_table
[0]); i
++) {
99 if(!strcmpiW(color
, keyword_table
[i
].keyword
))
100 rgb
= keyword_table
[i
].rgb
;
104 WARN("unknown color %s\n", debugstr_w(color
));
105 *ret
= SysAllocString(color
);
106 return *ret
? S_OK
: E_OUTOFMEMORY
;
109 *ret
= SysAllocStringLen(NULL
, 7);
111 return E_OUTOFMEMORY
;
113 sprintfW(*ret
, formatW
, rgb
>>16, (rgb
>>8)&0xff, rgb
&0xff);
115 TRACE("%s -> %s\n", debugstr_w(color
), debugstr_w(*ret
));
119 static BOOL
variant_to_nscolor(const VARIANT
*v
, nsAString
*nsstr
)
123 nsAString_Init(nsstr
, V_BSTR(v
));
128 static const WCHAR formatW
[] = {'#','%','x',0};
130 wsprintfW(buf
, formatW
, V_I4(v
));
131 nsAString_Init(nsstr
, buf
);
136 FIXME("invalid vt=%d\n", V_VT(v
));
143 static void nscolor_to_variant(const nsAString
*nsstr
, VARIANT
*p
)
145 const PRUnichar
*color
;
147 nsAString_GetData(nsstr
, &color
);
151 V_I4(p
) = strtolW(color
+1, NULL
, 16);
154 V_BSTR(p
) = SysAllocString(color
);
158 #define HTMLBODY_THIS(iface) DEFINE_THIS(HTMLBodyElement, HTMLBodyElement, iface)
160 static HRESULT WINAPI
HTMLBodyElement_QueryInterface(IHTMLBodyElement
*iface
,
161 REFIID riid
, void **ppv
)
163 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
165 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This
->textcont
.element
.node
), riid
, ppv
);
168 static ULONG WINAPI
HTMLBodyElement_AddRef(IHTMLBodyElement
*iface
)
170 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
172 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This
->textcont
.element
.node
));
175 static ULONG WINAPI
HTMLBodyElement_Release(IHTMLBodyElement
*iface
)
177 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
179 return IHTMLDOMNode_Release(HTMLDOMNODE(&This
->textcont
.element
.node
));
182 static HRESULT WINAPI
HTMLBodyElement_GetTypeInfoCount(IHTMLBodyElement
*iface
, UINT
*pctinfo
)
184 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
185 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This
->textcont
.element
.node
.dispex
), pctinfo
);
188 static HRESULT WINAPI
HTMLBodyElement_GetTypeInfo(IHTMLBodyElement
*iface
, UINT iTInfo
,
189 LCID lcid
, ITypeInfo
**ppTInfo
)
191 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
192 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This
->textcont
.element
.node
.dispex
), iTInfo
, lcid
, ppTInfo
);
195 static HRESULT WINAPI
HTMLBodyElement_GetIDsOfNames(IHTMLBodyElement
*iface
, REFIID riid
,
196 LPOLESTR
*rgszNames
, UINT cNames
,
197 LCID lcid
, DISPID
*rgDispId
)
199 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
200 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This
->textcont
.element
.node
.dispex
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
203 static HRESULT WINAPI
HTMLBodyElement_Invoke(IHTMLBodyElement
*iface
, DISPID dispIdMember
,
204 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
205 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
207 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
208 return IDispatchEx_Invoke(DISPATCHEX(&This
->textcont
.element
.node
.dispex
), dispIdMember
, riid
, lcid
,
209 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
212 static HRESULT WINAPI
HTMLBodyElement_put_background(IHTMLBodyElement
*iface
, BSTR v
)
214 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
219 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
221 nsAString_Init(&nsstr
, v
);
223 nsres
= nsIDOMHTMLBodyElement_SetBackground(This
->nsbody
, &nsstr
);
224 if(!NS_SUCCEEDED(nsres
))
229 nsAString_Finish(&nsstr
);
234 static HRESULT WINAPI
HTMLBodyElement_get_background(IHTMLBodyElement
*iface
, BSTR
*p
)
236 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
237 nsAString background_str
;
240 TRACE("(%p)->(%p)\n", This
, p
);
242 nsAString_Init(&background_str
, NULL
);
244 nsres
= nsIDOMHTMLBodyElement_GetBackground(This
->nsbody
, &background_str
);
245 if(NS_SUCCEEDED(nsres
)) {
246 const PRUnichar
*background
;
247 nsAString_GetData(&background_str
, &background
);
248 *p
= *background
? SysAllocString(background
) : NULL
;
250 ERR("GetBackground failed: %08x\n", nsres
);
254 nsAString_Finish(&background_str
);
256 TRACE("*p = %s\n", debugstr_w(*p
));
260 static HRESULT WINAPI
HTMLBodyElement_put_bgProperties(IHTMLBodyElement
*iface
, BSTR v
)
262 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
263 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
267 static HRESULT WINAPI
HTMLBodyElement_get_bgProperties(IHTMLBodyElement
*iface
, BSTR
*p
)
269 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
270 FIXME("(%p)->(%p)\n", This
, p
);
274 static HRESULT WINAPI
HTMLBodyElement_put_leftMargin(IHTMLBodyElement
*iface
, VARIANT v
)
276 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
277 FIXME("(%p)->()\n", This
);
281 static HRESULT WINAPI
HTMLBodyElement_get_leftMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
283 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
284 FIXME("(%p)->(%p)\n", This
, p
);
288 static HRESULT WINAPI
HTMLBodyElement_put_topMargin(IHTMLBodyElement
*iface
, VARIANT v
)
290 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
291 FIXME("(%p)->()\n", This
);
295 static HRESULT WINAPI
HTMLBodyElement_get_topMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
297 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
298 FIXME("(%p)->(%p)\n", This
, p
);
302 static HRESULT WINAPI
HTMLBodyElement_put_rightMargin(IHTMLBodyElement
*iface
, VARIANT v
)
304 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
305 FIXME("(%p)->()\n", This
);
309 static HRESULT WINAPI
HTMLBodyElement_get_rightMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
311 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
312 FIXME("(%p)->(%p)\n", This
, p
);
316 static HRESULT WINAPI
HTMLBodyElement_put_bottomMargin(IHTMLBodyElement
*iface
, VARIANT v
)
318 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
319 FIXME("(%p)->()\n", This
);
323 static HRESULT WINAPI
HTMLBodyElement_get_bottomMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
325 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
326 FIXME("(%p)->(%p)\n", This
, p
);
330 static HRESULT WINAPI
HTMLBodyElement_put_noWrap(IHTMLBodyElement
*iface
, VARIANT_BOOL v
)
332 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
333 FIXME("(%p)->(%x)\n", This
, v
);
337 static HRESULT WINAPI
HTMLBodyElement_get_noWrap(IHTMLBodyElement
*iface
, VARIANT_BOOL
*p
)
339 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
340 FIXME("(%p)->(%p)\n", This
, p
);
344 static HRESULT WINAPI
HTMLBodyElement_put_bgColor(IHTMLBodyElement
*iface
, VARIANT v
)
346 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
350 TRACE("(%p)->()\n", This
);
352 if(!variant_to_nscolor(&v
, &strColor
))
355 nsres
= nsIDOMHTMLBodyElement_SetBgColor(This
->nsbody
, &strColor
);
356 nsAString_Finish(&strColor
);
358 ERR("SetBgColor failed: %08x\n", nsres
);
363 static HRESULT WINAPI
HTMLBodyElement_get_bgColor(IHTMLBodyElement
*iface
, VARIANT
*p
)
365 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
370 TRACE("(%p)->(%p)\n", This
, p
);
372 nsAString_Init(&strColor
, NULL
);
373 nsres
= nsIDOMHTMLBodyElement_GetBgColor(This
->nsbody
, &strColor
);
374 if(NS_SUCCEEDED(nsres
)) {
375 const PRUnichar
*color
;
377 nsAString_GetData(&strColor
, &color
);
379 hres
= nscolor_to_str(color
, &V_BSTR(p
));
381 ERR("SetBgColor failed: %08x\n", nsres
);
385 nsAString_Finish(&strColor
);
389 static HRESULT WINAPI
HTMLBodyElement_put_text(IHTMLBodyElement
*iface
, VARIANT v
)
391 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
395 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
397 if(!variant_to_nscolor(&v
, &text
))
400 nsres
= nsIDOMHTMLBodyElement_SetText(This
->nsbody
, &text
);
401 nsAString_Finish(&text
);
406 static HRESULT WINAPI
HTMLBodyElement_get_text(IHTMLBodyElement
*iface
, VARIANT
*p
)
408 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
412 TRACE("(%p)->(%p)\n", This
, p
);
414 nsAString_Init(&text
, NULL
);
419 nsres
= nsIDOMHTMLBodyElement_GetText(This
->nsbody
, &text
);
420 if(NS_SUCCEEDED(nsres
))
422 const PRUnichar
*sText
;
423 nsAString_GetData(&text
, &sText
);
426 V_BSTR(p
) = SysAllocString(sText
);
429 nsAString_Finish(&text
);
434 static HRESULT WINAPI
HTMLBodyElement_put_link(IHTMLBodyElement
*iface
, VARIANT v
)
436 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
440 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
442 if(!variant_to_nscolor(&v
, &link_str
))
445 nsres
= nsIDOMHTMLBodyElement_SetLink(This
->nsbody
, &link_str
);
446 nsAString_Finish(&link_str
);
448 ERR("SetLink failed: %08x\n", nsres
);
453 static HRESULT WINAPI
HTMLBodyElement_get_link(IHTMLBodyElement
*iface
, VARIANT
*p
)
455 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
459 TRACE("(%p)->(%p)\n", This
, p
);
461 nsAString_Init(&link_str
, NULL
);
462 nsres
= nsIDOMHTMLBodyElement_GetLink(This
->nsbody
, &link_str
);
464 ERR("GetLink failed: %08x\n", nsres
);
466 nscolor_to_variant(&link_str
, p
);
467 nsAString_Finish(&link_str
);
472 static HRESULT WINAPI
HTMLBodyElement_put_vLink(IHTMLBodyElement
*iface
, VARIANT v
)
474 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
478 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
480 if(!variant_to_nscolor(&v
, &vlink_str
))
483 nsres
= nsIDOMHTMLBodyElement_SetVLink(This
->nsbody
, &vlink_str
);
484 nsAString_Finish(&vlink_str
);
486 ERR("SetLink failed: %08x\n", nsres
);
491 static HRESULT WINAPI
HTMLBodyElement_get_vLink(IHTMLBodyElement
*iface
, VARIANT
*p
)
493 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
497 TRACE("(%p)->(%p)\n", This
, p
);
499 nsAString_Init(&vlink_str
, NULL
);
500 nsres
= nsIDOMHTMLBodyElement_GetVLink(This
->nsbody
, &vlink_str
);
502 ERR("GetLink failed: %08x\n", nsres
);
504 nscolor_to_variant(&vlink_str
, p
);
505 nsAString_Finish(&vlink_str
);
510 static HRESULT WINAPI
HTMLBodyElement_put_aLink(IHTMLBodyElement
*iface
, VARIANT v
)
512 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
516 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
518 if(!variant_to_nscolor(&v
, &alink_str
))
521 nsres
= nsIDOMHTMLBodyElement_SetALink(This
->nsbody
, &alink_str
);
522 nsAString_Finish(&alink_str
);
524 ERR("SetALink failed: %08x\n", nsres
);
529 static HRESULT WINAPI
HTMLBodyElement_get_aLink(IHTMLBodyElement
*iface
, VARIANT
*p
)
531 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
535 TRACE("(%p)->(%p)\n", This
, p
);
537 nsAString_Init(&alink_str
, NULL
);
538 nsres
= nsIDOMHTMLBodyElement_GetALink(This
->nsbody
, &alink_str
);
540 ERR("GetALink failed: %08x\n", nsres
);
542 nscolor_to_variant(&alink_str
, p
);
543 nsAString_Finish(&alink_str
);
548 static HRESULT WINAPI
HTMLBodyElement_put_onload(IHTMLBodyElement
*iface
, VARIANT v
)
550 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
551 FIXME("(%p)->()\n", This
);
555 static HRESULT WINAPI
HTMLBodyElement_get_onload(IHTMLBodyElement
*iface
, VARIANT
*p
)
557 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
558 FIXME("(%p)->(%p)\n", This
, p
);
562 static HRESULT WINAPI
HTMLBodyElement_put_onunload(IHTMLBodyElement
*iface
, VARIANT v
)
564 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
565 FIXME("(%p)->()\n", This
);
569 static HRESULT WINAPI
HTMLBodyElement_get_onunload(IHTMLBodyElement
*iface
, VARIANT
*p
)
571 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
572 FIXME("(%p)->(%p)\n", This
, p
);
576 static HRESULT WINAPI
HTMLBodyElement_put_scroll(IHTMLBodyElement
*iface
, BSTR v
)
578 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
579 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
583 static HRESULT WINAPI
HTMLBodyElement_get_scroll(IHTMLBodyElement
*iface
, BSTR
*p
)
585 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
586 FIXME("(%p)->(%p)\n", This
, p
);
590 static HRESULT WINAPI
HTMLBodyElement_put_onselect(IHTMLBodyElement
*iface
, VARIANT v
)
592 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
593 FIXME("(%p)->()\n", This
);
597 static HRESULT WINAPI
HTMLBodyElement_get_onselect(IHTMLBodyElement
*iface
, VARIANT
*p
)
599 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
600 FIXME("(%p)->(%p)\n", This
, p
);
604 static HRESULT WINAPI
HTMLBodyElement_put_onbeforeunload(IHTMLBodyElement
*iface
, VARIANT v
)
606 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
607 FIXME("(%p)->()\n", This
);
611 static HRESULT WINAPI
HTMLBodyElement_get_onbeforeunload(IHTMLBodyElement
*iface
, VARIANT
*p
)
613 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
614 FIXME("(%p)->(%p)\n", This
, p
);
618 static HRESULT WINAPI
HTMLBodyElement_createTextRange(IHTMLBodyElement
*iface
, IHTMLTxtRange
**range
)
620 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
621 nsIDOMDocumentRange
*nsdocrange
;
622 nsIDOMRange
*nsrange
= NULL
;
626 TRACE("(%p)->(%p)\n", This
, range
);
628 if(!This
->textcont
.element
.node
.doc
->nsdoc
) {
633 nsres
= nsIDOMDocument_QueryInterface(This
->textcont
.element
.node
.doc
->nsdoc
, &IID_nsIDOMDocumentRange
,
634 (void**)&nsdocrange
);
635 if(NS_FAILED(nsres
)) {
636 ERR("Could not get nsIDOMDocumentRabge iface: %08x\n", nsres
);
640 nsres
= nsIDOMDocumentRange_CreateRange(nsdocrange
, &nsrange
);
641 if(NS_SUCCEEDED(nsres
)) {
642 nsres
= nsIDOMRange_SelectNodeContents(nsrange
, This
->textcont
.element
.node
.nsnode
);
644 ERR("SelectNodeContents failed: %08x\n", nsres
);
646 ERR("CreateRange failed: %08x\n", nsres
);
649 nsIDOMDocumentRange_Release(nsdocrange
);
651 hres
= HTMLTxtRange_Create(This
->textcont
.element
.node
.doc
->basedoc
.doc_node
, nsrange
, range
);
653 nsIDOMRange_Release(nsrange
);
659 static const IHTMLBodyElementVtbl HTMLBodyElementVtbl
= {
660 HTMLBodyElement_QueryInterface
,
661 HTMLBodyElement_AddRef
,
662 HTMLBodyElement_Release
,
663 HTMLBodyElement_GetTypeInfoCount
,
664 HTMLBodyElement_GetTypeInfo
,
665 HTMLBodyElement_GetIDsOfNames
,
666 HTMLBodyElement_Invoke
,
667 HTMLBodyElement_put_background
,
668 HTMLBodyElement_get_background
,
669 HTMLBodyElement_put_bgProperties
,
670 HTMLBodyElement_get_bgProperties
,
671 HTMLBodyElement_put_leftMargin
,
672 HTMLBodyElement_get_leftMargin
,
673 HTMLBodyElement_put_topMargin
,
674 HTMLBodyElement_get_topMargin
,
675 HTMLBodyElement_put_rightMargin
,
676 HTMLBodyElement_get_rightMargin
,
677 HTMLBodyElement_put_bottomMargin
,
678 HTMLBodyElement_get_bottomMargin
,
679 HTMLBodyElement_put_noWrap
,
680 HTMLBodyElement_get_noWrap
,
681 HTMLBodyElement_put_bgColor
,
682 HTMLBodyElement_get_bgColor
,
683 HTMLBodyElement_put_text
,
684 HTMLBodyElement_get_text
,
685 HTMLBodyElement_put_link
,
686 HTMLBodyElement_get_link
,
687 HTMLBodyElement_put_vLink
,
688 HTMLBodyElement_get_vLink
,
689 HTMLBodyElement_put_aLink
,
690 HTMLBodyElement_get_aLink
,
691 HTMLBodyElement_put_onload
,
692 HTMLBodyElement_get_onload
,
693 HTMLBodyElement_put_onunload
,
694 HTMLBodyElement_get_onunload
,
695 HTMLBodyElement_put_scroll
,
696 HTMLBodyElement_get_scroll
,
697 HTMLBodyElement_put_onselect
,
698 HTMLBodyElement_get_onselect
,
699 HTMLBodyElement_put_onbeforeunload
,
700 HTMLBodyElement_get_onbeforeunload
,
701 HTMLBodyElement_createTextRange
704 #define HTMLBODY_NODE_THIS(iface) DEFINE_THIS2(HTMLBodyElement, textcont.element.node, iface)
706 static HRESULT
HTMLBodyElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
708 HTMLBodyElement
*This
= HTMLBODY_NODE_THIS(iface
);
712 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
713 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
714 *ppv
= HTMLBODY(This
);
715 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
716 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
717 *ppv
= HTMLBODY(This
);
718 }else if(IsEqualGUID(&IID_IHTMLBodyElement
, riid
)) {
719 TRACE("(%p)->(IID_IHTMLBodyElement %p)\n", This
, ppv
);
720 *ppv
= HTMLBODY(This
);
721 }else if(IsEqualGUID(&IID_IHTMLTextContainer
, riid
)) {
722 TRACE("(%p)->(IID_IHTMLTextContainer %p)\n", &This
->textcont
, ppv
);
723 *ppv
= HTMLTEXTCONT(&This
->textcont
);
727 IUnknown_AddRef((IUnknown
*)*ppv
);
731 return HTMLElement_QI(&This
->textcont
.element
.node
, riid
, ppv
);
734 static void HTMLBodyElement_destructor(HTMLDOMNode
*iface
)
736 HTMLBodyElement
*This
= HTMLBODY_NODE_THIS(iface
);
738 nsIDOMHTMLBodyElement_Release(This
->nsbody
);
740 HTMLElement_destructor(&This
->textcont
.element
.node
);
743 static event_target_t
**HTMLBodyElement_get_event_target(HTMLDOMNode
*iface
)
745 HTMLBodyElement
*This
= HTMLBODY_NODE_THIS(iface
);
747 return This
->textcont
.element
.node
.doc
&& This
->textcont
.element
.node
.doc
->basedoc
.window
748 ? &This
->textcont
.element
.node
.doc
->basedoc
.window
->event_target
749 : &This
->textcont
.element
.node
.event_target
;
752 #undef HTMLBODY_NODE_THIS
754 static const NodeImplVtbl HTMLBodyElementImplVtbl
= {
756 HTMLBodyElement_destructor
,
757 HTMLBodyElement_get_event_target
760 static const tid_t HTMLBodyElement_iface_tids
[] = {
761 IHTMLBodyElement_tid
,
762 IHTMLBodyElement2_tid
,
769 IHTMLTextContainer_tid
,
774 static dispex_static_data_t HTMLBodyElement_dispex
= {
778 HTMLBodyElement_iface_tids
781 HTMLElement
*HTMLBodyElement_Create(HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
)
783 HTMLBodyElement
*ret
= heap_alloc_zero(sizeof(HTMLBodyElement
));
786 TRACE("(%p)->(%p)\n", ret
, nselem
);
788 ret
->lpHTMLBodyElementVtbl
= &HTMLBodyElementVtbl
;
789 ret
->textcont
.element
.node
.vtbl
= &HTMLBodyElementImplVtbl
;
791 HTMLTextContainer_Init(&ret
->textcont
, doc
, nselem
, &HTMLBodyElement_dispex
);
793 ConnectionPoint_Init(&ret
->cp_propnotif
, &ret
->textcont
.element
.cp_container
, &IID_IPropertyNotifySink
, NULL
);
795 nsres
= nsIDOMHTMLElement_QueryInterface(nselem
, &IID_nsIDOMHTMLBodyElement
,
796 (void**)&ret
->nsbody
);
798 ERR("Could not get nsDOMHTMLBodyElement: %08x\n", nsres
);
800 return &ret
->textcont
.element
;