Chromium Code Reviews| 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..c113f58a7d4c1112324db04371e02fc9497cf91d 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* findAtomizedStringIfKnown(const UChar* characters, unsigned length); |
|
abarth-chromium
2013/12/10 04:48:23
findAtomizedStringIfKnown -> findStringIfStatic
oystein (OOO til 10th of July)
2013/12/10 18:42:27
Done.
|
| + |
| +enum CharacterWidth { |
| + Likely8Bit, |
| + Force8Bit, |
| + Force16Bit |
| +}; |
| + |
| +template<size_t inlineCapacity> |
| +static String createAtomizedString(const Vector<UChar, inlineCapacity>& vector, CharacterWidth width) |
|
abarth-chromium
2013/12/10 04:48:23
createAtomizedString isn't a great name because it
oystein (OOO til 10th of July)
2013/12/10 18:42:27
attemptStaticStringCreation?
|
| { |
| - // 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(findAtomizedStringIfKnown(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 |