mshtml: Implement performance.timing.msFirstPaint.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2022-11-22 18:26:22 +02:00 committed by Alexandre Julliard
parent 72b13c5ab8
commit dd30d429fa
4 changed files with 7 additions and 4 deletions

View file

@ -524,6 +524,7 @@ typedef struct {
ULONGLONG dom_content_loaded_event_end_time; ULONGLONG dom_content_loaded_event_end_time;
ULONGLONG load_event_start_time; ULONGLONG load_event_start_time;
ULONGLONG load_event_end_time; ULONGLONG load_event_end_time;
ULONGLONG first_paint_time;
} HTMLPerformanceTiming; } HTMLPerformanceTiming;
typedef struct nsChannelBSC nsChannelBSC; typedef struct nsChannelBSC nsChannelBSC;

View file

@ -1585,8 +1585,6 @@ static HRESULT WINAPI HTMLPerformanceTiming_Invoke(IHTMLPerformanceTiming *iface
pDispParams, pVarResult, pExcepInfo, puArgErr); pDispParams, pVarResult, pExcepInfo, puArgErr);
} }
#define TIMING_FAKE_TIMESTAMP 0xdeadbeef
static ULONGLONG get_fetch_time(HTMLPerformanceTiming *This) static ULONGLONG get_fetch_time(HTMLPerformanceTiming *This)
{ {
/* If there's no prior doc unloaded and no redirects, fetch time == navigationStart time */ /* If there's no prior doc unloaded and no redirects, fetch time == navigationStart time */
@ -1816,9 +1814,9 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_msFirstPaint(IHTMLPerformanceTim
{ {
HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface); HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
FIXME("(%p)->(%p) returning fake value\n", This, p); TRACE("(%p)->(%p)\n", This, p);
*p = TIMING_FAKE_TIMESTAMP; *p = This->first_paint_time;
return S_OK; return S_OK;
} }

View file

@ -39,6 +39,7 @@ ok(performance.timing.unloadEventStart === 0, "unloadEventStart != 0");
ok(performance.timing.unloadEventEnd === 0, "unloadEventEnd != 0"); ok(performance.timing.unloadEventEnd === 0, "unloadEventEnd != 0");
ok(performance.timing.redirectStart === 0, "redirectStart != 0"); ok(performance.timing.redirectStart === 0, "redirectStart != 0");
ok(performance.timing.redirectEnd === 0, "redirectEnd != 0"); ok(performance.timing.redirectEnd === 0, "redirectEnd != 0");
ok(performance.timing.msFirstPaint === 0, "msFirstPaint != 0");
var pageshow_fired = false, pagehide_fired = false; var pageshow_fired = false, pagehide_fired = false;
document.doc_unload_events_called = false; document.doc_unload_events_called = false;

View file

@ -50,6 +50,9 @@ static void paint_document(HTMLDocumentObj *This)
RECT rect; RECT rect;
HDC hdc; HDC hdc;
if(This->window && This->window->base.inner_window && !This->window->base.inner_window->performance_timing->first_paint_time)
This->window->base.inner_window->performance_timing->first_paint_time = get_time_stamp();
GetClientRect(This->hwnd, &rect); GetClientRect(This->hwnd, &rect);
hdc = BeginPaint(This->hwnd, &ps); hdc = BeginPaint(This->hwnd, &ps);