summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2017-04-24 22:40:03 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2017-04-25 18:29:55 +0000
commit4bd713d56aa9bb86bc96ea9cb0c64cbf94bf43d4 (patch)
tree02bd448d49627f059df0d8036fbdb9d9ee883a50 /Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp
parentbd3f57b00bee3088971209a0ebc513eb1ef4ba14 (diff)
downloadqtwebkit-4bd713d56aa9bb86bc96ea9cb0c64cbf94bf43d4.tar.gz
Import WebKit commit 3040e0455efecd271f1aeef53cf287e75486a70d
Change-Id: I7df106cef8ce93ce33e49ad6fb0d202cd066d87c Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp')
-rw-r--r--Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp b/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp
index 4ae448e62..6fad021f6 100644
--- a/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp
+++ b/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp
@@ -39,8 +39,13 @@ QString WKStringCopyQString(WKStringRef stringRef)
{
if (!stringRef)
return QString();
- const WTF::String& string = toImpl(stringRef)->string();
- return QString(reinterpret_cast<const QChar*>(string.characters()), string.length());
+
+ auto stringView = toImpl(stringRef)->stringView();
+
+ if (stringView.is8Bit())
+ return QString::fromLatin1(reinterpret_cast<const char*>(stringView.characters8()), stringView.length());
+
+ return QString(reinterpret_cast<const QChar*>(stringView.characters16()), stringView.length());
}
namespace WebKit {