mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
mshtml: Moved document node from HTMLOuterWindow to HTMLInnerWindow.
This commit is contained in:
parent
08964ede45
commit
79356c65c1
15 changed files with 151 additions and 100 deletions
|
@ -1568,7 +1568,7 @@ static void HTMLDocument_on_advise(IUnknown *iface, cp_static_data_t *cp)
|
|||
HTMLDocument *This = impl_from_IHTMLDocument2((IHTMLDocument2*)iface);
|
||||
|
||||
if(This->window)
|
||||
update_cp_events(This->window, &This->doc_node->node.event_target, cp, This->doc_node->node.nsnode);
|
||||
update_cp_events(This->window->base.inner_window, &This->doc_node->node.event_target, cp, This->doc_node->node.nsnode);
|
||||
}
|
||||
|
||||
static inline HTMLDocument *impl_from_ISupportErrorInfo(ISupportErrorInfo *iface)
|
||||
|
@ -2448,7 +2448,6 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
|
||||
nsres = nsIWebBrowser_GetContentDOMWindow(doc->nscontainer->webbrowser, &nswindow);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("GetContentDOMWindow failed: %08x\n", nsres);
|
||||
|
@ -2461,8 +2460,8 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
|
|||
return hres;
|
||||
}
|
||||
|
||||
if(!doc->basedoc.doc_node && doc->basedoc.window->doc) {
|
||||
doc->basedoc.doc_node = doc->basedoc.window->doc;
|
||||
if(!doc->basedoc.doc_node && doc->basedoc.window->base.inner_window->doc) {
|
||||
doc->basedoc.doc_node = doc->basedoc.window->base.inner_window->doc;
|
||||
htmldoc_addref(&doc->basedoc.doc_node->basedoc);
|
||||
}
|
||||
|
||||
|
|
|
@ -1348,7 +1348,7 @@ HRESULT detach_event(event_target_t *event_target, HTMLDocument *doc, BSTR name,
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
void update_cp_events(HTMLOuterWindow *window, event_target_t **event_target_ptr, cp_static_data_t *cp, nsIDOMNode *nsnode)
|
||||
void update_cp_events(HTMLInnerWindow *window, event_target_t **event_target_ptr, cp_static_data_t *cp, nsIDOMNode *nsnode)
|
||||
{
|
||||
event_target_t *event_target;
|
||||
int i;
|
||||
|
|
|
@ -54,7 +54,7 @@ HRESULT attach_event(event_target_t**,nsIDOMNode*,HTMLDocument*,BSTR,IDispatch*,
|
|||
HRESULT detach_event(event_target_t*,HTMLDocument*,BSTR,IDispatch*) DECLSPEC_HIDDEN;
|
||||
HRESULT dispatch_event(HTMLDOMNode*,const WCHAR*,VARIANT*,VARIANT_BOOL*) DECLSPEC_HIDDEN;
|
||||
HRESULT call_fire_event(HTMLDOMNode*,eventid_t) DECLSPEC_HIDDEN;
|
||||
void update_cp_events(HTMLOuterWindow*,event_target_t**,cp_static_data_t*,nsIDOMNode*) DECLSPEC_HIDDEN;
|
||||
void update_cp_events(HTMLInnerWindow*,event_target_t**,cp_static_data_t*,nsIDOMNode*) DECLSPEC_HIDDEN;
|
||||
HRESULT doc_init_events(HTMLDocumentNode*) DECLSPEC_HIDDEN;
|
||||
void detach_events(HTMLDocumentNode *doc) DECLSPEC_HIDDEN;
|
||||
|
||||
|
|
|
@ -206,12 +206,12 @@ static HRESULT HTMLFrameElement_get_document(HTMLDOMNode *iface, IDispatch **p)
|
|||
{
|
||||
HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
|
||||
|
||||
if(!This->framebase.content_window || !This->framebase.content_window->doc) {
|
||||
if(!This->framebase.content_window || !This->framebase.content_window->base.inner_window->doc) {
|
||||
*p = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*p = (IDispatch*)&This->framebase.content_window->doc->basedoc.IHTMLDocument2_iface;
|
||||
*p = (IDispatch*)&This->framebase.content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface;
|
||||
IDispatch_AddRef(*p);
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -461,12 +461,12 @@ static HRESULT WINAPI HTMLFrameBase2_get_readyState(IHTMLFrameBase2 *iface, BSTR
|
|||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(!This->content_window || !This->content_window->doc) {
|
||||
if(!This->content_window || !This->content_window->base.inner_window->doc) {
|
||||
FIXME("no document associated\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return IHTMLDocument2_get_readyState(&This->content_window->doc->basedoc.IHTMLDocument2_iface, p);
|
||||
return IHTMLDocument2_get_readyState(&This->content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface, p);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLFrameBase2_put_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL v)
|
||||
|
|
|
@ -184,12 +184,12 @@ static HRESULT HTMLIFrame_get_document(HTMLDOMNode *iface, IDispatch **p)
|
|||
{
|
||||
HTMLIFrame *This = impl_from_HTMLDOMNode(iface);
|
||||
|
||||
if(!This->framebase.content_window || !This->framebase.content_window->doc) {
|
||||
if(!This->framebase.content_window || !This->framebase.content_window->base.inner_window->doc) {
|
||||
*p = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*p = (IDispatch*)&This->framebase.content_window->doc->basedoc.IHTMLDocument2_iface;
|
||||
*p = (IDispatch*)&This->framebase.content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface;
|
||||
IDispatch_AddRef(*p);
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -807,6 +807,7 @@ static HRESULT WINAPI HTMLImageElementFactory_create(IHTMLImageElementFactory *i
|
|||
VARIANT width, VARIANT height, IHTMLImgElement **img_elem)
|
||||
{
|
||||
HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface);
|
||||
HTMLDocumentNode *doc;
|
||||
IHTMLImgElement *img;
|
||||
HTMLElement *elem;
|
||||
nsIDOMHTMLElement *nselem;
|
||||
|
@ -818,18 +819,20 @@ static HRESULT WINAPI HTMLImageElementFactory_create(IHTMLImageElementFactory *i
|
|||
TRACE("(%p)->(%s %s %p)\n", This, debugstr_variant(&width),
|
||||
debugstr_variant(&height), img_elem);
|
||||
|
||||
if(!This->window || !This->window->doc) {
|
||||
if(!This->window || !This->window->base.inner_window->doc) {
|
||||
WARN("NULL doc\n");
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
doc = This->window->base.inner_window->doc;
|
||||
|
||||
*img_elem = NULL;
|
||||
|
||||
hres = create_nselem(This->window->doc, imgW, &nselem);
|
||||
hres = create_nselem(doc, imgW, &nselem);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = HTMLElement_Create(This->window->doc, (nsIDOMNode*)nselem, FALSE, &elem);
|
||||
hres = HTMLElement_Create(doc, (nsIDOMNode*)nselem, FALSE, &elem);
|
||||
nsIDOMHTMLElement_Release(nselem);
|
||||
if(FAILED(hres)) {
|
||||
ERR("HTMLElement_Create failed\n");
|
||||
|
|
|
@ -468,18 +468,18 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory
|
|||
TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_variant(&text), debugstr_variant(&value),
|
||||
debugstr_variant(&defaultselected), debugstr_variant(&selected), optelem);
|
||||
|
||||
if(!This->window || !This->window->doc) {
|
||||
if(!This->window || !This->window->base.inner_window->doc) {
|
||||
WARN("NULL doc\n");
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
*optelem = NULL;
|
||||
|
||||
hres = create_nselem(This->window->doc, optionW, &nselem);
|
||||
hres = create_nselem(This->window->base.inner_window->doc, optionW, &nselem);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = get_node(This->window->doc, (nsIDOMNode*)nselem, TRUE, &node);
|
||||
hres = get_node(This->window->base.inner_window->doc, (nsIDOMNode*)nselem, TRUE, &node);
|
||||
nsIDOMHTMLElement_Release(nselem);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
|
|
@ -43,48 +43,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|||
|
||||
static struct list window_list = LIST_INIT(window_list);
|
||||
|
||||
static HRESULT window_set_docnode(HTMLOuterWindow*,HTMLDocumentNode*);
|
||||
|
||||
static inline BOOL is_outer_window(HTMLWindow *window)
|
||||
{
|
||||
return &window->outer_window->base == window;
|
||||
}
|
||||
|
||||
static void window_set_docnode(HTMLOuterWindow *window, HTMLDocumentNode *doc_node)
|
||||
{
|
||||
if(window->doc) {
|
||||
if(window->doc_obj && window == window->doc_obj->basedoc.window)
|
||||
window->doc->basedoc.cp_container.forward_container = NULL;
|
||||
detach_events(window->doc);
|
||||
abort_document_bindings(window->doc);
|
||||
release_script_hosts(window);
|
||||
window->doc->basedoc.window = NULL;
|
||||
htmldoc_release(&window->doc->basedoc);
|
||||
}
|
||||
window->doc = doc_node;
|
||||
if(doc_node)
|
||||
htmldoc_addref(&doc_node->basedoc);
|
||||
|
||||
if(window->doc_obj && window->doc_obj->basedoc.window == window) {
|
||||
if(window->doc_obj->basedoc.doc_node)
|
||||
htmldoc_release(&window->doc_obj->basedoc.doc_node->basedoc);
|
||||
window->doc_obj->basedoc.doc_node = doc_node;
|
||||
if(doc_node)
|
||||
htmldoc_addref(&doc_node->basedoc);
|
||||
}
|
||||
|
||||
if(doc_node && window->doc_obj && window->doc_obj->usermode == EDITMODE) {
|
||||
nsAString mode_str;
|
||||
nsresult nsres;
|
||||
|
||||
static const PRUnichar onW[] = {'o','n',0};
|
||||
|
||||
nsAString_Init(&mode_str, onW);
|
||||
nsres = nsIDOMHTMLDocument_SetDesignMode(doc_node->nsdoc, &mode_str);
|
||||
nsAString_Finish(&mode_str);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("SetDesignMode failed: %08x\n", nsres);
|
||||
}
|
||||
}
|
||||
|
||||
static void release_children(HTMLOuterWindow *This)
|
||||
{
|
||||
HTMLOuterWindow *child;
|
||||
|
@ -124,22 +89,22 @@ void get_top_window(HTMLOuterWindow *window, HTMLOuterWindow **ret)
|
|||
|
||||
static inline HRESULT set_window_event(HTMLWindow *window, eventid_t eid, VARIANT *var)
|
||||
{
|
||||
if(!window->outer_window->doc) {
|
||||
if(!window->inner_window->doc) {
|
||||
FIXME("No document\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return set_event_handler(&window->outer_window->doc->body_event_target, NULL, window->outer_window->doc, eid, var);
|
||||
return set_event_handler(&window->inner_window->doc->body_event_target, NULL, window->inner_window->doc, eid, var);
|
||||
}
|
||||
|
||||
static inline HRESULT get_window_event(HTMLWindow *window, eventid_t eid, VARIANT *var)
|
||||
{
|
||||
if(!window->outer_window->doc) {
|
||||
if(!window->inner_window->doc) {
|
||||
FIXME("No document\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return get_event_handler(&window->outer_window->doc->body_event_target, eid, var);
|
||||
return get_event_handler(&window->inner_window->doc->body_event_target, eid, var);
|
||||
}
|
||||
|
||||
static inline HTMLWindow *impl_from_IHTMLWindow2(IHTMLWindow2 *iface)
|
||||
|
@ -266,6 +231,7 @@ static void release_outer_window(HTMLOuterWindow *This)
|
|||
|
||||
static void release_inner_window(HTMLInnerWindow *This)
|
||||
{
|
||||
htmldoc_release(&This->doc->basedoc);
|
||||
heap_free(This);
|
||||
}
|
||||
|
||||
|
@ -529,7 +495,7 @@ static HRESULT WINAPI HTMLWindow2_clearTimeout(IHTMLWindow2 *iface, LONG timerID
|
|||
|
||||
TRACE("(%p)->(%d)\n", This, timerID);
|
||||
|
||||
return clear_task_timer(&This->outer_window->doc->basedoc, FALSE, timerID);
|
||||
return clear_task_timer(&This->inner_window->doc->basedoc, FALSE, timerID);
|
||||
}
|
||||
|
||||
#define MAX_MESSAGE_LEN 2000
|
||||
|
@ -1046,9 +1012,9 @@ static HRESULT WINAPI HTMLWindow2_get_document(IHTMLWindow2 *iface, IHTMLDocumen
|
|||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(This->outer_window->doc) {
|
||||
if(This->inner_window->doc) {
|
||||
/* FIXME: We should return a wrapper object here */
|
||||
*p = &This->outer_window->doc->basedoc.IHTMLDocument2_iface;
|
||||
*p = &This->inner_window->doc->basedoc.IHTMLDocument2_iface;
|
||||
IHTMLDocument2_AddRef(*p);
|
||||
}else {
|
||||
*p = NULL;
|
||||
|
@ -1187,7 +1153,7 @@ static HRESULT WINAPI HTMLWindow2_clearInterval(IHTMLWindow2 *iface, LONG timerI
|
|||
|
||||
TRACE("(%p)->(%d)\n", This, timerID);
|
||||
|
||||
return clear_task_timer(&This->outer_window->doc->basedoc, TRUE, timerID);
|
||||
return clear_task_timer(&This->inner_window->doc->basedoc, TRUE, timerID);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLWindow2_put_offscreenBuffering(IHTMLWindow2 *iface, VARIANT v)
|
||||
|
@ -1457,7 +1423,7 @@ static HRESULT WINAPI HTMLWindow3_get_screenTop(IHTMLWindow3 *iface, LONG *p)
|
|||
static HRESULT WINAPI HTMLWindow3_attachEvent(IHTMLWindow3 *iface, BSTR event, IDispatch *pDisp, VARIANT_BOOL *pfResult)
|
||||
{
|
||||
HTMLWindow *This = impl_from_IHTMLWindow3(iface);
|
||||
HTMLOuterWindow *window = This->outer_window;
|
||||
HTMLInnerWindow *window = This->inner_window;
|
||||
|
||||
TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
|
||||
|
||||
|
@ -1472,7 +1438,7 @@ static HRESULT WINAPI HTMLWindow3_attachEvent(IHTMLWindow3 *iface, BSTR event, I
|
|||
static HRESULT WINAPI HTMLWindow3_detachEvent(IHTMLWindow3 *iface, BSTR event, IDispatch *pDisp)
|
||||
{
|
||||
HTMLWindow *This = impl_from_IHTMLWindow3(iface);
|
||||
HTMLOuterWindow *window = This->outer_window;
|
||||
HTMLInnerWindow *window = This->inner_window;
|
||||
|
||||
TRACE("(%p)->()\n", This);
|
||||
|
||||
|
@ -1484,7 +1450,7 @@ static HRESULT WINAPI HTMLWindow3_detachEvent(IHTMLWindow3 *iface, BSTR event, I
|
|||
return detach_event(window->doc->body_event_target, &window->doc->basedoc, event, pDisp);
|
||||
}
|
||||
|
||||
static HRESULT window_set_timer(HTMLOuterWindow *This, VARIANT *expr, LONG msec, VARIANT *language,
|
||||
static HRESULT window_set_timer(HTMLInnerWindow *This, VARIANT *expr, LONG msec, VARIANT *language,
|
||||
BOOL interval, LONG *timer_id)
|
||||
{
|
||||
IDispatch *disp = NULL;
|
||||
|
@ -1496,7 +1462,7 @@ static HRESULT window_set_timer(HTMLOuterWindow *This, VARIANT *expr, LONG msec,
|
|||
break;
|
||||
|
||||
case VT_BSTR:
|
||||
disp = script_parse_event(This, V_BSTR(expr));
|
||||
disp = script_parse_event(This->base.outer_window, V_BSTR(expr));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1520,7 +1486,7 @@ static HRESULT WINAPI HTMLWindow3_setTimeout(IHTMLWindow3 *iface, VARIANT *expre
|
|||
|
||||
TRACE("(%p)->(%s %d %s %p)\n", This, debugstr_variant(expression), msec, debugstr_variant(language), timerID);
|
||||
|
||||
return window_set_timer(This->outer_window, expression, msec, language, FALSE, timerID);
|
||||
return window_set_timer(This->inner_window, expression, msec, language, FALSE, timerID);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLWindow3_setInterval(IHTMLWindow3 *iface, VARIANT *expression, LONG msec,
|
||||
|
@ -1530,7 +1496,7 @@ static HRESULT WINAPI HTMLWindow3_setInterval(IHTMLWindow3 *iface, VARIANT *expr
|
|||
|
||||
TRACE("(%p)->(%p %d %p %p)\n", This, expression, msec, language, timerID);
|
||||
|
||||
return window_set_timer(This->outer_window, expression, msec, language, TRUE, timerID);
|
||||
return window_set_timer(This->inner_window, expression, msec, language, TRUE, timerID);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLWindow3_print(IHTMLWindow3 *iface)
|
||||
|
@ -2299,11 +2265,11 @@ static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName,
|
|||
if(hres != DISP_E_UNKNOWNNAME)
|
||||
return hres;
|
||||
|
||||
if(window->doc) {
|
||||
if(window->base.inner_window->doc) {
|
||||
global_prop_t *prop;
|
||||
IHTMLElement *elem;
|
||||
|
||||
hres = IHTMLDocument3_getElementById(&window->doc->basedoc.IHTMLDocument3_iface,
|
||||
hres = IHTMLDocument3_getElementById(&window->base.inner_window->doc->basedoc.IHTMLDocument3_iface,
|
||||
bstrName, &elem);
|
||||
if(SUCCEEDED(hres) && elem) {
|
||||
IHTMLElement_Release(elem);
|
||||
|
@ -2518,7 +2484,7 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD
|
|||
case DISPATCH_PROPERTYGET: {
|
||||
IHTMLElement *elem;
|
||||
|
||||
hres = IHTMLDocument3_getElementById(&This->doc->basedoc.IHTMLDocument3_iface,
|
||||
hres = IHTMLDocument3_getElementById(&This->base.inner_window->doc->basedoc.IHTMLDocument3_iface,
|
||||
prop->name, &elem);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
@ -2600,7 +2566,26 @@ static void *alloc_window(size_t size)
|
|||
return window;
|
||||
}
|
||||
|
||||
HRESULT HTMLOuterWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTMLOuterWindow *parent, HTMLOuterWindow **ret)
|
||||
static HRESULT create_inner_window(HTMLOuterWindow *outer_window, HTMLDocumentNode *doc_node, HTMLInnerWindow **ret)
|
||||
{
|
||||
HTMLInnerWindow *window;
|
||||
|
||||
window = alloc_window(sizeof(HTMLInnerWindow));
|
||||
if(!window)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
window->base.outer_window = outer_window;
|
||||
window->base.inner_window = window;
|
||||
|
||||
htmldoc_addref(&doc_node->basedoc);
|
||||
window->doc = doc_node;
|
||||
|
||||
*ret = window;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT HTMLOuterWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow,
|
||||
HTMLOuterWindow *parent, HTMLOuterWindow **ret)
|
||||
{
|
||||
HTMLOuterWindow *window;
|
||||
HRESULT hres;
|
||||
|
@ -2634,6 +2619,12 @@ HRESULT HTMLOuterWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow,
|
|||
window->readystate = READYSTATE_UNINITIALIZED;
|
||||
list_init(&window->script_hosts);
|
||||
|
||||
hres = update_window_doc(window);
|
||||
if(FAILED(hres)) {
|
||||
IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface);
|
||||
return hres;
|
||||
}
|
||||
|
||||
hres = CoInternetCreateSecurityManager(NULL, &window->secmgr, 0);
|
||||
if(FAILED(hres)) {
|
||||
IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface);
|
||||
|
@ -2641,7 +2632,6 @@ HRESULT HTMLOuterWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow,
|
|||
}
|
||||
|
||||
window->task_magic = get_task_target_magic();
|
||||
update_window_doc(window);
|
||||
|
||||
list_init(&window->children);
|
||||
list_add_head(&window_list, &window->entry);
|
||||
|
@ -2657,39 +2647,97 @@ HRESULT HTMLOuterWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow,
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
void update_window_doc(HTMLOuterWindow *window)
|
||||
static HRESULT window_set_docnode(HTMLOuterWindow *window, HTMLDocumentNode *doc_node)
|
||||
{
|
||||
HTMLInnerWindow *inner_window;
|
||||
HRESULT hres;
|
||||
|
||||
if(window->base.inner_window) {
|
||||
if(window->doc_obj && window == window->doc_obj->basedoc.window)
|
||||
window->base.inner_window->doc->basedoc.cp_container.forward_container = NULL;
|
||||
detach_events(window->base.inner_window->doc);
|
||||
abort_document_bindings(window->base.inner_window->doc);
|
||||
release_script_hosts(window);
|
||||
}
|
||||
|
||||
if(doc_node) {
|
||||
hres = create_inner_window(window, doc_node, &inner_window);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
}else {
|
||||
inner_window = NULL;
|
||||
}
|
||||
|
||||
if(window->base.inner_window) {
|
||||
window->base.inner_window->doc->basedoc.window = NULL;
|
||||
window->base.inner_window->base.outer_window = NULL;
|
||||
IHTMLWindow2_Release(&window->base.inner_window->base.IHTMLWindow2_iface);
|
||||
}
|
||||
window->base.inner_window = inner_window;
|
||||
|
||||
if(!doc_node)
|
||||
return S_OK;
|
||||
|
||||
if(window->doc_obj && window->doc_obj->basedoc.window == window) {
|
||||
if(window->doc_obj->basedoc.doc_node)
|
||||
htmldoc_release(&window->doc_obj->basedoc.doc_node->basedoc);
|
||||
window->doc_obj->basedoc.doc_node = doc_node;
|
||||
if(doc_node)
|
||||
htmldoc_addref(&doc_node->basedoc);
|
||||
}
|
||||
|
||||
if(doc_node && window->doc_obj && window->doc_obj->usermode == EDITMODE) {
|
||||
nsAString mode_str;
|
||||
nsresult nsres;
|
||||
|
||||
static const PRUnichar onW[] = {'o','n',0};
|
||||
|
||||
nsAString_Init(&mode_str, onW);
|
||||
nsres = nsIDOMHTMLDocument_SetDesignMode(doc_node->nsdoc, &mode_str);
|
||||
nsAString_Finish(&mode_str);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("SetDesignMode failed: %08x\n", nsres);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT update_window_doc(HTMLOuterWindow *window)
|
||||
{
|
||||
nsIDOMHTMLDocument *nshtmldoc;
|
||||
nsIDOMDocument *nsdoc;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
||||
nsres = nsIDOMWindow_GetDocument(window->nswindow, &nsdoc);
|
||||
if(NS_FAILED(nsres) || !nsdoc) {
|
||||
ERR("GetDocument failed: %08x\n", nsres);
|
||||
return;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
nsres = nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&nshtmldoc);
|
||||
nsIDOMDocument_Release(nsdoc);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("Could not get nsIDOMHTMLDocument iface: %08x\n", nsres);
|
||||
return;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(!window->doc || window->doc->nsdoc != nshtmldoc) {
|
||||
if(!window->base.inner_window || window->base.inner_window->doc->nsdoc != nshtmldoc) {
|
||||
HTMLDocumentNode *doc;
|
||||
HRESULT hres;
|
||||
|
||||
hres = create_doc_from_nsdoc(nshtmldoc, window->doc_obj, window, &doc);
|
||||
if(SUCCEEDED(hres)) {
|
||||
window_set_docnode(window, doc);
|
||||
hres = window_set_docnode(window, doc);
|
||||
htmldoc_release(&doc->basedoc);
|
||||
}else {
|
||||
ERR("create_doc_from_nsdoc failed: %08x\n", hres);
|
||||
}
|
||||
}else {
|
||||
hres = S_OK;
|
||||
}
|
||||
|
||||
nsIDOMHTMLDocument_Release(nshtmldoc);
|
||||
return hres;
|
||||
}
|
||||
|
||||
HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow *nswindow)
|
||||
|
|
|
@ -321,7 +321,6 @@ struct HTMLOuterWindow {
|
|||
windowref_t *window_ref;
|
||||
LONG task_magic;
|
||||
|
||||
HTMLDocumentNode *doc;
|
||||
HTMLDocumentObj *doc_obj;
|
||||
nsIDOMWindow *nswindow;
|
||||
HTMLOuterWindow *parent;
|
||||
|
@ -357,6 +356,8 @@ struct HTMLOuterWindow {
|
|||
|
||||
struct HTMLInnerWindow {
|
||||
HTMLWindow base;
|
||||
|
||||
HTMLDocumentNode *doc;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
@ -656,7 +657,7 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLOuterWind
|
|||
HRESULT create_document_fragment(nsIDOMNode*,HTMLDocumentNode*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
|
||||
void update_window_doc(HTMLOuterWindow*) DECLSPEC_HIDDEN;
|
||||
HRESULT update_window_doc(HTMLOuterWindow*) DECLSPEC_HIDDEN;
|
||||
HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN;
|
||||
void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
|
||||
HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLOuterWindow*) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -726,7 +726,7 @@ HRESULT start_binding(HTMLOuterWindow *window, HTMLDocumentNode *doc, BSCallback
|
|||
|
||||
bscallback->doc = doc;
|
||||
if(!doc && window)
|
||||
bscallback->doc = window->doc;
|
||||
bscallback->doc = window->base.inner_window->doc;
|
||||
|
||||
/* NOTE: IE7 calls IsSystemMoniker here*/
|
||||
|
||||
|
@ -998,10 +998,10 @@ static HRESULT on_start_nsrequest(nsChannelBSC *This)
|
|||
list_remove(&This->bsc.entry);
|
||||
list_init(&This->bsc.entry);
|
||||
update_window_doc(This->window);
|
||||
if(This->window->doc != This->bsc.doc) {
|
||||
if(This->window->base.inner_window->doc != This->bsc.doc) {
|
||||
if(This->bsc.doc)
|
||||
list_remove(&This->bsc.entry);
|
||||
This->bsc.doc = This->window->doc;
|
||||
This->bsc.doc = This->window->base.inner_window->doc;
|
||||
}
|
||||
list_add_head(&This->bsc.doc->bindings, &This->bsc.entry);
|
||||
if(This->window->readystate != READYSTATE_LOADING)
|
||||
|
@ -1276,7 +1276,7 @@ static HRESULT nsChannelBSC_start_binding(BSCallback *bsc)
|
|||
nsChannelBSC *This = nsChannelBSC_from_BSCallback(bsc);
|
||||
|
||||
if(This->window)
|
||||
This->window->doc->skip_mutation_notif = FALSE;
|
||||
This->window->base.inner_window->doc->skip_mutation_notif = FALSE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1668,7 +1668,7 @@ void set_window_bscallback(HTMLOuterWindow *window, nsChannelBSC *callback)
|
|||
if(callback) {
|
||||
callback->window = window;
|
||||
IBindStatusCallback_AddRef(&callback->bsc.IBindStatusCallback_iface);
|
||||
callback->bsc.doc = window->doc;
|
||||
callback->bsc.doc = window->base.inner_window->doc;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2150,7 +2150,7 @@ HRESULT navigate_url(HTMLOuterWindow *window, const WCHAR *new_url, const WCHAR
|
|||
if(window->doc_obj && window == window->doc_obj->basedoc.window) {
|
||||
BOOL cancel;
|
||||
|
||||
hres = hlink_frame_navigate(&window->doc->basedoc, url, NULL, 0, &cancel);
|
||||
hres = hlink_frame_navigate(&window->base.inner_window->doc->basedoc, url, NULL, 0, &cancel);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@ static nsIDOMElement *get_dom_element(NPP instance)
|
|||
return elem;
|
||||
}
|
||||
|
||||
static HTMLOuterWindow *get_elem_window(nsIDOMElement *elem)
|
||||
static HTMLInnerWindow *get_elem_window(nsIDOMElement *elem)
|
||||
{
|
||||
nsIDOMWindow *nswindow;
|
||||
nsIDOMDocument *nsdoc;
|
||||
|
@ -253,7 +253,7 @@ static HTMLOuterWindow *get_elem_window(nsIDOMElement *elem)
|
|||
window = nswindow_to_window(nswindow);
|
||||
nsIDOMWindow_Release(nswindow);
|
||||
|
||||
return window;
|
||||
return window->base.inner_window;
|
||||
}
|
||||
|
||||
static BOOL parse_classid(const PRUnichar *classid, CLSID *clsid)
|
||||
|
@ -313,7 +313,7 @@ static BOOL get_elem_clsid(nsIDOMElement *elem, CLSID *clsid)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static IUnknown *create_activex_object(HTMLOuterWindow *window, nsIDOMElement *nselem, CLSID *clsid)
|
||||
static IUnknown *create_activex_object(HTMLInnerWindow *window, nsIDOMElement *nselem, CLSID *clsid)
|
||||
{
|
||||
IClassFactoryEx *cfex;
|
||||
IClassFactory *cf;
|
||||
|
@ -357,7 +357,7 @@ static NPError CDECL NPP_New(NPMIMEType pluginType, NPP instance, UINT16 mode, I
|
|||
char **argv, NPSavedData *saved)
|
||||
{
|
||||
nsIDOMElement *nselem;
|
||||
HTMLOuterWindow *window;
|
||||
HTMLInnerWindow *window;
|
||||
IUnknown *obj;
|
||||
CLSID clsid;
|
||||
NPError err = NPERR_NO_ERROR;
|
||||
|
|
|
@ -285,10 +285,10 @@ HRESULT load_nsuri(HTMLOuterWindow *window, nsWineURI *uri, nsChannelBSC *channe
|
|||
}
|
||||
|
||||
uri->channel_bsc = channelbsc;
|
||||
doc = window->doc;
|
||||
doc = window->base.inner_window->doc;
|
||||
doc->skip_mutation_notif = TRUE;
|
||||
nsres = nsIDocShell_LoadURI(doc_shell, (nsIURI*)&uri->nsIURL_iface, NULL, flags, FALSE);
|
||||
if(doc == window->doc)
|
||||
if(doc == window->base.inner_window->doc)
|
||||
doc->skip_mutation_notif = FALSE;
|
||||
uri->channel_bsc = NULL;
|
||||
nsIDocShell_Release(doc_shell);
|
||||
|
@ -1022,9 +1022,9 @@ static nsresult async_open(nsChannel *This, HTMLOuterWindow *window, BOOL is_doc
|
|||
}else {
|
||||
start_binding_task_t *task = heap_alloc(sizeof(start_binding_task_t));
|
||||
|
||||
task->doc = window->doc;
|
||||
task->doc = window->base.inner_window->doc;
|
||||
task->bscallback = bscallback;
|
||||
push_task(&task->header, start_binding_proc, start_binding_task_destr, window->doc->basedoc.task_magic);
|
||||
push_task(&task->header, start_binding_proc, start_binding_task_destr, window->base.inner_window->doc->basedoc.task_magic);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -406,7 +406,7 @@ void set_ready_state(HTMLOuterWindow *window, READYSTATE readystate)
|
|||
if(window->doc_obj && window->doc_obj->basedoc.window == window)
|
||||
call_property_onchanged(&window->doc_obj->basedoc.cp_propnotif, DISPID_READYSTATE);
|
||||
|
||||
fire_event(window->doc, EVENTID_READYSTATECHANGE, FALSE, window->doc->node.nsnode, NULL);
|
||||
fire_event(window->base.inner_window->doc, EVENTID_READYSTATECHANGE, FALSE, window->base.inner_window->doc->node.nsnode, NULL);
|
||||
|
||||
if(window->frame_element)
|
||||
fire_event(window->frame_element->element.node.doc, EVENTID_READYSTATECHANGE,
|
||||
|
|
|
@ -573,10 +573,10 @@ static HRESULT WINAPI ASServiceProvider_QueryService(IServiceProvider *iface, RE
|
|||
if(IsEqualGUID(&SID_SInternetHostSecurityManager, guidService)) {
|
||||
TRACE("(%p)->(SID_SInternetHostSecurityManager)\n", This);
|
||||
|
||||
if(!This->window || !This->window->doc)
|
||||
if(!This->window || !This->window->base.inner_window->doc)
|
||||
return E_NOINTERFACE;
|
||||
|
||||
return IInternetHostSecurityManager_QueryInterface(&This->window->doc->IInternetHostSecurityManager_iface,
|
||||
return IInternetHostSecurityManager_QueryInterface(&This->window->base.inner_window->doc->IInternetHostSecurityManager_iface,
|
||||
riid, ppv);
|
||||
}
|
||||
|
||||
|
@ -659,7 +659,7 @@ static void parse_extern_script(ScriptHost *script_host, LPCWSTR src)
|
|||
if(FAILED(hres))
|
||||
return;
|
||||
|
||||
hres = bind_mon_to_buffer(script_host->window->doc, mon, (void**)&buf, &size);
|
||||
hres = bind_mon_to_buffer(script_host->window->base.inner_window->doc, mon, (void**)&buf, &size);
|
||||
IMoniker_Release(mon);
|
||||
if(FAILED(hres))
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue