Chromium Code Reviews| Index: Source/core/platform/chromium/support/WebString.cpp |
| diff --git a/Source/core/platform/chromium/support/WebString.cpp b/Source/core/platform/chromium/support/WebString.cpp |
| index 4b5dd6b5150a70ab631a9f766e4d8746c1b78cb3..be8151cf06fb2b462d1e23aa994cbe04942e20b8 100644 |
| --- a/Source/core/platform/chromium/support/WebString.cpp |
| +++ b/Source/core/platform/chromium/support/WebString.cpp |
| @@ -96,6 +96,22 @@ WebString WebString::fromUTF8(const char* data) |
| return WTF::String::fromUTF8(data); |
| } |
| +std::string WebString::latin1() const |
| +{ |
| + String string(m_private.get()); |
| + |
| + if (string.is8Bit()) |
|
abarth-chromium
2013/09/03 15:46:40
You need to handle the isEmpty() case as well. Yo
davidben
2013/09/03 17:58:25
Done.
|
| + return std::string(reinterpret_cast<const char*>(string.characters8()), string.length()); |
| + |
| + WebCString latin1 = string.latin1(); |
| + return std::string(latin1.data(), latin1.length()); |
| +} |
| + |
| +WebString WebString::fromLatin1(const char* data, size_t length) |
| +{ |
| + return String(data, length); |
| +} |
| + |
| bool WebString::equals(const WebString& s) const |
| { |
| return equal(m_private.get(), s.m_private.get()); |