Title: [144355] trunk/Source/WebKit/blackberry
Revision
144355
Author
mifen...@rim.com
Date
2013-02-28 13:30:00 -0800 (Thu, 28 Feb 2013)

Log Message

[BlackBerry] Maintain the directionality of the selection after modifying the selection using key events.
https://bugs.webkit.org/show_bug.cgi?id=111078

Reviewed by Yong Li.

PR 295224.

When using the key navigation to modify the selection, reset the
directionality of the selection to the original to prevent
changing the anchor.

Reviewed Internally by Nima Ghanavatian.

* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::updateOrHandleInputSelection):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (144354 => 144355)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-02-28 21:08:39 UTC (rev 144354)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-02-28 21:30:00 UTC (rev 144355)
@@ -1,3 +1,21 @@
+2013-02-28  Mike Fenton  <mifen...@rim.com>
+
+        [BlackBerry] Maintain the directionality of the selection after modifying the selection using key events.
+        https://bugs.webkit.org/show_bug.cgi?id=111078
+
+        Reviewed by Yong Li.
+
+        PR 295224.
+
+        When using the key navigation to modify the selection, reset the
+        directionality of the selection to the original to prevent
+        changing the anchor.
+
+        Reviewed Internally by Nima Ghanavatian.
+
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::SelectionHandler::updateOrHandleInputSelection):
+
 2013-02-28  Lianghui Chen  <liac...@rim.com>
 
         [BlackBerry] Disable auto-filling password in forms when auto-form-filling is not enabled.

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp (144354 => 144355)


--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2013-02-28 21:08:39 UTC (rev 144354)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2013-02-28 21:30:00 UTC (rev 144355)
@@ -439,15 +439,17 @@
         return false;
 
     unsigned character = 0;
+    bool needToInvertDirection = false;
     if (startIsOutsideOfField) {
         character = extendSelectionToFieldBoundary(true /* isStartHandle */, relativeStart, newSelection);
-        if (character) {
+        if (character && controller->selection().isBaseFirst()) {
             // Invert the selection so that the cursor point is at the beginning.
             controller->setSelection(VisibleSelection(controller->selection().end(), controller->selection().start(), true /* isDirectional */));
+            needToInvertDirection = true;
         }
     } else if (endIsOutsideOfField) {
         character = extendSelectionToFieldBoundary(false /* isStartHandle */, relativeEnd, newSelection);
-        if (character) {
+        if (character && !controller->selection().isBaseFirst()) {
             // Reset the selection so that the end is the edit point.
             controller->setSelection(VisibleSelection(controller->selection().start(), controller->selection().end(), true /* isDirectional */));
         }
@@ -463,6 +465,9 @@
     if (shouldExtendSelectionInDirection(controller->selection(), character))
         m_webPage->m_inputHandler->handleKeyboardInput(Platform::KeyboardEvent(character, Platform::KeyboardEvent::KeyDown, KEYMOD_SHIFT));
 
+    if (needToInvertDirection)
+        controller->setSelection(VisibleSelection(controller->selection().extent(), controller->selection().base(), true /* isDirectional */));
+
     // Send the selection changed in case this does not trigger a selection change to
     // ensure the caret position is accurate. This may be a duplicate event.
     selectionPositionChanged(true /* forceUpdateWithoutChange */);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to