Index: Source/core/html/parser/HTMLParserIdioms.h |
diff --git a/Source/core/html/parser/HTMLParserIdioms.h b/Source/core/html/parser/HTMLParserIdioms.h |
index 49dbed3ba6c6639e80eff7daa5847e36dc3b8b1c..a128d4fb876cca424259c1c157873cf9d11b1fce 100644 |
--- a/Source/core/html/parser/HTMLParserIdioms.h |
+++ b/Source/core/html/parser/HTMLParserIdioms.h |
@@ -115,21 +115,33 @@ enum CharacterWidth { |
Force16Bit |
}; |
-template<size_t inlineCapacity> |
-static String attemptStaticStringCreation(const Vector<UChar, inlineCapacity>& vector, CharacterWidth width) |
+inline static String attemptStaticStringCreation(const UChar* characters, size_t size, CharacterWidth width) |
{ |
- String string(findStringIfStatic(vector.data(), vector.size())); |
+ String string(findStringIfStatic(characters, size)); |
if (string.impl()) |
return string; |
if (width == Likely8Bit) |
- string = StringImpl::create8BitIfPossible(vector); |
+ string = StringImpl::create8BitIfPossible(characters, size); |
else if (width == Force8Bit) |
- string = String::make8BitFrom16BitSource(vector); |
+ string = String::make8BitFrom16BitSource(characters, size); |
else |
- string = String(vector); |
+ string = String(characters, size); |
return string; |
} |
+template<size_t inlineCapacity> |
+static String attemptStaticStringCreation(const Vector<UChar, inlineCapacity>& vector, CharacterWidth width) |
+{ |
+ return attemptStaticStringCreation(vector.data(), vector.size(), width); |
+} |
+ |
+inline static String attemptStaticStringCreation(const String str, CharacterWidth width) |
+{ |
+ ASSERT(!str.is8Bit()); |
+ return attemptStaticStringCreation(str.characters16(), str.length(), width); |
+} |
+ |
+ |
} |
#endif |