comctl32/tooltips: Reset window subclass data when removing tools.
[wine.git] / dlls / mshtml / htmlframebase.c
blob83cf9fcd14e2644249c4b488c75bf4250261c965
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 mozIDOMWindowProxy *mozwindow;
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, &mozwindow);
53 if(NS_FAILED(nsres) || !mozwindow)
54 return E_FAIL;
56 window = mozwindow_to_window(mozwindow);
57 if(!window) {
58 nsIDOMWindow *nswindow;
59 nsres = mozIDOMWindowProxy_QueryInterface(mozwindow, &IID_nsIDOMWindow, (void**)&nswindow);
60 assert(nsres == NS_OK);
62 hres = HTMLOuterWindow_Create(frame->element.node.doc->basedoc.doc_obj, nswindow,
63 frame->element.node.doc->basedoc.window, &window);
64 nsIDOMWindow_Release(nswindow);
66 mozIDOMWindowProxy_Release(mozwindow);
67 if(FAILED(hres))
68 return hres;
70 frame->content_window = window;
71 window->frame_element = frame;
72 return S_OK;
75 static inline HTMLFrameBase *impl_from_IHTMLFrameBase(IHTMLFrameBase *iface)
77 return CONTAINING_RECORD(iface, HTMLFrameBase, IHTMLFrameBase_iface);
80 static HRESULT WINAPI HTMLFrameBase_QueryInterface(IHTMLFrameBase *iface, REFIID riid, void **ppv)
82 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
84 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
87 static ULONG WINAPI HTMLFrameBase_AddRef(IHTMLFrameBase *iface)
89 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
91 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
94 static ULONG WINAPI HTMLFrameBase_Release(IHTMLFrameBase *iface)
96 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
98 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
101 static HRESULT WINAPI HTMLFrameBase_GetTypeInfoCount(IHTMLFrameBase *iface, UINT *pctinfo)
103 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
105 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
108 static HRESULT WINAPI HTMLFrameBase_GetTypeInfo(IHTMLFrameBase *iface, UINT iTInfo,
109 LCID lcid, ITypeInfo **ppTInfo)
111 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
113 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
114 ppTInfo);
117 static HRESULT WINAPI HTMLFrameBase_GetIDsOfNames(IHTMLFrameBase *iface, REFIID riid,
118 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
120 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
122 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
123 cNames, lcid, rgDispId);
126 static HRESULT WINAPI HTMLFrameBase_Invoke(IHTMLFrameBase *iface, DISPID dispIdMember,
127 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
128 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
130 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
132 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
133 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
136 static HRESULT WINAPI HTMLFrameBase_put_src(IHTMLFrameBase *iface, BSTR v)
138 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
140 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
142 if(!This->content_window || !This->element.node.doc || !This->element.node.doc->basedoc.window) {
143 nsAString nsstr;
144 nsresult nsres;
146 nsAString_InitDepend(&nsstr, v);
147 if(This->nsframe)
148 nsres = nsIDOMHTMLFrameElement_SetSrc(This->nsframe, &nsstr);
149 else
150 nsres = nsIDOMHTMLIFrameElement_SetSrc(This->nsiframe, &nsstr);
151 nsAString_Finish(&nsstr);
152 if(NS_FAILED(nsres)) {
153 ERR("SetSrc failed: %08x\n", nsres);
154 return E_FAIL;
157 return S_OK;
160 return navigate_url(This->content_window, v, This->element.node.doc->basedoc.window->uri, BINDING_NAVIGATED);
163 static HRESULT WINAPI HTMLFrameBase_get_src(IHTMLFrameBase *iface, BSTR *p)
165 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
166 nsAString nsstr;
167 nsresult nsres;
169 TRACE("(%p)->(%p)\n", This, p);
171 if(!This->nsframe && !This->nsiframe) {
172 ERR("No attached frame object\n");
173 return E_UNEXPECTED;
176 nsAString_Init(&nsstr, NULL);
177 if(This->nsframe)
178 nsres = nsIDOMHTMLFrameElement_GetSrc(This->nsframe, &nsstr);
179 else
180 nsres = nsIDOMHTMLIFrameElement_GetSrc(This->nsiframe, &nsstr);
181 return return_nsstr(nsres, &nsstr, p);
184 static HRESULT WINAPI HTMLFrameBase_put_name(IHTMLFrameBase *iface, BSTR v)
186 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
187 nsAString name_str;
188 nsresult nsres;
190 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
192 if(!This->nsframe && !This->nsiframe) {
193 ERR("No attached ns frame object\n");
194 return E_UNEXPECTED;
197 nsAString_InitDepend(&name_str, v);
198 if(This->nsframe)
199 nsres = nsIDOMHTMLFrameElement_SetName(This->nsframe, &name_str);
200 else
201 nsres = nsIDOMHTMLIFrameElement_SetName(This->nsiframe, &name_str);
202 nsAString_Finish(&name_str);
203 if(NS_FAILED(nsres)) {
204 ERR("SetName failed: %08x\n", nsres);
205 return E_FAIL;
208 return S_OK;
211 static HRESULT WINAPI HTMLFrameBase_get_name(IHTMLFrameBase *iface, BSTR *p)
213 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
214 nsAString nsstr;
215 nsresult nsres;
217 TRACE("(%p)->(%p)\n", This, p);
219 if(!This->nsframe && !This->nsiframe) {
220 ERR("No attached ns frame object\n");
221 return E_UNEXPECTED;
224 nsAString_Init(&nsstr, NULL);
225 if(This->nsframe)
226 nsres = nsIDOMHTMLFrameElement_GetName(This->nsframe, &nsstr);
227 else
228 nsres = nsIDOMHTMLIFrameElement_GetName(This->nsiframe, &nsstr);
229 return return_nsstr(nsres, &nsstr, p);
232 static HRESULT WINAPI HTMLFrameBase_put_border(IHTMLFrameBase *iface, VARIANT v)
234 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
235 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
236 return E_NOTIMPL;
239 static HRESULT WINAPI HTMLFrameBase_get_border(IHTMLFrameBase *iface, VARIANT *p)
241 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
242 FIXME("(%p)->(%p)\n", This, p);
243 return E_NOTIMPL;
246 static HRESULT WINAPI HTMLFrameBase_put_frameBorder(IHTMLFrameBase *iface, BSTR v)
248 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
249 nsAString nsstr;
250 nsresult nsres;
252 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
254 if(!This->nsframe && !This->nsiframe) {
255 ERR("No attached ns frame object\n");
256 return E_UNEXPECTED;
259 nsAString_InitDepend(&nsstr, v);
260 if(This->nsframe)
261 nsres = nsIDOMHTMLFrameElement_SetFrameBorder(This->nsframe, &nsstr);
262 else
263 nsres = nsIDOMHTMLIFrameElement_SetFrameBorder(This->nsiframe, &nsstr);
264 nsAString_Finish(&nsstr);
265 if(NS_FAILED(nsres)) {
266 ERR("SetFrameBorder failed: %08x\n", nsres);
267 return E_FAIL;
270 return S_OK;
273 static HRESULT WINAPI HTMLFrameBase_get_frameBorder(IHTMLFrameBase *iface, BSTR *p)
275 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
276 nsAString nsstr;
277 nsresult nsres;
279 TRACE("(%p)->(%p)\n", This, p);
281 if(!This->nsframe && !This->nsiframe) {
282 ERR("No attached ns frame object\n");
283 return E_UNEXPECTED;
286 nsAString_Init(&nsstr, NULL);
287 if(This->nsframe)
288 nsres = nsIDOMHTMLFrameElement_GetFrameBorder(This->nsframe, &nsstr);
289 else
290 nsres = nsIDOMHTMLIFrameElement_GetFrameBorder(This->nsiframe, &nsstr);
291 return return_nsstr(nsres, &nsstr, p);
294 static HRESULT WINAPI HTMLFrameBase_put_frameSpacing(IHTMLFrameBase *iface, VARIANT v)
296 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
297 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
298 return E_NOTIMPL;
301 static HRESULT WINAPI HTMLFrameBase_get_frameSpacing(IHTMLFrameBase *iface, VARIANT *p)
303 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
304 FIXME("(%p)->(%p)\n", This, p);
305 return E_NOTIMPL;
308 static HRESULT WINAPI HTMLFrameBase_put_marginWidth(IHTMLFrameBase *iface, VARIANT v)
310 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
311 nsAString nsstr;
312 nsresult nsres;
314 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
316 if(V_VT(&v) != VT_BSTR) {
317 FIXME("unsupported %s\n", debugstr_variant(&v));
318 return E_NOTIMPL;
321 nsAString_InitDepend(&nsstr, V_BSTR(&v));
322 if(This->nsframe)
323 nsres = nsIDOMHTMLFrameElement_SetMarginWidth(This->nsframe, &nsstr);
324 else
325 nsres = nsIDOMHTMLIFrameElement_SetMarginWidth(This->nsiframe, &nsstr);
326 nsAString_Finish(&nsstr);
327 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
330 static HRESULT WINAPI HTMLFrameBase_get_marginWidth(IHTMLFrameBase *iface, VARIANT *p)
332 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
333 nsAString nsstr;
334 nsresult nsres;
335 HRESULT hres = S_OK;
337 TRACE("(%p)->(%p)\n", This, p);
339 nsAString_Init(&nsstr, NULL);
340 if(This->nsframe)
341 nsres = nsIDOMHTMLFrameElement_GetMarginWidth(This->nsframe, &nsstr);
342 else
343 nsres = nsIDOMHTMLIFrameElement_GetMarginWidth(This->nsiframe, &nsstr);
344 if(NS_SUCCEEDED(nsres)) {
345 const PRUnichar *str, *end;
347 nsAString_GetData(&nsstr, &str);
349 if(*str) {
350 BSTR ret;
352 end = strstrW(str, pxW);
353 if(!end)
354 end = str+strlenW(str);
355 ret = SysAllocStringLen(str, end-str);
356 if(ret) {
357 V_VT(p) = VT_BSTR;
358 V_BSTR(p) = ret;
359 }else {
360 hres = E_OUTOFMEMORY;
362 }else {
363 V_VT(p) = VT_BSTR;
364 V_BSTR(p) = NULL;
366 }else {
367 ERR("GetMarginWidth failed: %08x\n", nsres);
368 hres = E_FAIL;
371 nsAString_Finish(&nsstr);
372 return hres;
375 static HRESULT WINAPI HTMLFrameBase_put_marginHeight(IHTMLFrameBase *iface, VARIANT v)
377 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
378 nsAString nsstr;
379 nsresult nsres;
381 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
383 if(V_VT(&v) != VT_BSTR) {
384 FIXME("unsupported %s\n", debugstr_variant(&v));
385 return E_NOTIMPL;
388 nsAString_InitDepend(&nsstr, V_BSTR(&v));
389 if(This->nsframe)
390 nsres = nsIDOMHTMLFrameElement_SetMarginHeight(This->nsframe, &nsstr);
391 else
392 nsres = nsIDOMHTMLIFrameElement_SetMarginHeight(This->nsiframe, &nsstr);
393 nsAString_Finish(&nsstr);
394 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
397 static HRESULT WINAPI HTMLFrameBase_get_marginHeight(IHTMLFrameBase *iface, VARIANT *p)
399 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
400 nsAString nsstr;
401 nsresult nsres;
402 HRESULT hres = S_OK;
404 TRACE("(%p)->(%p)\n", This, p);
406 nsAString_Init(&nsstr, NULL);
407 if(This->nsframe)
408 nsres = nsIDOMHTMLFrameElement_GetMarginHeight(This->nsframe, &nsstr);
409 else
410 nsres = nsIDOMHTMLIFrameElement_GetMarginHeight(This->nsiframe, &nsstr);
411 if(NS_SUCCEEDED(nsres)) {
412 const PRUnichar *str, *end;
414 nsAString_GetData(&nsstr, &str);
416 if(*str) {
417 BSTR ret;
419 end = strstrW(str, pxW);
420 if(!end)
421 end = str+strlenW(str);
422 ret = SysAllocStringLen(str, end-str);
423 if(ret) {
424 V_VT(p) = VT_BSTR;
425 V_BSTR(p) = ret;
426 }else {
427 hres = E_OUTOFMEMORY;
429 }else {
430 V_VT(p) = VT_BSTR;
431 V_BSTR(p) = NULL;
433 }else {
434 ERR("SetMarginHeight failed: %08x\n", nsres);
435 hres = E_FAIL;
438 nsAString_Finish(&nsstr);
439 return hres;
442 static HRESULT WINAPI HTMLFrameBase_put_noResize(IHTMLFrameBase *iface, VARIANT_BOOL v)
444 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
445 FIXME("(%p)->(%x)\n", This, v);
446 return E_NOTIMPL;
449 static HRESULT WINAPI HTMLFrameBase_get_noResize(IHTMLFrameBase *iface, VARIANT_BOOL *p)
451 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
452 FIXME("(%p)->(%p)\n", This, p);
453 return E_NOTIMPL;
456 static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
458 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
459 nsAString nsstr;
460 nsresult nsres;
462 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
464 if(!(!strcmpiW(v, yesW) || !strcmpiW(v, noW) || !strcmpiW(v, autoW)))
465 return E_INVALIDARG;
467 if(This->nsframe) {
468 nsAString_InitDepend(&nsstr, v);
469 nsres = nsIDOMHTMLFrameElement_SetScrolling(This->nsframe, &nsstr);
470 }else if(This->nsiframe) {
471 nsAString_InitDepend(&nsstr, v);
472 nsres = nsIDOMHTMLIFrameElement_SetScrolling(This->nsiframe, &nsstr);
473 }else {
474 ERR("No attached ns frame object\n");
475 return E_UNEXPECTED;
477 nsAString_Finish(&nsstr);
479 if(NS_FAILED(nsres)) {
480 ERR("SetScrolling failed: 0x%08x\n", nsres);
481 return E_FAIL;
484 return S_OK;
487 static HRESULT WINAPI HTMLFrameBase_get_scrolling(IHTMLFrameBase *iface, BSTR *p)
489 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
490 nsAString nsstr;
491 const PRUnichar *strdata;
492 nsresult nsres;
494 TRACE("(%p)->(%p)\n", This, p);
496 if(This->nsframe) {
497 nsAString_Init(&nsstr, NULL);
498 nsres = nsIDOMHTMLFrameElement_GetScrolling(This->nsframe, &nsstr);
499 }else if(This->nsiframe) {
500 nsAString_Init(&nsstr, NULL);
501 nsres = nsIDOMHTMLIFrameElement_GetScrolling(This->nsiframe, &nsstr);
502 }else {
503 ERR("No attached ns frame object\n");
504 return E_UNEXPECTED;
507 if(NS_FAILED(nsres)) {
508 ERR("GetScrolling failed: 0x%08x\n", nsres);
509 nsAString_Finish(&nsstr);
510 return E_FAIL;
513 nsAString_GetData(&nsstr, &strdata);
515 if(*strdata)
516 *p = SysAllocString(strdata);
517 else
518 *p = SysAllocString(autoW);
520 nsAString_Finish(&nsstr);
522 return *p ? S_OK : E_OUTOFMEMORY;
525 static const IHTMLFrameBaseVtbl HTMLFrameBaseVtbl = {
526 HTMLFrameBase_QueryInterface,
527 HTMLFrameBase_AddRef,
528 HTMLFrameBase_Release,
529 HTMLFrameBase_GetTypeInfoCount,
530 HTMLFrameBase_GetTypeInfo,
531 HTMLFrameBase_GetIDsOfNames,
532 HTMLFrameBase_Invoke,
533 HTMLFrameBase_put_src,
534 HTMLFrameBase_get_src,
535 HTMLFrameBase_put_name,
536 HTMLFrameBase_get_name,
537 HTMLFrameBase_put_border,
538 HTMLFrameBase_get_border,
539 HTMLFrameBase_put_frameBorder,
540 HTMLFrameBase_get_frameBorder,
541 HTMLFrameBase_put_frameSpacing,
542 HTMLFrameBase_get_frameSpacing,
543 HTMLFrameBase_put_marginWidth,
544 HTMLFrameBase_get_marginWidth,
545 HTMLFrameBase_put_marginHeight,
546 HTMLFrameBase_get_marginHeight,
547 HTMLFrameBase_put_noResize,
548 HTMLFrameBase_get_noResize,
549 HTMLFrameBase_put_scrolling,
550 HTMLFrameBase_get_scrolling
553 static inline HTMLFrameBase *impl_from_IHTMLFrameBase2(IHTMLFrameBase2 *iface)
555 return CONTAINING_RECORD(iface, HTMLFrameBase, IHTMLFrameBase2_iface);
558 static HRESULT WINAPI HTMLFrameBase2_QueryInterface(IHTMLFrameBase2 *iface, REFIID riid, void **ppv)
560 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
562 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
565 static ULONG WINAPI HTMLFrameBase2_AddRef(IHTMLFrameBase2 *iface)
567 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
569 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
572 static ULONG WINAPI HTMLFrameBase2_Release(IHTMLFrameBase2 *iface)
574 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
576 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
579 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfoCount(IHTMLFrameBase2 *iface, UINT *pctinfo)
581 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
582 FIXME("(%p)\n", This);
583 return E_NOTIMPL;
586 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfo(IHTMLFrameBase2 *iface, UINT iTInfo,
587 LCID lcid, ITypeInfo **ppTInfo)
589 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
590 FIXME("(%p)\n", This);
591 return E_NOTIMPL;
594 static HRESULT WINAPI HTMLFrameBase2_GetIDsOfNames(IHTMLFrameBase2 *iface, REFIID riid,
595 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
597 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
598 FIXME("(%p)\n", This);
599 return E_NOTIMPL;
602 static HRESULT WINAPI HTMLFrameBase2_Invoke(IHTMLFrameBase2 *iface, DISPID dispIdMember,
603 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
604 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
606 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
607 FIXME("(%p)\n", This);
608 return E_NOTIMPL;
611 static HRESULT WINAPI HTMLFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, IHTMLWindow2 **p)
613 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
615 TRACE("(%p)->(%p)\n", This, p);
617 if(This->content_window) {
618 IHTMLWindow2_AddRef(&This->content_window->base.IHTMLWindow2_iface);
619 *p = &This->content_window->base.IHTMLWindow2_iface;
620 }else {
621 WARN("NULL content window\n");
622 *p = NULL;
624 return S_OK;
627 static HRESULT WINAPI HTMLFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v)
629 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
631 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
633 return set_node_event(&This->element.node, EVENTID_LOAD, &v);
636 static HRESULT WINAPI HTMLFrameBase2_get_onload(IHTMLFrameBase2 *iface, VARIANT *p)
638 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
640 TRACE("(%p)->(%p)\n", This, p);
642 return get_node_event(&This->element.node, EVENTID_LOAD, p);
645 static HRESULT WINAPI HTMLFrameBase2_put_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT v)
647 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
648 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
649 return E_NOTIMPL;
652 static HRESULT WINAPI HTMLFrameBase2_get_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT *p)
654 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
655 FIXME("(%p)->(%p)\n", This, p);
656 return E_NOTIMPL;
659 static HRESULT WINAPI HTMLFrameBase2_get_readyState(IHTMLFrameBase2 *iface, BSTR *p)
661 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
663 TRACE("(%p)->(%p)\n", This, p);
665 if(!This->content_window || !This->content_window->base.inner_window->doc) {
666 FIXME("no document associated\n");
667 return E_FAIL;
670 return IHTMLDocument2_get_readyState(&This->content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface, p);
673 static HRESULT WINAPI HTMLFrameBase2_put_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL v)
675 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
677 FIXME("(%p)->(%x) semi-stub\n", This, v);
679 return S_OK;
682 static HRESULT WINAPI HTMLFrameBase2_get_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL *p)
684 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
686 FIXME("(%p)->(%p) semi-stub\n", This, p);
688 *p = VARIANT_TRUE;
689 return S_OK;
692 static const IHTMLFrameBase2Vtbl HTMLFrameBase2Vtbl = {
693 HTMLFrameBase2_QueryInterface,
694 HTMLFrameBase2_AddRef,
695 HTMLFrameBase2_Release,
696 HTMLFrameBase2_GetTypeInfoCount,
697 HTMLFrameBase2_GetTypeInfo,
698 HTMLFrameBase2_GetIDsOfNames,
699 HTMLFrameBase2_Invoke,
700 HTMLFrameBase2_get_contentWindow,
701 HTMLFrameBase2_put_onload,
702 HTMLFrameBase2_get_onload,
703 HTMLFrameBase2_put_onreadystatechange,
704 HTMLFrameBase2_get_onreadystatechange,
705 HTMLFrameBase2_get_readyState,
706 HTMLFrameBase2_put_allowTransparency,
707 HTMLFrameBase2_get_allowTransparency
710 HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv)
712 if(IsEqualGUID(&IID_IHTMLFrameBase, riid)) {
713 TRACE("(%p)->(IID_IHTMLFrameBase %p)\n", This, ppv);
714 *ppv = &This->IHTMLFrameBase_iface;
715 }else if(IsEqualGUID(&IID_IHTMLFrameBase2, riid)) {
716 TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This, ppv);
717 *ppv = &This->IHTMLFrameBase2_iface;
718 }else {
719 return HTMLElement_QI(&This->element.node, riid, ppv);
722 IUnknown_AddRef((IUnknown*)*ppv);
723 return S_OK;
726 void HTMLFrameBase_destructor(HTMLFrameBase *This)
728 if(This->content_window)
729 This->content_window->frame_element = NULL;
731 HTMLElement_destructor(&This->element.node);
734 void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
735 dispex_static_data_t *dispex_data)
737 nsresult nsres;
739 This->IHTMLFrameBase_iface.lpVtbl = &HTMLFrameBaseVtbl;
740 This->IHTMLFrameBase2_iface.lpVtbl = &HTMLFrameBase2Vtbl;
742 HTMLElement_Init(&This->element, doc, nselem, dispex_data);
744 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFrameElement, (void**)&This->nsframe);
745 if(NS_FAILED(nsres)) {
746 This->nsframe = NULL;
747 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&This->nsiframe);
748 assert(nsres == NS_OK);
749 }else {
750 This->nsiframe = NULL;