when in standard mode and calculating desired size it removes the width of the native border

because it is implicitly added during the calculation
This commit is contained in:
rods%netscape.com 1999-09-03 14:48:26 +00:00
Родитель e6ba3a3633
Коммит 2bdffa9cdb
2 изменённых файлов: 34 добавлений и 10 удалений

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

@ -243,12 +243,12 @@ nsTextControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
areaSpec, desiredSize, minSize, widthExplicit, heightExplicit, ignore);
}
float p2t;
aPresContext->GetPixelsToTwips(&p2t);
if (NS_FORM_TEXTAREA == type) {
nscoord scrollbarWidth = 0;
nscoord scrollbarHeight = 0;
float scale;
float p2t;
aPresContext->GetPixelsToTwips(&p2t);
nsCOMPtr<nsIDeviceContext> dx;
aPresContext->GetDeviceContext(getter_AddRefs(dx));
if (dx) {
@ -273,9 +273,21 @@ nsTextControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
}
}
aDesiredLayoutSize.width = desiredSize.width;
aDesiredLayoutSize.height = desiredSize.height;
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
if (eCompatibility_Standard == mode) {
nsILookAndFeel * lookAndFeel;
if (NS_OK == nsComponentManager::CreateInstance(kLookAndFeelCID, nsnull, kILookAndFeelIID, (void**)&lookAndFeel)) {
PRInt32 borderSize;
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_TextFieldBorder, borderSize);
nscoord borderTwips = NSIntPixelsToTwips(borderSize, p2t);
desiredSize.width -= borderTwips*2;
desiredSize.height -= borderTwips*2;
NS_RELEASE(lookAndFeel);
}
}
aDesiredLayoutSize.width = desiredSize.width;
aDesiredLayoutSize.height = desiredSize.height;
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
aDesiredLayoutSize.descent = 0;
if (aDesiredLayoutSize.maxElementSize) {

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

@ -243,12 +243,12 @@ nsTextControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
areaSpec, desiredSize, minSize, widthExplicit, heightExplicit, ignore);
}
float p2t;
aPresContext->GetPixelsToTwips(&p2t);
if (NS_FORM_TEXTAREA == type) {
nscoord scrollbarWidth = 0;
nscoord scrollbarHeight = 0;
float scale;
float p2t;
aPresContext->GetPixelsToTwips(&p2t);
nsCOMPtr<nsIDeviceContext> dx;
aPresContext->GetDeviceContext(getter_AddRefs(dx));
if (dx) {
@ -273,9 +273,21 @@ nsTextControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
}
}
aDesiredLayoutSize.width = desiredSize.width;
aDesiredLayoutSize.height = desiredSize.height;
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
if (eCompatibility_Standard == mode) {
nsILookAndFeel * lookAndFeel;
if (NS_OK == nsComponentManager::CreateInstance(kLookAndFeelCID, nsnull, kILookAndFeelIID, (void**)&lookAndFeel)) {
PRInt32 borderSize;
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_TextFieldBorder, borderSize);
nscoord borderTwips = NSIntPixelsToTwips(borderSize, p2t);
desiredSize.width -= borderTwips*2;
desiredSize.height -= borderTwips*2;
NS_RELEASE(lookAndFeel);
}
}
aDesiredLayoutSize.width = desiredSize.width;
aDesiredLayoutSize.height = desiredSize.height;
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
aDesiredLayoutSize.descent = 0;
if (aDesiredLayoutSize.maxElementSize) {