+2018-11-14 Christopher Reid <chris.reid@sony.com>
+
+ [WPE] Remove glib usage in PlatformKeyboardEventWPE.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=191606
+
+ Reviewed by Michael Catanzaro.
+
+ No behavior change.
+
+ Use StringBuilder::append(UChar32) as a generic way to convert a uint32_t code point to WTFString.
+
+ * platform/wpe/PlatformKeyboardEventWPE.cpp:
+ (WebCore::PlatformKeyboardEvent::keyValueForWPEKeyCode):
+ (WebCore::PlatformKeyboardEvent::singleCharacterString):
+
2018-11-13 Zalan Bujtas <zalan@apple.com>
[LFC][IFC] Construct dedicated runs when the inline element requires it (part 2)
#include "WindowsKeyboardCodes.h"
#include <wpe/wpe.h>
-#include <wtf/glib/GUniquePtr.h>
+#include <wtf/text/StringBuilder.h>
namespace WebCore {
break;
}
- guint32 unicodeCharacter = wpe_key_code_to_unicode(keyCode);
- if (unicodeCharacter) {
- // UTF-8 will use up to 6 bytes.
- char utf8[7] = { 0 };
- g_unichar_to_utf8(unicodeCharacter, utf8);
- return String::fromUTF8(utf8);
+ UChar32 unicodeCharacter = wpe_key_code_to_unicode(keyCode);
+ if (unicodeCharacter && U_IS_UNICODE_CHAR(unicodeCharacter)) {
+ StringBuilder builder;
+ builder.append(unicodeCharacter);
+ return builder.toString();
}
return "Unidentified"_s;
break;
}
- gunichar c = wpe_key_code_to_unicode(val);
- glong length;
- GUniquePtr<gunichar2> uchar16(g_ucs4_to_utf16(&c, 1, nullptr, &length, nullptr));
- if (uchar16)
- return String(reinterpret_cast<UChar*>(uchar16.get()), length);
+ UChar32 unicodeCharacter = wpe_key_code_to_unicode(val);
+ if (unicodeCharacter && U_IS_UNICODE_CHAR(unicodeCharacter)) {
+ StringBuilder builder;
+ builder.append(unicodeCharacter);
+ return builder.toString();
+ }
return { };
}