configure: Add a check for sys/ucontext.h and include it where appropriate.
[wine.git] / dlls / mshtml / htmlframebase.c
blob380691fd1a69e232af3caf94c5aea65ec3cc5147
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.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.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.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.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 FIXME("detached element\n");
138 return E_FAIL;
141 return navigate_url(This->content_window, v, This->element.node.doc->basedoc.window->uri, BINDING_NAVIGATED);
144 static HRESULT WINAPI HTMLFrameBase_get_src(IHTMLFrameBase *iface, BSTR *p)
146 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
147 FIXME("(%p)->(%p)\n", This, p);
148 return E_NOTIMPL;
151 static HRESULT WINAPI HTMLFrameBase_put_name(IHTMLFrameBase *iface, BSTR v)
153 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
154 nsAString name_str;
155 nsresult nsres;
157 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
159 if(!This->nsframe && !This->nsiframe) {
160 ERR("No attached ns frame object\n");
161 return E_UNEXPECTED;
164 nsAString_InitDepend(&name_str, v);
165 if(This->nsframe)
166 nsres = nsIDOMHTMLFrameElement_SetName(This->nsframe, &name_str);
167 else
168 nsres = nsIDOMHTMLIFrameElement_SetName(This->nsiframe, &name_str);
169 nsAString_Finish(&name_str);
170 if(NS_FAILED(nsres)) {
171 ERR("SetName failed: %08x\n", nsres);
172 return E_FAIL;
175 return S_OK;
178 static HRESULT WINAPI HTMLFrameBase_get_name(IHTMLFrameBase *iface, BSTR *p)
180 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
181 nsAString nsstr;
182 nsresult nsres;
184 TRACE("(%p)->(%p)\n", This, p);
186 if(!This->nsframe && !This->nsiframe) {
187 ERR("No attached ns frame object\n");
188 return E_UNEXPECTED;
191 nsAString_Init(&nsstr, NULL);
192 if(This->nsframe)
193 nsres = nsIDOMHTMLFrameElement_GetName(This->nsframe, &nsstr);
194 else
195 nsres = nsIDOMHTMLIFrameElement_GetName(This->nsiframe, &nsstr);
196 return return_nsstr(nsres, &nsstr, p);
199 static HRESULT WINAPI HTMLFrameBase_put_border(IHTMLFrameBase *iface, VARIANT v)
201 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
202 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
203 return E_NOTIMPL;
206 static HRESULT WINAPI HTMLFrameBase_get_border(IHTMLFrameBase *iface, VARIANT *p)
208 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
209 FIXME("(%p)->(%p)\n", This, p);
210 return E_NOTIMPL;
213 static HRESULT WINAPI HTMLFrameBase_put_frameBorder(IHTMLFrameBase *iface, BSTR v)
215 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
216 nsAString nsstr;
217 nsresult nsres;
219 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
221 if(!This->nsframe && !This->nsiframe) {
222 ERR("No attached ns frame object\n");
223 return E_UNEXPECTED;
226 nsAString_InitDepend(&nsstr, v);
227 if(This->nsframe)
228 nsres = nsIDOMHTMLFrameElement_SetFrameBorder(This->nsframe, &nsstr);
229 else
230 nsres = nsIDOMHTMLIFrameElement_SetFrameBorder(This->nsiframe, &nsstr);
231 nsAString_Finish(&nsstr);
232 if(NS_FAILED(nsres)) {
233 ERR("SetFrameBorder failed: %08x\n", nsres);
234 return E_FAIL;
237 return S_OK;
240 static HRESULT WINAPI HTMLFrameBase_get_frameBorder(IHTMLFrameBase *iface, BSTR *p)
242 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
243 nsAString nsstr;
244 nsresult nsres;
246 TRACE("(%p)->(%p)\n", This, p);
248 if(!This->nsframe && !This->nsiframe) {
249 ERR("No attached ns frame object\n");
250 return E_UNEXPECTED;
253 nsAString_Init(&nsstr, NULL);
254 if(This->nsframe)
255 nsres = nsIDOMHTMLFrameElement_GetFrameBorder(This->nsframe, &nsstr);
256 else
257 nsres = nsIDOMHTMLIFrameElement_GetFrameBorder(This->nsiframe, &nsstr);
258 return return_nsstr(nsres, &nsstr, p);
261 static HRESULT WINAPI HTMLFrameBase_put_frameSpacing(IHTMLFrameBase *iface, VARIANT v)
263 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
264 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
265 return E_NOTIMPL;
268 static HRESULT WINAPI HTMLFrameBase_get_frameSpacing(IHTMLFrameBase *iface, VARIANT *p)
270 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
271 FIXME("(%p)->(%p)\n", This, p);
272 return E_NOTIMPL;
275 static HRESULT WINAPI HTMLFrameBase_put_marginWidth(IHTMLFrameBase *iface, VARIANT v)
277 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
278 nsAString nsstr;
279 nsresult nsres;
281 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
283 if(V_VT(&v) != VT_BSTR) {
284 FIXME("unsupported %s\n", debugstr_variant(&v));
285 return E_NOTIMPL;
288 nsAString_InitDepend(&nsstr, V_BSTR(&v));
289 if(This->nsframe)
290 nsres = nsIDOMHTMLFrameElement_SetMarginWidth(This->nsframe, &nsstr);
291 else
292 nsres = nsIDOMHTMLIFrameElement_SetMarginWidth(This->nsiframe, &nsstr);
293 nsAString_Finish(&nsstr);
294 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
297 static HRESULT WINAPI HTMLFrameBase_get_marginWidth(IHTMLFrameBase *iface, VARIANT *p)
299 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
300 nsAString nsstr;
301 nsresult nsres;
302 HRESULT hres = S_OK;
304 TRACE("(%p)->(%p)\n", This, p);
306 nsAString_Init(&nsstr, NULL);
307 if(This->nsframe)
308 nsres = nsIDOMHTMLFrameElement_GetMarginWidth(This->nsframe, &nsstr);
309 else
310 nsres = nsIDOMHTMLIFrameElement_GetMarginWidth(This->nsiframe, &nsstr);
311 if(NS_SUCCEEDED(nsres)) {
312 const PRUnichar *str, *end;
314 nsAString_GetData(&nsstr, &str);
316 if(*str) {
317 BSTR ret;
319 end = strstrW(str, pxW);
320 if(!end)
321 end = str+strlenW(str);
322 ret = SysAllocStringLen(str, end-str);
323 if(ret) {
324 V_VT(p) = VT_BSTR;
325 V_BSTR(p) = ret;
326 }else {
327 hres = E_OUTOFMEMORY;
329 }else {
330 V_VT(p) = VT_BSTR;
331 V_BSTR(p) = NULL;
333 }else {
334 ERR("GetMarginWidth failed: %08x\n", nsres);
335 hres = E_FAIL;
338 nsAString_Finish(&nsstr);
339 return hres;
342 static HRESULT WINAPI HTMLFrameBase_put_marginHeight(IHTMLFrameBase *iface, VARIANT v)
344 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
345 nsAString nsstr;
346 nsresult nsres;
348 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
350 if(V_VT(&v) != VT_BSTR) {
351 FIXME("unsupported %s\n", debugstr_variant(&v));
352 return E_NOTIMPL;
355 nsAString_InitDepend(&nsstr, V_BSTR(&v));
356 if(This->nsframe)
357 nsres = nsIDOMHTMLFrameElement_SetMarginHeight(This->nsframe, &nsstr);
358 else
359 nsres = nsIDOMHTMLIFrameElement_SetMarginHeight(This->nsiframe, &nsstr);
360 nsAString_Finish(&nsstr);
361 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
364 static HRESULT WINAPI HTMLFrameBase_get_marginHeight(IHTMLFrameBase *iface, VARIANT *p)
366 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
367 nsAString nsstr;
368 nsresult nsres;
369 HRESULT hres = S_OK;
371 TRACE("(%p)->(%p)\n", This, p);
373 nsAString_Init(&nsstr, NULL);
374 if(This->nsframe)
375 nsres = nsIDOMHTMLFrameElement_GetMarginHeight(This->nsframe, &nsstr);
376 else
377 nsres = nsIDOMHTMLIFrameElement_GetMarginHeight(This->nsiframe, &nsstr);
378 if(NS_SUCCEEDED(nsres)) {
379 const PRUnichar *str, *end;
381 nsAString_GetData(&nsstr, &str);
383 if(*str) {
384 BSTR ret;
386 end = strstrW(str, pxW);
387 if(!end)
388 end = str+strlenW(str);
389 ret = SysAllocStringLen(str, end-str);
390 if(ret) {
391 V_VT(p) = VT_BSTR;
392 V_BSTR(p) = ret;
393 }else {
394 hres = E_OUTOFMEMORY;
396 }else {
397 V_VT(p) = VT_BSTR;
398 V_BSTR(p) = NULL;
400 }else {
401 ERR("SetMarginHeight failed: %08x\n", nsres);
402 hres = E_FAIL;
405 nsAString_Finish(&nsstr);
406 return hres;
409 static HRESULT WINAPI HTMLFrameBase_put_noResize(IHTMLFrameBase *iface, VARIANT_BOOL v)
411 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
412 FIXME("(%p)->(%x)\n", This, v);
413 return E_NOTIMPL;
416 static HRESULT WINAPI HTMLFrameBase_get_noResize(IHTMLFrameBase *iface, VARIANT_BOOL *p)
418 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
419 FIXME("(%p)->(%p)\n", This, p);
420 return E_NOTIMPL;
423 static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
425 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
426 nsAString nsstr;
427 nsresult nsres;
429 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
431 if(!(!strcmpiW(v, yesW) || !strcmpiW(v, noW) || !strcmpiW(v, autoW)))
432 return E_INVALIDARG;
434 if(This->nsframe) {
435 nsAString_InitDepend(&nsstr, v);
436 nsres = nsIDOMHTMLFrameElement_SetScrolling(This->nsframe, &nsstr);
437 }else if(This->nsiframe) {
438 nsAString_InitDepend(&nsstr, v);
439 nsres = nsIDOMHTMLIFrameElement_SetScrolling(This->nsiframe, &nsstr);
440 }else {
441 ERR("No attached ns frame object\n");
442 return E_UNEXPECTED;
444 nsAString_Finish(&nsstr);
446 if(NS_FAILED(nsres)) {
447 ERR("SetScrolling failed: 0x%08x\n", nsres);
448 return E_FAIL;
451 return S_OK;
454 static HRESULT WINAPI HTMLFrameBase_get_scrolling(IHTMLFrameBase *iface, BSTR *p)
456 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
457 nsAString nsstr;
458 const PRUnichar *strdata;
459 nsresult nsres;
461 TRACE("(%p)->(%p)\n", This, p);
463 if(This->nsframe) {
464 nsAString_Init(&nsstr, NULL);
465 nsres = nsIDOMHTMLFrameElement_GetScrolling(This->nsframe, &nsstr);
466 }else if(This->nsiframe) {
467 nsAString_Init(&nsstr, NULL);
468 nsres = nsIDOMHTMLIFrameElement_GetScrolling(This->nsiframe, &nsstr);
469 }else {
470 ERR("No attached ns frame object\n");
471 return E_UNEXPECTED;
474 if(NS_FAILED(nsres)) {
475 ERR("GetScrolling failed: 0x%08x\n", nsres);
476 nsAString_Finish(&nsstr);
477 return E_FAIL;
480 nsAString_GetData(&nsstr, &strdata);
482 if(*strdata)
483 *p = SysAllocString(strdata);
484 else
485 *p = SysAllocString(autoW);
487 nsAString_Finish(&nsstr);
489 return *p ? S_OK : E_OUTOFMEMORY;
492 static const IHTMLFrameBaseVtbl HTMLFrameBaseVtbl = {
493 HTMLFrameBase_QueryInterface,
494 HTMLFrameBase_AddRef,
495 HTMLFrameBase_Release,
496 HTMLFrameBase_GetTypeInfoCount,
497 HTMLFrameBase_GetTypeInfo,
498 HTMLFrameBase_GetIDsOfNames,
499 HTMLFrameBase_Invoke,
500 HTMLFrameBase_put_src,
501 HTMLFrameBase_get_src,
502 HTMLFrameBase_put_name,
503 HTMLFrameBase_get_name,
504 HTMLFrameBase_put_border,
505 HTMLFrameBase_get_border,
506 HTMLFrameBase_put_frameBorder,
507 HTMLFrameBase_get_frameBorder,
508 HTMLFrameBase_put_frameSpacing,
509 HTMLFrameBase_get_frameSpacing,
510 HTMLFrameBase_put_marginWidth,
511 HTMLFrameBase_get_marginWidth,
512 HTMLFrameBase_put_marginHeight,
513 HTMLFrameBase_get_marginHeight,
514 HTMLFrameBase_put_noResize,
515 HTMLFrameBase_get_noResize,
516 HTMLFrameBase_put_scrolling,
517 HTMLFrameBase_get_scrolling
520 static inline HTMLFrameBase *impl_from_IHTMLFrameBase2(IHTMLFrameBase2 *iface)
522 return CONTAINING_RECORD(iface, HTMLFrameBase, IHTMLFrameBase2_iface);
525 static HRESULT WINAPI HTMLFrameBase2_QueryInterface(IHTMLFrameBase2 *iface, REFIID riid, void **ppv)
527 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
529 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
532 static ULONG WINAPI HTMLFrameBase2_AddRef(IHTMLFrameBase2 *iface)
534 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
536 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
539 static ULONG WINAPI HTMLFrameBase2_Release(IHTMLFrameBase2 *iface)
541 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
543 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
546 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfoCount(IHTMLFrameBase2 *iface, UINT *pctinfo)
548 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
549 FIXME("(%p)\n", This);
550 return E_NOTIMPL;
553 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfo(IHTMLFrameBase2 *iface, UINT iTInfo,
554 LCID lcid, ITypeInfo **ppTInfo)
556 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
557 FIXME("(%p)\n", This);
558 return E_NOTIMPL;
561 static HRESULT WINAPI HTMLFrameBase2_GetIDsOfNames(IHTMLFrameBase2 *iface, REFIID riid,
562 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
564 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
565 FIXME("(%p)\n", This);
566 return E_NOTIMPL;
569 static HRESULT WINAPI HTMLFrameBase2_Invoke(IHTMLFrameBase2 *iface, DISPID dispIdMember,
570 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
571 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
573 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
574 FIXME("(%p)\n", This);
575 return E_NOTIMPL;
578 static HRESULT WINAPI HTMLFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, IHTMLWindow2 **p)
580 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
582 TRACE("(%p)->(%p)\n", This, p);
584 if(This->content_window) {
585 IHTMLWindow2_AddRef(&This->content_window->base.IHTMLWindow2_iface);
586 *p = &This->content_window->base.IHTMLWindow2_iface;
587 }else {
588 WARN("NULL content window\n");
589 *p = NULL;
591 return S_OK;
594 static HRESULT WINAPI HTMLFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v)
596 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
598 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
600 return set_node_event(&This->element.node, EVENTID_LOAD, &v);
603 static HRESULT WINAPI HTMLFrameBase2_get_onload(IHTMLFrameBase2 *iface, VARIANT *p)
605 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
607 TRACE("(%p)->(%p)\n", This, p);
609 return get_node_event(&This->element.node, EVENTID_LOAD, p);
612 static HRESULT WINAPI HTMLFrameBase2_put_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT v)
614 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
615 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
616 return E_NOTIMPL;
619 static HRESULT WINAPI HTMLFrameBase2_get_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT *p)
621 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
622 FIXME("(%p)->(%p)\n", This, p);
623 return E_NOTIMPL;
626 static HRESULT WINAPI HTMLFrameBase2_get_readyState(IHTMLFrameBase2 *iface, BSTR *p)
628 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
630 TRACE("(%p)->(%p)\n", This, p);
632 if(!This->content_window || !This->content_window->base.inner_window->doc) {
633 FIXME("no document associated\n");
634 return E_FAIL;
637 return IHTMLDocument2_get_readyState(&This->content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface, p);
640 static HRESULT WINAPI HTMLFrameBase2_put_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL v)
642 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
643 FIXME("(%p)->(%x)\n", This, v);
644 return E_NOTIMPL;
647 static HRESULT WINAPI HTMLFrameBase2_get_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL *p)
649 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
650 FIXME("(%p)->(%p)\n", This, p);
651 return E_NOTIMPL;
654 static const IHTMLFrameBase2Vtbl HTMLFrameBase2Vtbl = {
655 HTMLFrameBase2_QueryInterface,
656 HTMLFrameBase2_AddRef,
657 HTMLFrameBase2_Release,
658 HTMLFrameBase2_GetTypeInfoCount,
659 HTMLFrameBase2_GetTypeInfo,
660 HTMLFrameBase2_GetIDsOfNames,
661 HTMLFrameBase2_Invoke,
662 HTMLFrameBase2_get_contentWindow,
663 HTMLFrameBase2_put_onload,
664 HTMLFrameBase2_get_onload,
665 HTMLFrameBase2_put_onreadystatechange,
666 HTMLFrameBase2_get_onreadystatechange,
667 HTMLFrameBase2_get_readyState,
668 HTMLFrameBase2_put_allowTransparency,
669 HTMLFrameBase2_get_allowTransparency
672 HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv)
674 if(IsEqualGUID(&IID_IHTMLFrameBase, riid)) {
675 TRACE("(%p)->(IID_IHTMLFrameBase %p)\n", This, ppv);
676 *ppv = &This->IHTMLFrameBase_iface;
677 }else if(IsEqualGUID(&IID_IHTMLFrameBase2, riid)) {
678 TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This, ppv);
679 *ppv = &This->IHTMLFrameBase2_iface;
680 }else {
681 return HTMLElement_QI(&This->element.node, riid, ppv);
684 IUnknown_AddRef((IUnknown*)*ppv);
685 return S_OK;
688 void HTMLFrameBase_destructor(HTMLFrameBase *This)
690 if(This->content_window)
691 This->content_window->frame_element = NULL;
693 HTMLElement_destructor(&This->element.node);
696 void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
697 dispex_static_data_t *dispex_data)
699 nsresult nsres;
701 This->IHTMLFrameBase_iface.lpVtbl = &HTMLFrameBaseVtbl;
702 This->IHTMLFrameBase2_iface.lpVtbl = &HTMLFrameBase2Vtbl;
704 HTMLElement_Init(&This->element, doc, nselem, dispex_data);
706 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFrameElement, (void**)&This->nsframe);
707 if(NS_FAILED(nsres)) {
708 This->nsframe = NULL;
709 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&This->nsiframe);
710 assert(nsres == NS_OK && (nsIDOMNode*)This->nsiframe == This->element.node.nsnode);
711 }else {
712 assert((nsIDOMNode*)This->nsframe == This->element.node.nsnode);
713 This->nsiframe = NULL;
716 /* Share the reference with nsnode */
717 nsIDOMNode_Release(This->element.node.nsnode);