Set ascent/descent information so that vertical alignment works better

git-svn-id: svn://10.0.0.236/trunk@1065 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kipp 1998-05-02 02:04:00 +00:00
parent 4016c14fb8
commit 51777f1e3b
7 changed files with 16 additions and 1 deletions

View File

@ -99,6 +99,8 @@ void FormElementFrame::GetDesiredSize(nsIPresContext* aPresContext,
float p2t = aPresContext->GetPixelsToTwips();
aDesiredSize.width = nscoord(75 * p2t);
aDesiredSize.height = nscoord(37 * p2t);
aDesiredSize.ascent = aDesiredSize.height;
aDesiredSize.descent = 0;
}
//----------------------------------------------------------------------

View File

@ -401,6 +401,8 @@ nsInputButtonFrame::GetDesiredSize(nsIPresContext* aPresContext,
if (kButton_Hidden == GetButtonType()) { // there is no physical rep
aDesiredLayoutSize.width = 0;
aDesiredLayoutSize.height = 0;
aDesiredLayoutSize.ascent = 0;
aDesiredLayoutSize.descent = 0;
}
else {
nsSize styleSize;
@ -444,6 +446,8 @@ nsInputButtonFrame::GetDesiredSize(nsIPresContext* aPresContext,
aDesiredLayoutSize.width = size.width;
aDesiredLayoutSize.height= size.height;
}
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
aDesiredLayoutSize.descent = 0;
}
aDesiredWidgetSize.width = aDesiredLayoutSize.width;

View File

@ -116,6 +116,8 @@ nsInputCheckboxFrame::GetDesiredSize(nsIPresContext* aPresContext,
PRInt32 padding = GetPadding();
aDesiredLayoutSize.width = aDesiredWidgetSize.width + (2 * padding);
aDesiredLayoutSize.height = aDesiredWidgetSize.height;
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
aDesiredLayoutSize.descent = 0;
}
void

View File

@ -161,6 +161,8 @@ nsInputFrame::GetDesiredSize(nsIPresContext* aPresContext,
// subclasses should always override this method, but if not and no css, make it small
aDesiredLayoutSize.width = (styleSize.width > CSS_NOTSET) ? styleSize.width : 144;
aDesiredLayoutSize.height = (styleSize.height > CSS_NOTSET) ? styleSize.height : 144;
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
aDesiredLayoutSize.descent = 0;
aDesiredWidgetSize.width = aDesiredLayoutSize.width;
aDesiredWidgetSize.height = aDesiredLayoutSize.height;
}

View File

@ -110,6 +110,8 @@ nsInputRadioFrame::GetDesiredSize(nsIPresContext* aPresContext,
PRInt32 padding = GetPadding();
aDesiredLayoutSize.width = aDesiredWidgetSize.width + (2 * padding);
aDesiredLayoutSize.height = aDesiredWidgetSize.height;
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
aDesiredLayoutSize.descent = 0;
}
void

View File

@ -141,6 +141,8 @@ nsInputTextFrame::GetDesiredSize(nsIPresContext* aPresContext,
aDesiredLayoutSize.width = size.width;
aDesiredLayoutSize.height = size.height;
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
aDesiredLayoutSize.descent = 0;
aDesiredWidgetSize.width = aDesiredLayoutSize.width;
aDesiredWidgetSize.height = aDesiredLayoutSize.height;
}

View File

@ -228,13 +228,14 @@ nsSelectFrame::GetDesiredSize(nsIPresContext* aPresContext,
aDesiredLayoutSize.width = ((numRows < select->ChildCount()) || isCombo)
? calcSize.width + 350 : calcSize.width + 100;
aDesiredLayoutSize.height = calcSize.height;
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
aDesiredLayoutSize.descent = 0;
aDesiredWidgetSize.width = aDesiredLayoutSize.width;
aDesiredWidgetSize.height =
(isCombo && !heightExplicit) ? aDesiredLayoutSize.height + (rowHeight * numChildren) + 100
: aDesiredLayoutSize.height;
NS_RELEASE(select);
}