Commit ca54be2c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLScreen::get_width implementation.

parent 1ddc01c0
......@@ -148,8 +148,11 @@ static HRESULT WINAPI HTMLScreen_get_bufferDepth(IHTMLScreen *iface, LONG *p)
static HRESULT WINAPI HTMLScreen_get_width(IHTMLScreen *iface, LONG *p)
{
HTMLScreen *This = HTMLSCREEN_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
*p = GetDeviceCaps(get_display_dc(), HORZRES);
return S_OK;
}
static HRESULT WINAPI HTMLScreen_get_height(IHTMLScreen *iface, LONG *p)
......
......@@ -47,6 +47,7 @@ HINSTANCE hInst;
DWORD mshtml_tls = TLS_OUT_OF_INDEXES;
static HINSTANCE shdoclc = NULL;
static HDC display_dc;
static void thread_detach(void)
{
......@@ -71,6 +72,8 @@ static void process_detach(void)
FreeLibrary(shdoclc);
if(mshtml_tls != TLS_OUT_OF_INDEXES)
TlsFree(mshtml_tls);
if(display_dc)
DeleteObject(display_dc);
}
HINSTANCE get_shdoclc(void)
......@@ -84,6 +87,21 @@ HINSTANCE get_shdoclc(void)
return shdoclc = LoadLibraryExW(wszShdoclc, NULL, LOAD_LIBRARY_AS_DATAFILE);
}
HDC get_display_dc(void)
{
static const WCHAR displayW[] = {'D','I','S','P','L','A','Y',0};
if(!display_dc) {
HDC hdc;
hdc = CreateICW(displayW, NULL, NULL, NULL);
if(InterlockedCompareExchangePointer((void**)&display_dc, hdc, NULL))
DeleteObject(hdc);
}
return display_dc;
}
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
{
switch(fdwReason) {
......
......@@ -940,6 +940,7 @@ static inline void windowref_release(windowref_t *ref)
heap_free(ref);
}
HDC get_display_dc(void);
HINSTANCE get_shdoclc(void);
extern HINSTANCE hInst;
......@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = mshtml.dll
IMPORTS = ole32 oleaut32 user32 urlmon advapi32 kernel32
IMPORTS = ole32 oleaut32 user32 urlmon gdi32 advapi32 kernel32
CTESTS = \
dom.c \
......
......@@ -3035,8 +3035,12 @@ static void test_navigator(IHTMLDocument2 *doc)
static void test_screen(IHTMLWindow2 *window)
{
IHTMLScreen *screen, *screen2;
LONG l, exl;
HDC hdc;
HRESULT hres;
static const WCHAR displayW[] = {'D','I','S','P','L','A','Y',0};
screen = NULL;
hres = IHTMLWindow2_get_screen(window, &screen);
ok(hres == S_OK, "get_screen failed: %08x\n", hres);
......@@ -3051,6 +3055,17 @@ static void test_screen(IHTMLWindow2 *window)
test_disp((IUnknown*)screen, &DIID_DispHTMLScreen, "[object]");
hdc = CreateICW(displayW, NULL, NULL, NULL);
exl = GetDeviceCaps(hdc, HORZRES);
l = 0xdeadbeef;
hres = IHTMLScreen_get_width(screen, &l);
ok(hres == S_OK, "get_width failed: %08x\n", hres);
ok(l == exl, "width = %d, expected %d\n", l, exl);
DeleteObject(hdc);
IHTMLScreen_Release(screen);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment