Split cryptographic digest computation and parsing out of CSP code so it can be reused
[WebKit-https.git] / Source / WebCore / html / parser / ParsingUtilities.h
index a70d312..a56cc25 100644 (file)
@@ -30,6 +30,8 @@
 
 #pragma once
 
+#include <wtf/text/StringCommon.h>
+
 namespace WebCore {
 
 template<typename CharType>
@@ -80,4 +82,16 @@ void reverseSkipWhile(const CharType*& position, const CharType* start)
         --position;
 }
 
+template<typename CharacterType, unsigned lowercaseLettersLength>
+bool skipExactlyIgnoringASCIICase(const CharacterType*& position, const CharacterType* end, const char (&lowercaseLetters)[lowercaseLettersLength])
+{
+    if (position + lowercaseLettersLength > end)
+        return false;
+
+    bool result = WTF::equalLettersIgnoringASCIICase(position, lowercaseLettersLength - 1, lowercaseLetters);
+    if (result)
+        position += (lowercaseLettersLength - 1);
+    return result;
+}
+
 } // namespace WebCore