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};
66 const WCHAR hexstr
[8];
68 {aquaW
, {'#','0','0','f','f','f','f',0}},
69 {blackW
, {'#','0','0','0','0','0','0',0}},
70 {blueW
, {'#','0','0','0','0','f','f',0}},
71 {fuchsiaW
, {'#','f','f','0','0','f','f',0}},
72 {grayW
, {'#','8','0','8','0','8','0',0}},
73 {greenW
, {'#','0','0','8','0','0','0',0}},
74 {limeW
, {'#','0','0','f','f','0','0',0}},
75 {maroonW
, {'#','8','0','0','0','0','0',0}},
76 {navyW
, {'#','0','0','0','0','8','0',0}},
77 {oliveW
, {'#','8','0','8','0','0','0',0}},
78 {purpleW
, {'#','8','0','0','0','8','0',0}},
79 {redW
, {'#','f','f','0','0','0','0',0}},
80 {silverW
, {'#','c','0','c','0','c','0',0}},
81 {tealW
, {'#','0','0','8','0','8','0',0}},
82 {whiteW
, {'#','f','f','f','f','f','f',0}},
83 {yellowW
, {'#','f','f','f','f','0','0',0}}
86 static BSTR
nscolor_to_str(LPCWSTR color
)
90 if(!color
|| *color
== '#')
91 return SysAllocString(color
);
93 for(i
=0; i
< sizeof(keyword_table
)/sizeof(keyword_table
[0]); i
++) {
94 if(!strcmpiW(color
, keyword_table
[i
].keyword
))
95 return SysAllocString(keyword_table
[i
].hexstr
);
98 WARN("unknown color %s\n", debugstr_w(color
));
99 return SysAllocString(color
);
102 static BOOL
variant_to_nscolor(const VARIANT
*v
, nsAString
*nsstr
)
106 nsAString_Init(nsstr
, V_BSTR(v
));
111 static const WCHAR formatW
[] = {'#','%','x',0};
113 wsprintfW(buf
, formatW
, V_I4(v
));
114 nsAString_Init(nsstr
, buf
);
119 FIXME("invalid vt=%d\n", V_VT(v
));
126 static void nscolor_to_variant(const nsAString
*nsstr
, VARIANT
*p
)
128 const PRUnichar
*color
;
130 nsAString_GetData(nsstr
, &color
);
134 V_I4(p
) = strtolW(color
+1, NULL
, 16);
137 V_BSTR(p
) = SysAllocString(color
);
141 #define HTMLBODY_THIS(iface) DEFINE_THIS(HTMLBodyElement, HTMLBodyElement, iface)
143 static HRESULT WINAPI
HTMLBodyElement_QueryInterface(IHTMLBodyElement
*iface
,
144 REFIID riid
, void **ppv
)
146 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
148 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This
->textcont
.element
.node
), riid
, ppv
);
151 static ULONG WINAPI
HTMLBodyElement_AddRef(IHTMLBodyElement
*iface
)
153 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
155 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This
->textcont
.element
.node
));
158 static ULONG WINAPI
HTMLBodyElement_Release(IHTMLBodyElement
*iface
)
160 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
162 return IHTMLDOMNode_Release(HTMLDOMNODE(&This
->textcont
.element
.node
));
165 static HRESULT WINAPI
HTMLBodyElement_GetTypeInfoCount(IHTMLBodyElement
*iface
, UINT
*pctinfo
)
167 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
168 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This
->textcont
.element
.node
.dispex
), pctinfo
);
171 static HRESULT WINAPI
HTMLBodyElement_GetTypeInfo(IHTMLBodyElement
*iface
, UINT iTInfo
,
172 LCID lcid
, ITypeInfo
**ppTInfo
)
174 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
175 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This
->textcont
.element
.node
.dispex
), iTInfo
, lcid
, ppTInfo
);
178 static HRESULT WINAPI
HTMLBodyElement_GetIDsOfNames(IHTMLBodyElement
*iface
, REFIID riid
,
179 LPOLESTR
*rgszNames
, UINT cNames
,
180 LCID lcid
, DISPID
*rgDispId
)
182 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
183 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This
->textcont
.element
.node
.dispex
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
186 static HRESULT WINAPI
HTMLBodyElement_Invoke(IHTMLBodyElement
*iface
, DISPID dispIdMember
,
187 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
188 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
190 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
191 return IDispatchEx_Invoke(DISPATCHEX(&This
->textcont
.element
.node
.dispex
), dispIdMember
, riid
, lcid
,
192 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
195 static HRESULT WINAPI
HTMLBodyElement_put_background(IHTMLBodyElement
*iface
, BSTR v
)
197 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
202 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
204 nsAString_Init(&nsstr
, v
);
206 nsres
= nsIDOMHTMLBodyElement_SetBackground(This
->nsbody
, &nsstr
);
207 if(!NS_SUCCEEDED(nsres
))
212 nsAString_Finish(&nsstr
);
217 static HRESULT WINAPI
HTMLBodyElement_get_background(IHTMLBodyElement
*iface
, BSTR
*p
)
219 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
220 nsAString background_str
;
223 TRACE("(%p)->(%p)\n", This
, p
);
225 nsAString_Init(&background_str
, NULL
);
227 nsres
= nsIDOMHTMLBodyElement_GetBackground(This
->nsbody
, &background_str
);
228 if(NS_SUCCEEDED(nsres
)) {
229 const PRUnichar
*background
;
230 nsAString_GetData(&background_str
, &background
);
231 *p
= *background
? SysAllocString(background
) : NULL
;
233 ERR("GetBackground failed: %08x\n", nsres
);
237 nsAString_Finish(&background_str
);
239 TRACE("*p = %s\n", debugstr_w(*p
));
243 static HRESULT WINAPI
HTMLBodyElement_put_bgProperties(IHTMLBodyElement
*iface
, BSTR v
)
245 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
246 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
250 static HRESULT WINAPI
HTMLBodyElement_get_bgProperties(IHTMLBodyElement
*iface
, BSTR
*p
)
252 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
253 FIXME("(%p)->(%p)\n", This
, p
);
257 static HRESULT WINAPI
HTMLBodyElement_put_leftMargin(IHTMLBodyElement
*iface
, VARIANT v
)
259 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
260 FIXME("(%p)->()\n", This
);
264 static HRESULT WINAPI
HTMLBodyElement_get_leftMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
266 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
267 FIXME("(%p)->(%p)\n", This
, p
);
271 static HRESULT WINAPI
HTMLBodyElement_put_topMargin(IHTMLBodyElement
*iface
, VARIANT v
)
273 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
274 FIXME("(%p)->()\n", This
);
278 static HRESULT WINAPI
HTMLBodyElement_get_topMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
280 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
281 FIXME("(%p)->(%p)\n", This
, p
);
285 static HRESULT WINAPI
HTMLBodyElement_put_rightMargin(IHTMLBodyElement
*iface
, VARIANT v
)
287 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
288 FIXME("(%p)->()\n", This
);
292 static HRESULT WINAPI
HTMLBodyElement_get_rightMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
294 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
295 FIXME("(%p)->(%p)\n", This
, p
);
299 static HRESULT WINAPI
HTMLBodyElement_put_bottomMargin(IHTMLBodyElement
*iface
, VARIANT v
)
301 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
302 FIXME("(%p)->()\n", This
);
306 static HRESULT WINAPI
HTMLBodyElement_get_bottomMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
308 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
309 FIXME("(%p)->(%p)\n", This
, p
);
313 static HRESULT WINAPI
HTMLBodyElement_put_noWrap(IHTMLBodyElement
*iface
, VARIANT_BOOL v
)
315 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
316 FIXME("(%p)->(%x)\n", This
, v
);
320 static HRESULT WINAPI
HTMLBodyElement_get_noWrap(IHTMLBodyElement
*iface
, VARIANT_BOOL
*p
)
322 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
323 FIXME("(%p)->(%p)\n", This
, p
);
327 static HRESULT WINAPI
HTMLBodyElement_put_bgColor(IHTMLBodyElement
*iface
, VARIANT v
)
329 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
333 TRACE("(%p)->()\n", This
);
335 if(!variant_to_nscolor(&v
, &strColor
))
338 nsres
= nsIDOMHTMLBodyElement_SetBgColor(This
->nsbody
, &strColor
);
339 nsAString_Finish(&strColor
);
341 ERR("SetBgColor failed: %08x\n", nsres
);
346 static HRESULT WINAPI
HTMLBodyElement_get_bgColor(IHTMLBodyElement
*iface
, VARIANT
*p
)
348 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
351 const PRUnichar
*color
;
353 TRACE("(%p)->(%p)\n", This
, p
);
355 nsAString_Init(&strColor
, NULL
);
356 nsres
= nsIDOMHTMLBodyElement_GetBgColor(This
->nsbody
, &strColor
);
358 ERR("SetBgColor failed: %08x\n", nsres
);
360 nsAString_GetData(&strColor
, &color
);
363 V_BSTR(p
) = nscolor_to_str(color
);
365 nsAString_Finish(&strColor
);
370 static HRESULT WINAPI
HTMLBodyElement_put_text(IHTMLBodyElement
*iface
, VARIANT v
)
372 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
376 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
378 if(!variant_to_nscolor(&v
, &text
))
381 nsres
= nsIDOMHTMLBodyElement_SetText(This
->nsbody
, &text
);
382 nsAString_Finish(&text
);
387 static HRESULT WINAPI
HTMLBodyElement_get_text(IHTMLBodyElement
*iface
, VARIANT
*p
)
389 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
393 TRACE("(%p)->(%p)\n", This
, p
);
395 nsAString_Init(&text
, NULL
);
400 nsres
= nsIDOMHTMLBodyElement_GetText(This
->nsbody
, &text
);
401 if(NS_SUCCEEDED(nsres
))
403 const PRUnichar
*sText
;
404 nsAString_GetData(&text
, &sText
);
407 V_BSTR(p
) = SysAllocString(sText
);
410 nsAString_Finish(&text
);
415 static HRESULT WINAPI
HTMLBodyElement_put_link(IHTMLBodyElement
*iface
, VARIANT v
)
417 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
421 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
423 if(!variant_to_nscolor(&v
, &link_str
))
426 nsres
= nsIDOMHTMLBodyElement_SetLink(This
->nsbody
, &link_str
);
427 nsAString_Finish(&link_str
);
429 ERR("SetLink failed: %08x\n", nsres
);
434 static HRESULT WINAPI
HTMLBodyElement_get_link(IHTMLBodyElement
*iface
, VARIANT
*p
)
436 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
440 TRACE("(%p)->(%p)\n", This
, p
);
442 nsAString_Init(&link_str
, NULL
);
443 nsres
= nsIDOMHTMLBodyElement_GetLink(This
->nsbody
, &link_str
);
445 ERR("GetLink failed: %08x\n", nsres
);
447 nscolor_to_variant(&link_str
, p
);
448 nsAString_Finish(&link_str
);
453 static HRESULT WINAPI
HTMLBodyElement_put_vLink(IHTMLBodyElement
*iface
, VARIANT v
)
455 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
459 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
461 if(!variant_to_nscolor(&v
, &vlink_str
))
464 nsres
= nsIDOMHTMLBodyElement_SetVLink(This
->nsbody
, &vlink_str
);
465 nsAString_Finish(&vlink_str
);
467 ERR("SetLink failed: %08x\n", nsres
);
472 static HRESULT WINAPI
HTMLBodyElement_get_vLink(IHTMLBodyElement
*iface
, VARIANT
*p
)
474 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
478 TRACE("(%p)->(%p)\n", This
, p
);
480 nsAString_Init(&vlink_str
, NULL
);
481 nsres
= nsIDOMHTMLBodyElement_GetVLink(This
->nsbody
, &vlink_str
);
483 ERR("GetLink failed: %08x\n", nsres
);
485 nscolor_to_variant(&vlink_str
, p
);
486 nsAString_Finish(&vlink_str
);
491 static HRESULT WINAPI
HTMLBodyElement_put_aLink(IHTMLBodyElement
*iface
, VARIANT v
)
493 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
497 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
499 if(!variant_to_nscolor(&v
, &alink_str
))
502 nsres
= nsIDOMHTMLBodyElement_SetALink(This
->nsbody
, &alink_str
);
503 nsAString_Finish(&alink_str
);
505 ERR("SetALink failed: %08x\n", nsres
);
510 static HRESULT WINAPI
HTMLBodyElement_get_aLink(IHTMLBodyElement
*iface
, VARIANT
*p
)
512 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
516 TRACE("(%p)->(%p)\n", This
, p
);
518 nsAString_Init(&alink_str
, NULL
);
519 nsres
= nsIDOMHTMLBodyElement_GetALink(This
->nsbody
, &alink_str
);
521 ERR("GetALink failed: %08x\n", nsres
);
523 nscolor_to_variant(&alink_str
, p
);
524 nsAString_Finish(&alink_str
);
529 static HRESULT WINAPI
HTMLBodyElement_put_onload(IHTMLBodyElement
*iface
, VARIANT v
)
531 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
532 FIXME("(%p)->()\n", This
);
536 static HRESULT WINAPI
HTMLBodyElement_get_onload(IHTMLBodyElement
*iface
, VARIANT
*p
)
538 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
539 FIXME("(%p)->(%p)\n", This
, p
);
543 static HRESULT WINAPI
HTMLBodyElement_put_onunload(IHTMLBodyElement
*iface
, VARIANT v
)
545 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
546 FIXME("(%p)->()\n", This
);
550 static HRESULT WINAPI
HTMLBodyElement_get_onunload(IHTMLBodyElement
*iface
, VARIANT
*p
)
552 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
553 FIXME("(%p)->(%p)\n", This
, p
);
557 static HRESULT WINAPI
HTMLBodyElement_put_scroll(IHTMLBodyElement
*iface
, BSTR v
)
559 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
560 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
564 static HRESULT WINAPI
HTMLBodyElement_get_scroll(IHTMLBodyElement
*iface
, BSTR
*p
)
566 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
567 FIXME("(%p)->(%p)\n", This
, p
);
571 static HRESULT WINAPI
HTMLBodyElement_put_onselect(IHTMLBodyElement
*iface
, VARIANT v
)
573 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
574 FIXME("(%p)->()\n", This
);
578 static HRESULT WINAPI
HTMLBodyElement_get_onselect(IHTMLBodyElement
*iface
, VARIANT
*p
)
580 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
581 FIXME("(%p)->(%p)\n", This
, p
);
585 static HRESULT WINAPI
HTMLBodyElement_put_onbeforeunload(IHTMLBodyElement
*iface
, VARIANT v
)
587 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
588 FIXME("(%p)->()\n", This
);
592 static HRESULT WINAPI
HTMLBodyElement_get_onbeforeunload(IHTMLBodyElement
*iface
, VARIANT
*p
)
594 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
595 FIXME("(%p)->(%p)\n", This
, p
);
599 static HRESULT WINAPI
HTMLBodyElement_createTextRange(IHTMLBodyElement
*iface
, IHTMLTxtRange
**range
)
601 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
602 nsIDOMDocumentRange
*nsdocrange
;
603 nsIDOMRange
*nsrange
= NULL
;
606 TRACE("(%p)->(%p)\n", This
, range
);
608 if(!This
->textcont
.element
.node
.doc
->nsdoc
) {
613 nsres
= nsIDOMDocument_QueryInterface(This
->textcont
.element
.node
.doc
->nsdoc
, &IID_nsIDOMDocumentRange
,
614 (void**)&nsdocrange
);
615 if(NS_FAILED(nsres
)) {
616 ERR("Could not get nsIDOMDocumentRabge iface: %08x\n", nsres
);
620 nsres
= nsIDOMDocumentRange_CreateRange(nsdocrange
, &nsrange
);
621 if(NS_SUCCEEDED(nsres
)) {
622 nsres
= nsIDOMRange_SelectNodeContents(nsrange
, This
->textcont
.element
.node
.nsnode
);
624 ERR("SelectNodeContents failed: %08x\n", nsres
);
626 ERR("CreateRange failed: %08x\n", nsres
);
629 nsIDOMDocumentRange_Release(nsdocrange
);
631 *range
= HTMLTxtRange_Create(This
->textcont
.element
.node
.doc
, nsrange
);
637 static const IHTMLBodyElementVtbl HTMLBodyElementVtbl
= {
638 HTMLBodyElement_QueryInterface
,
639 HTMLBodyElement_AddRef
,
640 HTMLBodyElement_Release
,
641 HTMLBodyElement_GetTypeInfoCount
,
642 HTMLBodyElement_GetTypeInfo
,
643 HTMLBodyElement_GetIDsOfNames
,
644 HTMLBodyElement_Invoke
,
645 HTMLBodyElement_put_background
,
646 HTMLBodyElement_get_background
,
647 HTMLBodyElement_put_bgProperties
,
648 HTMLBodyElement_get_bgProperties
,
649 HTMLBodyElement_put_leftMargin
,
650 HTMLBodyElement_get_leftMargin
,
651 HTMLBodyElement_put_topMargin
,
652 HTMLBodyElement_get_topMargin
,
653 HTMLBodyElement_put_rightMargin
,
654 HTMLBodyElement_get_rightMargin
,
655 HTMLBodyElement_put_bottomMargin
,
656 HTMLBodyElement_get_bottomMargin
,
657 HTMLBodyElement_put_noWrap
,
658 HTMLBodyElement_get_noWrap
,
659 HTMLBodyElement_put_bgColor
,
660 HTMLBodyElement_get_bgColor
,
661 HTMLBodyElement_put_text
,
662 HTMLBodyElement_get_text
,
663 HTMLBodyElement_put_link
,
664 HTMLBodyElement_get_link
,
665 HTMLBodyElement_put_vLink
,
666 HTMLBodyElement_get_vLink
,
667 HTMLBodyElement_put_aLink
,
668 HTMLBodyElement_get_aLink
,
669 HTMLBodyElement_put_onload
,
670 HTMLBodyElement_get_onload
,
671 HTMLBodyElement_put_onunload
,
672 HTMLBodyElement_get_onunload
,
673 HTMLBodyElement_put_scroll
,
674 HTMLBodyElement_get_scroll
,
675 HTMLBodyElement_put_onselect
,
676 HTMLBodyElement_get_onselect
,
677 HTMLBodyElement_put_onbeforeunload
,
678 HTMLBodyElement_get_onbeforeunload
,
679 HTMLBodyElement_createTextRange
682 #define HTMLBODY_NODE_THIS(iface) DEFINE_THIS2(HTMLBodyElement, textcont.element.node, iface)
684 static HRESULT
HTMLBodyElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
686 HTMLBodyElement
*This
= HTMLBODY_NODE_THIS(iface
);
690 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
691 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
692 *ppv
= HTMLBODY(This
);
693 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
694 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
695 *ppv
= HTMLBODY(This
);
696 }else if(IsEqualGUID(&IID_IHTMLBodyElement
, riid
)) {
697 TRACE("(%p)->(IID_IHTMLBodyElement %p)\n", This
, ppv
);
698 *ppv
= HTMLBODY(This
);
699 }else if(IsEqualGUID(&IID_IHTMLTextContainer
, riid
)) {
700 TRACE("(%p)->(IID_IHTMLTextContainer %p)\n", &This
->textcont
, ppv
);
701 *ppv
= HTMLTEXTCONT(&This
->textcont
);
705 IUnknown_AddRef((IUnknown
*)*ppv
);
709 return HTMLElement_QI(&This
->textcont
.element
.node
, riid
, ppv
);
712 static void HTMLBodyElement_destructor(HTMLDOMNode
*iface
)
714 HTMLBodyElement
*This
= HTMLBODY_NODE_THIS(iface
);
716 nsIDOMHTMLBodyElement_Release(This
->nsbody
);
718 HTMLElement_destructor(&This
->textcont
.element
.node
);
721 #undef HTMLBODY_NODE_THIS
723 static const NodeImplVtbl HTMLBodyElementImplVtbl
= {
725 HTMLBodyElement_destructor
728 static const tid_t HTMLBodyElement_iface_tids
[] = {
729 IHTMLBodyElement_tid
,
730 IHTMLBodyElement2_tid
,
737 IHTMLTextContainer_tid
,
742 static dispex_static_data_t HTMLBodyElement_dispex
= {
746 HTMLBodyElement_iface_tids
749 HTMLElement
*HTMLBodyElement_Create(nsIDOMHTMLElement
*nselem
)
751 HTMLBodyElement
*ret
= heap_alloc_zero(sizeof(HTMLBodyElement
));
754 TRACE("(%p)->(%p)\n", ret
, nselem
);
756 HTMLTextContainer_Init(&ret
->textcont
);
758 ret
->lpHTMLBodyElementVtbl
= &HTMLBodyElementVtbl
;
760 init_dispex(&ret
->textcont
.element
.node
.dispex
, (IUnknown
*)HTMLBODY(ret
), &HTMLBodyElement_dispex
);
761 ret
->textcont
.element
.node
.vtbl
= &HTMLBodyElementImplVtbl
;
763 ConnectionPoint_Init(&ret
->cp_propnotif
, &ret
->textcont
.element
.cp_container
, &IID_IPropertyNotifySink
);
765 nsres
= nsIDOMHTMLElement_QueryInterface(nselem
, &IID_nsIDOMHTMLBodyElement
,
766 (void**)&ret
->nsbody
);
768 ERR("Could not get nsDOMHTMLBodyElement: %08x\n", nsres
);
770 return &ret
->textcont
.element
;