Commit e919ebc9 authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

[BlackBerry] When selecting an object, assign focus to new node instead of...

[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 <andchen@blackberry.com> 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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146226 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9b4acf7f
2013-03-19 Andy Chen <andchen@blackberry.com>
[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 <agarcia@igalia.com>
 
[BlackBerry] Prevent text selection inside Colour and Date/Time input fields
......
......@@ -442,6 +442,9 @@ void InputHandler::focusedNodeChanged()
setElementFocused(element);
return;
}
} else if (node && DOMSupport::isTextBasedContentEditableElement(node->parentElement())) {
setElementFocused(node->parentElement());
return;
}
if (isActiveTextEdit() && m_currentFocusElement->isContentEditable()) {
......
......@@ -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 @@ void SelectionHandler::selectObject(const WebCore::IntPoint& location, TextGranu
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());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment