msi: Add support for storing strings with embedded nulls in the string table.
[wine.git] / dlls / mshtml / htmlframebase.c
bloba11adca1c731f922d9a9be066cedb0acf0b7b68b
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"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 static const WCHAR autoW[] = {'a','u','t','o',0};
36 static const WCHAR yesW[] = {'y','e','s',0};
37 static const WCHAR noW[] = {'n','o',0};
38 static const WCHAR pxW[] = {'p','x',0};
40 HRESULT set_frame_doc(HTMLFrameBase *frame, nsIDOMDocument *nsdoc)
42 nsIDOMWindow *nswindow;
43 HTMLOuterWindow *window;
44 nsresult nsres;
45 HRESULT hres = S_OK;
47 if(frame->content_window)
48 return S_OK;
50 nsres = nsIDOMDocument_GetDefaultView(nsdoc, &nswindow);
51 if(NS_FAILED(nsres) || !nswindow)
52 return E_FAIL;
54 window = nswindow_to_window(nswindow);
55 if(!window)
56 hres = HTMLOuterWindow_Create(frame->element.node.doc->basedoc.doc_obj, nswindow,
57 frame->element.node.doc->basedoc.window, &window);
58 nsIDOMWindow_Release(nswindow);
59 if(FAILED(hres))
60 return hres;
62 frame->content_window = window;
63 window->frame_element = frame;
64 return S_OK;
67 static inline HTMLFrameBase *impl_from_IHTMLFrameBase(IHTMLFrameBase *iface)
69 return CONTAINING_RECORD(iface, HTMLFrameBase, IHTMLFrameBase_iface);
72 static HRESULT WINAPI HTMLFrameBase_QueryInterface(IHTMLFrameBase *iface, REFIID riid, void **ppv)
74 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
76 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
79 static ULONG WINAPI HTMLFrameBase_AddRef(IHTMLFrameBase *iface)
81 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
83 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
86 static ULONG WINAPI HTMLFrameBase_Release(IHTMLFrameBase *iface)
88 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
90 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
93 static HRESULT WINAPI HTMLFrameBase_GetTypeInfoCount(IHTMLFrameBase *iface, UINT *pctinfo)
95 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
97 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
100 static HRESULT WINAPI HTMLFrameBase_GetTypeInfo(IHTMLFrameBase *iface, UINT iTInfo,
101 LCID lcid, ITypeInfo **ppTInfo)
103 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
105 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
106 ppTInfo);
109 static HRESULT WINAPI HTMLFrameBase_GetIDsOfNames(IHTMLFrameBase *iface, REFIID riid,
110 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
112 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
114 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
115 cNames, lcid, rgDispId);
118 static HRESULT WINAPI HTMLFrameBase_Invoke(IHTMLFrameBase *iface, DISPID dispIdMember,
119 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
120 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
122 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
124 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
125 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
128 static HRESULT WINAPI HTMLFrameBase_put_src(IHTMLFrameBase *iface, BSTR v)
130 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
132 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
134 if(!This->content_window || !This->element.node.doc || !This->element.node.doc->basedoc.window) {
135 FIXME("detached element\n");
136 return E_FAIL;
139 return navigate_url(This->content_window, v, This->element.node.doc->basedoc.window->uri);
142 static HRESULT WINAPI HTMLFrameBase_get_src(IHTMLFrameBase *iface, BSTR *p)
144 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
145 FIXME("(%p)->(%p)\n", This, p);
146 return E_NOTIMPL;
149 static HRESULT WINAPI HTMLFrameBase_put_name(IHTMLFrameBase *iface, BSTR v)
151 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
152 nsAString name_str;
153 nsresult nsres;
155 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
157 if(!This->nsframe && !This->nsiframe) {
158 ERR("No attached ns frame object\n");
159 return E_UNEXPECTED;
162 nsAString_InitDepend(&name_str, v);
163 if(This->nsframe)
164 nsres = nsIDOMHTMLFrameElement_SetName(This->nsframe, &name_str);
165 else
166 nsres = nsIDOMHTMLIFrameElement_SetName(This->nsiframe, &name_str);
167 nsAString_Finish(&name_str);
168 if(NS_FAILED(nsres)) {
169 ERR("SetName failed: %08x\n", nsres);
170 return E_FAIL;
173 return S_OK;
176 static HRESULT WINAPI HTMLFrameBase_get_name(IHTMLFrameBase *iface, BSTR *p)
178 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
179 nsAString nsstr;
180 nsresult nsres;
182 TRACE("(%p)->(%p)\n", This, p);
184 if(!This->nsframe && !This->nsiframe) {
185 ERR("No attached ns frame object\n");
186 return E_UNEXPECTED;
189 nsAString_Init(&nsstr, NULL);
190 if(This->nsframe)
191 nsres = nsIDOMHTMLFrameElement_GetName(This->nsframe, &nsstr);
192 else
193 nsres = nsIDOMHTMLIFrameElement_GetName(This->nsiframe, &nsstr);
194 return return_nsstr(nsres, &nsstr, p);
197 static HRESULT WINAPI HTMLFrameBase_put_border(IHTMLFrameBase *iface, VARIANT v)
199 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
200 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
201 return E_NOTIMPL;
204 static HRESULT WINAPI HTMLFrameBase_get_border(IHTMLFrameBase *iface, VARIANT *p)
206 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
207 FIXME("(%p)->(%p)\n", This, p);
208 return E_NOTIMPL;
211 static HRESULT WINAPI HTMLFrameBase_put_frameBorder(IHTMLFrameBase *iface, BSTR v)
213 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
214 nsAString nsstr;
215 nsresult nsres;
217 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
219 if(!This->nsframe && !This->nsiframe) {
220 ERR("No attached ns frame object\n");
221 return E_UNEXPECTED;
224 nsAString_InitDepend(&nsstr, v);
225 if(This->nsframe)
226 nsres = nsIDOMHTMLFrameElement_SetFrameBorder(This->nsframe, &nsstr);
227 else
228 nsres = nsIDOMHTMLIFrameElement_SetFrameBorder(This->nsiframe, &nsstr);
229 nsAString_Finish(&nsstr);
230 if(NS_FAILED(nsres)) {
231 ERR("SetFrameBorder failed: %08x\n", nsres);
232 return E_FAIL;
235 return S_OK;
238 static HRESULT WINAPI HTMLFrameBase_get_frameBorder(IHTMLFrameBase *iface, BSTR *p)
240 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
241 nsAString nsstr;
242 nsresult nsres;
244 TRACE("(%p)->(%p)\n", This, p);
246 if(!This->nsframe && !This->nsiframe) {
247 ERR("No attached ns frame object\n");
248 return E_UNEXPECTED;
251 nsAString_Init(&nsstr, NULL);
252 if(This->nsframe)
253 nsres = nsIDOMHTMLFrameElement_GetFrameBorder(This->nsframe, &nsstr);
254 else
255 nsres = nsIDOMHTMLIFrameElement_GetFrameBorder(This->nsiframe, &nsstr);
256 return return_nsstr(nsres, &nsstr, p);
259 static HRESULT WINAPI HTMLFrameBase_put_frameSpacing(IHTMLFrameBase *iface, VARIANT v)
261 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
262 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
263 return E_NOTIMPL;
266 static HRESULT WINAPI HTMLFrameBase_get_frameSpacing(IHTMLFrameBase *iface, VARIANT *p)
268 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
269 FIXME("(%p)->(%p)\n", This, p);
270 return E_NOTIMPL;
273 static HRESULT WINAPI HTMLFrameBase_put_marginWidth(IHTMLFrameBase *iface, VARIANT v)
275 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
276 nsAString nsstr;
277 nsresult nsres;
279 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
281 if(V_VT(&v) != VT_BSTR) {
282 FIXME("unsupported %s\n", debugstr_variant(&v));
283 return E_NOTIMPL;
286 nsAString_InitDepend(&nsstr, V_BSTR(&v));
287 if(This->nsframe)
288 nsres = nsIDOMHTMLFrameElement_SetMarginWidth(This->nsframe, &nsstr);
289 else
290 nsres = nsIDOMHTMLIFrameElement_SetMarginWidth(This->nsiframe, &nsstr);
291 nsAString_Finish(&nsstr);
292 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
295 static HRESULT WINAPI HTMLFrameBase_get_marginWidth(IHTMLFrameBase *iface, VARIANT *p)
297 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
298 nsAString nsstr;
299 nsresult nsres;
300 HRESULT hres = S_OK;
302 TRACE("(%p)->(%p)\n", This, p);
304 nsAString_Init(&nsstr, NULL);
305 if(This->nsframe)
306 nsres = nsIDOMHTMLFrameElement_GetMarginWidth(This->nsframe, &nsstr);
307 else
308 nsres = nsIDOMHTMLIFrameElement_GetMarginWidth(This->nsiframe, &nsstr);
309 if(NS_SUCCEEDED(nsres)) {
310 const PRUnichar *str, *end;
312 nsAString_GetData(&nsstr, &str);
314 if(*str) {
315 BSTR ret;
317 end = strstrW(str, pxW);
318 if(!end)
319 end = str+strlenW(str);
320 ret = SysAllocStringLen(str, end-str);
321 if(ret) {
322 V_VT(p) = VT_BSTR;
323 V_BSTR(p) = ret;
324 }else {
325 hres = E_OUTOFMEMORY;
327 }else {
328 V_VT(p) = VT_BSTR;
329 V_BSTR(p) = NULL;
331 }else {
332 ERR("GetMarginWidth failed: %08x\n", nsres);
333 hres = E_FAIL;
336 nsAString_Finish(&nsstr);
337 return hres;
340 static HRESULT WINAPI HTMLFrameBase_put_marginHeight(IHTMLFrameBase *iface, VARIANT v)
342 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
343 nsAString nsstr;
344 nsresult nsres;
346 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
348 if(V_VT(&v) != VT_BSTR) {
349 FIXME("unsupported %s\n", debugstr_variant(&v));
350 return E_NOTIMPL;
353 nsAString_InitDepend(&nsstr, V_BSTR(&v));
354 if(This->nsframe)
355 nsres = nsIDOMHTMLFrameElement_SetMarginHeight(This->nsframe, &nsstr);
356 else
357 nsres = nsIDOMHTMLIFrameElement_SetMarginHeight(This->nsiframe, &nsstr);
358 nsAString_Finish(&nsstr);
359 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
362 static HRESULT WINAPI HTMLFrameBase_get_marginHeight(IHTMLFrameBase *iface, VARIANT *p)
364 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
365 nsAString nsstr;
366 nsresult nsres;
367 HRESULT hres = S_OK;
369 TRACE("(%p)->(%p)\n", This, p);
371 nsAString_Init(&nsstr, NULL);
372 if(This->nsframe)
373 nsres = nsIDOMHTMLFrameElement_GetMarginHeight(This->nsframe, &nsstr);
374 else
375 nsres = nsIDOMHTMLIFrameElement_GetMarginHeight(This->nsiframe, &nsstr);
376 if(NS_SUCCEEDED(nsres)) {
377 const PRUnichar *str, *end;
379 nsAString_GetData(&nsstr, &str);
381 if(*str) {
382 BSTR ret;
384 end = strstrW(str, pxW);
385 if(!end)
386 end = str+strlenW(str);
387 ret = SysAllocStringLen(str, end-str);
388 if(ret) {
389 V_VT(p) = VT_BSTR;
390 V_BSTR(p) = ret;
391 }else {
392 hres = E_OUTOFMEMORY;
394 }else {
395 V_VT(p) = VT_BSTR;
396 V_BSTR(p) = NULL;
398 }else {
399 ERR("SetMarginHeight failed: %08x\n", nsres);
400 hres = E_FAIL;
403 nsAString_Finish(&nsstr);
404 return hres;
407 static HRESULT WINAPI HTMLFrameBase_put_noResize(IHTMLFrameBase *iface, VARIANT_BOOL v)
409 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
410 FIXME("(%p)->(%x)\n", This, v);
411 return E_NOTIMPL;
414 static HRESULT WINAPI HTMLFrameBase_get_noResize(IHTMLFrameBase *iface, VARIANT_BOOL *p)
416 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
417 FIXME("(%p)->(%p)\n", This, p);
418 return E_NOTIMPL;
421 static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
423 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
424 nsAString nsstr;
425 nsresult nsres;
427 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
429 if(!(!strcmpiW(v, yesW) || !strcmpiW(v, noW) || !strcmpiW(v, autoW)))
430 return E_INVALIDARG;
432 if(This->nsframe) {
433 nsAString_InitDepend(&nsstr, v);
434 nsres = nsIDOMHTMLFrameElement_SetScrolling(This->nsframe, &nsstr);
435 }else if(This->nsiframe) {
436 nsAString_InitDepend(&nsstr, v);
437 nsres = nsIDOMHTMLIFrameElement_SetScrolling(This->nsiframe, &nsstr);
438 }else {
439 ERR("No attached ns frame object\n");
440 return E_UNEXPECTED;
442 nsAString_Finish(&nsstr);
444 if(NS_FAILED(nsres)) {
445 ERR("SetScrolling failed: 0x%08x\n", nsres);
446 return E_FAIL;
449 return S_OK;
452 static HRESULT WINAPI HTMLFrameBase_get_scrolling(IHTMLFrameBase *iface, BSTR *p)
454 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
455 nsAString nsstr;
456 const PRUnichar *strdata;
457 nsresult nsres;
459 TRACE("(%p)->(%p)\n", This, p);
461 if(This->nsframe) {
462 nsAString_Init(&nsstr, NULL);
463 nsres = nsIDOMHTMLFrameElement_GetScrolling(This->nsframe, &nsstr);
464 }else if(This->nsiframe) {
465 nsAString_Init(&nsstr, NULL);
466 nsres = nsIDOMHTMLIFrameElement_GetScrolling(This->nsiframe, &nsstr);
467 }else {
468 ERR("No attached ns frame object\n");
469 return E_UNEXPECTED;
472 if(NS_FAILED(nsres)) {
473 ERR("GetScrolling failed: 0x%08x\n", nsres);
474 nsAString_Finish(&nsstr);
475 return E_FAIL;
478 nsAString_GetData(&nsstr, &strdata);
480 if(*strdata)
481 *p = SysAllocString(strdata);
482 else
483 *p = SysAllocString(autoW);
485 nsAString_Finish(&nsstr);
487 return *p ? S_OK : E_OUTOFMEMORY;
490 static const IHTMLFrameBaseVtbl HTMLFrameBaseVtbl = {
491 HTMLFrameBase_QueryInterface,
492 HTMLFrameBase_AddRef,
493 HTMLFrameBase_Release,
494 HTMLFrameBase_GetTypeInfoCount,
495 HTMLFrameBase_GetTypeInfo,
496 HTMLFrameBase_GetIDsOfNames,
497 HTMLFrameBase_Invoke,
498 HTMLFrameBase_put_src,
499 HTMLFrameBase_get_src,
500 HTMLFrameBase_put_name,
501 HTMLFrameBase_get_name,
502 HTMLFrameBase_put_border,
503 HTMLFrameBase_get_border,
504 HTMLFrameBase_put_frameBorder,
505 HTMLFrameBase_get_frameBorder,
506 HTMLFrameBase_put_frameSpacing,
507 HTMLFrameBase_get_frameSpacing,
508 HTMLFrameBase_put_marginWidth,
509 HTMLFrameBase_get_marginWidth,
510 HTMLFrameBase_put_marginHeight,
511 HTMLFrameBase_get_marginHeight,
512 HTMLFrameBase_put_noResize,
513 HTMLFrameBase_get_noResize,
514 HTMLFrameBase_put_scrolling,
515 HTMLFrameBase_get_scrolling
518 static inline HTMLFrameBase *impl_from_IHTMLFrameBase2(IHTMLFrameBase2 *iface)
520 return CONTAINING_RECORD(iface, HTMLFrameBase, IHTMLFrameBase2_iface);
523 static HRESULT WINAPI HTMLFrameBase2_QueryInterface(IHTMLFrameBase2 *iface, REFIID riid, void **ppv)
525 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
527 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
530 static ULONG WINAPI HTMLFrameBase2_AddRef(IHTMLFrameBase2 *iface)
532 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
534 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
537 static ULONG WINAPI HTMLFrameBase2_Release(IHTMLFrameBase2 *iface)
539 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
541 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
544 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfoCount(IHTMLFrameBase2 *iface, UINT *pctinfo)
546 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
547 FIXME("(%p)\n", This);
548 return E_NOTIMPL;
551 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfo(IHTMLFrameBase2 *iface, UINT iTInfo,
552 LCID lcid, ITypeInfo **ppTInfo)
554 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
555 FIXME("(%p)\n", This);
556 return E_NOTIMPL;
559 static HRESULT WINAPI HTMLFrameBase2_GetIDsOfNames(IHTMLFrameBase2 *iface, REFIID riid,
560 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
562 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
563 FIXME("(%p)\n", This);
564 return E_NOTIMPL;
567 static HRESULT WINAPI HTMLFrameBase2_Invoke(IHTMLFrameBase2 *iface, DISPID dispIdMember,
568 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
569 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
571 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
572 FIXME("(%p)\n", This);
573 return E_NOTIMPL;
576 static HRESULT WINAPI HTMLFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, IHTMLWindow2 **p)
578 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
580 TRACE("(%p)->(%p)\n", This, p);
582 if(This->content_window) {
583 IHTMLWindow2_AddRef(&This->content_window->base.IHTMLWindow2_iface);
584 *p = &This->content_window->base.IHTMLWindow2_iface;
585 }else {
586 WARN("NULL content window\n");
587 *p = NULL;
589 return S_OK;
592 static HRESULT WINAPI HTMLFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v)
594 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
595 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
596 return E_NOTIMPL;
599 static HRESULT WINAPI HTMLFrameBase2_get_onload(IHTMLFrameBase2 *iface, VARIANT *p)
601 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
602 FIXME("(%p)->(%p)\n", This, p);
603 return E_NOTIMPL;
606 static HRESULT WINAPI HTMLFrameBase2_put_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT v)
608 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
609 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
610 return E_NOTIMPL;
613 static HRESULT WINAPI HTMLFrameBase2_get_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT *p)
615 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
616 FIXME("(%p)->(%p)\n", This, p);
617 return E_NOTIMPL;
620 static HRESULT WINAPI HTMLFrameBase2_get_readyState(IHTMLFrameBase2 *iface, BSTR *p)
622 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
624 TRACE("(%p)->(%p)\n", This, p);
626 if(!This->content_window || !This->content_window->base.inner_window->doc) {
627 FIXME("no document associated\n");
628 return E_FAIL;
631 return IHTMLDocument2_get_readyState(&This->content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface, p);
634 static HRESULT WINAPI HTMLFrameBase2_put_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL v)
636 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
637 FIXME("(%p)->(%x)\n", This, v);
638 return E_NOTIMPL;
641 static HRESULT WINAPI HTMLFrameBase2_get_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL *p)
643 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
644 FIXME("(%p)->(%p)\n", This, p);
645 return E_NOTIMPL;
648 static const IHTMLFrameBase2Vtbl HTMLFrameBase2Vtbl = {
649 HTMLFrameBase2_QueryInterface,
650 HTMLFrameBase2_AddRef,
651 HTMLFrameBase2_Release,
652 HTMLFrameBase2_GetTypeInfoCount,
653 HTMLFrameBase2_GetTypeInfo,
654 HTMLFrameBase2_GetIDsOfNames,
655 HTMLFrameBase2_Invoke,
656 HTMLFrameBase2_get_contentWindow,
657 HTMLFrameBase2_put_onload,
658 HTMLFrameBase2_get_onload,
659 HTMLFrameBase2_put_onreadystatechange,
660 HTMLFrameBase2_get_onreadystatechange,
661 HTMLFrameBase2_get_readyState,
662 HTMLFrameBase2_put_allowTransparency,
663 HTMLFrameBase2_get_allowTransparency
666 HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv)
668 if(IsEqualGUID(&IID_IHTMLFrameBase, riid)) {
669 TRACE("(%p)->(IID_IHTMLFrameBase %p)\n", This, ppv);
670 *ppv = &This->IHTMLFrameBase_iface;
671 }else if(IsEqualGUID(&IID_IHTMLFrameBase2, riid)) {
672 TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This, ppv);
673 *ppv = &This->IHTMLFrameBase2_iface;
674 }else {
675 return HTMLElement_QI(&This->element.node, riid, ppv);
678 IUnknown_AddRef((IUnknown*)*ppv);
679 return S_OK;
682 void HTMLFrameBase_destructor(HTMLFrameBase *This)
684 if(This->content_window)
685 This->content_window->frame_element = NULL;
687 HTMLElement_destructor(&This->element.node);
690 void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
691 dispex_static_data_t *dispex_data)
693 nsresult nsres;
695 This->IHTMLFrameBase_iface.lpVtbl = &HTMLFrameBaseVtbl;
696 This->IHTMLFrameBase2_iface.lpVtbl = &HTMLFrameBase2Vtbl;
698 HTMLElement_Init(&This->element, doc, nselem, dispex_data);
700 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFrameElement, (void**)&This->nsframe);
701 if(NS_FAILED(nsres)) {
702 This->nsframe = NULL;
703 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&This->nsiframe);
704 assert(nsres == NS_OK && (nsIDOMNode*)This->nsiframe == This->element.node.nsnode);
705 }else {
706 assert((nsIDOMNode*)This->nsframe == This->element.node.nsnode);
707 This->nsiframe = NULL;
710 /* Share the reference with nsnode */
711 nsIDOMNode_Release(This->element.node.nsnode);