зеркало из https://github.com/mozilla/gecko-dev.git
respect the look&feel pref about showing comboboxes outside the client area. r=rods/sr=sfraser/a=asa. bug# 102834.
This commit is contained in:
Родитель
bbc4678735
Коммит
483bf5514f
|
@ -74,6 +74,7 @@
|
||||||
#include "nsIDOMHTMLButtonElement.h"
|
#include "nsIDOMHTMLButtonElement.h"
|
||||||
#include "nsIEventStateManager.h"
|
#include "nsIEventStateManager.h"
|
||||||
#include "nsIScrollableView.h"
|
#include "nsIScrollableView.h"
|
||||||
|
#include "nsILookAndFeel.h"
|
||||||
|
|
||||||
#ifdef DEBUG_evaughan
|
#ifdef DEBUG_evaughan
|
||||||
//#define DEBUG_rods
|
//#define DEBUG_rods
|
||||||
|
@ -964,18 +965,26 @@ nsresult
|
||||||
nsFormControlFrame::GetScreenHeight(nsIPresContext* aPresContext, nscoord& aHeight)
|
nsFormControlFrame::GetScreenHeight(nsIPresContext* aPresContext, nscoord& aHeight)
|
||||||
{
|
{
|
||||||
aHeight = 0;
|
aHeight = 0;
|
||||||
nsIDeviceContext* context;
|
nsCOMPtr<nsIDeviceContext> context;
|
||||||
aPresContext->GetDeviceContext( &context );
|
aPresContext->GetDeviceContext( getter_AddRefs(context) );
|
||||||
if ( nsnull != context ) {
|
if ( context ) {
|
||||||
PRInt32 height;
|
nsRect screen;
|
||||||
PRInt32 width;
|
|
||||||
context->GetDeviceSurfaceDimensions(width, height);
|
PRBool dropdownCanOverlapOSBar = PR_FALSE;
|
||||||
float devUnits;
|
nsCOMPtr<nsILookAndFeel> lookAndFeel;
|
||||||
context->GetDevUnitsToAppUnits(devUnits);
|
aPresContext->GetLookAndFeel(getter_AddRefs(lookAndFeel));
|
||||||
aHeight = NSToIntRound(float( height) / devUnits );
|
if ( lookAndFeel )
|
||||||
NS_RELEASE( context );
|
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_MenusCanOverlapOSBar, dropdownCanOverlapOSBar);
|
||||||
return NS_OK;
|
if ( dropdownCanOverlapOSBar )
|
||||||
}
|
context->GetRect ( screen );
|
||||||
|
else
|
||||||
|
context->GetClientRect(screen);
|
||||||
|
|
||||||
|
float devUnits;
|
||||||
|
context->GetDevUnitsToAppUnits(devUnits);
|
||||||
|
aHeight = NSToIntRound(float(screen.height) / devUnits );
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
#include "nsIDOMHTMLButtonElement.h"
|
#include "nsIDOMHTMLButtonElement.h"
|
||||||
#include "nsIEventStateManager.h"
|
#include "nsIEventStateManager.h"
|
||||||
#include "nsIScrollableView.h"
|
#include "nsIScrollableView.h"
|
||||||
|
#include "nsILookAndFeel.h"
|
||||||
|
|
||||||
#ifdef DEBUG_evaughan
|
#ifdef DEBUG_evaughan
|
||||||
//#define DEBUG_rods
|
//#define DEBUG_rods
|
||||||
|
@ -964,18 +965,26 @@ nsresult
|
||||||
nsFormControlFrame::GetScreenHeight(nsIPresContext* aPresContext, nscoord& aHeight)
|
nsFormControlFrame::GetScreenHeight(nsIPresContext* aPresContext, nscoord& aHeight)
|
||||||
{
|
{
|
||||||
aHeight = 0;
|
aHeight = 0;
|
||||||
nsIDeviceContext* context;
|
nsCOMPtr<nsIDeviceContext> context;
|
||||||
aPresContext->GetDeviceContext( &context );
|
aPresContext->GetDeviceContext( getter_AddRefs(context) );
|
||||||
if ( nsnull != context ) {
|
if ( context ) {
|
||||||
PRInt32 height;
|
nsRect screen;
|
||||||
PRInt32 width;
|
|
||||||
context->GetDeviceSurfaceDimensions(width, height);
|
PRBool dropdownCanOverlapOSBar = PR_FALSE;
|
||||||
float devUnits;
|
nsCOMPtr<nsILookAndFeel> lookAndFeel;
|
||||||
context->GetDevUnitsToAppUnits(devUnits);
|
aPresContext->GetLookAndFeel(getter_AddRefs(lookAndFeel));
|
||||||
aHeight = NSToIntRound(float( height) / devUnits );
|
if ( lookAndFeel )
|
||||||
NS_RELEASE( context );
|
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_MenusCanOverlapOSBar, dropdownCanOverlapOSBar);
|
||||||
return NS_OK;
|
if ( dropdownCanOverlapOSBar )
|
||||||
}
|
context->GetRect ( screen );
|
||||||
|
else
|
||||||
|
context->GetClientRect(screen);
|
||||||
|
|
||||||
|
float devUnits;
|
||||||
|
context->GetDevUnitsToAppUnits(devUnits);
|
||||||
|
aHeight = NSToIntRound(float(screen.height) / devUnits );
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ NS_SetupRegistry()
|
||||||
|
|
||||||
// WIDGET
|
// WIDGET
|
||||||
#if !defined(XP_UNIX) && !defined(XP_OS2) && !defined(XP_WIN)
|
#if !defined(XP_UNIX) && !defined(XP_OS2) && !defined(XP_WIN)
|
||||||
nsComponentManager::RegisterComponentLib(kCLookAndFeelCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
nsComponentManager::RegisterComponentLib(kCLookAndFeelCID, NULL, "@mozilla.org/widget/lookandfeel;1", WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||||
nsComponentManager::RegisterComponentLib(kCWindowCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
nsComponentManager::RegisterComponentLib(kCWindowCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||||
nsComponentManager::RegisterComponentLib(kCVScrollbarCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
nsComponentManager::RegisterComponentLib(kCVScrollbarCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||||
nsComponentManager::RegisterComponentLib(kCHScrollbarCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
nsComponentManager::RegisterComponentLib(kCHScrollbarCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче