Module: wine Branch: master Commit: a06ee80be0e4019c09132bea76e6e0c9eb707403 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a06ee80be0e4019c09132bea76...
Author: Jacek Caban jacek@codeweavers.com Date: Thu Jan 21 14:48:11 2010 +0100
mshtml: Added IHTMLFrameElement3::get_contentDocument implementation.
---
dlls/mshtml/htmlframe.c | 18 ++++++++++++++++-- dlls/mshtml/tests/dom.c | 25 ++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/dlls/mshtml/htmlframe.c b/dlls/mshtml/htmlframe.c index f6f02a8..0bf5c4d 100644 --- a/dlls/mshtml/htmlframe.c +++ b/dlls/mshtml/htmlframe.c @@ -94,8 +94,22 @@ static HRESULT WINAPI HTMLFrameElement3_Invoke(IHTMLFrameElement3 *iface, DISPID static HRESULT WINAPI HTMLFrameElement3_get_contentDocument(IHTMLFrameElement3 *iface, IDispatch **p) { HTMLFrameElement *This = HTMLFRAME3_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + IHTMLDocument2 *doc; + HRESULT hres; + + TRACE("(%p)->(%p)\n", This, p); + + if(!This->framebase.content_window) { + FIXME("NULL window\n"); + return E_FAIL; + } + + hres = IHTMLWindow2_get_document(HTMLWINDOW2(This->framebase.content_window), &doc); + if(FAILED(hres)) + return hres; + + *p = doc ? (IDispatch*)doc : NULL; + return S_OK; }
static HRESULT WINAPI HTMLFrameElement3_put_src(IHTMLFrameElement3 *iface, BSTR v) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 951c647..6fa0e29 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -5158,10 +5158,12 @@ static void doc_write(IHTMLDocument2 *doc, BOOL ln, const char *text) SafeArrayDestroy(sa); }
-static void test_frame_doc(IUnknown *frame_elem) +static void test_frame_doc(IUnknown *frame_elem, BOOL iframe) { IHTMLDocument2 *window_doc, *elem_doc; + IHTMLFrameElement3 *frame_elem3; IHTMLWindow2 *content_window; + HRESULT hres;
content_window = get_frame_content_window(frame_elem); window_doc = get_window_doc(content_window); @@ -5170,6 +5172,23 @@ static void test_frame_doc(IUnknown *frame_elem) elem_doc = get_elem_doc(frame_elem); ok(iface_cmp((IUnknown*)window_doc, (IUnknown*)elem_doc), "content_doc != elem_doc\n");
+ if(!iframe) { + hres = IUnknown_QueryInterface(frame_elem, &IID_IHTMLFrameElement3, (void**)&frame_elem3); + if(SUCCEEDED(hres)) { + IDispatch *disp = NULL; + + hres = IHTMLFrameElement3_get_contentDocument(frame_elem3, &disp); + ok(hres == S_OK, "get_contentDocument failed: %08x\n", hres); + ok(disp != NULL, "contentDocument == NULL\n"); + ok(iface_cmp((IUnknown*)disp, (IUnknown*)window_doc), "contentDocument != contentWindow.document\n"); + + IDispatch_Release(disp); + IHTMLFrameElement3_Release(frame_elem3); + }else { + win_skip("IHTMLFrameElement3 not supported\n"); + } + } + IHTMLDocument2_Release(elem_doc); IHTMLDocument2_Release(window_doc); } @@ -5192,7 +5211,7 @@ static void test_iframe_elem(IHTMLElement *elem) ET_BR };
- test_frame_doc((IUnknown*)elem); + test_frame_doc((IUnknown*)elem, TRUE);
content_window = get_frame_content_window((IUnknown*)elem); test_window_length(content_window, 0); @@ -5981,7 +6000,7 @@ static void test_frame(IDispatch *disp, const char *exp_id) return;
test_elem_type((IUnknown*)frame_elem, ET_FRAME); - test_frame_doc((IUnknown*)frame_elem); + test_frame_doc((IUnknown*)frame_elem, FALSE); test_elem_id((IUnknown*)frame_elem, exp_id); IHTMLElement_Release(frame_elem);