diff --git a/mozilla/content/html/style/src/nsCSSScanner.cpp b/mozilla/content/html/style/src/nsCSSScanner.cpp index f00044d4c79..43ff6c26036 100644 --- a/mozilla/content/html/style/src/nsCSSScanner.cpp +++ b/mozilla/content/html/style/src/nsCSSScanner.cpp @@ -674,6 +674,7 @@ PRBool nsCSSScanner::ParseNumber(PRInt32& aErrorCode, PRInt32 c, } else if ('%' == c) { type = eCSSToken_Percentage; value = value / 100.0f; + ident.SetLength(0); } else { // Put back character that stopped numeric scan Unread(); @@ -684,6 +685,13 @@ PRBool nsCSSScanner::ParseNumber(PRInt32& aErrorCode, PRInt32 c, ident.SetLength(0); } } + else { // stream ended + if (!gotDot) { + aToken.mInteger = ident.ToInteger(&ec); + aToken.mIntegerValid = PR_TRUE; + } + ident.SetLength(0); + } aToken.mNumber = value; aToken.mType = type; return PR_TRUE; diff --git a/mozilla/layout/html/style/src/nsCSSScanner.cpp b/mozilla/layout/html/style/src/nsCSSScanner.cpp index f00044d4c79..43ff6c26036 100644 --- a/mozilla/layout/html/style/src/nsCSSScanner.cpp +++ b/mozilla/layout/html/style/src/nsCSSScanner.cpp @@ -674,6 +674,7 @@ PRBool nsCSSScanner::ParseNumber(PRInt32& aErrorCode, PRInt32 c, } else if ('%' == c) { type = eCSSToken_Percentage; value = value / 100.0f; + ident.SetLength(0); } else { // Put back character that stopped numeric scan Unread(); @@ -684,6 +685,13 @@ PRBool nsCSSScanner::ParseNumber(PRInt32& aErrorCode, PRInt32 c, ident.SetLength(0); } } + else { // stream ended + if (!gotDot) { + aToken.mInteger = ident.ToInteger(&ec); + aToken.mIntegerValid = PR_TRUE; + } + ident.SetLength(0); + } aToken.mNumber = value; aToken.mType = type; return PR_TRUE; diff --git a/mozilla/layout/style/nsCSSScanner.cpp b/mozilla/layout/style/nsCSSScanner.cpp index f00044d4c79..43ff6c26036 100644 --- a/mozilla/layout/style/nsCSSScanner.cpp +++ b/mozilla/layout/style/nsCSSScanner.cpp @@ -674,6 +674,7 @@ PRBool nsCSSScanner::ParseNumber(PRInt32& aErrorCode, PRInt32 c, } else if ('%' == c) { type = eCSSToken_Percentage; value = value / 100.0f; + ident.SetLength(0); } else { // Put back character that stopped numeric scan Unread(); @@ -684,6 +685,13 @@ PRBool nsCSSScanner::ParseNumber(PRInt32& aErrorCode, PRInt32 c, ident.SetLength(0); } } + else { // stream ended + if (!gotDot) { + aToken.mInteger = ident.ToInteger(&ec); + aToken.mIntegerValid = PR_TRUE; + } + ident.SetLength(0); + } aToken.mNumber = value; aToken.mType = type; return PR_TRUE;