https://bugs.webkit.org/show_bug.cgi?id=109126
PR 292540
Source/WebCore:
Patch by Xiaobo Wang <xbwang@torchmobile.com.cn> 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 <xbwang@torchmobile.com.cn> 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 <xbwang@torchmobile.com.cn> on 2013-02-07
Reviewed by Yong Li.
Change char code to 4 bytes.
* DumpRenderTree/blackberry/EventSender.cpp:
(keyDownCallback):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142120
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2013-02-07 Xiaobo Wang <xbwang@torchmobile.com.cn>
+
+ [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 <mkwst@chromium.org>
Replace ExceptionCode assertions with ASSERT_NO_EXCEPTION macro.
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)
bool m_isSystemKey;
#if PLATFORM(BLACKBERRY)
- unsigned short m_unmodifiedCharacter;
+ unsigned m_unmodifiedCharacter;
#endif
#if PLATFORM(MAC)
namespace WebCore {
-static String keyIdentifierForBlackBerryCharacter(unsigned short character)
+static String keyIdentifierForBlackBerryCharacter(unsigned character)
{
switch (character) {
case KEYCODE_RETURN:
}
}
-static int windowsKeyCodeForBlackBerryCharacter(unsigned short character)
+static int windowsKeyCodeForBlackBerryCharacter(unsigned character)
{
switch (character) {
case KEYCODE_RETURN:
}
}
-unsigned short adjustCharacterFromOS(unsigned short character)
+unsigned adjustCharacterFromOS(unsigned character)
{
// Use windows key character as ASCII value when possible to enhance readability.
switch (character) {
, 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)
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;
+2013-02-07 Xiaobo Wang <xbwang@torchmobile.com.cn>
+
+ [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 <Xuewen.Wang@torchmobile.com.cn>
[BlackBerry] Reader Mode: Opening two links quickly from reader mode causes browser bad state
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.
int32_t m_processingTransactionId;
bool m_shouldNotifyWebView;
- unsigned short m_expectedKeyUpChar;
+ unsigned m_expectedKeyUpChar;
imf_sp_text_t m_spellCheckingOptionsRequest;
WebCore::IntSize m_screenOffset;
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));
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
}
// 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);
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);
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())
// 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.
if (startIsOutsideOfField && endIsOutsideOfField)
return false;
- unsigned short character = 0;
+ unsigned character = 0;
if (startIsOutsideOfField) {
character = extendSelectionToFieldBoundary(true /* isStartHandle */, relativeStart, newSelection);
if (character) {
, 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;
+2013-02-07 Xiaobo Wang <xbwang@torchmobile.com.cn>
+
+ [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 <gavinp@chromium.org>
Unreviewed, rolling out r142090.
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;