From 0b167b55e77acf6fc8a23687bd3acd22f4c4597e Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Wed, 31 Aug 2005 16:15:58 +0000 Subject: [PATCH] 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 git-svn-id: svn://10.0.0.236/trunk@179391 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/style/nsCSSScanner.cpp | 14 +++++++------- mozilla/layout/style/nsCSSScanner.h | 1 - 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/mozilla/layout/style/nsCSSScanner.cpp b/mozilla/layout/style/nsCSSScanner.cpp index 81cd4e74171..b4f21f65dc9 100644 --- a/mozilla/layout/style/nsCSSScanner.cpp +++ b/mozilla/layout/style/nsCSSScanner.cpp @@ -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; diff --git a/mozilla/layout/style/nsCSSScanner.h b/mozilla/layout/style/nsCSSScanner.h index 685aaad5ed8..68914006f82 100644 --- a/mozilla/layout/style/nsCSSScanner.h +++ b/mozilla/layout/style/nsCSSScanner.h @@ -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;