mshtml: Added HTML frames support.

This commit is contained in:
Jacek Caban 2009-10-27 21:17:08 +01:00 committed by Alexandre Julliard
parent faf0b6bb2a
commit 67e6c7f1f3
2 changed files with 87 additions and 12 deletions

View File

@ -37,6 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
enum { enum {
MUTATION_COMMENT, MUTATION_COMMENT,
MUTATION_FRAME,
MUTATION_IFRAME, MUTATION_IFRAME,
MUTATION_SCRIPT MUTATION_SCRIPT
}; };
@ -245,10 +246,30 @@ static void pop_mutation_queue(HTMLDocumentNode *doc)
heap_free(tmp); heap_free(tmp);
} }
static nsresult init_nsdoc_window(HTMLDocumentNode *doc, nsIDOMDocument *nsdoc)
{
nsIDOMWindow *nswindow;
nswindow = get_nsdoc_window(nsdoc);
if(!nswindow)
return NS_ERROR_FAILURE;
if(!nswindow_to_window(nswindow)) {
HTMLWindow *window;
HRESULT hres;
hres = HTMLWindow_Create(doc->basedoc.doc_obj, nswindow, doc->basedoc.window, &window);
if(SUCCEEDED(hres))
IHTMLWindow2_Release(HTMLWINDOW2(window));
}
nsIDOMWindow_Release(nswindow);
return NS_OK;
}
static nsresult init_iframe_window(HTMLDocumentNode *doc, nsISupports *nsunk) static nsresult init_iframe_window(HTMLDocumentNode *doc, nsISupports *nsunk)
{ {
nsIDOMHTMLIFrameElement *nsiframe; nsIDOMHTMLIFrameElement *nsiframe;
nsIDOMWindow *nswindow;
nsIDOMDocument *nsdoc; nsIDOMDocument *nsdoc;
nsresult nsres; nsresult nsres;
@ -265,22 +286,35 @@ static nsresult init_iframe_window(HTMLDocumentNode *doc, nsISupports *nsunk)
return nsres; return nsres;
} }
nswindow = get_nsdoc_window(nsdoc); nsres = init_nsdoc_window(doc, nsdoc);
nsIDOMDocument_Release(nsdoc); nsIDOMDocument_Release(nsdoc);
if(!nswindow) return nsres;
return NS_ERROR_FAILURE; }
if(!nswindow_to_window(nswindow)) { static nsresult init_frame_window(HTMLDocumentNode *doc, nsISupports *nsunk)
HTMLWindow *window; {
HRESULT hres; nsIDOMHTMLFrameElement *nsframe;
nsIDOMDocument *nsdoc;
nsresult nsres;
hres = HTMLWindow_Create(doc->basedoc.doc_obj, nswindow, doc->basedoc.window, &window); nsres = nsISupports_QueryInterface(nsunk, &IID_nsIDOMHTMLFrameElement, (void**)&nsframe);
if(SUCCEEDED(hres)) if(NS_FAILED(nsres)) {
IHTMLWindow2_Release(HTMLWINDOW2(window)); ERR("Could not get nsIDOMHTMLFrameElement: %08x\n", nsres);
return nsres;
} }
nsIDOMWindow_Release(nswindow); nsres = nsIDOMHTMLFrameElement_GetContentDocument(nsframe, &nsdoc);
return NS_OK; nsIDOMHTMLFrameElement_Release(nsframe);
if(NS_FAILED(nsres) || !nsdoc) {
ERR("GetContentDocument failed: %08x\n", nsres);
return nsres;
}
nsres = init_nsdoc_window(doc, nsdoc);
nsIDOMDocument_Release(nsdoc);
return nsres;
} }
static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface) static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface)
@ -339,6 +373,10 @@ static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface)
break; break;
} }
case MUTATION_FRAME:
init_frame_window(This, This->mutation_queue->nsiface);
break;
case MUTATION_IFRAME: case MUTATION_IFRAME:
init_iframe_window(This, This->mutation_queue->nsiface); init_iframe_window(This, This->mutation_queue->nsiface);
break; break;
@ -562,6 +600,7 @@ static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface,
{ {
HTMLDocumentNode *This = NSDOCOBS_THIS(iface); HTMLDocumentNode *This = NSDOCOBS_THIS(iface);
nsIDOMHTMLIFrameElement *nsiframe; nsIDOMHTMLIFrameElement *nsiframe;
nsIDOMHTMLFrameElement *nsframe;
nsIDOMComment *nscomment; nsIDOMComment *nscomment;
nsIDOMElement *nselem; nsIDOMElement *nselem;
nsresult nsres; nsresult nsres;
@ -591,6 +630,15 @@ static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface,
nsIDOMHTMLIFrameElement_Release(nsiframe); nsIDOMHTMLIFrameElement_Release(nsiframe);
add_script_runner(This); add_script_runner(This);
} }
nsres = nsISupports_QueryInterface(aContent, &IID_nsIDOMHTMLFrameElement, (void**)&nsframe);
if(NS_SUCCEEDED(nsres)) {
TRACE("frame node\n");
push_mutation_queue(This, MUTATION_FRAME, (nsISupports*)nsframe);
nsIDOMHTMLFrameElement_Release(nsframe);
add_script_runner(This);
}
} }
static void NSAPI nsDocumentObserver_DoneAddingChildren(nsIDocumentObserver *iface, nsIContent *aContent, static void NSAPI nsDocumentObserver_DoneAddingChildren(nsIDocumentObserver *iface, nsIContent *aContent,

View File

@ -1511,6 +1511,33 @@ interface nsIDOMHTMLIFrameElement : nsIDOMHTMLElement
nsresult GetContentDocument(nsIDOMDocument **aContentDocument); nsresult GetContentDocument(nsIDOMDocument **aContentDocument);
} }
[
object,
uuid(a6cf90b9-15b3-11d2-932e-00805f8add32),
local
/* FROZEN */
]
interface nsIDOMHTMLFrameElement : nsIDOMHTMLElement
{
nsresult GetFrameBorder(nsAString *aFrameBorder);
nsresult SetFrameBorder(const nsAString *aFrameBorder);
nsresult GetLongDesc(nsAString *aLongDesc);
nsresult SetLongDesc(const nsAString *aLongDesc);
nsresult GetMarginHeight(nsAString *aMarginHeight);
nsresult SetMarginHeight(const nsAString *aMarginHeight);
nsresult GetMarginWidth(nsAString *aMarginWidth);
nsresult SetMarginWidth(const nsAString *aMarginWidth);
nsresult GetName(nsAString *aName);
nsresult SetName(const nsAString *aName);
nsresult GetNoResize(PRBool *aNoResize);
nsresult SetNoResize(PRBool aNoResize);
nsresult GetScrolling(nsAString *aScrolling);
nsresult SetScrolling(const nsAString *aScrolling);
nsresult GetSrc(nsAString *aSrc);
nsresult SetSrc(const nsAString *aSrc);
nsresult GetContentDocument(nsIDOMDocument **aContentDocument);
}
[ [
object, object,
uuid(94928ab3-8b63-11d3-989d-001083010e9b), uuid(94928ab3-8b63-11d3-989d-001083010e9b),