From bd5d6f753c355311670f41be5a53259e6c5b645c Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sun, 10 Jun 2007 11:52:53 +0200 Subject: [PATCH] mshtml: Set default scrollbar preferences. --- dlls/mshtml/nsembed.c | 20 +++++++++++++++++++- dlls/mshtml/nsiface.idl | 31 ++++++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index f8944e99a5e..df6bcf3f1d0 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006 Jacek Caban for CodeWeavers + * Copyright 2005-2007 Jacek Caban for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -1526,6 +1526,7 @@ NSContainer *NSContainer_Create(HTMLDocument *doc, NSContainer *parent) { nsIDOMWindow *dom_window; nsIWebBrowserSetup *wbsetup; + nsIScrollable *scrollable; NSContainer *ret; nsresult nsres; @@ -1642,6 +1643,23 @@ NSContainer *NSContainer_Create(HTMLDocument *doc, NSContainer *parent) ERR("GetContentDOMWindow failed: %08x\n", nsres); } + nsres = nsIWebBrowser_QueryInterface(ret->webbrowser, &IID_nsIScrollable, (void**)&scrollable); + if(NS_SUCCEEDED(nsres)) { + nsres = nsIScrollable_SetDefaultScrollbarPreferences(scrollable, + ScrollOrientation_Y, Scrollbar_Always); + if(NS_FAILED(nsres)) + ERR("Could not set default Y scrollbar prefs: %08x\n", nsres); + + nsres = nsIScrollable_SetDefaultScrollbarPreferences(scrollable, + ScrollOrientation_X, Scrollbar_Auto); + if(NS_FAILED(nsres)) + ERR("Could not set default X scrollbar prefs: %08x\n", nsres); + + nsIScrollable_Release(scrollable); + }else { + ERR("Could not get nsIScrollable: %08x\n", nsres); + } + return ret; } diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl index 9643e612ea2..347fd49d1cb 100644 --- a/dlls/mshtml/nsiface.idl +++ b/dlls/mshtml/nsiface.idl @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006 Jacek Caban for CodeWeavers + * Copyright 2005-2007 Jacek Caban for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -1149,6 +1149,35 @@ interface nsIWebBrowserPrint : nsISupports nsresult ExitPrintPreview(); } +[ + object, + uuid(919e792a-6490-40b8-bba5-f9e9ad5640c8) +] +interface nsIScrollable : nsISupports +{ + enum { + ScrollOrientation_X = 1, + ScrollOrientation_Y = 2 + }; + + enum { + Scrollbar_Auto = 1, + Scrollbar_Never = 2, + Scrollbar_Always = 3 + }; + + nsresult GetCurScrollPos(PRInt32 scrollOrientation, PRInt32 *curPos); + nsresult SetCurScrollPos(PRInt32 scrollOrientation, PRInt32 curPos); + nsresult SetCurScrollPosEx(PRInt32 curHorizontalPos, PRInt32 curVerticalPos); + nsresult GetScrollRange(PRInt32 scrollOrientation, PRInt32 *minPos, PRInt32 *maxPos); + nsresult SetScrollRange(PRInt32 scrollOrientation, PRInt32 minPos, PRInt32 maxPos); + nsresult SetScrollRangeEx(PRInt32 minHorizontalPos, PRInt32 maxHorizontalPos, + PRInt32 minVerticalPos, PRInt32 maxVerticalPos); + nsresult GetDefaultScrollbarPreferences(PRInt32 scrollOrientation, PRInt32 *scrollbarPref); + nsresult SetDefaultScrollbarPreferences(PRInt32 scrollOrientation, PRInt32 scrollbarPref); + nsresult GetScrollbarVisibility(PRBool *verticalVisible, PRBool *horizontalVisible); +} + [ object, uuid(c8c0a080-0868-11d3-915f-d9d889d48e3c)