mshtml: Pass document node to handle_edit_event.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-03-12 16:10:39 +01:00 committed by Alexandre Julliard
parent aa4d9190a0
commit 53e095c2e8
3 changed files with 13 additions and 15 deletions

View File

@ -379,7 +379,7 @@ static void set_font_size(HTMLDocument *This, LPCWSTR size)
set_dirty(This->doc_node->browser, VARIANT_TRUE);
}
static void handle_arrow_key(HTMLDocument *This, nsIDOMEvent *event, nsIDOMKeyEvent *key_event, const char * const cmds[4])
static void handle_arrow_key(HTMLDocumentNode *doc, nsIDOMEvent *event, nsIDOMKeyEvent *key_event, const char * const cmds[4])
{
int i=0;
cpp_bool b;
@ -393,12 +393,12 @@ static void handle_arrow_key(HTMLDocument *This, nsIDOMEvent *event, nsIDOMKeyEv
i |= 2;
if(cmds[i])
do_ns_editor_command(This->doc_obj->nscontainer, cmds[i]);
do_ns_editor_command(doc->browser, cmds[i]);
nsIDOMEvent_PreventDefault(event);
}
void handle_edit_event(HTMLDocument *This, nsIDOMEvent *event)
void handle_edit_event(HTMLDocumentNode *doc, nsIDOMEvent *event)
{
nsIDOMKeyEvent *key_event;
UINT32 code;
@ -417,7 +417,7 @@ void handle_edit_event(HTMLDocument *This, nsIDOMEvent *event)
};
TRACE("left\n");
handle_arrow_key(This, event, key_event, cmds);
handle_arrow_key(doc, event, key_event, cmds);
break;
}
case DOM_VK_RIGHT: {
@ -429,7 +429,7 @@ void handle_edit_event(HTMLDocument *This, nsIDOMEvent *event)
};
TRACE("right\n");
handle_arrow_key(This, event, key_event, cmds);
handle_arrow_key(doc, event, key_event, cmds);
break;
}
case DOM_VK_UP: {
@ -441,7 +441,7 @@ void handle_edit_event(HTMLDocument *This, nsIDOMEvent *event)
};
TRACE("up\n");
handle_arrow_key(This, event, key_event, cmds);
handle_arrow_key(doc, event, key_event, cmds);
break;
}
case DOM_VK_DOWN: {
@ -453,7 +453,7 @@ void handle_edit_event(HTMLDocument *This, nsIDOMEvent *event)
};
TRACE("down\n");
handle_arrow_key(This, event, key_event, cmds);
handle_arrow_key(doc, event, key_event, cmds);
break;
}
case DOM_VK_DELETE: {
@ -464,7 +464,7 @@ void handle_edit_event(HTMLDocument *This, nsIDOMEvent *event)
};
TRACE("delete\n");
handle_arrow_key(This, event, key_event, cmds);
handle_arrow_key(doc, event, key_event, cmds);
break;
}
case DOM_VK_HOME: {
@ -476,7 +476,7 @@ void handle_edit_event(HTMLDocument *This, nsIDOMEvent *event)
};
TRACE("home\n");
handle_arrow_key(This, event, key_event, cmds);
handle_arrow_key(doc, event, key_event, cmds);
break;
}
case DOM_VK_END: {
@ -488,7 +488,7 @@ void handle_edit_event(HTMLDocument *This, nsIDOMEvent *event)
};
TRACE("end\n");
handle_arrow_key(This, event, key_event, cmds);
handle_arrow_key(doc, event, key_event, cmds);
break;
}
}

View File

@ -1136,7 +1136,7 @@ HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
/* editor */
HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
void init_editor(HTMLDocument*) DECLSPEC_HIDDEN;
void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN;
void handle_edit_event(HTMLDocumentNode*,nsIDOMEvent*) DECLSPEC_HIDDEN;
HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;

View File

@ -173,17 +173,15 @@ static nsresult NSAPI handle_keypress(nsIDOMEventListener *iface,
{
nsEventListener *This = impl_from_nsIDOMEventListener(iface);
HTMLDocumentNode *doc = This->This->doc;
HTMLDocumentObj *doc_obj;
if(!doc || !doc->browser)
return NS_ERROR_FAILURE;
doc_obj = doc->basedoc.doc_obj;
TRACE("(%p)->(%p)\n", doc, event);
update_doc(doc_obj, UPDATE_UI);
update_doc(doc->browser->doc, UPDATE_UI);
if(doc->browser->usermode == EDITMODE)
handle_edit_event(&doc_obj->basedoc, event);
handle_edit_event(doc, event);
return NS_OK;
}