mshtml: Added HTMLFrameElement object and associate it with frame window.

This commit is contained in:
Jacek Caban 2009-11-01 19:19:41 +01:00 committed by Alexandre Julliard
parent 9d6af171e5
commit fa3ac0a3d9
3 changed files with 56 additions and 7 deletions

View File

@ -278,3 +278,49 @@ void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLEl
}
This->content_window = content_window;
}
typedef struct {
HTMLFrameBase framebase;
} HTMLFrameElement;
#define HTMLFRAME_NODE_THIS(iface) DEFINE_THIS2(HTMLFrameElement, framebase.element.node, iface)
static HRESULT HTMLFrameElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
{
HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
return HTMLFrameBase_QI(&This->framebase, riid, ppv);
}
static void HTMLFrameElement_destructor(HTMLDOMNode *iface)
{
HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
HTMLFrameBase_destructor(&This->framebase);
}
#undef HTMLFRAME_NODE_THIS
static const NodeImplVtbl HTMLFrameElementImplVtbl = {
HTMLFrameElement_QI,
HTMLFrameElement_destructor
};
HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLWindow *content_window)
{
nsIDOMHTMLFrameElement *nsframe;
HTMLFrameElement *ret;
nsresult nsres;
ret = heap_alloc_zero(sizeof(HTMLFrameElement));
ret->framebase.element.node.vtbl = &HTMLFrameElementImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFrameElement, (void**)&nsframe);
if(NS_FAILED(nsres))
ERR("Could not get nsIDOMHTMLFrameElement iface: %08x\n", nsres);
HTMLFrameBase_Init(&ret->framebase, doc, nselem, content_window, NULL);
return &ret->framebase.element;
}

View File

@ -697,6 +697,7 @@ HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
HTMLElement *HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
HTMLElement *HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLWindow*);
HTMLElement *HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLWindow*);
HTMLElement *HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
HTMLElement *HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);

View File

@ -259,12 +259,8 @@ static nsresult init_nsdoc_window(HTMLDocumentNode *doc, nsIDOMDocument *nsdoc,
HRESULT hres;
hres = HTMLWindow_Create(doc->basedoc.doc_obj, nswindow, doc->basedoc.window, &window);
if(SUCCEEDED(hres)) {
if(ret)
if(SUCCEEDED(hres))
*ret = window;
else
IHTMLWindow2_Release(HTMLWINDOW2(window));
}
}
nsIDOMWindow_Release(nswindow);
@ -305,6 +301,7 @@ static nsresult init_iframe_window(HTMLDocumentNode *doc, nsISupports *nsunk)
static nsresult init_frame_window(HTMLDocumentNode *doc, nsISupports *nsunk)
{
nsIDOMHTMLFrameElement *nsframe;
HTMLWindow *window = NULL;
nsIDOMDocument *nsdoc;
nsresult nsres;
@ -321,7 +318,12 @@ static nsresult init_frame_window(HTMLDocumentNode *doc, nsISupports *nsunk)
return nsres;
}
nsres = init_nsdoc_window(doc, nsdoc, NULL);
nsres = init_nsdoc_window(doc, nsdoc, &window);
if(window) {
HTMLFrameElement_Create(doc, (nsIDOMHTMLElement*)nsframe, window);
IHTMLWindow2_Release(HTMLWINDOW2(window));
}
nsIDOMDocument_Release(nsdoc);
return nsres;