mirror of
https://github.com/reactos/reactos.git
synced 2025-04-05 21:21:33 +00:00
-sync mshtml with wine 1.1.31
svn path=/trunk/; revision=43656
This commit is contained in:
parent
59245c6725
commit
ed7ac63c3c
53 changed files with 4211 additions and 10650 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2008 Jacek Caban for CodeWeavers
|
||||
* Copyright 2008-2009 Jacek Caban for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -31,6 +31,8 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
||||
|
||||
static const WCHAR objectW[] = {'[','o','b','j','e','c','t',']',0};
|
||||
|
||||
typedef struct {
|
||||
DISPID id;
|
||||
BSTR name;
|
||||
|
@ -79,6 +81,7 @@ static REFIID tid_ids[] = {
|
|||
&IID_NULL,
|
||||
&DIID_DispCEventObj,
|
||||
&DIID_DispDOMChildrenCollection,
|
||||
&DIID_DispHTMLAnchorElement,
|
||||
&DIID_DispHTMLBody,
|
||||
&DIID_DispHTMLCommentElement,
|
||||
&DIID_DispHTMLCurrentStyle,
|
||||
|
@ -98,6 +101,7 @@ static REFIID tid_ids[] = {
|
|||
&DIID_DispHTMLTableRow,
|
||||
&DIID_DispHTMLUnknownElement,
|
||||
&DIID_DispHTMLWindow2,
|
||||
&IID_IHTMLAnchorElement,
|
||||
&IID_IHTMLBodyElement,
|
||||
&IID_IHTMLBodyElement2,
|
||||
&IID_IHTMLCommentElement,
|
||||
|
@ -242,10 +246,12 @@ static dispex_data_t *preprocess_dispex_data(DispatchEx *This)
|
|||
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
hres = get_typeinfo(This->data->disp_tid, &dti);
|
||||
if(FAILED(hres)) {
|
||||
ERR("Could not get disp type info: %08x\n", hres);
|
||||
return NULL;
|
||||
if(This->data->disp_tid) {
|
||||
hres = get_typeinfo(This->data->disp_tid, &dti);
|
||||
if(FAILED(hres)) {
|
||||
ERR("Could not get disp type info: %08x\n", hres);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
data = heap_alloc(sizeof(dispex_data_t));
|
||||
|
@ -318,11 +324,8 @@ static dispex_data_t *get_dispex_data(DispatchEx *This)
|
|||
return This->data->data;
|
||||
}
|
||||
|
||||
void call_disp_func(HTMLDocument *doc, IDispatch *disp, IDispatch *this_obj)
|
||||
HRESULT call_disp_func(IDispatch *disp, DISPPARAMS *dp)
|
||||
{
|
||||
DISPID named_arg = DISPID_THIS;
|
||||
VARIANTARG arg;
|
||||
DISPPARAMS params = {&arg, &named_arg, 1, 1};
|
||||
EXCEPINFO ei;
|
||||
IDispatchEx *dispex;
|
||||
VARIANT res;
|
||||
|
@ -331,20 +334,17 @@ void call_disp_func(HTMLDocument *doc, IDispatch *disp, IDispatch *this_obj)
|
|||
hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
|
||||
if(FAILED(hres)) {
|
||||
FIXME("Could not get IDispatchEx interface: %08x\n", hres);
|
||||
return;
|
||||
return hres;
|
||||
}
|
||||
|
||||
V_VT(&arg) = VT_DISPATCH;
|
||||
V_DISPATCH(&arg) = this_obj;
|
||||
VariantInit(&res);
|
||||
memset(&ei, 0, sizeof(ei));
|
||||
|
||||
hres = IDispatchEx_InvokeEx(dispex, 0, GetUserDefaultLCID(), DISPATCH_METHOD, ¶ms, &res, &ei, NULL);
|
||||
hres = IDispatchEx_InvokeEx(dispex, 0, GetUserDefaultLCID(), DISPATCH_METHOD, dp, &res, &ei, NULL);
|
||||
|
||||
IDispatchEx_Release(dispex);
|
||||
|
||||
TRACE("%p returned %08x\n", disp, hres);
|
||||
|
||||
VariantClear(&res);
|
||||
return hres;
|
||||
}
|
||||
|
||||
static inline BOOL is_custom_dispid(DISPID id)
|
||||
|
@ -425,8 +425,6 @@ HRESULT dispex_get_dprop_ref(DispatchEx *This, const WCHAR *name, BOOL alloc, VA
|
|||
static HRESULT dispex_value(DispatchEx *This, LCID lcid, WORD flags, DISPPARAMS *params,
|
||||
VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
|
||||
{
|
||||
static const WCHAR objectW[] = {'[','o','b','j','e','c','t',']',0};
|
||||
|
||||
if(This->data->vtbl && This->data->vtbl->value)
|
||||
return This->data->vtbl->value(This->outer, lcid, flags, params, res, ei, caller);
|
||||
|
||||
|
@ -541,11 +539,13 @@ static const dispex_static_data_vtbl_t function_dispex_vtbl = {
|
|||
NULL
|
||||
};
|
||||
|
||||
static const tid_t function_iface_tids[] = {0};
|
||||
|
||||
static dispex_static_data_t function_dispex = {
|
||||
&function_dispex_vtbl,
|
||||
LAST_tid,
|
||||
NULL_tid,
|
||||
NULL,
|
||||
NULL
|
||||
function_iface_tids
|
||||
};
|
||||
|
||||
static func_disp_t *create_func_disp(DispatchEx *obj, func_info_t *info)
|
||||
|
@ -576,6 +576,18 @@ static HRESULT function_invoke(DispatchEx *This, func_info_t *func, WORD flags,
|
|||
case DISPATCH_PROPERTYGET: {
|
||||
dispex_dynamic_data_t *dynamic_data;
|
||||
|
||||
if(func->id == DISPID_VALUE) {
|
||||
BSTR ret;
|
||||
|
||||
ret = SysAllocString(objectW);
|
||||
if(!ret)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
V_VT(res) = VT_BSTR;
|
||||
V_BSTR(res) = ret;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
dynamic_data = get_dynamic_data(This, TRUE);
|
||||
if(!dynamic_data)
|
||||
return E_OUTOFMEMORY;
|
||||
|
@ -607,6 +619,31 @@ static HRESULT function_invoke(DispatchEx *This, func_info_t *func, WORD flags,
|
|||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT get_builtin_func(dispex_data_t *data, DISPID id, func_info_t **ret)
|
||||
{
|
||||
int min, max, n;
|
||||
|
||||
min = 0;
|
||||
max = data->func_cnt-1;
|
||||
|
||||
while(min <= max) {
|
||||
n = (min+max)/2;
|
||||
|
||||
if(data->funcs[n].id == id) {
|
||||
*ret = data->funcs+n;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if(data->funcs[n].id < id)
|
||||
min = n+1;
|
||||
else
|
||||
max = n-1;
|
||||
}
|
||||
|
||||
WARN("invalid id %x\n", id);
|
||||
return DISP_E_UNKNOWNNAME;
|
||||
}
|
||||
|
||||
#define DISPATCHEX_THIS(iface) DEFINE_THIS(DispatchEx, IDispatchEx, iface)
|
||||
|
||||
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
|
||||
|
@ -748,14 +785,11 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
|
|||
{
|
||||
DispatchEx *This = DISPATCHEX_THIS(iface);
|
||||
dispex_data_t *data;
|
||||
int min, max, n;
|
||||
func_info_t *func;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
|
||||
|
||||
if(id == DISPID_VALUE)
|
||||
return dispex_value(This, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
|
||||
|
||||
if(is_custom_dispid(id) && This->data->vtbl && This->data->vtbl->invoke)
|
||||
return This->data->vtbl->invoke(This->outer, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
|
||||
|
||||
|
@ -828,30 +862,16 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
|
|||
if(!data)
|
||||
return E_FAIL;
|
||||
|
||||
min = 0;
|
||||
max = data->func_cnt-1;
|
||||
hres = get_builtin_func(data, id, &func);
|
||||
if(id == DISPID_VALUE && hres == DISP_E_UNKNOWNNAME)
|
||||
return dispex_value(This, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
while(min <= max) {
|
||||
n = (min+max)/2;
|
||||
|
||||
if(data->funcs[n].id == id)
|
||||
break;
|
||||
|
||||
if(data->funcs[n].id < id)
|
||||
min = n+1;
|
||||
else
|
||||
max = n-1;
|
||||
}
|
||||
|
||||
if(min > max) {
|
||||
WARN("invalid id %x\n", id);
|
||||
return DISP_E_UNKNOWNNAME;
|
||||
}
|
||||
|
||||
if(data->funcs[n].func_disp_idx == -1)
|
||||
hres = typeinfo_invoke(This, data->funcs+n, wFlags, pdp, pvarRes, pei);
|
||||
if(func->func_disp_idx == -1)
|
||||
hres = typeinfo_invoke(This, func, wFlags, pdp, pvarRes, pei);
|
||||
else
|
||||
hres = function_invoke(This, data->funcs+n, wFlags, pdp, pvarRes, pei);
|
||||
hres = function_invoke(This, func, wFlags, pdp, pvarRes, pei);
|
||||
|
||||
return hres;
|
||||
}
|
||||
|
@ -880,15 +900,92 @@ static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID
|
|||
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
|
||||
{
|
||||
DispatchEx *This = DISPATCHEX_THIS(iface);
|
||||
FIXME("(%p)->(%x %p)\n", This, id, pbstrName);
|
||||
return E_NOTIMPL;
|
||||
dispex_data_t *data;
|
||||
func_info_t *func;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%x %p)\n", This, id, pbstrName);
|
||||
|
||||
if(is_dynamic_dispid(id)) {
|
||||
DWORD idx = id - DISPID_DYNPROP_0;
|
||||
|
||||
if(!This->dynamic_data || This->dynamic_data->prop_cnt <= idx)
|
||||
return DISP_E_UNKNOWNNAME;
|
||||
|
||||
*pbstrName = SysAllocString(This->dynamic_data->props[idx].name);
|
||||
if(!*pbstrName)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
data = get_dispex_data(This);
|
||||
if(!data)
|
||||
return E_FAIL;
|
||||
|
||||
hres = get_builtin_func(data, id, &func);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
*pbstrName = SysAllocString(func->name);
|
||||
if(!*pbstrName)
|
||||
return E_OUTOFMEMORY;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
|
||||
{
|
||||
DispatchEx *This = DISPATCHEX_THIS(iface);
|
||||
FIXME("(%p)->(%x %x %p)\n", This, grfdex, id, pid);
|
||||
return E_NOTIMPL;
|
||||
dispex_data_t *data;
|
||||
func_info_t *func;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%x %x %p)\n", This, grfdex, id, pid);
|
||||
|
||||
if(is_dynamic_dispid(id)) {
|
||||
DWORD idx = id - DISPID_DYNPROP_0;
|
||||
|
||||
if(!This->dynamic_data || This->dynamic_data->prop_cnt <= idx)
|
||||
return DISP_E_UNKNOWNNAME;
|
||||
|
||||
if(idx+1 == This->dynamic_data->prop_cnt) {
|
||||
*pid = DISPID_STARTENUM;
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
*pid = id+1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
data = get_dispex_data(This);
|
||||
if(!data)
|
||||
return E_FAIL;
|
||||
|
||||
if(id == DISPID_STARTENUM) {
|
||||
func = data->funcs;
|
||||
}else {
|
||||
hres = get_builtin_func(data, id, &func);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
func++;
|
||||
}
|
||||
|
||||
while(func < data->funcs+data->func_cnt) {
|
||||
/* FIXME: Skip hidden properties */
|
||||
if(func->func_disp_idx == -1) {
|
||||
*pid = func->id;
|
||||
return S_OK;
|
||||
}
|
||||
func++;
|
||||
}
|
||||
|
||||
if(This->dynamic_data && This->dynamic_data->prop_cnt) {
|
||||
*pid = DISPID_DYNPROP_0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*pid = DISPID_STARTENUM;
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
|
||||
|
|
|
@ -100,15 +100,15 @@ void set_dirty(HTMLDocument *This, VARIANT_BOOL dirty)
|
|||
{
|
||||
nsresult nsres;
|
||||
|
||||
if(This->usermode != EDITMODE || !This->nscontainer || !This->nscontainer->editor)
|
||||
if(This->doc_obj->usermode != EDITMODE || !This->doc_obj->nscontainer || !This->doc_obj->nscontainer->editor)
|
||||
return;
|
||||
|
||||
if(dirty) {
|
||||
nsres = nsIEditor_IncrementModificationCount(This->nscontainer->editor, 1);
|
||||
nsres = nsIEditor_IncrementModificationCount(This->doc_obj->nscontainer->editor, 1);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("IncrementModificationCount failed: %08x\n", nsres);
|
||||
}else {
|
||||
nsres = nsIEditor_ResetModificationCount(This->nscontainer->editor);
|
||||
nsres = nsIEditor_ResetModificationCount(This->doc_obj->nscontainer->editor);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("ResetModificationCount failed: %08x\n", nsres);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ static nsresult get_ns_command_state(NSContainer *This, const char *cmd, nsIComm
|
|||
return nsres;
|
||||
}
|
||||
|
||||
nsres = nsICommandManager_GetCommandState(cmdmgr, cmd, This->doc->window->nswindow, nsparam);
|
||||
nsres = nsICommandManager_GetCommandState(cmdmgr, cmd, This->doc->basedoc.window->nswindow, nsparam);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("GetCommandState(%s) failed: %08x\n", debugstr_a(cmd), nsres);
|
||||
|
||||
|
@ -150,12 +150,12 @@ static DWORD query_ns_edit_status(HTMLDocument *This, const char *nscmd)
|
|||
nsICommandParams *nsparam;
|
||||
PRBool b = FALSE;
|
||||
|
||||
if(This->usermode != EDITMODE || This->readystate < READYSTATE_INTERACTIVE)
|
||||
if(This->doc_obj->usermode != EDITMODE || This->doc_obj->readystate < READYSTATE_INTERACTIVE)
|
||||
return OLECMDF_SUPPORTED;
|
||||
|
||||
if(This->nscontainer && nscmd) {
|
||||
if(This->doc_obj->nscontainer && nscmd) {
|
||||
nsparam = create_nscommand_params();
|
||||
get_ns_command_state(This->nscontainer, nscmd, nsparam);
|
||||
get_ns_command_state(This->doc_obj->nscontainer, nscmd, nsparam);
|
||||
|
||||
nsICommandParams_GetBooleanValue(nsparam, NSSTATE_ALL, &b);
|
||||
|
||||
|
@ -169,13 +169,13 @@ static void set_ns_align(HTMLDocument *This, const char *align_str)
|
|||
{
|
||||
nsICommandParams *nsparam;
|
||||
|
||||
if(!This->nscontainer)
|
||||
if(!This->doc_obj->nscontainer)
|
||||
return;
|
||||
|
||||
nsparam = create_nscommand_params();
|
||||
nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, align_str);
|
||||
|
||||
do_ns_command(This->nscontainer, NSCMD_ALIGN, nsparam);
|
||||
do_ns_command(This, NSCMD_ALIGN, nsparam);
|
||||
|
||||
nsICommandParams_Release(nsparam);
|
||||
}
|
||||
|
@ -185,12 +185,12 @@ static DWORD query_align_status(HTMLDocument *This, const char *align_str)
|
|||
nsICommandParams *nsparam;
|
||||
char *align = NULL;
|
||||
|
||||
if(This->usermode != EDITMODE || This->readystate < READYSTATE_INTERACTIVE)
|
||||
if(This->doc_obj->usermode != EDITMODE || This->doc_obj->readystate < READYSTATE_INTERACTIVE)
|
||||
return OLECMDF_SUPPORTED;
|
||||
|
||||
if(This->nscontainer) {
|
||||
if(This->doc_obj->nscontainer) {
|
||||
nsparam = create_nscommand_params();
|
||||
get_ns_command_state(This->nscontainer, NSCMD_ALIGN, nsparam);
|
||||
get_ns_command_state(This->doc_obj->nscontainer, NSCMD_ALIGN, nsparam);
|
||||
|
||||
nsICommandParams_GetCStringValue(nsparam, NSSTATE_ATTRIBUTE, &align);
|
||||
|
||||
|
@ -204,19 +204,12 @@ static DWORD query_align_status(HTMLDocument *This, const char *align_str)
|
|||
|
||||
static nsISelection *get_ns_selection(HTMLDocument *This)
|
||||
{
|
||||
nsIDOMWindow *dom_window;
|
||||
nsISelection *nsselection = NULL;
|
||||
nsresult nsres;
|
||||
|
||||
if(!This->nscontainer)
|
||||
return NULL;
|
||||
|
||||
nsres = nsIWebBrowser_GetContentDOMWindow(This->nscontainer->webbrowser, &dom_window);
|
||||
nsres = nsIDOMWindow_GetSelection(This->window->nswindow, &nsselection);
|
||||
if(NS_FAILED(nsres))
|
||||
return NULL;
|
||||
|
||||
nsIDOMWindow_GetSelection(dom_window, &nsselection);
|
||||
nsIDOMWindow_Release(dom_window);
|
||||
ERR("GetSelection failed %08x\n", nsres);
|
||||
|
||||
return nsselection;
|
||||
|
||||
|
@ -412,7 +405,7 @@ static void handle_arrow_key(HTMLDocument *This, nsIDOMKeyEvent *event, const ch
|
|||
i |= 2;
|
||||
|
||||
if(cmds[i])
|
||||
do_ns_editor_command(This->nscontainer, cmds[i]);
|
||||
do_ns_editor_command(This->doc_obj->nscontainer, cmds[i]);
|
||||
|
||||
nsIDOMKeyEvent_PreventDefault(event);
|
||||
}
|
||||
|
@ -517,11 +510,11 @@ void handle_edit_event(HTMLDocument *This, nsIDOMEvent *event)
|
|||
|
||||
void handle_edit_load(HTMLDocument *This)
|
||||
{
|
||||
This->nscontainer->reset_focus = GetFocus();
|
||||
get_editor_controller(This->nscontainer);
|
||||
This->doc_obj->nscontainer->reset_focus = GetFocus();
|
||||
get_editor_controller(This->doc_obj->nscontainer);
|
||||
}
|
||||
|
||||
static void set_ns_fontname(NSContainer *This, const char *fontname)
|
||||
static void set_ns_fontname(HTMLDocument *This, const char *fontname)
|
||||
{
|
||||
nsICommandParams *nsparam = create_nscommand_params();
|
||||
|
||||
|
@ -534,8 +527,8 @@ static HRESULT exec_delete(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VA
|
|||
{
|
||||
TRACE("(%p)->(%p %p)\n", This, in, out);
|
||||
|
||||
if(This->nscontainer)
|
||||
do_ns_editor_command(This->nscontainer, NSCMD_DELETECHARFORWARD);
|
||||
if(This->doc_obj->nscontainer)
|
||||
do_ns_editor_command(This->doc_obj->nscontainer, NSCMD_DELETECHARFORWARD);
|
||||
|
||||
update_doc(This, UPDATE_UI);
|
||||
return S_OK;
|
||||
|
@ -545,7 +538,7 @@ static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
|
|||
{
|
||||
TRACE("(%p)->(%p %p)\n", This, in, out);
|
||||
|
||||
if(!This->nscontainer) {
|
||||
if(!This->doc_obj->nscontainer) {
|
||||
update_doc(This, UPDATE_UI);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -561,7 +554,7 @@ static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
|
|||
TRACE("%s\n", debugstr_w(V_BSTR(in)));
|
||||
|
||||
stra = heap_strdupWtoA(V_BSTR(in));
|
||||
set_ns_fontname(This->nscontainer, stra);
|
||||
set_ns_fontname(This, stra);
|
||||
heap_free(stra);
|
||||
|
||||
update_doc(This, UPDATE_UI);
|
||||
|
@ -579,7 +572,7 @@ static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
|
|||
|
||||
nsparam = create_nscommand_params();
|
||||
|
||||
nsres = get_ns_command_state(This->nscontainer, NSCMD_FONTFACE, nsparam);
|
||||
nsres = get_ns_command_state(This->doc_obj->nscontainer, NSCMD_FONTFACE, nsparam);
|
||||
if(NS_FAILED(nsres))
|
||||
return S_OK;
|
||||
|
||||
|
@ -611,7 +604,7 @@ static HRESULT exec_forecolor(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
|
|||
V_I4(in)&0xff, (V_I4(in)>>8)&0xff, (V_I4(in)>>16)&0xff);
|
||||
|
||||
nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, color_str);
|
||||
do_ns_command(This->nscontainer, NSCMD_FONTCOLOR, nsparam);
|
||||
do_ns_command(This, NSCMD_FONTCOLOR, nsparam);
|
||||
|
||||
nsICommandParams_Release(nsparam);
|
||||
}else {
|
||||
|
@ -677,8 +670,8 @@ static HRESULT exec_selectall(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
|
|||
if(in || out)
|
||||
FIXME("unsupported args\n");
|
||||
|
||||
if(This->nscontainer)
|
||||
do_ns_command(This->nscontainer, NSCMD_SELECTALL, NULL);
|
||||
if(This->doc_obj->nscontainer)
|
||||
do_ns_command(This, NSCMD_SELECTALL, NULL);
|
||||
|
||||
update_doc(This, UPDATE_UI);
|
||||
return S_OK;
|
||||
|
@ -691,8 +684,8 @@ static HRESULT exec_bold(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARI
|
|||
if(in || out)
|
||||
FIXME("unsupported args\n");
|
||||
|
||||
if(This->nscontainer)
|
||||
do_ns_command(This->nscontainer, NSCMD_BOLD, NULL);
|
||||
if(This->doc_obj->nscontainer)
|
||||
do_ns_command(This, NSCMD_BOLD, NULL);
|
||||
|
||||
update_doc(This, UPDATE_UI);
|
||||
return S_OK;
|
||||
|
@ -705,8 +698,8 @@ static HRESULT exec_italic(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VA
|
|||
if(in || out)
|
||||
FIXME("unsupported args\n");
|
||||
|
||||
if(This->nscontainer)
|
||||
do_ns_command(This->nscontainer, NSCMD_ITALIC, NULL);
|
||||
if(This->doc_obj->nscontainer)
|
||||
do_ns_command(This, NSCMD_ITALIC, NULL);
|
||||
|
||||
update_doc(This, UPDATE_UI);
|
||||
return S_OK;
|
||||
|
@ -722,7 +715,7 @@ static HRESULT query_justify(HTMLDocument *This, OLECMD *cmd)
|
|||
case IDM_JUSTIFYLEFT:
|
||||
TRACE("(%p) IDM_JUSTIFYLEFT\n", This);
|
||||
/* FIXME: We should set OLECMDF_LATCHED only if it's set explicitly. */
|
||||
if(This->usermode != EDITMODE || This->readystate < READYSTATE_INTERACTIVE)
|
||||
if(This->doc_obj->usermode != EDITMODE || This->doc_obj->readystate < READYSTATE_INTERACTIVE)
|
||||
cmd->cmdf = OLECMDF_SUPPORTED;
|
||||
else
|
||||
cmd->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
|
||||
|
@ -779,9 +772,7 @@ static HRESULT exec_underline(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
|
|||
if(in || out)
|
||||
FIXME("unsupported args\n");
|
||||
|
||||
if(This->nscontainer)
|
||||
do_ns_command(This->nscontainer, NSCMD_UNDERLINE, NULL);
|
||||
|
||||
do_ns_command(This, NSCMD_UNDERLINE, NULL);
|
||||
update_doc(This, UPDATE_UI);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -793,9 +784,7 @@ static HRESULT exec_horizontalline(HTMLDocument *This, DWORD cmdexecopt, VARIANT
|
|||
if(in || out)
|
||||
FIXME("unsupported args\n");
|
||||
|
||||
if(This->nscontainer)
|
||||
do_ns_command(This->nscontainer, NSCMD_INSERTHR, NULL);
|
||||
|
||||
do_ns_command(This, NSCMD_INSERTHR, NULL);
|
||||
update_doc(This, UPDATE_UI);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -807,9 +796,7 @@ static HRESULT exec_orderlist(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
|
|||
if(in || out)
|
||||
FIXME("unsupported args\n");
|
||||
|
||||
if(This->nscontainer)
|
||||
do_ns_command(This->nscontainer, NSCMD_OL, NULL);
|
||||
|
||||
do_ns_command(This, NSCMD_OL, NULL);
|
||||
update_doc(This, UPDATE_UI);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -821,9 +808,7 @@ static HRESULT exec_unorderlist(HTMLDocument *This, DWORD cmdexecopt, VARIANT *i
|
|||
if(in || out)
|
||||
FIXME("unsupported args\n");
|
||||
|
||||
if(This->nscontainer)
|
||||
do_ns_command(This->nscontainer, NSCMD_UL, NULL);
|
||||
|
||||
do_ns_command(This, NSCMD_UL, NULL);
|
||||
update_doc(This, UPDATE_UI);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -835,9 +820,7 @@ static HRESULT exec_indent(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VA
|
|||
if(in || out)
|
||||
FIXME("unsupported args\n");
|
||||
|
||||
if(This->nscontainer)
|
||||
do_ns_command(This->nscontainer, NSCMD_INDENT, NULL);
|
||||
|
||||
do_ns_command(This, NSCMD_INDENT, NULL);
|
||||
update_doc(This, UPDATE_UI);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -849,9 +832,7 @@ static HRESULT exec_outdent(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, V
|
|||
if(in || out)
|
||||
FIXME("unsupported args\n");
|
||||
|
||||
if(This->nscontainer)
|
||||
do_ns_command(This->nscontainer, NSCMD_OUTDENT, NULL);
|
||||
|
||||
do_ns_command(This, NSCMD_OUTDENT, NULL);
|
||||
update_doc(This, UPDATE_UI);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -931,10 +912,10 @@ HRESULT editor_exec_copy(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARI
|
|||
{
|
||||
update_doc(This, UPDATE_UI);
|
||||
|
||||
if(!This->nscontainer)
|
||||
if(!This->doc_obj->nscontainer)
|
||||
return E_FAIL;
|
||||
|
||||
do_ns_editor_command(This->nscontainer, NSCMD_COPY);
|
||||
do_ns_editor_command(This->doc_obj->nscontainer, NSCMD_COPY);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -942,10 +923,10 @@ HRESULT editor_exec_cut(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIA
|
|||
{
|
||||
update_doc(This, UPDATE_UI);
|
||||
|
||||
if(!This->nscontainer)
|
||||
if(!This->doc_obj->nscontainer)
|
||||
return E_FAIL;
|
||||
|
||||
do_ns_editor_command(This->nscontainer, NSCMD_CUT);
|
||||
do_ns_editor_command(This->doc_obj->nscontainer, NSCMD_CUT);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -953,10 +934,10 @@ HRESULT editor_exec_paste(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VAR
|
|||
{
|
||||
update_doc(This, UPDATE_UI);
|
||||
|
||||
if(!This->nscontainer)
|
||||
if(!This->doc_obj->nscontainer)
|
||||
return E_FAIL;
|
||||
|
||||
do_ns_editor_command(This->nscontainer, NSCMD_PASTE);
|
||||
do_ns_editor_command(This->doc_obj->nscontainer, NSCMD_PASTE);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -1212,7 +1193,7 @@ static HRESULT exec_hyperlink(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
|
|||
|
||||
nsAString_Finish(&ns_url);
|
||||
|
||||
nsIEditor_QueryInterface(This->nscontainer->editor, &IID_nsIHTMLEditor, (void **)&html_editor);
|
||||
nsIEditor_QueryInterface(This->doc_obj->nscontainer->editor, &IID_nsIHTMLEditor, (void **)&html_editor);
|
||||
if (html_editor) {
|
||||
nsresult nsres;
|
||||
|
||||
|
@ -1273,20 +1254,17 @@ void init_editor(HTMLDocument *This)
|
|||
{
|
||||
update_doc(This, UPDATE_UI);
|
||||
|
||||
if(!This->nscontainer)
|
||||
return;
|
||||
|
||||
set_ns_fontname(This->nscontainer, "Times New Roman");
|
||||
set_ns_fontname(This, "Times New Roman");
|
||||
}
|
||||
|
||||
HRESULT editor_is_dirty(HTMLDocument *This)
|
||||
{
|
||||
PRBool modified;
|
||||
|
||||
if(!This->nscontainer || !This->nscontainer->editor)
|
||||
if(!This->doc_obj->nscontainer || !This->doc_obj->nscontainer->editor)
|
||||
return S_FALSE;
|
||||
|
||||
nsIEditor_GetDocumentModified(This->nscontainer->editor, &modified);
|
||||
nsIEditor_GetDocumentModified(This->doc_obj->nscontainer->editor, &modified);
|
||||
|
||||
return modified ? S_OK : S_FALSE;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ typedef struct {
|
|||
HTMLElement element;
|
||||
|
||||
const IHTMLAnchorElementVtbl *lpHTMLAnchorElementVtbl;
|
||||
|
||||
nsIDOMHTMLAnchorElement *nsanchor;
|
||||
} HTMLAnchorElement;
|
||||
|
||||
#define HTMLANCHOR(x) (&(x)->lpHTMLAnchorElementVtbl)
|
||||
|
@ -104,8 +106,26 @@ static HRESULT WINAPI HTMLAnchorElement_put_href(IHTMLAnchorElement *iface, BSTR
|
|||
static HRESULT WINAPI HTMLAnchorElement_get_href(IHTMLAnchorElement *iface, BSTR *p)
|
||||
{
|
||||
HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
nsAString href_str;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
nsAString_Init(&href_str, NULL);
|
||||
nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
const PRUnichar *href;
|
||||
|
||||
nsAString_GetData(&href_str, &href);
|
||||
hres = nsuri_to_url(href, TRUE, p);
|
||||
}else {
|
||||
ERR("GetHref failed: %08x\n", nsres);
|
||||
hres = E_FAIL;
|
||||
}
|
||||
|
||||
nsAString_Finish(&href_str);
|
||||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLAnchorElement_put_target(IHTMLAnchorElement *iface, BSTR v)
|
||||
|
@ -464,6 +484,10 @@ static HRESULT HTMLAnchorElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
|
|||
static void HTMLAnchorElement_destructor(HTMLDOMNode *iface)
|
||||
{
|
||||
HTMLAnchorElement *This = HTMLANCHOR_NODE_THIS(iface);
|
||||
|
||||
if(This->nsanchor)
|
||||
nsIDOMHTMLAnchorElement_Release(This->nsanchor);
|
||||
|
||||
HTMLElement_destructor(&This->element.node);
|
||||
}
|
||||
|
||||
|
@ -474,14 +498,39 @@ static const NodeImplVtbl HTMLAnchorElementImplVtbl = {
|
|||
HTMLAnchorElement_destructor
|
||||
};
|
||||
|
||||
static const tid_t HTMLAnchorElement_iface_tids[] = {
|
||||
IHTMLAnchorElement_tid,
|
||||
IHTMLDOMNode_tid,
|
||||
IHTMLDOMNode2_tid,
|
||||
IHTMLElement_tid,
|
||||
IHTMLElement2_tid,
|
||||
IHTMLElement3_tid,
|
||||
IHTMLElement4_tid,
|
||||
IHTMLTextContainer_tid,
|
||||
IHTMLUniqueName_tid,
|
||||
0
|
||||
};
|
||||
|
||||
static dispex_static_data_t HTMLAnchorElement_dispex = {
|
||||
NULL,
|
||||
DispHTMLAnchorElement_tid,
|
||||
NULL,
|
||||
HTMLAnchorElement_iface_tids
|
||||
};
|
||||
|
||||
HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement *nselem)
|
||||
{
|
||||
HTMLAnchorElement *ret = heap_alloc_zero(sizeof(HTMLAnchorElement));
|
||||
|
||||
HTMLElement_Init(&ret->element);
|
||||
nsresult nsres;
|
||||
|
||||
ret->lpHTMLAnchorElementVtbl = &HTMLAnchorElementVtbl;
|
||||
ret->element.node.vtbl = &HTMLAnchorElementImplVtbl;
|
||||
|
||||
HTMLElement_Init(&ret->element, &HTMLAnchorElement_dispex);
|
||||
|
||||
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLAnchorElement, (void**)&ret->nsanchor);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("Could not get nsIDOMHTMLAnchorElement iface: %08x\n", nsres);
|
||||
|
||||
return &ret->element;
|
||||
}
|
||||
|
|
|
@ -602,15 +602,16 @@ static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, I
|
|||
nsIDOMDocumentRange *nsdocrange;
|
||||
nsIDOMRange *nsrange = NULL;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, range);
|
||||
|
||||
if(!This->textcont.element.node.doc->nsdoc) {
|
||||
if(!This->textcont.element.node.doc->basedoc.nsdoc) {
|
||||
WARN("No nsdoc\n");
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsres = nsIDOMDocument_QueryInterface(This->textcont.element.node.doc->nsdoc, &IID_nsIDOMDocumentRange,
|
||||
nsres = nsIDOMDocument_QueryInterface(This->textcont.element.node.doc->basedoc.nsdoc, &IID_nsIDOMDocumentRange,
|
||||
(void**)&nsdocrange);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("Could not get nsIDOMDocumentRabge iface: %08x\n", nsres);
|
||||
|
@ -628,8 +629,10 @@ static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, I
|
|||
|
||||
nsIDOMDocumentRange_Release(nsdocrange);
|
||||
|
||||
*range = HTMLTxtRange_Create(This->textcont.element.node.doc, nsrange);
|
||||
return S_OK;
|
||||
hres = HTMLTxtRange_Create(This->textcont.element.node.doc->basedoc.doc_node, nsrange, range);
|
||||
|
||||
nsIDOMRange_Release(nsrange);
|
||||
return hres;
|
||||
}
|
||||
|
||||
#undef HTMLBODY_THIS
|
||||
|
@ -718,11 +721,21 @@ static void HTMLBodyElement_destructor(HTMLDOMNode *iface)
|
|||
HTMLElement_destructor(&This->textcont.element.node);
|
||||
}
|
||||
|
||||
static event_target_t **HTMLBodyElement_get_event_target(HTMLDOMNode *iface)
|
||||
{
|
||||
HTMLBodyElement *This = HTMLBODY_NODE_THIS(iface);
|
||||
|
||||
return This->textcont.element.node.doc && This->textcont.element.node.doc->basedoc.window
|
||||
? &This->textcont.element.node.doc->basedoc.window->event_target
|
||||
: &This->textcont.element.node.event_target;
|
||||
}
|
||||
|
||||
#undef HTMLBODY_NODE_THIS
|
||||
|
||||
static const NodeImplVtbl HTMLBodyElementImplVtbl = {
|
||||
HTMLBodyElement_QI,
|
||||
HTMLBodyElement_destructor
|
||||
HTMLBodyElement_destructor,
|
||||
HTMLBodyElement_get_event_target
|
||||
};
|
||||
|
||||
static const tid_t HTMLBodyElement_iface_tids[] = {
|
||||
|
@ -753,13 +766,11 @@ HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement *nselem)
|
|||
|
||||
TRACE("(%p)->(%p)\n", ret, nselem);
|
||||
|
||||
HTMLTextContainer_Init(&ret->textcont);
|
||||
|
||||
ret->lpHTMLBodyElementVtbl = &HTMLBodyElementVtbl;
|
||||
|
||||
init_dispex(&ret->textcont.element.node.dispex, (IUnknown*)HTMLBODY(ret), &HTMLBodyElement_dispex);
|
||||
ret->textcont.element.node.vtbl = &HTMLBodyElementImplVtbl;
|
||||
|
||||
HTMLTextContainer_Init(&ret->textcont, &HTMLBodyElement_dispex);
|
||||
|
||||
ConnectionPoint_Init(&ret->cp_propnotif, &ret->textcont.element.cp_container, &IID_IPropertyNotifySink);
|
||||
|
||||
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLBodyElement,
|
||||
|
|
|
@ -186,15 +186,14 @@ static dispex_static_data_t HTMLCommentElement_dispex = {
|
|||
HTMLCommentElement_iface_tids
|
||||
};
|
||||
|
||||
HTMLElement *HTMLCommentElement_Create(HTMLDocument *doc, nsIDOMNode *nsnode)
|
||||
HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode)
|
||||
{
|
||||
HTMLCommentElement *ret = heap_alloc_zero(sizeof(*ret));
|
||||
|
||||
ret->element.node.vtbl = &HTMLCommentElementImplVtbl;
|
||||
ret->lpIHTMLCommentElementVtbl = &HTMLCommentElementVtbl;
|
||||
|
||||
init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLCOMMENT(ret), &HTMLCommentElement_dispex);
|
||||
HTMLElement_Init(&ret->element);
|
||||
HTMLElement_Init(&ret->element, &HTMLCommentElement_dispex);
|
||||
HTMLDOMNode_Init(doc, &ret->element.node, nsnode);
|
||||
|
||||
return &ret->element;
|
||||
|
|
|
@ -224,29 +224,29 @@ static HRESULT WINAPI HTMLCurrentStyle_get_backgroundRepeat(IHTMLCurrentStyle *i
|
|||
static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftColor(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, p, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLCurrentStyle_get_borderTopColor(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, p, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLCurrentStyle_get_borderRightColor(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, p, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomColor(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, p, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLCurrentStyle_get_borderTopStyle(IHTMLCurrentStyle *iface, BSTR *p)
|
||||
|
@ -343,22 +343,22 @@ static HRESULT WINAPI HTMLCurrentStyle_get_paddingLeft(IHTMLCurrentStyle *iface,
|
|||
static HRESULT WINAPI HTMLCurrentStyle_get_paddingTop(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_TOP, p, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLCurrentStyle_get_paddingRight(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_RIGHT, p, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLCurrentStyle_get_paddingBottom(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_BOTTOM, p, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLCurrentStyle_get_textAlign(IHTMLCurrentStyle *iface, BSTR *p)
|
||||
|
@ -403,22 +403,22 @@ static HRESULT WINAPI HTMLCurrentStyle_get_zIndex(IHTMLCurrentStyle *iface, VARI
|
|||
static HRESULT WINAPI HTMLCurrentStyle_get_letterSpacing(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
return get_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, p, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLCurrentStyle_get_lineHeight(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
return get_nsstyle_attr_var(This->nsstyle, STYLEID_LINE_HEIGHT, p, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLCurrentStyle_get_textIndent(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
return get_nsstyle_attr_var(This->nsstyle, STYLEID_TEXT_INDENT, p, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLCurrentStyle_get_verticalAlign(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
|
@ -438,8 +438,8 @@ static HRESULT WINAPI HTMLCurrentStyle_get_backgroundAttachment(IHTMLCurrentStyl
|
|||
static HRESULT WINAPI HTMLCurrentStyle_get_marginTop(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, p, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLCurrentStyle_get_marginRight(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
|
@ -452,8 +452,8 @@ static HRESULT WINAPI HTMLCurrentStyle_get_marginRight(IHTMLCurrentStyle *iface,
|
|||
static HRESULT WINAPI HTMLCurrentStyle_get_marginBottom(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_BOTTOM, p, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLCurrentStyle_get_marginLeft(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
|
@ -593,15 +593,15 @@ static HRESULT WINAPI HTMLCurrentStyle_get_unicodeBidi(IHTMLCurrentStyle *iface,
|
|||
static HRESULT WINAPI HTMLCurrentStyle_get_right(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
return get_nsstyle_attr_var(This->nsstyle, STYLEID_RIGHT, p, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLCurrentStyle_get_bottom(IHTMLCurrentStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
return get_nsstyle_attr_var(This->nsstyle, STYLEID_BOTTOM, p, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLCurrentStyle_get_imeMode(IHTMLCurrentStyle *iface, BSTR *p)
|
||||
|
@ -899,12 +899,12 @@ HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p)
|
|||
HTMLCurrentStyle *ret;
|
||||
nsresult nsres;
|
||||
|
||||
if(!elem->node.doc->nsdoc) {
|
||||
if(!elem->node.doc->basedoc.nsdoc) {
|
||||
WARN("NULL nsdoc\n");
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsres = nsIDOMHTMLDocument_QueryInterface(elem->node.doc->nsdoc, &IID_nsIDOMDocumentView, (void**)&nsdocview);
|
||||
nsres = nsIDOMHTMLDocument_QueryInterface(elem->node.doc->basedoc.nsdoc, &IID_nsIDOMDocumentView, (void**)&nsdocview);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("Could not get nsIDOMDocumentView: %08x\n", nsres);
|
||||
return E_FAIL;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2005 Jacek Caban
|
||||
* Copyright 2005-2009 Jacek Caban for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -28,6 +28,7 @@
|
|||
#include "winuser.h"
|
||||
#include "ole2.h"
|
||||
#include "perhist.h"
|
||||
#include "mshtmdid.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
|
@ -38,198 +39,25 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|||
|
||||
#define HTMLDOC_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument2, iface)
|
||||
|
||||
static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID riid, void **ppvObject)
|
||||
static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
HTMLDocument *This = HTMLDOC_THIS(iface);
|
||||
|
||||
*ppvObject = NULL;
|
||||
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
||||
TRACE("(%p)->(IID_IUnknown, %p)\n", This, ppvObject);
|
||||
*ppvObject = HTMLDOC(This);
|
||||
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
|
||||
TRACE("(%p)->(IID_IDispatch, %p)\n", This, ppvObject);
|
||||
*ppvObject = DISPATCHEX(This);
|
||||
}else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
|
||||
TRACE("(%p)->(IID_IDispatchEx, %p)\n", This, ppvObject);
|
||||
*ppvObject = DISPATCHEX(This);
|
||||
}else if(IsEqualGUID(&IID_IHTMLDocument, riid)) {
|
||||
TRACE("(%p)->(IID_IHTMLDocument, %p)\n", This, ppvObject);
|
||||
*ppvObject = HTMLDOC(This);
|
||||
}else if(IsEqualGUID(&IID_IHTMLDocument2, riid)) {
|
||||
TRACE("(%p)->(IID_IHTMLDocument2, %p)\n", This, ppvObject);
|
||||
*ppvObject = HTMLDOC(This);
|
||||
}else if(IsEqualGUID(&IID_IHTMLDocument3, riid)) {
|
||||
TRACE("(%p)->(IID_IHTMLDocument3, %p)\n", This, ppvObject);
|
||||
*ppvObject = HTMLDOC3(This);
|
||||
}else if(IsEqualGUID(&IID_IHTMLDocument4, riid)) {
|
||||
TRACE("(%p)->(IID_IHTMLDocument4, %p)\n", This, ppvObject);
|
||||
*ppvObject = HTMLDOC4(This);
|
||||
}else if(IsEqualGUID(&IID_IHTMLDocument5, riid)) {
|
||||
TRACE("(%p)->(IID_IHTMLDocument5, %p)\n", This, ppvObject);
|
||||
*ppvObject = HTMLDOC5(This);
|
||||
}else if(IsEqualGUID(&IID_IPersist, riid)) {
|
||||
TRACE("(%p)->(IID_IPersist, %p)\n", This, ppvObject);
|
||||
*ppvObject = PERSIST(This);
|
||||
}else if(IsEqualGUID(&IID_IPersistMoniker, riid)) {
|
||||
TRACE("(%p)->(IID_IPersistMoniker, %p)\n", This, ppvObject);
|
||||
*ppvObject = PERSISTMON(This);
|
||||
}else if(IsEqualGUID(&IID_IPersistFile, riid)) {
|
||||
TRACE("(%p)->(IID_IPersistFile, %p)\n", This, ppvObject);
|
||||
*ppvObject = PERSISTFILE(This);
|
||||
}else if(IsEqualGUID(&IID_IMonikerProp, riid)) {
|
||||
TRACE("(%p)->(IID_IMonikerProp, %p)\n", This, ppvObject);
|
||||
*ppvObject = MONPROP(This);
|
||||
}else if(IsEqualGUID(&IID_IOleObject, riid)) {
|
||||
TRACE("(%p)->(IID_IOleObject, %p)\n", This, ppvObject);
|
||||
*ppvObject = OLEOBJ(This);
|
||||
}else if(IsEqualGUID(&IID_IOleDocument, riid)) {
|
||||
TRACE("(%p)->(IID_IOleDocument, %p)\n", This, ppvObject);
|
||||
*ppvObject = OLEDOC(This);
|
||||
}else if(IsEqualGUID(&IID_IOleDocumentView, riid)) {
|
||||
TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This, ppvObject);
|
||||
*ppvObject = DOCVIEW(This);
|
||||
}else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
|
||||
TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This, ppvObject);
|
||||
*ppvObject = ACTOBJ(This);
|
||||
}else if(IsEqualGUID(&IID_IViewObject, riid)) {
|
||||
TRACE("(%p)->(IID_IViewObject, %p)\n", This, ppvObject);
|
||||
*ppvObject = VIEWOBJ(This);
|
||||
}else if(IsEqualGUID(&IID_IViewObject2, riid)) {
|
||||
TRACE("(%p)->(IID_IViewObject2, %p)\n", This, ppvObject);
|
||||
*ppvObject = VIEWOBJ2(This);
|
||||
}else if(IsEqualGUID(&IID_IOleWindow, riid)) {
|
||||
TRACE("(%p)->(IID_IOleWindow, %p)\n", This, ppvObject);
|
||||
*ppvObject = OLEWIN(This);
|
||||
}else if(IsEqualGUID(&IID_IOleInPlaceObject, riid)) {
|
||||
TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This, ppvObject);
|
||||
*ppvObject = INPLACEOBJ(This);
|
||||
}else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless, riid)) {
|
||||
TRACE("(%p)->(IID_IOleInPlaceObjectWindowless, %p)\n", This, ppvObject);
|
||||
*ppvObject = INPLACEWIN(This);
|
||||
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
|
||||
TRACE("(%p)->(IID_IServiceProvider, %p)\n", This, ppvObject);
|
||||
*ppvObject = SERVPROV(This);
|
||||
}else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
|
||||
TRACE("(%p)->(IID_IOleCommandTarget, %p)\n", This, ppvObject);
|
||||
*ppvObject = CMDTARGET(This);
|
||||
}else if(IsEqualGUID(&IID_IOleControl, riid)) {
|
||||
TRACE("(%p)->(IID_IOleControl, %p)\n", This, ppvObject);
|
||||
*ppvObject = CONTROL(This);
|
||||
}else if(IsEqualGUID(&IID_IHlinkTarget, riid)) {
|
||||
TRACE("(%p)->(IID_IHlinkTarget, %p)\n", This, ppvObject);
|
||||
*ppvObject = HLNKTARGET(This);
|
||||
}else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
|
||||
TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppvObject);
|
||||
*ppvObject = CONPTCONT(&This->cp_container);
|
||||
}else if(IsEqualGUID(&IID_IPersistStreamInit, riid)) {
|
||||
TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppvObject);
|
||||
*ppvObject = PERSTRINIT(This);
|
||||
}else if(IsEqualGUID(&IID_ICustomDoc, riid)) {
|
||||
TRACE("(%p)->(IID_ICustomDoc %p)\n", This, ppvObject);
|
||||
*ppvObject = CUSTOMDOC(This);
|
||||
}else if(IsEqualGUID(&DIID_DispHTMLDocument, riid)) {
|
||||
TRACE("(%p)->(DIID_DispHTMLDocument %p)\n", This, ppvObject);
|
||||
*ppvObject = HTMLDOC(This);
|
||||
}else if(IsEqualGUID(&IID_ISupportErrorInfo, riid)) {
|
||||
TRACE("(%p)->(IID_ISupportErrorInfo %p)\n", This, ppvObject);
|
||||
*ppvObject = SUPPERRINFO(This);
|
||||
}else if(IsEqualGUID(&IID_IPersistHistory, riid)) {
|
||||
TRACE("(%p)->(IID_IPersistHistory %p)\n", This, ppvObject);
|
||||
*ppvObject = PERSISTHIST(This);
|
||||
}else if(IsEqualGUID(&CLSID_CMarkup, riid)) {
|
||||
FIXME("(%p)->(CLSID_CMarkup %p)\n", This, ppvObject);
|
||||
return E_NOINTERFACE;
|
||||
}else if(IsEqualGUID(&IID_IRunnableObject, riid)) {
|
||||
TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppvObject);
|
||||
return E_NOINTERFACE;
|
||||
}else if(IsEqualGUID(&IID_IPersistPropertyBag, riid)) {
|
||||
TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This, ppvObject);
|
||||
return E_NOINTERFACE;
|
||||
}else if(IsEqualGUID(&IID_IMarshal, riid)) {
|
||||
TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This, ppvObject);
|
||||
return E_NOINTERFACE;
|
||||
}else if(dispex_query_interface(&This->dispex, riid, ppvObject)) {
|
||||
return *ppvObject ? S_OK : E_NOINTERFACE;
|
||||
}
|
||||
|
||||
if(*ppvObject) {
|
||||
IHTMLDocument2_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppvObject);
|
||||
return E_NOINTERFACE;
|
||||
return htmldoc_query_interface(This, riid, ppv);
|
||||
}
|
||||
|
||||
static ULONG WINAPI HTMLDocument_AddRef(IHTMLDocument2 *iface)
|
||||
{
|
||||
HTMLDocument *This = HTMLDOC_THIS(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
TRACE("(%p) ref = %u\n", This, ref);
|
||||
return ref;
|
||||
|
||||
return htmldoc_addref(This);
|
||||
}
|
||||
|
||||
static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
|
||||
{
|
||||
HTMLDocument *This = HTMLDOC_THIS(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p) ref = %u\n", This, ref);
|
||||
|
||||
if(!ref) {
|
||||
remove_doc_tasks(This);
|
||||
release_script_hosts(This);
|
||||
|
||||
if(This->client)
|
||||
IOleObject_SetClientSite(OLEOBJ(This), NULL);
|
||||
if(This->in_place_active)
|
||||
IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This));
|
||||
if(This->ipsite)
|
||||
IOleDocumentView_SetInPlaceSite(DOCVIEW(This), NULL);
|
||||
if(This->undomgr)
|
||||
IOleUndoManager_Release(This->undomgr);
|
||||
|
||||
set_document_bscallback(This, NULL);
|
||||
set_current_mon(This, NULL);
|
||||
|
||||
if(This->tooltips_hwnd)
|
||||
DestroyWindow(This->tooltips_hwnd);
|
||||
if(This->hwnd)
|
||||
DestroyWindow(This->hwnd);
|
||||
|
||||
if(This->option_factory) {
|
||||
This->option_factory->doc = NULL;
|
||||
IHTMLOptionElementFactory_Release(HTMLOPTFACTORY(This->option_factory));
|
||||
}
|
||||
|
||||
if(This->location)
|
||||
This->location->doc = NULL;
|
||||
|
||||
if(This->window)
|
||||
IHTMLWindow2_Release(HTMLWINDOW2(This->window));
|
||||
|
||||
if(This->event_target)
|
||||
release_event_target(This->event_target);
|
||||
|
||||
heap_free(This->mime);
|
||||
detach_selection(This);
|
||||
detach_ranges(This);
|
||||
release_nodes(This);
|
||||
release_dispex(&This->dispex);
|
||||
|
||||
ConnectionPointContainer_Destroy(&This->cp_container);
|
||||
|
||||
if(This->nsdoc) {
|
||||
remove_mutation_observer(This->nscontainer, This->nsdoc);
|
||||
nsIDOMHTMLDocument_Release(This->nsdoc);
|
||||
}
|
||||
if(This->nscontainer)
|
||||
NSContainer_Release(This->nscontainer);
|
||||
|
||||
heap_free(This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
return htmldoc_release(This);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLDocument_GetTypeInfoCount(IHTMLDocument2 *iface, UINT *pctinfo)
|
||||
|
@ -297,7 +125,7 @@ static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCo
|
|||
}
|
||||
|
||||
if(nselem) {
|
||||
*p = create_all_collection(get_node(This, (nsIDOMNode*)nselem, TRUE), TRUE);
|
||||
*p = create_all_collection(get_node(This->doc_node, (nsIDOMNode*)nselem, TRUE), TRUE);
|
||||
nsIDOMElement_Release(nselem);
|
||||
}else {
|
||||
*p = NULL;
|
||||
|
@ -327,7 +155,7 @@ static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement
|
|||
}
|
||||
|
||||
if(nsbody) {
|
||||
node = get_node(This, (nsIDOMNode*)nsbody, TRUE);
|
||||
node = get_node(This->doc_node, (nsIDOMNode*)nsbody, TRUE);
|
||||
nsIDOMHTMLElement_Release(nsbody);
|
||||
|
||||
IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p);
|
||||
|
@ -371,7 +199,7 @@ static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElemen
|
|||
}
|
||||
|
||||
if(nscoll) {
|
||||
*p = create_collection_from_htmlcol(This, (IUnknown*)HTMLDOC(This), nscoll);
|
||||
*p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)HTMLDOC(This), nscoll);
|
||||
nsIDOMElement_Release(nscoll);
|
||||
}
|
||||
|
||||
|
@ -403,7 +231,7 @@ static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLEleme
|
|||
}
|
||||
|
||||
if(nscoll) {
|
||||
*p = create_collection_from_htmlcol(This, (IUnknown*)HTMLDOC(This), nscoll);
|
||||
*p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)HTMLDOC(This), nscoll);
|
||||
nsIDOMElement_Release(nscoll);
|
||||
}
|
||||
|
||||
|
@ -435,7 +263,7 @@ static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElement
|
|||
}
|
||||
|
||||
if(nscoll) {
|
||||
*p = create_collection_from_htmlcol(This, (IUnknown*)HTMLDOC(This), nscoll);
|
||||
*p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)HTMLDOC(This), nscoll);
|
||||
nsIDOMElement_Release(nscoll);
|
||||
}
|
||||
|
||||
|
@ -467,7 +295,7 @@ static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElement
|
|||
}
|
||||
|
||||
if(nscoll) {
|
||||
*p = create_collection_from_htmlcol(This, (IUnknown*)HTMLDOC(This), nscoll);
|
||||
*p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)HTMLDOC(This), nscoll);
|
||||
nsIDOMElement_Release(nscoll);
|
||||
}
|
||||
|
||||
|
@ -499,7 +327,7 @@ static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLEleme
|
|||
}
|
||||
|
||||
if(nscoll) {
|
||||
*p = create_collection_from_htmlcol(This, (IUnknown*)HTMLDOC(This), nscoll);
|
||||
*p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)HTMLDOC(This), nscoll);
|
||||
nsIDOMElement_Release(nscoll);
|
||||
}
|
||||
|
||||
|
@ -590,22 +418,18 @@ static HRESULT WINAPI HTMLDocument_get_designMode(IHTMLDocument2 *iface, BSTR *p
|
|||
static HRESULT WINAPI HTMLDocument_get_selection(IHTMLDocument2 *iface, IHTMLSelectionObject **p)
|
||||
{
|
||||
HTMLDocument *This = HTMLDOC_THIS(iface);
|
||||
nsISelection *nsselection = NULL;
|
||||
nsISelection *nsselection;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(This->nscontainer) {
|
||||
nsIDOMWindow *dom_window = NULL;
|
||||
|
||||
nsIWebBrowser_GetContentDOMWindow(This->nscontainer->webbrowser, &dom_window);
|
||||
if(dom_window) {
|
||||
nsIDOMWindow_GetSelection(dom_window, &nsselection);
|
||||
nsIDOMWindow_Release(dom_window);
|
||||
}
|
||||
nsres = nsIDOMWindow_GetSelection(This->window->nswindow, &nsselection);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("GetSelection failed: %08x\n", nsres);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
*p = HTMLSelectionObject_Create(This, nsselection);
|
||||
return S_OK;
|
||||
return HTMLSelectionObject_Create(This->doc_node, nsselection, p);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLDocument_get_readyState(IHTMLDocument2 *iface, BSTR *p)
|
||||
|
@ -631,7 +455,7 @@ static HRESULT WINAPI HTMLDocument_get_readyState(IHTMLDocument2 *iface, BSTR *p
|
|||
if(!p)
|
||||
return E_POINTER;
|
||||
|
||||
*p = SysAllocString(readystate_str[This->readystate]);
|
||||
*p = SysAllocString(readystate_str[This->doc_obj->readystate]);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -739,13 +563,7 @@ static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLoca
|
|||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(This->location)
|
||||
IHTMLLocation_AddRef(HTMLLOCATION(This->location));
|
||||
else
|
||||
This->location = HTMLLocation_Create(This);
|
||||
|
||||
*p = HTMLLOCATION(This->location);
|
||||
return S_OK;
|
||||
return IHTMLWindow2_get_location(HTMLWINDOW2(This->window), p);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLDocument_get_lastModified(IHTMLDocument2 *iface, BSTR *p)
|
||||
|
@ -771,8 +589,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)
|
||||
|
@ -1113,7 +931,7 @@ static HRESULT WINAPI HTMLDocument_createElement(IHTMLDocument2 *iface, BSTR eTa
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
elem = HTMLElement_Create(This, (nsIDOMNode*)nselem, TRUE);
|
||||
elem = HTMLElement_Create(This->doc_node, (nsIDOMNode*)nselem, TRUE);
|
||||
nsIDOMElement_Release(nselem);
|
||||
|
||||
*newElem = HTMLELEM(elem);
|
||||
|
@ -1138,15 +956,19 @@ static HRESULT WINAPI HTMLDocument_get_onhelp(IHTMLDocument2 *iface, VARIANT *p)
|
|||
static HRESULT WINAPI HTMLDocument_put_onclick(IHTMLDocument2 *iface, VARIANT v)
|
||||
{
|
||||
HTMLDocument *This = HTMLDOC_THIS(iface);
|
||||
FIXME("(%p)\n", This);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
|
||||
return set_doc_event(This, EVENTID_CLICK, &v);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLDocument_get_onclick(IHTMLDocument2 *iface, VARIANT *p)
|
||||
{
|
||||
HTMLDocument *This = HTMLDOC_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
return get_doc_event(This, EVENTID_CLICK, p);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLDocument_put_ondblclick(IHTMLDocument2 *iface, VARIANT v)
|
||||
|
@ -1654,7 +1476,7 @@ static HRESULT WINAPI DocDispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *p
|
|||
{
|
||||
HTMLDocument *This = DISPEX_THIS(iface);
|
||||
|
||||
return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
|
||||
return IDispatchEx_GetTypeInfoCount(This->dispex, pctinfo);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DocDispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
|
||||
|
@ -1662,7 +1484,7 @@ static HRESULT WINAPI DocDispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
|
|||
{
|
||||
HTMLDocument *This = DISPEX_THIS(iface);
|
||||
|
||||
return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
|
||||
return IDispatchEx_GetTypeInfo(This->dispex, iTInfo, lcid, ppTInfo);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DocDispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
|
||||
|
@ -1671,7 +1493,7 @@ static HRESULT WINAPI DocDispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID rii
|
|||
{
|
||||
HTMLDocument *This = DISPEX_THIS(iface);
|
||||
|
||||
return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
|
||||
return IDispatchEx_GetIDsOfNames(This->dispex, riid, rgszNames, cNames, lcid, rgDispId);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DocDispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
|
||||
|
@ -1691,11 +1513,11 @@ static HRESULT WINAPI DocDispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMemb
|
|||
return E_INVALIDARG;
|
||||
|
||||
V_VT(pVarResult) = VT_I4;
|
||||
V_I4(pVarResult) = This->readystate;
|
||||
V_I4(pVarResult) = This->doc_obj->readystate;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
|
||||
return IDispatchEx_Invoke(This->dispex, dispIdMember, riid, lcid, wFlags, pDispParams,
|
||||
pVarResult, pExcepInfo, puArgErr);
|
||||
}
|
||||
|
||||
|
@ -1703,7 +1525,7 @@ static HRESULT WINAPI DocDispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName,
|
|||
{
|
||||
HTMLDocument *This = DISPEX_THIS(iface);
|
||||
|
||||
return IDispatchEx_GetDispID(DISPATCHEX(&This->dispex), bstrName, grfdex, pid);
|
||||
return IDispatchEx_GetDispID(This->dispex, bstrName, grfdex, pid);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DocDispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
||||
|
@ -1711,49 +1533,49 @@ static HRESULT WINAPI DocDispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID
|
|||
{
|
||||
HTMLDocument *This = DISPEX_THIS(iface);
|
||||
|
||||
return IDispatchEx_InvokeEx(DISPATCHEX(&This->dispex), id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
|
||||
return IDispatchEx_InvokeEx(This->dispex, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DocDispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
|
||||
{
|
||||
HTMLDocument *This = DISPEX_THIS(iface);
|
||||
|
||||
return IDispatchEx_DeleteMemberByName(DISPATCHEX(&This->dispex), bstrName, grfdex);
|
||||
return IDispatchEx_DeleteMemberByName(This->dispex, bstrName, grfdex);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DocDispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
|
||||
{
|
||||
HTMLDocument *This = DISPEX_THIS(iface);
|
||||
|
||||
return IDispatchEx_DeleteMemberByDispID(DISPATCHEX(&This->dispex), id);
|
||||
return IDispatchEx_DeleteMemberByDispID(This->dispex, id);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DocDispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
|
||||
{
|
||||
HTMLDocument *This = DISPEX_THIS(iface);
|
||||
|
||||
return IDispatchEx_GetMemberProperties(DISPATCHEX(&This->dispex), id, grfdexFetch, pgrfdex);
|
||||
return IDispatchEx_GetMemberProperties(This->dispex, id, grfdexFetch, pgrfdex);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DocDispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
|
||||
{
|
||||
HTMLDocument *This = DISPEX_THIS(iface);
|
||||
|
||||
return IDispatchEx_GetMemberName(DISPATCHEX(&This->dispex), id, pbstrName);
|
||||
return IDispatchEx_GetMemberName(This->dispex, id, pbstrName);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DocDispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
|
||||
{
|
||||
HTMLDocument *This = DISPEX_THIS(iface);
|
||||
|
||||
return IDispatchEx_GetNextDispID(DISPATCHEX(&This->dispex), grfdex, id, pid);
|
||||
return IDispatchEx_GetNextDispID(This->dispex, grfdex, id, pid);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DocDispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
|
||||
{
|
||||
HTMLDocument *This = DISPEX_THIS(iface);
|
||||
|
||||
return IDispatchEx_GetNameSpaceParent(DISPATCHEX(&This->dispex), ppunk);
|
||||
return IDispatchEx_GetNameSpaceParent(This->dispex, ppunk);
|
||||
}
|
||||
|
||||
#undef DISPEX_THIS
|
||||
|
@ -1776,36 +1598,129 @@ static const IDispatchExVtbl DocDispatchExVtbl = {
|
|||
DocDispatchEx_GetNameSpaceParent
|
||||
};
|
||||
|
||||
static const tid_t HTMLDocument_iface_tids[] = {
|
||||
IHTMLDocument2_tid,
|
||||
IHTMLDocument3_tid,
|
||||
IHTMLDocument4_tid,
|
||||
IHTMLDocument5_tid,
|
||||
0
|
||||
};
|
||||
static dispex_static_data_t HTMLDocument_dispex = {
|
||||
NULL,
|
||||
DispHTMLDocument_tid,
|
||||
NULL,
|
||||
HTMLDocument_iface_tids
|
||||
};
|
||||
|
||||
static HRESULT alloc_doc(HTMLDocument **ret)
|
||||
static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
|
||||
{
|
||||
HTMLDocument *doc;
|
||||
*ppv = NULL;
|
||||
|
||||
doc = heap_alloc_zero(sizeof(HTMLDocument));
|
||||
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
||||
TRACE("(%p)->(IID_IUnknown, %p)\n", This, ppv);
|
||||
*ppv = HTMLDOC(This);
|
||||
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
|
||||
TRACE("(%p)->(IID_IDispatch, %p)\n", This, ppv);
|
||||
*ppv = DISPATCHEX(This);
|
||||
}else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
|
||||
TRACE("(%p)->(IID_IDispatchEx, %p)\n", This, ppv);
|
||||
*ppv = DISPATCHEX(This);
|
||||
}else if(IsEqualGUID(&IID_IHTMLDocument, riid)) {
|
||||
TRACE("(%p)->(IID_IHTMLDocument, %p)\n", This, ppv);
|
||||
*ppv = HTMLDOC(This);
|
||||
}else if(IsEqualGUID(&IID_IHTMLDocument2, riid)) {
|
||||
TRACE("(%p)->(IID_IHTMLDocument2, %p)\n", This, ppv);
|
||||
*ppv = HTMLDOC(This);
|
||||
}else if(IsEqualGUID(&IID_IHTMLDocument3, riid)) {
|
||||
TRACE("(%p)->(IID_IHTMLDocument3, %p)\n", This, ppv);
|
||||
*ppv = HTMLDOC3(This);
|
||||
}else if(IsEqualGUID(&IID_IHTMLDocument4, riid)) {
|
||||
TRACE("(%p)->(IID_IHTMLDocument4, %p)\n", This, ppv);
|
||||
*ppv = HTMLDOC4(This);
|
||||
}else if(IsEqualGUID(&IID_IHTMLDocument5, riid)) {
|
||||
TRACE("(%p)->(IID_IHTMLDocument5, %p)\n", This, ppv);
|
||||
*ppv = HTMLDOC5(This);
|
||||
}else if(IsEqualGUID(&IID_IPersist, riid)) {
|
||||
TRACE("(%p)->(IID_IPersist, %p)\n", This, ppv);
|
||||
*ppv = PERSIST(This);
|
||||
}else if(IsEqualGUID(&IID_IPersistMoniker, riid)) {
|
||||
TRACE("(%p)->(IID_IPersistMoniker, %p)\n", This, ppv);
|
||||
*ppv = PERSISTMON(This);
|
||||
}else if(IsEqualGUID(&IID_IPersistFile, riid)) {
|
||||
TRACE("(%p)->(IID_IPersistFile, %p)\n", This, ppv);
|
||||
*ppv = PERSISTFILE(This);
|
||||
}else if(IsEqualGUID(&IID_IMonikerProp, riid)) {
|
||||
TRACE("(%p)->(IID_IMonikerProp, %p)\n", This, ppv);
|
||||
*ppv = MONPROP(This);
|
||||
}else if(IsEqualGUID(&IID_IOleObject, riid)) {
|
||||
TRACE("(%p)->(IID_IOleObject, %p)\n", This, ppv);
|
||||
*ppv = OLEOBJ(This);
|
||||
}else if(IsEqualGUID(&IID_IOleDocument, riid)) {
|
||||
TRACE("(%p)->(IID_IOleDocument, %p)\n", This, ppv);
|
||||
*ppv = OLEDOC(This);
|
||||
}else if(IsEqualGUID(&IID_IOleDocumentView, riid)) {
|
||||
TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This, ppv);
|
||||
*ppv = DOCVIEW(This);
|
||||
}else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
|
||||
TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This, ppv);
|
||||
*ppv = ACTOBJ(This);
|
||||
}else if(IsEqualGUID(&IID_IViewObject, riid)) {
|
||||
TRACE("(%p)->(IID_IViewObject, %p)\n", This, ppv);
|
||||
*ppv = VIEWOBJ(This);
|
||||
}else if(IsEqualGUID(&IID_IViewObject2, riid)) {
|
||||
TRACE("(%p)->(IID_IViewObject2, %p)\n", This, ppv);
|
||||
*ppv = VIEWOBJ2(This);
|
||||
}else if(IsEqualGUID(&IID_IOleWindow, riid)) {
|
||||
TRACE("(%p)->(IID_IOleWindow, %p)\n", This, ppv);
|
||||
*ppv = OLEWIN(This);
|
||||
}else if(IsEqualGUID(&IID_IOleInPlaceObject, riid)) {
|
||||
TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This, ppv);
|
||||
*ppv = INPLACEOBJ(This);
|
||||
}else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless, riid)) {
|
||||
TRACE("(%p)->(IID_IOleInPlaceObjectWindowless, %p)\n", This, ppv);
|
||||
*ppv = INPLACEWIN(This);
|
||||
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
|
||||
TRACE("(%p)->(IID_IServiceProvider, %p)\n", This, ppv);
|
||||
*ppv = SERVPROV(This);
|
||||
}else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
|
||||
TRACE("(%p)->(IID_IOleCommandTarget, %p)\n", This, ppv);
|
||||
*ppv = CMDTARGET(This);
|
||||
}else if(IsEqualGUID(&IID_IOleControl, riid)) {
|
||||
TRACE("(%p)->(IID_IOleControl, %p)\n", This, ppv);
|
||||
*ppv = CONTROL(This);
|
||||
}else if(IsEqualGUID(&IID_IHlinkTarget, riid)) {
|
||||
TRACE("(%p)->(IID_IHlinkTarget, %p)\n", This, ppv);
|
||||
*ppv = HLNKTARGET(This);
|
||||
}else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
|
||||
TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
|
||||
*ppv = CONPTCONT(&This->cp_container);
|
||||
}else if(IsEqualGUID(&IID_IPersistStreamInit, riid)) {
|
||||
TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
|
||||
*ppv = PERSTRINIT(This);
|
||||
}else if(IsEqualGUID(&DIID_DispHTMLDocument, riid)) {
|
||||
TRACE("(%p)->(DIID_DispHTMLDocument %p)\n", This, ppv);
|
||||
*ppv = HTMLDOC(This);
|
||||
}else if(IsEqualGUID(&IID_ISupportErrorInfo, riid)) {
|
||||
TRACE("(%p)->(IID_ISupportErrorInfo %p)\n", This, ppv);
|
||||
*ppv = SUPPERRINFO(This);
|
||||
}else if(IsEqualGUID(&IID_IPersistHistory, riid)) {
|
||||
TRACE("(%p)->(IID_IPersistHistory %p)\n", This, ppv);
|
||||
*ppv = PERSISTHIST(This);
|
||||
}else if(IsEqualGUID(&CLSID_CMarkup, riid)) {
|
||||
FIXME("(%p)->(CLSID_CMarkup %p)\n", This, ppv);
|
||||
*ppv = NULL;
|
||||
}else if(IsEqualGUID(&IID_IRunnableObject, riid)) {
|
||||
TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppv);
|
||||
*ppv = NULL;
|
||||
}else if(IsEqualGUID(&IID_IPersistPropertyBag, riid)) {
|
||||
TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This, ppv);
|
||||
*ppv = NULL;
|
||||
}else if(IsEqualGUID(&IID_IMarshal, riid)) {
|
||||
TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This, ppv);
|
||||
*ppv = NULL;
|
||||
}else {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(*ppv)
|
||||
IUnknown_AddRef((IUnknown*)*ppv);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void init_doc(HTMLDocument *doc, IUnknown *unk_impl, IDispatchEx *dispex)
|
||||
{
|
||||
doc->lpHTMLDocument2Vtbl = &HTMLDocumentVtbl;
|
||||
doc->lpIDispatchExVtbl = &DocDispatchExVtbl;
|
||||
doc->lpSupportErrorInfoVtbl = &SupportErrorInfoVtbl;
|
||||
doc->ref = 1;
|
||||
doc->readystate = READYSTATE_UNINITIALIZED;
|
||||
doc->scriptmode = SCRIPTMODE_GECKO;
|
||||
|
||||
list_init(&doc->bindings);
|
||||
list_init(&doc->script_hosts);
|
||||
list_init(&doc->selection_list);
|
||||
list_init(&doc->range_list);
|
||||
doc->unk_impl = unk_impl;
|
||||
doc->dispex = dispex;
|
||||
|
||||
HTMLDocument_HTMLDocument3_Init(doc);
|
||||
HTMLDocument_HTMLDocument5_Init(doc);
|
||||
|
@ -1821,28 +1736,106 @@ static HRESULT alloc_doc(HTMLDocument **ret)
|
|||
ConnectionPoint_Init(&doc->cp_propnotif, &doc->cp_container, &IID_IPropertyNotifySink);
|
||||
ConnectionPoint_Init(&doc->cp_htmldocevents, &doc->cp_container, &DIID_HTMLDocumentEvents);
|
||||
ConnectionPoint_Init(&doc->cp_htmldocevents2, &doc->cp_container, &DIID_HTMLDocumentEvents2);
|
||||
}
|
||||
|
||||
init_dispex(&doc->dispex, (IUnknown*)HTMLDOC(doc), &HTMLDocument_dispex);
|
||||
static void destroy_htmldoc(HTMLDocument *This)
|
||||
{
|
||||
remove_doc_tasks(This);
|
||||
|
||||
*ret = doc;
|
||||
ConnectionPointContainer_Destroy(&This->cp_container);
|
||||
|
||||
if(This->nsdoc)
|
||||
nsIDOMHTMLDocument_Release(This->nsdoc);
|
||||
}
|
||||
|
||||
#define HTMLDOCNODE_NODE_THIS(iface) DEFINE_THIS2(HTMLDocumentNode, node, iface)
|
||||
|
||||
static HRESULT HTMLDocumentNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
HTMLDocumentNode *This = HTMLDOCNODE_NODE_THIS(iface);
|
||||
|
||||
if(htmldoc_qi(&This->basedoc, riid, ppv))
|
||||
return *ppv ? S_OK : E_NOINTERFACE;
|
||||
|
||||
if(IsEqualGUID(&IID_IInternetHostSecurityManager, riid)) {
|
||||
TRACE("(%p)->(IID_IInternetHostSecurityManager %p)\n", This, ppv);
|
||||
*ppv = HOSTSECMGR(This);
|
||||
}else {
|
||||
return HTMLDOMNode_QI(&This->node, riid, ppv);
|
||||
}
|
||||
|
||||
IUnknown_AddRef((IUnknown*)*ppv);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocument **ret)
|
||||
static void HTMLDocumentNode_destructor(HTMLDOMNode *iface)
|
||||
{
|
||||
HTMLDocument *doc;
|
||||
HTMLDocumentNode *This = HTMLDOCNODE_NODE_THIS(iface);
|
||||
|
||||
if(This->secmgr)
|
||||
IInternetSecurityManager_Release(This->secmgr);
|
||||
|
||||
detach_selection(This);
|
||||
detach_ranges(This);
|
||||
release_nodes(This);
|
||||
destroy_htmldoc(&This->basedoc);
|
||||
}
|
||||
|
||||
#undef HTMLDOCNODE_NODE_THIS
|
||||
|
||||
static const NodeImplVtbl HTMLDocumentNodeImplVtbl = {
|
||||
HTMLDocumentNode_QI,
|
||||
HTMLDocumentNode_destructor
|
||||
};
|
||||
|
||||
static const tid_t HTMLDocumentNode_iface_tids[] = {
|
||||
IHTMLDOMNode_tid,
|
||||
IHTMLDOMNode2_tid,
|
||||
IHTMLDocument2_tid,
|
||||
IHTMLDocument3_tid,
|
||||
IHTMLDocument4_tid,
|
||||
IHTMLDocument5_tid,
|
||||
0
|
||||
};
|
||||
|
||||
static dispex_static_data_t HTMLDocumentNode_dispex = {
|
||||
NULL,
|
||||
DispHTMLDocument_tid,
|
||||
NULL,
|
||||
HTMLDocumentNode_iface_tids
|
||||
};
|
||||
|
||||
HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_obj, HTMLWindow *window, HTMLDocumentNode **ret)
|
||||
{
|
||||
HTMLDocumentNode *doc;
|
||||
HRESULT hres;
|
||||
|
||||
hres = alloc_doc(&doc);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
doc = heap_alloc_zero(sizeof(HTMLDocumentNode));
|
||||
if(!doc)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
doc->basedoc.doc_node = doc;
|
||||
doc->basedoc.doc_obj = doc_obj;
|
||||
|
||||
init_dispex(&doc->node.dispex, (IUnknown*)HTMLDOMNODE(&doc->node), &HTMLDocumentNode_dispex);
|
||||
init_doc(&doc->basedoc, (IUnknown*)HTMLDOMNODE(&doc->node), DISPATCHEX(&doc->node.dispex));
|
||||
HTMLDocumentNode_SecMgr_Init(doc);
|
||||
doc->ref = 1;
|
||||
|
||||
nsIDOMHTMLDocument_AddRef(nsdoc);
|
||||
doc->nsdoc = nsdoc;
|
||||
doc->basedoc.nsdoc = nsdoc;
|
||||
|
||||
hres = HTMLWindow_Create(doc, NULL, &doc->window);
|
||||
doc->basedoc.window = window;
|
||||
|
||||
list_init(&doc->selection_list);
|
||||
list_init(&doc->range_list);
|
||||
|
||||
HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)nsdoc);
|
||||
doc->node.vtbl = &HTMLDocumentNodeImplVtbl;
|
||||
|
||||
hres = CoInternetCreateSecurityManager(NULL, &doc->secmgr, 0);
|
||||
if(FAILED(hres)) {
|
||||
IHTMLDocument_Release(HTMLDOC(doc));
|
||||
htmldoc_release(&doc->basedoc);
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
@ -1850,25 +1843,149 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocument **ret)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
* ICustomDoc implementation
|
||||
*/
|
||||
|
||||
#define CUSTOMDOC_THIS(iface) DEFINE_THIS(HTMLDocumentObj, CustomDoc, iface)
|
||||
|
||||
static HRESULT WINAPI CustomDoc_QueryInterface(ICustomDoc *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
HTMLDocumentObj *This = CUSTOMDOC_THIS(iface);
|
||||
|
||||
if(htmldoc_qi(&This->basedoc, riid, ppv))
|
||||
return *ppv ? S_OK : E_NOINTERFACE;
|
||||
|
||||
if(IsEqualGUID(&IID_ICustomDoc, riid)) {
|
||||
TRACE("(%p)->(IID_ICustomDoc %p)\n", This, ppv);
|
||||
*ppv = CUSTOMDOC(This);
|
||||
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
|
||||
return *ppv ? S_OK : E_NOINTERFACE;
|
||||
}else {
|
||||
FIXME("Unimplemented interface %s\n", debugstr_guid(riid));
|
||||
*ppv = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
IUnknown_AddRef((IUnknown*)*ppv);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static ULONG WINAPI CustomDoc_AddRef(ICustomDoc *iface)
|
||||
{
|
||||
HTMLDocumentObj *This = CUSTOMDOC_THIS(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p) ref = %u\n", This, ref);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
|
||||
{
|
||||
HTMLDocumentObj *This = CUSTOMDOC_THIS(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
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));
|
||||
}
|
||||
if(This->basedoc.window) {
|
||||
This->basedoc.window->doc_obj = NULL;
|
||||
IHTMLWindow2_Release(HTMLWINDOW2(This->basedoc.window));
|
||||
}
|
||||
|
||||
if(This->client)
|
||||
IOleObject_SetClientSite(OLEOBJ(&This->basedoc), NULL);
|
||||
if(This->in_place_active)
|
||||
IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(&This->basedoc));
|
||||
if(This->ipsite)
|
||||
IOleDocumentView_SetInPlaceSite(DOCVIEW(&This->basedoc), NULL);
|
||||
if(This->undomgr)
|
||||
IOleUndoManager_Release(This->undomgr);
|
||||
if(This->tooltips_hwnd)
|
||||
DestroyWindow(This->tooltips_hwnd);
|
||||
|
||||
if(This->hwnd)
|
||||
DestroyWindow(This->hwnd);
|
||||
heap_free(This->mime);
|
||||
|
||||
destroy_htmldoc(&This->basedoc);
|
||||
release_dispex(&This->dispex);
|
||||
|
||||
if(This->basedoc.nsdoc)
|
||||
remove_mutation_observer(This->nscontainer, This->basedoc.nsdoc);
|
||||
if(This->nscontainer)
|
||||
NSContainer_Release(This->nscontainer);
|
||||
heap_free(This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI CustomDoc_SetUIHandler(ICustomDoc *iface, IDocHostUIHandler *pUIHandler)
|
||||
{
|
||||
HTMLDocumentObj *This = CUSTOMDOC_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, pUIHandler);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
#undef CUSTOMDOC_THIS
|
||||
|
||||
static const ICustomDocVtbl CustomDocVtbl = {
|
||||
CustomDoc_QueryInterface,
|
||||
CustomDoc_AddRef,
|
||||
CustomDoc_Release,
|
||||
CustomDoc_SetUIHandler
|
||||
};
|
||||
|
||||
static const tid_t HTMLDocumentObj_iface_tids[] = {
|
||||
IHTMLDocument2_tid,
|
||||
IHTMLDocument3_tid,
|
||||
IHTMLDocument4_tid,
|
||||
IHTMLDocument5_tid,
|
||||
0
|
||||
};
|
||||
static dispex_static_data_t HTMLDocumentObj_dispex = {
|
||||
NULL,
|
||||
DispHTMLDocument_tid,
|
||||
NULL,
|
||||
HTMLDocumentObj_iface_tids
|
||||
};
|
||||
|
||||
HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
|
||||
{
|
||||
HTMLDocument *doc;
|
||||
HTMLDocumentObj *doc;
|
||||
nsIDOMWindow *nswindow = NULL;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppvObject);
|
||||
|
||||
hres = alloc_doc(&doc);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
doc = heap_alloc_zero(sizeof(HTMLDocumentObj));
|
||||
if(!doc)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
hres = IHTMLDocument_QueryInterface(HTMLDOC(doc), riid, ppvObject);
|
||||
IHTMLDocument_Release(HTMLDOC(doc));
|
||||
init_dispex(&doc->dispex, (IUnknown*)CUSTOMDOC(doc), &HTMLDocumentObj_dispex);
|
||||
init_doc(&doc->basedoc, (IUnknown*)CUSTOMDOC(doc), DISPATCHEX(&doc->dispex));
|
||||
|
||||
doc->lpCustomDocVtbl = &CustomDocVtbl;
|
||||
doc->ref = 1;
|
||||
doc->basedoc.doc_obj = doc;
|
||||
|
||||
hres = htmldoc_query_interface(&doc->basedoc, riid, ppvObject);
|
||||
htmldoc_release(&doc->basedoc);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
doc->nscontainer = NSContainer_Create(doc, NULL);
|
||||
update_nsdocument(doc);
|
||||
list_init(&doc->bindings);
|
||||
doc->usermode = UNKNOWN_USERMODE;
|
||||
doc->readystate = READYSTATE_UNINITIALIZED;
|
||||
|
||||
if(doc->nscontainer) {
|
||||
nsresult nsres;
|
||||
|
@ -1878,14 +1995,15 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
|
|||
ERR("GetContentDOMWindow failed: %08x\n", nsres);
|
||||
}
|
||||
|
||||
hres = HTMLWindow_Create(doc, nswindow, &doc->window);
|
||||
hres = HTMLWindow_Create(doc, nswindow, &doc->basedoc.window);
|
||||
if(nswindow)
|
||||
nsIDOMWindow_Release(nswindow);
|
||||
if(FAILED(hres)) {
|
||||
IHTMLDocument_Release(HTMLDOC(doc));
|
||||
IHTMLDocument_Release(HTMLDOC(&doc->basedoc));
|
||||
return hres;
|
||||
}
|
||||
|
||||
update_nsdocument(doc);
|
||||
get_thread_hwnd();
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "wine/debug.h"
|
||||
|
||||
#include "mshtml_private.h"
|
||||
#include "htmlevent.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
||||
|
||||
|
@ -123,7 +124,7 @@ static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR t
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
node = HTMLDOMTextNode_Create(This, (nsIDOMNode*)nstext);
|
||||
node = HTMLDOMTextNode_Create(This->doc_node, (nsIDOMNode*)nstext);
|
||||
nsIDOMElement_Release(nstext);
|
||||
|
||||
*newTextNode = HTMLDOMNODE(node);
|
||||
|
@ -152,7 +153,7 @@ static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, I
|
|||
}
|
||||
|
||||
if(nselem) {
|
||||
node = get_node(This, (nsIDOMNode *)nselem, TRUE);
|
||||
node = get_node(This->doc_node, (nsIDOMNode *)nselem, TRUE);
|
||||
nsIDOMElement_Release(nselem);
|
||||
IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p);
|
||||
}else {
|
||||
|
@ -173,8 +174,10 @@ static HRESULT WINAPI HTMLDocument3_attachEvent(IHTMLDocument3 *iface, BSTR even
|
|||
IDispatch* pDisp, VARIANT_BOOL *pfResult)
|
||||
{
|
||||
HTMLDocument *This = HTMLDOC3_THIS(iface);
|
||||
FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
|
||||
|
||||
return attach_event(&This->doc_node->node.event_target, This, event, pDisp, pfResult);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLDocument3_detachEvent(IHTMLDocument3 *iface, BSTR event,
|
||||
|
@ -442,7 +445,7 @@ static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v
|
|||
}
|
||||
|
||||
if(nselem) {
|
||||
node = get_node(This, (nsIDOMNode*)nselem, TRUE);
|
||||
node = get_node(This->doc_node, (nsIDOMNode*)nselem, TRUE);
|
||||
nsIDOMElement_Release(nselem);
|
||||
|
||||
IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)pel);
|
||||
|
@ -480,7 +483,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface,
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
*pelColl = (IHTMLElementCollection*)create_collection_from_nodelist(This, (IUnknown*)HTMLDOC3(This), nslist);
|
||||
*pelColl = (IHTMLElementCollection*)create_collection_from_nodelist(This->doc_node, (IUnknown*)HTMLDOC3(This), nslist);
|
||||
nsIDOMNodeList_Release(nslist);
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -144,7 +144,7 @@ static HRESULT WINAPI HTMLDocument5_createComment(IHTMLDocument5 *iface, BSTR bs
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
node = &HTMLCommentElement_Create(This, (nsIDOMNode*)nscomment)->node;
|
||||
node = &HTMLCommentElement_Create(This->doc_node, (nsIDOMNode*)nscomment)->node;
|
||||
nsIDOMElement_Release(nscomment);
|
||||
|
||||
*ppRetNode = HTMLDOMNODE(node);
|
||||
|
|
|
@ -96,44 +96,26 @@ static HRESULT WINAPI HTMLElement_setAttribute(IHTMLElement *iface, BSTR strAttr
|
|||
VARIANT AttributeValue, LONG lFlags)
|
||||
{
|
||||
HTMLElement *This = HTMLELEM_THIS(iface);
|
||||
nsAString attr_str;
|
||||
nsAString value_str;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
VARIANT AttributeValueChanged;
|
||||
DISPID dispid, dispidNamed = DISPID_PROPERTYPUT;
|
||||
DISPPARAMS dispParams;
|
||||
EXCEPINFO excep;
|
||||
|
||||
WARN("(%p)->(%s . %08x)\n", This, debugstr_w(strAttributeName), lFlags);
|
||||
TRACE("(%p)->(%s . %08x)\n", This, debugstr_w(strAttributeName), lFlags);
|
||||
|
||||
if(!This->nselem) {
|
||||
FIXME("NULL nselem\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
VariantInit(&AttributeValueChanged);
|
||||
|
||||
hres = VariantChangeType(&AttributeValueChanged, &AttributeValue, 0, VT_BSTR);
|
||||
if (FAILED(hres)) {
|
||||
WARN("couldn't convert input attribute value %d to VT_BSTR\n", V_VT(&AttributeValue));
|
||||
hres = IDispatchEx_GetDispID(DISPATCHEX(&This->node.dispex), strAttributeName,
|
||||
fdexNameCaseInsensitive | fdexNameEnsure, &dispid);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
}
|
||||
|
||||
nsAString_Init(&attr_str, strAttributeName);
|
||||
nsAString_Init(&value_str, V_BSTR(&AttributeValueChanged));
|
||||
|
||||
TRACE("setting %s to %s\n", debugstr_w(strAttributeName),
|
||||
debugstr_w(V_BSTR(&AttributeValueChanged)));
|
||||
|
||||
nsres = nsIDOMHTMLElement_SetAttribute(This->nselem, &attr_str, &value_str);
|
||||
nsAString_Finish(&attr_str);
|
||||
nsAString_Finish(&value_str);
|
||||
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
hres = S_OK;
|
||||
}else {
|
||||
ERR("SetAttribute failed: %08x\n", nsres);
|
||||
hres = E_FAIL;
|
||||
}
|
||||
dispParams.cArgs = 1;
|
||||
dispParams.cNamedArgs = 1;
|
||||
dispParams.rgdispidNamedArgs = &dispidNamed;
|
||||
dispParams.rgvarg = &AttributeValue;
|
||||
|
||||
hres = IDispatchEx_InvokeEx(DISPATCHEX(&This->node.dispex), dispid,
|
||||
LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT, &dispParams,
|
||||
NULL, &excep, NULL);
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
@ -141,59 +123,28 @@ static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttr
|
|||
LONG lFlags, VARIANT *AttributeValue)
|
||||
{
|
||||
HTMLElement *This = HTMLELEM_THIS(iface);
|
||||
nsAString attr_str;
|
||||
nsAString value_str;
|
||||
const PRUnichar *value;
|
||||
nsresult nsres;
|
||||
HRESULT hres = S_OK;
|
||||
DISPID dispid;
|
||||
HRESULT hres;
|
||||
DISPPARAMS dispParams = {NULL, NULL, 0, 0};
|
||||
EXCEPINFO excep;
|
||||
|
||||
WARN("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
|
||||
TRACE("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
|
||||
|
||||
if(!This->nselem) {
|
||||
FIXME("NULL nselem\n");
|
||||
hres = IDispatchEx_GetDispID(DISPATCHEX(&This->node.dispex), strAttributeName,
|
||||
fdexNameCaseInsensitive, &dispid);
|
||||
if(hres == DISP_E_UNKNOWNNAME) {
|
||||
V_VT(AttributeValue) = VT_NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
V_VT(AttributeValue) = VT_NULL;
|
||||
|
||||
nsAString_Init(&attr_str, strAttributeName);
|
||||
nsAString_Init(&value_str, NULL);
|
||||
|
||||
nsres = nsIDOMHTMLElement_GetAttribute(This->nselem, &attr_str, &value_str);
|
||||
nsAString_Finish(&attr_str);
|
||||
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
static const WCHAR wszSRC[] = {'s','r','c',0};
|
||||
nsAString_GetData(&value_str, &value);
|
||||
if(!strcmpiW(strAttributeName, wszSRC))
|
||||
{
|
||||
WCHAR buffer[256];
|
||||
DWORD len;
|
||||
BSTR bstrBaseUrl;
|
||||
hres = IHTMLDocument2_get_URL(HTMLDOC(This->node.doc), &bstrBaseUrl);
|
||||
if(SUCCEEDED(hres)) {
|
||||
hres = CoInternetCombineUrl(bstrBaseUrl, value,
|
||||
URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO,
|
||||
buffer, sizeof(buffer)/sizeof(WCHAR), &len, 0);
|
||||
SysFreeString(bstrBaseUrl);
|
||||
if(SUCCEEDED(hres)) {
|
||||
V_VT(AttributeValue) = VT_BSTR;
|
||||
V_BSTR(AttributeValue) = SysAllocString(buffer);
|
||||
TRACE("attr_value=%s\n", debugstr_w(V_BSTR(AttributeValue)));
|
||||
}
|
||||
}
|
||||
}else if(*value) {
|
||||
V_VT(AttributeValue) = VT_BSTR;
|
||||
V_BSTR(AttributeValue) = SysAllocString(value);
|
||||
TRACE("attr_value=%s\n", debugstr_w(V_BSTR(AttributeValue)));
|
||||
}
|
||||
}else {
|
||||
ERR("GetAttribute failed: %08x\n", nsres);
|
||||
hres = E_FAIL;
|
||||
if(FAILED(hres)) {
|
||||
V_VT(AttributeValue) = VT_NULL;
|
||||
return hres;
|
||||
}
|
||||
|
||||
nsAString_Finish(&value_str);
|
||||
hres = IDispatchEx_InvokeEx(DISPATCHEX(&This->node.dispex), dispid,
|
||||
LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, &dispParams,
|
||||
AttributeValue, &excep, NULL);
|
||||
|
||||
return hres;
|
||||
}
|
||||
|
@ -431,15 +382,19 @@ static HRESULT WINAPI HTMLElement_get_onclick(IHTMLElement *iface, VARIANT *p)
|
|||
static HRESULT WINAPI HTMLElement_put_ondblclick(IHTMLElement *iface, VARIANT v)
|
||||
{
|
||||
HTMLElement *This = HTMLELEM_THIS(iface);
|
||||
FIXME("(%p)->()\n", This);
|
||||
return E_NOTIMPL;
|
||||
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
|
||||
return set_node_event(&This->node, EVENTID_DBLCLICK, &v);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLElement_get_ondblclick(IHTMLElement *iface, VARIANT *p)
|
||||
{
|
||||
HTMLElement *This = HTMLELEM_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
return get_node_event(&This->node, EVENTID_DBLCLICK, p);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLElement_put_onkeydown(IHTMLElement *iface, VARIANT v)
|
||||
|
@ -585,7 +540,7 @@ static HRESULT WINAPI HTMLElement_get_document(IHTMLElement *iface, IDispatch **
|
|||
if(!p)
|
||||
return E_POINTER;
|
||||
|
||||
*p = (IDispatch*)HTMLDOC(This->node.doc);
|
||||
*p = (IDispatch*)HTMLDOC(&This->node.doc->basedoc);
|
||||
IDispatch_AddRef(*p);
|
||||
|
||||
return S_OK;
|
||||
|
@ -895,7 +850,7 @@ static HRESULT WINAPI HTMLElement_put_innerText(IHTMLElement *iface, BSTR v)
|
|||
}
|
||||
|
||||
nsAString_Init(&text_str, v);
|
||||
nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &text_str, &text_node);
|
||||
nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->basedoc.nsdoc, &text_str, &text_node);
|
||||
nsAString_Finish(&text_str);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("CreateTextNode failed: %08x\n", nsres);
|
||||
|
@ -1051,12 +1006,12 @@ static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR w
|
|||
|
||||
TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(html));
|
||||
|
||||
if(!This->node.doc->nsdoc) {
|
||||
if(!This->node.doc->basedoc.nsdoc) {
|
||||
WARN("NULL nsdoc\n");
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsres = nsIDOMDocument_QueryInterface(This->node.doc->nsdoc, &IID_nsIDOMDocumentRange, (void **)&nsdocrange);
|
||||
nsres = nsIDOMDocument_QueryInterface(This->node.doc->basedoc.nsdoc, &IID_nsIDOMDocumentRange, (void **)&nsdocrange);
|
||||
if(NS_FAILED(nsres))
|
||||
{
|
||||
ERR("getting nsIDOMDocumentRange failed: %08x\n", nsres);
|
||||
|
@ -1109,14 +1064,14 @@ static HRESULT WINAPI HTMLElement_insertAdjacentText(IHTMLElement *iface, BSTR w
|
|||
|
||||
TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(text));
|
||||
|
||||
if(!This->node.doc->nsdoc) {
|
||||
if(!This->node.doc->basedoc.nsdoc) {
|
||||
WARN("NULL nsdoc\n");
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
|
||||
nsAString_Init(&ns_text, text);
|
||||
nsres = nsIDOMDocument_CreateTextNode(This->node.doc->nsdoc, &ns_text, (nsIDOMText **)&nsnode);
|
||||
nsres = nsIDOMDocument_CreateTextNode(This->node.doc->basedoc.nsdoc, &ns_text, (nsIDOMText **)&nsnode);
|
||||
nsAString_Finish(&ns_text);
|
||||
|
||||
if(NS_FAILED(nsres) || !nsnode)
|
||||
|
@ -1503,7 +1458,7 @@ static dispex_static_data_t HTMLElement_dispex = {
|
|||
HTMLElement_iface_tids
|
||||
};
|
||||
|
||||
void HTMLElement_Init(HTMLElement *This)
|
||||
void HTMLElement_Init(HTMLElement *This, dispex_static_data_t *dispex_data)
|
||||
{
|
||||
This->lpHTMLElementVtbl = &HTMLElementVtbl;
|
||||
|
||||
|
@ -1512,11 +1467,10 @@ void HTMLElement_Init(HTMLElement *This)
|
|||
HTMLElement2_Init(This);
|
||||
HTMLElement3_Init(This);
|
||||
|
||||
if(!This->node.dispex.data)
|
||||
init_dispex(&This->node.dispex, (IUnknown*)HTMLELEM(This), &HTMLElement_dispex);
|
||||
init_dispex(&This->node.dispex, (IUnknown*)HTMLELEM(This), dispex_data ? dispex_data : &HTMLElement_dispex);
|
||||
}
|
||||
|
||||
HTMLElement *HTMLElement_Create(HTMLDocument *doc, nsIDOMNode *nsnode, BOOL use_generic)
|
||||
HTMLElement *HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_generic)
|
||||
{
|
||||
nsIDOMHTMLElement *nselem;
|
||||
HTMLElement *ret = NULL;
|
||||
|
@ -1572,7 +1526,7 @@ HTMLElement *HTMLElement_Create(HTMLDocument *doc, nsIDOMNode *nsnode, BOOL use_
|
|||
|
||||
if(!ret) {
|
||||
ret = heap_alloc_zero(sizeof(HTMLElement));
|
||||
HTMLElement_Init(ret);
|
||||
HTMLElement_Init(ret, NULL);
|
||||
ret->node.vtbl = &HTMLElementImplVtbl;
|
||||
}
|
||||
|
||||
|
|
|
@ -590,23 +590,59 @@ static HRESULT WINAPI HTMLElement2_get_clientWidth(IHTMLElement2 *iface, LONG *p
|
|||
static HRESULT WINAPI HTMLElement2_get_clientTop(IHTMLElement2 *iface, LONG *p)
|
||||
{
|
||||
HTMLElement *This = HTMLELEM2_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
nsIDOMNSElement *nselem;
|
||||
PRInt32 client_top = 0;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsres = nsIDOMNSElement_GetClientTop(nselem, &client_top);
|
||||
nsIDOMNSElement_Release(nselem);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("GetScrollHeight failed: %08x\n", nsres);
|
||||
}else {
|
||||
ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
|
||||
}
|
||||
|
||||
*p = client_top;
|
||||
TRACE("*p = %d\n", *p);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLElement2_get_clientLeft(IHTMLElement2 *iface, LONG *p)
|
||||
{
|
||||
HTMLElement *This = HTMLELEM2_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
nsIDOMNSElement *nselem;
|
||||
PRInt32 client_left = 0;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsres = nsIDOMNSElement_GetClientLeft(nselem, &client_left);
|
||||
nsIDOMNSElement_Release(nselem);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("GetScrollHeight failed: %08x\n", nsres);
|
||||
}else {
|
||||
ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
|
||||
}
|
||||
|
||||
*p = client_left;
|
||||
TRACE("*p = %d\n", *p);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLElement2_attachEvent(IHTMLElement2 *iface, BSTR event,
|
||||
IDispatch *pDisp, VARIANT_BOOL *pfResult)
|
||||
{
|
||||
HTMLElement *This = HTMLELEM2_THIS(iface);
|
||||
FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
|
||||
|
||||
return attach_event(get_node_event_target(&This->node), &This->node.doc->basedoc, event, pDisp, pfResult);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLElement2_detachEvent(IHTMLElement2 *iface, BSTR event, IDispatch *pDisp)
|
||||
|
@ -626,15 +662,19 @@ static HRESULT WINAPI HTMLElement2_get_readyState(IHTMLElement2 *iface, VARIANT
|
|||
static HRESULT WINAPI HTMLElement2_put_onreadystatechange(IHTMLElement2 *iface, VARIANT v)
|
||||
{
|
||||
HTMLElement *This = HTMLELEM2_THIS(iface);
|
||||
FIXME("(%p)->()\n", This);
|
||||
return E_NOTIMPL;
|
||||
|
||||
FIXME("(%p)->(%s): semi-stub\n", This, debugstr_variant(&v));
|
||||
|
||||
return set_node_event(&This->node, EVENTID_READYSTATECHANGE, &v);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLElement2_get_onreadystatechange(IHTMLElement2 *iface, VARIANT *p)
|
||||
{
|
||||
HTMLElement *This = HTMLELEM2_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
return get_node_event(&This->node, EVENTID_READYSTATECHANGE, p);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLElement2_put_onrowsdelete(IHTMLElement2 *iface, VARIANT v)
|
||||
|
@ -733,7 +773,7 @@ static HRESULT WINAPI HTMLElement2_get_scrollHeight(IHTMLElement2 *iface, LONG *
|
|||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
|
||||
nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsres = nsIDOMNSElement_GetScrollHeight(nselem, &height);
|
||||
nsIDOMNSElement_Release(nselem);
|
||||
|
@ -743,7 +783,7 @@ static HRESULT WINAPI HTMLElement2_get_scrollHeight(IHTMLElement2 *iface, LONG *
|
|||
ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
|
||||
}
|
||||
|
||||
*p = height == -1 ? 0 : height;
|
||||
*p = height;
|
||||
TRACE("*p = %d\n", *p);
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -445,7 +445,7 @@ static dispex_static_data_t HTMLElementCollection_dispex = {
|
|||
HTMLElementCollection_iface_tids
|
||||
};
|
||||
|
||||
static void create_all_list(HTMLDocument *doc, HTMLDOMNode *elem, elem_vector_t *buf)
|
||||
static void create_all_list(HTMLDocumentNode *doc, HTMLDOMNode *elem, elem_vector_t *buf)
|
||||
{
|
||||
nsIDOMNodeList *nsnode_list;
|
||||
nsIDOMNode *iter;
|
||||
|
@ -492,7 +492,7 @@ IHTMLElementCollection *create_all_collection(HTMLDOMNode *node, BOOL include_ro
|
|||
return HTMLElementCollection_Create((IUnknown*)HTMLDOMNODE(node), buf.buf, buf.len);
|
||||
}
|
||||
|
||||
IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument *doc, IUnknown *unk, nsIDOMNodeList *nslist)
|
||||
IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode *doc, IUnknown *unk, nsIDOMNodeList *nslist)
|
||||
{
|
||||
PRUint32 length = 0, i;
|
||||
elem_vector_t buf;
|
||||
|
@ -521,7 +521,7 @@ IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument *doc, IUnkn
|
|||
return HTMLElementCollection_Create(unk, buf.buf, buf.len);
|
||||
}
|
||||
|
||||
IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocument *doc, IUnknown *unk, nsIDOMHTMLCollection *nscol)
|
||||
IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode *doc, IUnknown *unk, nsIDOMHTMLCollection *nscol)
|
||||
{
|
||||
PRUint32 length = 0, i;
|
||||
elem_vector_t buf;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2008 Jacek Caban for CodeWeavers
|
||||
* Copyright 2008-2009 Jacek Caban for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -32,10 +32,19 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
||||
|
||||
typedef struct {
|
||||
IDispatch *handler_prop;
|
||||
DWORD handler_cnt;
|
||||
IDispatch *handlers[0];
|
||||
} handler_vector_t;
|
||||
|
||||
struct event_target_t {
|
||||
IDispatch *event_table[EVENTID_LAST];
|
||||
handler_vector_t *event_table[EVENTID_LAST];
|
||||
};
|
||||
|
||||
static const WCHAR beforeunloadW[] = {'b','e','f','o','r','e','u','n','l','o','a','d',0};
|
||||
static const WCHAR onbeforeunloadW[] = {'o','n','b','e','f','o','r','e','u','n','l','o','a','d',0};
|
||||
|
||||
static const WCHAR blurW[] = {'b','l','u','r',0};
|
||||
static const WCHAR onblurW[] = {'o','n','b','l','u','r',0};
|
||||
|
||||
|
@ -45,6 +54,9 @@ static const WCHAR onchangeW[] = {'o','n','c','h','a','n','g','e',0};
|
|||
static const WCHAR clickW[] = {'c','l','i','c','k',0};
|
||||
static const WCHAR onclickW[] = {'o','n','c','l','i','c','k',0};
|
||||
|
||||
static const WCHAR dblclickW[] = {'d','b','l','c','l','i','c','k',0};
|
||||
static const WCHAR ondblclickW[] = {'o','n','d','b','l','c','l','i','c','k',0};
|
||||
|
||||
static const WCHAR dragW[] = {'d','r','a','g',0};
|
||||
static const WCHAR ondragW[] = {'o','n','d','r','a','g',0};
|
||||
|
||||
|
@ -78,6 +90,9 @@ static const WCHAR onmouseupW[] = {'o','n','m','o','u','s','e','u','p',0};
|
|||
static const WCHAR pasteW[] = {'p','a','s','t','e',0};
|
||||
static const WCHAR onpasteW[] = {'o','n','p','a','s','t','e',0};
|
||||
|
||||
static const WCHAR readystatechangeW[] = {'r','e','a','d','y','s','t','a','t','e','c','h','a','n','g','e',0};
|
||||
static const WCHAR onreadystatechangeW[] = {'o','n','r','e','a','d','y','s','t','a','t','e','c','h','a','n','g','e',0};
|
||||
|
||||
static const WCHAR selectstartW[] = {'s','e','l','e','c','t','s','t','a','r','t',0};
|
||||
static const WCHAR onselectstartW[] = {'o','n','s','e','l','e','c','t','s','t','a','r','t',0};
|
||||
|
||||
|
@ -89,23 +104,27 @@ typedef struct {
|
|||
|
||||
#define EVENT_DEFAULTLISTENER 0x0001
|
||||
#define EVENT_BUBBLE 0x0002
|
||||
#define EVENT_FORWARDBODY 0x0004
|
||||
|
||||
static const event_info_t event_info[] = {
|
||||
{blurW, onblurW, EVENT_DEFAULTLISTENER},
|
||||
{changeW, onchangeW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{clickW, onclickW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{dragW, ondragW, 0},
|
||||
{dragstartW, ondragstartW, 0},
|
||||
{focusW, onfocusW, EVENT_DEFAULTLISTENER},
|
||||
{keydownW, onkeydownW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{keyupW, onkeyupW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{loadW, onloadW, 0},
|
||||
{mousedownW, onmousedownW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{mouseoutW, onmouseoutW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{mouseoverW, onmouseoverW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{mouseupW, onmouseupW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{pasteW, onpasteW, 0},
|
||||
{selectstartW, onselectstartW, 0}
|
||||
{beforeunloadW, onbeforeunloadW, EVENT_DEFAULTLISTENER|EVENT_FORWARDBODY},
|
||||
{blurW, onblurW, EVENT_DEFAULTLISTENER},
|
||||
{changeW, onchangeW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{clickW, onclickW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{dblclickW, ondblclickW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{dragW, ondragW, 0},
|
||||
{dragstartW, ondragstartW, 0},
|
||||
{focusW, onfocusW, EVENT_DEFAULTLISTENER},
|
||||
{keydownW, onkeydownW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{keyupW, onkeyupW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{loadW, onloadW, 0},
|
||||
{mousedownW, onmousedownW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{mouseoutW, onmouseoutW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{mouseoverW, onmouseoverW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{mouseupW, onmouseupW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
|
||||
{pasteW, onpasteW, 0},
|
||||
{readystatechangeW, onreadystatechangeW, 0},
|
||||
{selectstartW, onselectstartW, 0}
|
||||
};
|
||||
|
||||
eventid_t str_to_eid(LPCWSTR str)
|
||||
|
@ -121,6 +140,18 @@ eventid_t str_to_eid(LPCWSTR str)
|
|||
return EVENTID_LAST;
|
||||
}
|
||||
|
||||
static eventid_t attr_to_eid(LPCWSTR str)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; i < sizeof(event_info)/sizeof(event_info[0]); i++) {
|
||||
if(!strcmpW(event_info[i].attr_name, str))
|
||||
return i;
|
||||
}
|
||||
|
||||
return EVENTID_LAST;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
DispatchEx dispex;
|
||||
const IHTMLEventObjVtbl *lpIHTMLEventObjVtbl;
|
||||
|
@ -128,6 +159,8 @@ typedef struct {
|
|||
LONG ref;
|
||||
|
||||
HTMLDOMNode *target;
|
||||
const event_info_t *type;
|
||||
nsIDOMEvent *nsevent;
|
||||
} HTMLEventObj;
|
||||
|
||||
#define HTMLEVENTOBJ(x) ((IHTMLEventObj*) &(x)->lpIHTMLEventObjVtbl)
|
||||
|
@ -177,6 +210,8 @@ static ULONG WINAPI HTMLEventObj_Release(IHTMLEventObj *iface)
|
|||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
|
||||
if(!ref) {
|
||||
if(This->nsevent)
|
||||
nsIDOMEvent_Release(This->nsevent);
|
||||
release_dispex(&This->dispex);
|
||||
heap_free(This);
|
||||
}
|
||||
|
@ -231,22 +266,91 @@ static HRESULT WINAPI HTMLEventObj_get_srcElement(IHTMLEventObj *iface, IHTMLEle
|
|||
static HRESULT WINAPI HTMLEventObj_get_altKey(IHTMLEventObj *iface, VARIANT_BOOL *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
PRBool ret = FALSE;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(This->nsevent) {
|
||||
nsIDOMKeyEvent *key_event;
|
||||
nsresult nsres;
|
||||
|
||||
nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMKeyEvent, (void**)&key_event);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsIDOMKeyEvent_GetAltKey(key_event, &ret);
|
||||
nsIDOMKeyEvent_Release(key_event);
|
||||
}else {
|
||||
nsIDOMMouseEvent *mouse_event;
|
||||
|
||||
nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsIDOMMouseEvent_GetAltKey(mouse_event, &ret);
|
||||
nsIDOMMouseEvent_Release(mouse_event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*p = ret ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_ctrlKey(IHTMLEventObj *iface, VARIANT_BOOL *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
PRBool ret = FALSE;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(This->nsevent) {
|
||||
nsIDOMKeyEvent *key_event;
|
||||
nsresult nsres;
|
||||
|
||||
nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMKeyEvent, (void**)&key_event);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsIDOMKeyEvent_GetCtrlKey(key_event, &ret);
|
||||
nsIDOMKeyEvent_Release(key_event);
|
||||
}else {
|
||||
nsIDOMMouseEvent *mouse_event;
|
||||
|
||||
nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsIDOMMouseEvent_GetCtrlKey(mouse_event, &ret);
|
||||
nsIDOMMouseEvent_Release(mouse_event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*p = ret ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_shiftKey(IHTMLEventObj *iface, VARIANT_BOOL *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
PRBool ret = FALSE;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(This->nsevent) {
|
||||
nsIDOMKeyEvent *key_event;
|
||||
nsresult nsres;
|
||||
|
||||
nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMKeyEvent, (void**)&key_event);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsIDOMKeyEvent_GetShiftKey(key_event, &ret);
|
||||
nsIDOMKeyEvent_Release(key_event);
|
||||
}else {
|
||||
nsIDOMMouseEvent *mouse_event;
|
||||
|
||||
nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsIDOMMouseEvent_GetShiftKey(mouse_event, &ret);
|
||||
nsIDOMMouseEvent_Release(mouse_event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*p = ret ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_put_returnValue(IHTMLEventObj *iface, VARIANT v)
|
||||
|
@ -259,8 +363,11 @@ static HRESULT WINAPI HTMLEventObj_put_returnValue(IHTMLEventObj *iface, VARIANT
|
|||
static HRESULT WINAPI HTMLEventObj_get_returnValue(IHTMLEventObj *iface, VARIANT *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
V_VT(p) = VT_EMPTY;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_put_cancelBubble(IHTMLEventObj *iface, VARIANT_BOOL v)
|
||||
|
@ -273,22 +380,31 @@ static HRESULT WINAPI HTMLEventObj_put_cancelBubble(IHTMLEventObj *iface, VARIAN
|
|||
static HRESULT WINAPI HTMLEventObj_get_cancelBubble(IHTMLEventObj *iface, VARIANT_BOOL *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
*p = VARIANT_FALSE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_fromElement(IHTMLEventObj *iface, IHTMLElement **p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
*p = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_toElement(IHTMLEventObj *iface, IHTMLElement **p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
*p = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_put_keyCode(IHTMLEventObj *iface, LONG v)
|
||||
|
@ -301,99 +417,213 @@ static HRESULT WINAPI HTMLEventObj_put_keyCode(IHTMLEventObj *iface, LONG v)
|
|||
static HRESULT WINAPI HTMLEventObj_get_keyCode(IHTMLEventObj *iface, LONG *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
PRUint32 key_code = 0;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(This->nsevent) {
|
||||
nsIDOMKeyEvent *key_event;
|
||||
nsresult nsres;
|
||||
|
||||
nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMKeyEvent, (void**)&key_event);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsIDOMKeyEvent_GetKeyCode(key_event, &key_code);
|
||||
nsIDOMKeyEvent_Release(key_event);
|
||||
}
|
||||
}
|
||||
|
||||
*p = key_code;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_button(IHTMLEventObj *iface, LONG *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
PRUint16 button = 0;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(This->nsevent) {
|
||||
nsIDOMMouseEvent *mouse_event;
|
||||
nsresult nsres;
|
||||
|
||||
nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsIDOMMouseEvent_GetButton(mouse_event, &button);
|
||||
nsIDOMMouseEvent_Release(mouse_event);
|
||||
}
|
||||
}
|
||||
|
||||
*p = button;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_type(IHTMLEventObj *iface, BSTR *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
*p = SysAllocString(This->type->name);
|
||||
return *p ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_qualifier(IHTMLEventObj *iface, BSTR *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
*p = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_reason(IHTMLEventObj *iface, LONG *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
*p = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_x(IHTMLEventObj *iface, LONG *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
*p = -1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_y(IHTMLEventObj *iface, LONG *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
*p = -1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_clientX(IHTMLEventObj *iface, LONG *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
PRInt32 x = 0;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(This->nsevent) {
|
||||
nsIDOMMouseEvent *mouse_event;
|
||||
nsresult nsres;
|
||||
|
||||
nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsIDOMMouseEvent_GetClientX(mouse_event, &x);
|
||||
nsIDOMMouseEvent_Release(mouse_event);
|
||||
}
|
||||
}
|
||||
|
||||
*p = x;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_clientY(IHTMLEventObj *iface, LONG *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
PRInt32 y = 0;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(This->nsevent) {
|
||||
nsIDOMMouseEvent *mouse_event;
|
||||
nsresult nsres;
|
||||
|
||||
nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsIDOMMouseEvent_GetClientY(mouse_event, &y);
|
||||
nsIDOMMouseEvent_Release(mouse_event);
|
||||
}
|
||||
}
|
||||
|
||||
*p = y;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_offsetX(IHTMLEventObj *iface, LONG *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
*p = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_offsetY(IHTMLEventObj *iface, LONG *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
*p = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_screenX(IHTMLEventObj *iface, LONG *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
PRInt32 x = 0;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(This->nsevent) {
|
||||
nsIDOMMouseEvent *mouse_event;
|
||||
nsresult nsres;
|
||||
|
||||
nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsIDOMMouseEvent_GetScreenX(mouse_event, &x);
|
||||
nsIDOMMouseEvent_Release(mouse_event);
|
||||
}
|
||||
}
|
||||
|
||||
*p = x;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_screenY(IHTMLEventObj *iface, LONG *p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
PRInt32 y = 0;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(This->nsevent) {
|
||||
nsIDOMMouseEvent *mouse_event;
|
||||
nsresult nsres;
|
||||
|
||||
nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsIDOMMouseEvent_GetScreenY(mouse_event, &y);
|
||||
nsIDOMMouseEvent_Release(mouse_event);
|
||||
}
|
||||
}
|
||||
|
||||
*p = y;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLEventObj_get_srcFilter(IHTMLEventObj *iface, IDispatch **p)
|
||||
{
|
||||
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
|
||||
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
*p = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#undef HTMLEVENTOBJ_THIS
|
||||
|
@ -445,104 +675,198 @@ static dispex_static_data_t HTMLEventObj_dispex = {
|
|||
HTMLEventObj_iface_tids
|
||||
};
|
||||
|
||||
static IHTMLEventObj *create_event(HTMLDOMNode *target)
|
||||
static IHTMLEventObj *create_event(HTMLDOMNode *target, eventid_t eid, nsIDOMEvent *nsevent)
|
||||
{
|
||||
HTMLEventObj *ret;
|
||||
|
||||
ret = heap_alloc(sizeof(*ret));
|
||||
ret->lpIHTMLEventObjVtbl = &HTMLEventObjVtbl;
|
||||
ret->ref = 1;
|
||||
ret->type = event_info+eid;
|
||||
ret->target = target;
|
||||
IHTMLDOMNode_AddRef(HTMLDOMNODE(target));
|
||||
|
||||
ret->nsevent = nsevent;
|
||||
if(nsevent)
|
||||
nsIDOMEvent_AddRef(nsevent);
|
||||
|
||||
init_dispex(&ret->dispex, (IUnknown*)HTMLEVENTOBJ(ret), &HTMLEventObj_dispex);
|
||||
|
||||
return HTMLEVENTOBJ(ret);
|
||||
}
|
||||
|
||||
void fire_event(HTMLDocument *doc, eventid_t eid, nsIDOMNode *target)
|
||||
static void call_event_handlers(HTMLDocumentNode *doc, IHTMLEventObj *event_obj, event_target_t *event_target,
|
||||
eventid_t eid, IDispatch *this_obj)
|
||||
{
|
||||
handler_vector_t *handler_vector;
|
||||
DWORD i;
|
||||
HRESULT hres;
|
||||
|
||||
if(!event_target || !(handler_vector = event_target->event_table[eid]))
|
||||
return;
|
||||
|
||||
if(handler_vector->handler_prop) {
|
||||
DISPID named_arg = DISPID_THIS;
|
||||
VARIANTARG arg;
|
||||
DISPPARAMS dp = {&arg, &named_arg, 1, 1};
|
||||
|
||||
V_VT(&arg) = VT_DISPATCH;
|
||||
V_DISPATCH(&arg) = this_obj;
|
||||
|
||||
TRACE("%s >>>\n", debugstr_w(event_info[eid].name));
|
||||
hres = call_disp_func(handler_vector->handler_prop, &dp);
|
||||
if(hres == S_OK)
|
||||
TRACE("%s <<<\n", debugstr_w(event_info[eid].name));
|
||||
else
|
||||
WARN("%s <<< %08x\n", debugstr_w(event_info[eid].name), hres);
|
||||
}
|
||||
|
||||
if(handler_vector->handler_cnt) {
|
||||
VARIANTARG arg;
|
||||
DISPPARAMS dp = {&arg, NULL, 1, 0};
|
||||
|
||||
V_VT(&arg) = VT_DISPATCH;
|
||||
V_DISPATCH(&arg) = (IDispatch*)event_obj;
|
||||
|
||||
for(i=0; i < handler_vector->handler_cnt; i++) {
|
||||
if(handler_vector->handlers[i]) {
|
||||
TRACE("%s [%d] >>>\n", debugstr_w(event_info[eid].name), i);
|
||||
hres = call_disp_func(handler_vector->handlers[i], &dp);
|
||||
if(hres == S_OK)
|
||||
TRACE("%s [%d] <<<\n", debugstr_w(event_info[eid].name), i);
|
||||
else
|
||||
WARN("%s [%d] <<< %08x\n", debugstr_w(event_info[eid].name), i, hres);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fire_event(HTMLDocumentNode *doc, eventid_t eid, nsIDOMNode *target, nsIDOMEvent *nsevent)
|
||||
{
|
||||
IHTMLEventObj *prev_event, *event_obj = NULL;
|
||||
nsIDOMNode *parent, *nsnode;
|
||||
HTMLDOMNode *node;
|
||||
PRUint16 node_type;
|
||||
|
||||
nsIDOMNode_GetNodeType(target, &node_type);
|
||||
if(node_type != ELEMENT_NODE) {
|
||||
FIXME("node type %d node supported\n", node_type);
|
||||
return;
|
||||
}
|
||||
TRACE("(%p) %s\n", doc, debugstr_w(event_info[eid].name));
|
||||
|
||||
prev_event = doc->window->event;
|
||||
prev_event = doc->basedoc.window->event;
|
||||
event_obj = doc->basedoc.window->event = create_event(get_node(doc, target, TRUE), eid, nsevent);
|
||||
|
||||
nsIDOMNode_GetNodeType(target, &node_type);
|
||||
nsnode = target;
|
||||
nsIDOMNode_AddRef(nsnode);
|
||||
|
||||
while(1) {
|
||||
node = get_node(doc, nsnode, FALSE);
|
||||
switch(node_type) {
|
||||
case ELEMENT_NODE:
|
||||
do {
|
||||
node = get_node(doc, nsnode, FALSE);
|
||||
if(node)
|
||||
call_event_handlers(doc, event_obj, *get_node_event_target(node), eid, (IDispatch*)HTMLDOMNODE(node));
|
||||
|
||||
if(node && node->event_target && node->event_target->event_table[eid]) {
|
||||
if(!event_obj)
|
||||
event_obj = doc->window->event = create_event(get_node(doc, target, TRUE));
|
||||
if(!(event_info[eid].flags & EVENT_BUBBLE))
|
||||
break;
|
||||
|
||||
TRACE("%s >>>\n", debugstr_w(event_info[eid].name));
|
||||
call_disp_func(doc, node->event_target->event_table[eid], (IDispatch*)HTMLDOMNODE(node));
|
||||
TRACE("%s <<<\n", debugstr_w(event_info[eid].name));
|
||||
}
|
||||
nsIDOMNode_GetParentNode(nsnode, &parent);
|
||||
nsIDOMNode_Release(nsnode);
|
||||
nsnode = parent;
|
||||
if(!nsnode)
|
||||
break;
|
||||
|
||||
nsIDOMNode_GetNodeType(nsnode, &node_type);
|
||||
}while(node_type == ELEMENT_NODE);
|
||||
|
||||
if(!(event_info[eid].flags & EVENT_BUBBLE))
|
||||
break;
|
||||
|
||||
nsIDOMNode_GetParentNode(nsnode, &parent);
|
||||
nsIDOMNode_Release(nsnode);
|
||||
nsnode = parent;
|
||||
if(!nsnode)
|
||||
break;
|
||||
case DOCUMENT_NODE:
|
||||
if(event_info[eid].flags & EVENT_FORWARDBODY) {
|
||||
nsIDOMHTMLElement *nsbody;
|
||||
nsresult nsres;
|
||||
|
||||
nsIDOMNode_GetNodeType(nsnode, &node_type);
|
||||
if(node_type != ELEMENT_NODE)
|
||||
break;
|
||||
nsres = nsIDOMHTMLDocument_GetBody(doc->basedoc.nsdoc, &nsbody);
|
||||
if(NS_SUCCEEDED(nsres) && nsbody) {
|
||||
node = get_node(doc, (nsIDOMNode*)nsbody, FALSE);
|
||||
if(node)
|
||||
call_event_handlers(doc, event_obj, *get_node_event_target(node), eid, (IDispatch*)HTMLDOMNODE(node));
|
||||
nsIDOMHTMLElement_Release(nsbody);
|
||||
}else {
|
||||
ERR("Could not get body: %08x\n", nsres);
|
||||
}
|
||||
}
|
||||
|
||||
call_event_handlers(doc, event_obj, doc->basedoc.doc_node->node.event_target, eid,
|
||||
(IDispatch*)HTMLDOC(&doc->basedoc));
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("unimplemented node type %d\n", node_type);
|
||||
}
|
||||
|
||||
if(nsnode)
|
||||
nsIDOMNode_Release(nsnode);
|
||||
|
||||
if((event_info[eid].flags & EVENT_BUBBLE) && doc->event_target && doc->event_target->event_table[eid]) {
|
||||
if(!event_obj)
|
||||
event_obj = doc->window->event = create_event(get_node(doc, target, TRUE));
|
||||
|
||||
TRACE("doc %s >>>\n", debugstr_w(event_info[eid].name));
|
||||
call_disp_func(doc, doc->event_target->event_table[eid], (IDispatch*)HTMLDOC(doc));
|
||||
TRACE("doc %s <<<\n", debugstr_w(event_info[eid].name));
|
||||
}
|
||||
|
||||
if(event_obj) {
|
||||
IHTMLEventObj_Release(event_obj);
|
||||
doc->window->event = prev_event;
|
||||
}
|
||||
IHTMLEventObj_Release(event_obj);
|
||||
doc->basedoc.window->event = prev_event;
|
||||
}
|
||||
|
||||
static HRESULT set_event_handler_disp(event_target_t **event_target, HTMLDocument *doc, eventid_t eid, IDispatch *disp)
|
||||
static inline event_target_t *get_event_target(event_target_t **event_target_ptr)
|
||||
{
|
||||
if(!*event_target)
|
||||
*event_target = heap_alloc_zero(sizeof(event_target_t));
|
||||
else if((*event_target)->event_table[eid])
|
||||
IDispatch_Release((*event_target)->event_table[eid]);
|
||||
if(!*event_target_ptr)
|
||||
*event_target_ptr = heap_alloc_zero(sizeof(event_target_t));
|
||||
return *event_target_ptr;
|
||||
}
|
||||
|
||||
(*event_target)->event_table[eid] = disp;
|
||||
static BOOL alloc_handler_vector(event_target_t *event_target, eventid_t eid, int cnt)
|
||||
{
|
||||
handler_vector_t *new_vector, *handler_vector = event_target->event_table[eid];
|
||||
|
||||
if(handler_vector) {
|
||||
if(cnt <= handler_vector->handler_cnt)
|
||||
return TRUE;
|
||||
|
||||
new_vector = heap_realloc_zero(handler_vector, sizeof(handler_vector_t) + sizeof(IDispatch*)*cnt);
|
||||
}else {
|
||||
new_vector = heap_alloc_zero(sizeof(handler_vector_t) + sizeof(IDispatch*)*cnt);
|
||||
}
|
||||
|
||||
if(!new_vector)
|
||||
return FALSE;
|
||||
|
||||
new_vector->handler_cnt = cnt;
|
||||
event_target->event_table[eid] = new_vector;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static HRESULT set_event_handler_disp(event_target_t **event_target_ptr, HTMLWindow *window, eventid_t eid, IDispatch *disp)
|
||||
{
|
||||
event_target_t *event_target;
|
||||
|
||||
event_target = get_event_target(event_target_ptr);
|
||||
if(!event_target)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if(!alloc_handler_vector(event_target, eid, 0))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if(event_target->event_table[eid]->handler_prop)
|
||||
IDispatch_Release(event_target->event_table[eid]->handler_prop);
|
||||
|
||||
event_target->event_table[eid]->handler_prop = disp;
|
||||
if(!disp)
|
||||
return S_OK;
|
||||
IDispatch_AddRef(disp);
|
||||
|
||||
if(doc->nscontainer && (event_info[eid].flags & EVENT_DEFAULTLISTENER)) {
|
||||
if(!doc->nscontainer->event_vector) {
|
||||
doc->nscontainer->event_vector = heap_alloc_zero(EVENTID_LAST*sizeof(BOOL));
|
||||
if(!doc->nscontainer->event_vector)
|
||||
if(window->nswindow && (event_info[eid].flags & EVENT_DEFAULTLISTENER)) {
|
||||
if(!window->event_vector) {
|
||||
window->event_vector = heap_alloc_zero(EVENTID_LAST*sizeof(BOOL));
|
||||
if(!window->event_vector)
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
if(!doc->nscontainer->event_vector[eid]) {
|
||||
doc->nscontainer->event_vector[eid] = TRUE;
|
||||
add_nsevent_listener(doc->nscontainer, event_info[eid].name);
|
||||
if(!window->event_vector[eid]) {
|
||||
window->event_vector[eid] = TRUE;
|
||||
add_nsevent_listener(window, event_info[eid].name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -553,14 +877,14 @@ HRESULT set_event_handler(event_target_t **event_target, HTMLDocument *doc, even
|
|||
{
|
||||
switch(V_VT(var)) {
|
||||
case VT_NULL:
|
||||
if(*event_target && (*event_target)->event_table[eid]) {
|
||||
IDispatch_Release((*event_target)->event_table[eid]);
|
||||
(*event_target)->event_table[eid] = NULL;
|
||||
if(*event_target && (*event_target)->event_table[eid] && (*event_target)->event_table[eid]->handler_prop) {
|
||||
IDispatch_Release((*event_target)->event_table[eid]->handler_prop);
|
||||
(*event_target)->event_table[eid]->handler_prop = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case VT_DISPATCH:
|
||||
return set_event_handler_disp(event_target, doc, eid, V_DISPATCH(var));
|
||||
return set_event_handler_disp(event_target, doc->window, eid, V_DISPATCH(var));
|
||||
|
||||
default:
|
||||
FIXME("not supported vt=%d\n", V_VT(var));
|
||||
|
@ -572,9 +896,9 @@ HRESULT set_event_handler(event_target_t **event_target, HTMLDocument *doc, even
|
|||
|
||||
HRESULT get_event_handler(event_target_t **event_target, eventid_t eid, VARIANT *var)
|
||||
{
|
||||
if(*event_target && (*event_target)->event_table[eid]) {
|
||||
if(*event_target && (*event_target)->event_table[eid] && (*event_target)->event_table[eid]->handler_prop) {
|
||||
V_VT(var) = VT_DISPATCH;
|
||||
V_DISPATCH(var) = (*event_target)->event_table[eid];
|
||||
V_DISPATCH(var) = (*event_target)->event_table[eid]->handler_prop;
|
||||
IDispatch_AddRef(V_DISPATCH(var));
|
||||
}else {
|
||||
V_VT(var) = VT_NULL;
|
||||
|
@ -583,7 +907,40 @@ HRESULT get_event_handler(event_target_t **event_target, eventid_t eid, VARIANT
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
void check_event_attr(HTMLDocument *doc, nsIDOMElement *nselem)
|
||||
HRESULT attach_event(event_target_t **event_target_ptr, HTMLDocument *doc, BSTR name, IDispatch *disp, VARIANT_BOOL *res)
|
||||
{
|
||||
event_target_t *event_target;
|
||||
eventid_t eid;
|
||||
DWORD i = 0;
|
||||
|
||||
eid = attr_to_eid(name);
|
||||
if(eid == EVENTID_LAST) {
|
||||
WARN("Unknown event\n");
|
||||
*res = VARIANT_TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
event_target = get_event_target(event_target_ptr);
|
||||
if(!event_target)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if(event_target->event_table[eid]) {
|
||||
while(i < event_target->event_table[eid]->handler_cnt && event_target->event_table[eid]->handlers[i])
|
||||
i++;
|
||||
if(i == event_target->event_table[eid]->handler_cnt && !alloc_handler_vector(event_target, eid, i+1))
|
||||
return E_OUTOFMEMORY;
|
||||
}else if(!alloc_handler_vector(event_target, eid, i+1)) {
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
IDispatch_AddRef(disp);
|
||||
event_target->event_table[eid]->handlers[i] = disp;
|
||||
|
||||
*res = VARIANT_TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void check_event_attr(HTMLDocumentNode *doc, nsIDOMElement *nselem)
|
||||
{
|
||||
const PRUnichar *attr_value;
|
||||
nsAString attr_name_str, attr_value_str;
|
||||
|
@ -605,10 +962,10 @@ void check_event_attr(HTMLDocument *doc, nsIDOMElement *nselem)
|
|||
|
||||
TRACE("%p.%s = %s\n", nselem, debugstr_w(event_info[i].attr_name), debugstr_w(attr_value));
|
||||
|
||||
disp = script_parse_event(doc, attr_value);
|
||||
disp = script_parse_event(doc->basedoc.window, attr_value);
|
||||
if(disp) {
|
||||
node = get_node(doc, (nsIDOMNode*)nselem, TRUE);
|
||||
set_event_handler_disp(&node->event_target, node->doc, i, disp);
|
||||
set_event_handler_disp(get_node_event_target(node), node->doc->basedoc.window, i, disp);
|
||||
IDispatch_Release(disp);
|
||||
}
|
||||
}
|
||||
|
@ -620,11 +977,15 @@ void check_event_attr(HTMLDocument *doc, nsIDOMElement *nselem)
|
|||
|
||||
void release_event_target(event_target_t *event_target)
|
||||
{
|
||||
int i;
|
||||
int i, j;
|
||||
|
||||
for(i=0; i < EVENTID_LAST; i++) {
|
||||
if(event_target->event_table[i])
|
||||
IDispatch_Release(event_target->event_table[i]);
|
||||
if(event_target->event_table[i]) {
|
||||
if(event_target->event_table[i]->handler_prop)
|
||||
IDispatch_Release(event_target->event_table[i]->handler_prop);
|
||||
for(j=0; j < event_target->event_table[i]->handler_cnt; j++)
|
||||
IDispatch_Release(event_target->event_table[i]->handlers[j]);
|
||||
}
|
||||
}
|
||||
|
||||
heap_free(event_target);
|
||||
|
|
|
@ -17,9 +17,11 @@
|
|||
*/
|
||||
|
||||
typedef enum {
|
||||
EVENTID_BEFOREUNLOAD,
|
||||
EVENTID_BLUR,
|
||||
EVENTID_CHANGE,
|
||||
EVENTID_CLICK,
|
||||
EVENTID_DBLCLICK,
|
||||
EVENTID_DRAG,
|
||||
EVENTID_DRAGSTART,
|
||||
EVENTID_FOCUS,
|
||||
|
@ -31,33 +33,50 @@ typedef enum {
|
|||
EVENTID_MOUSEOVER,
|
||||
EVENTID_MOUSEUP,
|
||||
EVENTID_PASTE,
|
||||
EVENTID_READYSTATECHANGE,
|
||||
EVENTID_SELECTSTART,
|
||||
EVENTID_LAST
|
||||
} eventid_t;
|
||||
|
||||
eventid_t str_to_eid(LPCWSTR);
|
||||
void check_event_attr(HTMLDocument*,nsIDOMElement*);
|
||||
void check_event_attr(HTMLDocumentNode*,nsIDOMElement*);
|
||||
void release_event_target(event_target_t*);
|
||||
void fire_event(HTMLDocument*,eventid_t,nsIDOMNode*);
|
||||
void fire_event(HTMLDocumentNode*,eventid_t,nsIDOMNode*,nsIDOMEvent*);
|
||||
HRESULT set_event_handler(event_target_t**,HTMLDocument*,eventid_t,VARIANT*);
|
||||
HRESULT get_event_handler(event_target_t**,eventid_t,VARIANT*);
|
||||
HRESULT attach_event(event_target_t**,HTMLDocument*,BSTR,IDispatch*,VARIANT_BOOL*);
|
||||
|
||||
static inline event_target_t **get_node_event_target(HTMLDOMNode *node)
|
||||
{
|
||||
return node->vtbl->get_event_target ? node->vtbl->get_event_target(node) : &node->event_target;
|
||||
}
|
||||
|
||||
static inline HRESULT set_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
|
||||
{
|
||||
return set_event_handler(&node->event_target, node->doc, eid, var);
|
||||
return set_event_handler(get_node_event_target(node), &node->doc->basedoc, eid, var);
|
||||
}
|
||||
|
||||
static inline HRESULT get_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
|
||||
{
|
||||
return get_event_handler(&node->event_target, eid, var);
|
||||
return get_event_handler(get_node_event_target(node), eid, var);
|
||||
}
|
||||
|
||||
static inline HRESULT set_doc_event(HTMLDocument *doc, eventid_t eid, VARIANT *var)
|
||||
{
|
||||
return set_event_handler(&doc->event_target, doc, eid, var);
|
||||
return set_node_event(&doc->doc_node->node, eid, var);
|
||||
}
|
||||
|
||||
static inline HRESULT get_doc_event(HTMLDocument *doc, eventid_t eid, VARIANT *var)
|
||||
{
|
||||
return get_event_handler(&doc->event_target, eid, var);
|
||||
return get_node_event(&doc->doc_node->node, eid, var);
|
||||
}
|
||||
|
||||
static inline HRESULT set_window_event(HTMLWindow *window, eventid_t eid, VARIANT *var)
|
||||
{
|
||||
return set_event_handler(&window->event_target, &window->doc_obj->basedoc, eid, var);
|
||||
}
|
||||
|
||||
static inline HRESULT get_window_event(HTMLWindow *window, eventid_t eid, VARIANT *var)
|
||||
{
|
||||
return get_event_handler(&window->event_target, eid, var);
|
||||
}
|
||||
|
|
|
@ -178,8 +178,7 @@ HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement *nselem)
|
|||
ret->lpHTMLGenericElementVtbl = &HTMLGenericElementVtbl;
|
||||
ret->element.node.vtbl = &HTMLGenericElementImplVtbl;
|
||||
|
||||
init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLGENERIC(ret), &HTMLGenericElement_dispex);
|
||||
HTMLElement_Init(&ret->element);
|
||||
HTMLElement_Init(&ret->element, &HTMLGenericElement_dispex);
|
||||
|
||||
return &ret->element;
|
||||
}
|
||||
|
|
|
@ -38,11 +38,45 @@ typedef struct {
|
|||
LONG ref;
|
||||
|
||||
nsIDOMHTMLIFrameElement *nsiframe;
|
||||
HTMLDocument *content_doc;
|
||||
HTMLWindow *content_window;
|
||||
} HTMLIFrame;
|
||||
|
||||
#define HTMLFRAMEBASE2(x) (&(x)->lpIHTMLFrameBase2Vtbl)
|
||||
|
||||
static HRESULT create_content_window(HTMLIFrame *This, nsIDOMHTMLDocument *nsdoc, HTMLWindow **ret)
|
||||
{
|
||||
nsIDOMDocumentView *nsdocview;
|
||||
nsIDOMAbstractView *nsview;
|
||||
nsIDOMWindow *nswindow;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
||||
nsres = nsIDOMHTMLDocument_QueryInterface(nsdoc, &IID_nsIDOMDocumentView, (void**)&nsdocview);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("Could not get nsIDOMDocumentView: %08x\n", nsres);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
nsres = nsIDOMDocumentView_GetDefaultView(nsdocview, &nsview);
|
||||
nsIDOMDocumentView_Release(nsdocview);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("GetDefaultView failed: %08x\n", nsres);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
nsres = nsIDOMAbstractView_QueryInterface(nsview, &IID_nsIDOMWindow, (void**)&nswindow);
|
||||
nsIDOMAbstractView_Release(nsview);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("Coult not get nsIDOMWindow iface: %08x\n", nsres);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
hres = HTMLWindow_Create(This->element.node.doc->basedoc.doc_obj, nswindow, ret);
|
||||
|
||||
nsIDOMWindow_Release(nswindow);
|
||||
return hres;
|
||||
}
|
||||
|
||||
#define HTMLFRAMEBASE2_THIS(iface) DEFINE_THIS(HTMLIFrame, IHTMLFrameBase2, iface)
|
||||
|
||||
static HRESULT WINAPI HTMLIFrameBase2_QueryInterface(IHTMLFrameBase2 *iface, REFIID riid, void **ppv)
|
||||
|
@ -104,9 +138,11 @@ static HRESULT WINAPI HTMLIFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface,
|
|||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(!This->content_doc) {
|
||||
if(!This->content_window) {
|
||||
nsIDOMHTMLDocument *nshtmldoc;
|
||||
HTMLDocumentNode *content_doc;
|
||||
nsIDOMDocument *nsdoc;
|
||||
HTMLWindow *window;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
||||
|
@ -128,13 +164,28 @@ static HRESULT WINAPI HTMLIFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface,
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
hres = create_doc_from_nsdoc(nshtmldoc, &This->content_doc);
|
||||
hres = create_content_window(This, nshtmldoc, &window);
|
||||
if(FAILED(hres)) {
|
||||
nsIDOMHTMLDocument_Release(nshtmldoc);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
hres = create_doc_from_nsdoc(nshtmldoc, This->element.node.doc->basedoc.doc_obj, window, &content_doc);
|
||||
nsIDOMHTMLDocument_Release(nshtmldoc);
|
||||
if(SUCCEEDED(hres))
|
||||
window_set_docnode(window, content_doc);
|
||||
else
|
||||
IHTMLWindow2_Release(HTMLWINDOW2(window));
|
||||
htmldoc_release(&content_doc->basedoc);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
This->content_window = window;
|
||||
}
|
||||
|
||||
return IHTMLDocument2_get_parentWindow(HTMLDOC(This->content_doc), p);
|
||||
IHTMLWindow2_AddRef(HTMLWINDOW2(This->content_window));
|
||||
*p = HTMLWINDOW2(This->content_window);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLIFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v)
|
||||
|
@ -229,8 +280,8 @@ static void HTMLIFrame_destructor(HTMLDOMNode *iface)
|
|||
{
|
||||
HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
|
||||
|
||||
if(This->content_doc)
|
||||
IHTMLDocument2_Release(HTMLDOC(This->content_doc));
|
||||
if(This->content_window)
|
||||
IHTMLWindow2_Release(HTMLWINDOW2(This->content_window));
|
||||
if(This->nsiframe)
|
||||
nsIDOMHTMLIFrameElement_Release(This->nsiframe);
|
||||
|
||||
|
@ -271,8 +322,7 @@ HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement *nselem)
|
|||
ret->lpIHTMLFrameBase2Vtbl = &HTMLIFrameBase2Vtbl;
|
||||
ret->element.node.vtbl = &HTMLIFrameImplVtbl;
|
||||
|
||||
init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLFRAMEBASE2(ret), &HTMLIFrame_dispex);
|
||||
HTMLElement_Init(&ret->element);
|
||||
HTMLElement_Init(&ret->element, &HTMLIFrame_dispex);
|
||||
|
||||
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&ret->nsiframe);
|
||||
if(NS_FAILED(nsres))
|
||||
|
|
|
@ -295,7 +295,7 @@ static HRESULT WINAPI HTMLImgElement_get_src(IHTMLImgElement *iface, BSTR *p)
|
|||
}
|
||||
|
||||
nsAString_GetData(&src_str, &src);
|
||||
hres = nsuri_to_url(src, p);
|
||||
hres = nsuri_to_url(src, TRUE, p);
|
||||
nsAString_Finish(&src_str);
|
||||
|
||||
return hres;
|
||||
|
@ -607,8 +607,7 @@ HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement *nselem)
|
|||
if(NS_FAILED(nsres))
|
||||
ERR("Could not get nsIDOMHTMLImageElement: %08x\n", nsres);
|
||||
|
||||
init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLIMG(ret), &HTMLImgElement_dispex);
|
||||
HTMLElement_Init(&ret->element);
|
||||
HTMLElement_Init(&ret->element, &HTMLImgElement_dispex);
|
||||
|
||||
return &ret->element;
|
||||
}
|
||||
|
|
|
@ -506,15 +506,42 @@ static HRESULT WINAPI HTMLInputElement_get_alt(IHTMLInputElement *iface, BSTR *p
|
|||
static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
|
||||
{
|
||||
HTMLInputElement *This = HTMLINPUT_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
return E_NOTIMPL;
|
||||
nsAString nsstr;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
|
||||
nsAString_Init(&nsstr, v);
|
||||
nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
|
||||
nsAString_Finish(&nsstr);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("SetSrc failed: %08x\n", nsres);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p)
|
||||
{
|
||||
HTMLInputElement *This = HTMLINPUT_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
const PRUnichar *src;
|
||||
nsAString src_str;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
nsAString_Init(&src_str, NULL);
|
||||
nsres = nsIDOMHTMLInputElement_GetSrc(This->nsinput, &src_str);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("GetSrc failed: %08x\n", nsres);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
nsAString_GetData(&src_str, &src);
|
||||
hres = nsuri_to_url(src, FALSE, p);
|
||||
nsAString_Finish(&src_str);
|
||||
|
||||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLInputElement_put_lowsrc(IHTMLInputElement *iface, BSTR v)
|
||||
|
@ -1119,6 +1146,7 @@ static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOO
|
|||
static const NodeImplVtbl HTMLInputElementImplVtbl = {
|
||||
HTMLInputElement_QI,
|
||||
HTMLInputElement_destructor,
|
||||
NULL,
|
||||
HTMLInputElementImpl_put_disabled,
|
||||
HTMLInputElementImpl_get_disabled,
|
||||
};
|
||||
|
@ -1148,8 +1176,7 @@ HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement *nselem)
|
|||
ret->lpHTMLInputTextElementVtbl = &HTMLInputTextElementVtbl;
|
||||
ret->element.node.vtbl = &HTMLInputElementImplVtbl;
|
||||
|
||||
init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLINPUT(ret), &HTMLInputElement_dispex);
|
||||
HTMLElement_Init(&ret->element);
|
||||
HTMLElement_Init(&ret->element, &HTMLInputElement_dispex);
|
||||
|
||||
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement,
|
||||
(void**)&ret->nsinput);
|
||||
|
|
|
@ -35,6 +35,18 @@
|
|||
|
||||
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->url) {
|
||||
FIXME("No current URL\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
*ret = This->window->doc_obj->url;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
#define HTMLLOCATION_THIS(iface) DEFINE_THIS(HTMLLocation, HTMLLocation, iface)
|
||||
|
||||
static HRESULT WINAPI HTMLLocation_QueryInterface(IHTMLLocation *iface, REFIID riid, void **ppv)
|
||||
|
@ -80,8 +92,8 @@ static ULONG WINAPI HTMLLocation_Release(IHTMLLocation *iface)
|
|||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
|
||||
if(!ref) {
|
||||
if(This->doc && This->doc->location == This)
|
||||
This->doc->location = NULL;
|
||||
if(This->window)
|
||||
This->window->location = NULL;
|
||||
release_dispex(&This->dispex);
|
||||
heap_free(This);
|
||||
}
|
||||
|
@ -129,20 +141,20 @@ static HRESULT WINAPI HTMLLocation_put_href(IHTMLLocation *iface, BSTR v)
|
|||
static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p)
|
||||
{
|
||||
HTMLLocation *This = HTMLLOCATION_THIS(iface);
|
||||
const WCHAR *url;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(!p)
|
||||
return E_POINTER;
|
||||
|
||||
if(!This->doc || !This->doc->url) {
|
||||
FIXME("No current URL\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
hres = get_url(This, &url);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
*p = SysAllocString(This->doc->url);
|
||||
|
||||
return S_OK;
|
||||
*p = SysAllocString(url);
|
||||
return *p ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLLocation_put_protocol(IHTMLLocation *iface, BSTR v)
|
||||
|
@ -156,6 +168,10 @@ static HRESULT WINAPI HTMLLocation_get_protocol(IHTMLLocation *iface, BSTR *p)
|
|||
{
|
||||
HTMLLocation *This = HTMLLOCATION_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(!p)
|
||||
return E_POINTER;
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -170,6 +186,10 @@ static HRESULT WINAPI HTMLLocation_get_host(IHTMLLocation *iface, BSTR *p)
|
|||
{
|
||||
HTMLLocation *This = HTMLLOCATION_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(!p)
|
||||
return E_POINTER;
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -184,6 +204,10 @@ static HRESULT WINAPI HTMLLocation_get_hostname(IHTMLLocation *iface, BSTR *p)
|
|||
{
|
||||
HTMLLocation *This = HTMLLOCATION_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(!p)
|
||||
return E_POINTER;
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -198,6 +222,10 @@ static HRESULT WINAPI HTMLLocation_get_port(IHTMLLocation *iface, BSTR *p)
|
|||
{
|
||||
HTMLLocation *This = HTMLLOCATION_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(!p)
|
||||
return E_POINTER;
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -213,17 +241,20 @@ static HRESULT WINAPI HTMLLocation_get_pathname(IHTMLLocation *iface, BSTR *p)
|
|||
HTMLLocation *This = HTMLLOCATION_THIS(iface);
|
||||
WCHAR buf[INTERNET_MAX_PATH_LENGTH];
|
||||
URL_COMPONENTSW url = {sizeof(url)};
|
||||
const WCHAR *doc_url;
|
||||
DWORD size = 0;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(!This->doc || !This->doc->url) {
|
||||
FIXME("No current URL\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
if(!p)
|
||||
return E_POINTER;
|
||||
|
||||
hres = CoInternetParseUrl(This->doc->url, PARSE_PATH_FROM_URL, 0, buf, sizeof(buf), &size, 0);
|
||||
hres = get_url(This, &doc_url);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = CoInternetParseUrl(doc_url, PARSE_PATH_FROM_URL, 0, buf, sizeof(buf), &size, 0);
|
||||
if(SUCCEEDED(hres)) {
|
||||
*p = SysAllocString(buf);
|
||||
if(!*p)
|
||||
|
@ -232,7 +263,7 @@ static HRESULT WINAPI HTMLLocation_get_pathname(IHTMLLocation *iface, BSTR *p)
|
|||
}
|
||||
|
||||
url.dwUrlPathLength = 1;
|
||||
if(!InternetCrackUrlW(This->doc->url, 0, 0, &url)) {
|
||||
if(!InternetCrackUrlW(doc_url, 0, 0, &url)) {
|
||||
FIXME("InternetCrackUrl failed\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -259,6 +290,10 @@ static HRESULT WINAPI HTMLLocation_get_search(IHTMLLocation *iface, BSTR *p)
|
|||
{
|
||||
HTMLLocation *This = HTMLLOCATION_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(!p)
|
||||
return E_POINTER;
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -273,6 +308,10 @@ static HRESULT WINAPI HTMLLocation_get_hash(IHTMLLocation *iface, BSTR *p)
|
|||
{
|
||||
HTMLLocation *This = HTMLLOCATION_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(!p)
|
||||
return E_POINTER;
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -304,34 +343,6 @@ static HRESULT WINAPI HTMLLocation_toString(IHTMLLocation *iface, BSTR *String)
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT HTMLLocation_value(IUnknown *iface, LCID lcid, WORD flags, DISPPARAMS *params,
|
||||
VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
|
||||
{
|
||||
HTMLLocation *This = HTMLLOCATION_THIS(iface);
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
switch(flags) {
|
||||
case DISPATCH_PROPERTYGET: {
|
||||
BSTR str;
|
||||
|
||||
hres = IHTMLLocation_get_href(HTMLLOCATION(This), &str);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
V_VT(res) = VT_BSTR;
|
||||
V_BSTR(res) = str;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
FIXME("unimplemented flags %x\n", flags);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#undef HTMLLOCATION_THIS
|
||||
|
||||
static const IHTMLLocationVtbl HTMLLocationVtbl = {
|
||||
|
@ -364,33 +375,32 @@ static const IHTMLLocationVtbl HTMLLocationVtbl = {
|
|||
HTMLLocation_toString
|
||||
};
|
||||
|
||||
static const dispex_static_data_vtbl_t HTMLLocation_dispex_vtbl = {
|
||||
HTMLLocation_value,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const tid_t HTMLLocation_iface_tids[] = {
|
||||
IHTMLLocation_tid,
|
||||
0
|
||||
};
|
||||
static dispex_static_data_t HTMLLocation_dispex = {
|
||||
&HTMLLocation_dispex_vtbl,
|
||||
NULL,
|
||||
DispHTMLLocation_tid,
|
||||
NULL,
|
||||
HTMLLocation_iface_tids
|
||||
};
|
||||
|
||||
|
||||
HTMLLocation *HTMLLocation_Create(HTMLDocument *doc)
|
||||
HRESULT HTMLLocation_Create(HTMLWindow *window, HTMLLocation **ret)
|
||||
{
|
||||
HTMLLocation *ret = heap_alloc(sizeof(*ret));
|
||||
HTMLLocation *location;
|
||||
|
||||
ret->lpHTMLLocationVtbl = &HTMLLocationVtbl;
|
||||
ret->ref = 1;
|
||||
ret->doc = doc;
|
||||
location = heap_alloc(sizeof(*location));
|
||||
if(!location)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
init_dispex(&ret->dispex, (IUnknown*)HTMLLOCATION(ret), &HTMLLocation_dispex);
|
||||
location->lpHTMLLocationVtbl = &HTMLLocationVtbl;
|
||||
location->ref = 1;
|
||||
location->window = window;
|
||||
|
||||
return ret;
|
||||
init_dispex(&location->dispex, (IUnknown*)HTMLLOCATION(location), &HTMLLocation_dispex);
|
||||
|
||||
*ret = location;
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
||||
|
||||
static HTMLDOMNode *get_node_obj(HTMLDocument*,IUnknown*);
|
||||
static HTMLDOMNode *get_node_obj(HTMLDocumentNode*,IUnknown*);
|
||||
|
||||
typedef struct {
|
||||
DispatchEx dispex;
|
||||
|
@ -41,7 +41,7 @@ typedef struct {
|
|||
LONG ref;
|
||||
|
||||
/* FIXME: implement weak reference */
|
||||
HTMLDocument *doc;
|
||||
HTMLDocumentNode *doc;
|
||||
|
||||
nsIDOMNodeList *nslist;
|
||||
} HTMLDOMChildrenCollection;
|
||||
|
@ -262,7 +262,7 @@ static dispex_static_data_t HTMLDOMChildrenCollection_dispex = {
|
|||
HTMLDOMChildrenCollection_iface_tids
|
||||
};
|
||||
|
||||
static IHTMLDOMChildrenCollection *create_child_collection(HTMLDocument *doc, nsIDOMNodeList *nslist)
|
||||
static IHTMLDOMChildrenCollection *create_child_collection(HTMLDocumentNode *doc, nsIDOMNodeList *nslist)
|
||||
{
|
||||
HTMLDOMChildrenCollection *ret;
|
||||
|
||||
|
@ -536,8 +536,22 @@ static HRESULT WINAPI HTMLDOMNode_cloneNode(IHTMLDOMNode *iface, VARIANT_BOOL fD
|
|||
IHTMLDOMNode **clonedNode)
|
||||
{
|
||||
HTMLDOMNode *This = HTMLDOMNODE_THIS(iface);
|
||||
FIXME("(%p)->(%x %p)\n", This, fDeep, clonedNode);
|
||||
return E_NOTIMPL;
|
||||
nsIDOMNode *nsnode;
|
||||
HTMLDOMNode *node;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%x %p)\n", This, fDeep, clonedNode);
|
||||
|
||||
nsres = nsIDOMNode_CloneNode(This->nsnode, fDeep != VARIANT_FALSE, &nsnode);
|
||||
if(NS_FAILED(nsres) || !nsnode) {
|
||||
ERR("CloneNode failed: %08x\n", nsres);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
node = get_node(This->doc, nsnode, TRUE);
|
||||
IHTMLDOMNode_AddRef(HTMLDOMNODE(node));
|
||||
*clonedNode = HTMLDOMNODE(node);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLDOMNode_removeNode(IHTMLDOMNode *iface, VARIANT_BOOL fDeep,
|
||||
|
@ -808,8 +822,12 @@ static HRESULT WINAPI HTMLDOMNode2_Invoke(IHTMLDOMNode2 *iface, DISPID dispIdMem
|
|||
static HRESULT WINAPI HTMLDOMNode2_get_ownerDocument(IHTMLDOMNode2 *iface, IDispatch **p)
|
||||
{
|
||||
HTMLDOMNode *This = HTMLDOMNODE2_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
*p = (IDispatch*)HTMLDOC(&This->doc->basedoc);
|
||||
IDispatch_AddRef(*p);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#undef HTMLDOMNODE2_THIS
|
||||
|
@ -875,7 +893,7 @@ static const NodeImplVtbl HTMLDOMNodeImplVtbl = {
|
|||
HTMLDOMNode_destructor
|
||||
};
|
||||
|
||||
void HTMLDOMNode_Init(HTMLDocument *doc, HTMLDOMNode *node, nsIDOMNode *nsnode)
|
||||
void HTMLDOMNode_Init(HTMLDocumentNode *doc, HTMLDOMNode *node, nsIDOMNode *nsnode)
|
||||
{
|
||||
node->lpHTMLDOMNodeVtbl = &HTMLDOMNodeVtbl;
|
||||
node->lpHTMLDOMNode2Vtbl = &HTMLDOMNode2Vtbl;
|
||||
|
@ -889,7 +907,7 @@ void HTMLDOMNode_Init(HTMLDocument *doc, HTMLDOMNode *node, nsIDOMNode *nsnode)
|
|||
doc->nodes = node;
|
||||
}
|
||||
|
||||
static HTMLDOMNode *create_node(HTMLDocument *doc, nsIDOMNode *nsnode)
|
||||
static HTMLDOMNode *create_node(HTMLDocumentNode *doc, nsIDOMNode *nsnode)
|
||||
{
|
||||
HTMLDOMNode *ret;
|
||||
PRUint16 node_type;
|
||||
|
@ -923,7 +941,7 @@ static HTMLDOMNode *create_node(HTMLDocument *doc, nsIDOMNode *nsnode)
|
|||
* (better) find a way to store HTMLDOMelement pointer in nsIDOMNode.
|
||||
*/
|
||||
|
||||
HTMLDOMNode *get_node(HTMLDocument *This, nsIDOMNode *nsnode, BOOL create)
|
||||
HTMLDOMNode *get_node(HTMLDocumentNode *This, nsIDOMNode *nsnode, BOOL create)
|
||||
{
|
||||
HTMLDOMNode *iter = This->nodes;
|
||||
|
||||
|
@ -944,7 +962,7 @@ HTMLDOMNode *get_node(HTMLDocument *This, nsIDOMNode *nsnode, BOOL create)
|
|||
* We should use better way for getting node object (like private interface)
|
||||
* or avoid it at all.
|
||||
*/
|
||||
static HTMLDOMNode *get_node_obj(HTMLDocument *This, IUnknown *iface)
|
||||
static HTMLDOMNode *get_node_obj(HTMLDocumentNode *This, IUnknown *iface)
|
||||
{
|
||||
HTMLDOMNode *iter = This->nodes;
|
||||
IHTMLDOMNode *node;
|
||||
|
@ -962,7 +980,7 @@ static HTMLDOMNode *get_node_obj(HTMLDocument *This, IUnknown *iface)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void release_nodes(HTMLDocument *This)
|
||||
void release_nodes(HTMLDocumentNode *This)
|
||||
{
|
||||
HTMLDOMNode *iter, *next;
|
||||
|
||||
|
@ -972,6 +990,7 @@ void release_nodes(HTMLDocument *This)
|
|||
for(iter = This->nodes; iter; iter = next) {
|
||||
next = iter->next;
|
||||
iter->doc = NULL;
|
||||
IHTMLDOMNode_Release(HTMLDOMNODE(iter));
|
||||
if(&This->node != iter)
|
||||
IHTMLDOMNode_Release(HTMLDOMNODE(iter));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
|
|||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
|
||||
if(!This->element.node.doc->nsdoc) {
|
||||
if(!This->element.node.doc->basedoc.nsdoc) {
|
||||
WARN("NULL nsdoc\n");
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
|
|||
}
|
||||
|
||||
nsAString_Init(&text_str, v);
|
||||
nsres = nsIDOMHTMLDocument_CreateTextNode(This->element.node.doc->nsdoc, &text_str, &text_node);
|
||||
nsres = nsIDOMHTMLDocument_CreateTextNode(This->element.node.doc->basedoc.nsdoc, &text_str, &text_node);
|
||||
nsAString_Finish(&text_str);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("CreateTextNode failed: %08x\n", nsres);
|
||||
|
@ -347,8 +347,7 @@ HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement *nselem)
|
|||
ret->lpHTMLOptionElementVtbl = &HTMLOptionElementVtbl;
|
||||
ret->element.node.vtbl = &HTMLOptionElementImplVtbl;
|
||||
|
||||
HTMLElement_Init(&ret->element);
|
||||
init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLOPTION(ret), &HTMLOptionElement_dispex);
|
||||
HTMLElement_Init(&ret->element, &HTMLOptionElement_dispex);
|
||||
|
||||
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLOptionElement, (void**)&ret->nsoption);
|
||||
if(NS_FAILED(nsres))
|
||||
|
@ -459,7 +458,7 @@ 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->doc->nsdoc) {
|
||||
if(!This->window || !This->window->doc || !This->window->doc->basedoc.nsdoc) {
|
||||
WARN("NULL nsdoc\n");
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
@ -467,14 +466,14 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory
|
|||
*optelem = NULL;
|
||||
|
||||
nsAString_Init(&option_str, optionW);
|
||||
nsres = nsIDOMHTMLDocument_CreateElement(This->doc->nsdoc, &option_str, &nselem);
|
||||
nsres = nsIDOMHTMLDocument_CreateElement(This->window->doc->basedoc.nsdoc, &option_str, &nselem);
|
||||
nsAString_Finish(&option_str);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("CreateElement failed: %08x\n", nsres);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
hres = IHTMLDOMNode_QueryInterface(HTMLDOMNODE(get_node(This->doc, (nsIDOMNode*)nselem, TRUE)),
|
||||
hres = IHTMLDOMNode_QueryInterface(HTMLDOMNODE(get_node(This->window->doc, (nsIDOMNode*)nselem, TRUE)),
|
||||
&IID_IHTMLOptionElement, (void**)optelem);
|
||||
nsIDOMElement_Release(nselem);
|
||||
|
||||
|
@ -509,7 +508,7 @@ static const IHTMLOptionElementFactoryVtbl HTMLOptionElementFactoryVtbl = {
|
|||
HTMLOptionElementFactory_create
|
||||
};
|
||||
|
||||
HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument *doc)
|
||||
HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow *window)
|
||||
{
|
||||
HTMLOptionElementFactory *ret;
|
||||
|
||||
|
@ -517,7 +516,7 @@ HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument *doc)
|
|||
|
||||
ret->lpHTMLOptionElementFactoryVtbl = &HTMLOptionElementFactoryVtbl;
|
||||
ret->ref = 1;
|
||||
ret->doc = doc;
|
||||
ret->window = window;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -311,11 +311,11 @@ HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement *nselem)
|
|||
HTMLScriptElement *ret = heap_alloc_zero(sizeof(HTMLScriptElement));
|
||||
nsresult nsres;
|
||||
|
||||
HTMLElement_Init(&ret->element);
|
||||
|
||||
ret->lpHTMLScriptElementVtbl = &HTMLScriptElementVtbl;
|
||||
ret->element.node.vtbl = &HTMLScriptElementImplVtbl;
|
||||
|
||||
HTMLElement_Init(&ret->element, NULL);
|
||||
|
||||
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLScriptElement, (void**)&ret->nsscript);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("Could not get nsIDOMHTMLScriptElement: %08x\n", nsres);
|
||||
|
|
|
@ -480,6 +480,7 @@ static HRESULT HTMLSelectElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BO
|
|||
static const NodeImplVtbl HTMLSelectElementImplVtbl = {
|
||||
HTMLSelectElement_QI,
|
||||
HTMLSelectElement_destructor,
|
||||
NULL,
|
||||
HTMLSelectElementImpl_put_disabled,
|
||||
HTMLSelectElementImpl_get_disabled
|
||||
};
|
||||
|
@ -509,8 +510,7 @@ HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement *nselem)
|
|||
ret->lpHTMLSelectElementVtbl = &HTMLSelectElementVtbl;
|
||||
ret->element.node.vtbl = &HTMLSelectElementImplVtbl;
|
||||
|
||||
init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLSELECT(ret), &HTMLSelectElement_dispex);
|
||||
HTMLElement_Init(&ret->element);
|
||||
HTMLElement_Init(&ret->element, &HTMLSelectElement_dispex);
|
||||
|
||||
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLSelectElement,
|
||||
(void**)&ret->nsselect);
|
||||
|
|
|
@ -49,6 +49,8 @@ static const WCHAR attrBackgroundRepeat[] =
|
|||
{'b','a','c','k','g','r','o','u','n','d','-','r','e','p','e','a','t',0};
|
||||
static const WCHAR attrBorder[] =
|
||||
{'b','o','r','d','e','r',0};
|
||||
static const WCHAR attrBorderBottomColor[] =
|
||||
{'b','o','r','d','e','r','-','b','o','t','t','o','m','-','c','o','l','o','r',0};
|
||||
static const WCHAR attrBorderBottomStyle[] =
|
||||
{'b','o','r','d','e','r','-','b','o','t','t','o','m','-','s','t','y','l','e',0};
|
||||
static const WCHAR attrBorderBottomWidth[] =
|
||||
|
@ -57,14 +59,20 @@ static const WCHAR attrBorderColor[] =
|
|||
{'b','o','r','d','e','r','-','c','o','l','o','r',0};
|
||||
static const WCHAR attrBorderLeft[] =
|
||||
{'b','o','r','d','e','r','-','l','e','f','t',0};
|
||||
static const WCHAR attrBorderLeftColor[] =
|
||||
{'b','o','r','d','e','r','-','l','e','f','t','-','c','o','l','o','r',0};
|
||||
static const WCHAR attrBorderLeftStyle[] =
|
||||
{'b','o','r','d','e','r','-','l','e','f','t','-','s','t','y','l','e',0};
|
||||
static const WCHAR attrBorderLeftWidth[] =
|
||||
{'b','o','r','d','e','r','-','l','e','f','t','-','w','i','d','t','h',0};
|
||||
static const WCHAR attrBorderRightColor[] =
|
||||
{'b','o','r','d','e','r','-','r','i','g','h','t','-','c','o','l','o','r',0};
|
||||
static const WCHAR attrBorderRightStyle[] =
|
||||
{'b','o','r','d','e','r','-','r','i','g','h','t','-','s','t','y','l','e',0};
|
||||
static const WCHAR attrBorderRightWidth[] =
|
||||
{'b','o','r','d','e','r','-','r','i','g','h','t','-','w','i','d','t','h',0};
|
||||
static const WCHAR attrBorderTopColor[] =
|
||||
{'b','o','r','d','e','r','-','t','o','p','-','c','o','l','o','r',0};
|
||||
static const WCHAR attrBorderStyle[] =
|
||||
{'b','o','r','d','e','r','-','s','t','y','l','e',0};
|
||||
static const WCHAR attrBorderTopStyle[] =
|
||||
|
@ -73,6 +81,8 @@ static const WCHAR attrBorderTopWidth[] =
|
|||
{'b','o','r','d','e','r','-','t','o','p','-','w','i','d','t','h',0};
|
||||
static const WCHAR attrBorderWidth[] =
|
||||
{'b','o','r','d','e','r','-','w','i','d','t','h',0};
|
||||
static const WCHAR attrBottom[] =
|
||||
{'b','o','t','t','o','m',0};
|
||||
static const WCHAR attrColor[] =
|
||||
{'c','o','l','o','r',0};
|
||||
static const WCHAR attrCursor[] =
|
||||
|
@ -97,24 +107,40 @@ static const WCHAR attrLeft[] =
|
|||
{'l','e','f','t',0};
|
||||
static const WCHAR attrLetterSpacing[] =
|
||||
{'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0};
|
||||
static const WCHAR attrLineHeight[] =
|
||||
{'l','i','n','e','-','h','e','i','g','h','t',0};
|
||||
static const WCHAR attrMargin[] =
|
||||
{'m','a','r','g','i','n',0};
|
||||
static const WCHAR attrMarginBottom[] =
|
||||
{'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
|
||||
static const WCHAR attrMarginLeft[] =
|
||||
{'m','a','r','g','i','n','-','l','e','f','t',0};
|
||||
static const WCHAR attrMarginRight[] =
|
||||
{'m','a','r','g','i','n','-','r','i','g','h','t',0};
|
||||
static const WCHAR attrMarginTop[] =
|
||||
{'m','a','r','g','i','n','-','t','o','p',0};
|
||||
static const WCHAR attrMinHeight[] =
|
||||
{'m','i','n','-','h','e','i','g','h','t',0};
|
||||
static const WCHAR attrOverflow[] =
|
||||
{'o','v','e','r','f','l','o','w',0};
|
||||
static const WCHAR attrPaddingBottom[] =
|
||||
{'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
|
||||
static const WCHAR attrPaddingLeft[] =
|
||||
{'p','a','d','d','i','n','g','-','l','e','f','t',0};
|
||||
static const WCHAR attrPaddingRight[] =
|
||||
{'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
|
||||
static const WCHAR attrPaddingTop[] =
|
||||
{'p','a','d','d','i','n','g','-','t','o','p',0};
|
||||
static const WCHAR attrPosition[] =
|
||||
{'p','o','s','i','t','i','o','n',0};
|
||||
static const WCHAR attrRight[] =
|
||||
{'r','i','g','h','t',0};
|
||||
static const WCHAR attrTextAlign[] =
|
||||
{'t','e','x','t','-','a','l','i','g','n',0};
|
||||
static const WCHAR attrTextDecoration[] =
|
||||
{'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
|
||||
static const WCHAR attrTextIndent[] =
|
||||
{'t','e','x','t','-','i','n','d','e','n','t',0};
|
||||
static const WCHAR attrTop[] =
|
||||
{'t','o','p',0};
|
||||
static const WCHAR attrVerticalAlign[] =
|
||||
|
@ -141,18 +167,23 @@ static const struct{
|
|||
{attrBackgroundPositionY, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY},
|
||||
{attrBackgroundRepeat, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT},
|
||||
{attrBorder, DISPID_IHTMLSTYLE_BORDER},
|
||||
{attrBorderBottomColor, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR},
|
||||
{attrBorderBottomStyle, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE},
|
||||
{attrBorderBottomWidth, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH},
|
||||
{attrBorderColor, DISPID_IHTMLSTYLE_BORDERCOLOR},
|
||||
{attrBorderLeft, DISPID_IHTMLSTYLE_BORDERLEFT},
|
||||
{attrBorderLeftColor, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR},
|
||||
{attrBorderLeftStyle, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE},
|
||||
{attrBorderLeftWidth, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH},
|
||||
{attrBorderRightColor, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR},
|
||||
{attrBorderRightStyle, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE},
|
||||
{attrBorderRightWidth, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH},
|
||||
{attrBorderStyle, DISPID_IHTMLSTYLE_BORDERSTYLE},
|
||||
{attrBorderTopColor, DISPID_IHTMLSTYLE_BORDERTOPCOLOR},
|
||||
{attrBorderTopStyle, DISPID_IHTMLSTYLE_BORDERTOPSTYLE},
|
||||
{attrBorderTopWidth, DISPID_IHTMLSTYLE_BORDERTOPWIDTH},
|
||||
{attrBorderWidth, DISPID_IHTMLSTYLE_BORDERWIDTH},
|
||||
{attrBottom, DISPID_IHTMLSTYLE2_BOTTOM},
|
||||
{attrColor, DISPID_IHTMLSTYLE_COLOR},
|
||||
{attrCursor, DISPID_IHTMLSTYLE_CURSOR},
|
||||
{attrDisplay, DISPID_IHTMLSTYLE_DISPLAY},
|
||||
|
@ -165,15 +196,23 @@ static const struct{
|
|||
{attrHeight, DISPID_IHTMLSTYLE_HEIGHT},
|
||||
{attrLeft, DISPID_IHTMLSTYLE_LEFT},
|
||||
{attrLetterSpacing, DISPID_IHTMLSTYLE_LETTERSPACING},
|
||||
{attrLineHeight, DISPID_IHTMLSTYLE_LINEHEIGHT},
|
||||
{attrMargin, DISPID_IHTMLSTYLE_MARGIN},
|
||||
{attrMarginBottom, DISPID_IHTMLSTYLE_MARGINBOTTOM},
|
||||
{attrMarginLeft, DISPID_IHTMLSTYLE_MARGINLEFT},
|
||||
{attrMarginRight, DISPID_IHTMLSTYLE_MARGINRIGHT},
|
||||
{attrMarginTop, DISPID_IHTMLSTYLE_MARGINTOP},
|
||||
{attrMinHeight, DISPID_IHTMLSTYLE4_MINHEIGHT},
|
||||
{attrOverflow, DISPID_IHTMLSTYLE_OVERFLOW},
|
||||
{attrPaddingBottom, DISPID_IHTMLSTYLE_PADDINGBOTTOM},
|
||||
{attrPaddingLeft, DISPID_IHTMLSTYLE_PADDINGLEFT},
|
||||
{attrPaddingRight, DISPID_IHTMLSTYLE_PADDINGRIGHT},
|
||||
{attrPaddingTop, DISPID_IHTMLSTYLE_PADDINGTOP},
|
||||
{attrPosition, DISPID_IHTMLSTYLE2_POSITION},
|
||||
{attrRight, DISPID_IHTMLSTYLE2_RIGHT},
|
||||
{attrTextAlign, DISPID_IHTMLSTYLE_TEXTALIGN},
|
||||
{attrTextDecoration, DISPID_IHTMLSTYLE_TEXTDECORATION},
|
||||
{attrTextIndent, DISPID_IHTMLSTYLE_TEXTINDENT},
|
||||
{attrTop, DISPID_IHTMLSTYLE_TOP},
|
||||
{attrVerticalAlign, DISPID_IHTMLSTYLE_VERTICALALIGN},
|
||||
{attrVisibility, DISPID_IHTMLSTYLE_VISIBILITY},
|
||||
|
@ -292,6 +331,9 @@ HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid,
|
|||
case VT_BSTR:
|
||||
return set_nsstyle_attr(nsstyle, sid, V_BSTR(value), flags);
|
||||
|
||||
case VT_BSTR|VT_BYREF:
|
||||
return set_nsstyle_attr(nsstyle, sid, *V_BSTRREF(value), flags);
|
||||
|
||||
case VT_I4: {
|
||||
WCHAR str[14];
|
||||
static const WCHAR format[] = {'%','d',0};
|
||||
|
@ -2016,7 +2058,7 @@ static HRESULT WINAPI HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v)
|
|||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
|
||||
/* overflow can only be one of the follow values. */
|
||||
if(!v || strcmpiW(szVisible, v) == 0 || strcmpiW(szScroll, v) == 0 ||
|
||||
if(!v || !*v || strcmpiW(szVisible, v) == 0 || strcmpiW(szScroll, v) == 0 ||
|
||||
strcmpiW(szHidden, v) == 0 || strcmpiW(szAuto, v) == 0)
|
||||
{
|
||||
return set_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, v, 0);
|
||||
|
|
|
@ -42,18 +42,23 @@ typedef enum {
|
|||
STYLEID_BACKGROUND_POSITION_Y,
|
||||
STYLEID_BACKGROUND_REPEAT,
|
||||
STYLEID_BORDER,
|
||||
STYLEID_BORDER_BOTTOM_COLOR,
|
||||
STYLEID_BORDER_BOTTOM_STYLE,
|
||||
STYLEID_BORDER_BOTTOM_WIDTH,
|
||||
STYLEID_BORDER_COLOR,
|
||||
STYLEID_BORDER_LEFT,
|
||||
STYLEID_BORDER_LEFT_COLOR,
|
||||
STYLEID_BORDER_LEFT_STYLE,
|
||||
STYLEID_BORDER_LEFT_WIDTH,
|
||||
STYLEID_BORDER_RIGHT_COLOR,
|
||||
STYLEID_BORDER_RIGHT_STYLE,
|
||||
STYLEID_BORDER_RIGHT_WIDTH,
|
||||
STYLEID_BORDER_STYLE,
|
||||
STYLEID_BORDER_TOP_COLOR,
|
||||
STYLEID_BORDER_TOP_STYLE,
|
||||
STYLEID_BORDER_TOP_WIDTH,
|
||||
STYLEID_BORDER_WIDTH,
|
||||
STYLEID_BOTTOM,
|
||||
STYLEID_COLOR,
|
||||
STYLEID_CURSOR,
|
||||
STYLEID_DISPLAY,
|
||||
|
@ -66,15 +71,23 @@ typedef enum {
|
|||
STYLEID_HEIGHT,
|
||||
STYLEID_LEFT,
|
||||
STYLEID_LETTER_SPACING,
|
||||
STYLEID_LINE_HEIGHT,
|
||||
STYLEID_MARGIN,
|
||||
STYLEID_MARGIN_BOTTOM,
|
||||
STYLEID_MARGIN_LEFT,
|
||||
STYLEID_MARGIN_RIGHT,
|
||||
STYLEID_MARGIN_TOP,
|
||||
STYLEID_MIN_HEIGHT,
|
||||
STYLEID_OVERFLOW,
|
||||
STYLEID_PADDING_BOTTOM,
|
||||
STYLEID_PADDING_LEFT,
|
||||
STYLEID_PADDING_RIGHT,
|
||||
STYLEID_PADDING_TOP,
|
||||
STYLEID_POSITION,
|
||||
STYLEID_RIGHT,
|
||||
STYLEID_TEXT_ALIGN,
|
||||
STYLEID_TEXT_DECORATION,
|
||||
STYLEID_TEXT_INDENT,
|
||||
STYLEID_TOP,
|
||||
STYLEID_VERTICAL_ALIGN,
|
||||
STYLEID_VISIBILITY,
|
||||
|
|
|
@ -582,8 +582,7 @@ HTMLElement *HTMLTable_Create(nsIDOMHTMLElement *nselem)
|
|||
ret->element.node.vtbl = &HTMLTableImplVtbl;
|
||||
ret->lpHTMLTableVtbl = &HTMLTableVtbl;
|
||||
|
||||
init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLTABLE(ret), &HTMLTable_dispex);
|
||||
HTMLElement_Init(&ret->element);
|
||||
HTMLElement_Init(&ret->element, &HTMLTable_dispex);
|
||||
|
||||
ConnectionPoint_Init(&ret->cp, &ret->element.cp_container, &DIID_HTMLTableEvents);
|
||||
|
||||
|
|
|
@ -325,8 +325,7 @@ HTMLElement *HTMLTableRow_Create(nsIDOMHTMLElement *nselem)
|
|||
ret->lpHTMLTableRowVtbl = &HTMLTableRowVtbl;
|
||||
ret->element.node.vtbl = &HTMLTableRowImplVtbl;
|
||||
|
||||
init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLTABLEROW(ret), &HTMLTableRow_dispex);
|
||||
HTMLElement_Init(&ret->element);
|
||||
HTMLElement_Init(&ret->element, &HTMLTableRow_dispex);
|
||||
|
||||
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableRowElement, (void**)&ret->nsrow);
|
||||
if(NS_FAILED(nsres))
|
||||
|
|
|
@ -405,6 +405,7 @@ static HRESULT HTMLTextAreaElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_
|
|||
static const NodeImplVtbl HTMLTextAreaElementImplVtbl = {
|
||||
HTMLTextAreaElement_QI,
|
||||
HTMLTextAreaElement_destructor,
|
||||
NULL,
|
||||
HTMLTextAreaElementImpl_put_disabled,
|
||||
HTMLTextAreaElementImpl_get_disabled
|
||||
};
|
||||
|
@ -414,11 +415,11 @@ HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement *nselem)
|
|||
HTMLTextAreaElement *ret = heap_alloc_zero(sizeof(HTMLTextAreaElement));
|
||||
nsresult nsres;
|
||||
|
||||
HTMLElement_Init(&ret->element);
|
||||
|
||||
ret->lpHTMLTextAreaElementVtbl = &HTMLTextAreaElementVtbl;
|
||||
ret->element.node.vtbl = &HTMLTextAreaElementImplVtbl;
|
||||
|
||||
HTMLElement_Init(&ret->element, NULL);
|
||||
|
||||
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTextAreaElement,
|
||||
(void**)&ret->nstextarea);
|
||||
if(NS_FAILED(nsres))
|
||||
|
|
|
@ -182,11 +182,11 @@ static const IHTMLTextContainerVtbl HTMLTextContainerVtbl = {
|
|||
HTMLTextContainer_get_onscroll
|
||||
};
|
||||
|
||||
void HTMLTextContainer_Init(HTMLTextContainer *This)
|
||||
void HTMLTextContainer_Init(HTMLTextContainer *This, dispex_static_data_t *dispex_data)
|
||||
{
|
||||
HTMLElement_Init(&This->element);
|
||||
|
||||
This->lpHTMLTextContainerVtbl = &HTMLTextContainerVtbl;
|
||||
|
||||
HTMLElement_Init(&This->element, dispex_data);
|
||||
|
||||
ConnectionPoint_Init(&This->cp, &This->element.cp_container, &DIID_HTMLTextContainerEvents);
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ static dispex_static_data_t HTMLDOMTextNode_dispex = {
|
|||
HTMLDOMTextNode_iface_tids
|
||||
};
|
||||
|
||||
HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocument *doc, nsIDOMNode *nsnode)
|
||||
HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode)
|
||||
{
|
||||
HTMLDOMTextNode *ret ;
|
||||
|
||||
|
|
|
@ -29,12 +29,24 @@
|
|||
#include "wine/unicode.h"
|
||||
|
||||
#include "mshtml_private.h"
|
||||
#include "htmlevent.h"
|
||||
#include "resource.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
||||
|
||||
static struct list window_list = LIST_INIT(window_list);
|
||||
|
||||
void window_set_docnode(HTMLWindow *window, HTMLDocumentNode *doc_node)
|
||||
{
|
||||
if(window->doc) {
|
||||
window->doc->basedoc.window = NULL;
|
||||
htmldoc_release(&window->doc->basedoc);
|
||||
}
|
||||
window->doc = doc_node;
|
||||
if(doc_node)
|
||||
htmldoc_addref(&doc_node->basedoc);
|
||||
}
|
||||
|
||||
#define HTMLWINDOW2_THIS(iface) DEFINE_THIS(HTMLWindow, HTMLWindow2, iface)
|
||||
|
||||
static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID riid, void **ppv)
|
||||
|
@ -92,6 +104,27 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
|
|||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
|
||||
if(!ref) {
|
||||
DWORD i;
|
||||
|
||||
window_set_docnode(This, NULL);
|
||||
|
||||
if(This->option_factory) {
|
||||
This->option_factory->window = NULL;
|
||||
IHTMLOptionElementFactory_Release(HTMLOPTFACTORY(This->option_factory));
|
||||
}
|
||||
|
||||
if(This->location) {
|
||||
This->location->window = NULL;
|
||||
IHTMLLocation_Release(HTMLLOCATION(This->location));
|
||||
}
|
||||
|
||||
if(This->event_target)
|
||||
release_event_target(This->event_target);
|
||||
for(i=0; i < This->global_prop_cnt; i++)
|
||||
heap_free(This->global_props[i].name);
|
||||
heap_free(This->global_props);
|
||||
heap_free(This->event_vector);
|
||||
release_script_hosts(This);
|
||||
list_remove(&This->entry);
|
||||
release_dispex(&This->dispex);
|
||||
heap_free(This);
|
||||
|
@ -203,7 +236,7 @@ static HRESULT WINAPI HTMLWindow2_clearTimeout(IHTMLWindow2 *iface, LONG timerID
|
|||
|
||||
TRACE("(%p)->(%d)\n", This, timerID);
|
||||
|
||||
return clear_task_timer(This->doc, FALSE, timerID);
|
||||
return clear_task_timer(&This->doc->basedoc, FALSE, timerID);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLWindow2_alert(IHTMLWindow2 *iface, BSTR message)
|
||||
|
@ -219,7 +252,7 @@ static HRESULT WINAPI HTMLWindow2_alert(IHTMLWindow2 *iface, BSTR message)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
MessageBoxW(This->doc->hwnd, message, wszTitle, MB_ICONWARNING);
|
||||
MessageBoxW(This->doc_obj->hwnd, message, wszTitle, MB_ICONWARNING);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -240,7 +273,7 @@ static HRESULT WINAPI HTMLWindow2_confirm(IHTMLWindow2 *iface, BSTR message,
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
if(MessageBoxW(This->doc->hwnd, message, wszTitle,
|
||||
if(MessageBoxW(This->doc_obj->hwnd, message, wszTitle,
|
||||
MB_OKCANCEL|MB_ICONQUESTION)==IDOK)
|
||||
*confirmed = VARIANT_TRUE;
|
||||
else *confirmed = VARIANT_FALSE;
|
||||
|
@ -333,7 +366,7 @@ static HRESULT WINAPI HTMLWindow2_prompt(IHTMLWindow2 *iface, BSTR message,
|
|||
arg.textdata = textdata;
|
||||
|
||||
DialogBoxParamW(hInst, MAKEINTRESOURCEW(ID_PROMPT_DIALOG),
|
||||
This->doc->hwnd, prompt_dlgproc, (LPARAM)&arg);
|
||||
This->doc_obj->hwnd, prompt_dlgproc, (LPARAM)&arg);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -350,12 +383,18 @@ static HRESULT WINAPI HTMLWindow2_get_location(IHTMLWindow2 *iface, IHTMLLocatio
|
|||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(!This->doc) {
|
||||
FIXME("This->doc is NULL\n");
|
||||
return E_FAIL;
|
||||
if(This->location) {
|
||||
IHTMLLocation_AddRef(HTMLLOCATION(This->location));
|
||||
}else {
|
||||
HRESULT hres;
|
||||
|
||||
hres = HTMLLocation_Create(This, &This->location);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
}
|
||||
|
||||
return IHTMLDocument2_get_location(HTMLDOC(This->doc), p);
|
||||
*p = HTMLLOCATION(This->location);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLWindow2_get_history(IHTMLWindow2 *iface, IOmHistory **p)
|
||||
|
@ -495,29 +534,37 @@ static HRESULT WINAPI HTMLWindow2_get_onblur(IHTMLWindow2 *iface, VARIANT *p)
|
|||
static HRESULT WINAPI HTMLWindow2_put_onload(IHTMLWindow2 *iface, VARIANT v)
|
||||
{
|
||||
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
|
||||
FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
|
||||
return set_window_event(This, EVENTID_LOAD, &v);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLWindow2_get_onload(IHTMLWindow2 *iface, VARIANT *p)
|
||||
{
|
||||
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
return get_window_event(This, EVENTID_LOAD, p);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLWindow2_put_onbeforeunload(IHTMLWindow2 *iface, VARIANT v)
|
||||
{
|
||||
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
|
||||
FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(v(%d))\n", This, V_VT(&v));
|
||||
|
||||
return set_window_event(This, EVENTID_BEFOREUNLOAD, &v);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLWindow2_get_onbeforeunload(IHTMLWindow2 *iface, VARIANT *p)
|
||||
{
|
||||
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
return get_window_event(This, EVENTID_BEFOREUNLOAD, p);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLWindow2_put_onunload(IHTMLWindow2 *iface, VARIANT v)
|
||||
|
@ -598,7 +645,7 @@ static HRESULT WINAPI HTMLWindow2_get_document(IHTMLWindow2 *iface, IHTMLDocumen
|
|||
|
||||
if(This->doc) {
|
||||
/* FIXME: We should return a wrapper object here */
|
||||
*p = HTMLDOC(This->doc);
|
||||
*p = HTMLDOC(&This->doc->basedoc);
|
||||
IHTMLDocument2_AddRef(*p);
|
||||
}else {
|
||||
*p = NULL;
|
||||
|
@ -655,10 +702,10 @@ static HRESULT WINAPI HTMLWindow2_get_Option(IHTMLWindow2 *iface, IHTMLOptionEle
|
|||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(!This->doc->option_factory)
|
||||
This->doc->option_factory = HTMLOptionElementFactory_Create(This->doc);
|
||||
if(!This->option_factory)
|
||||
This->option_factory = HTMLOptionElementFactory_Create(This);
|
||||
|
||||
*p = HTMLOPTFACTORY(This->doc->option_factory);
|
||||
*p = HTMLOPTFACTORY(This->option_factory);
|
||||
IHTMLOptionElementFactory_AddRef(*p);
|
||||
|
||||
return S_OK;
|
||||
|
@ -718,7 +765,7 @@ static HRESULT WINAPI HTMLWindow2_clearInterval(IHTMLWindow2 *iface, LONG timerI
|
|||
|
||||
TRACE("(%p)->(%d)\n", This, timerID);
|
||||
|
||||
return clear_task_timer(This->doc, TRUE, timerID);
|
||||
return clear_task_timer(&This->doc->basedoc, TRUE, timerID);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLWindow2_put_offscreenBuffering(IHTMLWindow2 *iface, VARIANT v)
|
||||
|
@ -822,10 +869,44 @@ static HRESULT WINAPI HTMLWindow2_get_external(IHTMLWindow2 *iface, IDispatch **
|
|||
|
||||
*p = NULL;
|
||||
|
||||
if(!This->doc->hostui)
|
||||
if(!This->doc_obj->hostui)
|
||||
return S_OK;
|
||||
|
||||
return IDocHostUIHandler_GetExternal(This->doc->hostui, p);
|
||||
return IDocHostUIHandler_GetExternal(This->doc_obj->hostui, p);
|
||||
}
|
||||
|
||||
static HRESULT HTMLWindow_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
|
||||
VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
|
||||
{
|
||||
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
|
||||
IDispatchEx *dispex;
|
||||
IDispatch *disp;
|
||||
DWORD idx;
|
||||
HRESULT hres;
|
||||
|
||||
idx = id - MSHTML_DISPID_CUSTOM_MIN;
|
||||
if(idx >= This->global_prop_cnt)
|
||||
return DISP_E_MEMBERNOTFOUND;
|
||||
|
||||
disp = get_script_disp(This->global_props[idx].script_host);
|
||||
if(!disp)
|
||||
return E_UNEXPECTED;
|
||||
|
||||
hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
|
||||
if(SUCCEEDED(hres)) {
|
||||
TRACE("%s >>>\n", debugstr_w(This->global_props[idx].name));
|
||||
hres = IDispatchEx_InvokeEx(dispex, This->global_props[idx].id, lcid, flags, params, res, ei, caller);
|
||||
if(hres == S_OK)
|
||||
TRACE("%s <<<\n", debugstr_w(This->global_props[idx].name));
|
||||
else
|
||||
WARN("%s <<< %08x\n", debugstr_w(This->global_props[idx].name), hres);
|
||||
IDispatchEx_Release(dispex);
|
||||
}else {
|
||||
FIXME("No IDispatchEx\n");
|
||||
}
|
||||
|
||||
IDispatch_Release(disp);
|
||||
return hres;
|
||||
}
|
||||
|
||||
#undef HTMLWINDOW2_THIS
|
||||
|
@ -984,8 +1065,10 @@ 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 = HTMLWINDOW3_THIS(iface);
|
||||
FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
|
||||
|
||||
return attach_event(&This->event_target, &This->doc_obj->basedoc, event, pDisp, pfResult);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLWindow3_detachEvent(IHTMLWindow3 *iface, BSTR event, IDispatch *pDisp)
|
||||
|
@ -1007,7 +1090,7 @@ static HRESULT window_set_timer(HTMLWindow *This, VARIANT *expr, LONG msec, VARI
|
|||
break;
|
||||
|
||||
case VT_BSTR:
|
||||
disp = script_parse_event(This->doc, V_BSTR(expr));
|
||||
disp = script_parse_event(This, V_BSTR(expr));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1018,7 +1101,7 @@ static HRESULT window_set_timer(HTMLWindow *This, VARIANT *expr, LONG msec, VARI
|
|||
if(!disp)
|
||||
return E_FAIL;
|
||||
|
||||
*timer_id = set_task_timer(This->doc, msec, interval, disp);
|
||||
*timer_id = set_task_timer(&This->doc->basedoc, msec, interval, disp);
|
||||
IDispatch_Release(disp);
|
||||
|
||||
return S_OK;
|
||||
|
@ -1193,9 +1276,49 @@ static HRESULT WINAPI WindowDispEx_Invoke(IDispatchEx *iface, DISPID dispIdMembe
|
|||
static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
|
||||
{
|
||||
HTMLWindow *This = DISPEX_THIS(iface);
|
||||
ScriptHost *script_host;
|
||||
DISPID id;
|
||||
DWORD i;
|
||||
|
||||
TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid);
|
||||
|
||||
for(i=0; i < This->global_prop_cnt; i++) {
|
||||
/* FIXME: case sensitivity */
|
||||
if(!strcmpW(This->global_props[i].name, bstrName)) {
|
||||
*pid = MSHTML_DISPID_CUSTOM_MIN+i;
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if(find_global_prop(This, bstrName, grfdex, &script_host, &id)) {
|
||||
if(This->global_prop_cnt == This->global_prop_size) {
|
||||
global_prop_t *new_props;
|
||||
DWORD new_size;
|
||||
|
||||
if(This->global_props) {
|
||||
new_size = This->global_prop_size*2;
|
||||
new_props = heap_realloc(This->global_props, new_size*sizeof(global_prop_t));
|
||||
}else {
|
||||
new_size = 16;
|
||||
new_props = heap_alloc(new_size*sizeof(global_prop_t));
|
||||
}
|
||||
if(!new_props)
|
||||
return E_OUTOFMEMORY;
|
||||
This->global_props = new_props;
|
||||
This->global_prop_size = new_size;
|
||||
}
|
||||
|
||||
This->global_props[This->global_prop_cnt].name = heap_strdupW(bstrName);
|
||||
if(!This->global_props[This->global_prop_cnt].name)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
This->global_props[This->global_prop_cnt].script_host = script_host;
|
||||
This->global_props[This->global_prop_cnt].id = id;
|
||||
|
||||
*pid = MSHTML_DISPID_CUSTOM_MIN + (This->global_prop_cnt++);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return IDispatchEx_GetDispID(DISPATCHEX(&This->dispex), bstrName, grfdex, pid);
|
||||
}
|
||||
|
||||
|
@ -1289,14 +1412,21 @@ static const tid_t HTMLWindow_iface_tids[] = {
|
|||
IHTMLWindow3_tid,
|
||||
0
|
||||
};
|
||||
static dispex_static_data_t HTMLWindow_dispex = {
|
||||
|
||||
static const dispex_static_data_vtbl_t HTMLWindow_dispex_vtbl = {
|
||||
NULL,
|
||||
NULL,
|
||||
HTMLWindow_invoke
|
||||
};
|
||||
|
||||
static dispex_static_data_t HTMLWindow_dispex = {
|
||||
&HTMLWindow_dispex_vtbl,
|
||||
DispHTMLWindow2_tid,
|
||||
NULL,
|
||||
HTMLWindow_iface_tids
|
||||
};
|
||||
|
||||
HRESULT HTMLWindow_Create(HTMLDocument *doc, nsIDOMWindow *nswindow, HTMLWindow **ret)
|
||||
HRESULT HTMLWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTMLWindow **ret)
|
||||
{
|
||||
HTMLWindow *window;
|
||||
|
||||
|
@ -1308,7 +1438,7 @@ HRESULT HTMLWindow_Create(HTMLDocument *doc, nsIDOMWindow *nswindow, HTMLWindow
|
|||
window->lpHTMLWindow3Vtbl = &HTMLWindow3Vtbl;
|
||||
window->lpIDispatchExVtbl = &WindowDispExVtbl;
|
||||
window->ref = 1;
|
||||
window->doc = doc;
|
||||
window->doc_obj = doc_obj;
|
||||
|
||||
init_dispex(&window->dispex, (IUnknown*)HTMLWINDOW2(window), &HTMLWindow_dispex);
|
||||
|
||||
|
@ -1317,6 +1447,9 @@ HRESULT HTMLWindow_Create(HTMLDocument *doc, nsIDOMWindow *nswindow, HTMLWindow
|
|||
window->nswindow = nswindow;
|
||||
}
|
||||
|
||||
window->scriptmode = SCRIPTMODE_GECKO;
|
||||
list_init(&window->script_hosts);
|
||||
|
||||
list_add_head(&window_list, &window->entry);
|
||||
|
||||
*ret = window;
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
<file>persist.c</file>
|
||||
<file>protocol.c</file>
|
||||
<file>script.c</file>
|
||||
<file>secmgr.c</file>
|
||||
<file>selection.c</file>
|
||||
<file>service.c</file>
|
||||
<file>task.c</file>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2005-2008 Jacek Caban for CodeWeavers
|
||||
* Copyright 2005-2009 Jacek Caban for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -59,6 +59,7 @@ typedef enum {
|
|||
NULL_tid,
|
||||
DispCEventObj_tid,
|
||||
DispDOMChildrenCollection_tid,
|
||||
DispHTMLAnchorElement_tid,
|
||||
DispHTMLBody_tid,
|
||||
DispHTMLCommentElement_tid,
|
||||
DispHTMLCurrentStyle_tid,
|
||||
|
@ -78,6 +79,7 @@ typedef enum {
|
|||
DispHTMLTableRow_tid,
|
||||
DispHTMLUnknownElement_tid,
|
||||
DispHTMLWindow2_tid,
|
||||
IHTMLAnchorElement_tid,
|
||||
IHTMLBodyElement_tid,
|
||||
IHTMLBodyElement2_tid,
|
||||
IHTMLCommentElement_tid,
|
||||
|
@ -153,7 +155,41 @@ void release_dispex(DispatchEx*);
|
|||
BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
|
||||
HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
|
||||
|
||||
typedef struct HTMLWindow HTMLWindow;
|
||||
typedef struct HTMLDocumentNode HTMLDocumentNode;
|
||||
typedef struct HTMLDocumentObj HTMLDocumentObj;
|
||||
|
||||
typedef enum {
|
||||
SCRIPTMODE_GECKO,
|
||||
SCRIPTMODE_ACTIVESCRIPT
|
||||
} SCRIPTMODE;
|
||||
|
||||
typedef struct ScriptHost ScriptHost;
|
||||
|
||||
typedef struct {
|
||||
WCHAR *name;
|
||||
ScriptHost *script_host;
|
||||
DISPID id;
|
||||
} global_prop_t;
|
||||
|
||||
typedef struct {
|
||||
const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
|
||||
|
||||
LONG ref;
|
||||
|
||||
HTMLWindow *window;
|
||||
} HTMLOptionElementFactory;
|
||||
|
||||
struct HTMLLocation {
|
||||
DispatchEx dispex;
|
||||
const IHTMLLocationVtbl *lpHTMLLocationVtbl;
|
||||
|
||||
LONG ref;
|
||||
|
||||
HTMLWindow *window;
|
||||
};
|
||||
|
||||
struct HTMLWindow {
|
||||
DispatchEx dispex;
|
||||
const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
|
||||
const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
|
||||
|
@ -161,13 +197,26 @@ typedef struct {
|
|||
|
||||
LONG ref;
|
||||
|
||||
HTMLDocument *doc;
|
||||
HTMLDocumentNode *doc;
|
||||
HTMLDocumentObj *doc_obj;
|
||||
nsIDOMWindow *nswindow;
|
||||
|
||||
event_target_t *event_target;
|
||||
IHTMLEventObj *event;
|
||||
BOOL *event_vector;
|
||||
|
||||
SCRIPTMODE scriptmode;
|
||||
struct list script_hosts;
|
||||
|
||||
HTMLOptionElementFactory *option_factory;
|
||||
HTMLLocation *location;
|
||||
|
||||
global_prop_t *global_props;
|
||||
DWORD global_prop_cnt;
|
||||
DWORD global_prop_size;
|
||||
|
||||
struct list entry;
|
||||
} HTMLWindow;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
UNKNOWN_USERMODE,
|
||||
|
@ -175,11 +224,6 @@ typedef enum {
|
|||
EDITMODE
|
||||
} USERMODE;
|
||||
|
||||
typedef enum {
|
||||
SCRIPTMODE_GECKO,
|
||||
SCRIPTMODE_ACTIVESCRIPT
|
||||
} SCRIPTMODE;
|
||||
|
||||
typedef struct {
|
||||
const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
|
||||
|
||||
|
@ -204,25 +248,7 @@ struct ConnectionPoint {
|
|||
ConnectionPoint *next;
|
||||
};
|
||||
|
||||
struct HTMLLocation {
|
||||
DispatchEx dispex;
|
||||
const IHTMLLocationVtbl *lpHTMLLocationVtbl;
|
||||
|
||||
LONG ref;
|
||||
|
||||
HTMLDocument *doc;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
|
||||
|
||||
LONG ref;
|
||||
|
||||
HTMLDocument *doc;
|
||||
} HTMLOptionElementFactory;
|
||||
|
||||
struct HTMLDocument {
|
||||
DispatchEx dispex;
|
||||
const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
|
||||
const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
|
||||
const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
|
||||
|
@ -242,14 +268,47 @@ struct HTMLDocument {
|
|||
const IOleControlVtbl *lpOleControlVtbl;
|
||||
const IHlinkTargetVtbl *lpHlinkTargetVtbl;
|
||||
const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
|
||||
const ICustomDocVtbl *lpCustomDocVtbl;
|
||||
const IDispatchExVtbl *lpIDispatchExVtbl;
|
||||
const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
|
||||
|
||||
IUnknown *unk_impl;
|
||||
IDispatchEx *dispex;
|
||||
|
||||
HTMLDocumentObj *doc_obj;
|
||||
HTMLDocumentNode *doc_node;
|
||||
|
||||
HTMLWindow *window;
|
||||
nsIDOMHTMLDocument *nsdoc;
|
||||
|
||||
ConnectionPointContainer cp_container;
|
||||
ConnectionPoint cp_htmldocevents;
|
||||
ConnectionPoint cp_htmldocevents2;
|
||||
ConnectionPoint cp_propnotif;
|
||||
};
|
||||
|
||||
static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
|
||||
{
|
||||
return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
|
||||
}
|
||||
|
||||
static inline ULONG htmldoc_addref(HTMLDocument *This)
|
||||
{
|
||||
return IUnknown_AddRef(This->unk_impl);
|
||||
}
|
||||
|
||||
static inline ULONG htmldoc_release(HTMLDocument *This)
|
||||
{
|
||||
return IUnknown_Release(This->unk_impl);
|
||||
}
|
||||
|
||||
struct HTMLDocumentObj {
|
||||
HTMLDocument basedoc;
|
||||
DispatchEx dispex;
|
||||
const ICustomDocVtbl *lpCustomDocVtbl;
|
||||
|
||||
LONG ref;
|
||||
|
||||
NSContainer *nscontainer;
|
||||
HTMLWindow *window;
|
||||
nsIDOMHTMLDocument *nsdoc;
|
||||
|
||||
IOleClientSite *client;
|
||||
IDocHostUIHandler *hostui;
|
||||
|
@ -257,46 +316,31 @@ struct HTMLDocument {
|
|||
IOleInPlaceFrame *frame;
|
||||
IOleInPlaceUIWindow *ip_window;
|
||||
|
||||
DOCHOSTUIINFO hostinfo;
|
||||
|
||||
IOleUndoManager *undomgr;
|
||||
|
||||
nsChannelBSC *bscallback;
|
||||
IMoniker *mon;
|
||||
LPOLESTR url;
|
||||
struct list bindings;
|
||||
|
||||
struct list script_hosts;
|
||||
|
||||
HWND hwnd;
|
||||
HWND tooltips_hwnd;
|
||||
|
||||
DOCHOSTUIINFO hostinfo;
|
||||
|
||||
USERMODE usermode;
|
||||
SCRIPTMODE scriptmode;
|
||||
READYSTATE readystate;
|
||||
BOOL in_place_active;
|
||||
BOOL ui_active;
|
||||
BOOL window_active;
|
||||
BOOL has_key_path;
|
||||
BOOL container_locked;
|
||||
BOOL focus;
|
||||
|
||||
USERMODE usermode;
|
||||
READYSTATE readystate;
|
||||
LPWSTR mime;
|
||||
|
||||
DWORD update;
|
||||
|
||||
event_target_t *event_target;
|
||||
ConnectionPointContainer cp_container;
|
||||
ConnectionPoint cp_htmldocevents;
|
||||
ConnectionPoint cp_htmldocevents2;
|
||||
ConnectionPoint cp_propnotif;
|
||||
|
||||
HTMLOptionElementFactory *option_factory;
|
||||
HTMLLocation *location;
|
||||
|
||||
struct list selection_list;
|
||||
struct list range_list;
|
||||
|
||||
HTMLDOMNode *nodes;
|
||||
/* FIXME: probably should be in document node object */
|
||||
nsChannelBSC *bscallback;
|
||||
IMoniker *mon;
|
||||
LPOLESTR url;
|
||||
struct list bindings;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
@ -342,7 +386,7 @@ struct NSContainer {
|
|||
LONG ref;
|
||||
|
||||
NSContainer *parent;
|
||||
HTMLDocument *doc;
|
||||
HTMLDocumentObj *doc;
|
||||
|
||||
nsIURIContentListener *content_listener;
|
||||
|
||||
|
@ -353,8 +397,6 @@ struct NSContainer {
|
|||
|
||||
nsChannelBSC *bscallback; /* hack */
|
||||
HWND reset_focus; /* hack */
|
||||
|
||||
BOOL *event_vector;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
@ -382,6 +424,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
|
||||
void (*destructor)(HTMLDOMNode*);
|
||||
event_target_t **(*get_event_target)(HTMLDOMNode*);
|
||||
HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
|
||||
HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
|
||||
} NodeImplVtbl;
|
||||
|
@ -395,7 +438,7 @@ struct HTMLDOMNode {
|
|||
LONG ref;
|
||||
|
||||
nsIDOMNode *nsnode;
|
||||
HTMLDocument *doc;
|
||||
HTMLDocumentNode *doc;
|
||||
event_target_t *event_target;
|
||||
|
||||
HTMLDOMNode *next;
|
||||
|
@ -420,6 +463,22 @@ typedef struct {
|
|||
ConnectionPoint cp;
|
||||
} HTMLTextContainer;
|
||||
|
||||
struct HTMLDocumentNode {
|
||||
HTMLDOMNode node;
|
||||
HTMLDocument basedoc;
|
||||
|
||||
const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
|
||||
|
||||
LONG ref;
|
||||
|
||||
HTMLDOMNode *nodes;
|
||||
|
||||
IInternetSecurityManager *secmgr;
|
||||
|
||||
struct list selection_list;
|
||||
struct list range_list;
|
||||
};
|
||||
|
||||
#define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
|
||||
#define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
|
||||
|
||||
|
@ -487,17 +546,20 @@ typedef struct {
|
|||
|
||||
#define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
|
||||
|
||||
#define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
|
||||
|
||||
#define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
|
||||
#define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
|
||||
|
||||
HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
|
||||
HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
|
||||
HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocument**);
|
||||
HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**);
|
||||
|
||||
HRESULT HTMLWindow_Create(HTMLDocument*,nsIDOMWindow*,HTMLWindow**);
|
||||
HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow**);
|
||||
void window_set_docnode(HTMLWindow*,HTMLDocumentNode*);
|
||||
HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
|
||||
HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
|
||||
HTMLLocation *HTMLLocation_Create(HTMLDocument*);
|
||||
HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
|
||||
HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
|
||||
IOmNavigator *OmNavigator_Create(void);
|
||||
|
||||
void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
|
||||
|
@ -510,25 +572,27 @@ void HTMLDocument_Window_Init(HTMLDocument*);
|
|||
void HTMLDocument_Service_Init(HTMLDocument*);
|
||||
void HTMLDocument_Hlink_Init(HTMLDocument*);
|
||||
|
||||
void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
|
||||
|
||||
HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
|
||||
|
||||
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*);
|
||||
void set_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
|
||||
void remove_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
|
||||
|
||||
void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
|
||||
void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
|
||||
void notif_focus(HTMLDocument*);
|
||||
void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
|
||||
void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
|
||||
void notif_focus(HTMLDocumentObj*);
|
||||
|
||||
void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
|
||||
void hide_tooltip(HTMLDocument*);
|
||||
void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
|
||||
void hide_tooltip(HTMLDocumentObj*);
|
||||
HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
|
||||
|
||||
HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
|
||||
|
@ -540,7 +604,7 @@ void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
|
|||
void release_nsio(void);
|
||||
BOOL install_wine_gecko(BOOL);
|
||||
|
||||
HRESULT nsuri_to_url(LPCWSTR,BSTR*);
|
||||
HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
|
||||
|
||||
void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
|
||||
|
||||
|
@ -564,9 +628,9 @@ nsICommandParams *create_nscommand_params(void);
|
|||
HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
|
||||
void get_editor_controller(NSContainer*);
|
||||
void init_nsevents(NSContainer*);
|
||||
void add_nsevent_listener(NSContainer*,LPCWSTR);
|
||||
void add_nsevent_listener(HTMLWindow*,LPCWSTR);
|
||||
nsresult get_nsinterface(nsISupports*,REFIID,void**);
|
||||
void update_nsdocument(HTMLDocument*);
|
||||
void update_nsdocument(HTMLDocumentObj*);
|
||||
|
||||
void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
|
||||
void set_current_mon(HTMLDocument*,IMoniker*);
|
||||
|
@ -579,20 +643,20 @@ HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
|
|||
void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
|
||||
IMoniker *get_channelbsc_mon(nsChannelBSC*);
|
||||
|
||||
IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
|
||||
IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
|
||||
HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
|
||||
HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
|
||||
IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
|
||||
IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
|
||||
IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
|
||||
|
||||
void detach_selection(HTMLDocument*);
|
||||
void detach_ranges(HTMLDocument*);
|
||||
void detach_selection(HTMLDocumentNode*);
|
||||
void detach_ranges(HTMLDocumentNode*);
|
||||
HRESULT get_node_text(HTMLDOMNode*,BSTR*);
|
||||
|
||||
HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocument*,nsIDOMNode*);
|
||||
HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*);
|
||||
|
||||
HTMLElement *HTMLElement_Create(HTMLDocument*,nsIDOMNode*,BOOL);
|
||||
HTMLElement *HTMLCommentElement_Create(HTMLDocument*,nsIDOMNode*);
|
||||
HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
|
||||
HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
|
||||
HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
|
||||
HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
|
||||
HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement*);
|
||||
|
@ -606,11 +670,11 @@ HTMLElement *HTMLTableRow_Create(nsIDOMHTMLElement*);
|
|||
HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
|
||||
HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*);
|
||||
|
||||
void HTMLDOMNode_Init(HTMLDocument*,HTMLDOMNode*,nsIDOMNode*);
|
||||
void HTMLElement_Init(HTMLElement*);
|
||||
void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
|
||||
void HTMLElement_Init(HTMLElement*,dispex_static_data_t*);
|
||||
void HTMLElement2_Init(HTMLElement*);
|
||||
void HTMLElement3_Init(HTMLElement*);
|
||||
void HTMLTextContainer_Init(HTMLTextContainer*);
|
||||
void HTMLTextContainer_Init(HTMLTextContainer*,dispex_static_data_t*);
|
||||
|
||||
HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
|
||||
void HTMLDOMNode_destructor(HTMLDOMNode*);
|
||||
|
@ -618,18 +682,20 @@ void HTMLDOMNode_destructor(HTMLDOMNode*);
|
|||
HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
|
||||
void HTMLElement_destructor(HTMLDOMNode*);
|
||||
|
||||
HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
|
||||
void release_nodes(HTMLDocument*);
|
||||
HTMLDOMNode *get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL);
|
||||
void release_nodes(HTMLDocumentNode*);
|
||||
|
||||
void release_script_hosts(HTMLDocument*);
|
||||
void connect_scripts(HTMLDocument*);
|
||||
void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
|
||||
IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
|
||||
void set_script_mode(HTMLDocument*,SCRIPTMODE);
|
||||
void release_script_hosts(HTMLWindow*);
|
||||
void connect_scripts(HTMLWindow*);
|
||||
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*);
|
||||
IDispatch *get_script_disp(ScriptHost*);
|
||||
|
||||
IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
|
||||
IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument*,IUnknown*,nsIDOMNodeList*);
|
||||
IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocument*,IUnknown*,nsIDOMHTMLCollection*);
|
||||
IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*);
|
||||
IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*);
|
||||
|
||||
/* commands */
|
||||
typedef struct {
|
||||
|
@ -640,14 +706,14 @@ 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
|
||||
#define UPDATE_TITLE 0x0002
|
||||
|
||||
void update_doc(HTMLDocument *This, DWORD flags);
|
||||
void update_title(HTMLDocument*);
|
||||
void update_doc(HTMLDocument*,DWORD);
|
||||
void update_title(HTMLDocumentObj*);
|
||||
|
||||
/* editor */
|
||||
void init_editor(HTMLDocument*);
|
||||
|
@ -692,7 +758,7 @@ DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
|
|||
HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
|
||||
|
||||
void release_typelib(void);
|
||||
void call_disp_func(HTMLDocument*,IDispatch*,IDispatch*);
|
||||
HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
|
||||
|
||||
const char *debugstr_variant(const VARIANT*);
|
||||
|
||||
|
@ -721,6 +787,11 @@ static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
|
|||
return HeapReAlloc(GetProcessHeap(), 0, mem, len);
|
||||
}
|
||||
|
||||
static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
|
||||
{
|
||||
return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
|
||||
}
|
||||
|
||||
static inline BOOL heap_free(void *mem)
|
||||
{
|
||||
return HeapFree(GetProcessHeap(), 0, mem);
|
||||
|
|
|
@ -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.doc_node, nselem);
|
||||
nsIDOMElement_Release(nselem);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
@ -615,7 +615,7 @@ static void init_bscallback(BSCallback *This, const BSCallbackVtbl *vtbl, IMonik
|
|||
}
|
||||
|
||||
/* Calls undocumented 84 cmd of CGID_ShellDocView */
|
||||
static void call_docview_84(HTMLDocument *doc)
|
||||
static void call_docview_84(HTMLDocumentObj *doc)
|
||||
{
|
||||
IOleCommandTarget *olecmd;
|
||||
VARIANT var;
|
||||
|
@ -714,7 +714,7 @@ HRESULT start_binding(HTMLDocument *doc, BSCallback *bscallback, IBindCtx *bctx)
|
|||
|
||||
/* NOTE: IE7 calls IsSystemMoniker here*/
|
||||
|
||||
call_docview_84(doc);
|
||||
call_docview_84(doc->doc_obj);
|
||||
|
||||
if(bctx) {
|
||||
RegisterBindStatusCallback(bctx, STATUSCLB(bscallback), NULL, 0);
|
||||
|
@ -893,20 +893,20 @@ static void on_start_nsrequest(nsChannelBSC *This)
|
|||
FIXME("OnStartRequest failed: %08x\n", nsres);
|
||||
}
|
||||
|
||||
static void on_stop_nsrequest(nsChannelBSC *This)
|
||||
static void on_stop_nsrequest(nsChannelBSC *This, HRESULT result)
|
||||
{
|
||||
nsresult nsres;
|
||||
|
||||
if(!This->nslistener)
|
||||
return;
|
||||
|
||||
if(!This->bsc.readed) {
|
||||
if(!This->bsc.readed && SUCCEEDED(result)) {
|
||||
TRACE("No data read! Calling OnStartRequest\n");
|
||||
on_start_nsrequest(This);
|
||||
}
|
||||
|
||||
nsres = nsIStreamListener_OnStopRequest(This->nslistener, (nsIRequest*)NSCHANNEL(This->nschannel),
|
||||
This->nscontext, NS_OK);
|
||||
This->nscontext, SUCCEEDED(result) ? NS_OK : NS_ERROR_FAILURE);
|
||||
if(NS_FAILED(nsres))
|
||||
WARN("OnStopRequest failed: %08x\n", nsres);
|
||||
}
|
||||
|
@ -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) {
|
||||
update_nsdocument(This->bsc.doc);
|
||||
init_nsevents(This->bsc.doc->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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1030,7 +1030,7 @@ static HRESULT nsChannelBSC_stop_binding(BSCallback *bsc, HRESULT result)
|
|||
{
|
||||
nsChannelBSC *This = NSCHANNELBSC_THIS(bsc);
|
||||
|
||||
on_stop_nsrequest(This);
|
||||
on_stop_nsrequest(This, result);
|
||||
|
||||
if(This->nslistener) {
|
||||
if(This->nschannel->load_group) {
|
||||
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
@ -807,11 +807,13 @@ void set_ns_editmode(NSContainer *This)
|
|||
nsIWebBrowser_SetParentURIContentListener(This->webbrowser, NSURICL(This));
|
||||
}
|
||||
|
||||
void update_nsdocument(HTMLDocument *doc)
|
||||
void update_nsdocument(HTMLDocumentObj *doc)
|
||||
{
|
||||
HTMLDocumentNode *doc_node;
|
||||
nsIDOMHTMLDocument *nsdoc;
|
||||
nsIDOMDocument *nsdomdoc;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
||||
if(!doc->nscontainer || !doc->nscontainer->navigation)
|
||||
return;
|
||||
|
@ -829,20 +831,37 @@ void update_nsdocument(HTMLDocument *doc)
|
|||
return;
|
||||
}
|
||||
|
||||
if(nsdoc == doc->nsdoc) {
|
||||
if(nsdoc == doc->basedoc.nsdoc) {
|
||||
nsIDOMHTMLDocument_Release(nsdoc);
|
||||
return;
|
||||
}
|
||||
|
||||
if(doc->nsdoc) {
|
||||
remove_mutation_observer(doc->nscontainer, doc->nsdoc);
|
||||
nsIDOMHTMLDocument_Release(doc->nsdoc);
|
||||
if(doc->basedoc.nsdoc) {
|
||||
remove_mutation_observer(doc->nscontainer, doc->basedoc.nsdoc);
|
||||
nsIDOMHTMLDocument_Release(doc->basedoc.nsdoc);
|
||||
|
||||
doc_node = doc->basedoc.doc_node;
|
||||
doc_node->basedoc.doc_obj = NULL;
|
||||
IHTMLDocument2_Release(HTMLDOC(&doc_node->basedoc));
|
||||
doc->basedoc.doc_node = NULL;
|
||||
}
|
||||
|
||||
doc->nsdoc = nsdoc;
|
||||
doc->basedoc.nsdoc = nsdoc;
|
||||
if(!nsdoc) {
|
||||
window_set_docnode(doc->basedoc.window, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if(nsdoc)
|
||||
set_mutation_observer(doc->nscontainer, nsdoc);
|
||||
set_mutation_observer(doc->nscontainer, nsdoc);
|
||||
|
||||
hres = create_doc_from_nsdoc(nsdoc, doc, doc->basedoc.window, &doc_node);
|
||||
if(FAILED(hres)) {
|
||||
ERR("Could not create document: %08x\n", hres);
|
||||
return;
|
||||
}
|
||||
|
||||
doc->basedoc.doc_node = doc_node;
|
||||
window_set_docnode(doc->basedoc.window, doc_node);
|
||||
}
|
||||
|
||||
void close_gecko(void)
|
||||
|
@ -932,7 +951,6 @@ static nsrefcnt NSAPI nsWebBrowserChrome_Release(nsIWebBrowserChrome *iface)
|
|||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
|
||||
if(!ref) {
|
||||
heap_free(This->event_vector);
|
||||
if(This->parent)
|
||||
nsIWebBrowserChrome_Release(NSWBCHROME(This->parent));
|
||||
heap_free(This);
|
||||
|
@ -1121,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, dwID, &pt, (IDispatch*)HTMLDOMNODE(get_node(This->doc->basedoc.doc_node, aNode, TRUE)));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1160,7 +1178,7 @@ static nsrefcnt NSAPI nsURIContentListener_Release(nsIURIContentListener *iface)
|
|||
return nsIWebBrowserChrome_Release(NSWBCHROME(This));
|
||||
}
|
||||
|
||||
static BOOL translate_url(HTMLDocument *doc, nsIWineURI *nsuri)
|
||||
static BOOL translate_url(HTMLDocumentObj *doc, nsIWineURI *nsuri)
|
||||
{
|
||||
OLECHAR *new_url = NULL, *url;
|
||||
BOOL ret = FALSE;
|
||||
|
@ -1233,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, wine_uri);
|
||||
}
|
||||
|
||||
nsIWineURI_Release(wine_uri);
|
||||
|
@ -1653,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->hwnd; hwnd = GetParent(hwnd));
|
||||
|
||||
return hwnd == This->doc->hwnd;
|
||||
return hwnd != NULL;
|
||||
}
|
||||
|
||||
static nsresult NSAPI handle_blur(nsIDOMEventListener *iface, nsIDOMEvent *event)
|
||||
|
@ -91,8 +91,8 @@ 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;
|
||||
if(!This->reset_focus && This->doc && This->doc->basedoc.doc_obj->focus && !is_doc_child_focus(This)) {
|
||||
This->doc->basedoc.doc_obj->focus = FALSE;
|
||||
notif_focus(This->doc);
|
||||
}
|
||||
|
||||
|
@ -120,9 +120,9 @@ static nsresult NSAPI handle_keypress(nsIDOMEventListener *iface,
|
|||
|
||||
TRACE("(%p)->(%p)\n", This, event);
|
||||
|
||||
update_doc(This->doc, UPDATE_UI);
|
||||
update_doc(&This->doc->basedoc, UPDATE_UI);
|
||||
if(This->doc->usermode == EDITMODE)
|
||||
handle_edit_event(This->doc, event);
|
||||
handle_edit_event(&This->doc->basedoc, event);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
|
|||
return NS_OK;
|
||||
|
||||
update_nsdocument(This->doc);
|
||||
connect_scripts(This->doc);
|
||||
connect_scripts(This->doc->basedoc.window);
|
||||
|
||||
if(This->editor_controller) {
|
||||
nsIController_Release(This->editor_controller);
|
||||
|
@ -146,16 +146,16 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
|
|||
}
|
||||
|
||||
if(This->doc->usermode == EDITMODE)
|
||||
handle_edit_load(This->doc);
|
||||
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);
|
||||
fire_event(This->doc->basedoc.doc_node, 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);
|
||||
fire_event(This->doc->basedoc.doc_node, eid, nsnode, event);
|
||||
|
||||
nsIDOMNode_Release(nsnode);
|
||||
|
||||
|
@ -235,26 +235,18 @@ static void init_listener(nsEventListener *This, NSContainer *container,
|
|||
This->This = container;
|
||||
}
|
||||
|
||||
void add_nsevent_listener(NSContainer *container, LPCWSTR type)
|
||||
void add_nsevent_listener(HTMLWindow *window, LPCWSTR type)
|
||||
{
|
||||
nsIDOMWindow *dom_window;
|
||||
nsIDOMEventTarget *target;
|
||||
nsresult nsres;
|
||||
|
||||
nsres = nsIWebBrowser_GetContentDOMWindow(container->webbrowser, &dom_window);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("GetContentDOMWindow failed: %08x\n", nsres);
|
||||
return;
|
||||
}
|
||||
|
||||
nsres = nsIDOMWindow_QueryInterface(dom_window, &IID_nsIDOMEventTarget, (void**)&target);
|
||||
nsIDOMWindow_Release(dom_window);
|
||||
nsres = nsIDOMWindow_QueryInterface(window->nswindow, &IID_nsIDOMEventTarget, (void**)&target);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("Could not get nsIDOMEventTarget interface: %08x\n", nsres);
|
||||
return;
|
||||
}
|
||||
|
||||
init_event(target, type, NSEVENTLIST(&container->htmlevent_listener), TRUE);
|
||||
init_event(target, type, NSEVENTLIST(&window->doc_obj->nscontainer->htmlevent_listener), TRUE);
|
||||
nsIDOMEventTarget_Release(target);
|
||||
}
|
||||
|
||||
|
|
|
@ -1351,6 +1351,42 @@ interface nsIDOMHTMLImageElement : nsIDOMHTMLElement
|
|||
nsresult SetWidth(PRInt32 aWidth);
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(a6cf90aa-15b3-11d2-932e-00805f8add32),
|
||||
local
|
||||
/* FROZEN */
|
||||
]
|
||||
interface nsIDOMHTMLAnchorElement : nsIDOMHTMLElement
|
||||
{
|
||||
nsresult GetAccessKey(nsAString *aAccessKey);
|
||||
nsresult SetAccessKey(const nsAString *aAccessKey);
|
||||
nsresult GetCharset(nsAString *aCharset);
|
||||
nsresult SetCharset(const nsAString *aCharset);
|
||||
nsresult GetCoords(nsAString *aCoords);
|
||||
nsresult SetCoords(const nsAString *aCoords);
|
||||
nsresult GetHref(nsAString *aHref);
|
||||
nsresult SetHref(const nsAString *aHref);
|
||||
nsresult GetHreflang(nsAString *aHreflang);
|
||||
nsresult SetHreflang(const nsAString *aHreflang);
|
||||
nsresult GetName(nsAString *aName);
|
||||
nsresult SetName(const nsAString *aName);
|
||||
nsresult GetRel(nsAString *aRel);
|
||||
nsresult SetRel(const nsAString *aRel);
|
||||
nsresult GetRev(nsAString *aRev);
|
||||
nsresult SetRev(const nsAString *aRev);
|
||||
nsresult GetShape(nsAString *aShape);
|
||||
nsresult SetShape(const nsAString *aShape);
|
||||
nsresult GetTabIndex(PRInt32 *aTabIndex);
|
||||
nsresult SetTabIndex(PRInt32 aTabIndex);
|
||||
nsresult GetTarget(nsAString *aTarget);
|
||||
nsresult SetTarget(const nsAString *aTarget);
|
||||
nsresult GetType(nsAString *aType);
|
||||
nsresult SetType(const nsAString *aType);
|
||||
nsresult Blur();
|
||||
nsresult Focus();
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(a6cf90b2-15b3-11d2-932e-00805f8add32),
|
||||
|
|
|
@ -77,7 +77,7 @@ static const char *debugstr_nsacstr(const nsACString *nsstr)
|
|||
return debugstr_a(data);
|
||||
}
|
||||
|
||||
HRESULT nsuri_to_url(LPCWSTR nsuri, BSTR *ret)
|
||||
HRESULT nsuri_to_url(LPCWSTR nsuri, BOOL ret_empty, BSTR *ret)
|
||||
{
|
||||
const WCHAR *ptr = nsuri;
|
||||
|
||||
|
@ -86,21 +86,24 @@ HRESULT nsuri_to_url(LPCWSTR nsuri, BSTR *ret)
|
|||
if(!strncmpW(nsuri, wine_prefixW, sizeof(wine_prefixW)/sizeof(WCHAR)))
|
||||
ptr += sizeof(wine_prefixW)/sizeof(WCHAR);
|
||||
|
||||
*ret = SysAllocString(ptr);
|
||||
if(!*ret)
|
||||
return E_OUTOFMEMORY;
|
||||
if(*ptr || ret_empty) {
|
||||
*ret = SysAllocString(ptr);
|
||||
if(!*ret)
|
||||
return E_OUTOFMEMORY;
|
||||
}else {
|
||||
*ret = NULL;
|
||||
}
|
||||
|
||||
TRACE("%s -> %s\n", debugstr_w(nsuri), debugstr_w(*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,
|
||||
(void**)&cmdtrg);
|
||||
hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
|
||||
if(SUCCEEDED(hres)) {
|
||||
VARIANT varUrl, varRes;
|
||||
|
||||
|
@ -124,8 +127,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;
|
||||
|
@ -160,7 +163,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;
|
||||
|
@ -729,7 +732,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;
|
||||
|
@ -755,7 +758,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);
|
||||
|
@ -470,10 +473,10 @@ static HRESULT exec_mshtml_copy(HTMLDocument *This, DWORD cmdexecopt, VARIANT *i
|
|||
{
|
||||
TRACE("(%p)->(%08x %p %p)\n", This, cmdexecopt, in, out);
|
||||
|
||||
if(This->usermode == EDITMODE)
|
||||
if(This->doc_obj->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;
|
||||
}
|
||||
|
||||
|
@ -488,7 +491,7 @@ static HRESULT exec_mshtml_cut(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in
|
|||
{
|
||||
TRACE("(%p)->(%08x %p %p)\n", This, cmdexecopt, in, out);
|
||||
|
||||
if(This->usermode == EDITMODE)
|
||||
if(This->doc_obj->usermode == EDITMODE)
|
||||
return editor_exec_cut(This, cmdexecopt, in, out);
|
||||
|
||||
FIXME("Unimplemented in browse mode\n");
|
||||
|
@ -506,7 +509,7 @@ static HRESULT exec_mshtml_paste(HTMLDocument *This, DWORD cmdexecopt, VARIANT *
|
|||
{
|
||||
TRACE("(%p)->(%08x %p %p)\n", This, cmdexecopt, in, out);
|
||||
|
||||
if(This->usermode == EDITMODE)
|
||||
if(This->doc_obj->usermode == EDITMODE)
|
||||
return editor_exec_paste(This, cmdexecopt, in, out);
|
||||
|
||||
FIXME("Unimplemented in browse mode\n");
|
||||
|
@ -520,7 +523,7 @@ static HRESULT exec_browsemode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in
|
|||
if(in || out)
|
||||
FIXME("unsupported args\n");
|
||||
|
||||
This->usermode = BROWSEMODE;
|
||||
This->doc_obj->usermode = BROWSEMODE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -535,29 +538,29 @@ static HRESULT exec_editmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
|
|||
if(in || out)
|
||||
FIXME("unsupported args\n");
|
||||
|
||||
if(This->usermode == EDITMODE)
|
||||
if(This->doc_obj->usermode == EDITMODE)
|
||||
return S_OK;
|
||||
|
||||
This->usermode = EDITMODE;
|
||||
This->doc_obj->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));
|
||||
}
|
||||
}
|
||||
|
||||
if(This->frame)
|
||||
IOleInPlaceFrame_SetStatusText(This->frame, NULL);
|
||||
if(This->doc_obj->frame)
|
||||
IOleInPlaceFrame_SetStatusText(This->doc_obj->frame, NULL);
|
||||
|
||||
This->readystate = READYSTATE_UNINITIALIZED;
|
||||
This->doc_obj->readystate = READYSTATE_UNINITIALIZED;
|
||||
|
||||
if(This->client) {
|
||||
if(This->doc_obj->client) {
|
||||
IOleCommandTarget *cmdtrg;
|
||||
|
||||
hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget,
|
||||
hres = IOleClientSite_QueryInterface(This->doc_obj->client, &IID_IOleCommandTarget,
|
||||
(void**)&cmdtrg);
|
||||
if(SUCCEEDED(hres)) {
|
||||
VARIANT var;
|
||||
|
@ -570,12 +573,12 @@ static HRESULT exec_editmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
|
|||
}
|
||||
}
|
||||
|
||||
if(This->hostui) {
|
||||
if(This->doc_obj->hostui) {
|
||||
DOCHOSTUIINFO hostinfo;
|
||||
|
||||
memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
|
||||
hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
|
||||
hres = IDocHostUIHandler_GetHostInfo(This->hostui, &hostinfo);
|
||||
hres = IDocHostUIHandler_GetHostInfo(This->doc_obj->hostui, &hostinfo);
|
||||
if(SUCCEEDED(hres))
|
||||
/* FIXME: use hostinfo */
|
||||
TRACE("hostinfo = {%u %08x %08x %s %s}\n",
|
||||
|
@ -585,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};
|
||||
|
@ -606,29 +609,29 @@ static HRESULT exec_editmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(This->ui_active) {
|
||||
if(This->ip_window)
|
||||
call_set_active_object(This->ip_window, NULL);
|
||||
if(This->hostui)
|
||||
IDocHostUIHandler_HideUI(This->hostui);
|
||||
if(This->doc_obj->ui_active) {
|
||||
if(This->doc_obj->ip_window)
|
||||
call_set_active_object(This->doc_obj->ip_window, NULL);
|
||||
if(This->doc_obj->hostui)
|
||||
IDocHostUIHandler_HideUI(This->doc_obj->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) {
|
||||
if(This->doc_obj->ui_active) {
|
||||
RECT rcBorderWidths;
|
||||
|
||||
if(This->hostui)
|
||||
IDocHostUIHandler_ShowUI(This->hostui, DOCHOSTUITYPE_AUTHOR, ACTOBJ(This), CMDTARGET(This),
|
||||
This->frame, This->ip_window);
|
||||
if(This->doc_obj->hostui)
|
||||
IDocHostUIHandler_ShowUI(This->doc_obj->hostui, DOCHOSTUITYPE_AUTHOR, ACTOBJ(This), CMDTARGET(This),
|
||||
This->doc_obj->frame, This->doc_obj->ip_window);
|
||||
|
||||
if(This->ip_window)
|
||||
call_set_active_object(This->ip_window, ACTOBJ(This));
|
||||
if(This->doc_obj->ip_window)
|
||||
call_set_active_object(This->doc_obj->ip_window, ACTOBJ(This));
|
||||
|
||||
memset(&rcBorderWidths, 0, sizeof(rcBorderWidths));
|
||||
if (This->frame)
|
||||
IOleInPlaceFrame_SetBorderSpace(This->frame, &rcBorderWidths);
|
||||
if(This->doc_obj->frame)
|
||||
IOleInPlaceFrame_SetBorderSpace(This->doc_obj->frame, &rcBorderWidths);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
@ -789,8 +792,8 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con
|
|||
OLECMD olecmd;
|
||||
|
||||
prgCmds[i].cmdf = OLECMDF_SUPPORTED;
|
||||
if(This->client) {
|
||||
hr = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget,
|
||||
if(This->doc_obj->client) {
|
||||
hr = IOleClientSite_QueryInterface(This->doc_obj->client, &IID_IOleCommandTarget,
|
||||
(void**)&cmdtrg);
|
||||
if(SUCCEEDED(hr)) {
|
||||
olecmd.cmdID = prgCmds[i].cmdID;
|
||||
|
@ -894,14 +897,14 @@ static const IOleCommandTargetVtbl OleCommandTargetVtbl = {
|
|||
OleCommandTarget_Exec
|
||||
};
|
||||
|
||||
void show_context_menu(HTMLDocument *This, DWORD dwID, POINT *ppt, IDispatch *elem)
|
||||
void show_context_menu(HTMLDocumentObj *This, DWORD dwID, POINT *ppt, IDispatch *elem)
|
||||
{
|
||||
HMENU menu_res, menu;
|
||||
DWORD cmdid;
|
||||
HRESULT hres;
|
||||
|
||||
hres = IDocHostUIHandler_ShowContextMenu(This->hostui, dwID, ppt,
|
||||
(IUnknown*)CMDTARGET(This), elem);
|
||||
(IUnknown*)CMDTARGET(&This->basedoc), elem);
|
||||
if(hres == S_OK)
|
||||
return;
|
||||
|
||||
|
@ -913,7 +916,7 @@ void show_context_menu(HTMLDocument *This, DWORD dwID, POINT *ppt, IDispatch *el
|
|||
DestroyMenu(menu_res);
|
||||
|
||||
if(cmdid)
|
||||
IOleCommandTarget_Exec(CMDTARGET(This), &CGID_MSHTML, cmdid, 0, NULL, NULL);
|
||||
IOleCommandTarget_Exec(CMDTARGET(&This->basedoc), &CGID_MSHTML, cmdid, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
void HTMLDocument_OleCmd_Init(HTMLDocument *This)
|
||||
|
|
|
@ -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;
|
||||
|
@ -97,21 +97,21 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
|
|||
|
||||
TRACE("(%p)->(%p)\n", This, pClientSite);
|
||||
|
||||
if(pClientSite == This->client)
|
||||
if(pClientSite == This->doc_obj->client)
|
||||
return S_OK;
|
||||
|
||||
if(This->client) {
|
||||
IOleClientSite_Release(This->client);
|
||||
This->client = NULL;
|
||||
This->usermode = UNKNOWN_USERMODE;
|
||||
if(This->doc_obj->client) {
|
||||
IOleClientSite_Release(This->doc_obj->client);
|
||||
This->doc_obj->client = NULL;
|
||||
This->doc_obj->usermode = UNKNOWN_USERMODE;
|
||||
}
|
||||
|
||||
if(This->hostui) {
|
||||
IDocHostUIHandler_Release(This->hostui);
|
||||
This->hostui = NULL;
|
||||
if(This->doc_obj->hostui) {
|
||||
IDocHostUIHandler_Release(This->doc_obj->hostui);
|
||||
This->doc_obj->hostui = NULL;
|
||||
}
|
||||
|
||||
memset(&This->hostinfo, 0, sizeof(DOCHOSTUIINFO));
|
||||
memset(&This->doc_obj->hostinfo, 0, sizeof(DOCHOSTUIINFO));
|
||||
|
||||
if(!pClientSite)
|
||||
return S_OK;
|
||||
|
@ -129,11 +129,11 @@ 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);
|
||||
This->hostinfo = hostinfo;
|
||||
update_hostinfo(This->doc_obj, &hostinfo);
|
||||
This->doc_obj->hostinfo = hostinfo;
|
||||
}
|
||||
|
||||
if(!This->has_key_path) {
|
||||
if(!This->doc_obj->has_key_path) {
|
||||
hres = IDocHostUIHandler_GetOptionKeyPath(pDocHostUIHandler, &key_path, 0);
|
||||
if(hres == S_OK && key_path) {
|
||||
if(key_path[0]) {
|
||||
|
@ -157,7 +157,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
|
|||
IDocHostUIHandler2_Release(pDocHostUIHandler2);
|
||||
}
|
||||
|
||||
This->has_key_path = TRUE;
|
||||
This->doc_obj->has_key_path = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,15 +192,15 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
|
|||
}
|
||||
|
||||
IOleClientSite_AddRef(pClientSite);
|
||||
This->client = pClientSite;
|
||||
This->hostui = pDocHostUIHandler;
|
||||
This->doc_obj->client = pClientSite;
|
||||
This->doc_obj->hostui = pDocHostUIHandler;
|
||||
|
||||
if(This->usermode == UNKNOWN_USERMODE)
|
||||
if(This->doc_obj->usermode == UNKNOWN_USERMODE)
|
||||
IOleControl_OnAmbientPropertyChange(CONTROL(This), DISPID_AMBIENT_USERMODE);
|
||||
|
||||
IOleControl_OnAmbientPropertyChange(CONTROL(This), DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
|
||||
|
||||
hres = get_client_disp_property(This->client, DISPID_AMBIENT_SILENT, &silent);
|
||||
hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_SILENT, &silent);
|
||||
if(SUCCEEDED(hres)) {
|
||||
if(V_VT(&silent) != VT_BOOL)
|
||||
WARN("V_VT(silent) = %d\n", V_VT(&silent));
|
||||
|
@ -223,9 +223,9 @@ static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, IOleClientSite
|
|||
if(!ppClientSite)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if(This->client)
|
||||
IOleClientSite_AddRef(This->client);
|
||||
*ppClientSite = This->client;
|
||||
if(This->doc_obj->client)
|
||||
IOleClientSite_AddRef(This->doc_obj->client);
|
||||
*ppClientSite = This->doc_obj->client;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -246,10 +246,10 @@ static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
|
|||
if(dwSaveOption == OLECLOSE_PROMPTSAVE)
|
||||
FIXME("OLECLOSE_PROMPTSAVE not implemented\n");
|
||||
|
||||
if(This->in_place_active)
|
||||
if(This->doc_obj->in_place_active)
|
||||
IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This));
|
||||
|
||||
HTMLDocument_LockContainer(This, FALSE);
|
||||
HTMLDocument_LockContainer(This->doc_obj, FALSE);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -298,11 +298,11 @@ static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, LPMSG lpms
|
|||
}
|
||||
|
||||
if(!pActiveSite)
|
||||
pActiveSite = This->client;
|
||||
pActiveSite = This->doc_obj->client;
|
||||
|
||||
hres = IOleClientSite_QueryInterface(pActiveSite, &IID_IOleDocumentSite, (void**)&pDocSite);
|
||||
if(SUCCEEDED(hres)) {
|
||||
HTMLDocument_LockContainer(This, TRUE);
|
||||
HTMLDocument_LockContainer(This->doc_obj, TRUE);
|
||||
|
||||
/* FIXME: Create new IOleDocumentView. See CreateView for more info. */
|
||||
hres = IOleDocumentSite_ActivateMe(pDocSite, DOCVIEW(This));
|
||||
|
@ -589,7 +589,7 @@ static HRESULT on_change_dlcontrol(HTMLDocument *This)
|
|||
VARIANT res;
|
||||
HRESULT hres;
|
||||
|
||||
hres = get_client_disp_property(This->client, DISPID_AMBIENT_DLCONTROL, &res);
|
||||
hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_DLCONTROL, &res);
|
||||
if(SUCCEEDED(hres))
|
||||
FIXME("unsupported dlcontrol %08x\n", V_I4(&res));
|
||||
|
||||
|
@ -599,27 +599,29 @@ static HRESULT on_change_dlcontrol(HTMLDocument *This)
|
|||
static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DISPID dispID)
|
||||
{
|
||||
HTMLDocument *This = CONTROL_THIS(iface);
|
||||
IOleClientSite *client;
|
||||
VARIANT res;
|
||||
HRESULT hres;
|
||||
|
||||
if(!This->client) {
|
||||
TRACE("This->client = NULL\n");
|
||||
client = This->doc_obj->client;
|
||||
if(!client) {
|
||||
TRACE("client = NULL\n");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
switch(dispID) {
|
||||
case DISPID_AMBIENT_USERMODE:
|
||||
TRACE("(%p)->(DISPID_AMBIENT_USERMODE)\n", This);
|
||||
hres = get_client_disp_property(This->client, DISPID_AMBIENT_USERMODE, &res);
|
||||
hres = get_client_disp_property(client, DISPID_AMBIENT_USERMODE, &res);
|
||||
if(FAILED(hres))
|
||||
return S_OK;
|
||||
|
||||
if(V_VT(&res) == VT_BOOL) {
|
||||
if(V_BOOL(&res)) {
|
||||
This->usermode = BROWSEMODE;
|
||||
This->doc_obj->usermode = BROWSEMODE;
|
||||
}else {
|
||||
FIXME("edit mode is not supported\n");
|
||||
This->usermode = EDITMODE;
|
||||
This->doc_obj->usermode = EDITMODE;
|
||||
}
|
||||
}else {
|
||||
FIXME("V_VT(res)=%d\n", V_VT(&res));
|
||||
|
@ -631,7 +633,7 @@ static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DIS
|
|||
case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
|
||||
TRACE("(%p)->(DISPID_AMBIENT_OFFLINEIFNOTCONNECTED)\n", This);
|
||||
on_change_dlcontrol(This);
|
||||
hres = get_client_disp_property(This->client, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED, &res);
|
||||
hres = get_client_disp_property(client, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED, &res);
|
||||
if(FAILED(hres))
|
||||
return S_OK;
|
||||
|
||||
|
@ -647,7 +649,7 @@ static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DIS
|
|||
case DISPID_AMBIENT_SILENT:
|
||||
TRACE("(%p)->(DISPID_AMBIENT_SILENT)\n", This);
|
||||
on_change_dlcontrol(This);
|
||||
hres = get_client_disp_property(This->client, DISPID_AMBIENT_SILENT, &res);
|
||||
hres = get_client_disp_property(client, DISPID_AMBIENT_SILENT, &res);
|
||||
if(FAILED(hres))
|
||||
return S_OK;
|
||||
|
||||
|
@ -662,7 +664,7 @@ static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DIS
|
|||
return S_OK;
|
||||
case DISPID_AMBIENT_USERAGENT:
|
||||
TRACE("(%p)->(DISPID_AMBIENT_USERAGENT)\n", This);
|
||||
hres = get_client_disp_property(This->client, DISPID_AMBIENT_USERAGENT, &res);
|
||||
hres = get_client_disp_property(client, DISPID_AMBIENT_USERAGENT, &res);
|
||||
if(FAILED(hres))
|
||||
return S_OK;
|
||||
|
||||
|
@ -671,7 +673,7 @@ static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DIS
|
|||
return S_OK;
|
||||
case DISPID_AMBIENT_PALETTE:
|
||||
TRACE("(%p)->(DISPID_AMBIENT_PALETTE)\n", This);
|
||||
hres = get_client_disp_property(This->client, DISPID_AMBIENT_PALETTE, &res);
|
||||
hres = get_client_disp_property(client, DISPID_AMBIENT_PALETTE, &res);
|
||||
if(FAILED(hres))
|
||||
return S_OK;
|
||||
|
||||
|
@ -703,47 +705,7 @@ static const IOleControlVtbl OleControlVtbl = {
|
|||
OleControl_FreezeEvents
|
||||
};
|
||||
|
||||
/**********************************************************
|
||||
* ICustomDoc implementation
|
||||
*/
|
||||
|
||||
#define CUSTOMDOC_THIS(iface) DEFINE_THIS(HTMLDocument, CustomDoc, iface)
|
||||
|
||||
static HRESULT WINAPI CustomDoc_QueryInterface(ICustomDoc *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
HTMLDocument *This = CUSTOMDOC_THIS(iface);
|
||||
return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
|
||||
}
|
||||
|
||||
static ULONG WINAPI CustomDoc_AddRef(ICustomDoc *iface)
|
||||
{
|
||||
HTMLDocument *This = CUSTOMDOC_THIS(iface);
|
||||
return IHTMLDocument2_AddRef(HTMLDOC(This));
|
||||
}
|
||||
|
||||
static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
|
||||
{
|
||||
HTMLDocument *This = CUSTOMDOC_THIS(iface);
|
||||
return IHTMLDocument_Release(HTMLDOC(This));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI CustomDoc_SetUIHandler(ICustomDoc *iface, IDocHostUIHandler *pUIHandler)
|
||||
{
|
||||
HTMLDocument *This = CUSTOMDOC_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, pUIHandler);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
#undef CUSTOMDOC_THIS
|
||||
|
||||
static const ICustomDocVtbl CustomDocVtbl = {
|
||||
CustomDoc_QueryInterface,
|
||||
CustomDoc_AddRef,
|
||||
CustomDoc_Release,
|
||||
CustomDoc_SetUIHandler
|
||||
};
|
||||
|
||||
void HTMLDocument_LockContainer(HTMLDocument *This, BOOL fLock)
|
||||
void HTMLDocument_LockContainer(HTMLDocumentObj *This, BOOL fLock)
|
||||
{
|
||||
IOleContainer *container;
|
||||
HRESULT hres;
|
||||
|
@ -764,15 +726,4 @@ void HTMLDocument_OleObj_Init(HTMLDocument *This)
|
|||
This->lpOleObjectVtbl = &OleObjectVtbl;
|
||||
This->lpOleDocumentVtbl = &OleDocumentVtbl;
|
||||
This->lpOleControlVtbl = &OleControlVtbl;
|
||||
This->lpCustomDocVtbl = &CustomDocVtbl;
|
||||
|
||||
This->usermode = UNKNOWN_USERMODE;
|
||||
|
||||
This->client = NULL;
|
||||
This->hostui = NULL;
|
||||
|
||||
This->has_key_path = FALSE;
|
||||
This->container_locked = FALSE;
|
||||
|
||||
memset(&This->hostinfo, 0, sizeof(DOCHOSTUIINFO));
|
||||
}
|
||||
|
|
|
@ -68,12 +68,12 @@ static HRESULT WINAPI OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *
|
|||
if(!phwnd)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if(!This->in_place_active) {
|
||||
if(!This->doc_obj->in_place_active) {
|
||||
*phwnd = NULL;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
*phwnd = This->hwnd;
|
||||
*phwnd = This->doc_obj->hwnd;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -98,8 +98,8 @@ static HRESULT WINAPI OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceAc
|
|||
|
||||
TRACE("(%p)->(%x)\n", This, fActivate);
|
||||
|
||||
if(This->hostui)
|
||||
IDocHostUIHandler_OnFrameWindowActivate(This->hostui, fActivate);
|
||||
if(This->doc_obj->hostui)
|
||||
IDocHostUIHandler_OnFrameWindowActivate(This->doc_obj->hostui, fActivate);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -186,35 +186,35 @@ static HRESULT WINAPI OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceOb
|
|||
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
if(This->ui_active)
|
||||
if(This->doc_obj->ui_active)
|
||||
IOleDocumentView_UIActivate(DOCVIEW(This), FALSE);
|
||||
This->window_active = FALSE;
|
||||
This->doc_obj->window_active = FALSE;
|
||||
|
||||
if(!This->in_place_active)
|
||||
if(!This->doc_obj->in_place_active)
|
||||
return S_OK;
|
||||
|
||||
if(This->frame)
|
||||
IOleInPlaceFrame_Release(This->frame);
|
||||
if(This->doc_obj->frame)
|
||||
IOleInPlaceFrame_Release(This->doc_obj->frame);
|
||||
|
||||
if(This->hwnd) {
|
||||
ShowWindow(This->hwnd, SW_HIDE);
|
||||
SetWindowPos(This->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
|
||||
if(This->doc_obj->hwnd) {
|
||||
ShowWindow(This->doc_obj->hwnd, SW_HIDE);
|
||||
SetWindowPos(This->doc_obj->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
|
||||
}
|
||||
|
||||
This->focus = FALSE;
|
||||
notif_focus(This);
|
||||
This->doc_obj->focus = FALSE;
|
||||
notif_focus(This->doc_obj);
|
||||
|
||||
This->in_place_active = FALSE;
|
||||
if(This->ipsite) {
|
||||
This->doc_obj->in_place_active = FALSE;
|
||||
if(This->doc_obj->ipsite) {
|
||||
IOleInPlaceSiteEx *ipsiteex;
|
||||
HRESULT hres;
|
||||
|
||||
hres = IOleInPlaceSite_QueryInterface(This->ipsite, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex);
|
||||
hres = IOleInPlaceSite_QueryInterface(This->doc_obj->ipsite, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex);
|
||||
if(SUCCEEDED(hres)) {
|
||||
IOleInPlaceSiteEx_OnInPlaceDeactivateEx(ipsiteex, TRUE);
|
||||
IOleInPlaceSiteEx_Release(ipsiteex);
|
||||
}else {
|
||||
IOleInPlaceSite_OnInPlaceDeactivate(This->ipsite);
|
||||
IOleInPlaceSite_OnInPlaceDeactivate(This->doc_obj->ipsite);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,34 +42,37 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|||
static BOOL use_gecko_script(LPCWSTR url)
|
||||
{
|
||||
static const WCHAR fileW[] = {'f','i','l','e',':'};
|
||||
return strncmpiW(fileW, url, sizeof(fileW)/sizeof(WCHAR));
|
||||
static const WCHAR aboutW[] = {'a','b','o','u','t',':'};
|
||||
|
||||
return strncmpiW(fileW, url, sizeof(fileW)/sizeof(WCHAR))
|
||||
&& strncmpiW(aboutW, url, sizeof(aboutW)/sizeof(WCHAR));
|
||||
}
|
||||
|
||||
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, 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)
|
||||
|
@ -110,11 +113,11 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO
|
|||
}
|
||||
}
|
||||
|
||||
This->readystate = READYSTATE_LOADING;
|
||||
This->doc_obj->readystate = READYSTATE_LOADING;
|
||||
call_property_onchanged(&This->cp_propnotif, DISPID_READYSTATE);
|
||||
update_doc(This, UPDATE_TITLE);
|
||||
|
||||
HTMLDocument_LockContainer(This, TRUE);
|
||||
HTMLDocument_LockContainer(This->doc_obj, TRUE);
|
||||
|
||||
hres = IMoniker_GetDisplayName(mon, pibc, NULL, &url);
|
||||
if(FAILED(hres)) {
|
||||
|
@ -126,11 +129,11 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO
|
|||
|
||||
set_current_mon(This, mon);
|
||||
|
||||
if(This->client) {
|
||||
if(This->doc_obj->client) {
|
||||
VARIANT silent, offline;
|
||||
IOleCommandTarget *cmdtrg = NULL;
|
||||
|
||||
hres = get_client_disp_property(This->client, DISPID_AMBIENT_SILENT, &silent);
|
||||
hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_SILENT, &silent);
|
||||
if(SUCCEEDED(hres)) {
|
||||
if(V_VT(&silent) != VT_BOOL)
|
||||
WARN("V_VT(silent) = %d\n", V_VT(&silent));
|
||||
|
@ -138,7 +141,7 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO
|
|||
FIXME("silent == true\n");
|
||||
}
|
||||
|
||||
hres = get_client_disp_property(This->client,
|
||||
hres = get_client_disp_property(This->doc_obj->client,
|
||||
DISPID_AMBIENT_OFFLINEIFNOTCONNECTED, &offline);
|
||||
if(SUCCEEDED(hres)) {
|
||||
if(V_VT(&silent) != VT_BOOL)
|
||||
|
@ -147,7 +150,7 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO
|
|||
FIXME("offline == true\n");
|
||||
}
|
||||
|
||||
hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget,
|
||||
hres = IOleClientSite_QueryInterface(This->doc_obj->client, &IID_IOleCommandTarget,
|
||||
(void**)&cmdtrg);
|
||||
if(SUCCEEDED(hres)) {
|
||||
VARIANT var;
|
||||
|
@ -162,7 +165,7 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO
|
|||
|
||||
bscallback = create_channelbsc(mon);
|
||||
|
||||
if(This->frame) {
|
||||
if(This->doc_obj->frame) {
|
||||
task = heap_alloc(sizeof(task_t));
|
||||
|
||||
task->doc = This;
|
||||
|
@ -180,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);
|
||||
|
@ -289,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;
|
||||
}
|
||||
|
@ -315,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;
|
||||
}
|
||||
|
||||
|
@ -367,8 +370,8 @@ static HRESULT WINAPI MonikerProp_PutProperty(IMonikerProp *iface, MONIKERPROPER
|
|||
|
||||
switch(mkp) {
|
||||
case MIMETYPEPROP:
|
||||
heap_free(This->mime);
|
||||
This->mime = heap_strdupW(val);
|
||||
heap_free(This->doc_obj->mime);
|
||||
This->doc_obj->mime = heap_strdupW(val);
|
||||
break;
|
||||
|
||||
case CLASSIDPROP:
|
||||
|
@ -526,7 +529,7 @@ static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface)
|
|||
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
if(This->usermode == EDITMODE)
|
||||
if(This->doc_obj->usermode == EDITMODE)
|
||||
return editor_is_dirty(This);
|
||||
|
||||
return S_FALSE;
|
||||
|
@ -553,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,
|
||||
|
@ -689,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;
|
||||
}
|
||||
|
|
|
@ -938,6 +938,89 @@ static ProtocolFactory ResProtocolFactory = {
|
|||
&ResProtocolFactoryVtbl
|
||||
};
|
||||
|
||||
/********************************************************************
|
||||
* JSProtocol implementation
|
||||
*/
|
||||
|
||||
static HRESULT WINAPI JSProtocolFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter,
|
||||
REFIID riid, void **ppv)
|
||||
{
|
||||
FIXME("(%p)->(%p %s %p)\n", iface, pUnkOuter, debugstr_guid(riid), ppv);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI JSProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
|
||||
PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
|
||||
DWORD* pcchResult, DWORD dwReserved)
|
||||
{
|
||||
TRACE("%p)->(%s %d %x %p %d %p %d)\n", iface, debugstr_w(pwzUrl), ParseAction,
|
||||
dwParseFlags, pwzResult, cchResult, pcchResult, dwReserved);
|
||||
|
||||
switch(ParseAction) {
|
||||
case PARSE_SECURITY_URL:
|
||||
FIXME("PARSE_SECURITY_URL\n");
|
||||
return E_NOTIMPL;
|
||||
case PARSE_DOMAIN:
|
||||
FIXME("PARSE_DOMAIN\n");
|
||||
return E_NOTIMPL;
|
||||
default:
|
||||
return INET_E_DEFAULT_ACTION;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI JSProtocolInfo_QueryInfo(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
|
||||
QUERYOPTION QueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD* pcbBuf,
|
||||
DWORD dwReserved)
|
||||
{
|
||||
TRACE("%p)->(%s %08x %08x %p %d %p %d)\n", iface, debugstr_w(pwzUrl), QueryOption, dwQueryFlags, pBuffer,
|
||||
cbBuffer, pcbBuf, dwReserved);
|
||||
|
||||
switch(QueryOption) {
|
||||
case QUERY_USES_NETWORK:
|
||||
if(!pBuffer || cbBuffer < sizeof(DWORD))
|
||||
return E_FAIL;
|
||||
|
||||
*(DWORD*)pBuffer = 0;
|
||||
if(pcbBuf)
|
||||
*pcbBuf = sizeof(DWORD);
|
||||
break;
|
||||
|
||||
case QUERY_IS_SECURE:
|
||||
FIXME("not supporte QUERY_IS_SECURE\n");
|
||||
return E_NOTIMPL;
|
||||
|
||||
default:
|
||||
return INET_E_USE_DEFAULT_PROTOCOLHANDLER;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IInternetProtocolInfoVtbl JSProtocolInfoVtbl = {
|
||||
InternetProtocolInfo_QueryInterface,
|
||||
InternetProtocolInfo_AddRef,
|
||||
InternetProtocolInfo_Release,
|
||||
JSProtocolInfo_ParseUrl,
|
||||
InternetProtocolInfo_CombineUrl,
|
||||
InternetProtocolInfo_CompareUrl,
|
||||
JSProtocolInfo_QueryInfo
|
||||
};
|
||||
|
||||
static const IClassFactoryVtbl JSProtocolFactoryVtbl = {
|
||||
ClassFactory_QueryInterface,
|
||||
ClassFactory_AddRef,
|
||||
ClassFactory_Release,
|
||||
JSProtocolFactory_CreateInstance,
|
||||
ClassFactory_LockServer
|
||||
};
|
||||
|
||||
static ProtocolFactory JSProtocolFactory = {
|
||||
&JSProtocolInfoVtbl,
|
||||
&JSProtocolFactoryVtbl
|
||||
};
|
||||
|
||||
HRESULT ProtocolFactory_Create(REFCLSID rclsid, REFIID riid, void **ppv)
|
||||
{
|
||||
ProtocolFactory *cf = NULL;
|
||||
|
@ -946,6 +1029,8 @@ HRESULT ProtocolFactory_Create(REFCLSID rclsid, REFIID riid, void **ppv)
|
|||
cf = &AboutProtocolFactory;
|
||||
else if(IsEqualGUID(&CLSID_ResProtocol, rclsid))
|
||||
cf = &ResProtocolFactory;
|
||||
else if(IsEqualGUID(&CLSID_JSProtocol, rclsid))
|
||||
cf = &JSProtocolFactory;
|
||||
|
||||
if(!cf) {
|
||||
FIXME("not implemented protocol %s\n", debugstr_guid(rclsid));
|
||||
|
|
|
@ -42,11 +42,12 @@ static const WCHAR emptyW[] = {0};
|
|||
static const CLSID CLSID_JScript =
|
||||
{0xf414c260,0x6ac0,0x11cf,{0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58}};
|
||||
|
||||
typedef struct {
|
||||
struct ScriptHost {
|
||||
const IActiveScriptSiteVtbl *lpIActiveScriptSiteVtbl;
|
||||
const IActiveScriptSiteInterruptPollVtbl *lpIActiveScriptSiteInterruptPollVtbl;
|
||||
const IActiveScriptSiteWindowVtbl *lpIActiveScriptSiteWindowVtbl;
|
||||
const IActiveScriptSiteDebug32Vtbl *lpIActiveScriptSiteDebug32Vtbl;
|
||||
const IServiceProviderVtbl *lpServiceProviderVtbl;
|
||||
|
||||
LONG ref;
|
||||
|
||||
|
@ -56,11 +57,11 @@ typedef struct {
|
|||
|
||||
SCRIPTSTATE script_state;
|
||||
|
||||
HTMLDocument *doc;
|
||||
HTMLWindow *window;
|
||||
|
||||
GUID guid;
|
||||
struct list entry;
|
||||
} ScriptHost;
|
||||
};
|
||||
|
||||
#define ACTSCPSITE(x) ((IActiveScriptSite*) &(x)->lpIActiveScriptSiteVtbl)
|
||||
#define ACTSCPPOLL(x) (&(x)->lpIActiveScriptSiteInterruptPollVtbl)
|
||||
|
@ -206,11 +207,11 @@ static void release_script_engine(ScriptHost *This)
|
|||
This->script_state = SCRIPTSTATE_UNINITIALIZED;
|
||||
}
|
||||
|
||||
void connect_scripts(HTMLDocument *doc)
|
||||
void connect_scripts(HTMLWindow *window)
|
||||
{
|
||||
ScriptHost *iter;
|
||||
|
||||
LIST_FOR_EACH_ENTRY(iter, &doc->script_hosts, ScriptHost, entry) {
|
||||
LIST_FOR_EACH_ENTRY(iter, &window->script_hosts, ScriptHost, entry) {
|
||||
if(iter->script_state == SCRIPTSTATE_STARTED)
|
||||
IActiveScript_SetScriptState(iter->script, SCRIPTSTATE_CONNECTED);
|
||||
}
|
||||
|
@ -239,6 +240,9 @@ static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface,
|
|||
}else if(IsEqualGUID(&IID_IActiveScriptSiteDebug32, riid)) {
|
||||
TRACE("(%p)->(IID_IActiveScriptSiteDebug32 %p)\n", This, ppv);
|
||||
*ppv = ACTSCPDBG32(This);
|
||||
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
|
||||
TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
|
||||
*ppv = SERVPROV(This);
|
||||
}else if(IsEqualGUID(&IID_ICanHandleException, riid)) {
|
||||
TRACE("(%p)->(IID_ICanHandleException not supported %p)\n", This, ppv);
|
||||
return E_NOINTERFACE;
|
||||
|
@ -270,7 +274,7 @@ static ULONG WINAPI ActiveScriptSite_Release(IActiveScriptSite *iface)
|
|||
|
||||
if(!ref) {
|
||||
release_script_engine(This);
|
||||
if(This->doc)
|
||||
if(This->window)
|
||||
list_remove(&This->entry);
|
||||
heap_free(This);
|
||||
}
|
||||
|
@ -305,11 +309,11 @@ static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPC
|
|||
if(strcmpW(pstrName, windowW))
|
||||
return DISP_E_MEMBERNOTFOUND;
|
||||
|
||||
if(!This->doc)
|
||||
if(!This->window)
|
||||
return E_FAIL;
|
||||
|
||||
/* FIXME: Return proxy object */
|
||||
*ppiunkItem = (IUnknown*)HTMLWINDOW2(This->doc->window);
|
||||
*ppiunkItem = (IUnknown*)HTMLWINDOW2(This->window);
|
||||
IUnknown_AddRef(*ppiunkItem);
|
||||
|
||||
return S_OK;
|
||||
|
@ -529,7 +533,54 @@ static const IActiveScriptSiteDebug32Vtbl ActiveScriptSiteDebug32Vtbl = {
|
|||
ActiveScriptSiteDebug32_OnScriptErrorDebug
|
||||
};
|
||||
|
||||
static ScriptHost *create_script_host(HTMLDocument *doc, const GUID *guid)
|
||||
#define SERVPROV_THIS(iface) DEFINE_THIS(ScriptHost, ServiceProvider, iface)
|
||||
|
||||
static HRESULT WINAPI ASServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
ScriptHost *This = SERVPROV_THIS(iface);
|
||||
return IActiveScriptSite_QueryInterface(ACTSCPSITE(This), riid, ppv);
|
||||
}
|
||||
|
||||
static ULONG WINAPI ASServiceProvider_AddRef(IServiceProvider *iface)
|
||||
{
|
||||
ScriptHost *This = SERVPROV_THIS(iface);
|
||||
return IActiveScriptSite_AddRef(ACTSCPSITE(This));
|
||||
}
|
||||
|
||||
static ULONG WINAPI ASServiceProvider_Release(IServiceProvider *iface)
|
||||
{
|
||||
ScriptHost *This = SERVPROV_THIS(iface);
|
||||
return IActiveScriptSite_Release(ACTSCPSITE(This));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ASServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
|
||||
REFIID riid, void **ppv)
|
||||
{
|
||||
ScriptHost *This = SERVPROV_THIS(iface);
|
||||
|
||||
if(IsEqualGUID(&SID_SInternetHostSecurityManager, guidService)) {
|
||||
TRACE("(%p)->(SID_SInternetHostSecurityManager)\n", This);
|
||||
|
||||
if(!This->window || !This->window->doc)
|
||||
return E_NOINTERFACE;
|
||||
|
||||
return IInternetHostSecurityManager_QueryInterface(HOSTSECMGR(This->window->doc), riid, ppv);
|
||||
}
|
||||
|
||||
FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
#undef SERVPROV_THIS
|
||||
|
||||
static const IServiceProviderVtbl ASServiceProviderVtbl = {
|
||||
ASServiceProvider_QueryInterface,
|
||||
ASServiceProvider_AddRef,
|
||||
ASServiceProvider_Release,
|
||||
ASServiceProvider_QueryService
|
||||
};
|
||||
|
||||
static ScriptHost *create_script_host(HTMLWindow *window, const GUID *guid)
|
||||
{
|
||||
ScriptHost *ret;
|
||||
HRESULT hres;
|
||||
|
@ -539,12 +590,13 @@ static ScriptHost *create_script_host(HTMLDocument *doc, const GUID *guid)
|
|||
ret->lpIActiveScriptSiteInterruptPollVtbl = &ActiveScriptSiteInterruptPollVtbl;
|
||||
ret->lpIActiveScriptSiteWindowVtbl = &ActiveScriptSiteWindowVtbl;
|
||||
ret->lpIActiveScriptSiteDebug32Vtbl = &ActiveScriptSiteDebug32Vtbl;
|
||||
ret->lpServiceProviderVtbl = &ASServiceProviderVtbl;
|
||||
ret->ref = 1;
|
||||
ret->doc = doc;
|
||||
ret->window = window;
|
||||
ret->script_state = SCRIPTSTATE_UNINITIALIZED;
|
||||
|
||||
ret->guid = *guid;
|
||||
list_add_tail(&doc->script_hosts, &ret->entry);
|
||||
list_add_tail(&window->script_hosts, &ret->entry);
|
||||
|
||||
hres = CoCreateInstance(&ret->guid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||
&IID_IActiveScript, (void**)&ret->script);
|
||||
|
@ -593,7 +645,7 @@ static void parse_extern_script(ScriptHost *script_host, LPCWSTR src)
|
|||
if(FAILED(hres))
|
||||
return;
|
||||
|
||||
hres = bind_mon_to_buffer(script_host->doc, mon, (void**)&buf, &size);
|
||||
hres = bind_mon_to_buffer(&script_host->window->doc_obj->basedoc, mon, (void**)&buf, &size);
|
||||
IMoniker_Release(mon);
|
||||
if(FAILED(hres))
|
||||
return;
|
||||
|
@ -727,24 +779,24 @@ static BOOL get_script_guid(nsIDOMHTMLScriptElement *nsscript, GUID *guid)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static ScriptHost *get_script_host(HTMLDocument *doc, const GUID *guid)
|
||||
static ScriptHost *get_script_host(HTMLWindow *window, const GUID *guid)
|
||||
{
|
||||
ScriptHost *iter;
|
||||
|
||||
if(IsEqualGUID(&CLSID_JScript, guid) && doc->scriptmode != SCRIPTMODE_ACTIVESCRIPT) {
|
||||
if(IsEqualGUID(&CLSID_JScript, guid) && window->scriptmode != SCRIPTMODE_ACTIVESCRIPT) {
|
||||
TRACE("Ignoring JScript\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LIST_FOR_EACH_ENTRY(iter, &doc->script_hosts, ScriptHost, entry) {
|
||||
LIST_FOR_EACH_ENTRY(iter, &window->script_hosts, ScriptHost, entry) {
|
||||
if(IsEqualGUID(guid, &iter->guid))
|
||||
return iter;
|
||||
}
|
||||
|
||||
return create_script_host(doc, 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 +806,7 @@ void doc_insert_script(HTMLDocument *doc, nsIDOMHTMLScriptElement *nsscript)
|
|||
return;
|
||||
}
|
||||
|
||||
script_host = get_script_host(doc, &guid);
|
||||
script_host = get_script_host(window, &guid);
|
||||
if(!script_host)
|
||||
return;
|
||||
|
||||
|
@ -762,7 +814,7 @@ void doc_insert_script(HTMLDocument *doc, nsIDOMHTMLScriptElement *nsscript)
|
|||
parse_script_elem(script_host, nsscript);
|
||||
}
|
||||
|
||||
IDispatch *script_parse_event(HTMLDocument *doc, LPCWSTR text)
|
||||
IDispatch *script_parse_event(HTMLWindow *window, LPCWSTR text)
|
||||
{
|
||||
ScriptHost *script_host;
|
||||
GUID guid = CLSID_JScript;
|
||||
|
@ -795,7 +847,7 @@ IDispatch *script_parse_event(HTMLDocument *doc, LPCWSTR text)
|
|||
ptr = text;
|
||||
}
|
||||
|
||||
script_host = get_script_host(doc, &guid);
|
||||
script_host = get_script_host(window, &guid);
|
||||
if(!script_host || !script_host->parse_proc)
|
||||
return NULL;
|
||||
|
||||
|
@ -811,6 +863,52 @@ IDispatch *script_parse_event(HTMLDocument *doc, LPCWSTR text)
|
|||
return disp;
|
||||
}
|
||||
|
||||
IDispatch *get_script_disp(ScriptHost *script_host)
|
||||
{
|
||||
IDispatch *disp;
|
||||
HRESULT hres;
|
||||
|
||||
if(!script_host->script)
|
||||
return NULL;
|
||||
|
||||
hres = IActiveScript_GetScriptDispatch(script_host->script, windowW, &disp);
|
||||
if(FAILED(hres))
|
||||
return NULL;
|
||||
|
||||
return disp;
|
||||
}
|
||||
|
||||
BOOL find_global_prop(HTMLWindow *window, BSTR name, DWORD flags, ScriptHost **ret_host, DISPID *ret_id)
|
||||
{
|
||||
IDispatchEx *dispex;
|
||||
IDispatch *disp;
|
||||
ScriptHost *iter;
|
||||
HRESULT hres;
|
||||
|
||||
LIST_FOR_EACH_ENTRY(iter, &window->script_hosts, ScriptHost, entry) {
|
||||
disp = get_script_disp(iter);
|
||||
if(!disp)
|
||||
continue;
|
||||
|
||||
hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
|
||||
if(SUCCEEDED(hres)) {
|
||||
hres = IDispatchEx_GetDispID(dispex, name, flags, ret_id);
|
||||
IDispatchEx_Release(dispex);
|
||||
}else {
|
||||
FIXME("No IDispatchEx\n");
|
||||
hres = E_NOTIMPL;
|
||||
}
|
||||
|
||||
IDispatch_Release(disp);
|
||||
if(SUCCEEDED(hres)) {
|
||||
*ret_host = iter;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL is_jscript_available(void)
|
||||
{
|
||||
static BOOL available, checked;
|
||||
|
@ -831,27 +929,27 @@ static BOOL is_jscript_available(void)
|
|||
return available;
|
||||
}
|
||||
|
||||
void set_script_mode(HTMLDocument *doc, SCRIPTMODE mode)
|
||||
void set_script_mode(HTMLWindow *window, SCRIPTMODE mode)
|
||||
{
|
||||
nsIWebBrowserSetup *setup;
|
||||
nsresult nsres;
|
||||
|
||||
if(mode == SCRIPTMODE_ACTIVESCRIPT && !is_jscript_available()) {
|
||||
TRACE("jscript.dll not available\n");
|
||||
doc->scriptmode = SCRIPTMODE_GECKO;
|
||||
window->scriptmode = SCRIPTMODE_GECKO;
|
||||
return;
|
||||
}
|
||||
|
||||
doc->scriptmode = mode;
|
||||
window->scriptmode = mode;
|
||||
|
||||
if(!doc->nscontainer || !doc->nscontainer->webbrowser)
|
||||
if(!window->doc_obj->nscontainer || !window->doc_obj->nscontainer->webbrowser)
|
||||
return;
|
||||
|
||||
nsres = nsIWebBrowser_QueryInterface(doc->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,
|
||||
doc->scriptmode == SCRIPTMODE_GECKO);
|
||||
window->scriptmode == SCRIPTMODE_GECKO);
|
||||
nsIWebBrowserSetup_Release(setup);
|
||||
}
|
||||
|
||||
|
@ -859,16 +957,16 @@ void set_script_mode(HTMLDocument *doc, SCRIPTMODE mode)
|
|||
ERR("JavaScript setup failed: %08x\n", nsres);
|
||||
}
|
||||
|
||||
void release_script_hosts(HTMLDocument *doc)
|
||||
void release_script_hosts(HTMLWindow *window)
|
||||
{
|
||||
ScriptHost *iter;
|
||||
|
||||
while(!list_empty(&doc->script_hosts)) {
|
||||
iter = LIST_ENTRY(list_head(&doc->script_hosts), ScriptHost, entry);
|
||||
while(!list_empty(&window->script_hosts)) {
|
||||
iter = LIST_ENTRY(list_head(&window->script_hosts), ScriptHost, entry);
|
||||
|
||||
release_script_engine(iter);
|
||||
list_remove(&iter->entry);
|
||||
iter->doc = NULL;
|
||||
iter->window = NULL;
|
||||
IActiveScript_Release(ACTSCPSITE(iter));
|
||||
}
|
||||
}
|
||||
|
|
181
reactos/dll/win32/mshtml/secmgr.c
Normal file
181
reactos/dll/win32/mshtml/secmgr.c
Normal file
|
@ -0,0 +1,181 @@
|
|||
/*
|
||||
* Copyright 2009 Jacek Caban for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "ole2.h"
|
||||
#include "objsafe.h"
|
||||
#include "activscp.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "mshtml_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
||||
|
||||
static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
|
||||
|
||||
/* Defined as extern in urlmon.idl, but not exported by uuid.lib */
|
||||
const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY =
|
||||
{0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}};
|
||||
|
||||
#define HOSTSECMGR_THIS(iface) DEFINE_THIS(HTMLDocumentNode, IInternetHostSecurityManager, iface)
|
||||
|
||||
static HRESULT WINAPI InternetHostSecurityManager_QueryInterface(IInternetHostSecurityManager *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
HTMLDocumentNode *This = HOSTSECMGR_THIS(iface);
|
||||
return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->node), riid, ppv);
|
||||
}
|
||||
|
||||
static ULONG WINAPI InternetHostSecurityManager_AddRef(IInternetHostSecurityManager *iface)
|
||||
{
|
||||
HTMLDocumentNode *This = HOSTSECMGR_THIS(iface);
|
||||
return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->node));
|
||||
}
|
||||
|
||||
static ULONG WINAPI InternetHostSecurityManager_Release(IInternetHostSecurityManager *iface)
|
||||
{
|
||||
HTMLDocumentNode *This = HOSTSECMGR_THIS(iface);
|
||||
return IHTMLDOMNode_Release(HTMLDOMNODE(&This->node));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InternetHostSecurityManager_GetSecurityId(IInternetHostSecurityManager *iface, BYTE *pbSecurityId,
|
||||
DWORD *pcbSecurityId, DWORD_PTR dwReserved)
|
||||
{
|
||||
HTMLDocumentNode *This = HOSTSECMGR_THIS(iface);
|
||||
FIXME("(%p)->(%p %p %lx)\n", This, pbSecurityId, pcbSecurityId, dwReserved);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InternetHostSecurityManager_ProcessUrlAction(IInternetHostSecurityManager *iface, DWORD dwAction,
|
||||
BYTE *pPolicy, DWORD cbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved)
|
||||
{
|
||||
HTMLDocumentNode *This = HOSTSECMGR_THIS(iface);
|
||||
const WCHAR *url;
|
||||
|
||||
TRACE("%p)->(%d %p %d %p %d %x %x)\n", This, dwAction, pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved);
|
||||
|
||||
url = This->basedoc.doc_obj->url ? This->basedoc.doc_obj->url : about_blankW;
|
||||
|
||||
return IInternetSecurityManager_ProcessUrlAction(This->secmgr, url, dwAction, pPolicy, cbPolicy,
|
||||
pContext, cbContext, dwFlags, dwReserved);
|
||||
}
|
||||
|
||||
static DWORD confirm_safety(HTMLDocumentNode *This, const WCHAR *url, IUnknown *obj)
|
||||
{
|
||||
DWORD policy, enabled_opts, supported_opts;
|
||||
IObjectSafety *obj_safety;
|
||||
HRESULT hres;
|
||||
|
||||
/* FIXME: Check URLACTION_ACTIVEX_OVERRIDE_SCRIPT_SAFETY */
|
||||
|
||||
hres = IInternetSecurityManager_ProcessUrlAction(This->secmgr, url, URLACTION_SCRIPT_SAFE_ACTIVEX,
|
||||
(BYTE*)&policy, sizeof(policy), NULL, 0, 0, 0);
|
||||
if(FAILED(hres) || policy != URLPOLICY_ALLOW)
|
||||
return URLPOLICY_DISALLOW;
|
||||
|
||||
hres = IUnknown_QueryInterface(obj, &IID_IObjectSafety, (void**)&obj_safety);
|
||||
if(FAILED(hres))
|
||||
return URLPOLICY_DISALLOW;
|
||||
|
||||
hres = IObjectSafety_GetInterfaceSafetyOptions(obj_safety, &IID_IDispatchEx, &supported_opts, &enabled_opts);
|
||||
if(SUCCEEDED(hres)) {
|
||||
enabled_opts = INTERFACESAFE_FOR_UNTRUSTED_CALLER;
|
||||
if(supported_opts & INTERFACE_USES_SECURITY_MANAGER)
|
||||
enabled_opts |= INTERFACE_USES_SECURITY_MANAGER;
|
||||
hres = IObjectSafety_SetInterfaceSafetyOptions(obj_safety, &IID_IDispatchEx, enabled_opts, enabled_opts);
|
||||
}
|
||||
IObjectSafety_Release(obj_safety);
|
||||
if(FAILED(hres))
|
||||
return URLPOLICY_DISALLOW;
|
||||
|
||||
return URLPOLICY_ALLOW;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy(IInternetHostSecurityManager *iface, REFGUID guidKey,
|
||||
BYTE **ppPolicy, DWORD *pcbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwReserved)
|
||||
{
|
||||
HTMLDocumentNode *This = HOSTSECMGR_THIS(iface);
|
||||
const WCHAR *url;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%s %p %p %p %d %x)\n", This, debugstr_guid(guidKey), ppPolicy, pcbPolicy, pContext, cbContext, dwReserved);
|
||||
|
||||
url = This->basedoc.doc_obj->url ? This->basedoc.doc_obj->url : about_blankW;
|
||||
|
||||
hres = IInternetSecurityManager_QueryCustomPolicy(This->secmgr, url, guidKey, ppPolicy, pcbPolicy,
|
||||
pContext, cbContext, dwReserved);
|
||||
if(hres != HRESULT_FROM_WIN32(ERROR_NOT_FOUND))
|
||||
return hres;
|
||||
|
||||
if(IsEqualGUID(&GUID_CUSTOM_CONFIRMOBJECTSAFETY, guidKey)) {
|
||||
IActiveScript *active_script;
|
||||
struct CONFIRMSAFETY *cs;
|
||||
DWORD policy;
|
||||
|
||||
if(cbContext != sizeof(struct CONFIRMSAFETY)) {
|
||||
FIXME("wrong context size\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
cs = (struct CONFIRMSAFETY*)pContext;
|
||||
hres = IUnknown_QueryInterface(cs->pUnk, &IID_IActiveScript, (void**)&active_script);
|
||||
if(SUCCEEDED(hres)) {
|
||||
FIXME("Got IAciveScript iface\n");
|
||||
IActiveScript_Release(active_script);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
policy = confirm_safety(This, url, cs->pUnk);
|
||||
|
||||
*ppPolicy = CoTaskMemAlloc(sizeof(policy));
|
||||
if(!*ppPolicy)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
*(DWORD*)*ppPolicy = policy;
|
||||
*pcbPolicy = sizeof(policy);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
FIXME("Unknown guidKey %s\n", debugstr_guid(guidKey));
|
||||
return hres;
|
||||
}
|
||||
|
||||
#undef HOSTSECMGR_THIS
|
||||
|
||||
static const IInternetHostSecurityManagerVtbl InternetHostSecurityManagerVtbl = {
|
||||
InternetHostSecurityManager_QueryInterface,
|
||||
InternetHostSecurityManager_AddRef,
|
||||
InternetHostSecurityManager_Release,
|
||||
InternetHostSecurityManager_GetSecurityId,
|
||||
InternetHostSecurityManager_ProcessUrlAction,
|
||||
InternetHostSecurityManager_QueryCustomPolicy
|
||||
};
|
||||
|
||||
void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode *This)
|
||||
{
|
||||
This->lpIInternetHostSecurityManagerVtbl = &InternetHostSecurityManagerVtbl;
|
||||
}
|
|
@ -38,7 +38,7 @@ typedef struct {
|
|||
LONG ref;
|
||||
|
||||
nsISelection *nsselection;
|
||||
HTMLDocument *doc;
|
||||
HTMLDocumentNode *doc;
|
||||
|
||||
struct list entry;
|
||||
} HTMLSelectionObject;
|
||||
|
@ -140,7 +140,9 @@ static HRESULT WINAPI HTMLSelectionObject_Invoke(IHTMLSelectionObject *iface, DI
|
|||
static HRESULT WINAPI HTMLSelectionObject_createRange(IHTMLSelectionObject *iface, IDispatch **range)
|
||||
{
|
||||
HTMLSelectionObject *This = HTMLSELOBJ_THIS(iface);
|
||||
IHTMLTxtRange *range_obj = NULL;
|
||||
nsIDOMRange *nsrange = NULL;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, range);
|
||||
|
||||
|
@ -154,12 +156,12 @@ static HRESULT WINAPI HTMLSelectionObject_createRange(IHTMLSelectionObject *ifac
|
|||
|
||||
TRACE("nsrange_cnt = 0\n");
|
||||
|
||||
if(!This->doc->nsdoc) {
|
||||
if(!This->doc->basedoc.nsdoc) {
|
||||
WARN("nsdoc is NULL\n");
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsres = nsIDOMHTMLDocument_GetBody(This->doc->nsdoc, &nsbody);
|
||||
nsres = nsIDOMHTMLDocument_GetBody(This->doc->basedoc.nsdoc, &nsbody);
|
||||
if(NS_FAILED(nsres) || !nsbody) {
|
||||
ERR("Could not get body: %08x\n", nsres);
|
||||
return E_FAIL;
|
||||
|
@ -178,8 +180,11 @@ static HRESULT WINAPI HTMLSelectionObject_createRange(IHTMLSelectionObject *ifac
|
|||
ERR("GetRangeAt failed: %08x\n", nsres);
|
||||
}
|
||||
|
||||
*range = (IDispatch*)HTMLTxtRange_Create(This->doc, nsrange);
|
||||
return S_OK;
|
||||
hres = HTMLTxtRange_Create(This->doc, nsrange, &range_obj);
|
||||
|
||||
if (nsrange) nsIDOMRange_Release(nsrange);
|
||||
*range = (IDispatch*)range_obj;
|
||||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLSelectionObject_empty(IHTMLSelectionObject *iface)
|
||||
|
@ -230,21 +235,26 @@ static const IHTMLSelectionObjectVtbl HTMLSelectionObjectVtbl = {
|
|||
HTMLSelectionObject_get_type
|
||||
};
|
||||
|
||||
IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument *doc, nsISelection *nsselection)
|
||||
HRESULT HTMLSelectionObject_Create(HTMLDocumentNode *doc, nsISelection *nsselection, IHTMLSelectionObject **ret)
|
||||
{
|
||||
HTMLSelectionObject *ret = heap_alloc(sizeof(HTMLSelectionObject));
|
||||
HTMLSelectionObject *selection;
|
||||
|
||||
ret->lpHTMLSelectionObjectVtbl = &HTMLSelectionObjectVtbl;
|
||||
ret->ref = 1;
|
||||
ret->nsselection = nsselection; /* We shouldn't call AddRef here */
|
||||
selection = heap_alloc(sizeof(HTMLSelectionObject));
|
||||
if(!selection)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
ret->doc = doc;
|
||||
list_add_head(&doc->selection_list, &ret->entry);
|
||||
selection->lpHTMLSelectionObjectVtbl = &HTMLSelectionObjectVtbl;
|
||||
selection->ref = 1;
|
||||
selection->nsselection = nsselection; /* We shouldn't call AddRef here */
|
||||
|
||||
return HTMLSELOBJ(ret);
|
||||
selection->doc = doc;
|
||||
list_add_head(&doc->selection_list, &selection->entry);
|
||||
|
||||
*ret = HTMLSELOBJ(selection);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void detach_selection(HTMLDocument *This)
|
||||
void detach_selection(HTMLDocumentNode *This)
|
||||
{
|
||||
HTMLSelectionObject *iter;
|
||||
|
||||
|
|
|
@ -240,11 +240,11 @@ static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFG
|
|||
if(IsEqualGUID(&IID_IOleUndoManager, riid)) {
|
||||
TRACE("(%p)->(IID_IOleUndoManager %p)\n", This, ppv);
|
||||
|
||||
if(!This->undomgr)
|
||||
This->undomgr = create_undomgr();
|
||||
if(!This->doc_obj->undomgr)
|
||||
This->doc_obj->undomgr = create_undomgr();
|
||||
|
||||
IOleUndoManager_AddRef(This->undomgr);
|
||||
*ppv = This->undomgr;
|
||||
IOleUndoManager_AddRef(This->doc_obj->undomgr);
|
||||
*ppv = This->doc_obj->undomgr;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -263,6 +263,4 @@ static const IServiceProviderVtbl ServiceProviderVtbl = {
|
|||
void HTMLDocument_Service_Init(HTMLDocument *This)
|
||||
{
|
||||
This->lpServiceProviderVtbl = &ServiceProviderVtbl;
|
||||
|
||||
This->undomgr = NULL;
|
||||
}
|
||||
|
|
|
@ -94,6 +94,9 @@ void remove_doc_tasks(const HTMLDocument *doc)
|
|||
task_timer_t *timer;
|
||||
task_t *iter, *tmp;
|
||||
|
||||
if(!thread_data)
|
||||
return;
|
||||
|
||||
LIST_FOR_EACH_SAFE(liter, ltmp, &thread_data->timer_list) {
|
||||
timer = LIST_ENTRY(liter, task_timer_t, entry);
|
||||
if(timer->doc == doc)
|
||||
|
@ -105,9 +108,6 @@ void remove_doc_tasks(const HTMLDocument *doc)
|
|||
SetTimer(thread_data->thread_hwnd, TIMER_ID, timer->time - GetTickCount(), NULL);
|
||||
}
|
||||
|
||||
if(!thread_data)
|
||||
return;
|
||||
|
||||
while(thread_data->task_queue_head
|
||||
&& thread_data->task_queue_head->doc == doc)
|
||||
pop_task();
|
||||
|
@ -191,7 +191,7 @@ HRESULT clear_task_timer(HTMLDocument *doc, BOOL interval, DWORD id)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static void set_downloading(HTMLDocument *doc)
|
||||
static void set_downloading(HTMLDocumentObj *doc)
|
||||
{
|
||||
IOleCommandTarget *olecmd;
|
||||
HRESULT hres;
|
||||
|
@ -228,7 +228,7 @@ static void set_downloading(HTMLDocument *doc)
|
|||
}
|
||||
|
||||
/* Calls undocumented 69 cmd of CGID_Explorer */
|
||||
static void call_explorer_69(HTMLDocument *doc)
|
||||
static void call_explorer_69(HTMLDocumentObj *doc)
|
||||
{
|
||||
IOleCommandTarget *olecmd;
|
||||
VARIANT var;
|
||||
|
@ -254,20 +254,20 @@ static void set_parsecomplete(HTMLDocument *doc)
|
|||
|
||||
TRACE("(%p)\n", doc);
|
||||
|
||||
if(doc->usermode == EDITMODE)
|
||||
if(doc->doc_obj->usermode == EDITMODE)
|
||||
init_editor(doc);
|
||||
|
||||
call_explorer_69(doc);
|
||||
call_explorer_69(doc->doc_obj);
|
||||
call_property_onchanged(&doc->cp_propnotif, 1005);
|
||||
call_explorer_69(doc);
|
||||
call_explorer_69(doc->doc_obj);
|
||||
|
||||
/* FIXME: IE7 calls EnableModelless(TRUE), EnableModelless(FALSE) and sets interactive state here */
|
||||
|
||||
doc->readystate = READYSTATE_INTERACTIVE;
|
||||
doc->doc_obj->readystate = READYSTATE_INTERACTIVE;
|
||||
call_property_onchanged(&doc->cp_propnotif, DISPID_READYSTATE);
|
||||
|
||||
if(doc->client)
|
||||
IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
|
||||
if(doc->doc_obj->client)
|
||||
IOleClientSite_QueryInterface(doc->doc_obj->client, &IID_IOleCommandTarget, (void**)&olecmd);
|
||||
|
||||
if(olecmd) {
|
||||
VARIANT state, progress;
|
||||
|
@ -289,15 +289,15 @@ static void set_parsecomplete(HTMLDocument *doc)
|
|||
IOleCommandTarget_Release(olecmd);
|
||||
}
|
||||
|
||||
doc->readystate = READYSTATE_COMPLETE;
|
||||
doc->doc_obj->readystate = READYSTATE_COMPLETE;
|
||||
call_property_onchanged(&doc->cp_propnotif, DISPID_READYSTATE);
|
||||
|
||||
if(doc->frame) {
|
||||
if(doc->doc_obj->frame) {
|
||||
static const WCHAR wszDone[] = {'D','o','n','e',0};
|
||||
IOleInPlaceFrame_SetStatusText(doc->frame, wszDone);
|
||||
IOleInPlaceFrame_SetStatusText(doc->doc_obj->frame, wszDone);
|
||||
}
|
||||
|
||||
update_title(doc);
|
||||
update_title(doc->doc_obj);
|
||||
}
|
||||
|
||||
static void set_progress(HTMLDocument *doc)
|
||||
|
@ -307,8 +307,8 @@ static void set_progress(HTMLDocument *doc)
|
|||
|
||||
TRACE("(%p)\n", doc);
|
||||
|
||||
if(doc->client)
|
||||
IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
|
||||
if(doc->doc_obj->client)
|
||||
IOleClientSite_QueryInterface(doc->doc_obj->client, &IID_IOleCommandTarget, (void**)&olecmd);
|
||||
|
||||
if(olecmd) {
|
||||
VARIANT progress_max, progress;
|
||||
|
@ -324,12 +324,12 @@ static void set_progress(HTMLDocument *doc)
|
|||
&progress, NULL);
|
||||
}
|
||||
|
||||
if(doc->usermode == EDITMODE && doc->hostui) {
|
||||
if(doc->doc_obj->usermode == EDITMODE && doc->doc_obj->hostui) {
|
||||
DOCHOSTUIINFO hostinfo;
|
||||
|
||||
memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
|
||||
hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
|
||||
hres = IDocHostUIHandler_GetHostInfo(doc->hostui, &hostinfo);
|
||||
hres = IDocHostUIHandler_GetHostInfo(doc->doc_obj->hostui, &hostinfo);
|
||||
if(SUCCEEDED(hres))
|
||||
/* FIXME: use hostinfo */
|
||||
TRACE("hostinfo = {%u %08x %08x %s %s}\n",
|
||||
|
@ -349,7 +349,7 @@ static void process_task(task_t *task)
|
|||
{
|
||||
switch(task->task_id) {
|
||||
case TASK_SETDOWNLOADSTATE:
|
||||
set_downloading(task->doc);
|
||||
set_downloading(task->doc->doc_obj);
|
||||
break;
|
||||
case TASK_PARSECOMPLETE:
|
||||
set_parsecomplete(task->doc);
|
||||
|
@ -374,8 +374,14 @@ static void call_timer_disp(IDispatch *disp)
|
|||
|
||||
V_VT(&res) = VT_EMPTY;
|
||||
memset(&ei, 0, sizeof(ei));
|
||||
|
||||
TRACE(">>>\n");
|
||||
hres = IDispatch_Invoke(disp, DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dp, &res, &ei, NULL);
|
||||
TRACE("ret %08x %s\n", hres, debugstr_variant(&res));
|
||||
if(hres == S_OK)
|
||||
TRACE("<<<\n");
|
||||
else
|
||||
WARN("<<< %08x\n", hres);
|
||||
|
||||
VariantClear(&res);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ typedef struct {
|
|||
LONG ref;
|
||||
|
||||
nsIDOMRange *nsrange;
|
||||
HTMLDocument *doc;
|
||||
HTMLDocumentNode *doc;
|
||||
|
||||
struct list entry;
|
||||
} HTMLTxtRange;
|
||||
|
@ -72,7 +72,7 @@ typedef enum {
|
|||
RU_TEXTEDIT
|
||||
} range_unit_t;
|
||||
|
||||
static HTMLTxtRange *get_range_object(HTMLDocument *doc, IHTMLTxtRange *iface)
|
||||
static HTMLTxtRange *get_range_object(HTMLDocumentNode *doc, IHTMLTxtRange *iface)
|
||||
{
|
||||
HTMLTxtRange *iter;
|
||||
|
||||
|
@ -342,7 +342,7 @@ static nsIDOMNode *prev_node(HTMLTxtRange *This, nsIDOMNode *iter)
|
|||
if(!iter) {
|
||||
nsIDOMHTMLElement *nselem;
|
||||
|
||||
nsIDOMHTMLDocument_GetBody(This->doc->nsdoc, &nselem);
|
||||
nsIDOMHTMLDocument_GetBody(This->doc->basedoc.nsdoc, &nselem);
|
||||
nsIDOMElement_GetLastChild(nselem, &tmp);
|
||||
if(!tmp)
|
||||
return (nsIDOMNode*)nselem;
|
||||
|
@ -1139,7 +1139,7 @@ static HRESULT WINAPI HTMLTxtRange_put_text(IHTMLTxtRange *iface, BSTR v)
|
|||
return MSHTML_E_NODOC;
|
||||
|
||||
nsAString_Init(&text_str, v);
|
||||
nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc->nsdoc, &text_str, &text_node);
|
||||
nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc->basedoc.nsdoc, &text_str, &text_node);
|
||||
nsAString_Finish(&text_str);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("CreateTextNode failed: %08x\n", nsres);
|
||||
|
@ -1211,14 +1211,15 @@ static HRESULT WINAPI HTMLTxtRange_duplicate(IHTMLTxtRange *iface, IHTMLTxtRange
|
|||
{
|
||||
HTMLTxtRange *This = HTMLTXTRANGE_THIS(iface);
|
||||
nsIDOMRange *nsrange = NULL;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, Duplicate);
|
||||
|
||||
nsIDOMRange_CloneRange(This->nsrange, &nsrange);
|
||||
*Duplicate = HTMLTxtRange_Create(This->doc, nsrange);
|
||||
hres = HTMLTxtRange_Create(This->doc, nsrange, Duplicate);
|
||||
nsIDOMRange_Release(nsrange);
|
||||
|
||||
return S_OK;
|
||||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLTxtRange_inRange(IHTMLTxtRange *iface, IHTMLTxtRange *Range,
|
||||
|
@ -1347,7 +1348,7 @@ static HRESULT WINAPI HTMLTxtRange_expand(IHTMLTxtRange *iface, BSTR Unit, VARIA
|
|||
nsIDOMHTMLElement *nsbody = NULL;
|
||||
nsresult nsres;
|
||||
|
||||
nsres = nsIDOMHTMLDocument_GetBody(This->doc->nsdoc, &nsbody);
|
||||
nsres = nsIDOMHTMLDocument_GetBody(This->doc->basedoc.nsdoc, &nsbody);
|
||||
if(NS_FAILED(nsres) || !nsbody) {
|
||||
ERR("Could not get body: %08x\n", nsres);
|
||||
break;
|
||||
|
@ -1545,23 +1546,20 @@ static HRESULT WINAPI HTMLTxtRange_moveEnd(IHTMLTxtRange *iface, BSTR Unit,
|
|||
static HRESULT WINAPI HTMLTxtRange_select(IHTMLTxtRange *iface)
|
||||
{
|
||||
HTMLTxtRange *This = HTMLTXTRANGE_THIS(iface);
|
||||
nsISelection *nsselection;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
if(This->doc->nscontainer) {
|
||||
nsIDOMWindow *dom_window = NULL;
|
||||
nsISelection *nsselection;
|
||||
|
||||
nsIWebBrowser_GetContentDOMWindow(This->doc->nscontainer->webbrowser, &dom_window);
|
||||
nsIDOMWindow_GetSelection(dom_window, &nsselection);
|
||||
nsIDOMWindow_Release(dom_window);
|
||||
|
||||
nsISelection_RemoveAllRanges(nsselection);
|
||||
nsISelection_AddRange(nsselection, This->nsrange);
|
||||
|
||||
nsISelection_Release(nsselection);
|
||||
nsres = nsIDOMWindow_GetSelection(This->doc->basedoc.window->nswindow, &nsselection);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("GetSelection failed: %08x\n", nsres);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
nsISelection_RemoveAllRanges(nsselection);
|
||||
nsISelection_AddRange(nsselection, This->nsrange);
|
||||
nsISelection_Release(nsselection);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -1790,17 +1788,17 @@ static HRESULT exec_indent(HTMLTxtRange *This, VARIANT *in, VARIANT *out)
|
|||
|
||||
TRACE("(%p)->(%p %p)\n", This, in, out);
|
||||
|
||||
if(!This->doc->nsdoc) {
|
||||
if(!This->doc->basedoc.nsdoc) {
|
||||
WARN("NULL nsdoc\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
nsAString_Init(&tag_str, blockquoteW);
|
||||
nsIDOMHTMLDocument_CreateElement(This->doc->nsdoc, &tag_str, &blockquote_elem);
|
||||
nsIDOMHTMLDocument_CreateElement(This->doc->basedoc.nsdoc, &tag_str, &blockquote_elem);
|
||||
nsAString_Finish(&tag_str);
|
||||
|
||||
nsAString_Init(&tag_str, pW);
|
||||
nsIDOMDocument_CreateElement(This->doc->nsdoc, &tag_str, &p_elem);
|
||||
nsIDOMDocument_CreateElement(This->doc->basedoc.nsdoc, &tag_str, &p_elem);
|
||||
nsAString_Finish(&tag_str);
|
||||
|
||||
nsIDOMRange_ExtractContents(This->nsrange, &fragment);
|
||||
|
@ -1850,9 +1848,13 @@ static const IOleCommandTargetVtbl OleCommandTargetVtbl = {
|
|||
RangeCommandTarget_Exec
|
||||
};
|
||||
|
||||
IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument *doc, nsIDOMRange *nsrange)
|
||||
HRESULT HTMLTxtRange_Create(HTMLDocumentNode *doc, nsIDOMRange *nsrange, IHTMLTxtRange **p)
|
||||
{
|
||||
HTMLTxtRange *ret = heap_alloc(sizeof(HTMLTxtRange));
|
||||
HTMLTxtRange *ret;
|
||||
|
||||
ret = heap_alloc(sizeof(HTMLTxtRange));
|
||||
if(!ret)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
ret->lpHTMLTxtRangeVtbl = &HTMLTxtRangeVtbl;
|
||||
ret->lpOleCommandTargetVtbl = &OleCommandTargetVtbl;
|
||||
|
@ -1865,10 +1867,11 @@ IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument *doc, nsIDOMRange *nsrange)
|
|||
ret->doc = doc;
|
||||
list_add_head(&doc->range_list, &ret->entry);
|
||||
|
||||
return HTMLTXTRANGE(ret);
|
||||
*p = HTMLTXTRANGE(ret);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void detach_ranges(HTMLDocument *This)
|
||||
void detach_ranges(HTMLDocumentNode *This)
|
||||
{
|
||||
HTMLTxtRange *iter;
|
||||
|
||||
|
|
|
@ -46,11 +46,11 @@ static const WCHAR wszTooltipData[] = {'t','o','o','l','t','i','p','_','d','a','
|
|||
static ATOM serverwnd_class = 0;
|
||||
|
||||
typedef struct {
|
||||
HTMLDocument *doc;
|
||||
HTMLDocumentObj *doc;
|
||||
WNDPROC proc;
|
||||
} tooltip_data;
|
||||
|
||||
static void paint_document(HTMLDocument *This)
|
||||
static void paint_document(HTMLDocumentObj *This)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
RECT rect;
|
||||
|
@ -97,13 +97,13 @@ 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);
|
||||
if(!This->doc_obj->update && This->doc_obj->hwnd)
|
||||
SetTimer(This->doc_obj->hwnd, TIMER_ID, 100, NULL);
|
||||
|
||||
This->update |= flags;
|
||||
This->doc_obj->update |= flags;
|
||||
}
|
||||
|
||||
void update_title(HTMLDocument *This)
|
||||
void update_title(HTMLDocumentObj *This)
|
||||
{
|
||||
IOleCommandTarget *olecmd;
|
||||
HRESULT hres;
|
||||
|
@ -131,7 +131,7 @@ void update_title(HTMLDocument *This)
|
|||
}
|
||||
}
|
||||
|
||||
static LRESULT on_timer(HTMLDocument *This)
|
||||
static LRESULT on_timer(HTMLDocumentObj *This)
|
||||
{
|
||||
TRACE("(%p) %x\n", This, This->update);
|
||||
|
||||
|
@ -163,7 +163,7 @@ static LRESULT on_timer(HTMLDocument *This)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void notif_focus(HTMLDocument *This)
|
||||
void notif_focus(HTMLDocumentObj *This)
|
||||
{
|
||||
IOleControlSite *site;
|
||||
HRESULT hres;
|
||||
|
@ -181,12 +181,12 @@ void notif_focus(HTMLDocument *This)
|
|||
|
||||
static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HTMLDocument *This;
|
||||
HTMLDocumentObj *This;
|
||||
|
||||
static const WCHAR wszTHIS[] = {'T','H','I','S',0};
|
||||
|
||||
if(msg == WM_CREATE) {
|
||||
This = *(HTMLDocument**)lParam;
|
||||
This = *(HTMLDocumentObj**)lParam;
|
||||
SetPropW(hwnd, wszTHIS, This);
|
||||
}else {
|
||||
This = GetPropW(hwnd, wszTHIS);
|
||||
|
@ -237,7 +237,7 @@ static void register_serverwnd_class(void)
|
|||
serverwnd_class = RegisterClassExW(&wndclass);
|
||||
}
|
||||
|
||||
static HRESULT activate_window(HTMLDocument *This)
|
||||
static HRESULT activate_window(HTMLDocumentObj *This)
|
||||
{
|
||||
IOleInPlaceFrame *pIPFrame;
|
||||
IOleCommandTarget *cmdtrg;
|
||||
|
@ -369,7 +369,7 @@ static LRESULT WINAPI tooltips_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
|
|||
return CallWindowProcW(data->proc, hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
static void create_tooltips_window(HTMLDocument *This)
|
||||
static void create_tooltips_window(HTMLDocumentObj *This)
|
||||
{
|
||||
tooltip_data *data = heap_alloc(sizeof(*data));
|
||||
|
||||
|
@ -388,7 +388,7 @@ static void create_tooltips_window(HTMLDocument *This)
|
|||
|
||||
}
|
||||
|
||||
void show_tooltip(HTMLDocument *This, DWORD x, DWORD y, LPCWSTR text)
|
||||
void show_tooltip(HTMLDocumentObj *This, DWORD x, DWORD y, LPCWSTR text)
|
||||
{
|
||||
TTTOOLINFOW toolinfo = {
|
||||
sizeof(TTTOOLINFOW), 0, This->hwnd, 0xdeadbeef,
|
||||
|
@ -406,7 +406,7 @@ void show_tooltip(HTMLDocument *This, DWORD x, DWORD y, LPCWSTR text)
|
|||
SendMessageW(This->tooltips_hwnd, TTM_RELAYEVENT, 0, (LPARAM)&msg);
|
||||
}
|
||||
|
||||
void hide_tooltip(HTMLDocument *This)
|
||||
void hide_tooltip(HTMLDocumentObj *This)
|
||||
{
|
||||
TTTOOLINFOW toolinfo = {
|
||||
sizeof(TTTOOLINFOW), 0, This->hwnd, 0xdeadbeef,
|
||||
|
@ -462,10 +462,10 @@ static HRESULT WINAPI OleDocumentView_SetInPlaceSite(IOleDocumentView *iface, IO
|
|||
if(pIPSite)
|
||||
IOleInPlaceSite_AddRef(pIPSite);
|
||||
|
||||
if(This->ipsite)
|
||||
IOleInPlaceSite_Release(This->ipsite);
|
||||
if(This->doc_obj->ipsite)
|
||||
IOleInPlaceSite_Release(This->doc_obj->ipsite);
|
||||
|
||||
This->ipsite = pIPSite;
|
||||
This->doc_obj->ipsite = pIPSite;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -477,10 +477,10 @@ static HRESULT WINAPI OleDocumentView_GetInPlaceSite(IOleDocumentView *iface, IO
|
|||
if(!ppIPSite)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if(This->ipsite)
|
||||
IOleInPlaceSite_AddRef(This->ipsite);
|
||||
if(This->doc_obj->ipsite)
|
||||
IOleInPlaceSite_AddRef(This->doc_obj->ipsite);
|
||||
|
||||
*ppIPSite = This->ipsite;
|
||||
*ppIPSite = This->doc_obj->ipsite;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -507,11 +507,11 @@ static HRESULT WINAPI OleDocumentView_SetRect(IOleDocumentView *iface, LPRECT pr
|
|||
if(!prcView)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if(This->hwnd) {
|
||||
GetClientRect(This->hwnd, &rect);
|
||||
if(This->doc_obj->hwnd) {
|
||||
GetClientRect(This->doc_obj->hwnd, &rect);
|
||||
if(memcmp(prcView, &rect, sizeof(RECT))) {
|
||||
InvalidateRect(This->hwnd,NULL,TRUE);
|
||||
SetWindowPos(This->hwnd, NULL, prcView->left, prcView->top, prcView->right,
|
||||
InvalidateRect(This->doc_obj->hwnd, NULL, TRUE);
|
||||
SetWindowPos(This->doc_obj->hwnd, NULL, prcView->left, prcView->top, prcView->right,
|
||||
prcView->bottom, SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
}
|
||||
}
|
||||
|
@ -528,7 +528,7 @@ static HRESULT WINAPI OleDocumentView_GetRect(IOleDocumentView *iface, LPRECT pr
|
|||
if(!prcView)
|
||||
return E_INVALIDARG;
|
||||
|
||||
GetClientRect(This->hwnd, prcView);
|
||||
GetClientRect(This->doc_obj->hwnd, prcView);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -548,18 +548,18 @@ static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow)
|
|||
TRACE("(%p)->(%x)\n", This, fShow);
|
||||
|
||||
if(fShow) {
|
||||
if(!This->ui_active) {
|
||||
hres = activate_window(This);
|
||||
if(!This->doc_obj->ui_active) {
|
||||
hres = activate_window(This->doc_obj);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
}
|
||||
update_doc(This, UPDATE_UI);
|
||||
ShowWindow(This->hwnd, SW_SHOW);
|
||||
ShowWindow(This->doc_obj->hwnd, SW_SHOW);
|
||||
}else {
|
||||
ShowWindow(This->hwnd, SW_HIDE);
|
||||
if(This->ip_window) {
|
||||
IOleInPlaceUIWindow_Release(This->ip_window);
|
||||
This->ip_window = NULL;
|
||||
ShowWindow(This->doc_obj->hwnd, SW_HIDE);
|
||||
if(This->doc_obj->ip_window) {
|
||||
IOleInPlaceUIWindow_Release(This->doc_obj->ip_window);
|
||||
This->doc_obj->ip_window = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -573,7 +573,7 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
|
|||
|
||||
TRACE("(%p)->(%x)\n", This, fUIActivate);
|
||||
|
||||
if(!This->ipsite) {
|
||||
if(!This->doc_obj->ipsite) {
|
||||
FIXME("This->ipsite = NULL\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -581,59 +581,59 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
|
|||
if(fUIActivate) {
|
||||
RECT rcBorderWidths;
|
||||
|
||||
if(This->ui_active)
|
||||
if(This->doc_obj->ui_active)
|
||||
return S_OK;
|
||||
|
||||
if(!This->window_active) {
|
||||
hres = activate_window(This);
|
||||
if(!This->doc_obj->window_active) {
|
||||
hres = activate_window(This->doc_obj);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
}
|
||||
|
||||
This->focus = TRUE;
|
||||
if(This->nscontainer)
|
||||
nsIWebBrowserFocus_Activate(This->nscontainer->focus);
|
||||
notif_focus(This);
|
||||
This->doc_obj->focus = TRUE;
|
||||
if(This->doc_obj->nscontainer)
|
||||
nsIWebBrowserFocus_Activate(This->doc_obj->nscontainer->focus);
|
||||
notif_focus(This->doc_obj);
|
||||
|
||||
update_doc(This, UPDATE_UI);
|
||||
|
||||
hres = IOleInPlaceSite_OnUIActivate(This->ipsite);
|
||||
hres = IOleInPlaceSite_OnUIActivate(This->doc_obj->ipsite);
|
||||
if(SUCCEEDED(hres)) {
|
||||
call_set_active_object((IOleInPlaceUIWindow*)This->frame, ACTOBJ(This));
|
||||
call_set_active_object((IOleInPlaceUIWindow*)This->doc_obj->frame, ACTOBJ(This));
|
||||
}else {
|
||||
FIXME("OnUIActivate failed: %08x\n", hres);
|
||||
IOleInPlaceFrame_Release(This->frame);
|
||||
This->frame = NULL;
|
||||
This->ui_active = FALSE;
|
||||
IOleInPlaceFrame_Release(This->doc_obj->frame);
|
||||
This->doc_obj->frame = NULL;
|
||||
This->doc_obj->ui_active = FALSE;
|
||||
return hres;
|
||||
}
|
||||
|
||||
if(This->hostui) {
|
||||
hres = IDocHostUIHandler_ShowUI(This->hostui,
|
||||
This->usermode == EDITMODE ? DOCHOSTUITYPE_AUTHOR : DOCHOSTUITYPE_BROWSE,
|
||||
ACTOBJ(This), CMDTARGET(This), This->frame, This->ip_window);
|
||||
if(This->doc_obj->hostui) {
|
||||
hres = IDocHostUIHandler_ShowUI(This->doc_obj->hostui,
|
||||
This->doc_obj->usermode == EDITMODE ? DOCHOSTUITYPE_AUTHOR : DOCHOSTUITYPE_BROWSE,
|
||||
ACTOBJ(This), CMDTARGET(This), This->doc_obj->frame, This->doc_obj->ip_window);
|
||||
if(FAILED(hres))
|
||||
IDocHostUIHandler_HideUI(This->hostui);
|
||||
IDocHostUIHandler_HideUI(This->doc_obj->hostui);
|
||||
}
|
||||
|
||||
if(This->ip_window)
|
||||
call_set_active_object(This->ip_window, ACTOBJ(This));
|
||||
if(This->doc_obj->ip_window)
|
||||
call_set_active_object(This->doc_obj->ip_window, ACTOBJ(This));
|
||||
|
||||
memset(&rcBorderWidths, 0, sizeof(rcBorderWidths));
|
||||
IOleInPlaceFrame_SetBorderSpace(This->frame, &rcBorderWidths);
|
||||
IOleInPlaceFrame_SetBorderSpace(This->doc_obj->frame, &rcBorderWidths);
|
||||
|
||||
This->ui_active = TRUE;
|
||||
This->doc_obj->ui_active = TRUE;
|
||||
}else {
|
||||
if(This->ui_active) {
|
||||
This->ui_active = FALSE;
|
||||
if(This->ip_window)
|
||||
call_set_active_object(This->ip_window, NULL);
|
||||
if(This->frame)
|
||||
call_set_active_object((IOleInPlaceUIWindow*)This->frame, NULL);
|
||||
if(This->hostui)
|
||||
IDocHostUIHandler_HideUI(This->hostui);
|
||||
if(This->ipsite)
|
||||
IOleInPlaceSite_OnUIDeactivate(This->ipsite, FALSE);
|
||||
if(This->doc_obj->ui_active) {
|
||||
This->doc_obj->ui_active = FALSE;
|
||||
if(This->doc_obj->ip_window)
|
||||
call_set_active_object(This->doc_obj->ip_window, NULL);
|
||||
if(This->doc_obj->frame)
|
||||
call_set_active_object((IOleInPlaceUIWindow*)This->doc_obj->frame, NULL);
|
||||
if(This->doc_obj->hostui)
|
||||
IDocHostUIHandler_HideUI(This->doc_obj->hostui);
|
||||
if(This->doc_obj->ipsite)
|
||||
IOleInPlaceSite_OnUIDeactivate(This->doc_obj->ipsite, FALSE);
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
|
@ -805,17 +805,4 @@ void HTMLDocument_View_Init(HTMLDocument *This)
|
|||
{
|
||||
This->lpOleDocumentViewVtbl = &OleDocumentViewVtbl;
|
||||
This->lpViewObject2Vtbl = &ViewObjectVtbl;
|
||||
|
||||
This->ipsite = NULL;
|
||||
This->frame = NULL;
|
||||
This->ip_window = NULL;
|
||||
This->hwnd = NULL;
|
||||
This->tooltips_hwnd = NULL;
|
||||
|
||||
This->in_place_active = FALSE;
|
||||
This->ui_active = FALSE;
|
||||
This->window_active = FALSE;
|
||||
This->focus = FALSE;
|
||||
|
||||
This->update = 0;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#define __MSHTMDID_H__
|
||||
|
||||
#define DISPID_NORMAL_FIRST 1000
|
||||
#define DISPID_IE8_NORMAL_FIRST (DISPID_NORMAL_FIRST+150)
|
||||
|
||||
#define DISPID_OMDOCUMENT DISPID_NORMAL_FIRST
|
||||
#define DISPID_DATATRANSFER DISPID_NORMAL_FIRST
|
||||
#define DISPID_ANCHOR DISPID_NORMAL_FIRST
|
||||
|
@ -97,6 +99,31 @@
|
|||
#define DISPID_GENERIC DISPID_NORMAL_FIRST
|
||||
#define DISPID_DOMIMPLEMENTATION DISPID_NORMAL_FIRST
|
||||
|
||||
#define DISPID_IE8_ANCHOR DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_AREA DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_BASE DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_BODY DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_FORM DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_HEAD DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_IMG DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_INPUT DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_LINK DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_MOD DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_SCRIPT DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_ATTR DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_NAMEDNODEMAP DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_COLLECTION DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_PARAM DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_EMBED DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_BLOCK DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_META DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_STYLE DISPID_IE8_NORMAL_FIRST
|
||||
#define DISPID_IE8_SELECT DISPID_IE8_NORMAL_FIRST
|
||||
|
||||
#define DISPID_IE8_ELEMENTBASE (DISPID_ELEMENT+200)
|
||||
#define DISPID_IE8_ELEMENTMAX (DISPID_SITE-1)
|
||||
#define DISPID_IE8_ELEMENT DISPID_IE8_ELEMENTBASE
|
||||
|
||||
#define DISPID_COLLECTION (DISPID_NORMAL_FIRST+500)
|
||||
#define DISPID_OPTIONS_COL (DISPID_NORMAL_FIRST+500)
|
||||
#define DISPID_IMG (DISPID_IMGBASE+1000)
|
||||
|
@ -1001,6 +1028,13 @@
|
|||
/* IHTMLElementCollection3 */
|
||||
#define DISPID_IHTMLELEMENTCOLLECTION3_NAMEDITEM DISPID_COLLECTION+6
|
||||
|
||||
/* IHTMLAttributeCollection3 */
|
||||
#define DISPID_IHTMLATTRIBUTECOLLECTION3_IE8_GETNAMEDITEM DISPID_IE8_NAMEDNODEMAP
|
||||
#define DISPID_IHTMLATTRIBUTECOLLECTION3_IE8_SETNAMEDITEM DISPID_IE8_NAMEDNODEMAP+1
|
||||
#define DISPID_IHTMLATTRIBUTECOLLECTION3_IE8_REMOVENAMEDITEM DISPID_IE8_NAMEDNODEMAP+2
|
||||
#define DISPID_IHTMLATTRIBUTECOLLECTION3_IE8_ITEM DISPID_IE8_NAMEDNODEMAP+4
|
||||
#define DISPID_IHTMLATTRIBUTECOLLECTION3_IE8_LENGTH DISPID_IE8_NAMEDNODEMAP+3
|
||||
|
||||
/* IHTMLDOMChildrenCollection */
|
||||
#define DISPID_IHTMLDOMCHILDRENCOLLECTION_LENGTH DISPID_COLLECTION
|
||||
#define DISPID_IHTMLDOMCHILDRENCOLLECTION__NEWENUM DISPID_NEWENUM
|
||||
|
@ -1302,6 +1336,49 @@
|
|||
#define DISPID_IHTMLELEMENT4_ONFOCUSIN DISPID_EVPROP_ONFOCUSIN
|
||||
#define DISPID_IHTMLELEMENT4_ONFOCUSOUT DISPID_EVPROP_ONFOCUSOUT
|
||||
|
||||
/* IElementSelector */
|
||||
#define DISPID_IELEMENTSELECTOR_QUERYSELECTOR DISPID_ELEMENT+114
|
||||
#define DISPID_IELEMENTSELECTOR_QUERYSELECTORALL DISPID_ELEMENT+115
|
||||
|
||||
/* IHTMLElement5 */
|
||||
#define DISPID_IHTMLELEMENT5_IE8_GETATTRIBUTENODE DISPID_IE8_ELEMENT
|
||||
#define DISPID_IHTMLELEMENT5_IE8_SETATTRIBUTENODE DISPID_IE8_ELEMENT+1
|
||||
#define DISPID_IHTMLELEMENT5_IE8_REMOVEATTRIBUTENODE DISPID_IE8_ELEMENT+2
|
||||
#define DISPID_IHTMLELEMENT5_HASATTRIBUTE DISPID_IE8_ELEMENT+3
|
||||
#define DISPID_IHTMLELEMENT5_ROLE DISPID_IE8_ELEMENT+4
|
||||
#define DISPID_IHTMLELEMENT5_ARIABUSY DISPID_IE8_ELEMENT+5
|
||||
#define DISPID_IHTMLELEMENT5_ARIACHECKED DISPID_IE8_ELEMENT+6
|
||||
#define DISPID_IHTMLELEMENT5_ARIADISABLED DISPID_IE8_ELEMENT+7
|
||||
#define DISPID_IHTMLELEMENT5_ARIAEXPANDED DISPID_IE8_ELEMENT+8
|
||||
#define DISPID_IHTMLELEMENT5_ARIAHASPOPUP DISPID_IE8_ELEMENT+9
|
||||
#define DISPID_IHTMLELEMENT5_ARIAHIDDEN DISPID_IE8_ELEMENT+10
|
||||
#define DISPID_IHTMLELEMENT5_ARIAINVALID DISPID_IE8_ELEMENT+11
|
||||
#define DISPID_IHTMLELEMENT5_ARIAMULTISELECTABLE DISPID_IE8_ELEMENT+12
|
||||
#define DISPID_IHTMLELEMENT5_ARIAPRESSED DISPID_IE8_ELEMENT+13
|
||||
#define DISPID_IHTMLELEMENT5_ARIAREADONLY DISPID_IE8_ELEMENT+14
|
||||
#define DISPID_IHTMLELEMENT5_ARIAREQUIRED DISPID_IE8_ELEMENT+15
|
||||
#define DISPID_IHTMLELEMENT5_ARIASECRET DISPID_IE8_ELEMENT+16
|
||||
#define DISPID_IHTMLELEMENT5_ARIASELECTED DISPID_IE8_ELEMENT+17
|
||||
#define DISPID_IHTMLELEMENT5_IE8_GETATTRIBUTE DISPID_IE8_ELEMENT+18
|
||||
#define DISPID_IHTMLELEMENT5_IE8_SETATTRIBUTE DISPID_IE8_ELEMENT+19
|
||||
#define DISPID_IHTMLELEMENT5_IE8_REMOVEATTRIBUTE DISPID_IE8_ELEMENT+20
|
||||
#define DISPID_IHTMLELEMENT5_IE8_ATTRIBUTES DISPID_IE8_ELEMENT+21
|
||||
#define DISPID_IHTMLELEMENT5_ARIAVALUENOW DISPID_IE8_ELEMENT+22
|
||||
#define DISPID_IHTMLELEMENT5_ARIAPOSINSET DISPID_IE8_ELEMENT+23
|
||||
#define DISPID_IHTMLELEMENT5_ARIASETSIZE DISPID_IE8_ELEMENT+24
|
||||
#define DISPID_IHTMLELEMENT5_ARIALEVEL DISPID_IE8_ELEMENT+25
|
||||
#define DISPID_IHTMLELEMENT5_ARIAVALUEMIN DISPID_IE8_ELEMENT+26
|
||||
#define DISPID_IHTMLELEMENT5_ARIAVALUEMAX DISPID_IE8_ELEMENT+27
|
||||
#define DISPID_IHTMLELEMENT5_ARIACONTROLS DISPID_IE8_ELEMENT+28
|
||||
#define DISPID_IHTMLELEMENT5_ARIADESCRIBEDBY DISPID_IE8_ELEMENT+29
|
||||
#define DISPID_IHTMLELEMENT5_ARIAFLOWTO DISPID_IE8_ELEMENT+30
|
||||
#define DISPID_IHTMLELEMENT5_ARIALABELLEDBY DISPID_IE8_ELEMENT+31
|
||||
#define DISPID_IHTMLELEMENT5_ARIAACTIVEDESCENDANT DISPID_IE8_ELEMENT+32
|
||||
#define DISPID_IHTMLELEMENT5_ARIAOWNS DISPID_IE8_ELEMENT+33
|
||||
#define DISPID_IHTMLELEMENT5_HASATTRIBUTES DISPID_IE8_ELEMENT+34
|
||||
#define DISPID_IHTMLELEMENT5_ARIALIVE DISPID_IE8_ELEMENT+35
|
||||
#define DISPID_IHTMLELEMENT5_ARIARELEVANT DISPID_IE8_ELEMENT+36
|
||||
|
||||
/* IHTMLGenericElement */
|
||||
#define DISPID_IHTMLGENERICELEMENT_RECORDSET DISPID_GENERIC+1
|
||||
#define DISPID_IHTMLGENERICELEMENT_NAMEDRECORDSET DISPID_GENERIC+2
|
||||
|
@ -1998,6 +2075,26 @@
|
|||
#define DISPID_IHTMLDOMATTRIBUTE_NODEVALUE DISPID_DOMATTRIBUTE+2
|
||||
#define DISPID_IHTMLDOMATTRIBUTE_SPECIFIED DISPID_DOMATTRIBUTE+1
|
||||
|
||||
/* IHTMLDOMAttribute2 */
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_NAME DISPID_DOMATTRIBUTE+3
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_VALUE DISPID_DOMATTRIBUTE+4
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_EXPANDO DISPID_DOMATTRIBUTE+5
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_NODETYPE DISPID_DOMATTRIBUTE+6
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_PARENTNODE DISPID_DOMATTRIBUTE+7
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_CHILDNODES DISPID_DOMATTRIBUTE+8
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_FIRSTCHILD DISPID_DOMATTRIBUTE+9
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_LASTCHILD DISPID_DOMATTRIBUTE+10
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_PREVIOUSSIBLING DISPID_DOMATTRIBUTE+11
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_NEXTSIBLING DISPID_DOMATTRIBUTE+12
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_ATTRIBUTES DISPID_DOMATTRIBUTE+13
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_OWNERDOCUMENT DISPID_DOMATTRIBUTE+14
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_INSERTBEFORE DISPID_DOMATTRIBUTE+15
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_REPLACECHILD DISPID_DOMATTRIBUTE+16
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_REMOVECHILD DISPID_DOMATTRIBUTE+17
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_APPENDCHILD DISPID_DOMATTRIBUTE+18
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_HASCHILDNODES DISPID_DOMATTRIBUTE+19
|
||||
#define DISPID_IHTMLDOMATTRIBUTE2_CLONENODE DISPID_DOMATTRIBUTE+20
|
||||
|
||||
/* IHTMLBodyElement */
|
||||
#define DISPID_IHTMLBODYELEMENT_BACKGROUND DISPID_A_BACKGROUNDIMAGE
|
||||
#define DISPID_IHTMLBODYELEMENT_BGPROPERTIES DISPID_A_BACKGROUNDATTACHMENT
|
||||
|
@ -2047,6 +2144,18 @@
|
|||
#define DISPID_IHTMLANCHORELEMENT_FOCUS DISPID_SITE+0
|
||||
#define DISPID_IHTMLANCHORELEMENT_BLUR DISPID_SITE+2
|
||||
|
||||
/* IHTMLAnchorElement2 */
|
||||
#define DISPID_IHTMLANCHORELEMENT2_CHARSET DISPID_ANCHOR+23
|
||||
#define DISPID_IHTMLANCHORELEMENT2_COORDS DISPID_ANCHOR+24
|
||||
#define DISPID_IHTMLANCHORELEMENT2_HREFLANG DISPID_ANCHOR+25
|
||||
#define DISPID_IHTMLANCHORELEMENT2_SHAPE DISPID_ANCHOR+26
|
||||
#define DISPID_IHTMLANCHORELEMENT2_TYPE DISPID_ANCHOR+27
|
||||
|
||||
/* IHTMLAnchorElement3 */
|
||||
#define DISPID_IHTMLANCHORELEMENT3_IE8_SHAPE DISPID_IE8_ANCHOR+1
|
||||
#define DISPID_IHTMLANCHORELEMENT3_IE8_COORDS DISPID_IE8_ANCHOR+2
|
||||
#define DISPID_IHTMLANCHORELEMENT3_IE8_HREF DISPID_IE8_ANCHOR+3
|
||||
|
||||
/* IHTMLTxtRange */
|
||||
#define DISPID_IHTMLTXTRANGE_HTMLTEXT DISPID_RANGE+3
|
||||
#define DISPID_IHTMLTXTRANGE_TEXT DISPID_RANGE+4
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue