Title: [142120] trunk
Revision
142120
Author
[email protected]
Date
2013-02-07 07:24:28 -0800 (Thu, 07 Feb 2013)

Log Message

[BlackBerry] CHHW - Characters that are using 32 bits encoding get trunked to 16bits
https://bugs.webkit.org/show_bug.cgi?id=109126
PR 292540

Source/WebCore:

Patch by Xiaobo Wang <[email protected]> on 2013-02-07
Reviewed by Yong Li.

Change char code to 4 bytes.
Need to convert UTF32 key char to UTF16 before constructing a WTF::String.

* platform/PlatformKeyboardEvent.h:
(WebCore::PlatformKeyboardEvent::unmodifiedCharacter):
(PlatformKeyboardEvent):
* platform/blackberry/PlatformKeyboardEventBlackBerry.cpp:
(WebCore::keyIdentifierForBlackBerryCharacter):
(WebCore::windowsKeyCodeForBlackBerryCharacter):
(WebCore::adjustCharacterFromOS):
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):

Source/WebKit/blackberry:

Patch by Xiaobo Wang <[email protected]> on 2013-02-07
Reviewed by Yong Li.
Internally reviewed by Mike Fenton.

Key char is UTF32 encoded, should be 4 bytes.

* Api/WebPage.cpp:
(BlackBerry::WebKit::handleScrolling):
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::handleKeyboardInput):
* WebKitSupport/InputHandler.h:
(InputHandler):
* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::directionOfPointRelativeToRect):
(BlackBerry::WebKit::SelectionHandler::setCaretPosition):
(BlackBerry::WebKit::shouldExtendSelectionInDirection):
(BlackBerry::WebKit::directionalVisiblePositionAtExtentOfBox):
(BlackBerry::WebKit::SelectionHandler::extendSelectionToFieldBoundary):
(BlackBerry::WebKit::SelectionHandler::updateOrHandleInputSelection):
* WebKitSupport/SelectionHandler.h:
(SelectionHandler):

Tools:

Patch by Xiaobo Wang <[email protected]> on 2013-02-07
Reviewed by Yong Li.

Change char code to 4 bytes.

* DumpRenderTree/blackberry/EventSender.cpp:
(keyDownCallback):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (142119 => 142120)


--- trunk/Source/WebCore/ChangeLog	2013-02-07 15:21:55 UTC (rev 142119)
+++ trunk/Source/WebCore/ChangeLog	2013-02-07 15:24:28 UTC (rev 142120)
@@ -1,3 +1,23 @@
+2013-02-07  Xiaobo Wang  <[email protected]>
+
+        [BlackBerry] CHHW - Characters that are using 32 bits encoding get trunked to 16bits
+        https://bugs.webkit.org/show_bug.cgi?id=109126
+        PR 292540
+
+        Reviewed by Yong Li.
+
+        Change char code to 4 bytes.
+        Need to convert UTF32 key char to UTF16 before constructing a WTF::String.
+
+        * platform/PlatformKeyboardEvent.h:
+        (WebCore::PlatformKeyboardEvent::unmodifiedCharacter):
+        (PlatformKeyboardEvent):
+        * platform/blackberry/PlatformKeyboardEventBlackBerry.cpp:
+        (WebCore::keyIdentifierForBlackBerryCharacter):
+        (WebCore::windowsKeyCodeForBlackBerryCharacter):
+        (WebCore::adjustCharacterFromOS):
+        (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
+
 2013-02-07  Mike West  <[email protected]>
 
         Replace ExceptionCode assertions with ASSERT_NO_EXCEPTION macro.

Modified: trunk/Source/WebCore/platform/PlatformKeyboardEvent.h (142119 => 142120)


--- trunk/Source/WebCore/platform/PlatformKeyboardEvent.h	2013-02-07 15:21:55 UTC (rev 142119)
+++ trunk/Source/WebCore/platform/PlatformKeyboardEvent.h	2013-02-07 15:24:28 UTC (rev 142120)
@@ -138,7 +138,7 @@
         static void getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey);
 
 #if PLATFORM(BLACKBERRY)
-        unsigned short unmodifiedCharacter() const { return m_unmodifiedCharacter; }
+        unsigned unmodifiedCharacter() const { return m_unmodifiedCharacter; }
 #endif
 
 #if PLATFORM(MAC)
@@ -192,7 +192,7 @@
         bool m_isSystemKey;
 
 #if PLATFORM(BLACKBERRY)
-        unsigned short m_unmodifiedCharacter;
+        unsigned m_unmodifiedCharacter;
 #endif
 
 #if PLATFORM(MAC)

Modified: trunk/Source/WebCore/platform/blackberry/PlatformKeyboardEventBlackBerry.cpp (142119 => 142120)


--- trunk/Source/WebCore/platform/blackberry/PlatformKeyboardEventBlackBerry.cpp	2013-02-07 15:21:55 UTC (rev 142119)
+++ trunk/Source/WebCore/platform/blackberry/PlatformKeyboardEventBlackBerry.cpp	2013-02-07 15:24:28 UTC (rev 142120)
@@ -30,7 +30,7 @@
 
 namespace WebCore {
 
-static String keyIdentifierForBlackBerryCharacter(unsigned short character)
+static String keyIdentifierForBlackBerryCharacter(unsigned character)
 {
     switch (character) {
     case KEYCODE_RETURN:
@@ -111,7 +111,7 @@
     }
 }
 
-static int windowsKeyCodeForBlackBerryCharacter(unsigned short character)
+static int windowsKeyCodeForBlackBerryCharacter(unsigned character)
 {
     switch (character) {
     case KEYCODE_RETURN:
@@ -357,7 +357,7 @@
     }
 }
 
-unsigned short adjustCharacterFromOS(unsigned short character)
+unsigned adjustCharacterFromOS(unsigned character)
 {
     // Use windows key character as ASCII value when possible to enhance readability.
     switch (character) {
@@ -446,8 +446,16 @@
     , m_isKeypad(false)
     , m_unmodifiedCharacter(event.character())
 {
-    unsigned short character = adjustCharacterFromOS(event.character());
-    m_text = String(&character, 1);
+    unsigned character = adjustCharacterFromOS(event.character());
+    UChar utf16[3] = {0};
+    int destLength = 0;
+    UErrorCode ec = U_ZERO_ERROR;
+    u_strFromUTF32(utf16, 3, &destLength, reinterpret_cast<UChar32*>(&character), 1, &ec);
+    if (ec) {
+        BBLOG(BlackBerry::Platform::LogLevelCritical, "PlatformKeyboardEvent::PlatformKeyboardEvent Error converting 0x%x to string ec (%d).", character, ec);
+        return;
+    }
+    m_text = String(utf16, destLength);
     m_unmodifiedText = m_text;
 
     if (event.character() == KEYCODE_BACK_TAB)

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (142119 => 142120)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2013-02-07 15:21:55 UTC (rev 142119)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2013-02-07 15:24:28 UTC (rev 142120)
@@ -4272,7 +4272,7 @@
         return d->focusedOrMainFrame()->loader()->reloadWithOverrideEncoding(encoding);
 }
 
-static void handleScrolling(unsigned short character, WebPagePrivate* scroller)
+static void handleScrolling(unsigned character, WebPagePrivate* scroller)
 {
     const int scrollFactor = 20;
     int dx = 0, dy = 0;

Modified: trunk/Source/WebKit/blackberry/ChangeLog (142119 => 142120)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-02-07 15:21:55 UTC (rev 142119)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-02-07 15:24:28 UTC (rev 142120)
@@ -1,3 +1,30 @@
+2013-02-07  Xiaobo Wang  <[email protected]>
+
+        [BlackBerry] CHHW - Characters that are using 32 bits encoding get trunked to 16bits
+        https://bugs.webkit.org/show_bug.cgi?id=109126
+        PR 292540
+
+        Reviewed by Yong Li.
+        Internally reviewed by Mike Fenton.
+
+        Key char is UTF32 encoded, should be 4 bytes.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::handleScrolling):
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::handleKeyboardInput):
+        * WebKitSupport/InputHandler.h:
+        (InputHandler):
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::directionOfPointRelativeToRect):
+        (BlackBerry::WebKit::SelectionHandler::setCaretPosition):
+        (BlackBerry::WebKit::shouldExtendSelectionInDirection):
+        (BlackBerry::WebKit::directionalVisiblePositionAtExtentOfBox):
+        (BlackBerry::WebKit::SelectionHandler::extendSelectionToFieldBoundary):
+        (BlackBerry::WebKit::SelectionHandler::updateOrHandleInputSelection):
+        * WebKitSupport/SelectionHandler.h:
+        (SelectionHandler):
+
 2013-02-07  Sean Wang  <[email protected]>
 
         [BlackBerry] Reader Mode: Opening two links quickly from reader mode causes browser bad state

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (142119 => 142120)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-02-07 15:21:55 UTC (rev 142119)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-02-07 15:24:28 UTC (rev 142120)
@@ -1553,7 +1553,7 @@
 bool InputHandler::handleKeyboardInput(const Platform::KeyboardEvent& keyboardEvent, bool changeIsPartOfComposition)
 {
     InputLog(Platform::LogLevelInfo,
-        "InputHandler::handleKeyboardInput received character='%c', type=%d",
+        "InputHandler::handleKeyboardInput received character='%lc', type=%d",
         keyboardEvent.character(), keyboardEvent.type());
 
     // Clearing the m_shouldNotifyWebView state on any KeyboardEvent.

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h (142119 => 142120)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h	2013-02-07 15:21:55 UTC (rev 142119)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h	2013-02-07 15:24:28 UTC (rev 142120)
@@ -238,7 +238,7 @@
     int32_t m_processingTransactionId;
 
     bool m_shouldNotifyWebView;
-    unsigned short m_expectedKeyUpChar;
+    unsigned m_expectedKeyUpChar;
 
     imf_sp_text_t m_spellCheckingOptionsRequest;
     WebCore::IntSize m_screenOffset;

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp (142119 => 142120)


--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2013-02-07 15:21:55 UTC (rev 142119)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2013-02-07 15:24:28 UTC (rev 142120)
@@ -184,7 +184,7 @@
     return visiblePos;
 }
 
-static unsigned short directionOfPointRelativeToRect(const WebCore::IntPoint& point, const WebCore::IntRect& rect, const bool useTopPadding = true, const bool useBottomPadding = true)
+static unsigned directionOfPointRelativeToRect(const WebCore::IntPoint& point, const WebCore::IntRect& rect, const bool useTopPadding = true, const bool useBottomPadding = true)
 {
     ASSERT(!rect.contains(point));
 
@@ -265,7 +265,7 @@
     if (RenderObject* focusedRenderer = focusedFrame->document()->focusedNode()->renderer()) {
         WebCore::IntRect nodeOutlineBounds(focusedRenderer->absoluteOutlineBounds());
         if (!nodeOutlineBounds.contains(relativePoint)) {
-            if (unsigned short character = directionOfPointRelativeToRect(relativePoint, currentCaretRect))
+            if (unsigned character = directionOfPointRelativeToRect(relativePoint, currentCaretRect))
                 m_webPage->m_inputHandler->handleKeyboardInput(Platform::KeyboardEvent(character));
 
             // Send the selection changed in case this does not trigger a selection change to
@@ -293,7 +293,7 @@
 }
 
 // This function makes sure we are not reducing the selection to a caret selection.
-static bool shouldExtendSelectionInDirection(const VisibleSelection& selection, unsigned short character)
+static bool shouldExtendSelectionInDirection(const VisibleSelection& selection, unsigned character)
 {
     FrameSelection tempSelection;
     tempSelection.setSelection(selection);
@@ -327,7 +327,7 @@
     return value < min ? min : std::min(value, max);
 }
 
-static VisiblePosition directionalVisiblePositionAtExtentOfBox(Frame* frame, const WebCore::IntRect& boundingBox, unsigned short direction, const WebCore::IntPoint& basePoint)
+static VisiblePosition directionalVisiblePositionAtExtentOfBox(Frame* frame, const WebCore::IntRect& boundingBox, unsigned direction, const WebCore::IntPoint& basePoint)
 {
     ASSERT(frame);
 
@@ -365,7 +365,7 @@
     return false;
 }
 
-unsigned short SelectionHandler::extendSelectionToFieldBoundary(bool isStartHandle, const WebCore::IntPoint& selectionPoint, VisibleSelection& newSelection)
+unsigned SelectionHandler::extendSelectionToFieldBoundary(bool isStartHandle, const WebCore::IntPoint& selectionPoint, VisibleSelection& newSelection)
 {
     Frame* focusedFrame = m_webPage->focusedOrMainFrame();
     if (!focusedFrame->document()->focusedNode() || !focusedFrame->document()->focusedNode()->renderer())
@@ -381,7 +381,7 @@
 
     // Start handle is outside of the field. Treat it as the changed handle and move
     // relative to the start caret rect.
-    unsigned short character = directionOfPointRelativeToRect(selectionPoint, caretRect, isStartHandle /* useTopPadding */, !isStartHandle /* useBottomPadding */);
+    unsigned character = directionOfPointRelativeToRect(selectionPoint, caretRect, isStartHandle /* useTopPadding */, !isStartHandle /* useBottomPadding */);
 
     // Prevent incorrect movement, handles can only extend the selection this way
     // to prevent inversion of the handles.
@@ -439,7 +439,7 @@
     if (startIsOutsideOfField && endIsOutsideOfField)
         return false;
 
-    unsigned short character = 0;
+    unsigned character = 0;
     if (startIsOutsideOfField) {
         character = extendSelectionToFieldBoundary(true /* isStartHandle */, relativeStart, newSelection);
         if (character) {

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h (142119 => 142120)


--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h	2013-02-07 15:21:55 UTC (rev 142119)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h	2013-02-07 15:24:28 UTC (rev 142120)
@@ -85,7 +85,7 @@
                                       , const WebCore::IntPoint& relativeEnd);
     WebCore::Node* DOMContainerNodeForVisiblePosition(const WebCore::VisiblePosition&) const;
     bool shouldUpdateSelectionOrCaretForPoint(const WebCore::IntPoint&, const WebCore::IntRect&, bool startCaret = true) const;
-    unsigned short extendSelectionToFieldBoundary(bool isStartHandle, const WebCore::IntPoint& selectionPoint, WebCore::VisibleSelection& newSelection);
+    unsigned extendSelectionToFieldBoundary(bool isStartHandle, const WebCore::IntPoint& selectionPoint, WebCore::VisibleSelection& newSelection);
     WebCore::IntPoint clipPointToVisibleContainer(const WebCore::IntPoint&) const;
 
     bool inputNodeOverridesTouch() const;

Modified: trunk/Tools/ChangeLog (142119 => 142120)


--- trunk/Tools/ChangeLog	2013-02-07 15:21:55 UTC (rev 142119)
+++ trunk/Tools/ChangeLog	2013-02-07 15:24:28 UTC (rev 142120)
@@ -1,3 +1,16 @@
+2013-02-07  Xiaobo Wang  <[email protected]>
+
+        [BlackBerry] CHHW - Characters that are using 32 bits encoding get trunked to 16bits
+        https://bugs.webkit.org/show_bug.cgi?id=109126
+        PR 292540
+
+        Reviewed by Yong Li.
+
+        Change char code to 4 bytes.
+
+        * DumpRenderTree/blackberry/EventSender.cpp:
+        (keyDownCallback):
+
 2013-02-07  Gavin Peters  <[email protected]>
 
         Unreviewed, rolling out r142090.

Modified: trunk/Tools/DumpRenderTree/blackberry/EventSender.cpp (142119 => 142120)


--- trunk/Tools/DumpRenderTree/blackberry/EventSender.cpp	2013-02-07 15:21:55 UTC (rev 142119)
+++ trunk/Tools/DumpRenderTree/blackberry/EventSender.cpp	2013-02-07 15:24:28 UTC (rev 142120)
@@ -121,7 +121,7 @@
 
     JSStringRef character = JSValueToStringCopy(context, arguments[0], exception);
     ASSERT(!*exception);
-    short charCode = 0;
+    unsigned charCode = 0;
     bool needsShiftKeyModifier = false;
     if (JSStringIsEqualToUTF8CString(character, "leftArrow"))
         charCode = KEYCODE_LEFT;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to