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
31 #include "wine/debug.h"
33 #include "mshtml_private.h"
34 #include "htmlevent.h"
35 #include "htmlstyle.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
42 IHTMLBodyElement IHTMLBodyElement_iface
;
43 IHTMLTextContainer IHTMLTextContainer_iface
;
45 nsIDOMHTMLBodyElement
*nsbody
;
55 {L
"fuchsia", 0xff00ff},
59 {L
"maroon", 0x800000},
62 {L
"purple", 0x800080},
64 {L
"silver", 0xc0c0c0},
70 static int comp_value(const WCHAR
*ptr
, int dpc
)
81 else if(is_digit(ch
= *ptr
++))
82 ret
= ret
*16 + (ch
-'0');
83 else if('a' <= ch
&& ch
<= 'f')
84 ret
= ret
*16 + (ch
-'a') + 10;
85 else if('A' <= ch
&& ch
<= 'F')
86 ret
= ret
*16 + (ch
-'A') + 10;
94 /* Based on Gecko NS_LooseHexToRGB */
95 static int loose_hex_to_rgb(const WCHAR
*hex
)
107 dpc
= min(len
/3 + (len
%3 ? 1 : 0), 4);
108 return (comp_value(hex
, dpc
) << 16)
109 | (comp_value(hex
+dpc
, dpc
) << 8)
110 | comp_value(hex
+2*dpc
, dpc
);
113 HRESULT
nscolor_to_str(LPCWSTR color
, BSTR
*ret
)
118 static const WCHAR formatW
[] = {'#','%','0','2','x','%','0','2','x','%','0','2','x',0};
120 if(!color
|| !*color
) {
126 for(i
=0; i
< ARRAY_SIZE(keyword_table
); i
++) {
127 if(!wcsicmp(color
, keyword_table
[i
].keyword
))
128 rgb
= keyword_table
[i
].rgb
;
132 rgb
= loose_hex_to_rgb(color
);
134 *ret
= SysAllocStringLen(NULL
, 7);
136 return E_OUTOFMEMORY
;
138 swprintf(*ret
, 8, formatW
, rgb
>>16, (rgb
>>8)&0xff, rgb
&0xff);
140 TRACE("%s -> %s\n", debugstr_w(color
), debugstr_w(*ret
));
144 BOOL
variant_to_nscolor(const VARIANT
*v
, nsAString
*nsstr
)
148 nsAString_Init(nsstr
, V_BSTR(v
));
153 static const WCHAR formatW
[] = {'#','%','x',0};
155 wsprintfW(buf
, formatW
, V_I4(v
));
156 nsAString_Init(nsstr
, buf
);
161 FIXME("invalid color %s\n", debugstr_variant(v
));
168 static HRESULT
return_nscolor(nsresult nsres
, nsAString
*nsstr
, VARIANT
*p
)
170 const PRUnichar
*color
;
172 if(NS_FAILED(nsres
)) {
173 ERR("failed: %08x\n", nsres
);
174 nsAString_Finish(nsstr
);
178 nsAString_GetData(nsstr
, &color
);
182 V_I4(p
) = wcstol(color
+1, NULL
, 16);
185 V_BSTR(p
) = SysAllocString(color
);
187 nsAString_Finish(nsstr
);
188 return E_OUTOFMEMORY
;
192 nsAString_Finish(nsstr
);
193 TRACE("ret %s\n", debugstr_variant(p
));
197 static inline HTMLBodyElement
*impl_from_IHTMLBodyElement(IHTMLBodyElement
*iface
)
199 return CONTAINING_RECORD(iface
, HTMLBodyElement
, IHTMLBodyElement_iface
);
202 static HRESULT WINAPI
HTMLBodyElement_QueryInterface(IHTMLBodyElement
*iface
,
203 REFIID riid
, void **ppv
)
205 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
207 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
210 static ULONG WINAPI
HTMLBodyElement_AddRef(IHTMLBodyElement
*iface
)
212 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
214 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
217 static ULONG WINAPI
HTMLBodyElement_Release(IHTMLBodyElement
*iface
)
219 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
221 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
224 static HRESULT WINAPI
HTMLBodyElement_GetTypeInfoCount(IHTMLBodyElement
*iface
, UINT
*pctinfo
)
226 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
227 return IDispatchEx_GetTypeInfoCount(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
,
231 static HRESULT WINAPI
HTMLBodyElement_GetTypeInfo(IHTMLBodyElement
*iface
, UINT iTInfo
,
232 LCID lcid
, ITypeInfo
**ppTInfo
)
234 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
235 return IDispatchEx_GetTypeInfo(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
,
239 static HRESULT WINAPI
HTMLBodyElement_GetIDsOfNames(IHTMLBodyElement
*iface
, REFIID riid
,
240 LPOLESTR
*rgszNames
, UINT cNames
,
241 LCID lcid
, DISPID
*rgDispId
)
243 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
244 return IDispatchEx_GetIDsOfNames(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
,
245 rgszNames
, cNames
, lcid
, rgDispId
);
248 static HRESULT WINAPI
HTMLBodyElement_Invoke(IHTMLBodyElement
*iface
, DISPID dispIdMember
,
249 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
250 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
252 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
253 return IDispatchEx_Invoke(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
,
254 riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
257 static HRESULT WINAPI
HTMLBodyElement_put_background(IHTMLBodyElement
*iface
, BSTR v
)
259 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
263 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
265 nsAString_InitDepend(&nsstr
, v
);
266 nsres
= nsIDOMHTMLBodyElement_SetBackground(This
->nsbody
, &nsstr
);
267 nsAString_Finish(&nsstr
);
274 static HRESULT WINAPI
HTMLBodyElement_get_background(IHTMLBodyElement
*iface
, BSTR
*p
)
276 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
277 nsAString background_str
;
280 TRACE("(%p)->(%p)\n", This
, p
);
282 nsAString_Init(&background_str
, NULL
);
283 nsres
= nsIDOMHTMLBodyElement_GetBackground(This
->nsbody
, &background_str
);
284 return return_nsstr(nsres
, &background_str
, p
);
287 static HRESULT WINAPI
HTMLBodyElement_put_bgProperties(IHTMLBodyElement
*iface
, BSTR v
)
289 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
290 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
294 static HRESULT WINAPI
HTMLBodyElement_get_bgProperties(IHTMLBodyElement
*iface
, BSTR
*p
)
296 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
297 FIXME("(%p)->(%p)\n", This
, p
);
301 static HRESULT WINAPI
HTMLBodyElement_put_leftMargin(IHTMLBodyElement
*iface
, VARIANT v
)
303 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
304 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
308 static HRESULT WINAPI
HTMLBodyElement_get_leftMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
310 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
311 FIXME("(%p)->(%p)\n", This
, p
);
315 static HRESULT WINAPI
HTMLBodyElement_put_topMargin(IHTMLBodyElement
*iface
, VARIANT v
)
317 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
318 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
322 static HRESULT WINAPI
HTMLBodyElement_get_topMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
324 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
325 FIXME("(%p)->(%p)\n", This
, p
);
329 static HRESULT WINAPI
HTMLBodyElement_put_rightMargin(IHTMLBodyElement
*iface
, VARIANT v
)
331 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
332 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
336 static HRESULT WINAPI
HTMLBodyElement_get_rightMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
338 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
339 FIXME("(%p)->(%p)\n", This
, p
);
343 static HRESULT WINAPI
HTMLBodyElement_put_bottomMargin(IHTMLBodyElement
*iface
, VARIANT v
)
345 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
346 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
350 static HRESULT WINAPI
HTMLBodyElement_get_bottomMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
352 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
353 FIXME("(%p)->(%p)\n", This
, p
);
357 static HRESULT WINAPI
HTMLBodyElement_put_noWrap(IHTMLBodyElement
*iface
, VARIANT_BOOL v
)
359 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
360 FIXME("(%p)->(%x)\n", This
, v
);
364 static HRESULT WINAPI
HTMLBodyElement_get_noWrap(IHTMLBodyElement
*iface
, VARIANT_BOOL
*p
)
366 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
367 FIXME("(%p)->(%p)\n", This
, p
);
371 static HRESULT WINAPI
HTMLBodyElement_put_bgColor(IHTMLBodyElement
*iface
, VARIANT v
)
373 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
377 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
379 if(!variant_to_nscolor(&v
, &strColor
))
382 nsres
= nsIDOMHTMLBodyElement_SetBgColor(This
->nsbody
, &strColor
);
383 nsAString_Finish(&strColor
);
385 ERR("SetBgColor failed: %08x\n", nsres
);
390 static HRESULT WINAPI
HTMLBodyElement_get_bgColor(IHTMLBodyElement
*iface
, VARIANT
*p
)
392 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
396 TRACE("(%p)->(%p)\n", This
, p
);
398 nsAString_Init(&nsstr
, NULL
);
399 nsres
= nsIDOMHTMLBodyElement_GetBgColor(This
->nsbody
, &nsstr
);
400 return return_nsstr_variant(nsres
, &nsstr
, NSSTR_COLOR
, p
);
403 static HRESULT WINAPI
HTMLBodyElement_put_text(IHTMLBodyElement
*iface
, VARIANT v
)
405 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
409 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
411 if(!variant_to_nscolor(&v
, &text
))
414 nsres
= nsIDOMHTMLBodyElement_SetText(This
->nsbody
, &text
);
415 nsAString_Finish(&text
);
416 if(NS_FAILED(nsres
)) {
417 ERR("SetText failed: %08x\n", nsres
);
424 static HRESULT WINAPI
HTMLBodyElement_get_text(IHTMLBodyElement
*iface
, VARIANT
*p
)
426 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
431 TRACE("(%p)->(%p)\n", This
, p
);
433 nsAString_Init(&text
, NULL
);
434 nsres
= nsIDOMHTMLBodyElement_GetText(This
->nsbody
, &text
);
435 if(NS_SUCCEEDED(nsres
)) {
436 const PRUnichar
*color
;
438 nsAString_GetData(&text
, &color
);
440 hres
= nscolor_to_str(color
, &V_BSTR(p
));
442 ERR("GetText failed: %08x\n", nsres
);
446 nsAString_Finish(&text
);
451 static HRESULT WINAPI
HTMLBodyElement_put_link(IHTMLBodyElement
*iface
, VARIANT v
)
453 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
457 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
459 if(!variant_to_nscolor(&v
, &link_str
))
462 nsres
= nsIDOMHTMLBodyElement_SetLink(This
->nsbody
, &link_str
);
463 nsAString_Finish(&link_str
);
465 ERR("SetLink failed: %08x\n", nsres
);
470 static HRESULT WINAPI
HTMLBodyElement_get_link(IHTMLBodyElement
*iface
, VARIANT
*p
)
472 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
476 TRACE("(%p)->(%p)\n", This
, p
);
478 nsAString_Init(&link_str
, NULL
);
479 nsres
= nsIDOMHTMLBodyElement_GetLink(This
->nsbody
, &link_str
);
480 return return_nscolor(nsres
, &link_str
, p
);
483 static HRESULT WINAPI
HTMLBodyElement_put_vLink(IHTMLBodyElement
*iface
, VARIANT v
)
485 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
489 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
491 if(!variant_to_nscolor(&v
, &vlink_str
))
494 nsres
= nsIDOMHTMLBodyElement_SetVLink(This
->nsbody
, &vlink_str
);
495 nsAString_Finish(&vlink_str
);
497 ERR("SetLink failed: %08x\n", nsres
);
502 static HRESULT WINAPI
HTMLBodyElement_get_vLink(IHTMLBodyElement
*iface
, VARIANT
*p
)
504 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
508 TRACE("(%p)->(%p)\n", This
, p
);
510 nsAString_Init(&vlink_str
, NULL
);
511 nsres
= nsIDOMHTMLBodyElement_GetVLink(This
->nsbody
, &vlink_str
);
512 return return_nscolor(nsres
, &vlink_str
, p
);
515 static HRESULT WINAPI
HTMLBodyElement_put_aLink(IHTMLBodyElement
*iface
, VARIANT v
)
517 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
521 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
523 if(!variant_to_nscolor(&v
, &alink_str
))
526 nsres
= nsIDOMHTMLBodyElement_SetALink(This
->nsbody
, &alink_str
);
527 nsAString_Finish(&alink_str
);
529 ERR("SetALink failed: %08x\n", nsres
);
534 static HRESULT WINAPI
HTMLBodyElement_get_aLink(IHTMLBodyElement
*iface
, VARIANT
*p
)
536 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
540 TRACE("(%p)->(%p)\n", This
, p
);
542 nsAString_Init(&alink_str
, NULL
);
543 nsres
= nsIDOMHTMLBodyElement_GetALink(This
->nsbody
, &alink_str
);
544 return return_nscolor(nsres
, &alink_str
, p
);
547 static HRESULT WINAPI
HTMLBodyElement_put_onload(IHTMLBodyElement
*iface
, VARIANT v
)
549 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
551 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
553 return set_node_event(&This
->element
.node
, EVENTID_LOAD
, &v
);
556 static HRESULT WINAPI
HTMLBodyElement_get_onload(IHTMLBodyElement
*iface
, VARIANT
*p
)
558 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
560 TRACE("(%p)->(%p)\n", This
, p
);
562 return get_node_event(&This
->element
.node
, EVENTID_LOAD
, p
);
565 static HRESULT WINAPI
HTMLBodyElement_put_onunload(IHTMLBodyElement
*iface
, VARIANT v
)
567 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
568 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
572 static HRESULT WINAPI
HTMLBodyElement_get_onunload(IHTMLBodyElement
*iface
, VARIANT
*p
)
574 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
575 FIXME("(%p)->(%p)\n", This
, p
);
579 static const WCHAR autoW
[] = {'a','u','t','o',0};
580 static const WCHAR hiddenW
[] = {'h','i','d','d','e','n',0};
581 static const WCHAR scrollW
[] = {'s','c','r','o','l','l',0};
582 static const WCHAR visibleW
[] = {'v','i','s','i','b','l','e',0};
583 static const WCHAR yesW
[] = {'y','e','s',0};
584 static const WCHAR noW
[] = {'n','o',0};
586 static HRESULT WINAPI
HTMLBodyElement_put_scroll(IHTMLBodyElement
*iface
, BSTR v
)
588 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
589 static const WCHAR
*val
;
591 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
593 /* Emulate with CSS visibility attribute */
594 if(!wcscmp(v
, yesW
)) {
596 }else if(!wcscmp(v
, autoW
)) {
598 }else if(!wcscmp(v
, noW
)) {
601 WARN("Invalid argument %s\n", debugstr_w(v
));
605 return set_elem_style(&This
->element
, STYLEID_OVERFLOW
, val
);
608 static HRESULT WINAPI
HTMLBodyElement_get_scroll(IHTMLBodyElement
*iface
, BSTR
*p
)
610 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
611 const WCHAR
*ret
= NULL
;
615 TRACE("(%p)->(%p)\n", This
, p
);
617 /* Emulate with CSS visibility attribute */
618 hres
= get_elem_style(&This
->element
, STYLEID_OVERFLOW
, &overflow
);
622 if(!overflow
|| !*overflow
) {
625 }else if(!wcscmp(overflow
, visibleW
) || !wcscmp(overflow
, autoW
)) {
627 }else if(!wcscmp(overflow
, scrollW
)) {
629 }else if(!wcscmp(overflow
, hiddenW
)) {
632 TRACE("Defaulting %s to NULL\n", debugstr_w(overflow
));
637 SysFreeString(overflow
);
639 *p
= SysAllocString(ret
);
640 hres
= *p
? S_OK
: E_OUTOFMEMORY
;
646 static HRESULT WINAPI
HTMLBodyElement_put_onselect(IHTMLBodyElement
*iface
, VARIANT v
)
648 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
649 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
653 static HRESULT WINAPI
HTMLBodyElement_get_onselect(IHTMLBodyElement
*iface
, VARIANT
*p
)
655 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
656 FIXME("(%p)->(%p)\n", This
, p
);
660 static HRESULT WINAPI
HTMLBodyElement_put_onbeforeunload(IHTMLBodyElement
*iface
, VARIANT v
)
662 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
663 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
667 static HRESULT WINAPI
HTMLBodyElement_get_onbeforeunload(IHTMLBodyElement
*iface
, VARIANT
*p
)
669 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
670 FIXME("(%p)->(%p)\n", This
, p
);
674 static HRESULT WINAPI
HTMLBodyElement_createTextRange(IHTMLBodyElement
*iface
, IHTMLTxtRange
**range
)
676 HTMLBodyElement
*This
= impl_from_IHTMLBodyElement(iface
);
677 nsIDOMRange
*nsrange
= NULL
;
681 TRACE("(%p)->(%p)\n", This
, range
);
683 if(!This
->element
.node
.doc
->nsdoc
) {
688 nsres
= nsIDOMHTMLDocument_CreateRange(This
->element
.node
.doc
->nsdoc
, &nsrange
);
689 if(NS_SUCCEEDED(nsres
)) {
690 nsres
= nsIDOMRange_SelectNodeContents(nsrange
, This
->element
.node
.nsnode
);
692 ERR("SelectNodeContents failed: %08x\n", nsres
);
694 ERR("CreateRange failed: %08x\n", nsres
);
697 hres
= HTMLTxtRange_Create(This
->element
.node
.doc
->basedoc
.doc_node
, nsrange
, range
);
699 nsIDOMRange_Release(nsrange
);
703 static const IHTMLBodyElementVtbl HTMLBodyElementVtbl
= {
704 HTMLBodyElement_QueryInterface
,
705 HTMLBodyElement_AddRef
,
706 HTMLBodyElement_Release
,
707 HTMLBodyElement_GetTypeInfoCount
,
708 HTMLBodyElement_GetTypeInfo
,
709 HTMLBodyElement_GetIDsOfNames
,
710 HTMLBodyElement_Invoke
,
711 HTMLBodyElement_put_background
,
712 HTMLBodyElement_get_background
,
713 HTMLBodyElement_put_bgProperties
,
714 HTMLBodyElement_get_bgProperties
,
715 HTMLBodyElement_put_leftMargin
,
716 HTMLBodyElement_get_leftMargin
,
717 HTMLBodyElement_put_topMargin
,
718 HTMLBodyElement_get_topMargin
,
719 HTMLBodyElement_put_rightMargin
,
720 HTMLBodyElement_get_rightMargin
,
721 HTMLBodyElement_put_bottomMargin
,
722 HTMLBodyElement_get_bottomMargin
,
723 HTMLBodyElement_put_noWrap
,
724 HTMLBodyElement_get_noWrap
,
725 HTMLBodyElement_put_bgColor
,
726 HTMLBodyElement_get_bgColor
,
727 HTMLBodyElement_put_text
,
728 HTMLBodyElement_get_text
,
729 HTMLBodyElement_put_link
,
730 HTMLBodyElement_get_link
,
731 HTMLBodyElement_put_vLink
,
732 HTMLBodyElement_get_vLink
,
733 HTMLBodyElement_put_aLink
,
734 HTMLBodyElement_get_aLink
,
735 HTMLBodyElement_put_onload
,
736 HTMLBodyElement_get_onload
,
737 HTMLBodyElement_put_onunload
,
738 HTMLBodyElement_get_onunload
,
739 HTMLBodyElement_put_scroll
,
740 HTMLBodyElement_get_scroll
,
741 HTMLBodyElement_put_onselect
,
742 HTMLBodyElement_get_onselect
,
743 HTMLBodyElement_put_onbeforeunload
,
744 HTMLBodyElement_get_onbeforeunload
,
745 HTMLBodyElement_createTextRange
748 static inline HTMLBodyElement
*impl_from_IHTMLTextContainer(IHTMLTextContainer
*iface
)
750 return CONTAINING_RECORD(iface
, HTMLBodyElement
, IHTMLTextContainer_iface
);
753 static HRESULT WINAPI
HTMLTextContainer_QueryInterface(IHTMLTextContainer
*iface
,
754 REFIID riid
, void **ppv
)
756 HTMLBodyElement
*This
= impl_from_IHTMLTextContainer(iface
);
757 return IHTMLElement_QueryInterface(&This
->element
.IHTMLElement_iface
, riid
, ppv
);
760 static ULONG WINAPI
HTMLTextContainer_AddRef(IHTMLTextContainer
*iface
)
762 HTMLBodyElement
*This
= impl_from_IHTMLTextContainer(iface
);
763 return IHTMLElement_AddRef(&This
->element
.IHTMLElement_iface
);
766 static ULONG WINAPI
HTMLTextContainer_Release(IHTMLTextContainer
*iface
)
768 HTMLBodyElement
*This
= impl_from_IHTMLTextContainer(iface
);
769 return IHTMLElement_Release(&This
->element
.IHTMLElement_iface
);
772 static HRESULT WINAPI
HTMLTextContainer_GetTypeInfoCount(IHTMLTextContainer
*iface
, UINT
*pctinfo
)
774 HTMLBodyElement
*This
= impl_from_IHTMLTextContainer(iface
);
775 return IDispatchEx_GetTypeInfoCount(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
778 static HRESULT WINAPI
HTMLTextContainer_GetTypeInfo(IHTMLTextContainer
*iface
, UINT iTInfo
,
779 LCID lcid
, ITypeInfo
**ppTInfo
)
781 HTMLBodyElement
*This
= impl_from_IHTMLTextContainer(iface
);
782 return IDispatchEx_GetTypeInfo(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
,
786 static HRESULT WINAPI
HTMLTextContainer_GetIDsOfNames(IHTMLTextContainer
*iface
, REFIID riid
,
787 LPOLESTR
*rgszNames
, UINT cNames
,
788 LCID lcid
, DISPID
*rgDispId
)
790 HTMLBodyElement
*This
= impl_from_IHTMLTextContainer(iface
);
791 return IDispatchEx_GetIDsOfNames(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
,
792 cNames
, lcid
, rgDispId
);
795 static HRESULT WINAPI
HTMLTextContainer_Invoke(IHTMLTextContainer
*iface
, DISPID dispIdMember
,
796 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
797 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
799 HTMLBodyElement
*This
= impl_from_IHTMLTextContainer(iface
);
800 return IDispatchEx_Invoke(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
,
801 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
804 static HRESULT WINAPI
HTMLTextContainer_createControlRange(IHTMLTextContainer
*iface
,
807 HTMLBodyElement
*This
= impl_from_IHTMLTextContainer(iface
);
808 FIXME("(%p)->(%p)\n", This
, range
);
812 static HRESULT WINAPI
HTMLTextContainer_get_scrollHeight(IHTMLTextContainer
*iface
, LONG
*p
)
814 HTMLBodyElement
*This
= impl_from_IHTMLTextContainer(iface
);
816 TRACE("(%p)->(%p)\n", This
, p
);
818 return IHTMLElement2_get_scrollHeight(&This
->element
.IHTMLElement2_iface
, p
);
821 static HRESULT WINAPI
HTMLTextContainer_get_scrollWidth(IHTMLTextContainer
*iface
, LONG
*p
)
823 HTMLBodyElement
*This
= impl_from_IHTMLTextContainer(iface
);
825 TRACE("(%p)->(%p)\n", This
, p
);
827 return IHTMLElement2_get_scrollWidth(&This
->element
.IHTMLElement2_iface
, p
);
830 static HRESULT WINAPI
HTMLTextContainer_put_scrollTop(IHTMLTextContainer
*iface
, LONG v
)
832 HTMLBodyElement
*This
= impl_from_IHTMLTextContainer(iface
);
834 TRACE("(%p)->(%d)\n", This
, v
);
836 return IHTMLElement2_put_scrollTop(&This
->element
.IHTMLElement2_iface
, v
);
839 static HRESULT WINAPI
HTMLTextContainer_get_scrollTop(IHTMLTextContainer
*iface
, LONG
*p
)
841 HTMLBodyElement
*This
= impl_from_IHTMLTextContainer(iface
);
843 TRACE("(%p)->(%p)\n", This
, p
);
845 return IHTMLElement2_get_scrollTop(&This
->element
.IHTMLElement2_iface
, p
);
848 static HRESULT WINAPI
HTMLTextContainer_put_scrollLeft(IHTMLTextContainer
*iface
, LONG v
)
850 HTMLBodyElement
*This
= impl_from_IHTMLTextContainer(iface
);
852 TRACE("(%p)->(%d)\n", This
, v
);
854 return IHTMLElement2_put_scrollLeft(&This
->element
.IHTMLElement2_iface
, v
);
857 static HRESULT WINAPI
HTMLTextContainer_get_scrollLeft(IHTMLTextContainer
*iface
, LONG
*p
)
859 HTMLBodyElement
*This
= impl_from_IHTMLTextContainer(iface
);
861 TRACE("(%p)->(%p)\n", This
, p
);
863 return IHTMLElement2_get_scrollLeft(&This
->element
.IHTMLElement2_iface
, p
);
866 static HRESULT WINAPI
HTMLTextContainer_put_onscroll(IHTMLTextContainer
*iface
, VARIANT v
)
868 HTMLBodyElement
*This
= impl_from_IHTMLTextContainer(iface
);
869 FIXME("(%p)->()\n", This
);
873 static HRESULT WINAPI
HTMLTextContainer_get_onscroll(IHTMLTextContainer
*iface
, VARIANT
*p
)
875 HTMLBodyElement
*This
= impl_from_IHTMLTextContainer(iface
);
876 FIXME("(%p)->(%p)\n", This
, p
);
880 static const IHTMLTextContainerVtbl HTMLTextContainerVtbl
= {
881 HTMLTextContainer_QueryInterface
,
882 HTMLTextContainer_AddRef
,
883 HTMLTextContainer_Release
,
884 HTMLTextContainer_GetTypeInfoCount
,
885 HTMLTextContainer_GetTypeInfo
,
886 HTMLTextContainer_GetIDsOfNames
,
887 HTMLTextContainer_Invoke
,
888 HTMLTextContainer_createControlRange
,
889 HTMLTextContainer_get_scrollHeight
,
890 HTMLTextContainer_get_scrollWidth
,
891 HTMLTextContainer_put_scrollTop
,
892 HTMLTextContainer_get_scrollTop
,
893 HTMLTextContainer_put_scrollLeft
,
894 HTMLTextContainer_get_scrollLeft
,
895 HTMLTextContainer_put_onscroll
,
896 HTMLTextContainer_get_onscroll
899 static inline HTMLBodyElement
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
901 return CONTAINING_RECORD(iface
, HTMLBodyElement
, element
.node
);
904 static HRESULT
HTMLBodyElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
906 HTMLBodyElement
*This
= impl_from_HTMLDOMNode(iface
);
910 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
911 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
912 *ppv
= &This
->IHTMLBodyElement_iface
;
913 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
914 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
915 *ppv
= &This
->IHTMLBodyElement_iface
;
916 }else if(IsEqualGUID(&IID_IHTMLBodyElement
, riid
)) {
917 TRACE("(%p)->(IID_IHTMLBodyElement %p)\n", This
, ppv
);
918 *ppv
= &This
->IHTMLBodyElement_iface
;
919 }else if(IsEqualGUID(&IID_IHTMLTextContainer
, riid
)) {
920 TRACE("(%p)->(IID_IHTMLTextContainer %p)\n", This
, ppv
);
921 *ppv
= &This
->IHTMLTextContainer_iface
;
925 IUnknown_AddRef((IUnknown
*)*ppv
);
929 return HTMLElement_QI(&This
->element
.node
, riid
, ppv
);
932 static void HTMLBodyElement_traverse(HTMLDOMNode
*iface
, nsCycleCollectionTraversalCallback
*cb
)
934 HTMLBodyElement
*This
= impl_from_HTMLDOMNode(iface
);
937 note_cc_edge((nsISupports
*)This
->nsbody
, "This->nsbody", cb
);
940 static void HTMLBodyElement_unlink(HTMLDOMNode
*iface
)
942 HTMLBodyElement
*This
= impl_from_HTMLDOMNode(iface
);
945 nsIDOMHTMLBodyElement
*nsbody
= This
->nsbody
;
947 nsIDOMHTMLBodyElement_Release(nsbody
);
951 static EventTarget
*HTMLBodyElement_get_event_prop_target(HTMLDOMNode
*iface
, int event_id
)
953 HTMLBodyElement
*This
= impl_from_HTMLDOMNode(iface
);
961 return This
->element
.node
.doc
&& This
->element
.node
.doc
->window
962 ? &This
->element
.node
.doc
->window
->event_target
963 : &This
->element
.node
.event_target
;
965 return &This
->element
.node
.event_target
;
969 static BOOL
HTMLBodyElement_is_text_edit(HTMLDOMNode
*iface
)
974 static BOOL
HTMLBodyElement_is_settable(HTMLDOMNode
*iface
, DISPID dispid
)
977 case DISPID_IHTMLELEMENT_OUTERTEXT
:
984 static const cpc_entry_t HTMLBodyElement_cpc
[] = {
985 {&DIID_HTMLTextContainerEvents
},
986 {&IID_IPropertyNotifySink
},
991 static const NodeImplVtbl HTMLBodyElementImplVtbl
= {
994 HTMLElement_destructor
,
997 HTMLElement_handle_event
,
998 HTMLElement_get_attr_col
,
999 HTMLBodyElement_get_event_prop_target
,
1007 HTMLBodyElement_traverse
,
1008 HTMLBodyElement_unlink
,
1009 HTMLBodyElement_is_text_edit
,
1010 HTMLBodyElement_is_settable
1013 static const tid_t HTMLBodyElement_iface_tids
[] = {
1014 IHTMLBodyElement_tid
,
1015 IHTMLBodyElement2_tid
,
1017 IHTMLTextContainer_tid
,
1021 static dispex_static_data_t HTMLBodyElement_dispex
= {
1024 HTMLBodyElement_iface_tids
,
1025 HTMLElement_init_dispex_info
1028 HRESULT
HTMLBodyElement_Create(HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
, HTMLElement
**elem
)
1030 HTMLBodyElement
*ret
;
1033 ret
= heap_alloc_zero(sizeof(HTMLBodyElement
));
1035 return E_OUTOFMEMORY
;
1037 ret
->IHTMLBodyElement_iface
.lpVtbl
= &HTMLBodyElementVtbl
;
1038 ret
->IHTMLTextContainer_iface
.lpVtbl
= &HTMLTextContainerVtbl
;
1039 ret
->element
.node
.vtbl
= &HTMLBodyElementImplVtbl
;
1041 HTMLElement_Init(&ret
->element
, doc
, nselem
, &HTMLBodyElement_dispex
);
1043 nsres
= nsIDOMElement_QueryInterface(nselem
, &IID_nsIDOMHTMLBodyElement
, (void**)&ret
->nsbody
);
1044 assert(nsres
== NS_OK
);
1046 *elem
= &ret
->element
;