Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(857)

Unified Diff: Source/core/platform/chromium/support/WebString.cpp

Issue 23456013: Expose latin1 methods in WebString (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/TestExpectations ('k') | public/platform/WebString.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c3ed5dba29a6de0e81f86a05d92697ea437d9e5f 100644
--- a/Source/core/platform/chromium/support/WebString.cpp
+++ b/Source/core/platform/chromium/support/WebString.cpp
@@ -88,12 +88,31 @@ std::string WebString::utf8() const
WebString WebString::fromUTF8(const char* data, size_t length)
{
- return WTF::String::fromUTF8(data, length);
+ return String::fromUTF8(data, length);
}
WebString WebString::fromUTF8(const char* data)
{
- return WTF::String::fromUTF8(data);
+ return String::fromUTF8(data);
+}
+
+std::string WebString::latin1() const
+{
+ String string(m_private.get());
+
+ if (string.isEmpty())
+ return std::string();
+
+ if (string.is8Bit())
+ 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 WebLChar* data, size_t length)
+{
+ return String(data, length);
}
bool WebString::equals(const WebString& s) const
« no previous file with comments | « LayoutTests/TestExpectations ('k') | public/platform/WebString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698