зеркало из 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 "nsIEventStateManager.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
|
||||
#ifdef DEBUG_evaughan
|
||||
//#define DEBUG_rods
|
||||
|
@ -964,18 +965,26 @@ nsresult
|
|||
nsFormControlFrame::GetScreenHeight(nsIPresContext* aPresContext, nscoord& aHeight)
|
||||
{
|
||||
aHeight = 0;
|
||||
nsIDeviceContext* context;
|
||||
aPresContext->GetDeviceContext( &context );
|
||||
if ( nsnull != context ) {
|
||||
PRInt32 height;
|
||||
PRInt32 width;
|
||||
context->GetDeviceSurfaceDimensions(width, height);
|
||||
float devUnits;
|
||||
context->GetDevUnitsToAppUnits(devUnits);
|
||||
aHeight = NSToIntRound(float( height) / devUnits );
|
||||
NS_RELEASE( context );
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIDeviceContext> context;
|
||||
aPresContext->GetDeviceContext( getter_AddRefs(context) );
|
||||
if ( context ) {
|
||||
nsRect screen;
|
||||
|
||||
PRBool dropdownCanOverlapOSBar = PR_FALSE;
|
||||
nsCOMPtr<nsILookAndFeel> lookAndFeel;
|
||||
aPresContext->GetLookAndFeel(getter_AddRefs(lookAndFeel));
|
||||
if ( lookAndFeel )
|
||||
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_MenusCanOverlapOSBar, dropdownCanOverlapOSBar);
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
#include "nsIDOMHTMLButtonElement.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
|
||||
#ifdef DEBUG_evaughan
|
||||
//#define DEBUG_rods
|
||||
|
@ -964,18 +965,26 @@ nsresult
|
|||
nsFormControlFrame::GetScreenHeight(nsIPresContext* aPresContext, nscoord& aHeight)
|
||||
{
|
||||
aHeight = 0;
|
||||
nsIDeviceContext* context;
|
||||
aPresContext->GetDeviceContext( &context );
|
||||
if ( nsnull != context ) {
|
||||
PRInt32 height;
|
||||
PRInt32 width;
|
||||
context->GetDeviceSurfaceDimensions(width, height);
|
||||
float devUnits;
|
||||
context->GetDevUnitsToAppUnits(devUnits);
|
||||
aHeight = NSToIntRound(float( height) / devUnits );
|
||||
NS_RELEASE( context );
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIDeviceContext> context;
|
||||
aPresContext->GetDeviceContext( getter_AddRefs(context) );
|
||||
if ( context ) {
|
||||
nsRect screen;
|
||||
|
||||
PRBool dropdownCanOverlapOSBar = PR_FALSE;
|
||||
nsCOMPtr<nsILookAndFeel> lookAndFeel;
|
||||
aPresContext->GetLookAndFeel(getter_AddRefs(lookAndFeel));
|
||||
if ( lookAndFeel )
|
||||
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_MenusCanOverlapOSBar, dropdownCanOverlapOSBar);
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ NS_SetupRegistry()
|
|||
|
||||
// WIDGET
|
||||
#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(kCVScrollbarCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
nsComponentManager::RegisterComponentLib(kCHScrollbarCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
|
|
Загрузка…
Ссылка в новой задаче