qcap: Implement a stubbed SmartTee filter.
[wine/multimedia.git] / dlls / mshtml / htmlframebase.c
blobbba9678fcb06c8eaf6cfdc1489f4324ba22a62ac
1 /*
2 * Copyright 2008 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 <assert.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
29 #include "mshtml_private.h"
30 #include "binding.h"
31 #include "htmlevent.h"
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37 static const WCHAR autoW[] = {'a','u','t','o',0};
38 static const WCHAR yesW[] = {'y','e','s',0};
39 static const WCHAR noW[] = {'n','o',0};
40 static const WCHAR pxW[] = {'p','x',0};
42 HRESULT set_frame_doc(HTMLFrameBase *frame, nsIDOMDocument *nsdoc)
44 nsIDOMWindow *nswindow;
45 HTMLOuterWindow *window;
46 nsresult nsres;
47 HRESULT hres = S_OK;
49 if(frame->content_window)
50 return S_OK;
52 nsres = nsIDOMDocument_GetDefaultView(nsdoc, &nswindow);
53 if(NS_FAILED(nsres) || !nswindow)
54 return E_FAIL;
56 window = nswindow_to_window(nswindow);
57 if(!window)
58 hres = HTMLOuterWindow_Create(frame->element.node.doc->basedoc.doc_obj, nswindow,
59 frame->element.node.doc->basedoc.window, &window);
60 nsIDOMWindow_Release(nswindow);
61 if(FAILED(hres))
62 return hres;
64 frame->content_window = window;
65 window->frame_element = frame;
66 return S_OK;
69 static inline HTMLFrameBase *impl_from_IHTMLFrameBase(IHTMLFrameBase *iface)
71 return CONTAINING_RECORD(iface, HTMLFrameBase, IHTMLFrameBase_iface);
74 static HRESULT WINAPI HTMLFrameBase_QueryInterface(IHTMLFrameBase *iface, REFIID riid, void **ppv)
76 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
78 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
81 static ULONG WINAPI HTMLFrameBase_AddRef(IHTMLFrameBase *iface)
83 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
85 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
88 static ULONG WINAPI HTMLFrameBase_Release(IHTMLFrameBase *iface)
90 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
92 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
95 static HRESULT WINAPI HTMLFrameBase_GetTypeInfoCount(IHTMLFrameBase *iface, UINT *pctinfo)
97 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
99 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
102 static HRESULT WINAPI HTMLFrameBase_GetTypeInfo(IHTMLFrameBase *iface, UINT iTInfo,
103 LCID lcid, ITypeInfo **ppTInfo)
105 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
107 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
108 ppTInfo);
111 static HRESULT WINAPI HTMLFrameBase_GetIDsOfNames(IHTMLFrameBase *iface, REFIID riid,
112 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
114 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
116 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
117 cNames, lcid, rgDispId);
120 static HRESULT WINAPI HTMLFrameBase_Invoke(IHTMLFrameBase *iface, DISPID dispIdMember,
121 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
122 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
124 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
126 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
127 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
130 static HRESULT WINAPI HTMLFrameBase_put_src(IHTMLFrameBase *iface, BSTR v)
132 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
134 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
136 if(!This->content_window || !This->element.node.doc || !This->element.node.doc->basedoc.window) {
137 nsAString nsstr;
138 nsresult nsres;
140 nsAString_InitDepend(&nsstr, v);
141 if(This->nsframe)
142 nsres = nsIDOMHTMLFrameElement_SetSrc(This->nsframe, &nsstr);
143 else
144 nsres = nsIDOMHTMLIFrameElement_SetSrc(This->nsiframe, &nsstr);
145 nsAString_Finish(&nsstr);
146 if(NS_FAILED(nsres)) {
147 ERR("SetSrc failed: %08x\n", nsres);
148 return E_FAIL;
151 return S_OK;
154 return navigate_url(This->content_window, v, This->element.node.doc->basedoc.window->uri, BINDING_NAVIGATED);
157 static HRESULT WINAPI HTMLFrameBase_get_src(IHTMLFrameBase *iface, BSTR *p)
159 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
160 nsAString nsstr;
161 nsresult nsres;
163 TRACE("(%p)->(%p)\n", This, p);
165 if(!This->nsframe && !This->nsiframe) {
166 ERR("No attached frame object\n");
167 return E_UNEXPECTED;
170 nsAString_Init(&nsstr, NULL);
171 if(This->nsframe)
172 nsres = nsIDOMHTMLFrameElement_GetSrc(This->nsframe, &nsstr);
173 else
174 nsres = nsIDOMHTMLIFrameElement_GetSrc(This->nsiframe, &nsstr);
175 return return_nsstr(nsres, &nsstr, p);
178 static HRESULT WINAPI HTMLFrameBase_put_name(IHTMLFrameBase *iface, BSTR v)
180 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
181 nsAString name_str;
182 nsresult nsres;
184 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
186 if(!This->nsframe && !This->nsiframe) {
187 ERR("No attached ns frame object\n");
188 return E_UNEXPECTED;
191 nsAString_InitDepend(&name_str, v);
192 if(This->nsframe)
193 nsres = nsIDOMHTMLFrameElement_SetName(This->nsframe, &name_str);
194 else
195 nsres = nsIDOMHTMLIFrameElement_SetName(This->nsiframe, &name_str);
196 nsAString_Finish(&name_str);
197 if(NS_FAILED(nsres)) {
198 ERR("SetName failed: %08x\n", nsres);
199 return E_FAIL;
202 return S_OK;
205 static HRESULT WINAPI HTMLFrameBase_get_name(IHTMLFrameBase *iface, BSTR *p)
207 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
208 nsAString nsstr;
209 nsresult nsres;
211 TRACE("(%p)->(%p)\n", This, p);
213 if(!This->nsframe && !This->nsiframe) {
214 ERR("No attached ns frame object\n");
215 return E_UNEXPECTED;
218 nsAString_Init(&nsstr, NULL);
219 if(This->nsframe)
220 nsres = nsIDOMHTMLFrameElement_GetName(This->nsframe, &nsstr);
221 else
222 nsres = nsIDOMHTMLIFrameElement_GetName(This->nsiframe, &nsstr);
223 return return_nsstr(nsres, &nsstr, p);
226 static HRESULT WINAPI HTMLFrameBase_put_border(IHTMLFrameBase *iface, VARIANT v)
228 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
229 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
230 return E_NOTIMPL;
233 static HRESULT WINAPI HTMLFrameBase_get_border(IHTMLFrameBase *iface, VARIANT *p)
235 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
236 FIXME("(%p)->(%p)\n", This, p);
237 return E_NOTIMPL;
240 static HRESULT WINAPI HTMLFrameBase_put_frameBorder(IHTMLFrameBase *iface, BSTR v)
242 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
243 nsAString nsstr;
244 nsresult nsres;
246 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
248 if(!This->nsframe && !This->nsiframe) {
249 ERR("No attached ns frame object\n");
250 return E_UNEXPECTED;
253 nsAString_InitDepend(&nsstr, v);
254 if(This->nsframe)
255 nsres = nsIDOMHTMLFrameElement_SetFrameBorder(This->nsframe, &nsstr);
256 else
257 nsres = nsIDOMHTMLIFrameElement_SetFrameBorder(This->nsiframe, &nsstr);
258 nsAString_Finish(&nsstr);
259 if(NS_FAILED(nsres)) {
260 ERR("SetFrameBorder failed: %08x\n", nsres);
261 return E_FAIL;
264 return S_OK;
267 static HRESULT WINAPI HTMLFrameBase_get_frameBorder(IHTMLFrameBase *iface, BSTR *p)
269 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
270 nsAString nsstr;
271 nsresult nsres;
273 TRACE("(%p)->(%p)\n", This, p);
275 if(!This->nsframe && !This->nsiframe) {
276 ERR("No attached ns frame object\n");
277 return E_UNEXPECTED;
280 nsAString_Init(&nsstr, NULL);
281 if(This->nsframe)
282 nsres = nsIDOMHTMLFrameElement_GetFrameBorder(This->nsframe, &nsstr);
283 else
284 nsres = nsIDOMHTMLIFrameElement_GetFrameBorder(This->nsiframe, &nsstr);
285 return return_nsstr(nsres, &nsstr, p);
288 static HRESULT WINAPI HTMLFrameBase_put_frameSpacing(IHTMLFrameBase *iface, VARIANT v)
290 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
291 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
292 return E_NOTIMPL;
295 static HRESULT WINAPI HTMLFrameBase_get_frameSpacing(IHTMLFrameBase *iface, VARIANT *p)
297 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
298 FIXME("(%p)->(%p)\n", This, p);
299 return E_NOTIMPL;
302 static HRESULT WINAPI HTMLFrameBase_put_marginWidth(IHTMLFrameBase *iface, VARIANT v)
304 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
305 nsAString nsstr;
306 nsresult nsres;
308 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
310 if(V_VT(&v) != VT_BSTR) {
311 FIXME("unsupported %s\n", debugstr_variant(&v));
312 return E_NOTIMPL;
315 nsAString_InitDepend(&nsstr, V_BSTR(&v));
316 if(This->nsframe)
317 nsres = nsIDOMHTMLFrameElement_SetMarginWidth(This->nsframe, &nsstr);
318 else
319 nsres = nsIDOMHTMLIFrameElement_SetMarginWidth(This->nsiframe, &nsstr);
320 nsAString_Finish(&nsstr);
321 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
324 static HRESULT WINAPI HTMLFrameBase_get_marginWidth(IHTMLFrameBase *iface, VARIANT *p)
326 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
327 nsAString nsstr;
328 nsresult nsres;
329 HRESULT hres = S_OK;
331 TRACE("(%p)->(%p)\n", This, p);
333 nsAString_Init(&nsstr, NULL);
334 if(This->nsframe)
335 nsres = nsIDOMHTMLFrameElement_GetMarginWidth(This->nsframe, &nsstr);
336 else
337 nsres = nsIDOMHTMLIFrameElement_GetMarginWidth(This->nsiframe, &nsstr);
338 if(NS_SUCCEEDED(nsres)) {
339 const PRUnichar *str, *end;
341 nsAString_GetData(&nsstr, &str);
343 if(*str) {
344 BSTR ret;
346 end = strstrW(str, pxW);
347 if(!end)
348 end = str+strlenW(str);
349 ret = SysAllocStringLen(str, end-str);
350 if(ret) {
351 V_VT(p) = VT_BSTR;
352 V_BSTR(p) = ret;
353 }else {
354 hres = E_OUTOFMEMORY;
356 }else {
357 V_VT(p) = VT_BSTR;
358 V_BSTR(p) = NULL;
360 }else {
361 ERR("GetMarginWidth failed: %08x\n", nsres);
362 hres = E_FAIL;
365 nsAString_Finish(&nsstr);
366 return hres;
369 static HRESULT WINAPI HTMLFrameBase_put_marginHeight(IHTMLFrameBase *iface, VARIANT v)
371 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
372 nsAString nsstr;
373 nsresult nsres;
375 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
377 if(V_VT(&v) != VT_BSTR) {
378 FIXME("unsupported %s\n", debugstr_variant(&v));
379 return E_NOTIMPL;
382 nsAString_InitDepend(&nsstr, V_BSTR(&v));
383 if(This->nsframe)
384 nsres = nsIDOMHTMLFrameElement_SetMarginHeight(This->nsframe, &nsstr);
385 else
386 nsres = nsIDOMHTMLIFrameElement_SetMarginHeight(This->nsiframe, &nsstr);
387 nsAString_Finish(&nsstr);
388 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
391 static HRESULT WINAPI HTMLFrameBase_get_marginHeight(IHTMLFrameBase *iface, VARIANT *p)
393 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
394 nsAString nsstr;
395 nsresult nsres;
396 HRESULT hres = S_OK;
398 TRACE("(%p)->(%p)\n", This, p);
400 nsAString_Init(&nsstr, NULL);
401 if(This->nsframe)
402 nsres = nsIDOMHTMLFrameElement_GetMarginHeight(This->nsframe, &nsstr);
403 else
404 nsres = nsIDOMHTMLIFrameElement_GetMarginHeight(This->nsiframe, &nsstr);
405 if(NS_SUCCEEDED(nsres)) {
406 const PRUnichar *str, *end;
408 nsAString_GetData(&nsstr, &str);
410 if(*str) {
411 BSTR ret;
413 end = strstrW(str, pxW);
414 if(!end)
415 end = str+strlenW(str);
416 ret = SysAllocStringLen(str, end-str);
417 if(ret) {
418 V_VT(p) = VT_BSTR;
419 V_BSTR(p) = ret;
420 }else {
421 hres = E_OUTOFMEMORY;
423 }else {
424 V_VT(p) = VT_BSTR;
425 V_BSTR(p) = NULL;
427 }else {
428 ERR("SetMarginHeight failed: %08x\n", nsres);
429 hres = E_FAIL;
432 nsAString_Finish(&nsstr);
433 return hres;
436 static HRESULT WINAPI HTMLFrameBase_put_noResize(IHTMLFrameBase *iface, VARIANT_BOOL v)
438 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
439 FIXME("(%p)->(%x)\n", This, v);
440 return E_NOTIMPL;
443 static HRESULT WINAPI HTMLFrameBase_get_noResize(IHTMLFrameBase *iface, VARIANT_BOOL *p)
445 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
446 FIXME("(%p)->(%p)\n", This, p);
447 return E_NOTIMPL;
450 static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
452 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
453 nsAString nsstr;
454 nsresult nsres;
456 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
458 if(!(!strcmpiW(v, yesW) || !strcmpiW(v, noW) || !strcmpiW(v, autoW)))
459 return E_INVALIDARG;
461 if(This->nsframe) {
462 nsAString_InitDepend(&nsstr, v);
463 nsres = nsIDOMHTMLFrameElement_SetScrolling(This->nsframe, &nsstr);
464 }else if(This->nsiframe) {
465 nsAString_InitDepend(&nsstr, v);
466 nsres = nsIDOMHTMLIFrameElement_SetScrolling(This->nsiframe, &nsstr);
467 }else {
468 ERR("No attached ns frame object\n");
469 return E_UNEXPECTED;
471 nsAString_Finish(&nsstr);
473 if(NS_FAILED(nsres)) {
474 ERR("SetScrolling failed: 0x%08x\n", nsres);
475 return E_FAIL;
478 return S_OK;
481 static HRESULT WINAPI HTMLFrameBase_get_scrolling(IHTMLFrameBase *iface, BSTR *p)
483 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
484 nsAString nsstr;
485 const PRUnichar *strdata;
486 nsresult nsres;
488 TRACE("(%p)->(%p)\n", This, p);
490 if(This->nsframe) {
491 nsAString_Init(&nsstr, NULL);
492 nsres = nsIDOMHTMLFrameElement_GetScrolling(This->nsframe, &nsstr);
493 }else if(This->nsiframe) {
494 nsAString_Init(&nsstr, NULL);
495 nsres = nsIDOMHTMLIFrameElement_GetScrolling(This->nsiframe, &nsstr);
496 }else {
497 ERR("No attached ns frame object\n");
498 return E_UNEXPECTED;
501 if(NS_FAILED(nsres)) {
502 ERR("GetScrolling failed: 0x%08x\n", nsres);
503 nsAString_Finish(&nsstr);
504 return E_FAIL;
507 nsAString_GetData(&nsstr, &strdata);
509 if(*strdata)
510 *p = SysAllocString(strdata);
511 else
512 *p = SysAllocString(autoW);
514 nsAString_Finish(&nsstr);
516 return *p ? S_OK : E_OUTOFMEMORY;
519 static const IHTMLFrameBaseVtbl HTMLFrameBaseVtbl = {
520 HTMLFrameBase_QueryInterface,
521 HTMLFrameBase_AddRef,
522 HTMLFrameBase_Release,
523 HTMLFrameBase_GetTypeInfoCount,
524 HTMLFrameBase_GetTypeInfo,
525 HTMLFrameBase_GetIDsOfNames,
526 HTMLFrameBase_Invoke,
527 HTMLFrameBase_put_src,
528 HTMLFrameBase_get_src,
529 HTMLFrameBase_put_name,
530 HTMLFrameBase_get_name,
531 HTMLFrameBase_put_border,
532 HTMLFrameBase_get_border,
533 HTMLFrameBase_put_frameBorder,
534 HTMLFrameBase_get_frameBorder,
535 HTMLFrameBase_put_frameSpacing,
536 HTMLFrameBase_get_frameSpacing,
537 HTMLFrameBase_put_marginWidth,
538 HTMLFrameBase_get_marginWidth,
539 HTMLFrameBase_put_marginHeight,
540 HTMLFrameBase_get_marginHeight,
541 HTMLFrameBase_put_noResize,
542 HTMLFrameBase_get_noResize,
543 HTMLFrameBase_put_scrolling,
544 HTMLFrameBase_get_scrolling
547 static inline HTMLFrameBase *impl_from_IHTMLFrameBase2(IHTMLFrameBase2 *iface)
549 return CONTAINING_RECORD(iface, HTMLFrameBase, IHTMLFrameBase2_iface);
552 static HRESULT WINAPI HTMLFrameBase2_QueryInterface(IHTMLFrameBase2 *iface, REFIID riid, void **ppv)
554 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
556 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
559 static ULONG WINAPI HTMLFrameBase2_AddRef(IHTMLFrameBase2 *iface)
561 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
563 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
566 static ULONG WINAPI HTMLFrameBase2_Release(IHTMLFrameBase2 *iface)
568 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
570 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
573 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfoCount(IHTMLFrameBase2 *iface, UINT *pctinfo)
575 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
576 FIXME("(%p)\n", This);
577 return E_NOTIMPL;
580 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfo(IHTMLFrameBase2 *iface, UINT iTInfo,
581 LCID lcid, ITypeInfo **ppTInfo)
583 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
584 FIXME("(%p)\n", This);
585 return E_NOTIMPL;
588 static HRESULT WINAPI HTMLFrameBase2_GetIDsOfNames(IHTMLFrameBase2 *iface, REFIID riid,
589 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
591 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
592 FIXME("(%p)\n", This);
593 return E_NOTIMPL;
596 static HRESULT WINAPI HTMLFrameBase2_Invoke(IHTMLFrameBase2 *iface, DISPID dispIdMember,
597 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
598 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
600 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
601 FIXME("(%p)\n", This);
602 return E_NOTIMPL;
605 static HRESULT WINAPI HTMLFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, IHTMLWindow2 **p)
607 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
609 TRACE("(%p)->(%p)\n", This, p);
611 if(This->content_window) {
612 IHTMLWindow2_AddRef(&This->content_window->base.IHTMLWindow2_iface);
613 *p = &This->content_window->base.IHTMLWindow2_iface;
614 }else {
615 WARN("NULL content window\n");
616 *p = NULL;
618 return S_OK;
621 static HRESULT WINAPI HTMLFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v)
623 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
625 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
627 return set_node_event(&This->element.node, EVENTID_LOAD, &v);
630 static HRESULT WINAPI HTMLFrameBase2_get_onload(IHTMLFrameBase2 *iface, VARIANT *p)
632 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
634 TRACE("(%p)->(%p)\n", This, p);
636 return get_node_event(&This->element.node, EVENTID_LOAD, p);
639 static HRESULT WINAPI HTMLFrameBase2_put_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT v)
641 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
642 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
643 return E_NOTIMPL;
646 static HRESULT WINAPI HTMLFrameBase2_get_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT *p)
648 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
649 FIXME("(%p)->(%p)\n", This, p);
650 return E_NOTIMPL;
653 static HRESULT WINAPI HTMLFrameBase2_get_readyState(IHTMLFrameBase2 *iface, BSTR *p)
655 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
657 TRACE("(%p)->(%p)\n", This, p);
659 if(!This->content_window || !This->content_window->base.inner_window->doc) {
660 FIXME("no document associated\n");
661 return E_FAIL;
664 return IHTMLDocument2_get_readyState(&This->content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface, p);
667 static HRESULT WINAPI HTMLFrameBase2_put_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL v)
669 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
671 FIXME("(%p)->(%x) semi-stub\n", This, v);
673 return S_OK;
676 static HRESULT WINAPI HTMLFrameBase2_get_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL *p)
678 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
680 FIXME("(%p)->(%p) semi-stub\n", This, p);
682 *p = VARIANT_TRUE;
683 return S_OK;
686 static const IHTMLFrameBase2Vtbl HTMLFrameBase2Vtbl = {
687 HTMLFrameBase2_QueryInterface,
688 HTMLFrameBase2_AddRef,
689 HTMLFrameBase2_Release,
690 HTMLFrameBase2_GetTypeInfoCount,
691 HTMLFrameBase2_GetTypeInfo,
692 HTMLFrameBase2_GetIDsOfNames,
693 HTMLFrameBase2_Invoke,
694 HTMLFrameBase2_get_contentWindow,
695 HTMLFrameBase2_put_onload,
696 HTMLFrameBase2_get_onload,
697 HTMLFrameBase2_put_onreadystatechange,
698 HTMLFrameBase2_get_onreadystatechange,
699 HTMLFrameBase2_get_readyState,
700 HTMLFrameBase2_put_allowTransparency,
701 HTMLFrameBase2_get_allowTransparency
704 HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv)
706 if(IsEqualGUID(&IID_IHTMLFrameBase, riid)) {
707 TRACE("(%p)->(IID_IHTMLFrameBase %p)\n", This, ppv);
708 *ppv = &This->IHTMLFrameBase_iface;
709 }else if(IsEqualGUID(&IID_IHTMLFrameBase2, riid)) {
710 TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This, ppv);
711 *ppv = &This->IHTMLFrameBase2_iface;
712 }else {
713 return HTMLElement_QI(&This->element.node, riid, ppv);
716 IUnknown_AddRef((IUnknown*)*ppv);
717 return S_OK;
720 void HTMLFrameBase_destructor(HTMLFrameBase *This)
722 if(This->content_window)
723 This->content_window->frame_element = NULL;
725 HTMLElement_destructor(&This->element.node);
728 void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
729 dispex_static_data_t *dispex_data)
731 nsresult nsres;
733 This->IHTMLFrameBase_iface.lpVtbl = &HTMLFrameBaseVtbl;
734 This->IHTMLFrameBase2_iface.lpVtbl = &HTMLFrameBase2Vtbl;
736 HTMLElement_Init(&This->element, doc, nselem, dispex_data);
738 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFrameElement, (void**)&This->nsframe);
739 if(NS_FAILED(nsres)) {
740 This->nsframe = NULL;
741 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&This->nsiframe);
742 assert(nsres == NS_OK);
743 }else {
744 This->nsiframe = NULL;