Bug 167001: Anything below the baseline goes out of input field. Patch by Hideo Saito <saito@densan.co.jp>, r+sr=dbaron

git-svn-id: svn://10.0.0.236/trunk@163502 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
smontagu%smontagu.org
2004-10-10 18:30:28 +00:00
parent 3d77b40dac
commit 6649ff6b3d
4 changed files with 16 additions and 14 deletions

View File

@@ -1543,7 +1543,7 @@ nsTextControlFrame::ReflowStandard(nsPresContext* aPresContext,
{
// get the css size and let the frame use or override it
nsSize minSize;
nsresult rv = CalculateSizeStandard(aPresContext, aReflowState.rendContext,
nsresult rv = CalculateSizeStandard(aPresContext, aReflowState,
aDesiredSize, minSize);
NS_ENSURE_SUCCESS(rv, rv);
@@ -1582,7 +1582,7 @@ nsTextControlFrame::ReflowStandard(nsPresContext* aPresContext,
nsresult
nsTextControlFrame::CalculateSizeStandard(nsPresContext* aPresContext,
nsIRenderingContext* aRendContext,
const nsHTMLReflowState& aReflowState,
nsSize& aDesiredSize,
nsSize& aMinSize)
{
@@ -1590,15 +1590,16 @@ nsTextControlFrame::CalculateSizeStandard(nsPresContext* aPresContext,
aDesiredSize.height = CSS_NOTSET;
// Get leading and the Average/MaxAdvance char width
nscoord fontHeight = 0;
nscoord lineHeight = 0;
nscoord charWidth = 0;
nscoord charMaxAdvance = 0;
nsCOMPtr<nsIFontMetrics> fontMet;
nsresult rv = nsFormControlHelper::GetFrameFontFM(this, getter_AddRefs(fontMet));
NS_ENSURE_SUCCESS(rv, rv);
aRendContext->SetFont(fontMet);
fontMet->GetHeight(fontHeight);
nsIRenderingContext* rendContext = aReflowState.rendContext;
rendContext->SetFont(fontMet);
lineHeight = aReflowState.CalcLineHeight(aPresContext, rendContext, aReflowState.frame);
fontMet->GetAveCharWidth(charWidth);
fontMet->GetMaxAdvance(charMaxAdvance);
@@ -1645,7 +1646,7 @@ nsTextControlFrame::CalculateSizeStandard(nsPresContext* aPresContext,
// Set the height equal to total number of rows (times the height of each
// line, of course)
aDesiredSize.height = fontHeight * GetRows();
aDesiredSize.height = lineHeight * GetRows();
// Set minimum size equal to desired size. We are form controls. We are Gods
// among elements. We do not yield for anybody, not even a table cell. None