mshtml: Added support for ZoomFactor registry value.

This commit is contained in:
Jacek Caban 2014-02-19 17:24:24 +01:00 committed by Alexandre Julliard
parent 99eab9d3c7
commit 92517e2c5e
2 changed files with 92 additions and 2 deletions

View File

@ -3701,6 +3701,47 @@ interface nsIDocShell : nsIDocShellTreeItem
nsresult GetCurrentSHEntry(nsISHEntry **aEntry, bool *_retval);
}
[
object,
uuid(02d37b31-e654-4b74-9bc3-14dfe0020bb3),
local
]
interface nsIMarkupDocumentViewer : nsISupports
{
nsresult ScrollToNode(nsIDOMNode *node);
nsresult GetTextZoom(float *aTextZoom);
nsresult SetTextZoom(float aTextZoom);
nsresult GetFullZoom(float *aFullZoom);
nsresult SetFullZoom(float aFullZoom);
nsresult GetAuthorStyleDisabled(bool *aAuthorStyleDisabled);
nsresult SetAuthorStyleDisabled(bool aAuthorStyleDisabled);
nsresult GetDefaultCharacterSet(nsACString *aDefaultCharacterSet);
nsresult SetDefaultCharacterSet(const nsACString *aDefaultCharacterSet);
nsresult GetForceCharacterSet(nsACString *aForceCharacterSet);
nsresult SetForceCharacterSet(const nsACString *aForceCharacterSet);
nsresult GetHintCharacterSet(nsACString *aHintCharacterSet);
nsresult SetHintCharacterSet(const nsACString *aHintCharacterSet);
nsresult GetHintCharacterSetSource(int32_t *aHintCharacterSetSource);
nsresult SetHintCharacterSetSource(int32_t aHintCharacterSetSource);
nsresult GetPrevDocCharacterSet(nsACString *aPrevDocCharacterSet);
nsresult SetPrevDocCharacterSet(const nsACString *aPrevDocCharacterSet);
nsresult GetContentSize(int32_t *width, int32_t *height);
nsresult GetBidiTextDirection(uint8_t *aBidiTextDirection);
nsresult SetBidiTextDirection(uint8_t aBidiTextDirection);
nsresult GetBidiTextType(uint8_t *aBidiTextType);
nsresult SetBidiTextType(uint8_t aBidiTextType);
nsresult GetBidiNumeral(uint8_t *aBidiNumeral);
nsresult SetBidiNumeral(uint8_t aBidiNumeral);
nsresult GetBidiSupport(uint8_t *aBidiSupport);
nsresult SetBidiSupport(uint8_t aBidiSupport);
nsresult GetBidiOptions(uint32_t *aBidiOptions);
nsresult SetBidiOptions(uint32_t aBidiOptions);
nsresult GetMinFontSize(int32_t *aMinFontSize);
nsresult SetMinFontSize(int32_t aMinFontSize);
nsresult AppendSubtree(void /* nsTArray<nsCOMPtr<nsIMarkupDocumentViewer>> */ *array);
nsresult ChangeMaxLineBoxWidth(int32_t maxLineBoxWidth);
}
[
object,
uuid(16fe5e3e-eadc-4312-9d44-b6bedd6b5474),

View File

@ -20,6 +20,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#define COBJMACROS
@ -226,6 +227,52 @@ void set_document_navigation(HTMLDocumentObj *doc, BOOL doc_can_navigate)
doc_can_navigate ? &var : NULL, NULL);
}
static void load_settings(HTMLDocumentObj *doc)
{
nsIMarkupDocumentViewer *markup_document_viewer;
nsIContentViewer *content_viewer;
nsIDocShell *doc_shell;
HKEY settings_key;
DWORD val, size;
LONG res;
nsresult nsres;
static const WCHAR ie_keyW[] = {
'S','O','F','T','W','A','R','E','\\',
'M','i','c','r','o','s','o','f','t','\\',
'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r',0};
static const WCHAR zoomW[] = {'Z','o','o','m',0};
static const WCHAR zoom_factorW[] = {'Z','o','o','m','F','a','c','t','o','r',0};
res = RegOpenKeyW(HKEY_CURRENT_USER, ie_keyW, &settings_key);
if(res != ERROR_SUCCESS)
return;
size = sizeof(val);
res = RegGetValueW(settings_key, zoomW, zoom_factorW, RRF_RT_REG_DWORD, NULL, &val, &size);
RegCloseKey(settings_key);
if(res != ERROR_SUCCESS)
return;
TRACE("Setting ZoomFactor to %u\n", val);
nsres = get_nsinterface((nsISupports*)doc->nscontainer->navigation, &IID_nsIDocShell, (void**)&doc_shell);
assert(nsres == NS_OK);
nsres = nsIDocShell_GetContentViewer(doc_shell, &content_viewer);
assert(nsres == NS_OK && content_viewer);
nsres = nsISupports_QueryInterface(content_viewer, &IID_nsIMarkupDocumentViewer, (void**)&markup_document_viewer);
nsISupports_Release(content_viewer);
assert(nsres == NS_OK);
nsres = nsIMarkupDocumentViewer_SetFullZoom(markup_document_viewer, (float)val/100000);
if(NS_FAILED(nsres))
ERR("SetFullZoom failed: %08x\n", nsres);
nsIDocShell_Release(doc_shell);
}
static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite *pClientSite)
{
HTMLDocument *This = impl_from_IOleObject(iface);
@ -319,7 +366,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
if(hres == S_OK && key_path) {
if(key_path[0]) {
/* FIXME: use key_path */
TRACE("key_path = %s\n", debugstr_w(key_path));
FIXME("key_path = %s\n", debugstr_w(key_path));
}
CoTaskMemFree(key_path);
}
@ -331,7 +378,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
if(hres == S_OK && override_key_path && override_key_path[0]) {
if(override_key_path[0]) {
/*FIXME: use override_key_path */
TRACE("override_key_path = %s\n", debugstr_w(override_key_path));
FIXME("override_key_path = %s\n", debugstr_w(override_key_path));
}
CoTaskMemFree(override_key_path);
}
@ -342,6 +389,8 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
}
}
load_settings(This->doc_obj);
/* Native calls here GetWindow. What is it for?
* We don't have anything to do with it here (yet). */
hres = IOleClientSite_QueryInterface(pClientSite, &IID_IOleWindow, (void**)&ole_window);