Title: [146226] trunk/Source/WebKit/blackberry
Revision
146226
Author
[email protected]
Date
2013-03-19 11:31:05 -0700 (Tue, 19 Mar 2013)

Log Message

[BlackBerry] When selecting an object, assign focus to new node instead of clearing previous focused node
https://bugs.webkit.org/show_bug.cgi?id=112707

Patch by Andy Chen <[email protected]> on 2013-03-19
Reviewed by Rob Buis.

In SelectionHandler, when selecting a new object, we should set focus
to the anchor node of selection instead of removing it from the old input.
In InputHandler, when focusedNodeChanged is called, if the new node is
not an Element node, we need to set focus to its Element parent node,
instead of removing focus from the old node.
PR 304631
Internally reviewed by Mike Fenton.

* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::focusedNodeChanged):
* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::selectObject):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (146225 => 146226)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-03-19 18:23:51 UTC (rev 146225)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-03-19 18:31:05 UTC (rev 146226)
@@ -1,3 +1,23 @@
+2013-03-19  Andy Chen  <[email protected]>
+
+        [BlackBerry] When selecting an object, assign focus to new node instead of clearing previous focused node
+        https://bugs.webkit.org/show_bug.cgi?id=112707
+
+        Reviewed by Rob Buis.
+
+        In SelectionHandler, when selecting a new object, we should set focus
+        to the anchor node of selection instead of removing it from the old input.
+        In InputHandler, when focusedNodeChanged is called, if the new node is
+        not an Element node, we need to set focus to its Element parent node,
+        instead of removing focus from the old node.
+        PR 304631
+        Internally reviewed by Mike Fenton.
+
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::focusedNodeChanged):
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::SelectionHandler::selectObject):
+
 2013-03-18  Alberto Garcia  <[email protected]>
 
         [BlackBerry] Prevent text selection inside Colour and Date/Time input fields

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (146225 => 146226)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-03-19 18:23:51 UTC (rev 146225)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-03-19 18:31:05 UTC (rev 146226)
@@ -442,6 +442,9 @@
             setElementFocused(element);
             return;
         }
+    } else if (node && DOMSupport::isTextBasedContentEditableElement(node->parentElement())) {
+        setElementFocused(node->parentElement());
+        return;
     }
 
     if (isActiveTextEdit() && m_currentFocusElement->isContentEditable()) {

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp (146225 => 146226)


--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2013-03-19 18:23:51 UTC (rev 146225)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2013-03-19 18:31:05 UTC (rev 146226)
@@ -23,12 +23,14 @@
 #include "Document.h"
 #include "FatFingers.h"
 #include "FloatQuad.h"
+#include "FocusController.h"
 #include "Frame.h"
 #include "FrameSelection.h"
 #include "FrameView.h"
 #include "HitTestResult.h"
 #include "InputHandler.h"
 #include "IntRect.h"
+#include "Page.h"
 #include "RenderLayer.h"
 #include "SelectionOverlay.h"
 #include "TouchEventHandler.h"
@@ -880,13 +882,14 @@
         Platform::IntPoint(location).toString().c_str());
 
     WebCore::IntPoint relativePoint = DOMSupport::convertPointToFrame(m_webPage->mainFrame(), focusedFrame, location);
-    // Clear input focus if we're not selecting in old input field.
-    if (!m_webPage->m_inputHandler->boundingBoxForInputField().contains(relativePoint))
-        m_webPage->clearFocusNode();
 
     VisiblePosition pointLocation(focusedFrame->visiblePositionForPoint(relativePoint));
     VisibleSelection selection = VisibleSelection(pointLocation, pointLocation);
 
+    // Move focus to the new node if we're not selecting in old input field.
+    if (!m_webPage->m_inputHandler->boundingBoxForInputField().contains(relativePoint))
+        m_webPage->m_page->focusController()->setFocusedNode(selection.start().anchorNode(), focusedFrame);
+
     m_selectionActive = expandSelectionToGranularity(focusedFrame, selection, granularity, m_webPage->m_inputHandler->isInputMode());
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to