Title: [137046] trunk/Source/WebKit/blackberry
- Revision
- 137046
- Author
- [email protected]
- Date
- 2012-12-08 12:34:52 -0800 (Sat, 08 Dec 2012)
Log Message
[BlackBerry] Enforce selection of last work when triggering caret based selection
https://bugs.webkit.org/show_bug.cgi?id=104447
Reviewed by Rob Buis.
PR 249225.
When the selection has reached the end of an input field,
ensure the last word is selected by adjusting the caret.
Reviewed Internally by Gen Mak.
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::isCaretAtEndOfText):
(WebKit):
* WebKitSupport/InputHandler.h:
(InputHandler):
* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::selectObject):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/ChangeLog (137045 => 137046)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-12-08 20:03:42 UTC (rev 137045)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-12-08 20:34:52 UTC (rev 137046)
@@ -1,3 +1,25 @@
+2012-12-08 Mike Fenton <[email protected]>
+
+ [BlackBerry] Enforce selection of last work when triggering caret based selection
+ https://bugs.webkit.org/show_bug.cgi?id=104447
+
+ Reviewed by Rob Buis.
+
+ PR 249225.
+
+ When the selection has reached the end of an input field,
+ ensure the last word is selected by adjusting the caret.
+
+ Reviewed Internally by Gen Mak.
+
+ * WebKitSupport/InputHandler.cpp:
+ (BlackBerry::WebKit::InputHandler::isCaretAtEndOfText):
+ (WebKit):
+ * WebKitSupport/InputHandler.h:
+ (InputHandler):
+ * WebKitSupport/SelectionHandler.cpp:
+ (BlackBerry::WebKit::SelectionHandler::selectObject):
+
2012-12-08 Chris Hutten-Czapski <[email protected]>
[BlackBerry] Remove about:credits
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (137045 => 137046)
--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp 2012-12-08 20:03:42 UTC (rev 137045)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp 2012-12-08 20:34:52 UTC (rev 137046)
@@ -1864,6 +1864,11 @@
return true;
}
+bool InputHandler::isCaretAtEndOfText()
+{
+ return caretPosition() == elementText().length();
+}
+
int InputHandler::caretPosition() const
{
if (!isActiveTextEdit())
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h (137045 => 137046)
--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h 2012-12-08 20:03:42 UTC (rev 137045)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h 2012-12-08 20:34:52 UTC (rev 137046)
@@ -121,6 +121,8 @@
WebCore::IntRect boundingBoxForInputField();
+ bool isCaretAtEndOfText();
+
// IMF driven calls.
bool setBatchEditingActive(bool);
bool setSelection(int start, int end, bool changeIsPartOfComposition = false);
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp (137045 => 137046)
--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp 2012-12-08 20:03:42 UTC (rev 137045)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp 2012-12-08 20:34:52 UTC (rev 137046)
@@ -654,9 +654,16 @@
SelectionLog(LogLevelInfo, "SelectionHandler::selectObject using current selection");
+ ASSERT(focusedFrame->selection()->selectionType() != VisibleSelection::NoSelection);
+
// Use the current selection as the selection point.
- ASSERT(focusedFrame->selection()->selectionType() != VisibleSelection::NoSelection);
- m_selectionActive = expandSelectionToGranularity(focusedFrame, focusedFrame->selection()->selection(), granularity, true /* isInputMode */);
+ VisibleSelection selectionOrigin = focusedFrame->selection()->selection();
+
+ // If this is the end of the input field, make sure we select the last word.
+ if (m_webPage->m_inputHandler->isCaretAtEndOfText())
+ selectionOrigin = previousWordPosition(selectionOrigin.start());
+
+ m_selectionActive = expandSelectionToGranularity(focusedFrame, selectionOrigin, granularity, true /* isInputMode */);
}
void SelectionHandler::selectObject(Node* node)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes