Changeset 238175 in webkit


Ignore:
Timestamp:
Nov 14, 2018 8:13:06 AM (5 years ago)
Author:
chris.reid@sony.com
Message:

[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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r238173 r238175  
     12018-11-14  Christopher Reid  <chris.reid@sony.com>
     2
     3        [WPE] Remove glib usage in PlatformKeyboardEventWPE.cpp
     4        https://bugs.webkit.org/show_bug.cgi?id=191606
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        No behavior change.
     9
     10        Use StringBuilder::append(UChar32) as a generic way to convert a uint32_t code point to WTFString.
     11
     12        * platform/wpe/PlatformKeyboardEventWPE.cpp:
     13        (WebCore::PlatformKeyboardEvent::keyValueForWPEKeyCode):
     14        (WebCore::PlatformKeyboardEvent::singleCharacterString):
     15
    1162018-11-13  Zalan Bujtas  <zalan@apple.com>
    217
  • trunk/Source/WebCore/platform/wpe/PlatformKeyboardEventWPE.cpp

    r234645 r238175  
    2929#include "WindowsKeyboardCodes.h"
    3030#include <wpe/wpe.h>
    31 #include <wtf/glib/GUniquePtr.h>
     31#include <wtf/text/StringBuilder.h>
    3232
    3333namespace WebCore {
     
    427427    }
    428428
    429     guint32 unicodeCharacter = wpe_key_code_to_unicode(keyCode);
    430     if (unicodeCharacter) {
    431         // UTF-8 will use up to 6 bytes.
    432         char utf8[7] = { 0 };
    433         g_unichar_to_utf8(unicodeCharacter, utf8);
    434         return String::fromUTF8(utf8);
     429    UChar32 unicodeCharacter = wpe_key_code_to_unicode(keyCode);
     430    if (unicodeCharacter && U_IS_UNICODE_CHAR(unicodeCharacter)) {
     431        StringBuilder builder;
     432        builder.append(unicodeCharacter);
     433        return builder.toString();
    435434    }
    436435
     
    13051304    }
    13061305
    1307     gunichar c = wpe_key_code_to_unicode(val);
    1308     glong length;
    1309     GUniquePtr<gunichar2> uchar16(g_ucs4_to_utf16(&c, 1, nullptr, &length, nullptr));
    1310     if (uchar16)
    1311         return String(reinterpret_cast<UChar*>(uchar16.get()), length);
     1306    UChar32 unicodeCharacter = wpe_key_code_to_unicode(val);
     1307    if (unicodeCharacter && U_IS_UNICODE_CHAR(unicodeCharacter)) {
     1308        StringBuilder builder;
     1309        builder.append(unicodeCharacter);
     1310        return builder.toString();
     1311    }
    13121312
    13131313    return { };
Note: See TracChangeset for help on using the changeset viewer.