Changeset 265129 in webkit
- Timestamp:
- Jul 30, 2020 8:44:09 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r265126 r265129 1 2020-07-30 Sam Weinig <weinig@apple.com> 2 3 It would be nice if the predicate taking functions in ParsingUtilities.h didn't require specifying the character type 4 https://bugs.webkit.org/show_bug.cgi?id=215002 5 6 Reviewed by Darin Adler. 7 8 Remove the need for specifying the character type by providing overloads for LChar and UChar 9 explicitly. 10 11 * html/parser/HTMLSrcsetParser.cpp: 12 (WebCore::parseImageCandidatesFromSrcsetAttribute): 13 * html/parser/ParsingUtilities.h: 14 (WebCore::characterPredicate): 15 * html/track/VTTScanner.h: 16 (WebCore::characterPredicate): 17 * loader/LinkHeader.cpp: 18 (WebCore::findURLBoundaries): 19 (WebCore::invalidParameterDelimiter): 20 (WebCore::parseParameterDelimiter): 21 (WebCore::parseParameterName): 22 (WebCore::skipQuotesIfNeeded): 23 (WebCore::parseParameterValue): 24 (WebCore::findNextHeader): 25 * loader/ResourceCryptographicDigest.cpp: 26 (WebCore::parseCryptographicDigestImpl): 27 (WebCore::parseEncodedCryptographicDigestImpl): 28 * loader/SubresourceIntegrity.cpp: 29 (WebCore::splitOnSpaces): 30 * loader/appcache/ApplicationCacheManifestParser.cpp: 31 (WebCore::parseApplicationCacheManifest): 32 * page/csp/ContentSecurityPolicyDirectiveList.cpp: 33 (WebCore::ContentSecurityPolicyDirectiveList::parseDirective): 34 (WebCore::ContentSecurityPolicyDirectiveList::parseReportURI): 35 * page/csp/ContentSecurityPolicyMediaListDirective.cpp: 36 (WebCore::ContentSecurityPolicyMediaListDirective::parse): 37 * page/csp/ContentSecurityPolicySourceList.cpp: 38 (WebCore::isSourceListNone): 39 (WebCore::ContentSecurityPolicySourceList::parse): 40 (WebCore::ContentSecurityPolicySourceList::parseSource): 41 (WebCore::ContentSecurityPolicySourceList::parseScheme): 42 (WebCore::ContentSecurityPolicySourceList::parseHost): 43 (WebCore::ContentSecurityPolicySourceList::parsePath): 44 (WebCore::ContentSecurityPolicySourceList::parsePort): 45 (WebCore::ContentSecurityPolicySourceList::parseNonceSource): 46 * platform/DateComponents.cpp: 47 (WebCore::countDigits): 48 * svg/SVGLengthList.cpp: 49 (WebCore::SVGLengthList::parse): 50 * svg/SVGParserUtilities.cpp: 51 (WebCore::genericParseNumber): 52 * svg/SVGParserUtilities.h: 53 (WebCore::skipOptionalSVGSpaces): 54 1 55 2020-07-30 Sam Weinig <weinig@apple.com> 2 56 -
trunk/Source/WebCore/html/parser/HTMLSrcsetParser.cpp
r246490 r265129 171 171 for (const CharType* position = attributeStart; position < attributeEnd;) { 172 172 // 4. Splitting loop: Collect a sequence of characters that are space characters or U+002C COMMA characters. 173 skipWhile< CharType, isHTMLSpaceOrComma<CharType>>(position, attributeEnd);173 skipWhile<isHTMLSpaceOrComma>(position, attributeEnd); 174 174 if (position == attributeEnd) { 175 175 // Contrary to spec language - descriptor parsing happens on each candidate, so when we reach the attributeEnd, we can exit. … … 179 179 // 6. Collect a sequence of characters that are not space characters, and let that be url. 180 180 181 skipUntil< CharType, isHTMLSpace<CharType>>(position, attributeEnd);181 skipUntil<isHTMLSpace>(position, attributeEnd); 182 182 const CharType* imageURLEnd = position; 183 183 … … 188 188 // Remove all trailing U+002C COMMA characters from url. 189 189 imageURLEnd = position - 1; 190 reverseSkipWhile< CharType,isComma>(imageURLEnd, imageURLStart);190 reverseSkipWhile<isComma>(imageURLEnd, imageURLStart); 191 191 ++imageURLEnd; 192 192 // If url is empty, then jump to the step labeled splitting loop. … … 194 194 continue; 195 195 } else { 196 skipWhile< CharType, isHTMLSpace<CharType>>(position, attributeEnd);196 skipWhile<isHTMLSpace>(position, attributeEnd); 197 197 Vector<StringView> descriptorTokens; 198 198 tokenizeDescriptors(position, attributeEnd, descriptorTokens); -
trunk/Source/WebCore/html/parser/ParsingUtilities.h
r263916 r265129 1 1 /* 2 2 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2020 Apple Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 31 32 #pragma once 32 33 33 #include <wtf/Forward.h>34 34 #include <wtf/text/StringCommon.h> 35 #include <wtf/text/StringParsingBuffer.h> 35 36 36 37 namespace WebCore { … … 59 60 } 60 61 61 template< typename CharacterType, bool characterPredicate(CharacterType)> bool skipExactly(const CharacterType*& position, const CharacterType* end)62 template<bool characterPredicate(LChar)> bool skipExactly(const LChar*& position, const LChar* end) 62 63 { 63 64 if (position < end && characterPredicate(*position)) { … … 68 69 } 69 70 70 template<typename CharacterType, bool characterPredicate(CharacterType)> bool skipExactly(StringParsingBuffer<CharacterType>& buffer) 71 template<bool characterPredicate(UChar)> bool skipExactly(const UChar*& position, const UChar* end) 72 { 73 if (position < end && characterPredicate(*position)) { 74 ++position; 75 return true; 76 } 77 return false; 78 } 79 80 template<bool characterPredicate(LChar)> bool skipExactly(StringParsingBuffer<LChar>& buffer) 71 81 { 72 82 if (buffer.hasCharactersRemaining() && characterPredicate(*buffer)) { … … 77 87 } 78 88 89 template<bool characterPredicate(UChar)> bool skipExactly(StringParsingBuffer<UChar>& buffer) 90 { 91 if (buffer.hasCharactersRemaining() && characterPredicate(*buffer)) { 92 ++buffer; 93 return true; 94 } 95 return false; 96 } 97 79 98 template<typename CharacterType, typename DelimiterType> void skipUntil(const CharacterType*& position, const CharacterType* end, DelimiterType delimiter) 80 99 { … … 89 108 } 90 109 91 template< typename CharacterType, bool characterPredicate(CharacterType)> void skipUntil(const CharacterType*& position, const CharacterType* end)110 template<bool characterPredicate(LChar)> void skipUntil(const LChar*& position, const LChar* end) 92 111 { 93 112 while (position < end && !characterPredicate(*position)) … … 95 114 } 96 115 97 template<typename CharacterType, bool characterPredicate(CharacterType)> void skipUntil(StringParsingBuffer<CharacterType>& buffer) 116 template<bool characterPredicate(UChar)> void skipUntil(const UChar*& position, const UChar* end) 117 { 118 while (position < end && !characterPredicate(*position)) 119 ++position; 120 } 121 122 template<bool characterPredicate(LChar)> void skipUntil(StringParsingBuffer<LChar>& buffer) 98 123 { 99 124 while (buffer.hasCharactersRemaining() && !characterPredicate(*buffer)) … … 101 126 } 102 127 103 template<typename CharacterType, bool characterPredicate(CharacterType)> void skipWhile(const CharacterType*& position, const CharacterType* end) 128 template<bool characterPredicate(UChar)> void skipUntil(StringParsingBuffer<UChar>& buffer) 129 { 130 while (buffer.hasCharactersRemaining() && !characterPredicate(*buffer)) 131 ++buffer; 132 } 133 134 template<bool characterPredicate(LChar)> void skipWhile(const LChar*& position, const LChar* end) 104 135 { 105 136 while (position < end && characterPredicate(*position)) … … 107 138 } 108 139 109 template<typename CharacterType, bool characterPredicate(CharacterType)> void skipWhile(StringParsingBuffer<CharacterType>& buffer) 140 template<bool characterPredicate(UChar)> void skipWhile(const UChar*& position, const UChar* end) 141 { 142 while (position < end && characterPredicate(*position)) 143 ++position; 144 } 145 146 template<bool characterPredicate(LChar)> void skipWhile(StringParsingBuffer<LChar>& buffer) 110 147 { 111 148 while (buffer.hasCharactersRemaining() && characterPredicate(*buffer)) … … 113 150 } 114 151 115 template<typename CharacterType, bool characterPredicate(CharacterType)> void reverseSkipWhile(const CharacterType*& position, const CharacterType* start) 152 template<bool characterPredicate(UChar)> void skipWhile(StringParsingBuffer<UChar>& buffer) 153 { 154 while (buffer.hasCharactersRemaining() && characterPredicate(*buffer)) 155 ++buffer; 156 } 157 158 159 template<bool characterPredicate(LChar)> void reverseSkipWhile(const LChar*& position, const LChar* start) 160 { 161 while (position >= start && characterPredicate(*position)) 162 --position; 163 } 164 165 template<bool characterPredicate(UChar)> void reverseSkipWhile(const UChar*& position, const UChar* start) 116 166 { 117 167 while (position >= start && characterPredicate(*position)) -
trunk/Source/WebCore/html/track/VTTScanner.h
r208179 r265129 167 167 { 168 168 if (m_is8Bit) 169 WebCore::skipWhile<LChar , LCharPredicateAdapter<characterPredicate> >(m_data.characters8, m_end.characters8);169 WebCore::skipWhile<LCharPredicateAdapter<characterPredicate> >(m_data.characters8, m_end.characters8); 170 170 else 171 WebCore::skipWhile< UChar,characterPredicate>(m_data.characters16, m_end.characters16);171 WebCore::skipWhile<characterPredicate>(m_data.characters16, m_end.characters16); 172 172 } 173 173 … … 176 176 { 177 177 if (m_is8Bit) 178 WebCore::skipUntil<LChar , LCharPredicateAdapter<characterPredicate> >(m_data.characters8, m_end.characters8);178 WebCore::skipUntil<LCharPredicateAdapter<characterPredicate> >(m_data.characters8, m_end.characters8); 179 179 else 180 WebCore::skipUntil< UChar,characterPredicate>(m_data.characters16, m_end.characters16);180 WebCore::skipUntil<characterPredicate>(m_data.characters16, m_end.characters16); 181 181 } 182 182 … … 186 186 if (m_is8Bit) { 187 187 const LChar* current = m_data.characters8; 188 WebCore::skipWhile<LChar , LCharPredicateAdapter<characterPredicate>>(current, m_end.characters8);188 WebCore::skipWhile<LCharPredicateAdapter<characterPredicate>>(current, m_end.characters8); 189 189 return Run(position(), current, m_is8Bit); 190 190 } 191 191 const UChar* current = m_data.characters16; 192 WebCore::skipWhile< UChar,characterPredicate>(current, m_end.characters16);192 WebCore::skipWhile<characterPredicate>(current, m_end.characters16); 193 193 return Run(position(), reinterpret_cast<Position>(current), m_is8Bit); 194 194 } … … 199 199 if (m_is8Bit) { 200 200 const LChar* current = m_data.characters8; 201 WebCore::skipUntil<LChar , LCharPredicateAdapter<characterPredicate> >(current, m_end.characters8);201 WebCore::skipUntil<LCharPredicateAdapter<characterPredicate> >(current, m_end.characters8); 202 202 return Run(position(), current, m_is8Bit); 203 203 } 204 204 const UChar* current = m_data.characters16; 205 WebCore::skipUntil< UChar,characterPredicate>(current, m_end.characters16);205 WebCore::skipUntil<characterPredicate>(current, m_end.characters16); 206 206 return Run(position(), reinterpret_cast<Position>(current), m_is8Bit); 207 207 } -
trunk/Source/WebCore/loader/LinkHeader.cpp
r246045 r265129 90 90 { 91 91 ASSERT(position <= end); 92 skipWhile< CharacterType,isSpaceOrTab>(position, end);93 if (!skipExactly <CharacterType>(position, end, '<'))92 skipWhile<isSpaceOrTab>(position, end); 93 if (!skipExactly(position, end, '<')) 94 94 return WTF::nullopt; 95 skipWhile< CharacterType,isSpaceOrTab>(position, end);95 skipWhile<isSpaceOrTab>(position, end); 96 96 97 97 CharacterType* urlStart = position; 98 skipWhile< CharacterType,isNotURLTerminatingChar>(position, end);98 skipWhile<isNotURLTerminatingChar>(position, end); 99 99 CharacterType* urlEnd = position; 100 skipUntil <CharacterType>(position, end, '>');101 if (!skipExactly <CharacterType>(position, end, '>'))100 skipUntil(position, end, '>'); 101 if (!skipExactly(position, end, '>')) 102 102 return WTF::nullopt; 103 103 … … 109 109 { 110 110 ASSERT(position <= end); 111 return (!skipExactly <CharacterType>(position, end, ';') && (position < end) && (*position != ','));111 return (!skipExactly(position, end, ';') && (position < end) && (*position != ',')); 112 112 } 113 113 … … 135 135 ASSERT(position <= end); 136 136 isValid = true; 137 skipWhile< CharacterType,isSpaceOrTab>(position, end);137 skipWhile<isSpaceOrTab>(position, end); 138 138 if (invalidParameterDelimiter(position, end)) { 139 139 isValid = false; 140 140 return false; 141 141 } 142 skipWhile< CharacterType,isSpaceOrTab>(position, end);142 skipWhile<isSpaceOrTab>(position, end); 143 143 if (validFieldEnd(position, end)) 144 144 return false; … … 189 189 ASSERT(position <= end); 190 190 CharacterType* nameStart = position; 191 skipWhile< CharacterType,isValidParameterNameChar>(position, end);191 skipWhile<isValidParameterNameChar>(position, end); 192 192 CharacterType* nameEnd = position; 193 skipWhile< CharacterType,isSpaceOrTab>(position, end);194 bool hasEqual = skipExactly <CharacterType>(position, end, '=');195 skipWhile< CharacterType,isSpaceOrTab>(position, end);193 skipWhile<isSpaceOrTab>(position, end); 194 bool hasEqual = skipExactly(position, end, '='); 195 skipWhile<isSpaceOrTab>(position, end); 196 196 name = paramterNameFromString(String(nameStart, nameEnd - nameStart)); 197 197 if (hasEqual) … … 217 217 ASSERT(position <= end); 218 218 unsigned char quote; 219 if (skipExactly <CharacterType>(position, end, '\''))219 if (skipExactly(position, end, '\'')) 220 220 quote = '\''; 221 else if (skipExactly <CharacterType>(position, end, '"'))221 else if (skipExactly(position, end, '"')) 222 222 quote = '"'; 223 223 else … … 253 253 bool hasQuotes = skipQuotesIfNeeded(position, end, completeQuotes); 254 254 if (!hasQuotes) 255 skipWhile< CharacterType,isParameterValueChar>(position, end);255 skipWhile<isParameterValueChar>(position, end); 256 256 valueEnd = position; 257 skipWhile< CharacterType,isSpaceOrTab>(position, end);257 skipWhile<isSpaceOrTab>(position, end); 258 258 if ((!completeQuotes && valueStart == valueEnd) || (position != end && !isParameterValueEnd(*position))) { 259 259 value = emptyString(); … … 311 311 { 312 312 ASSERT(position <= end); 313 skipUntil <CharacterType>(position, end, ',');314 skipExactly <CharacterType>(position, end, ',');313 skipUntil(position, end, ','); 314 skipExactly(position, end, ','); 315 315 } 316 316 -
trunk/Source/WebCore/loader/ResourceCryptographicDigest.cpp
r263581 r265129 63 63 64 64 auto beginHashValue = buffer.position(); 65 skipWhile< CharacterType,isBase64OrBase64URLCharacter>(buffer);65 skipWhile<isBase64OrBase64URLCharacter>(buffer); 66 66 skipExactly(buffer, '='); 67 67 skipExactly(buffer, '='); … … 103 103 104 104 auto beginHashValue = buffer.position(); 105 skipWhile< CharacterType,isBase64OrBase64URLCharacter>(buffer);105 skipWhile<isBase64OrBase64URLCharacter>(buffer); 106 106 skipExactly(buffer, '='); 107 107 skipExactly(buffer, '='); -
trunk/Source/WebCore/loader/SubresourceIntegrity.cpp
r263581 r265129 68 68 // them. Their syntax is a '?' follow by any number of VCHARs. 69 69 if (skipExactly(buffer, '?')) 70 skipWhile< CharacterType,isVCHAR>(buffer);70 skipWhile<isVCHAR>(buffer); 71 71 72 72 // After the base64 value and options, the current character pointed to by position … … 88 88 static inline void splitOnSpaces(StringParsingBuffer<CharacterType> buffer, Functor&& functor) 89 89 { 90 skipWhile< CharacterType,isHTMLSpace>(buffer);90 skipWhile<isHTMLSpace>(buffer); 91 91 92 92 while (buffer.hasCharactersRemaining()) { 93 93 if (!functor(buffer)) 94 skipWhile< CharacterType,isNotHTMLSpace>(buffer);95 skipWhile< CharacterType,isHTMLSpace>(buffer);94 skipWhile<isNotHTMLSpace>(buffer); 95 skipWhile<isHTMLSpace>(buffer); 96 96 } 97 97 } -
trunk/Source/WebCore/loader/appcache/ApplicationCacheManifestParser.cpp
r263908 r265129 97 97 98 98 // Skip to the end of the line. 99 skipUntil< CharacterType,isManifestNewline>(buffer);99 skipUntil<isManifestNewline>(buffer); 100 100 101 101 while (1) { 102 102 // Skip whitespace 103 skipWhile< CharacterType,isManifestWhitespaceOrNewline>(buffer);103 skipWhile<isManifestWhitespaceOrNewline>(buffer); 104 104 105 105 if (buffer.atEnd()) … … 109 109 110 110 // Find the end of the line 111 skipUntil< CharacterType,isManifestNewline>(buffer);111 skipUntil<isManifestNewline>(buffer); 112 112 113 113 // Line is a comment, skip to the next line. … … 148 148 case ApplicationCacheParserMode::Explicit: { 149 149 // Look for whitespace separating the URL from subsequent ignored tokens. 150 skipUntil< CharacterType,isManifestWhitespace>(lineBuffer);150 skipUntil<isManifestWhitespace>(lineBuffer); 151 151 152 152 auto url = makeManifestURL(manifestURL, lineStart, lineBuffer.position()); … … 166 166 case ApplicationCacheParserMode::OnlineAllowlist: { 167 167 // Look for whitespace separating the URL from subsequent ignored tokens. 168 skipUntil< CharacterType,isManifestWhitespace>(lineBuffer);168 skipUntil<isManifestWhitespace>(lineBuffer); 169 169 170 170 if (lineBuffer.position() - lineStart == 1 && *lineStart == '*') { … … 187 187 case ApplicationCacheParserMode::Fallback: { 188 188 // Look for whitespace separating the two URLs 189 skipUntil< CharacterType,isManifestWhitespace>(lineBuffer);189 skipUntil<isManifestWhitespace>(lineBuffer); 190 190 191 191 if (lineBuffer.atEnd()) { … … 208 208 209 209 // Skip whitespace separating fallback namespace from URL. 210 skipWhile< CharacterType,isManifestWhitespace>(lineBuffer);210 skipWhile<isManifestWhitespace>(lineBuffer); 211 211 212 212 auto fallbackStart = lineBuffer.position(); 213 213 214 214 // Look for whitespace separating the URL from subsequent ignored tokens. 215 skipUntil< CharacterType,isManifestWhitespace>(lineBuffer);215 skipUntil<isManifestWhitespace>(lineBuffer); 216 216 217 217 auto fallbackURL = makeManifestURL(manifestURL, fallbackStart, lineBuffer.position()); -
trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp
r263581 r265129 372 372 template<typename CharacterType> auto ContentSecurityPolicyDirectiveList::parseDirective(StringParsingBuffer<CharacterType> buffer) -> Optional<ParsedDirective> 373 373 { 374 skipWhile< CharacterType,isASCIISpace>(buffer);374 skipWhile<isASCIISpace>(buffer); 375 375 376 376 // Empty directive (e.g. ";;;"). Exit early. … … 379 379 380 380 auto nameBegin = buffer.position(); 381 skipWhile< CharacterType,isDirectiveNameCharacter>(buffer);381 skipWhile<isDirectiveNameCharacter>(buffer); 382 382 383 383 // The directive-name must be non-empty. 384 384 if (nameBegin == buffer.position()) { 385 skipWhile< CharacterType,isNotASCIISpace>(buffer);385 skipWhile<isNotASCIISpace>(buffer); 386 386 m_policy.reportUnsupportedDirective(String(nameBegin, buffer.position() - nameBegin)); 387 387 return WTF::nullopt; … … 393 393 return ParsedDirective { WTFMove(name), { } }; 394 394 395 if (!skipExactly< CharacterType,isASCIISpace>(buffer)) {396 skipWhile< CharacterType,isNotASCIISpace>(buffer);395 if (!skipExactly<isASCIISpace>(buffer)) { 396 skipWhile<isNotASCIISpace>(buffer); 397 397 m_policy.reportUnsupportedDirective(String(nameBegin, buffer.position() - nameBegin)); 398 398 return WTF::nullopt; 399 399 } 400 400 401 skipWhile< CharacterType,isASCIISpace>(buffer);401 skipWhile<isASCIISpace>(buffer); 402 402 403 403 auto valueBegin = buffer.position(); 404 skipWhile< CharacterType,isDirectiveValueCharacter>(buffer);404 skipWhile<isDirectiveValueCharacter>(buffer); 405 405 406 406 if (!buffer.atEnd()) { … … 425 425 426 426 readCharactersForParsing(directive.value, [&](auto buffer) { 427 using CharacterType = typename decltype(buffer)::CharacterType;428 429 427 auto begin = buffer.position(); 430 428 while (buffer.hasCharactersRemaining()) { 431 skipWhile< CharacterType,isASCIISpace>(buffer);429 skipWhile<isASCIISpace>(buffer); 432 430 433 431 auto urlBegin = buffer.position(); 434 skipWhile< CharacterType,isNotASCIISpace>(buffer);432 skipWhile<isNotASCIISpace>(buffer); 435 433 436 434 if (urlBegin < buffer.position()) -
trunk/Source/WebCore/page/csp/ContentSecurityPolicyMediaListDirective.cpp
r263581 r265129 61 61 62 62 readCharactersForParsing(value, [&](auto buffer) { 63 using CharacterType = typename decltype(buffer)::CharacterType;64 65 63 while (buffer.hasCharactersRemaining()) { 66 64 // _____ OR _____mime1/mime1 67 65 // ^ ^ 68 skipWhile< CharacterType,isASCIISpace>(buffer);66 skipWhile<isASCIISpace>(buffer); 69 67 if (buffer.atEnd()) 70 68 return; … … 73 71 // ^ 74 72 auto begin = buffer.position(); 75 if (!skipExactly< CharacterType,isMediaTypeCharacter>(buffer)) {76 skipWhile< CharacterType,isNotASCIISpace>(buffer);73 if (!skipExactly<isMediaTypeCharacter>(buffer)) { 74 skipWhile<isNotASCIISpace>(buffer); 77 75 directiveList().policy().reportInvalidPluginTypes(String(begin, buffer.position() - begin)); 78 76 continue; 79 77 } 80 skipWhile< CharacterType,isMediaTypeCharacter>(buffer);78 skipWhile<isMediaTypeCharacter>(buffer); 81 79 82 80 // mime1/mime1 mime2/mime2 83 81 // ^ 84 82 if (!skipExactly(buffer, '/')) { 85 skipWhile< CharacterType,isNotASCIISpace>(buffer);83 skipWhile<isNotASCIISpace>(buffer); 86 84 directiveList().policy().reportInvalidPluginTypes(String(begin, buffer.position() - begin)); 87 85 continue; … … 90 88 // mime1/mime1 mime2/mime2 91 89 // ^ 92 if (!skipExactly< CharacterType,isMediaTypeCharacter>(buffer)) {93 skipWhile< CharacterType,isNotASCIISpace>(buffer);90 if (!skipExactly<isMediaTypeCharacter>(buffer)) { 91 skipWhile<isNotASCIISpace>(buffer); 94 92 directiveList().policy().reportInvalidPluginTypes(String(begin, buffer.position() - begin)); 95 93 continue; 96 94 } 97 skipWhile< CharacterType,isMediaTypeCharacter>(buffer);95 skipWhile<isMediaTypeCharacter>(buffer); 98 96 99 97 // mime1/mime1 mime2/mime2 OR mime1/mime1 OR mime1/mime1/error 100 98 // ^ ^ ^ 101 99 if (buffer.hasCharactersRemaining() && isNotASCIISpace(*buffer)) { 102 skipWhile< CharacterType,isNotASCIISpace>(buffer);100 skipWhile<isNotASCIISpace>(buffer); 103 101 directiveList().policy().reportInvalidPluginTypes(String(begin, buffer.position() - begin)); 104 102 continue; -
trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp
r263581 r265129 85 85 template<typename CharacterType> static bool isSourceListNone(StringParsingBuffer<CharacterType> buffer) 86 86 { 87 skipWhile< CharacterType,isASCIISpace>(buffer);87 skipWhile<isASCIISpace>(buffer); 88 88 89 89 if (!skipExactlyIgnoringASCIICase(buffer, "'none'")) 90 90 return false; 91 91 92 skipWhile< CharacterType,isASCIISpace>(buffer);92 skipWhile<isASCIISpace>(buffer); 93 93 94 94 return buffer.atEnd(); … … 160 160 { 161 161 while (buffer.hasCharactersRemaining()) { 162 skipWhile< CharacterType,isASCIISpace>(buffer);162 skipWhile<isASCIISpace>(buffer); 163 163 if (buffer.atEnd()) 164 164 return; 165 165 166 166 auto beginSource = buffer.position(); 167 skipWhile< CharacterType,isSourceCharacter>(buffer);167 skipWhile<isSourceCharacter>(buffer); 168 168 169 169 auto sourceBuffer = StringParsingBuffer { beginSource, buffer.position() }; … … 232 232 const CharacterType* beginPort = nullptr; 233 233 234 skipWhile< CharacterType,isNotColonOrSlash>(buffer);234 skipWhile<isNotColonOrSlash>(buffer); 235 235 236 236 if (buffer.atEnd()) { … … 288 288 289 289 beginHost = buffer.position(); 290 skipWhile< CharacterType,isNotColonOrSlash>(buffer);290 skipWhile<isNotColonOrSlash>(buffer); 291 291 } 292 292 … … 344 344 auto begin = buffer.position(); 345 345 346 if (!skipExactly< CharacterType,isASCIIAlpha>(buffer))347 return WTF::nullopt; 348 349 skipWhile< CharacterType,isSchemeContinuationCharacter>(buffer);346 if (!skipExactly<isASCIIAlpha>(buffer)) 347 return WTF::nullopt; 348 349 skipWhile<isSchemeContinuationCharacter>(buffer); 350 350 351 351 if (!buffer.atEnd()) … … 381 381 382 382 while (buffer.hasCharactersRemaining()) { 383 if (!skipExactly< CharacterType,isHostCharacter>(buffer))384 return WTF::nullopt; 385 386 skipWhile< CharacterType,isHostCharacter>(buffer);383 if (!skipExactly<isHostCharacter>(buffer)) 384 return WTF::nullopt; 385 386 skipWhile<isHostCharacter>(buffer); 387 387 388 388 if (buffer.hasCharactersRemaining() && !skipExactly(buffer, '.')) … … 400 400 401 401 auto begin = buffer.position(); 402 skipWhile< CharacterType,isPathComponentCharacter>(buffer);402 skipWhile<isPathComponentCharacter>(buffer); 403 403 // path/to/file.js?query=string || path/to/file.js#anchor 404 404 // ^ ^ … … 431 431 432 432 auto begin = buffer.position(); 433 skipWhile< CharacterType,isASCIIDigit>(buffer);433 skipWhile<isASCIIDigit>(buffer); 434 434 435 435 if (!buffer.atEnd()) … … 462 462 463 463 auto beginNonceValue = buffer.position(); 464 skipWhile< CharacterType,isNonceCharacter>(buffer);464 skipWhile<isNonceCharacter>(buffer); 465 465 if (buffer.atEnd() || buffer.position() == beginNonceValue || *buffer != '\'') 466 466 return false; -
trunk/Source/WebCore/platform/DateComponents.cpp
r265126 r265129 110 110 { 111 111 auto begin = buffer.position(); 112 skipWhile< CharacterType,isASCIIDigit>(buffer);112 skipWhile<isASCIIDigit>(buffer); 113 113 return buffer.position() - begin; 114 114 } -
trunk/Source/WebCore/svg/SVGLengthList.cpp
r263617 r265129 37 37 38 38 return readCharactersForParsing(value, [&](auto buffer) { 39 using CharacterType = typename decltype(buffer)::CharacterType;40 41 39 while (buffer.hasCharactersRemaining()) { 42 40 auto start = buffer.position(); 43 41 44 skipUntil< CharacterType,isSVGSpaceOrComma>(buffer);42 skipUntil<isSVGSpaceOrComma>(buffer); 45 43 46 44 if (buffer.position() == start) -
trunk/Source/WebCore/svg/SVGParserUtilities.cpp
r263617 r265129 69 69 70 70 // Advance to first non-digit. 71 skipWhile< CharacterType,isASCIIDigit>(buffer);71 skipWhile<isASCIIDigit>(buffer); 72 72 73 73 if (buffer.position() != ptrStartIntPart) { -
trunk/Source/WebCore/svg/SVGParserUtilities.h
r264533 r265129 71 71 template<typename CharacterType> constexpr bool skipOptionalSVGSpaces(const CharacterType*& ptr, const CharacterType* end) 72 72 { 73 skipWhile< CharacterType,isSVGSpace>(ptr, end);73 skipWhile<isSVGSpace>(ptr, end); 74 74 return ptr < end; 75 75 } … … 77 77 template<typename CharacterType> constexpr bool skipOptionalSVGSpaces(StringParsingBuffer<CharacterType>& characters) 78 78 { 79 skipWhile< CharacterType,isSVGSpace>(characters);79 skipWhile<isSVGSpace>(characters); 80 80 return characters.hasCharactersRemaining(); 81 81 }
Note: See TracChangeset
for help on using the changeset viewer.