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

mshtml: Moved NSContainer to HTMLDocumentObj.

parent d3e6bf64
......@@ -1794,12 +1794,8 @@ static void destroy_htmldoc(HTMLDocument *This)
ConnectionPointContainer_Destroy(&This->cp_container);
if(This->nsdoc) {
remove_mutation_observer(This->nscontainer, This->nsdoc);
if(This->nsdoc)
nsIDOMHTMLDocument_Release(This->nsdoc);
}
if(This->nscontainer)
NSContainer_Release(This->nscontainer);
}
#define HTMLDOCNODE_THIS(base) DEFINE_THIS2(HTMLDocumentNode, basedoc, base)
......@@ -1904,6 +1900,10 @@ static ULONG HTMLDocumentObj_Release(HTMLDocument *base)
}
destroy_htmldoc(&This->basedoc);
if(This->basedoc.nsdoc)
remove_mutation_observer(This->nscontainer, This->basedoc.nsdoc);
if(This->nscontainer)
NSContainer_Release(This->nscontainer);
heap_free(This);
}
......@@ -1940,12 +1940,12 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
if(FAILED(hres))
return hres;
doc->basedoc.nscontainer = NSContainer_Create(&doc->basedoc, NULL);
doc->nscontainer = NSContainer_Create(doc, NULL);
if(doc->basedoc.nscontainer) {
if(doc->nscontainer) {
nsresult nsres;
nsres = nsIWebBrowser_GetContentDOMWindow(doc->basedoc.nscontainer->webbrowser, &nswindow);
nsres = nsIWebBrowser_GetContentDOMWindow(doc->nscontainer->webbrowser, &nswindow);
if(NS_FAILED(nsres))
ERR("GetContentDOMWindow failed: %08x\n", nsres);
}
......
......@@ -281,7 +281,6 @@ struct HTMLDocument {
HTMLDocumentObj *doc_obj;
HTMLDocumentNode *doc_node;
NSContainer *nscontainer;
HTMLWindow *window;
nsIDOMHTMLDocument *nsdoc;
......@@ -352,6 +351,8 @@ struct HTMLDocumentObj {
HTMLDocument basedoc;
LONG ref;
NSContainer *nscontainer;
};
typedef struct {
......@@ -397,7 +398,7 @@ struct NSContainer {
LONG ref;
NSContainer *parent;
HTMLDocument *doc;
HTMLDocumentObj *doc;
nsIURIContentListener *content_listener;
......@@ -571,7 +572,7 @@ void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
void NSContainer_Release(NSContainer*);
void init_mutation(NSContainer*);
......@@ -678,7 +679,7 @@ void release_nodes(HTMLDocument*);
void release_script_hosts(HTMLWindow*);
void connect_scripts(HTMLWindow*);
void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
void set_script_mode(HTMLWindow*,SCRIPTMODE);
BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
......@@ -697,7 +698,7 @@ typedef struct {
extern const cmdtable_t editmode_cmds[];
void do_ns_command(NSContainer*,const char*,nsICommandParams*);
void do_ns_command(HTMLDocument*,const char*,nsICommandParams*);
/* timer */
#define UPDATE_UI 0x0001
......
......@@ -214,7 +214,7 @@ static void add_script_runner(NSContainer *This)
nsIDOMNSDocument *nsdoc;
nsresult nsres;
nsres = nsIDOMHTMLDocument_QueryInterface(This->doc->nsdoc, &IID_nsIDOMNSDocument, (void**)&nsdoc);
nsres = nsIDOMHTMLDocument_QueryInterface(This->doc->basedoc.nsdoc, &IID_nsIDOMNSDocument, (void**)&nsdoc);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMNSDocument: %08x\n", nsres);
return;
......@@ -300,7 +300,7 @@ static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface)
const PRUnichar *comment;
nsAString_GetData(&comment_str, &comment);
remove_comment = handle_insert_comment(This->doc, comment);
remove_comment = handle_insert_comment(&This->doc->basedoc, comment);
}
nsAString_Finish(&comment_str);
......@@ -340,7 +340,7 @@ static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface)
break;
}
doc_insert_script(This->doc, nsscript);
doc_insert_script(This->doc->basedoc.window, nsscript);
nsIDOMHTMLScriptElement_Release(nsscript);
break;
}
......@@ -468,7 +468,7 @@ static void NSAPI nsDocumentObserver_EndLoad(nsIDocumentObserver *iface, nsIDocu
task = heap_alloc(sizeof(task_t));
task->doc = This->doc;
task->doc = &This->doc->basedoc;
task->task_id = TASK_PARSECOMPLETE;
task->next = NULL;
......@@ -545,7 +545,7 @@ static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface,
nsres = nsISupports_QueryInterface(aContent, &IID_nsIDOMElement, (void**)&nselem);
if(NS_SUCCEEDED(nsres)) {
check_event_attr(This->doc, nselem);
check_event_attr(&This->doc->basedoc, nselem);
nsIDOMElement_Release(nselem);
}
......
......@@ -949,9 +949,9 @@ 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->nscontainer) {
if(This->bsc.doc && This->bsc.doc->bscallback == This && This->bsc.doc->doc_obj->nscontainer) {
update_nsdocument(This->bsc.doc->doc_obj);
init_nsevents(This->bsc.doc->nscontainer);
init_nsevents(This->bsc.doc->doc_obj->nscontainer);
}
}
......
......@@ -117,7 +117,7 @@ static LRESULT WINAPI nsembed_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
SetFocus(This->reset_focus);
This->reset_focus = NULL;
if(This->doc)
This->doc->focus = FALSE;
This->doc->basedoc.focus = FALSE;
}
}
......@@ -744,7 +744,7 @@ void get_editor_controller(NSContainer *This)
}
nsres = nsIEditingSession_GetEditorForWindow(editing_session,
This->doc->window->nswindow, &This->editor);
This->doc->basedoc.window->nswindow, &This->editor);
nsIEditingSession_Release(editing_session);
if(NS_FAILED(nsres)) {
ERR("Could not get editor: %08x\n", nsres);
......@@ -815,10 +815,10 @@ void update_nsdocument(HTMLDocumentObj *doc)
nsresult nsres;
HRESULT hres;
if(!doc->basedoc.nscontainer || !doc->basedoc.nscontainer->navigation)
if(!doc->nscontainer || !doc->nscontainer->navigation)
return;
nsres = nsIWebNavigation_GetDocument(doc->basedoc.nscontainer->navigation, &nsdomdoc);
nsres = nsIWebNavigation_GetDocument(doc->nscontainer->navigation, &nsdomdoc);
if(NS_FAILED(nsres) || !nsdomdoc) {
ERR("GetDocument failed: %08x\n", nsres);
return;
......@@ -837,7 +837,7 @@ void update_nsdocument(HTMLDocumentObj *doc)
}
if(doc->basedoc.nsdoc) {
remove_mutation_observer(doc->basedoc.nscontainer, doc->basedoc.nsdoc);
remove_mutation_observer(doc->nscontainer, doc->basedoc.nsdoc);
nsIDOMHTMLDocument_Release(doc->basedoc.nsdoc);
doc_node = doc->basedoc.doc_node;
......@@ -852,7 +852,7 @@ void update_nsdocument(HTMLDocumentObj *doc)
return;
}
set_mutation_observer(doc->basedoc.nscontainer, nsdoc);
set_mutation_observer(doc->nscontainer, nsdoc);
hres = create_doc_from_nsdoc(nsdoc, doc, doc->basedoc.window, &doc_node);
if(FAILED(hres)) {
......@@ -968,7 +968,7 @@ static nsresult NSAPI nsWebBrowserChrome_SetStatus(nsIWebBrowserChrome *iface,
/* FIXME: This hack should be removed when we'll load all pages by URLMoniker */
if(This->doc)
update_nsdocument(This->doc->doc_obj);
update_nsdocument(This->doc);
return NS_OK;
}
......@@ -1139,7 +1139,7 @@ static nsresult NSAPI nsContextMenuListener_OnShowContextMenu(nsIContextMenuList
FIXME("aContextFlags=%08x\n", aContextFlags);
};
show_context_menu(This->doc, dwID, &pt, (IDispatch*)HTMLDOMNODE(get_node(This->doc, aNode, TRUE)));
show_context_menu(&This->doc->basedoc, dwID, &pt, (IDispatch*)HTMLDOMNODE(get_node(&This->doc->basedoc, aNode, TRUE)));
return NS_OK;
}
......@@ -1251,7 +1251,7 @@ static nsresult NSAPI nsURIContentListener_OnStartURIOpen(nsIURIContentListener
*_retval = FALSE;
}else if(This->doc) {
*_retval = translate_url(This->doc, wine_uri);
*_retval = translate_url(&This->doc->basedoc.doc_obj->basedoc, wine_uri);
}
nsIWineURI_Release(wine_uri);
......@@ -1441,7 +1441,7 @@ static nsresult NSAPI nsEmbeddingSiteWindow_GetVisibility(nsIEmbeddingSiteWindow
TRACE("(%p)->(%p)\n", This, aVisibility);
*aVisibility = This->doc && This->doc->hwnd && IsWindowVisible(This->doc->hwnd);
*aVisibility = This->doc && This->doc->basedoc.hwnd && IsWindowVisible(This->doc->basedoc.hwnd);
return NS_OK;
}
......@@ -1523,7 +1523,7 @@ static nsresult NSAPI nsTooltipListener_OnShowTooltip(nsITooltipListener *iface,
NSContainer *This = NSTOOLTIP_THIS(iface);
if (This->doc)
show_tooltip(This->doc, aXCoord, aYCoord, aTipText);
show_tooltip(&This->doc->basedoc, aXCoord, aYCoord, aTipText);
return NS_OK;
}
......@@ -1533,7 +1533,7 @@ static nsresult NSAPI nsTooltipListener_OnHideTooltip(nsITooltipListener *iface)
NSContainer *This = NSTOOLTIP_THIS(iface);
if (This->doc)
hide_tooltip(This->doc);
hide_tooltip(&This->doc->basedoc);
return NS_OK;
}
......@@ -1671,7 +1671,7 @@ static const nsISupportsWeakReferenceVtbl nsSupportsWeakReferenceVtbl = {
};
NSContainer *NSContainer_Create(HTMLDocument *doc, NSContainer *parent)
NSContainer *NSContainer_Create(HTMLDocumentObj *doc, NSContainer *parent)
{
nsIWebBrowserSetup *wbsetup;
nsIScrollable *scrollable;
......
......@@ -80,9 +80,9 @@ static BOOL is_doc_child_focus(NSContainer *This)
if(!This->doc)
return FALSE;
for(hwnd = GetFocus(); hwnd && hwnd != This->doc->hwnd; hwnd = GetParent(hwnd));
for(hwnd = GetFocus(); hwnd && hwnd != This->doc->basedoc.doc_obj->basedoc.hwnd; hwnd = GetParent(hwnd));
return hwnd == This->doc->hwnd;
return hwnd != NULL;
}
static nsresult NSAPI handle_blur(nsIDOMEventListener *iface, nsIDOMEvent *event)
......@@ -91,9 +91,9 @@ static nsresult NSAPI handle_blur(nsIDOMEventListener *iface, nsIDOMEvent *event
TRACE("(%p)\n", This);
if(!This->reset_focus && This->doc && This->doc->focus && !is_doc_child_focus(This)) {
This->doc->focus = FALSE;
notif_focus(This->doc);
if(!This->reset_focus && This->doc && This->doc->basedoc.doc_obj->basedoc.focus && !is_doc_child_focus(This)) {
This->doc->basedoc.doc_obj->basedoc.focus = FALSE;
notif_focus(&This->doc->basedoc);
}
return NS_OK;
......@@ -105,9 +105,9 @@ static nsresult NSAPI handle_focus(nsIDOMEventListener *iface, nsIDOMEvent *even
TRACE("(%p)\n", This);
if(!This->reset_focus && This->doc && !This->doc->focus) {
This->doc->focus = TRUE;
notif_focus(This->doc);
if(!This->reset_focus && This->doc && !This->doc->basedoc.focus) {
This->doc->basedoc.focus = TRUE;
notif_focus(&This->doc->basedoc);
}
return NS_OK;
......@@ -120,9 +120,9 @@ static nsresult NSAPI handle_keypress(nsIDOMEventListener *iface,
TRACE("(%p)->(%p)\n", This, event);
update_doc(This->doc, UPDATE_UI);
if(This->doc->usermode == EDITMODE)
handle_edit_event(This->doc, event);
update_doc(&This->doc->basedoc, UPDATE_UI);
if(This->doc->basedoc.usermode == EDITMODE)
handle_edit_event(&This->doc->basedoc, event);
return NS_OK;
}
......@@ -137,25 +137,25 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
if(!This->doc)
return NS_OK;
update_nsdocument(This->doc->doc_obj);
connect_scripts(This->doc->window);
update_nsdocument(This->doc);
connect_scripts(This->doc->basedoc.window);
if(This->editor_controller) {
nsIController_Release(This->editor_controller);
This->editor_controller = NULL;
}
if(This->doc->usermode == EDITMODE)
handle_edit_load(This->doc);
if(This->doc->basedoc.usermode == EDITMODE)
handle_edit_load(&This->doc->basedoc);
if(!This->doc->nsdoc) {
if(!This->doc->basedoc.nsdoc) {
ERR("NULL nsdoc\n");
return NS_ERROR_FAILURE;
}
nsIDOMHTMLDocument_GetBody(This->doc->nsdoc, &nsbody);
nsIDOMHTMLDocument_GetBody(This->doc->basedoc.nsdoc, &nsbody);
if(nsbody) {
fire_event(This->doc, EVENTID_LOAD, (nsIDOMNode*)nsbody, event);
fire_event(&This->doc->basedoc, EVENTID_LOAD, (nsIDOMNode*)nsbody, event);
nsIDOMHTMLElement_Release(nsbody);
}
......@@ -191,7 +191,7 @@ static nsresult NSAPI handle_htmlevent(nsIDOMEventListener *iface, nsIDOMEvent *
return NS_OK;
}
fire_event(This->doc, eid, nsnode, event);
fire_event(&This->doc->basedoc, eid, nsnode, event);
nsIDOMNode_Release(nsnode);
......@@ -246,7 +246,7 @@ void add_nsevent_listener(HTMLWindow *window, LPCWSTR type)
return;
}
init_event(target, type, NSEVENTLIST(&window->doc_obj->basedoc.nscontainer->htmlevent_listener), TRUE);
init_event(target, type, NSEVENTLIST(&window->doc_obj->nscontainer->htmlevent_listener), TRUE);
nsIDOMEventTarget_Release(target);
}
......
......@@ -98,12 +98,12 @@ HRESULT nsuri_to_url(LPCWSTR nsuri, BOOL ret_empty, BSTR *ret)
return S_OK;
}
static BOOL exec_shldocvw_67(HTMLDocument *doc, LPCWSTR url)
static BOOL exec_shldocvw_67(HTMLDocumentObj *doc, LPCWSTR url)
{
IOleCommandTarget *cmdtrg = NULL;
HRESULT hres;
hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget,
hres = IOleClientSite_QueryInterface(doc->basedoc.client, &IID_IOleCommandTarget,
(void**)&cmdtrg);
if(SUCCEEDED(hres)) {
VARIANT varUrl, varRes;
......@@ -128,8 +128,8 @@ static BOOL exec_shldocvw_67(HTMLDocument *doc, LPCWSTR url)
static BOOL before_async_open(nsChannel *channel, NSContainer *container)
{
HTMLDocumentObj *doc = container->doc;
IServiceProvider *service_provider;
HTMLDocument *doc = container->doc;
DWORD hlnf = 0;
LPCWSTR uri;
HRESULT hres;
......@@ -149,13 +149,13 @@ static BOOL before_async_open(nsChannel *channel, NSContainer *container)
doc = container_iter->doc;
}
if(!doc->client)
if(!doc->basedoc.client)
return TRUE;
if(!hlnf && !exec_shldocvw_67(doc, uri))
return FALSE;
hres = IOleClientSite_QueryInterface(doc->client, &IID_IServiceProvider,
hres = IOleClientSite_QueryInterface(doc->basedoc.client, &IID_IServiceProvider,
(void**)&service_provider);
if(SUCCEEDED(hres)) {
IHlinkFrame *hlink_frame;
......@@ -164,7 +164,7 @@ static BOOL before_async_open(nsChannel *channel, NSContainer *container)
&IID_IHlinkFrame, (void**)&hlink_frame);
IServiceProvider_Release(service_provider);
if(SUCCEEDED(hres)) {
hlink_frame_navigate(doc, hlink_frame, uri, channel->post_data_stream, hlnf);
hlink_frame_navigate(&doc->basedoc, hlink_frame, uri, channel->post_data_stream, hlnf);
IHlinkFrame_Release(hlink_frame);
return FALSE;
......@@ -709,9 +709,9 @@ static nsresult async_open_doc_uri(nsChannel *This, NSContainer *container,
if(container->bscallback) {
channelbsc_set_channel(container->bscallback, This, listener, context);
if(container->doc && container->doc->mime) {
if(container->doc && container->doc->basedoc.mime) {
heap_free(This->content_type);
This->content_type = heap_strdupWtoA(container->doc->mime);
This->content_type = heap_strdupWtoA(container->doc->basedoc.mime);
}
return NS_OK;
......@@ -733,7 +733,7 @@ static nsresult async_open_doc_uri(nsChannel *This, NSContainer *container,
if(FAILED(hres)) {
return NS_ERROR_UNEXPECTED;
}
set_current_mon(container->doc, mon);
set_current_mon(&container->doc->basedoc, mon);
}
*open = TRUE;
......@@ -759,7 +759,7 @@ static nsresult async_open(nsChannel *This, NSContainer *container, nsIStreamLis
task = heap_alloc(sizeof(task_t));
task->doc = container->doc;
task->doc = &container->doc->basedoc;
task->task_id = TASK_START_BINDING;
task->next = NULL;
task->bscallback = bscallback;
......
......@@ -39,20 +39,23 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
#define NSCMD_COPY "cmd_copy"
void do_ns_command(NSContainer *This, const char *cmd, nsICommandParams *nsparam)
void do_ns_command(HTMLDocument *This, const char *cmd, nsICommandParams *nsparam)
{
nsICommandManager *cmdmgr;
nsresult nsres;
TRACE("(%p)\n", This);
nsres = get_nsinterface((nsISupports*)This->webbrowser, &IID_nsICommandManager, (void**)&cmdmgr);
if(!This->doc_obj || !This->doc_obj->nscontainer)
return;
nsres = get_nsinterface((nsISupports*)This->doc_obj->nscontainer->webbrowser, &IID_nsICommandManager, (void**)&cmdmgr);
if(NS_FAILED(nsres)) {
ERR("Could not get nsICommandManager: %08x\n", nsres);
return;
}
nsres = nsICommandManager_DoCommand(cmdmgr, cmd, nsparam, This->doc->window->nswindow);
nsres = nsICommandManager_DoCommand(cmdmgr, cmd, nsparam, This->window->nswindow);
if(NS_FAILED(nsres))
ERR("DoCommand(%s) failed: %08x\n", debugstr_a(cmd), nsres);
......@@ -221,10 +224,10 @@ static HRESULT exec_print(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn,
if(pvaOut)
FIXME("unsupported pvaOut\n");
if(!This->nscontainer)
if(!This->doc_obj->nscontainer)
return S_OK;
nsres = get_nsinterface((nsISupports*)This->nscontainer->webbrowser, &IID_nsIWebBrowserPrint,
nsres = get_nsinterface((nsISupports*)This->doc_obj->nscontainer->webbrowser, &IID_nsIWebBrowserPrint,
(void**)&nsprint);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIWebBrowserPrint: %08x\n", nsres);
......@@ -473,7 +476,7 @@ static HRESULT exec_mshtml_copy(HTMLDocument *This, DWORD cmdexecopt, VARIANT *i
if(This->usermode == EDITMODE)
return editor_exec_copy(This, cmdexecopt, in, out);
do_ns_command(This->nscontainer, NSCMD_COPY, NULL);
do_ns_command(This, NSCMD_COPY, NULL);
return S_OK;
}
......@@ -613,8 +616,8 @@ static HRESULT exec_editmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
IDocHostUIHandler_HideUI(This->hostui);
}
if(This->nscontainer)
set_ns_editmode(This->nscontainer);
if(This->doc_obj->nscontainer)
set_ns_editmode(This->doc_obj->nscontainer);
if(This->ui_active) {
RECT rcBorderWidths;
......
......@@ -61,7 +61,7 @@ static ULONG WINAPI OleObject_Release(IOleObject *iface)
return IHTMLDocument2_Release(HTMLDOC(This));
}
static void update_hostinfo(HTMLDocument *This, DOCHOSTUIINFO *hostinfo)
static void update_hostinfo(HTMLDocumentObj *This, DOCHOSTUIINFO *hostinfo)
{
nsIScrollable *scrollable;
nsresult nsres;
......@@ -129,7 +129,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
TRACE("hostinfo = {%u %08x %08x %s %s}\n",
hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
update_hostinfo(This, &hostinfo);
update_hostinfo(This->doc_obj, &hostinfo);
This->hostinfo = hostinfo;
}
......
......@@ -183,11 +183,11 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO
push_task(task);
if(This->nscontainer) {
This->nscontainer->bscallback = bscallback;
nsres = nsIWebNavigation_LoadURI(This->nscontainer->navigation, url,
if(This->doc_obj->nscontainer) {
This->doc_obj->nscontainer->bscallback = bscallback;
nsres = nsIWebNavigation_LoadURI(This->doc_obj->nscontainer->navigation, url,
LOAD_FLAGS_NONE, NULL, NULL, NULL);
This->nscontainer->bscallback = NULL;
This->doc_obj->nscontainer->bscallback = NULL;
if(NS_FAILED(nsres)) {
WARN("LoadURI failed: %08x\n", nsres);
IUnknown_Release((IUnknown*)bscallback);
......
......@@ -744,7 +744,7 @@ static ScriptHost *get_script_host(HTMLWindow *window, const GUID *guid)
return create_script_host(window, guid);
}
void doc_insert_script(HTMLDocument *doc, nsIDOMHTMLScriptElement *nsscript)
void doc_insert_script(HTMLWindow *window, nsIDOMHTMLScriptElement *nsscript)
{
ScriptHost *script_host;
GUID guid;
......@@ -754,7 +754,7 @@ void doc_insert_script(HTMLDocument *doc, nsIDOMHTMLScriptElement *nsscript)
return;
}
script_host = get_script_host(doc->window, &guid);
script_host = get_script_host(window, &guid);
if(!script_host)
return;
......@@ -890,10 +890,10 @@ void set_script_mode(HTMLWindow *window, SCRIPTMODE mode)
window->scriptmode = mode;
if(!window->doc_obj->basedoc.nscontainer || !window->doc_obj->basedoc.nscontainer->webbrowser)
if(!window->doc_obj->nscontainer || !window->doc_obj->nscontainer->webbrowser)
return;
nsres = nsIWebBrowser_QueryInterface(window->doc_obj->basedoc.nscontainer->webbrowser,
nsres = nsIWebBrowser_QueryInterface(window->doc_obj->nscontainer->webbrowser,
&IID_nsIWebBrowserSetup, (void**)&setup);
if(NS_SUCCEEDED(nsres)) {
nsres = nsIWebBrowserSetup_SetProperty(setup, SETUP_ALLOW_JAVASCRIPT,
......
......@@ -50,17 +50,17 @@ typedef struct {
WNDPROC proc;
} tooltip_data;
static void paint_document(HTMLDocument *This)
static void paint_document(HTMLDocumentObj *This)
{
PAINTSTRUCT ps;
RECT rect;
HDC hdc;
GetClientRect(This->hwnd, &rect);
GetClientRect(This->basedoc.hwnd, &rect);
hdc = BeginPaint(This->hwnd, &ps);
hdc = BeginPaint(This->basedoc.hwnd, &ps);
if(!(This->hostinfo.dwFlags & (DOCHOSTUIFLAG_NO3DOUTERBORDER|DOCHOSTUIFLAG_NO3DBORDER)))
if(!(This->basedoc.hostinfo.dwFlags & (DOCHOSTUIFLAG_NO3DOUTERBORDER|DOCHOSTUIFLAG_NO3DBORDER)))
DrawEdge(hdc, &rect, EDGE_SUNKEN, BF_RECT|BF_ADJUST);
if(!This->nscontainer) {
......@@ -80,14 +80,14 @@ static void paint_document(HTMLDocument *This)
DeleteObject(font);
}
EndPaint(This->hwnd, &ps);
EndPaint(This->basedoc.hwnd, &ps);
}
static void activate_gecko(NSContainer *This)
{
TRACE("(%p) %p\n", This, This->window);
SetParent(This->hwnd, This->doc->hwnd);
SetParent(This->hwnd, This->doc->basedoc.hwnd);
ShowWindow(This->hwnd, SW_SHOW);
nsIBaseWindow_SetVisibility(This->window, TRUE);
......@@ -98,7 +98,7 @@ static void activate_gecko(NSContainer *This)
void update_doc(HTMLDocument *This, DWORD flags)
{
if(!This->update && This->hwnd)
SetTimer(This->hwnd, TIMER_ID, 100, NULL);
SetTimer(This->doc_obj->basedoc.hwnd, TIMER_ID, 100, NULL);
This->update |= flags;
}
......@@ -197,19 +197,19 @@ static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
This->hwnd = hwnd;
break;
case WM_PAINT:
paint_document(This);
paint_document(This->doc_obj);
break;
case WM_SIZE:
TRACE("(%p)->(WM_SIZE)\n", This);
if(This->nscontainer) {
if(This->doc_obj->nscontainer) {
INT ew=0, eh=0;
if(!(This->hostinfo.dwFlags & (DOCHOSTUIFLAG_NO3DOUTERBORDER|DOCHOSTUIFLAG_NO3DBORDER))) {
if(!(This->doc_obj->basedoc.hostinfo.dwFlags & (DOCHOSTUIFLAG_NO3DOUTERBORDER|DOCHOSTUIFLAG_NO3DBORDER))) {
ew = GetSystemMetrics(SM_CXEDGE);
eh = GetSystemMetrics(SM_CYEDGE);
}
SetWindowPos(This->nscontainer->hwnd, NULL, ew, eh,
SetWindowPos(This->doc_obj->nscontainer->hwnd, NULL, ew, eh,
LOWORD(lParam) - 2*ew, HIWORD(lParam) - 2*eh,
SWP_NOZORDER | SWP_NOACTIVATE);
}
......@@ -301,8 +301,8 @@ static HRESULT activate_window(HTMLDocument *This)
SetTimer(This->hwnd, TIMER_ID, 100, NULL);
}
if(This->nscontainer)
activate_gecko(This->nscontainer);
if(This->doc_obj->nscontainer)
activate_gecko(This->doc_obj->nscontainer);
This->in_place_active = TRUE;
hres = IOleInPlaceSite_QueryInterface(This->ipsite, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex);
......@@ -591,8 +591,8 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
}
This->focus = TRUE;
if(This->nscontainer)
nsIWebBrowserFocus_Activate(This->nscontainer->focus);
if(This->doc_obj->nscontainer)
nsIWebBrowserFocus_Activate(This->doc_obj->nscontainer->focus);
notif_focus(This);
update_doc(This, UPDATE_UI);
......
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