mshtml: Store nsIDOMHTMLDocument in HTMLDocument.
This commit is contained in:
parent
04841e1f35
commit
98789edc3e
|
@ -204,6 +204,8 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
|
|||
|
||||
ConnectionPointContainer_Destroy(&This->cp_container);
|
||||
|
||||
if(This->nsdoc)
|
||||
nsIDOMHTMLDocument_Release(This->nsdoc);
|
||||
if(This->nscontainer)
|
||||
NSContainer_Release(This->nscontainer);
|
||||
|
||||
|
@ -1636,6 +1638,8 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
|
|||
init_dispex(&ret->dispex, (IUnknown*)HTMLDOC(ret), &HTMLDocument_dispex);
|
||||
|
||||
ret->nscontainer = NSContainer_Create(ret, NULL);
|
||||
update_nsdocument(ret);
|
||||
|
||||
ret->window = HTMLWindow_Create(ret);
|
||||
|
||||
get_thread_hwnd();
|
||||
|
|
|
@ -246,6 +246,7 @@ struct HTMLDocument {
|
|||
|
||||
NSContainer *nscontainer;
|
||||
HTMLWindow *window;
|
||||
nsIDOMHTMLDocument *nsdoc;
|
||||
|
||||
IOleClientSite *client;
|
||||
IDocHostUIHandler *hostui;
|
||||
|
@ -530,6 +531,7 @@ void get_editor_controller(NSContainer*);
|
|||
void init_nsevents(NSContainer*);
|
||||
void add_nsevent_listener(NSContainer*,LPCWSTR);
|
||||
nsresult get_nsinterface(nsISupports*,REFIID,void**);
|
||||
void update_nsdocument(HTMLDocument*);
|
||||
|
||||
void check_event_attr(HTMLDocument*,nsIDOMElement*);
|
||||
void release_event_target(event_target_t*);
|
||||
|
|
|
@ -883,8 +883,10 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)
|
|||
FIXME("OnStartRequest failed: %08x\n", nsres);
|
||||
|
||||
/* events are reset when a new document URI is loaded, so re-initialise them here */
|
||||
if(This->bsc.doc && This->bsc.doc->bscallback == This && This->bsc.doc->nscontainer)
|
||||
if(This->bsc.doc && This->bsc.doc->bscallback == This && This->bsc.doc->nscontainer) {
|
||||
update_nsdocument(This->bsc.doc);
|
||||
init_nsevents(This->bsc.doc->nscontainer);
|
||||
}
|
||||
}
|
||||
|
||||
This->bsc.readed += This->nsstream->buf_size;
|
||||
|
|
|
@ -866,6 +866,39 @@ void set_ns_editmode(NSContainer *This)
|
|||
nsIWebBrowser_SetParentURIContentListener(This->webbrowser, NSURICL(This));
|
||||
}
|
||||
|
||||
void update_nsdocument(HTMLDocument *doc)
|
||||
{
|
||||
nsIDOMHTMLDocument *nsdoc;
|
||||
nsIDOMDocument *nsdomdoc;
|
||||
nsresult nsres;
|
||||
|
||||
if(!doc->nscontainer || !doc->nscontainer->navigation)
|
||||
return;
|
||||
|
||||
nsres = nsIWebNavigation_GetDocument(doc->nscontainer->navigation, &nsdomdoc);
|
||||
if(NS_FAILED(nsres) || !nsdomdoc) {
|
||||
ERR("GetDocument failed: %08x\n", nsres);
|
||||
return;
|
||||
}
|
||||
|
||||
nsres = nsIDOMDocument_QueryInterface(nsdomdoc, &IID_nsIDOMHTMLDocument, (void**)&nsdoc);
|
||||
nsIDOMDocument_Release(nsdomdoc);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("Could not get nsIDOMHTMLDocument iface: %08x\n", nsres);
|
||||
return;
|
||||
}
|
||||
|
||||
if(nsdoc == doc->nsdoc) {
|
||||
nsIDOMHTMLDocument_Release(nsdoc);
|
||||
return;
|
||||
}
|
||||
|
||||
if(doc->nsdoc)
|
||||
nsIDOMHTMLDocument_Release(doc->nsdoc);
|
||||
|
||||
doc->nsdoc = nsdoc;
|
||||
}
|
||||
|
||||
void close_gecko(void)
|
||||
{
|
||||
TRACE("()\n");
|
||||
|
@ -963,8 +996,14 @@ static nsresult NSAPI nsWebBrowserChrome_SetStatus(nsIWebBrowserChrome *iface,
|
|||
PRUint32 statusType, const PRUnichar *status)
|
||||
{
|
||||
NSContainer *This = NSWBCHROME_THIS(iface);
|
||||
|
||||
TRACE("(%p)->(%d %s)\n", This, statusType, debugstr_w(status));
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
/* FIXME: This hack should be removed when we'll load all pages by URLMoniker */
|
||||
if(This->doc)
|
||||
update_nsdocument(This->doc);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult NSAPI nsWebBrowserChrome_GetWebBrowser(nsIWebBrowserChrome *iface,
|
||||
|
|
|
@ -139,6 +139,7 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
|
|||
if(!This->doc)
|
||||
return NS_OK;
|
||||
|
||||
update_nsdocument(This->doc);
|
||||
connect_scripts(This->doc);
|
||||
setup_nswindow(This->doc->window);
|
||||
|
||||
|
|
Loading…
Reference in New Issue