Title: [151809] trunk/Source/WebKit/blackberry
- Revision
- 151809
- Author
- [email protected]
- Date
- 2013-06-20 15:52:37 -0700 (Thu, 20 Jun 2013)
Log Message
[BlackBerry] Send the correct offsets for misspelled words.
https://bugs.webkit.org/show_bug.cgi?id=117846
JIRA116916.
When the caret is placed after a word, the offsets were calculated around
the proceeding space. As such, words that end a sentence worked correctly, but
midsentence words did not. The 'startOfWord' was calculated for the space ahead
and not for the word before it. Now finding the start of the word correctly and
calculating the end from there.
Patch by Nima Ghanavatian <[email protected]> on 2013-06-20
Reviewed by Rob Buis.
Internally reviewed by Genevieve Mak.
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::requestSpellingCheckingOptions):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/ChangeLog (151808 => 151809)
--- trunk/Source/WebKit/blackberry/ChangeLog 2013-06-20 22:17:27 UTC (rev 151808)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2013-06-20 22:52:37 UTC (rev 151809)
@@ -1,3 +1,22 @@
+2013-06-20 Nima Ghanavatian <[email protected]>
+
+ [BlackBerry] Send the correct offsets for misspelled words.
+ https://bugs.webkit.org/show_bug.cgi?id=117846
+
+ JIRA116916.
+ When the caret is placed after a word, the offsets were calculated around
+ the proceeding space. As such, words that end a sentence worked correctly, but
+ midsentence words did not. The 'startOfWord' was calculated for the space ahead
+ and not for the word before it. Now finding the start of the word correctly and
+ calculating the end from there.
+
+ Reviewed by Rob Buis.
+
+ Internally reviewed by Genevieve Mak.
+
+ * WebKitSupport/InputHandler.cpp:
+ (BlackBerry::WebKit::InputHandler::requestSpellingCheckingOptions):
+
2013-06-20 Carlos Garcia Campos <[email protected]>
[BlackBerry] Handle testRunner.setWillSendRequestReturnsNull() in DRT
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (151808 => 151809)
--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp 2013-06-20 22:17:27 UTC (rev 151808)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp 2013-06-20 22:52:37 UTC (rev 151809)
@@ -827,18 +827,21 @@
// If we are only moving the dialog, we don't need to provide startTextPosition and endTextPosition so this logic can be skipped.
if (!shouldMoveDialog) {
// Calculate the offset for contentEditable since the marker offsets are relative to the node.
- // Get caret position. Though the spelling markers might no longer exist, if this method is called we can assume the caret was placed on top of a marker earlier.
- VisiblePosition caretPosition = m_currentFocusElement->document()->frame()->selection()->selection().visibleStart();
+ // Get caret selection. Though the spelling markers might no longer exist, if this method is called we can assume the caret was placed on top of a marker earlier.
+ VisibleSelection caretSelection = m_currentFocusElement->document()->frame()->selection()->selection();
+ caretSelection = DOMSupport::visibleSelectionForClosestActualWordStart(caretSelection);
+ VisiblePosition wordStart = caretSelection.visibleStart();
+ VisiblePosition wordEnd = endOfWord(caretSelection.visibleStart());
if (HTMLTextFormControlElement* controlElement = DOMSupport::toTextControlElement(m_currentFocusElement.get())) {
- spellCheckingOptionRequest.startTextPosition = controlElement->indexForVisiblePosition(startOfWord(caretPosition));
- spellCheckingOptionRequest.endTextPosition = controlElement->indexForVisiblePosition(endOfWord(caretPosition));
+ spellCheckingOptionRequest.startTextPosition = controlElement->indexForVisiblePosition(wordStart);
+ spellCheckingOptionRequest.endTextPosition = controlElement->indexForVisiblePosition(wordEnd);
} else {
unsigned location = 0;
unsigned length = 0;
// Create a range from the start to end of word.
- RefPtr<Range> rangeSelection = VisibleSelection(startOfWord(caretPosition), endOfWord(caretPosition)).toNormalizedRange();
+ RefPtr<Range> rangeSelection = VisibleSelection(wordStart, wordEnd).toNormalizedRange();
if (!rangeSelection)
return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes