Changeset 56334 in webkit


Ignore:
Timestamp:
Mar 22, 2010 8:09:58 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-03-22 Yi Shen <shenyi2006@gmail.com>

Reviewed by Simon Hausmann.

https://bugs.webkit.org/show_bug.cgi?id=35933
[Qt] [Symbian] Can not backward select (highlight) text using virtual keyboard
Make sure the selection start index is smaller than the selection end index.

  • Api/qwebpage.cpp: (QWebPagePrivate::inputMethodEvent):
  • tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::inputMethods):
Location:
trunk/WebKit/qt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/qt/Api/qwebpage.cpp

    r55803 r56334  
    13171317        case QInputMethodEvent::Selection: {
    13181318            if (renderTextControl) {
    1319                 renderTextControl->setSelectionStart(a.start);
    1320                 renderTextControl->setSelectionEnd(a.start + a.length);
     1319                renderTextControl->setSelectionStart(qMin(a.start, (a.start + a.length)));
     1320                renderTextControl->setSelectionEnd(qMax(a.start, (a.start + a.length)));
    13211321            }
    13221322            break;
  • trunk/WebKit/qt/ChangeLog

    r56322 r56334  
     12010-03-22  Yi Shen  <shenyi2006@gmail.com>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=35933 
     6        [Qt] [Symbian] Can not backward select (highlight) text using virtual keyboard
     7        Make sure the selection start index is smaller than the selection end index.
     8
     9        * Api/qwebpage.cpp:
     10        (QWebPagePrivate::inputMethodEvent):
     11        * tests/qwebpage/tst_qwebpage.cpp:
     12        (tst_QWebPage::inputMethods):
     13
    1142010-03-21  Kristian Amlie  <kristian.amlie@nokia.com>
    215
  • trunk/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

    r54578 r56334  
    14041404    QString selectionValue = variant.value<QString>();
    14051405    QCOMPARE(selectionValue, QString("eb"));
     1406
     1407    //Set selection with negative length
     1408    inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 6, -5, QVariant());
     1409    QInputMethodEvent eventSelection2("",inputAttributes);
     1410    page->event(&eventSelection2);
     1411
     1412    //ImAnchorPosition
     1413    variant = page->inputMethodQuery(Qt::ImAnchorPosition);
     1414    anchorPosition =  variant.toInt();
     1415    QCOMPARE(anchorPosition, 1);
     1416
     1417    //ImCursorPosition
     1418    variant = page->inputMethodQuery(Qt::ImCursorPosition);
     1419    cursorPosition =  variant.toInt();
     1420    QCOMPARE(cursorPosition, 6);
     1421
     1422    //ImCurrentSelection
     1423    variant = page->inputMethodQuery(Qt::ImCurrentSelection);
     1424    selectionValue = variant.value<QString>();
     1425    QCOMPARE(selectionValue, QString("tWebK"));
    14061426#endif
    14071427
Note: See TracChangeset for help on using the changeset viewer.