зеркало из https://github.com/mozilla/pjs.git
Fix popup positioning when window is scrolled.
This commit is contained in:
Родитель
5c88264a39
Коммит
0009949240
|
@ -54,6 +54,8 @@
|
|||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
@ -64,6 +66,8 @@
|
|||
// Common helper routines (also used by the context menu code)
|
||||
#include "CHGeckoUtils.h"
|
||||
|
||||
#import "CHBrowserView.h"
|
||||
|
||||
static void FindOptionWithContentID(nsIDOMHTMLSelectElement* aSel, PRUint32 aID, nsIDOMHTMLOptionElement** aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
|
@ -211,6 +215,13 @@ ContentClickListener::MouseDown(nsIDOMEvent* aEvent)
|
|||
|
||||
PRInt32 xDelta = clientX - left;
|
||||
PRInt32 yDelta = top + height - clientY;
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> window = getter_AddRefs([[[mBrowserController getBrowserWrapper] getBrowserView] getContentWindow]);
|
||||
PRInt32 scrollX, scrollY;
|
||||
window->GetScrollX(&scrollX);
|
||||
window->GetScrollY(&scrollY);
|
||||
xDelta += scrollX; // Normal direction.
|
||||
yDelta -= scrollY; // Remember, y is flipped.
|
||||
|
||||
#define XMENUOFFSET 20
|
||||
#define MENUHEIGHT 20
|
||||
|
|
|
@ -388,5 +388,26 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
}
|
||||
}
|
||||
|
||||
static PRBool gSetupSmoothTextMenu = PR_FALSE;
|
||||
|
||||
-(BOOL)validateMenuItem: (id <NSMenuItem> )aMenuItem
|
||||
{
|
||||
// XXXDWH I should not be using strings here. Not localizable.
|
||||
// SHould use tags instead.
|
||||
if ([[aMenuItem title] isEqualToString: @"Smooth Text"] &&
|
||||
!gSetupSmoothTextMenu) {
|
||||
gSetupSmoothTextMenu = PR_TRUE;
|
||||
// Grab the prefs service and just set the pref directly.
|
||||
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
|
||||
int mode;
|
||||
pref->GetIntPref("nglayout.mac.renderingmode", &mode);
|
||||
if (mode == 0)
|
||||
[aMenuItem setState: NSOffState];
|
||||
else
|
||||
[aMenuItem setState: NSOnState];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -388,5 +388,26 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
}
|
||||
}
|
||||
|
||||
static PRBool gSetupSmoothTextMenu = PR_FALSE;
|
||||
|
||||
-(BOOL)validateMenuItem: (id <NSMenuItem> )aMenuItem
|
||||
{
|
||||
// XXXDWH I should not be using strings here. Not localizable.
|
||||
// SHould use tags instead.
|
||||
if ([[aMenuItem title] isEqualToString: @"Smooth Text"] &&
|
||||
!gSetupSmoothTextMenu) {
|
||||
gSetupSmoothTextMenu = PR_TRUE;
|
||||
// Grab the prefs service and just set the pref directly.
|
||||
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
|
||||
int mode;
|
||||
pref->GetIntPref("nglayout.mac.renderingmode", &mode);
|
||||
if (mode == 0)
|
||||
[aMenuItem setState: NSOffState];
|
||||
else
|
||||
[aMenuItem setState: NSOnState];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
@ -64,6 +66,8 @@
|
|||
// Common helper routines (also used by the context menu code)
|
||||
#include "CHGeckoUtils.h"
|
||||
|
||||
#import "CHBrowserView.h"
|
||||
|
||||
static void FindOptionWithContentID(nsIDOMHTMLSelectElement* aSel, PRUint32 aID, nsIDOMHTMLOptionElement** aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
|
@ -211,6 +215,13 @@ ContentClickListener::MouseDown(nsIDOMEvent* aEvent)
|
|||
|
||||
PRInt32 xDelta = clientX - left;
|
||||
PRInt32 yDelta = top + height - clientY;
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> window = getter_AddRefs([[[mBrowserController getBrowserWrapper] getBrowserView] getContentWindow]);
|
||||
PRInt32 scrollX, scrollY;
|
||||
window->GetScrollX(&scrollX);
|
||||
window->GetScrollY(&scrollY);
|
||||
xDelta += scrollX; // Normal direction.
|
||||
yDelta -= scrollY; // Remember, y is flipped.
|
||||
|
||||
#define XMENUOFFSET 20
|
||||
#define MENUHEIGHT 20
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
@ -64,6 +66,8 @@
|
|||
// Common helper routines (also used by the context menu code)
|
||||
#include "CHGeckoUtils.h"
|
||||
|
||||
#import "CHBrowserView.h"
|
||||
|
||||
static void FindOptionWithContentID(nsIDOMHTMLSelectElement* aSel, PRUint32 aID, nsIDOMHTMLOptionElement** aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
|
@ -211,6 +215,13 @@ ContentClickListener::MouseDown(nsIDOMEvent* aEvent)
|
|||
|
||||
PRInt32 xDelta = clientX - left;
|
||||
PRInt32 yDelta = top + height - clientY;
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> window = getter_AddRefs([[[mBrowserController getBrowserWrapper] getBrowserView] getContentWindow]);
|
||||
PRInt32 scrollX, scrollY;
|
||||
window->GetScrollX(&scrollX);
|
||||
window->GetScrollY(&scrollY);
|
||||
xDelta += scrollX; // Normal direction.
|
||||
yDelta -= scrollY; // Remember, y is flipped.
|
||||
|
||||
#define XMENUOFFSET 20
|
||||
#define MENUHEIGHT 20
|
||||
|
|
|
@ -388,5 +388,26 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
}
|
||||
}
|
||||
|
||||
static PRBool gSetupSmoothTextMenu = PR_FALSE;
|
||||
|
||||
-(BOOL)validateMenuItem: (id <NSMenuItem> )aMenuItem
|
||||
{
|
||||
// XXXDWH I should not be using strings here. Not localizable.
|
||||
// SHould use tags instead.
|
||||
if ([[aMenuItem title] isEqualToString: @"Smooth Text"] &&
|
||||
!gSetupSmoothTextMenu) {
|
||||
gSetupSmoothTextMenu = PR_TRUE;
|
||||
// Grab the prefs service and just set the pref directly.
|
||||
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
|
||||
int mode;
|
||||
pref->GetIntPref("nglayout.mac.renderingmode", &mode);
|
||||
if (mode == 0)
|
||||
[aMenuItem setState: NSOffState];
|
||||
else
|
||||
[aMenuItem setState: NSOnState];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -388,5 +388,26 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
}
|
||||
}
|
||||
|
||||
static PRBool gSetupSmoothTextMenu = PR_FALSE;
|
||||
|
||||
-(BOOL)validateMenuItem: (id <NSMenuItem> )aMenuItem
|
||||
{
|
||||
// XXXDWH I should not be using strings here. Not localizable.
|
||||
// SHould use tags instead.
|
||||
if ([[aMenuItem title] isEqualToString: @"Smooth Text"] &&
|
||||
!gSetupSmoothTextMenu) {
|
||||
gSetupSmoothTextMenu = PR_TRUE;
|
||||
// Grab the prefs service and just set the pref directly.
|
||||
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
|
||||
int mode;
|
||||
pref->GetIntPref("nglayout.mac.renderingmode", &mode);
|
||||
if (mode == 0)
|
||||
[aMenuItem setState: NSOffState];
|
||||
else
|
||||
[aMenuItem setState: NSOnState];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
@ -64,6 +66,8 @@
|
|||
// Common helper routines (also used by the context menu code)
|
||||
#include "CHGeckoUtils.h"
|
||||
|
||||
#import "CHBrowserView.h"
|
||||
|
||||
static void FindOptionWithContentID(nsIDOMHTMLSelectElement* aSel, PRUint32 aID, nsIDOMHTMLOptionElement** aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
|
@ -211,6 +215,13 @@ ContentClickListener::MouseDown(nsIDOMEvent* aEvent)
|
|||
|
||||
PRInt32 xDelta = clientX - left;
|
||||
PRInt32 yDelta = top + height - clientY;
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> window = getter_AddRefs([[[mBrowserController getBrowserWrapper] getBrowserView] getContentWindow]);
|
||||
PRInt32 scrollX, scrollY;
|
||||
window->GetScrollX(&scrollX);
|
||||
window->GetScrollY(&scrollY);
|
||||
xDelta += scrollX; // Normal direction.
|
||||
yDelta -= scrollY; // Remember, y is flipped.
|
||||
|
||||
#define XMENUOFFSET 20
|
||||
#define MENUHEIGHT 20
|
||||
|
|
Загрузка…
Ссылка в новой задаче