Bug 12599: Accept string as integer attribute to prevent assert, fix courtesy rickg r=self and harishd

This commit is contained in:
pollmann%netscape.com 2000-01-07 05:44:42 +00:00
Родитель 21be882f53
Коммит 2f27c49438
4 изменённых файлов: 24 добавлений и 4 удалений

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

@ -92,7 +92,8 @@ protected:
inline PRInt32 nsHTMLValue::GetIntValue(void) const
{
NS_ASSERTION((mUnit == eHTMLUnit_Integer) ||
NS_ASSERTION((mUnit == eHTMLUnit_String) ||
(mUnit == eHTMLUnit_Integer) ||
(mUnit == eHTMLUnit_Enumerated) ||
(mUnit == eHTMLUnit_Proportional), "not an int value");
if ((mUnit == eHTMLUnit_Integer) ||
@ -100,6 +101,10 @@ inline PRInt32 nsHTMLValue::GetIntValue(void) const
(mUnit == eHTMLUnit_Proportional)) {
return mValue.mInt;
}
else if (mUnit == eHTMLUnit_String) {
PRInt32 err=0;
return (mValue.mString) ? mValue.mString->ToInteger(&err):0;
}
return 0;
}

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

@ -92,7 +92,8 @@ protected:
inline PRInt32 nsHTMLValue::GetIntValue(void) const
{
NS_ASSERTION((mUnit == eHTMLUnit_Integer) ||
NS_ASSERTION((mUnit == eHTMLUnit_String) ||
(mUnit == eHTMLUnit_Integer) ||
(mUnit == eHTMLUnit_Enumerated) ||
(mUnit == eHTMLUnit_Proportional), "not an int value");
if ((mUnit == eHTMLUnit_Integer) ||
@ -100,6 +101,10 @@ inline PRInt32 nsHTMLValue::GetIntValue(void) const
(mUnit == eHTMLUnit_Proportional)) {
return mValue.mInt;
}
else if (mUnit == eHTMLUnit_String) {
PRInt32 err=0;
return (mValue.mString) ? mValue.mString->ToInteger(&err):0;
}
return 0;
}

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

@ -92,7 +92,8 @@ protected:
inline PRInt32 nsHTMLValue::GetIntValue(void) const
{
NS_ASSERTION((mUnit == eHTMLUnit_Integer) ||
NS_ASSERTION((mUnit == eHTMLUnit_String) ||
(mUnit == eHTMLUnit_Integer) ||
(mUnit == eHTMLUnit_Enumerated) ||
(mUnit == eHTMLUnit_Proportional), "not an int value");
if ((mUnit == eHTMLUnit_Integer) ||
@ -100,6 +101,10 @@ inline PRInt32 nsHTMLValue::GetIntValue(void) const
(mUnit == eHTMLUnit_Proportional)) {
return mValue.mInt;
}
else if (mUnit == eHTMLUnit_String) {
PRInt32 err=0;
return (mValue.mString) ? mValue.mString->ToInteger(&err):0;
}
return 0;
}

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

@ -92,7 +92,8 @@ protected:
inline PRInt32 nsHTMLValue::GetIntValue(void) const
{
NS_ASSERTION((mUnit == eHTMLUnit_Integer) ||
NS_ASSERTION((mUnit == eHTMLUnit_String) ||
(mUnit == eHTMLUnit_Integer) ||
(mUnit == eHTMLUnit_Enumerated) ||
(mUnit == eHTMLUnit_Proportional), "not an int value");
if ((mUnit == eHTMLUnit_Integer) ||
@ -100,6 +101,10 @@ inline PRInt32 nsHTMLValue::GetIntValue(void) const
(mUnit == eHTMLUnit_Proportional)) {
return mValue.mInt;
}
else if (mUnit == eHTMLUnit_String) {
PRInt32 err=0;
return (mValue.mString) ? mValue.mString->ToInteger(&err):0;
}
return 0;
}