Commit e52e57cf authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Moved binding variables to HTMLDocumentObj.

parent d460c673
......@@ -588,8 +588,8 @@ static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p)
TRACE("(%p)->(%p)\n", iface, p);
*p = SysAllocString(This->url ? This->url : about_blank_url);
return S_OK;
*p = SysAllocString(This->doc_obj->url ? This->doc_obj->url : about_blank_url);
return *p ? S_OK : E_OUTOFMEMORY;
}
static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v)
......@@ -1739,8 +1739,6 @@ static void init_doc(HTMLDocument *doc, const htmldoc_vtbl_t *vtbl)
doc->lpSupportErrorInfoVtbl = &SupportErrorInfoVtbl;
doc->readystate = READYSTATE_UNINITIALIZED;
list_init(&doc->bindings);
HTMLDocument_HTMLDocument3_Init(doc);
HTMLDocument_HTMLDocument5_Init(doc);
HTMLDocument_Persist_Init(doc);
......@@ -1763,9 +1761,6 @@ static void destroy_htmldoc(HTMLDocument *This)
{
remove_doc_tasks(This);
set_document_bscallback(This, NULL);
set_current_mon(This, NULL);
if(This->event_target)
release_event_target(This->event_target);
......@@ -1876,6 +1871,8 @@ static ULONG HTMLDocumentObj_Release(HTMLDocument *base)
TRACE("(%p) ref = %u\n", This, ref);
if(!ref) {
set_document_bscallback(&This->basedoc, NULL);
set_current_mon(&This->basedoc, NULL);
if(This->basedoc.doc_node) {
This->basedoc.doc_node->basedoc.doc_obj = NULL;
IHTMLDocument2_Release(HTMLDOC(&This->basedoc.doc_node->basedoc));
......@@ -1942,6 +1939,7 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
return hres;
doc->nscontainer = NSContainer_Create(doc, NULL);
list_init(&doc->bindings);
if(doc->nscontainer) {
nsresult nsres;
......
......@@ -37,12 +37,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
static HRESULT get_url(HTMLLocation *This, const WCHAR **ret)
{
if(!This->window || !This->window->doc_obj || !This->window->doc_obj->basedoc.url) {
if(!This->window || !This->window->doc_obj || !This->window->doc_obj->url) {
FIXME("No current URL\n");
return E_NOTIMPL;
}
*ret = This->window->doc_obj->basedoc.url;
*ret = This->window->doc_obj->url;
return S_OK;
}
......
......@@ -284,11 +284,6 @@ struct HTMLDocument {
HTMLWindow *window;
nsIDOMHTMLDocument *nsdoc;
nsChannelBSC *bscallback;
IMoniker *mon;
LPOLESTR url;
struct list bindings;
USERMODE usermode;
READYSTATE readystate;
LPWSTR mime;
......@@ -354,6 +349,12 @@ struct HTMLDocumentObj {
BOOL has_key_path;
BOOL container_locked;
BOOL focus;
/* FIXME: probably should be in document node object */
nsChannelBSC *bscallback;
IMoniker *mon;
LPOLESTR url;
struct list bindings;
};
typedef struct {
......
......@@ -313,7 +313,7 @@ static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallback *ifa
This->binding = pbind;
if(This->doc)
list_add_head(&This->doc->bindings, &This->entry);
list_add_head(&This->doc->doc_obj->bindings, &This->entry);
return This->vtbl->start_binding(This);
}
......@@ -949,7 +949,7 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)
on_start_nsrequest(This);
/* 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->doc_obj->nscontainer) {
if(This->bsc.doc && This->bsc.doc->doc_obj->bscallback == This && This->bsc.doc->doc_obj->nscontainer) {
update_nsdocument(This->bsc.doc->doc_obj);
init_nsevents(This->bsc.doc->doc_obj->nscontainer);
}
......@@ -1109,19 +1109,19 @@ void set_document_bscallback(HTMLDocument *doc, nsChannelBSC *callback)
{
BSCallback *iter;
if(doc->bscallback) {
if(doc->bscallback->bsc.binding)
IBinding_Abort(doc->bscallback->bsc.binding);
doc->bscallback->bsc.doc = NULL;
IBindStatusCallback_Release(STATUSCLB(&doc->bscallback->bsc));
if(doc->doc_obj->bscallback) {
if(doc->doc_obj->bscallback->bsc.binding)
IBinding_Abort(doc->doc_obj->bscallback->bsc.binding);
doc->doc_obj->bscallback->bsc.doc = NULL;
IBindStatusCallback_Release(STATUSCLB(&doc->doc_obj->bscallback->bsc));
}
LIST_FOR_EACH_ENTRY(iter, &doc->bindings, BSCallback, entry) {
LIST_FOR_EACH_ENTRY(iter, &doc->doc_obj->bindings, BSCallback, entry) {
iter->doc = NULL;
list_remove(&iter->entry);
}
doc->bscallback = callback;
doc->doc_obj->bscallback = callback;
if(callback) {
IBindStatusCallback_AddRef(STATUSCLB(&callback->bsc));
......
......@@ -543,9 +543,9 @@ static HRESULT exec_editmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
This->usermode = EDITMODE;
if(This->mon) {
if(This->doc_obj->mon) {
CLSID clsid = IID_NULL;
hres = IMoniker_GetClassID(This->mon, &clsid);
hres = IMoniker_GetClassID(This->doc_obj->mon, &clsid);
if(SUCCEEDED(hres)) {
/* We should use IMoniker::Save here */
FIXME("Use CLSID %s\n", debugstr_guid(&clsid));
......@@ -588,11 +588,11 @@ static HRESULT exec_editmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
update_doc(This, UPDATE_UI);
if(This->mon) {
if(This->doc_obj->mon) {
/* FIXME: We should find nicer way to do this */
remove_doc_tasks(This);
mon = This->mon;
mon = This->doc_obj->mon;
IMoniker_AddRef(mon);
}else {
static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
......
......@@ -52,27 +52,27 @@ void set_current_mon(HTMLDocument *This, IMoniker *mon)
{
HRESULT hres;
if(This->mon) {
IMoniker_Release(This->mon);
This->mon = NULL;
if(This->doc_obj->mon) {
IMoniker_Release(This->doc_obj->mon);
This->doc_obj->mon = NULL;
}
if(This->url) {
CoTaskMemFree(This->url);
This->url = NULL;
if(This->doc_obj->url) {
CoTaskMemFree(This->doc_obj->url);
This->doc_obj->url = NULL;
}
if(!mon)
return;
IMoniker_AddRef(mon);
This->mon = mon;
This->doc_obj->mon = mon;
hres = IMoniker_GetDisplayName(mon, NULL, NULL, &This->url);
hres = IMoniker_GetDisplayName(mon, NULL, NULL, &This->doc_obj->url);
if(FAILED(hres))
WARN("GetDisplayName failed: %08x\n", hres);
set_script_mode(This->window, use_gecko_script(This->url) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT);
set_script_mode(This->window, use_gecko_script(This->doc_obj->url) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT);
}
static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BOOL *bind_complete)
......@@ -292,7 +292,7 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva
return hres;
if(!bind_complete)
return start_binding(This, (BSCallback*)This->bscallback, pibc);
return start_binding(This, (BSCallback*)This->doc_obj->bscallback, pibc);
return S_OK;
}
......@@ -318,11 +318,11 @@ static HRESULT WINAPI PersistMoniker_GetCurMoniker(IPersistMoniker *iface, IMoni
TRACE("(%p)->(%p)\n", This, ppimkName);
if(!This->mon)
if(!This->doc_obj->mon)
return E_UNEXPECTED;
IMoniker_AddRef(This->mon);
*ppimkName = This->mon;
IMoniker_AddRef(This->doc_obj->mon);
*ppimkName = This->doc_obj->mon;
return S_OK;
}
......@@ -556,7 +556,7 @@ static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, LPSTREAM
if(FAILED(hres))
return hres;
return channelbsc_load_stream(This->bscallback, pStm);
return channelbsc_load_stream(This->doc_obj->bscallback, pStm);
}
static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM pStm,
......@@ -692,9 +692,4 @@ void HTMLDocument_Persist_Init(HTMLDocument *This)
This->lpMonikerPropVtbl = &MonikerPropVtbl;
This->lpPersistStreamInitVtbl = &PersistStreamInitVtbl;
This->lpPersistHistoryVtbl = &PersistHistoryVtbl;
This->bscallback = NULL;
This->mon = NULL;
This->url = NULL;
This->mime = NULL;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment