fixed value to string for percentages to include the '%'

This commit is contained in:
kipp 1998-05-30 21:20:07 +00:00
Родитель b13aa91034
Коммит 89fa391100
1 изменённых файлов: 16 добавлений и 11 удалений

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

@ -169,6 +169,7 @@ nsContentAttr nsHTMLTagContent::GetAttribute(const nsString& aName,
case eHTMLUnit_Percent:
aResult.Truncate(0);
aResult.Append(PRInt32(value.GetPercentValue() * 100.0f), 10);
aResult.Append('%');
break;
case eHTMLUnit_Color:
@ -618,9 +619,10 @@ PRBool nsHTMLTagContent::TableAlignParamToString(const nsHTMLValue& aValue,
return EnumValueToString(aValue, kTableAlignTable, aResult);
}
void nsHTMLTagContent::ParseValueOrPercent(const nsString& aString,
nsHTMLValue& aResult,
nsHTMLUnit aValueUnit)
void
nsHTMLTagContent::ParseValueOrPercent(const nsString& aString,
nsHTMLValue& aResult,
nsHTMLUnit aValueUnit)
{ // XXX should vave min/max values?
nsAutoString tmp(aString);
tmp.CompressWhitespace(PR_TRUE, PR_TRUE);
@ -639,14 +641,15 @@ void nsHTMLTagContent::ParseValueOrPercent(const nsString& aString,
}
}
/* used to parser attribute values that could be either:
/* used to parse attribute values that could be either:
* integer (n),
* percent (n%),
* or proportional (n*)
*/
void nsHTMLTagContent::ParseValueOrPercentOrProportional(const nsString& aString,
nsHTMLValue& aResult,
nsHTMLUnit aValueUnit)
void
nsHTMLTagContent::ParseValueOrPercentOrProportional(const nsString& aString,
nsHTMLValue& aResult,
nsHTMLUnit aValueUnit)
{ // XXX should have min/max values?
nsAutoString tmp(aString);
tmp.CompressWhitespace(PR_TRUE, PR_TRUE);
@ -668,8 +671,9 @@ void nsHTMLTagContent::ParseValueOrPercentOrProportional(const nsString& aString
}
}
PRBool nsHTMLTagContent::ValueOrPercentToString(const nsHTMLValue& aValue,
nsString& aResult)
PRBool
nsHTMLTagContent::ValueOrPercentToString(const nsHTMLValue& aValue,
nsString& aResult)
{
aResult.Truncate(0);
switch (aValue.GetUnit()) {
@ -687,8 +691,9 @@ PRBool nsHTMLTagContent::ValueOrPercentToString(const nsHTMLValue& aValue,
return PR_FALSE;
}
void nsHTMLTagContent::ParseValue(const nsString& aString, PRInt32 aMin,
nsHTMLValue& aResult, nsHTMLUnit aValueUnit)
void
nsHTMLTagContent::ParseValue(const nsString& aString, PRInt32 aMin,
nsHTMLValue& aResult, nsHTMLUnit aValueUnit)
{
PRInt32 ec, val = aString.ToInteger(&ec);
if (val < aMin) val = aMin;