Index: third_party/WebKit/Source/wtf/text/StringImpl.cpp |
diff --git a/third_party/WebKit/Source/wtf/text/StringImpl.cpp b/third_party/WebKit/Source/wtf/text/StringImpl.cpp |
index dc57cd4b9a4ac241a80b96ffce6bd457ab29b107..2c7cfb864790769934aa6a65ef4c31c1cdb3e5ae 100644 |
--- a/third_party/WebKit/Source/wtf/text/StringImpl.cpp |
+++ b/third_party/WebKit/Source/wtf/text/StringImpl.cpp |
@@ -897,6 +897,15 @@ PassRefPtr<StringImpl> StringImpl::foldCase() |
return newImpl.release(); |
} |
+PassRefPtr<StringImpl> StringImpl::truncate(unsigned length) |
+{ |
+ if (length >= m_length) |
+ return this; |
+ if (is8Bit()) |
+ return create(characters8(), length); |
+ return create(characters16(), length); |
+} |
+ |
template <class UCharPredicate> |
inline PassRefPtr<StringImpl> StringImpl::stripMatchedCharacters(UCharPredicate predicate) |
{ |