shell32/tests: Use FAILED instead of !SUCCEEDED.
[wine/multimedia.git] / dlls / mshtml / htmlbody.c
blobefe5df8cefac9459996bad5be8b83106b32d7e4c
1 /*
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
19 #include <stdarg.h>
20 #include <stdio.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 typedef struct {
36 HTMLTextContainer textcont;
38 const IHTMLBodyElementVtbl *lpHTMLBodyElementVtbl;
40 ConnectionPoint cp_propnotif;
42 nsIDOMHTMLBodyElement *nsbody;
43 } HTMLBodyElement;
45 #define HTMLBODY(x) ((IHTMLBodyElement*) &(x)->lpHTMLBodyElementVtbl)
47 static BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr)
49 switch(V_VT(v)) {
50 case VT_BSTR:
51 nsAString_Init(nsstr, V_BSTR(v));
52 return TRUE;
54 case VT_I4: {
55 PRUnichar buf[10];
56 static const WCHAR formatW[] = {'#','%','x',0};
58 wsprintfW(buf, formatW, V_I4(v));
59 nsAString_Init(nsstr, buf);
60 return TRUE;
63 default:
64 FIXME("invalid vt=%d\n", V_VT(v));
67 return FALSE;
71 static void nscolor_to_variant(const nsAString *nsstr, VARIANT *p)
73 const PRUnichar *color;
75 nsAString_GetData(nsstr, &color);
77 if(*color == '#') {
78 V_VT(p) = VT_I4;
79 V_I4(p) = strtolW(color+1, NULL, 16);
80 }else {
81 V_VT(p) = VT_BSTR;
82 V_BSTR(p) = SysAllocString(color);
86 #define HTMLBODY_THIS(iface) DEFINE_THIS(HTMLBodyElement, HTMLBodyElement, iface)
88 static HRESULT WINAPI HTMLBodyElement_QueryInterface(IHTMLBodyElement *iface,
89 REFIID riid, void **ppv)
91 HTMLBodyElement *This = HTMLBODY_THIS(iface);
93 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->textcont.element.node), riid, ppv);
96 static ULONG WINAPI HTMLBodyElement_AddRef(IHTMLBodyElement *iface)
98 HTMLBodyElement *This = HTMLBODY_THIS(iface);
100 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->textcont.element.node));
103 static ULONG WINAPI HTMLBodyElement_Release(IHTMLBodyElement *iface)
105 HTMLBodyElement *This = HTMLBODY_THIS(iface);
107 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->textcont.element.node));
110 static HRESULT WINAPI HTMLBodyElement_GetTypeInfoCount(IHTMLBodyElement *iface, UINT *pctinfo)
112 HTMLBodyElement *This = HTMLBODY_THIS(iface);
113 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->textcont.element.node.dispex), pctinfo);
116 static HRESULT WINAPI HTMLBodyElement_GetTypeInfo(IHTMLBodyElement *iface, UINT iTInfo,
117 LCID lcid, ITypeInfo **ppTInfo)
119 HTMLBodyElement *This = HTMLBODY_THIS(iface);
120 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->textcont.element.node.dispex), iTInfo, lcid, ppTInfo);
123 static HRESULT WINAPI HTMLBodyElement_GetIDsOfNames(IHTMLBodyElement *iface, REFIID riid,
124 LPOLESTR *rgszNames, UINT cNames,
125 LCID lcid, DISPID *rgDispId)
127 HTMLBodyElement *This = HTMLBODY_THIS(iface);
128 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->textcont.element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
131 static HRESULT WINAPI HTMLBodyElement_Invoke(IHTMLBodyElement *iface, DISPID dispIdMember,
132 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
133 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
135 HTMLBodyElement *This = HTMLBODY_THIS(iface);
136 return IDispatchEx_Invoke(DISPATCHEX(&This->textcont.element.node.dispex), dispIdMember, riid, lcid,
137 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
140 static HRESULT WINAPI HTMLBodyElement_put_background(IHTMLBodyElement *iface, BSTR v)
142 HTMLBodyElement *This = HTMLBODY_THIS(iface);
143 HRESULT hr = S_OK;
144 nsAString nsstr;
145 nsresult nsres;
147 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
149 nsAString_Init(&nsstr, v);
151 nsres = nsIDOMHTMLBodyElement_SetBackground(This->nsbody, &nsstr);
152 if(!NS_SUCCEEDED(nsres))
154 hr = E_FAIL;
157 nsAString_Finish(&nsstr);
159 return hr;
162 static HRESULT WINAPI HTMLBodyElement_get_background(IHTMLBodyElement *iface, BSTR *p)
164 HTMLBodyElement *This = HTMLBODY_THIS(iface);
165 nsAString background_str;
166 nsresult nsres;
168 TRACE("(%p)->(%p)\n", This, p);
170 nsAString_Init(&background_str, NULL);
172 nsres = nsIDOMHTMLBodyElement_GetBackground(This->nsbody, &background_str);
173 if(NS_SUCCEEDED(nsres)) {
174 const PRUnichar *background;
175 nsAString_GetData(&background_str, &background);
176 *p = *background ? SysAllocString(background) : NULL;
177 }else {
178 ERR("GetBackground failed: %08x\n", nsres);
179 *p = NULL;
182 nsAString_Finish(&background_str);
184 TRACE("*p = %s\n", debugstr_w(*p));
185 return S_OK;
188 static HRESULT WINAPI HTMLBodyElement_put_bgProperties(IHTMLBodyElement *iface, BSTR v)
190 HTMLBodyElement *This = HTMLBODY_THIS(iface);
191 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
192 return E_NOTIMPL;
195 static HRESULT WINAPI HTMLBodyElement_get_bgProperties(IHTMLBodyElement *iface, BSTR *p)
197 HTMLBodyElement *This = HTMLBODY_THIS(iface);
198 FIXME("(%p)->(%p)\n", This, p);
199 return E_NOTIMPL;
202 static HRESULT WINAPI HTMLBodyElement_put_leftMargin(IHTMLBodyElement *iface, VARIANT v)
204 HTMLBodyElement *This = HTMLBODY_THIS(iface);
205 FIXME("(%p)->()\n", This);
206 return E_NOTIMPL;
209 static HRESULT WINAPI HTMLBodyElement_get_leftMargin(IHTMLBodyElement *iface, VARIANT *p)
211 HTMLBodyElement *This = HTMLBODY_THIS(iface);
212 FIXME("(%p)->(%p)\n", This, p);
213 return E_NOTIMPL;
216 static HRESULT WINAPI HTMLBodyElement_put_topMargin(IHTMLBodyElement *iface, VARIANT v)
218 HTMLBodyElement *This = HTMLBODY_THIS(iface);
219 FIXME("(%p)->()\n", This);
220 return E_NOTIMPL;
223 static HRESULT WINAPI HTMLBodyElement_get_topMargin(IHTMLBodyElement *iface, VARIANT *p)
225 HTMLBodyElement *This = HTMLBODY_THIS(iface);
226 FIXME("(%p)->(%p)\n", This, p);
227 return E_NOTIMPL;
230 static HRESULT WINAPI HTMLBodyElement_put_rightMargin(IHTMLBodyElement *iface, VARIANT v)
232 HTMLBodyElement *This = HTMLBODY_THIS(iface);
233 FIXME("(%p)->()\n", This);
234 return E_NOTIMPL;
237 static HRESULT WINAPI HTMLBodyElement_get_rightMargin(IHTMLBodyElement *iface, VARIANT *p)
239 HTMLBodyElement *This = HTMLBODY_THIS(iface);
240 FIXME("(%p)->(%p)\n", This, p);
241 return E_NOTIMPL;
244 static HRESULT WINAPI HTMLBodyElement_put_bottomMargin(IHTMLBodyElement *iface, VARIANT v)
246 HTMLBodyElement *This = HTMLBODY_THIS(iface);
247 FIXME("(%p)->()\n", This);
248 return E_NOTIMPL;
251 static HRESULT WINAPI HTMLBodyElement_get_bottomMargin(IHTMLBodyElement *iface, VARIANT *p)
253 HTMLBodyElement *This = HTMLBODY_THIS(iface);
254 FIXME("(%p)->(%p)\n", This, p);
255 return E_NOTIMPL;
258 static HRESULT WINAPI HTMLBodyElement_put_noWrap(IHTMLBodyElement *iface, VARIANT_BOOL v)
260 HTMLBodyElement *This = HTMLBODY_THIS(iface);
261 FIXME("(%p)->(%x)\n", This, v);
262 return E_NOTIMPL;
265 static HRESULT WINAPI HTMLBodyElement_get_noWrap(IHTMLBodyElement *iface, VARIANT_BOOL *p)
267 HTMLBodyElement *This = HTMLBODY_THIS(iface);
268 FIXME("(%p)->(%p)\n", This, p);
269 return E_NOTIMPL;
272 static HRESULT WINAPI HTMLBodyElement_put_bgColor(IHTMLBodyElement *iface, VARIANT v)
274 HTMLBodyElement *This = HTMLBODY_THIS(iface);
275 nsAString strColor;
276 nsresult nsres;
278 TRACE("(%p)->()\n", This);
280 if(!variant_to_nscolor(&v, &strColor))
281 return S_OK;
283 nsres = nsIDOMHTMLBodyElement_SetBgColor(This->nsbody, &strColor);
284 nsAString_Finish(&strColor);
285 if(NS_FAILED(nsres))
286 ERR("SetBgColor failed: %08x\n", nsres);
288 return S_OK;
291 static HRESULT WINAPI HTMLBodyElement_get_bgColor(IHTMLBodyElement *iface, VARIANT *p)
293 HTMLBodyElement *This = HTMLBODY_THIS(iface);
294 nsAString strColor;
295 nsresult nsres;
296 const PRUnichar *color;
298 TRACE("(%p)->(%p)\n", This, p);
300 nsAString_Init(&strColor, NULL);
301 nsres = nsIDOMHTMLBodyElement_GetBgColor(This->nsbody, &strColor);
302 if(NS_FAILED(nsres))
303 ERR("SetBgColor failed: %08x\n", nsres);
305 nsAString_GetData(&strColor, &color);
307 V_VT(p) = VT_BSTR;
308 V_BSTR(p) = SysAllocString(color);
310 nsAString_Finish(&strColor);
312 return S_OK;
315 static HRESULT WINAPI HTMLBodyElement_put_text(IHTMLBodyElement *iface, VARIANT v)
317 HTMLBodyElement *This = HTMLBODY_THIS(iface);
318 nsAString text;
319 nsresult nsres;
321 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
323 if(!variant_to_nscolor(&v, &text))
324 return S_OK;
326 nsres = nsIDOMHTMLBodyElement_SetText(This->nsbody, &text);
327 nsAString_Finish(&text);
329 return S_OK;
332 static HRESULT WINAPI HTMLBodyElement_get_text(IHTMLBodyElement *iface, VARIANT *p)
334 HTMLBodyElement *This = HTMLBODY_THIS(iface);
335 nsAString text;
336 nsresult nsres;
338 TRACE("(%p)->(%p)\n", This, p);
340 nsAString_Init(&text, NULL);
342 V_VT(p) = VT_BSTR;
343 V_BSTR(p) = NULL;
345 nsres = nsIDOMHTMLBodyElement_GetText(This->nsbody, &text);
346 if(NS_SUCCEEDED(nsres))
348 const PRUnichar *sText;
349 nsAString_GetData(&text, &sText);
351 V_VT(p) = VT_BSTR;
352 V_BSTR(p) = SysAllocString(sText);
355 nsAString_Finish(&text);
357 return S_OK;
360 static HRESULT WINAPI HTMLBodyElement_put_link(IHTMLBodyElement *iface, VARIANT v)
362 HTMLBodyElement *This = HTMLBODY_THIS(iface);
363 nsAString link_str;
364 nsresult nsres;
366 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
368 if(!variant_to_nscolor(&v, &link_str))
369 return S_OK;
371 nsres = nsIDOMHTMLBodyElement_SetLink(This->nsbody, &link_str);
372 nsAString_Finish(&link_str);
373 if(NS_FAILED(nsres))
374 ERR("SetLink failed: %08x\n", nsres);
376 return S_OK;
379 static HRESULT WINAPI HTMLBodyElement_get_link(IHTMLBodyElement *iface, VARIANT *p)
381 HTMLBodyElement *This = HTMLBODY_THIS(iface);
382 nsAString link_str;
383 nsresult nsres;
385 TRACE("(%p)->(%p)\n", This, p);
387 nsAString_Init(&link_str, NULL);
388 nsres = nsIDOMHTMLBodyElement_GetLink(This->nsbody, &link_str);
389 if(NS_FAILED(nsres))
390 ERR("GetLink failed: %08x\n", nsres);
392 nscolor_to_variant(&link_str, p);
393 nsAString_Finish(&link_str);
395 return S_OK;
398 static HRESULT WINAPI HTMLBodyElement_put_vLink(IHTMLBodyElement *iface, VARIANT v)
400 HTMLBodyElement *This = HTMLBODY_THIS(iface);
401 nsAString vlink_str;
402 nsresult nsres;
404 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
406 if(!variant_to_nscolor(&v, &vlink_str))
407 return S_OK;
409 nsres = nsIDOMHTMLBodyElement_SetVLink(This->nsbody, &vlink_str);
410 nsAString_Finish(&vlink_str);
411 if(NS_FAILED(nsres))
412 ERR("SetLink failed: %08x\n", nsres);
414 return S_OK;
417 static HRESULT WINAPI HTMLBodyElement_get_vLink(IHTMLBodyElement *iface, VARIANT *p)
419 HTMLBodyElement *This = HTMLBODY_THIS(iface);
420 nsAString vlink_str;
421 nsresult nsres;
423 TRACE("(%p)->(%p)\n", This, p);
425 nsAString_Init(&vlink_str, NULL);
426 nsres = nsIDOMHTMLBodyElement_GetVLink(This->nsbody, &vlink_str);
427 if(NS_FAILED(nsres))
428 ERR("GetLink failed: %08x\n", nsres);
430 nscolor_to_variant(&vlink_str, p);
431 nsAString_Finish(&vlink_str);
433 return S_OK;
436 static HRESULT WINAPI HTMLBodyElement_put_aLink(IHTMLBodyElement *iface, VARIANT v)
438 HTMLBodyElement *This = HTMLBODY_THIS(iface);
439 nsAString alink_str;
440 nsresult nsres;
442 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
444 if(!variant_to_nscolor(&v, &alink_str))
445 return S_OK;
447 nsres = nsIDOMHTMLBodyElement_SetALink(This->nsbody, &alink_str);
448 nsAString_Finish(&alink_str);
449 if(NS_FAILED(nsres))
450 ERR("SetALink failed: %08x\n", nsres);
452 return S_OK;
455 static HRESULT WINAPI HTMLBodyElement_get_aLink(IHTMLBodyElement *iface, VARIANT *p)
457 HTMLBodyElement *This = HTMLBODY_THIS(iface);
458 nsAString alink_str;
459 nsresult nsres;
461 TRACE("(%p)->(%p)\n", This, p);
463 nsAString_Init(&alink_str, NULL);
464 nsres = nsIDOMHTMLBodyElement_GetALink(This->nsbody, &alink_str);
465 if(NS_FAILED(nsres))
466 ERR("GetALink failed: %08x\n", nsres);
468 nscolor_to_variant(&alink_str, p);
469 nsAString_Finish(&alink_str);
471 return S_OK;
474 static HRESULT WINAPI HTMLBodyElement_put_onload(IHTMLBodyElement *iface, VARIANT v)
476 HTMLBodyElement *This = HTMLBODY_THIS(iface);
477 FIXME("(%p)->()\n", This);
478 return E_NOTIMPL;
481 static HRESULT WINAPI HTMLBodyElement_get_onload(IHTMLBodyElement *iface, VARIANT *p)
483 HTMLBodyElement *This = HTMLBODY_THIS(iface);
484 FIXME("(%p)->(%p)\n", This, p);
485 return E_NOTIMPL;
488 static HRESULT WINAPI HTMLBodyElement_put_onunload(IHTMLBodyElement *iface, VARIANT v)
490 HTMLBodyElement *This = HTMLBODY_THIS(iface);
491 FIXME("(%p)->()\n", This);
492 return E_NOTIMPL;
495 static HRESULT WINAPI HTMLBodyElement_get_onunload(IHTMLBodyElement *iface, VARIANT *p)
497 HTMLBodyElement *This = HTMLBODY_THIS(iface);
498 FIXME("(%p)->(%p)\n", This, p);
499 return E_NOTIMPL;
502 static HRESULT WINAPI HTMLBodyElement_put_scroll(IHTMLBodyElement *iface, BSTR v)
504 HTMLBodyElement *This = HTMLBODY_THIS(iface);
505 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
506 return E_NOTIMPL;
509 static HRESULT WINAPI HTMLBodyElement_get_scroll(IHTMLBodyElement *iface, BSTR *p)
511 HTMLBodyElement *This = HTMLBODY_THIS(iface);
512 FIXME("(%p)->(%p)\n", This, p);
513 return E_NOTIMPL;
516 static HRESULT WINAPI HTMLBodyElement_put_onselect(IHTMLBodyElement *iface, VARIANT v)
518 HTMLBodyElement *This = HTMLBODY_THIS(iface);
519 FIXME("(%p)->()\n", This);
520 return E_NOTIMPL;
523 static HRESULT WINAPI HTMLBodyElement_get_onselect(IHTMLBodyElement *iface, VARIANT *p)
525 HTMLBodyElement *This = HTMLBODY_THIS(iface);
526 FIXME("(%p)->(%p)\n", This, p);
527 return E_NOTIMPL;
530 static HRESULT WINAPI HTMLBodyElement_put_onbeforeunload(IHTMLBodyElement *iface, VARIANT v)
532 HTMLBodyElement *This = HTMLBODY_THIS(iface);
533 FIXME("(%p)->()\n", This);
534 return E_NOTIMPL;
537 static HRESULT WINAPI HTMLBodyElement_get_onbeforeunload(IHTMLBodyElement *iface, VARIANT *p)
539 HTMLBodyElement *This = HTMLBODY_THIS(iface);
540 FIXME("(%p)->(%p)\n", This, p);
541 return E_NOTIMPL;
544 static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, IHTMLTxtRange **range)
546 HTMLBodyElement *This = HTMLBODY_THIS(iface);
547 nsIDOMRange *nsrange = NULL;
549 TRACE("(%p)->(%p)\n", This, range);
551 if(This->textcont.element.node.doc->nscontainer) {
552 nsIDOMDocument *nsdoc;
553 nsIDOMDocumentRange *nsdocrange;
554 nsresult nsres;
556 nsIWebNavigation_GetDocument(This->textcont.element.node.doc->nscontainer->navigation, &nsdoc);
557 nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMDocumentRange, (void**)&nsdocrange);
558 nsIDOMDocument_Release(nsdoc);
560 nsres = nsIDOMDocumentRange_CreateRange(nsdocrange, &nsrange);
561 if(NS_SUCCEEDED(nsres)) {
562 nsres = nsIDOMRange_SelectNodeContents(nsrange, This->textcont.element.node.nsnode);
563 if(NS_FAILED(nsres))
564 ERR("SelectNodeContents failed: %08x\n", nsres);
565 }else {
566 ERR("CreateRange failed: %08x\n", nsres);
569 nsIDOMDocumentRange_Release(nsdocrange);
572 *range = HTMLTxtRange_Create(This->textcont.element.node.doc, nsrange);
573 return S_OK;
576 #undef HTMLBODY_THIS
578 static const IHTMLBodyElementVtbl HTMLBodyElementVtbl = {
579 HTMLBodyElement_QueryInterface,
580 HTMLBodyElement_AddRef,
581 HTMLBodyElement_Release,
582 HTMLBodyElement_GetTypeInfoCount,
583 HTMLBodyElement_GetTypeInfo,
584 HTMLBodyElement_GetIDsOfNames,
585 HTMLBodyElement_Invoke,
586 HTMLBodyElement_put_background,
587 HTMLBodyElement_get_background,
588 HTMLBodyElement_put_bgProperties,
589 HTMLBodyElement_get_bgProperties,
590 HTMLBodyElement_put_leftMargin,
591 HTMLBodyElement_get_leftMargin,
592 HTMLBodyElement_put_topMargin,
593 HTMLBodyElement_get_topMargin,
594 HTMLBodyElement_put_rightMargin,
595 HTMLBodyElement_get_rightMargin,
596 HTMLBodyElement_put_bottomMargin,
597 HTMLBodyElement_get_bottomMargin,
598 HTMLBodyElement_put_noWrap,
599 HTMLBodyElement_get_noWrap,
600 HTMLBodyElement_put_bgColor,
601 HTMLBodyElement_get_bgColor,
602 HTMLBodyElement_put_text,
603 HTMLBodyElement_get_text,
604 HTMLBodyElement_put_link,
605 HTMLBodyElement_get_link,
606 HTMLBodyElement_put_vLink,
607 HTMLBodyElement_get_vLink,
608 HTMLBodyElement_put_aLink,
609 HTMLBodyElement_get_aLink,
610 HTMLBodyElement_put_onload,
611 HTMLBodyElement_get_onload,
612 HTMLBodyElement_put_onunload,
613 HTMLBodyElement_get_onunload,
614 HTMLBodyElement_put_scroll,
615 HTMLBodyElement_get_scroll,
616 HTMLBodyElement_put_onselect,
617 HTMLBodyElement_get_onselect,
618 HTMLBodyElement_put_onbeforeunload,
619 HTMLBodyElement_get_onbeforeunload,
620 HTMLBodyElement_createTextRange
623 #define HTMLBODY_NODE_THIS(iface) DEFINE_THIS2(HTMLBodyElement, textcont.element.node, iface)
625 static HRESULT HTMLBodyElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
627 HTMLBodyElement *This = HTMLBODY_NODE_THIS(iface);
629 *ppv = NULL;
631 if(IsEqualGUID(&IID_IUnknown, riid)) {
632 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
633 *ppv = HTMLBODY(This);
634 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
635 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
636 *ppv = HTMLBODY(This);
637 }else if(IsEqualGUID(&IID_IHTMLBodyElement, riid)) {
638 TRACE("(%p)->(IID_IHTMLBodyElement %p)\n", This, ppv);
639 *ppv = HTMLBODY(This);
640 }else if(IsEqualGUID(&IID_IHTMLTextContainer, riid)) {
641 TRACE("(%p)->(IID_IHTMLTextContainer %p)\n", &This->textcont, ppv);
642 *ppv = HTMLTEXTCONT(&This->textcont);
645 if(*ppv) {
646 IUnknown_AddRef((IUnknown*)*ppv);
647 return S_OK;
650 return HTMLElement_QI(&This->textcont.element.node, riid, ppv);
653 static void HTMLBodyElement_destructor(HTMLDOMNode *iface)
655 HTMLBodyElement *This = HTMLBODY_NODE_THIS(iface);
657 nsIDOMHTMLBodyElement_Release(This->nsbody);
659 HTMLElement_destructor(&This->textcont.element.node);
662 #undef HTMLBODY_NODE_THIS
664 static const NodeImplVtbl HTMLBodyElementImplVtbl = {
665 HTMLBodyElement_QI,
666 HTMLBodyElement_destructor
669 static const tid_t HTMLBodyElement_iface_tids[] = {
670 IHTMLBodyElement_tid,
671 IHTMLBodyElement2_tid,
672 IHTMLDOMNode_tid,
673 IHTMLDOMNode2_tid,
674 IHTMLElement_tid,
675 IHTMLElement2_tid,
676 IHTMLElement3_tid,
677 IHTMLElement4_tid,
678 IHTMLTextContainer_tid,
679 IHTMLUniqueName_tid,
683 static dispex_static_data_t HTMLBodyElement_dispex = {
684 NULL,
685 DispHTMLBody_tid,
686 NULL,
687 HTMLBodyElement_iface_tids
690 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement *nselem)
692 HTMLBodyElement *ret = heap_alloc_zero(sizeof(HTMLBodyElement));
693 nsresult nsres;
695 TRACE("(%p)->(%p)\n", ret, nselem);
697 HTMLTextContainer_Init(&ret->textcont);
699 ret->lpHTMLBodyElementVtbl = &HTMLBodyElementVtbl;
701 init_dispex(&ret->textcont.element.node.dispex, (IUnknown*)HTMLBODY(ret), &HTMLBodyElement_dispex);
702 ret->textcont.element.node.vtbl = &HTMLBodyElementImplVtbl;
704 ConnectionPoint_Init(&ret->cp_propnotif, &ret->textcont.element.cp_container, &IID_IPropertyNotifySink);
706 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLBodyElement,
707 (void**)&ret->nsbody);
708 if(NS_FAILED(nsres))
709 ERR("Could not get nsDOMHTMLBodyElement: %08x\n", nsres);
711 return &ret->textcont.element;