mshtml: Introduce timer_type enum.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-04-22 01:49:02 +02:00 committed by Alexandre Julliard
parent 4f358c40b2
commit 8b6a3f554a
3 changed files with 14 additions and 7 deletions

View File

@ -1734,7 +1734,7 @@ static HRESULT WINAPI HTMLWindow3_detachEvent(IHTMLWindow3 *iface, BSTR event, I
}
static HRESULT window_set_timer(HTMLInnerWindow *This, VARIANT *expr, LONG msec, VARIANT *language,
BOOL interval, LONG *timer_id)
enum timer_type timer_type, LONG *timer_id)
{
IDispatch *disp = NULL;
HRESULT hres;
@ -1757,7 +1757,7 @@ static HRESULT window_set_timer(HTMLInnerWindow *This, VARIANT *expr, LONG msec,
if(!disp)
return E_FAIL;
hres = set_task_timer(This, msec, interval, disp, timer_id);
hres = set_task_timer(This, msec, timer_type, disp, timer_id);
IDispatch_Release(disp);
return hres;
@ -1770,7 +1770,7 @@ static HRESULT WINAPI HTMLWindow3_setTimeout(IHTMLWindow3 *iface, VARIANT *expre
TRACE("(%p)->(%s %d %s %p)\n", This, debugstr_variant(expression), msec, debugstr_variant(language), timerID);
return window_set_timer(This->inner_window, expression, msec, language, FALSE, timerID);
return window_set_timer(This->inner_window, expression, msec, language, TIMER_TIMEOUT, timerID);
}
static HRESULT WINAPI HTMLWindow3_setInterval(IHTMLWindow3 *iface, VARIANT *expression, LONG msec,
@ -1780,7 +1780,7 @@ static HRESULT WINAPI HTMLWindow3_setInterval(IHTMLWindow3 *iface, VARIANT *expr
TRACE("(%p)->(%p %d %p %p)\n", This, expression, msec, language, timerID);
return window_set_timer(This->inner_window, expression, msec, language, TRUE, timerID);
return window_set_timer(This->inner_window, expression, msec, language, TIMER_INTERVAL, timerID);
}
static HRESULT WINAPI HTMLWindow3_print(IHTMLWindow3 *iface)

View File

@ -1213,7 +1213,12 @@ LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
HRESULT set_task_timer(HTMLInnerWindow*,LONG,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
enum timer_type {
TIMER_TIMEOUT,
TIMER_INTERVAL,
};
HRESULT set_task_timer(HTMLInnerWindow*,LONG,enum timer_type,IDispatch*,LONG*) DECLSPEC_HIDDEN;
HRESULT clear_task_timer(HTMLInnerWindow*,DWORD) DECLSPEC_HIDDEN;
BOOL parse_compat_version(const WCHAR*,compat_mode_t*) DECLSPEC_HIDDEN;

View File

@ -41,6 +41,7 @@ typedef struct {
DWORD id;
DWORD time;
DWORD interval;
enum timer_type type;
IDispatch *disp;
struct list entry;
@ -162,7 +163,7 @@ static BOOL queue_timer(thread_data_t *thread_data, task_timer_t *timer)
return FALSE;
}
HRESULT set_task_timer(HTMLInnerWindow *window, LONG msec, BOOL interval, IDispatch *disp, LONG *id)
HRESULT set_task_timer(HTMLInnerWindow *window, LONG msec, enum timer_type timer_type, IDispatch *disp, LONG *id)
{
thread_data_t *thread_data;
task_timer_t *timer;
@ -184,7 +185,8 @@ HRESULT set_task_timer(HTMLInnerWindow *window, LONG msec, BOOL interval, IDispa
timer->id = id_cnt++;
timer->window = window;
timer->time = tc + msec;
timer->interval = interval ? msec : 0;
timer->interval = timer_type == TIMER_INTERVAL ? msec : 0;
timer->type = timer_type;
list_init(&timer->entry);
IDispatch_AddRef(disp);