Fix nsAReadableString assertions. r=jst.

git-svn-id: svn://10.0.0.236/trunk@73053 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
waterson%netscape.com 2000-06-23 08:49:04 +00:00
parent 01f208bc5c
commit 0c6159b166
2 changed files with 6 additions and 6 deletions

View File

@ -2112,7 +2112,7 @@ nsGenericHTMLElement::ParseValueOrPercent(const nsString& aString,
PRInt32 ec, val = tmp.ToInteger(&ec);
if (NS_OK == ec) {
if (val < 0) val = 0;
if (tmp.Last() == '%') {/* XXX not 100% compatible with ebina's code */
if (tmp.Length() && tmp.Last() == '%') {/* XXX not 100% compatible with ebina's code */
if (val > 100) val = 100;
aResult.SetPercentValue(float(val)/100.0f);
} else {
@ -2144,10 +2144,10 @@ nsGenericHTMLElement::ParseValueOrPercentOrProportional(const nsString& aString,
PRInt32 ec, val = tmp.ToInteger(&ec);
if (NS_OK == ec) {
if (val < 0) val = 0;
if (tmp.Last() == '%') {/* XXX not 100% compatible with ebina's code */
if (tmp.Length() && tmp.Last() == '%') {/* XXX not 100% compatible with ebina's code */
if (val > 100) val = 100;
aResult.SetPercentValue(float(val)/100.0f);
} else if (tmp.Last() == '*') {
} else if (tmp.Length() && tmp.Last() == '*') {
aResult.SetIntValue(val, eHTMLUnit_Proportional); // proportional values are integers
} else {
if (eHTMLUnit_Pixel == aValueUnit) {

View File

@ -2112,7 +2112,7 @@ nsGenericHTMLElement::ParseValueOrPercent(const nsString& aString,
PRInt32 ec, val = tmp.ToInteger(&ec);
if (NS_OK == ec) {
if (val < 0) val = 0;
if (tmp.Last() == '%') {/* XXX not 100% compatible with ebina's code */
if (tmp.Length() && tmp.Last() == '%') {/* XXX not 100% compatible with ebina's code */
if (val > 100) val = 100;
aResult.SetPercentValue(float(val)/100.0f);
} else {
@ -2144,10 +2144,10 @@ nsGenericHTMLElement::ParseValueOrPercentOrProportional(const nsString& aString,
PRInt32 ec, val = tmp.ToInteger(&ec);
if (NS_OK == ec) {
if (val < 0) val = 0;
if (tmp.Last() == '%') {/* XXX not 100% compatible with ebina's code */
if (tmp.Length() && tmp.Last() == '%') {/* XXX not 100% compatible with ebina's code */
if (val > 100) val = 100;
aResult.SetPercentValue(float(val)/100.0f);
} else if (tmp.Last() == '*') {
} else if (tmp.Length() && tmp.Last() == '*') {
aResult.SetIntValue(val, eHTMLUnit_Proportional); // proportional values are integers
} else {
if (eHTMLUnit_Pixel == aValueUnit) {