Use ASCIICType more, and improve it a little bit
https://bugs.webkit.org/show_bug.cgi?id=165360

Reviewed by Sam Weinig.

Source/JavaScriptCore:

* inspector/InspectorValues.cpp:
(Inspector::readHexDigits): Use isASCIIHexDigit.
(Inspector::hextoInt): Deleted.
(decodeString): Use toASCIIHexValue.

* runtime/JSGlobalObjectFunctions.cpp:
(JSC::parseDigit): Use isASCIIDigit, isASCIIUpper, and isASCIILower.

* runtime/StringPrototype.cpp:
(JSC::substituteBackreferencesSlow): Use isASCIIDigit.

Source/WebCore:

* css/CSSGrammar.y.in: Use isASCIIDigit.

* css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseFontFaceUnicodeRange): Use isASCIIHexDigit and
toASCIIHexValue.
(WebCore::isEqualToCSSIdentifier): Use isASCIILower.
* html/FormController.cpp:
(WebCore::isNotFormControlTypeCharacter): Use isASCIILower.
* html/parser/CSSPreloadScanner.cpp:
(WebCore::CSSPreloadScanner::tokenize): Use isASCIIAlpha.
* platform/Decimal.cpp:
(WebCore::Decimal::fromString): Use isASCIIDigit.
* platform/FileSystem.cpp:
(WebCore::decodeFromFilename): Use isASCIIHexDigit and toASCIIHexValue.
* platform/URL.cpp:
(WebCore::isLetterMatchIgnoringCase): Deleted.
(WebCore::isSchemeCharacterMatchIgnoringCase): Deleted.
(WebCore::assertProtocolIsGood): Use isASCIIUpper.
(WebCore::URL::protocolIs): Use isASCIIAlphaCaselessEqual.
(WebCore::URL::parse): Ditto.
(WebCore::protocolIs): Ditto.
(WebCore::protocolIsInHTTPFamily): Ditto.
* platform/URLParser.cpp:
(WeCore::URLParser::parseIPv4Piece): Use isASCIIDigit.

* platform/mac/WebCoreNSURLExtras.mm:
(WebCore::isRussianDomainNameCharacter): Use isASCIIDigit.
(WebCore::allCharactersAllowedByTLDRules): Ditto.
(WebCore::dataWithUserTypedString): Use upperNibbleToASCIIHexDigit and
lowerNibbleToASCIIHexDigit.
(WebCore::dataForURLComponentType): Ditto.
(WebCore::createStringWithEscapedUnsafeCharacters): Ditto.
(WebCore::userVisibleString): Use isASCIIHexDigit, toASCIIHexValue,
upperNibbleToASCIIHexDigit, and lowerNibbleToASCIIHexDigit.
(WebCore::isUserVisibleURL): Use isASCIIHexDigit and toASCIIHexValue.

* platform/network/FormDataBuilder.cpp:
(WebCore::FormDataBuilder::encodeStringAsFormData): Use isASCIIAlphanumeric.

* rendering/mathml/RenderMathMLToken.cpp:
(WebCore::mathVariant): Use isASCIIUpper, isASCIILower, and isASCIIDigit.

* svg/SVGParserUtilities.cpp:
(WebCore::genericParseNumber): Use isASCIIDigit.
* svg/SVGPathStringSource.cpp:
(WebCore::nextCommandHelper): Ditto.
* xml/XPathParser.cpp:
(WebCore::XPath::Parser::lexNumber): Ditto.
(WebCore::XPath::Parser::nextTokenInternal): Ditto.

Source/WebKit2:

* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::capitalizeRFC822HeaderFieldName): Removed unneeded checks to simplify code.

Source/WTF:

* wtf/ASCIICType.h: Added declarations of all the functions to the top of the file,
so we have a list of what's available, not just a mix of that and the implementation.

* wtf/HexNumber.h:
(WTF::Internal::hexDigitsForMode): Moved lowerHexDigits and upperHexDigits
inside this function.
(WTF::appendByteAsHex): Use auto.
(WTF::placeByteAsHexCompressIfPossible): Ditto.
(WTF::placeByteAsHex): Ditto.
(WTF::appendUnsignedAsHex): Ditto.
(WTF::appendUnsigned64AsHex): Ditto.
(WTF::appendUnsignedAsHexFixedSize): Ditto.
(WTF::isHexDigit): Deleted.
(WTF::uncheckedHexDigit): Deleted.
(WTF::hexDigitValue): Deleted.
(WTF::uncheckedHexDigitValue): Deleted.

* wtf/SixCharacterHash.cpp:
(WTF::sixCharacterHashStringToInteger): Use isASCIIUpper, isASCIILower, and
isASCIIDigit. Also added some FIXMEs; for some reason this function uses
RELEASE_ASSERT to abort if the passed-in string is not six characters long,
and it's not clear to me why this is so critical to assert.
(WTF::integerToSixCharacterHashString): Moved the table inside this function,
obviating the need for a macro named TABLE.

* wtf/dtoa/bignum.cc:
(WTF::double_conversion::HexCharValue): Deleted.
(WTF::double_conversion::Bignum::AssignHexString): Use toASCIIHexValue.
* wtf/dtoa/double-conversion.cc:
(WTF::double_conversion::StringToDoubleConverter::StringToDouble): Use isASCIIDigit.

* wtf/text/StringBuilder.cpp:
(WTF::appendQuotedJSONStringInternal): Use upperNibbleToASCIIHexDigit and
lowerNibbleToASCIIHexDigit.

* wtf/text/StringImpl.cpp:
(WTF::StringImpl::convertToUppercaseWithoutLocale): Use toASCIIUpper.
Removed the workaround for a bug that was fixed in Visual Studio 2013.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@209399 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/platform/Decimal.cpp b/Source/WebCore/platform/Decimal.cpp
index 66bd224..3d525cf 100644
--- a/Source/WebCore/platform/Decimal.cpp
+++ b/Source/WebCore/platform/Decimal.cpp
@@ -728,7 +728,7 @@
         const int ch = str[index];
         switch (state) {
         case StateDigit:
-            if (ch >= '0' && ch <= '9') {
+            if (isASCIIDigit(ch)) {
                 if (numberOfDigits < Precision) {
                     ++numberOfDigits;
                     accumulator *= 10;
@@ -743,7 +743,7 @@
             return nan();
 
         case StateDot:
-            if (ch >= '0' && ch <= '9') {
+            if (isASCIIDigit(ch)) {
                 if (numberOfDigits < Precision) {
                     ++numberOfDigits;
                     ++numberOfDigitsAfterDot;
@@ -757,7 +757,7 @@
             FALLTHROUGH;
 
         case StateDotDigit:
-            if (ch >= '0' && ch <= '9') {
+            if (isASCIIDigit(ch)) {
                 if (numberOfDigits < Precision) {
                     ++numberOfDigits;
                     ++numberOfDigitsAfterDot;
@@ -783,7 +783,7 @@
                 break;
             }
 
-            if (ch >= '0' && ch <= '9') {
+            if (isASCIIDigit(ch)) {
                 exponent = ch - '0';
                 state = StateEDigit;
                 break;
@@ -792,7 +792,7 @@
             return nan();
 
         case StateEDigit:
-            if (ch >= '0' && ch <= '9') {
+            if (isASCIIDigit(ch)) {
                 exponent *= 10;
                 exponent += ch - '0';
                 if (exponent > ExponentMax + Precision) {
@@ -807,7 +807,7 @@
             return nan();
 
         case StateESign:
-            if (ch >= '0' && ch <= '9') {
+            if (isASCIIDigit(ch)) {
                 exponent = ch - '0';
                 state = StateEDigit;
                 break;