mshtml: Added IHTMLScreen::get_width implementation.

This commit is contained in:
Jacek Caban 2009-11-30 17:57:39 +01:00 committed by Alexandre Julliard
parent 1ddc01c09b
commit ca54be2cc6
5 changed files with 40 additions and 3 deletions

View File

@ -148,8 +148,11 @@ static HRESULT WINAPI HTMLScreen_get_bufferDepth(IHTMLScreen *iface, LONG *p)
static HRESULT WINAPI HTMLScreen_get_width(IHTMLScreen *iface, LONG *p) static HRESULT WINAPI HTMLScreen_get_width(IHTMLScreen *iface, LONG *p)
{ {
HTMLScreen *This = HTMLSCREEN_THIS(iface); 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) static HRESULT WINAPI HTMLScreen_get_height(IHTMLScreen *iface, LONG *p)

View File

@ -47,6 +47,7 @@ HINSTANCE hInst;
DWORD mshtml_tls = TLS_OUT_OF_INDEXES; DWORD mshtml_tls = TLS_OUT_OF_INDEXES;
static HINSTANCE shdoclc = NULL; static HINSTANCE shdoclc = NULL;
static HDC display_dc;
static void thread_detach(void) static void thread_detach(void)
{ {
@ -71,6 +72,8 @@ static void process_detach(void)
FreeLibrary(shdoclc); FreeLibrary(shdoclc);
if(mshtml_tls != TLS_OUT_OF_INDEXES) if(mshtml_tls != TLS_OUT_OF_INDEXES)
TlsFree(mshtml_tls); TlsFree(mshtml_tls);
if(display_dc)
DeleteObject(display_dc);
} }
HINSTANCE get_shdoclc(void) HINSTANCE get_shdoclc(void)
@ -84,6 +87,21 @@ HINSTANCE get_shdoclc(void)
return shdoclc = LoadLibraryExW(wszShdoclc, NULL, LOAD_LIBRARY_AS_DATAFILE); 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) BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
{ {
switch(fdwReason) { switch(fdwReason) {

View File

@ -940,6 +940,7 @@ static inline void windowref_release(windowref_t *ref)
heap_free(ref); heap_free(ref);
} }
HDC get_display_dc(void);
HINSTANCE get_shdoclc(void); HINSTANCE get_shdoclc(void);
extern HINSTANCE hInst; extern HINSTANCE hInst;

View File

@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR = @srcdir@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
TESTDLL = mshtml.dll TESTDLL = mshtml.dll
IMPORTS = ole32 oleaut32 user32 urlmon advapi32 kernel32 IMPORTS = ole32 oleaut32 user32 urlmon gdi32 advapi32 kernel32
CTESTS = \ CTESTS = \
dom.c \ dom.c \

View File

@ -3035,8 +3035,12 @@ static void test_navigator(IHTMLDocument2 *doc)
static void test_screen(IHTMLWindow2 *window) static void test_screen(IHTMLWindow2 *window)
{ {
IHTMLScreen *screen, *screen2; IHTMLScreen *screen, *screen2;
LONG l, exl;
HDC hdc;
HRESULT hres; HRESULT hres;
static const WCHAR displayW[] = {'D','I','S','P','L','A','Y',0};
screen = NULL; screen = NULL;
hres = IHTMLWindow2_get_screen(window, &screen); hres = IHTMLWindow2_get_screen(window, &screen);
ok(hres == S_OK, "get_screen failed: %08x\n", hres); 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]"); 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); IHTMLScreen_Release(screen);
} }