Module: wine Branch: master Commit: 67e6c7f1f3c8353de580d92f4e253577275a4d34 URL: http://source.winehq.org/git/wine.git/?a=commit;h=67e6c7f1f3c8353de580d92f4e...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Oct 27 21:17:08 2009 +0100
mshtml: Added HTML frames support.
---
dlls/mshtml/mutation.c | 72 +++++++++++++++++++++++++++++++++++++++-------- dlls/mshtml/nsiface.idl | 27 +++++++++++++++++ 2 files changed, 87 insertions(+), 12 deletions(-)
diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index e2e88f4..4999e26 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -37,6 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
enum { MUTATION_COMMENT, + MUTATION_FRAME, MUTATION_IFRAME, MUTATION_SCRIPT }; @@ -245,10 +246,30 @@ static void pop_mutation_queue(HTMLDocumentNode *doc) 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) { nsIDOMHTMLIFrameElement *nsiframe; - nsIDOMWindow *nswindow; nsIDOMDocument *nsdoc; nsresult nsres;
@@ -265,22 +286,35 @@ static nsresult init_iframe_window(HTMLDocumentNode *doc, nsISupports *nsunk) return nsres; }
- nswindow = get_nsdoc_window(nsdoc); + nsres = init_nsdoc_window(doc, nsdoc); + nsIDOMDocument_Release(nsdoc); - if(!nswindow) - return NS_ERROR_FAILURE; + return nsres; +}
- if(!nswindow_to_window(nswindow)) { - HTMLWindow *window; - HRESULT hres; +static nsresult init_frame_window(HTMLDocumentNode *doc, nsISupports *nsunk) +{ + nsIDOMHTMLFrameElement *nsframe; + nsIDOMDocument *nsdoc; + nsresult nsres;
- hres = HTMLWindow_Create(doc->basedoc.doc_obj, nswindow, doc->basedoc.window, &window); - if(SUCCEEDED(hres)) - IHTMLWindow2_Release(HTMLWINDOW2(window)); + nsres = nsISupports_QueryInterface(nsunk, &IID_nsIDOMHTMLFrameElement, (void**)&nsframe); + if(NS_FAILED(nsres)) { + ERR("Could not get nsIDOMHTMLFrameElement: %08x\n", nsres); + return nsres; }
- nsIDOMWindow_Release(nswindow); - return NS_OK; + nsres = nsIDOMHTMLFrameElement_GetContentDocument(nsframe, &nsdoc); + 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) @@ -339,6 +373,10 @@ static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface) break; }
+ case MUTATION_FRAME: + init_frame_window(This, This->mutation_queue->nsiface); + break; + case MUTATION_IFRAME: init_iframe_window(This, This->mutation_queue->nsiface); break; @@ -562,6 +600,7 @@ static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface, { HTMLDocumentNode *This = NSDOCOBS_THIS(iface); nsIDOMHTMLIFrameElement *nsiframe; + nsIDOMHTMLFrameElement *nsframe; nsIDOMComment *nscomment; nsIDOMElement *nselem; nsresult nsres; @@ -591,6 +630,15 @@ static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface, nsIDOMHTMLIFrameElement_Release(nsiframe); 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, diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl index 6143963..19f29b0 100644 --- a/dlls/mshtml/nsiface.idl +++ b/dlls/mshtml/nsiface.idl @@ -1513,6 +1513,33 @@ interface nsIDOMHTMLIFrameElement : nsIDOMHTMLElement
[ 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, uuid(94928ab3-8b63-11d3-989d-001083010e9b), local /* FROZEN */