Title: [265129] trunk/Source/WebCore
Revision
265129
Author
[email protected]
Date
2020-07-30 20:44:09 -0700 (Thu, 30 Jul 2020)

Log Message

It would be nice if the predicate taking functions in ParsingUtilities.h didn't require specifying the character type
https://bugs.webkit.org/show_bug.cgi?id=215002

Reviewed by Darin Adler.

Remove the need for specifying the character type by providing overloads for LChar and UChar
explicitly.

* html/parser/HTMLSrcsetParser.cpp:
(WebCore::parseImageCandidatesFromSrcsetAttribute):
* html/parser/ParsingUtilities.h:
(WebCore::characterPredicate):
* html/track/VTTScanner.h:
(WebCore::characterPredicate):
* loader/LinkHeader.cpp:
(WebCore::findURLBoundaries):
(WebCore::invalidParameterDelimiter):
(WebCore::parseParameterDelimiter):
(WebCore::parseParameterName):
(WebCore::skipQuotesIfNeeded):
(WebCore::parseParameterValue):
(WebCore::findNextHeader):
* loader/ResourceCryptographicDigest.cpp:
(WebCore::parseCryptographicDigestImpl):
(WebCore::parseEncodedCryptographicDigestImpl):
* loader/SubresourceIntegrity.cpp:
(WebCore::splitOnSpaces):
* loader/appcache/ApplicationCacheManifestParser.cpp:
(WebCore::parseApplicationCacheManifest):
* page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::ContentSecurityPolicyDirectiveList::parseDirective):
(WebCore::ContentSecurityPolicyDirectiveList::parseReportURI):
* page/csp/ContentSecurityPolicyMediaListDirective.cpp:
(WebCore::ContentSecurityPolicyMediaListDirective::parse):
* page/csp/ContentSecurityPolicySourceList.cpp:
(WebCore::isSourceListNone):
(WebCore::ContentSecurityPolicySourceList::parse):
(WebCore::ContentSecurityPolicySourceList::parseSource):
(WebCore::ContentSecurityPolicySourceList::parseScheme):
(WebCore::ContentSecurityPolicySourceList::parseHost):
(WebCore::ContentSecurityPolicySourceList::parsePath):
(WebCore::ContentSecurityPolicySourceList::parsePort):
(WebCore::ContentSecurityPolicySourceList::parseNonceSource):
* platform/DateComponents.cpp:
(WebCore::countDigits):
* svg/SVGLengthList.cpp:
(WebCore::SVGLengthList::parse):
* svg/SVGParserUtilities.cpp:
(WebCore::genericParseNumber):
* svg/SVGParserUtilities.h:
(WebCore::skipOptionalSVGSpaces):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (265128 => 265129)


--- trunk/Source/WebCore/ChangeLog	2020-07-31 03:25:33 UTC (rev 265128)
+++ trunk/Source/WebCore/ChangeLog	2020-07-31 03:44:09 UTC (rev 265129)
@@ -1,5 +1,59 @@
 2020-07-30  Sam Weinig  <[email protected]>
 
+        It would be nice if the predicate taking functions in ParsingUtilities.h didn't require specifying the character type
+        https://bugs.webkit.org/show_bug.cgi?id=215002
+
+        Reviewed by Darin Adler.
+
+        Remove the need for specifying the character type by providing overloads for LChar and UChar
+        explicitly.
+
+        * html/parser/HTMLSrcsetParser.cpp:
+        (WebCore::parseImageCandidatesFromSrcsetAttribute):
+        * html/parser/ParsingUtilities.h:
+        (WebCore::characterPredicate):
+        * html/track/VTTScanner.h:
+        (WebCore::characterPredicate):
+        * loader/LinkHeader.cpp:
+        (WebCore::findURLBoundaries):
+        (WebCore::invalidParameterDelimiter):
+        (WebCore::parseParameterDelimiter):
+        (WebCore::parseParameterName):
+        (WebCore::skipQuotesIfNeeded):
+        (WebCore::parseParameterValue):
+        (WebCore::findNextHeader):
+        * loader/ResourceCryptographicDigest.cpp:
+        (WebCore::parseCryptographicDigestImpl):
+        (WebCore::parseEncodedCryptographicDigestImpl):
+        * loader/SubresourceIntegrity.cpp:
+        (WebCore::splitOnSpaces):
+        * loader/appcache/ApplicationCacheManifestParser.cpp:
+        (WebCore::parseApplicationCacheManifest):
+        * page/csp/ContentSecurityPolicyDirectiveList.cpp:
+        (WebCore::ContentSecurityPolicyDirectiveList::parseDirective):
+        (WebCore::ContentSecurityPolicyDirectiveList::parseReportURI):
+        * page/csp/ContentSecurityPolicyMediaListDirective.cpp:
+        (WebCore::ContentSecurityPolicyMediaListDirective::parse):
+        * page/csp/ContentSecurityPolicySourceList.cpp:
+        (WebCore::isSourceListNone):
+        (WebCore::ContentSecurityPolicySourceList::parse):
+        (WebCore::ContentSecurityPolicySourceList::parseSource):
+        (WebCore::ContentSecurityPolicySourceList::parseScheme):
+        (WebCore::ContentSecurityPolicySourceList::parseHost):
+        (WebCore::ContentSecurityPolicySourceList::parsePath):
+        (WebCore::ContentSecurityPolicySourceList::parsePort):
+        (WebCore::ContentSecurityPolicySourceList::parseNonceSource):
+        * platform/DateComponents.cpp:
+        (WebCore::countDigits):
+        * svg/SVGLengthList.cpp:
+        (WebCore::SVGLengthList::parse):
+        * svg/SVGParserUtilities.cpp:
+        (WebCore::genericParseNumber):
+        * svg/SVGParserUtilities.h:
+        (WebCore::skipOptionalSVGSpaces):
+
+2020-07-30  Sam Weinig  <[email protected]>
+
         Convert DateComponents to use StringParsingBuffer
         https://bugs.webkit.org/show_bug.cgi?id=213929
 

Modified: trunk/Source/WebCore/html/parser/HTMLSrcsetParser.cpp (265128 => 265129)


--- trunk/Source/WebCore/html/parser/HTMLSrcsetParser.cpp	2020-07-31 03:25:33 UTC (rev 265128)
+++ trunk/Source/WebCore/html/parser/HTMLSrcsetParser.cpp	2020-07-31 03:44:09 UTC (rev 265129)
@@ -170,7 +170,7 @@
 
     for (const CharType* position = attributeStart; position < attributeEnd;) {
         // 4. Splitting loop: Collect a sequence of characters that are space characters or U+002C COMMA characters.
-        skipWhile<CharType, isHTMLSpaceOrComma<CharType> >(position, attributeEnd);
+        skipWhile<isHTMLSpaceOrComma>(position, attributeEnd);
         if (position == attributeEnd) {
             // Contrary to spec language - descriptor parsing happens on each candidate, so when we reach the attributeEnd, we can exit.
             break;
@@ -178,7 +178,7 @@
         const CharType* imageURLStart = position;
         // 6. Collect a sequence of characters that are not space characters, and let that be url.
 
-        skipUntil<CharType, isHTMLSpace<CharType> >(position, attributeEnd);
+        skipUntil<isHTMLSpace>(position, attributeEnd);
         const CharType* imageURLEnd = position;
 
         DescriptorParsingResult result;
@@ -187,13 +187,13 @@
         if (isComma(*(position - 1))) {
             // Remove all trailing U+002C COMMA characters from url.
             imageURLEnd = position - 1;
-            reverseSkipWhile<CharType, isComma>(imageURLEnd, imageURLStart);
+            reverseSkipWhile<isComma>(imageURLEnd, imageURLStart);
             ++imageURLEnd;
             // If url is empty, then jump to the step labeled splitting loop.
             if (imageURLStart == imageURLEnd)
                 continue;
         } else {
-            skipWhile<CharType, isHTMLSpace<CharType>>(position, attributeEnd);
+            skipWhile<isHTMLSpace>(position, attributeEnd);
             Vector<StringView> descriptorTokens;
             tokenizeDescriptors(position, attributeEnd, descriptorTokens);
             // Contrary to spec language - descriptor parsing happens on each candidate.

Modified: trunk/Source/WebCore/html/parser/ParsingUtilities.h (265128 => 265129)


--- trunk/Source/WebCore/html/parser/ParsingUtilities.h	2020-07-31 03:25:33 UTC (rev 265128)
+++ trunk/Source/WebCore/html/parser/ParsingUtilities.h	2020-07-31 03:44:09 UTC (rev 265129)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -30,8 +31,8 @@
 
 #pragma once
 
-#include <wtf/Forward.h>
 #include <wtf/text/StringCommon.h>
+#include <wtf/text/StringParsingBuffer.h>
 
 namespace WebCore {
 
@@ -58,7 +59,7 @@
     return false;
 }
 
-template<typename CharacterType, bool characterPredicate(CharacterType)> bool skipExactly(const CharacterType*& position, const CharacterType* end)
+template<bool characterPredicate(LChar)> bool skipExactly(const LChar*& position, const LChar* end)
 {
     if (position < end && characterPredicate(*position)) {
         ++position;
@@ -67,8 +68,17 @@
     return false;
 }
 
-template<typename CharacterType, bool characterPredicate(CharacterType)> bool skipExactly(StringParsingBuffer<CharacterType>& buffer)
+template<bool characterPredicate(UChar)> bool skipExactly(const UChar*& position, const UChar* end)
 {
+    if (position < end && characterPredicate(*position)) {
+        ++position;
+        return true;
+    }
+    return false;
+}
+
+template<bool characterPredicate(LChar)> bool skipExactly(StringParsingBuffer<LChar>& buffer)
+{
     if (buffer.hasCharactersRemaining() && characterPredicate(*buffer)) {
         ++buffer;
         return true;
@@ -76,6 +86,15 @@
     return false;
 }
 
+template<bool characterPredicate(UChar)> bool skipExactly(StringParsingBuffer<UChar>& buffer)
+{
+    if (buffer.hasCharactersRemaining() && characterPredicate(*buffer)) {
+        ++buffer;
+        return true;
+    }
+    return false;
+}
+
 template<typename CharacterType, typename DelimiterType> void skipUntil(const CharacterType*& position, const CharacterType* end, DelimiterType delimiter)
 {
     while (position < end && *position != delimiter)
@@ -88,36 +107,67 @@
         ++buffer;
 }
 
-template<typename CharacterType, bool characterPredicate(CharacterType)> void skipUntil(const CharacterType*& position, const CharacterType* end)
+template<bool characterPredicate(LChar)> void skipUntil(const LChar*& position, const LChar* end)
 {
     while (position < end && !characterPredicate(*position))
         ++position;
 }
 
-template<typename CharacterType, bool characterPredicate(CharacterType)> void skipUntil(StringParsingBuffer<CharacterType>& buffer)
+template<bool characterPredicate(UChar)> void skipUntil(const UChar*& position, const UChar* end)
 {
+    while (position < end && !characterPredicate(*position))
+        ++position;
+}
+
+template<bool characterPredicate(LChar)> void skipUntil(StringParsingBuffer<LChar>& buffer)
+{
     while (buffer.hasCharactersRemaining() && !characterPredicate(*buffer))
         ++buffer;
 }
 
-template<typename CharacterType, bool characterPredicate(CharacterType)> void skipWhile(const CharacterType*& position, const CharacterType* end)
+template<bool characterPredicate(UChar)> void skipUntil(StringParsingBuffer<UChar>& buffer)
 {
+    while (buffer.hasCharactersRemaining() && !characterPredicate(*buffer))
+        ++buffer;
+}
+
+template<bool characterPredicate(LChar)> void skipWhile(const LChar*& position, const LChar* end)
+{
     while (position < end && characterPredicate(*position))
         ++position;
 }
 
-template<typename CharacterType, bool characterPredicate(CharacterType)> void skipWhile(StringParsingBuffer<CharacterType>& buffer)
+template<bool characterPredicate(UChar)> void skipWhile(const UChar*& position, const UChar* end)
 {
+    while (position < end && characterPredicate(*position))
+        ++position;
+}
+
+template<bool characterPredicate(LChar)> void skipWhile(StringParsingBuffer<LChar>& buffer)
+{
     while (buffer.hasCharactersRemaining() && characterPredicate(*buffer))
         ++buffer;
 }
 
-template<typename CharacterType, bool characterPredicate(CharacterType)> void reverseSkipWhile(const CharacterType*& position, const CharacterType* start)
+template<bool characterPredicate(UChar)> void skipWhile(StringParsingBuffer<UChar>& buffer)
 {
+    while (buffer.hasCharactersRemaining() && characterPredicate(*buffer))
+        ++buffer;
+}
+
+
+template<bool characterPredicate(LChar)> void reverseSkipWhile(const LChar*& position, const LChar* start)
+{
     while (position >= start && characterPredicate(*position))
         --position;
 }
 
+template<bool characterPredicate(UChar)> void reverseSkipWhile(const UChar*& position, const UChar* start)
+{
+    while (position >= start && characterPredicate(*position))
+        --position;
+}
+
 template<typename CharacterType, unsigned lowercaseLettersArraySize> bool skipExactlyIgnoringASCIICase(const CharacterType*& position, const CharacterType* end, const char (&lowercaseLetters)[lowercaseLettersArraySize])
 {
     constexpr auto lowercaseLettersLength = lowercaseLettersArraySize - 1;

Modified: trunk/Source/WebCore/html/track/VTTScanner.h (265128 => 265129)


--- trunk/Source/WebCore/html/track/VTTScanner.h	2020-07-31 03:25:33 UTC (rev 265128)
+++ trunk/Source/WebCore/html/track/VTTScanner.h	2020-07-31 03:44:09 UTC (rev 265129)
@@ -166,9 +166,9 @@
 inline void VTTScanner::skipWhile()
 {
     if (m_is8Bit)
-        WebCore::skipWhile<LChar, LCharPredicateAdapter<characterPredicate> >(m_data.characters8, m_end.characters8);
+        WebCore::skipWhile<LCharPredicateAdapter<characterPredicate> >(m_data.characters8, m_end.characters8);
     else
-        WebCore::skipWhile<UChar, characterPredicate>(m_data.characters16, m_end.characters16);
+        WebCore::skipWhile<characterPredicate>(m_data.characters16, m_end.characters16);
 }
 
 template<bool characterPredicate(UChar)>
@@ -175,9 +175,9 @@
 inline void VTTScanner::skipUntil()
 {
     if (m_is8Bit)
-        WebCore::skipUntil<LChar, LCharPredicateAdapter<characterPredicate> >(m_data.characters8, m_end.characters8);
+        WebCore::skipUntil<LCharPredicateAdapter<characterPredicate> >(m_data.characters8, m_end.characters8);
     else
-        WebCore::skipUntil<UChar, characterPredicate>(m_data.characters16, m_end.characters16);
+        WebCore::skipUntil<characterPredicate>(m_data.characters16, m_end.characters16);
 }
 
 template<bool characterPredicate(UChar)>
@@ -185,11 +185,11 @@
 {
     if (m_is8Bit) {
         const LChar* current = m_data.characters8;
-        WebCore::skipWhile<LChar, LCharPredicateAdapter<characterPredicate> >(current, m_end.characters8);
+        WebCore::skipWhile<LCharPredicateAdapter<characterPredicate>>(current, m_end.characters8);
         return Run(position(), current, m_is8Bit);
     }
     const UChar* current = m_data.characters16;
-    WebCore::skipWhile<UChar, characterPredicate>(current, m_end.characters16);
+    WebCore::skipWhile<characterPredicate>(current, m_end.characters16);
     return Run(position(), reinterpret_cast<Position>(current), m_is8Bit);
 }
 
@@ -198,11 +198,11 @@
 {
     if (m_is8Bit) {
         const LChar* current = m_data.characters8;
-        WebCore::skipUntil<LChar, LCharPredicateAdapter<characterPredicate> >(current, m_end.characters8);
+        WebCore::skipUntil<LCharPredicateAdapter<characterPredicate> >(current, m_end.characters8);
         return Run(position(), current, m_is8Bit);
     }
     const UChar* current = m_data.characters16;
-    WebCore::skipUntil<UChar, characterPredicate>(current, m_end.characters16);
+    WebCore::skipUntil<characterPredicate>(current, m_end.characters16);
     return Run(position(), reinterpret_cast<Position>(current), m_is8Bit);
 }
 

Modified: trunk/Source/WebCore/loader/LinkHeader.cpp (265128 => 265129)


--- trunk/Source/WebCore/loader/LinkHeader.cpp	2020-07-31 03:25:33 UTC (rev 265128)
+++ trunk/Source/WebCore/loader/LinkHeader.cpp	2020-07-31 03:44:09 UTC (rev 265129)
@@ -89,16 +89,16 @@
 static Optional<String> findURLBoundaries(CharacterType*& position, CharacterType* const end)
 {
     ASSERT(position <= end);
-    skipWhile<CharacterType, isSpaceOrTab>(position, end);
-    if (!skipExactly<CharacterType>(position, end, '<'))
+    skipWhile<isSpaceOrTab>(position, end);
+    if (!skipExactly(position, end, '<'))
         return WTF::nullopt;
-    skipWhile<CharacterType, isSpaceOrTab>(position, end);
+    skipWhile<isSpaceOrTab>(position, end);
 
     CharacterType* urlStart = position;
-    skipWhile<CharacterType, isNotURLTerminatingChar>(position, end);
+    skipWhile<isNotURLTerminatingChar>(position, end);
     CharacterType* urlEnd = position;
-    skipUntil<CharacterType>(position, end, '>');
-    if (!skipExactly<CharacterType>(position, end, '>'))
+    skipUntil(position, end, '>');
+    if (!skipExactly(position, end, '>'))
         return WTF::nullopt;
 
     return String(urlStart, urlEnd - urlStart);
@@ -108,7 +108,7 @@
 static bool invalidParameterDelimiter(CharacterType*& position, CharacterType* const end)
 {
     ASSERT(position <= end);
-    return (!skipExactly<CharacterType>(position, end, ';') && (position < end) && (*position != ','));
+    return (!skipExactly(position, end, ';') && (position < end) && (*position != ','));
 }
 
 template <typename CharacterType>
@@ -134,12 +134,12 @@
 {
     ASSERT(position <= end);
     isValid = true;
-    skipWhile<CharacterType, isSpaceOrTab>(position, end);
+    skipWhile<isSpaceOrTab>(position, end);
     if (invalidParameterDelimiter(position, end)) {
         isValid = false;
         return false;
     }
-    skipWhile<CharacterType, isSpaceOrTab>(position, end);
+    skipWhile<isSpaceOrTab>(position, end);
     if (validFieldEnd(position, end))
         return false;
     return true;
@@ -188,11 +188,11 @@
 {
     ASSERT(position <= end);
     CharacterType* nameStart = position;
-    skipWhile<CharacterType, isValidParameterNameChar>(position, end);
+    skipWhile<isValidParameterNameChar>(position, end);
     CharacterType* nameEnd = position;
-    skipWhile<CharacterType, isSpaceOrTab>(position, end);
-    bool hasEqual = skipExactly<CharacterType>(position, end, '=');
-    skipWhile<CharacterType, isSpaceOrTab>(position, end);
+    skipWhile<isSpaceOrTab>(position, end);
+    bool hasEqual = skipExactly(position, end, '=');
+    skipWhile<isSpaceOrTab>(position, end);
     name = paramterNameFromString(String(nameStart, nameEnd - nameStart));
     if (hasEqual)
         return true;
@@ -216,9 +216,9 @@
 {
     ASSERT(position <= end);
     unsigned char quote;
-    if (skipExactly<CharacterType>(position, end, '\''))
+    if (skipExactly(position, end, '\''))
         quote = '\'';
-    else if (skipExactly<CharacterType>(position, end, '"'))
+    else if (skipExactly(position, end, '"'))
         quote = '"';
     else
         return false;
@@ -252,9 +252,9 @@
     bool completeQuotes = false;
     bool hasQuotes = skipQuotesIfNeeded(position, end, completeQuotes);
     if (!hasQuotes)
-        skipWhile<CharacterType, isParameterValueChar>(position, end);
+        skipWhile<isParameterValueChar>(position, end);
     valueEnd = position;
-    skipWhile<CharacterType, isSpaceOrTab>(position, end);
+    skipWhile<isSpaceOrTab>(position, end);
     if ((!completeQuotes && valueStart == valueEnd) || (position != end && !isParameterValueEnd(*position))) {
         value = emptyString();
         return false;
@@ -310,8 +310,8 @@
 static void findNextHeader(CharacterType*& position, CharacterType* const end)
 {
     ASSERT(position <= end);
-    skipUntil<CharacterType>(position, end, ',');
-    skipExactly<CharacterType>(position, end, ',');
+    skipUntil(position, end, ',');
+    skipExactly(position, end, ',');
 }
 
 template <typename CharacterType>

Modified: trunk/Source/WebCore/loader/ResourceCryptographicDigest.cpp (265128 => 265129)


--- trunk/Source/WebCore/loader/ResourceCryptographicDigest.cpp	2020-07-31 03:25:33 UTC (rev 265128)
+++ trunk/Source/WebCore/loader/ResourceCryptographicDigest.cpp	2020-07-31 03:44:09 UTC (rev 265129)
@@ -62,7 +62,7 @@
         return WTF::nullopt;
 
     auto beginHashValue = buffer.position();
-    skipWhile<CharacterType, isBase64OrBase64URLCharacter>(buffer);
+    skipWhile<isBase64OrBase64URLCharacter>(buffer);
     skipExactly(buffer, '=');
     skipExactly(buffer, '=');
 
@@ -102,7 +102,7 @@
         return WTF::nullopt;
 
     auto beginHashValue = buffer.position();
-    skipWhile<CharacterType, isBase64OrBase64URLCharacter>(buffer);
+    skipWhile<isBase64OrBase64URLCharacter>(buffer);
     skipExactly(buffer, '=');
     skipExactly(buffer, '=');
 

Modified: trunk/Source/WebCore/loader/SubresourceIntegrity.cpp (265128 => 265129)


--- trunk/Source/WebCore/loader/SubresourceIntegrity.cpp	2020-07-31 03:25:33 UTC (rev 265128)
+++ trunk/Source/WebCore/loader/SubresourceIntegrity.cpp	2020-07-31 03:44:09 UTC (rev 265129)
@@ -67,7 +67,7 @@
         // specific options have been specified. Thus, we just parse and ignore
         // them. Their syntax is a '?' follow by any number of VCHARs.
         if (skipExactly(buffer, '?'))
-            skipWhile<CharacterType, isVCHAR>(buffer);
+            skipWhile<isVCHAR>(buffer);
 
         // After the base64 value and options, the current character pointed to by position
         // should either be the end or a space.
@@ -87,12 +87,12 @@
 template <typename CharacterType, typename Functor>
 static inline void splitOnSpaces(StringParsingBuffer<CharacterType> buffer, Functor&& functor)
 {
-    skipWhile<CharacterType, isHTMLSpace>(buffer);
+    skipWhile<isHTMLSpace>(buffer);
 
     while (buffer.hasCharactersRemaining()) {
         if (!functor(buffer))
-            skipWhile<CharacterType, isNotHTMLSpace>(buffer);
-        skipWhile<CharacterType, isHTMLSpace>(buffer);
+            skipWhile<isNotHTMLSpace>(buffer);
+        skipWhile<isHTMLSpace>(buffer);
     }
 }
 

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheManifestParser.cpp (265128 => 265129)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheManifestParser.cpp	2020-07-31 03:25:33 UTC (rev 265128)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheManifestParser.cpp	2020-07-31 03:44:09 UTC (rev 265129)
@@ -96,11 +96,11 @@
             return WTF::nullopt;
 
         // Skip to the end of the line.
-        skipUntil<CharacterType, isManifestNewline>(buffer);
+        skipUntil<isManifestNewline>(buffer);
 
         while (1) {
             // Skip whitespace
-            skipWhile<CharacterType, isManifestWhitespaceOrNewline>(buffer);
+            skipWhile<isManifestWhitespaceOrNewline>(buffer);
             
             if (buffer.atEnd())
                 break;
@@ -108,7 +108,7 @@
             auto lineStart = buffer.position();
             
             // Find the end of the line
-            skipUntil<CharacterType, isManifestNewline>(buffer);
+            skipUntil<isManifestNewline>(buffer);
             
             // Line is a comment, skip to the next line.
             if (*lineStart == '#')
@@ -147,7 +147,7 @@
             
             case ApplicationCacheParserMode::Explicit: {
                 // Look for whitespace separating the URL from subsequent ignored tokens.
-                skipUntil<CharacterType, isManifestWhitespace>(lineBuffer);
+                skipUntil<isManifestWhitespace>(lineBuffer);
 
                 auto url = "" lineStart, lineBuffer.position());
                 if (!url.isValid())
@@ -165,7 +165,7 @@
 
             case ApplicationCacheParserMode::OnlineAllowlist: {
                 // Look for whitespace separating the URL from subsequent ignored tokens.
-                skipUntil<CharacterType, isManifestWhitespace>(lineBuffer);
+                skipUntil<isManifestWhitespace>(lineBuffer);
 
                 if (lineBuffer.position() - lineStart == 1 && *lineStart == '*') {
                     // Wildcard was found.
@@ -186,7 +186,7 @@
             
             case ApplicationCacheParserMode::Fallback: {
                 // Look for whitespace separating the two URLs
-                skipUntil<CharacterType, isManifestWhitespace>(lineBuffer);
+                skipUntil<isManifestWhitespace>(lineBuffer);
 
                 if (lineBuffer.atEnd()) {
                     // There was no whitespace separating the URLs.
@@ -207,12 +207,12 @@
                     continue;
 
                 // Skip whitespace separating fallback namespace from URL.
-                skipWhile<CharacterType, isManifestWhitespace>(lineBuffer);
+                skipWhile<isManifestWhitespace>(lineBuffer);
 
                 auto fallbackStart = lineBuffer.position();
 
                 // Look for whitespace separating the URL from subsequent ignored tokens.
-                skipUntil<CharacterType, isManifestWhitespace>(lineBuffer);
+                skipUntil<isManifestWhitespace>(lineBuffer);
 
                 auto fallbackURL = makeManifestURL(manifestURL, fallbackStart, lineBuffer.position());
                 if (!fallbackURL.isValid())

Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp (265128 => 265129)


--- trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp	2020-07-31 03:25:33 UTC (rev 265128)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp	2020-07-31 03:44:09 UTC (rev 265129)
@@ -371,7 +371,7 @@
 //
 template<typename CharacterType> auto ContentSecurityPolicyDirectiveList::parseDirective(StringParsingBuffer<CharacterType> buffer) -> Optional<ParsedDirective>
 {
-    skipWhile<CharacterType, isASCIISpace>(buffer);
+    skipWhile<isASCIISpace>(buffer);
 
     // Empty directive (e.g. ";;;"). Exit early.
     if (buffer.atEnd())
@@ -378,11 +378,11 @@
         return WTF::nullopt;
 
     auto nameBegin = buffer.position();
-    skipWhile<CharacterType, isDirectiveNameCharacter>(buffer);
+    skipWhile<isDirectiveNameCharacter>(buffer);
 
     // The directive-name must be non-empty.
     if (nameBegin == buffer.position()) {
-        skipWhile<CharacterType, isNotASCIISpace>(buffer);
+        skipWhile<isNotASCIISpace>(buffer);
         m_policy.reportUnsupportedDirective(String(nameBegin, buffer.position() - nameBegin));
         return WTF::nullopt;
     }
@@ -392,16 +392,16 @@
     if (buffer.atEnd())
         return ParsedDirective { WTFMove(name), { } };
 
-    if (!skipExactly<CharacterType, isASCIISpace>(buffer)) {
-        skipWhile<CharacterType, isNotASCIISpace>(buffer);
+    if (!skipExactly<isASCIISpace>(buffer)) {
+        skipWhile<isNotASCIISpace>(buffer);
         m_policy.reportUnsupportedDirective(String(nameBegin, buffer.position() - nameBegin));
         return WTF::nullopt;
     }
 
-    skipWhile<CharacterType, isASCIISpace>(buffer);
+    skipWhile<isASCIISpace>(buffer);
 
     auto valueBegin = buffer.position();
-    skipWhile<CharacterType, isDirectiveValueCharacter>(buffer);
+    skipWhile<isDirectiveValueCharacter>(buffer);
 
     if (!buffer.atEnd()) {
         m_policy.reportInvalidDirectiveValueCharacter(name, String(valueBegin, buffer.end() - valueBegin));
@@ -424,14 +424,12 @@
     }
 
     readCharactersForParsing(directive.value, [&](auto buffer) {
-        using CharacterType = typename decltype(buffer)::CharacterType;
-
         auto begin = buffer.position();
         while (buffer.hasCharactersRemaining()) {
-            skipWhile<CharacterType, isASCIISpace>(buffer);
+            skipWhile<isASCIISpace>(buffer);
 
             auto urlBegin = buffer.position();
-            skipWhile<CharacterType, isNotASCIISpace>(buffer);
+            skipWhile<isNotASCIISpace>(buffer);
 
             if (urlBegin < buffer.position())
                 m_reportURIs.append(directive.value.substring(urlBegin - begin, buffer.position() - urlBegin));

Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicyMediaListDirective.cpp (265128 => 265129)


--- trunk/Source/WebCore/page/csp/ContentSecurityPolicyMediaListDirective.cpp	2020-07-31 03:25:33 UTC (rev 265128)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicyMediaListDirective.cpp	2020-07-31 03:44:09 UTC (rev 265129)
@@ -60,12 +60,10 @@
     }
 
     readCharactersForParsing(value, [&](auto buffer) {
-        using CharacterType = typename decltype(buffer)::CharacterType;
-
         while (buffer.hasCharactersRemaining()) {
             // _____ OR _____mime1/mime1
             // ^        ^
-            skipWhile<CharacterType, isASCIISpace>(buffer);
+            skipWhile<isASCIISpace>(buffer);
             if (buffer.atEnd())
                 return;
 
@@ -72,17 +70,17 @@
             // mime1/mime1 mime2/mime2
             // ^
             auto begin = buffer.position();
-            if (!skipExactly<CharacterType, isMediaTypeCharacter>(buffer)) {
-                skipWhile<CharacterType, isNotASCIISpace>(buffer);
+            if (!skipExactly<isMediaTypeCharacter>(buffer)) {
+                skipWhile<isNotASCIISpace>(buffer);
                 directiveList().policy().reportInvalidPluginTypes(String(begin, buffer.position() - begin));
                 continue;
             }
-            skipWhile<CharacterType, isMediaTypeCharacter>(buffer);
+            skipWhile<isMediaTypeCharacter>(buffer);
 
             // mime1/mime1 mime2/mime2
             //      ^
             if (!skipExactly(buffer, '/')) {
-                skipWhile<CharacterType, isNotASCIISpace>(buffer);
+                skipWhile<isNotASCIISpace>(buffer);
                 directiveList().policy().reportInvalidPluginTypes(String(begin, buffer.position() - begin));
                 continue;
             }
@@ -89,17 +87,17 @@
 
             // mime1/mime1 mime2/mime2
             //       ^
-            if (!skipExactly<CharacterType, isMediaTypeCharacter>(buffer)) {
-                skipWhile<CharacterType, isNotASCIISpace>(buffer);
+            if (!skipExactly<isMediaTypeCharacter>(buffer)) {
+                skipWhile<isNotASCIISpace>(buffer);
                 directiveList().policy().reportInvalidPluginTypes(String(begin, buffer.position() - begin));
                 continue;
             }
-            skipWhile<CharacterType, isMediaTypeCharacter>(buffer);
+            skipWhile<isMediaTypeCharacter>(buffer);
 
             // mime1/mime1 mime2/mime2 OR mime1/mime1  OR mime1/mime1/error
             //            ^                          ^               ^
             if (buffer.hasCharactersRemaining() && isNotASCIISpace(*buffer)) {
-                skipWhile<CharacterType, isNotASCIISpace>(buffer);
+                skipWhile<isNotASCIISpace>(buffer);
                 directiveList().policy().reportInvalidPluginTypes(String(begin, buffer.position() - begin));
                 continue;
             }

Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp (265128 => 265129)


--- trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp	2020-07-31 03:25:33 UTC (rev 265128)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp	2020-07-31 03:44:09 UTC (rev 265129)
@@ -84,12 +84,12 @@
 
 template<typename CharacterType> static bool isSourceListNone(StringParsingBuffer<CharacterType> buffer)
 {
-    skipWhile<CharacterType, isASCIISpace>(buffer);
+    skipWhile<isASCIISpace>(buffer);
 
     if (!skipExactlyIgnoringASCIICase(buffer, "'none'"))
         return false;
 
-    skipWhile<CharacterType, isASCIISpace>(buffer);
+    skipWhile<isASCIISpace>(buffer);
 
     return buffer.atEnd();
 }
@@ -159,12 +159,12 @@
 template<typename CharacterType> void ContentSecurityPolicySourceList::parse(StringParsingBuffer<CharacterType> buffer)
 {
     while (buffer.hasCharactersRemaining()) {
-        skipWhile<CharacterType, isASCIISpace>(buffer);
+        skipWhile<isASCIISpace>(buffer);
         if (buffer.atEnd())
             return;
 
         auto beginSource = buffer.position();
-        skipWhile<CharacterType, isSourceCharacter>(buffer);
+        skipWhile<isSourceCharacter>(buffer);
 
         auto sourceBuffer = StringParsingBuffer { beginSource, buffer.position() };
 
@@ -231,7 +231,7 @@
     auto beginPath = buffer.end();
     const CharacterType* beginPort = nullptr;
 
-    skipWhile<CharacterType, isNotColonOrSlash>(buffer);
+    skipWhile<isNotColonOrSlash>(buffer);
 
     if (buffer.atEnd()) {
         // host
@@ -287,7 +287,7 @@
             source.scheme = WTFMove(*scheme);
 
             beginHost = buffer.position();
-            skipWhile<CharacterType, isNotColonOrSlash>(buffer);
+            skipWhile<isNotColonOrSlash>(buffer);
         }
 
         if (buffer.hasCharactersRemaining() && *buffer == ':') {
@@ -343,10 +343,10 @@
 
     auto begin = buffer.position();
 
-    if (!skipExactly<CharacterType, isASCIIAlpha>(buffer))
+    if (!skipExactly<isASCIIAlpha>(buffer))
         return WTF::nullopt;
 
-    skipWhile<CharacterType, isSchemeContinuationCharacter>(buffer);
+    skipWhile<isSchemeContinuationCharacter>(buffer);
 
     if (!buffer.atEnd())
         return WTF::nullopt;
@@ -380,10 +380,10 @@
     auto hostBegin = buffer.position();
 
     while (buffer.hasCharactersRemaining()) {
-        if (!skipExactly<CharacterType, isHostCharacter>(buffer))
+        if (!skipExactly<isHostCharacter>(buffer))
             return WTF::nullopt;
 
-        skipWhile<CharacterType, isHostCharacter>(buffer);
+        skipWhile<isHostCharacter>(buffer);
 
         if (buffer.hasCharactersRemaining() && !skipExactly(buffer, '.'))
             return WTF::nullopt;
@@ -399,7 +399,7 @@
     ASSERT(buffer.position() <= buffer.end());
     
     auto begin = buffer.position();
-    skipWhile<CharacterType, isPathComponentCharacter>(buffer);
+    skipWhile<isPathComponentCharacter>(buffer);
     // path/to/file.js?query=string || path/to/file.js#anchor
     //                ^                               ^
     if (buffer.hasCharactersRemaining())
@@ -430,7 +430,7 @@
     }
     
     auto begin = buffer.position();
-    skipWhile<CharacterType, isASCIIDigit>(buffer);
+    skipWhile<isASCIIDigit>(buffer);
     
     if (!buffer.atEnd())
         return WTF::nullopt;
@@ -461,7 +461,7 @@
         return false;
 
     auto beginNonceValue = buffer.position();
-    skipWhile<CharacterType, isNonceCharacter>(buffer);
+    skipWhile<isNonceCharacter>(buffer);
     if (buffer.atEnd() || buffer.position() == beginNonceValue || *buffer != '\'')
         return false;
     m_nonces.add(String(beginNonceValue, buffer.position() - beginNonceValue));

Modified: trunk/Source/WebCore/platform/DateComponents.cpp (265128 => 265129)


--- trunk/Source/WebCore/platform/DateComponents.cpp	2020-07-31 03:25:33 UTC (rev 265128)
+++ trunk/Source/WebCore/platform/DateComponents.cpp	2020-07-31 03:44:09 UTC (rev 265129)
@@ -109,7 +109,7 @@
 template<typename CharacterType> static unsigned countDigits(StringParsingBuffer<CharacterType> buffer)
 {
     auto begin = buffer.position();
-    skipWhile<CharacterType, isASCIIDigit>(buffer);
+    skipWhile<isASCIIDigit>(buffer);
     return buffer.position() - begin;
 }
 

Modified: trunk/Source/WebCore/svg/SVGLengthList.cpp (265128 => 265129)


--- trunk/Source/WebCore/svg/SVGLengthList.cpp	2020-07-31 03:25:33 UTC (rev 265128)
+++ trunk/Source/WebCore/svg/SVGLengthList.cpp	2020-07-31 03:44:09 UTC (rev 265129)
@@ -36,12 +36,10 @@
     clearItems();
 
     return readCharactersForParsing(value, [&](auto buffer) {
-        using CharacterType = typename decltype(buffer)::CharacterType;
-
         while (buffer.hasCharactersRemaining()) {
             auto start = buffer.position();
 
-            skipUntil<CharacterType, isSVGSpaceOrComma>(buffer);
+            skipUntil<isSVGSpaceOrComma>(buffer);
 
             if (buffer.position() == start)
                 break;

Modified: trunk/Source/WebCore/svg/SVGParserUtilities.cpp (265128 => 265129)


--- trunk/Source/WebCore/svg/SVGParserUtilities.cpp	2020-07-31 03:25:33 UTC (rev 265128)
+++ trunk/Source/WebCore/svg/SVGParserUtilities.cpp	2020-07-31 03:44:09 UTC (rev 265129)
@@ -68,7 +68,7 @@
     auto ptrStartIntPart = buffer.position();
     
     // Advance to first non-digit.
-    skipWhile<CharacterType, isASCIIDigit>(buffer);
+    skipWhile<isASCIIDigit>(buffer);
 
     if (buffer.position() != ptrStartIntPart) {
         auto ptrScanIntPart = buffer.position() - 1;

Modified: trunk/Source/WebCore/svg/SVGParserUtilities.h (265128 => 265129)


--- trunk/Source/WebCore/svg/SVGParserUtilities.h	2020-07-31 03:25:33 UTC (rev 265128)
+++ trunk/Source/WebCore/svg/SVGParserUtilities.h	2020-07-31 03:44:09 UTC (rev 265129)
@@ -70,13 +70,13 @@
 
 template<typename CharacterType> constexpr bool skipOptionalSVGSpaces(const CharacterType*& ptr, const CharacterType* end)
 {
-    skipWhile<CharacterType, isSVGSpace>(ptr, end);
+    skipWhile<isSVGSpace>(ptr, end);
     return ptr < end;
 }
 
 template<typename CharacterType> constexpr bool skipOptionalSVGSpaces(StringParsingBuffer<CharacterType>& characters)
 {
-    skipWhile<CharacterType, isSVGSpace>(characters);
+    skipWhile<isSVGSpace>(characters);
     return characters.hasCharactersRemaining();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to