By using the virtual keyboard on a symbian device, the user can not select texts from right to left (the cursor position is before the anchor position);
Created attachment 50334 [details] proposal fix for bug 35933
This issue is Qt only, and the root cause is that webcore assumes the selection's start position is always before the end position. In RenderTextControl.cpp; void RenderTextControl::setSelectionEnd(int end) { setSelectionRange(min(end, selectionStart()), end); } The setSelectionEnd(int) function was called from QWebPagePrivate::inputMethodEvent(QInputMethodEvent*) at qwebpage.cpp case QInputMethodEvent::Selection: { if (renderTextControl) { renderTextControl->setSelectionStart(a.start); renderTextControl->setSelectionEnd(a.start + a.length); } break; } However, in above code, the a.length, which is from QcoeFepInputContext, is negative when doing backward selection: void QCoeFepInputContext::SetCursorSelectionForFepL(const TCursorSelection&) { int pos = aCursorSelection.iAnchorPos; int length = aCursorSelection.iCursorPos - pos; QList<QInputMethodEvent::Attribute> attributes; attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, pos, length, QVariant()); } It can explain why the backward selection doesn't work, that is, when start position is larger than end position, setSelectionRange(min(end, selectionStart()), end); equals setSelectionRange(end, end); The patch I attached would check/adjust the start & end position before calling the setSelectionStart & setSelectionEnd. I have tested it on both s60 emulator & target.
Created attachment 50795 [details] proposal patch
Created attachment 50812 [details] patch for bug35933
Comment on attachment 50812 [details] patch for bug35933 I think the patch is fine, but please make a unit test for this. See the inputMethods() unit tests in WebKit/qt/tests/qwebpage. You could test this by sending a synthetic input method event with a selection set. After sending the event you could verify that the selection is set correctly.
Created attachment 51157 [details] new patch with the unit test The new patch contains the unit test for qwebpage.
Comment on attachment 51157 [details] new patch with the unit test Clearing flags on attachment: 51157 Committed r56334: <http://trac.webkit.org/changeset/56334>
All reviewed patches have been landed. Closing bug.
Cherry-picked into qtwebkit-4.6 with commit edc778e0b452640d8e05c4a88903c18b6afe20ec