Index: Source/core/html/parser/HTMLParserIdioms.h |
diff --git a/Source/core/html/parser/HTMLParserIdioms.h b/Source/core/html/parser/HTMLParserIdioms.h |
index 903ca5a37cd3a19b3e93bb5ef9dddd212368ff2b..16fd3eebe3cb808dd0252c35a69add4e9e9fb905 100644 |
--- a/Source/core/html/parser/HTMLParserIdioms.h |
+++ b/Source/core/html/parser/HTMLParserIdioms.h |
@@ -26,7 +26,6 @@ |
#define HTMLParserIdioms_h |
#include "core/dom/QualifiedName.h" |
-#include "core/html/parser/HTMLIdentifier.h" |
#include "platform/Decimal.h" |
#include "wtf/Forward.h" |
#include "wtf/text/WTFString.h" |
@@ -98,15 +97,31 @@ inline bool isNotHTMLSpace(CharType character) |
} |
bool threadSafeMatch(const QualifiedName&, const QualifiedName&); |
-bool threadSafeMatch(const HTMLIdentifier&, const QualifiedName&); |
-inline bool threadSafeHTMLNamesMatch(const HTMLIdentifier& tagName, const QualifiedName& qName) |
+bool threadSafeMatch(const String&, const QualifiedName&); |
+ |
+StringImpl* findStringIfStatic(const UChar* characters, unsigned length); |
+ |
+enum CharacterWidth { |
+ Likely8Bit, |
+ Force8Bit, |
+ Force16Bit |
+}; |
+ |
+template<size_t inlineCapacity> |
+static String attemptStaticStringCreation(const Vector<UChar, inlineCapacity>& vector, CharacterWidth width) |
{ |
- // When the QualifiedName is known to HTMLIdentifier, |
- // all we have to do is a pointer compare. |
- ASSERT(HTMLIdentifier::isKnown(qName.localName().impl())); |
- return tagName.asStringImpl() == qName.localName().impl(); |
+ String string(findStringIfStatic(vector.data(), vector.size())); |
+ if (string.impl()) |
+ return string; |
+ if (width == Likely8Bit) |
+ string = StringImpl::create8BitIfPossible(vector); |
+ else if (width == Force8Bit) |
+ string = String::make8BitFrom16BitSource(vector); |
+ else |
+ string = String(vector); |
+ |
+ return string; |
} |
} |
- |
#endif |