Only accept a decimal point as part of a number when there are digits after it. Remove unused IS_ALPHA. b=306504 r+sr=bzbarsky

This commit is contained in:
dbaron%dbaron.org 2005-08-31 16:15:58 +00:00
Родитель b4c780f6ed
Коммит 2d0c5674de
2 изменённых файлов: 7 добавлений и 8 удалений

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

@ -61,10 +61,9 @@
static const PRUnichar CSS_ESCAPE = PRUnichar('\\');
const PRUint8 nsCSSScanner::IS_DIGIT = 0x01;
const PRUint8 nsCSSScanner::IS_HEX_DIGIT = 0x02;
const PRUint8 nsCSSScanner::IS_ALPHA = 0x04;
const PRUint8 nsCSSScanner::START_IDENT = 0x08;
const PRUint8 nsCSSScanner::IS_IDENT = 0x10;
const PRUint8 nsCSSScanner::IS_WHITESPACE = 0x20;
const PRUint8 nsCSSScanner::START_IDENT = 0x04;
const PRUint8 nsCSSScanner::IS_IDENT = 0x08;
const PRUint8 nsCSSScanner::IS_WHITESPACE = 0x10;
static PRBool gLexTableSetup = PR_FALSE;
PRUint8 nsCSSScanner::gLexTable[256];
@ -104,8 +103,8 @@ nsCSSScanner::BuildLexTable()
lt[i] |= IS_HEX_DIGIT;
lt[i+32] |= IS_HEX_DIGIT;
}
lt[i] |= IS_ALPHA | IS_IDENT | START_IDENT;
lt[i+32] |= IS_ALPHA | IS_IDENT | START_IDENT;
lt[i] |= IS_IDENT | START_IDENT;
lt[i+32] |= IS_IDENT | START_IDENT;
}
}
@ -983,7 +982,8 @@ PRBool nsCSSScanner::ParseNumber(nsresult& aErrorCode, PRInt32 c,
for (;;) {
c = Read(aErrorCode);
if (c < 0) break;
if (!gotDot && (c == '.')) {
if (!gotDot && (c == '.') &&
CheckLexTable(Peek(aErrorCode), IS_DIGIT, lexTable)) {
gotDot = PR_TRUE;
} else if ((c > 255) || ((lexTable[c] & IS_DIGIT) == 0)) {
break;

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

@ -234,7 +234,6 @@ protected:
static const PRUint8 IS_DIGIT;
static const PRUint8 IS_HEX_DIGIT;
static const PRUint8 IS_ALPHA;
static const PRUint8 START_IDENT;
static const PRUint8 IS_IDENT;
static const PRUint8 IS_WHITESPACE;