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:
pinkerton%netscape.com 2001-10-05 14:10:16 +00:00
Родитель bbc4678735
Коммит 483bf5514f
3 изменённых файлов: 43 добавлений и 25 удалений

Просмотреть файл

@ -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);