mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
added zooming front end.
This commit is contained in:
parent
768d09d96e
commit
04b6780a88
@ -185,6 +185,8 @@ public:
|
||||
NS_IMETHOD SetScrolling(PRInt32 aScrolling, PRBool aSetCurrentAndInitial = PR_TRUE);
|
||||
NS_IMETHOD GetIsFrame(PRBool& aIsFrame);
|
||||
NS_IMETHOD SetIsFrame(PRBool aIsFrame);
|
||||
NS_IMETHOD SetZoom(float aZoom);
|
||||
NS_IMETHOD GetZoom(float *aZoom);
|
||||
|
||||
// Document load api's
|
||||
NS_IMETHOD GetDocumentLoader(nsIDocumentLoader*& aResult);
|
||||
@ -365,6 +367,8 @@ protected:
|
||||
nsURLReloadType aType,
|
||||
const PRUint32 aLocalIP);
|
||||
|
||||
float mZoom;
|
||||
|
||||
static nsIPluginHost *mPluginHost;
|
||||
static nsIPluginManager *mPluginManager;
|
||||
static PRUint32 mPluginInitCnt;
|
||||
@ -1279,6 +1283,55 @@ nsWebShell::SetIsFrame(PRBool aIsFrame)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::SetZoom(float aZoom)
|
||||
{
|
||||
mZoom = aZoom;
|
||||
|
||||
if (mDeviceContext)
|
||||
mDeviceContext->SetZoom(mZoom);
|
||||
|
||||
if (mContentViewer) {
|
||||
nsIDocumentViewer* docv = nsnull;
|
||||
mContentViewer->QueryInterface(kIDocumentViewerIID, (void**) &docv);
|
||||
if (nsnull != docv) {
|
||||
nsIPresContext* cx = nsnull;
|
||||
docv->GetPresContext(cx);
|
||||
if (nsnull != cx) {
|
||||
nsIPresShell *shell = nsnull;
|
||||
cx->GetShell(&shell);
|
||||
if (nsnull != shell) {
|
||||
nsIViewManager *vm = nsnull;
|
||||
shell->GetViewManager(&vm);
|
||||
if (nsnull != vm) {
|
||||
nsIView *rootview = nsnull;
|
||||
nsIScrollableView *sv = nsnull;
|
||||
vm->GetRootScrollableView(&sv);
|
||||
if (nsnull != sv)
|
||||
sv->ComputeScrollOffsets();
|
||||
vm->GetRootView(rootview);
|
||||
if (nsnull != rootview)
|
||||
vm->UpdateView(rootview, nsnull, 0);
|
||||
NS_RELEASE(vm);
|
||||
}
|
||||
NS_RELEASE(shell);
|
||||
}
|
||||
NS_RELEASE(cx);
|
||||
}
|
||||
NS_RELEASE(docv);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetZoom(float *aZoom)
|
||||
{
|
||||
*aZoom = mZoom;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Document Load methods
|
||||
|
@ -339,11 +339,17 @@ public:
|
||||
|
||||
NS_IMETHOD GetDefaultCharacterSet (const PRUnichar** aDefaultCharacterSet) = 0;
|
||||
NS_IMETHOD SetDefaultCharacterSet (const PRUnichar* aDefaultCharacterSet) = 0;
|
||||
/**
|
||||
* Set/Get the document scale factor
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetZoom(float aZoom) = 0;
|
||||
NS_IMETHOD GetZoom(float *aZoom) = 0;
|
||||
|
||||
/**
|
||||
* Finds text in content
|
||||
*/
|
||||
NS_IMETHOD FindNext(const PRUnichar * aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) = 0;
|
||||
|
||||
};
|
||||
|
||||
extern "C" NS_WEB nsresult
|
||||
|
@ -185,6 +185,8 @@ public:
|
||||
NS_IMETHOD SetScrolling(PRInt32 aScrolling, PRBool aSetCurrentAndInitial = PR_TRUE);
|
||||
NS_IMETHOD GetIsFrame(PRBool& aIsFrame);
|
||||
NS_IMETHOD SetIsFrame(PRBool aIsFrame);
|
||||
NS_IMETHOD SetZoom(float aZoom);
|
||||
NS_IMETHOD GetZoom(float *aZoom);
|
||||
|
||||
// Document load api's
|
||||
NS_IMETHOD GetDocumentLoader(nsIDocumentLoader*& aResult);
|
||||
@ -365,6 +367,8 @@ protected:
|
||||
nsURLReloadType aType,
|
||||
const PRUint32 aLocalIP);
|
||||
|
||||
float mZoom;
|
||||
|
||||
static nsIPluginHost *mPluginHost;
|
||||
static nsIPluginManager *mPluginManager;
|
||||
static PRUint32 mPluginInitCnt;
|
||||
@ -1279,6 +1283,55 @@ nsWebShell::SetIsFrame(PRBool aIsFrame)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::SetZoom(float aZoom)
|
||||
{
|
||||
mZoom = aZoom;
|
||||
|
||||
if (mDeviceContext)
|
||||
mDeviceContext->SetZoom(mZoom);
|
||||
|
||||
if (mContentViewer) {
|
||||
nsIDocumentViewer* docv = nsnull;
|
||||
mContentViewer->QueryInterface(kIDocumentViewerIID, (void**) &docv);
|
||||
if (nsnull != docv) {
|
||||
nsIPresContext* cx = nsnull;
|
||||
docv->GetPresContext(cx);
|
||||
if (nsnull != cx) {
|
||||
nsIPresShell *shell = nsnull;
|
||||
cx->GetShell(&shell);
|
||||
if (nsnull != shell) {
|
||||
nsIViewManager *vm = nsnull;
|
||||
shell->GetViewManager(&vm);
|
||||
if (nsnull != vm) {
|
||||
nsIView *rootview = nsnull;
|
||||
nsIScrollableView *sv = nsnull;
|
||||
vm->GetRootScrollableView(&sv);
|
||||
if (nsnull != sv)
|
||||
sv->ComputeScrollOffsets();
|
||||
vm->GetRootView(rootview);
|
||||
if (nsnull != rootview)
|
||||
vm->UpdateView(rootview, nsnull, 0);
|
||||
NS_RELEASE(vm);
|
||||
}
|
||||
NS_RELEASE(shell);
|
||||
}
|
||||
NS_RELEASE(cx);
|
||||
}
|
||||
NS_RELEASE(docv);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetZoom(float *aZoom)
|
||||
{
|
||||
*aZoom = mZoom;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Document Load methods
|
||||
|
@ -611,6 +611,17 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
|
||||
DoImageInspector();
|
||||
break;
|
||||
|
||||
case VIEWER_ZOOM_500:
|
||||
case VIEWER_ZOOM_300:
|
||||
case VIEWER_ZOOM_200:
|
||||
case VIEWER_ZOOM_100:
|
||||
case VIEWER_ZOOM_070:
|
||||
case VIEWER_ZOOM_050:
|
||||
case VIEWER_ZOOM_030:
|
||||
case VIEWER_ZOOM_020:
|
||||
mWebShell->SetZoom((aID - VIEWER_ZOOM_BASE) / 10.0f);
|
||||
break;
|
||||
|
||||
#ifdef ClientWallet
|
||||
case PRVCY_PREFILL:
|
||||
case PRVCY_QPREFILL:
|
||||
|
@ -86,6 +86,16 @@
|
||||
#define VIEWER_EDIT_JOIN_CELL_RIGHT 40558
|
||||
#define VIEWER_EDIT_JOIN_CELL_BELOW 40559
|
||||
|
||||
#define VIEWER_ZOOM_BASE 40600
|
||||
#define VIEWER_ZOOM_500 40650
|
||||
#define VIEWER_ZOOM_300 40630
|
||||
#define VIEWER_ZOOM_200 40620
|
||||
#define VIEWER_ZOOM_100 40610
|
||||
#define VIEWER_ZOOM_070 40607
|
||||
#define VIEWER_ZOOM_050 40605
|
||||
#define VIEWER_ZOOM_030 40603
|
||||
#define VIEWER_ZOOM_020 40602
|
||||
|
||||
// Note: must be in ascending sequential order
|
||||
#define VIEWER_ONE_COLUMN 40050
|
||||
#define VIEWER_TWO_COLUMN 40051
|
||||
|
Loading…
Reference in New Issue
Block a user