Changeset 72471 in webkit
- Timestamp:
- Nov 20, 2010 12:15:10 AM (13 years ago)
- Location:
- trunk/WebKit/qt
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/qt/Api/qwebpage.cpp
r72370 r72471 1081 1081 } 1082 1082 1083 if (!ev->commitString().isEmpty()) 1083 if (node && ev->replacementLength() > 0) { 1084 int cursorPos = frame->selection()->extent().offsetInContainerNode(); 1085 int start = cursorPos + ev->replacementStart(); 1086 setSelectionRange(node, start, start + ev->replacementLength()); 1087 // Commit regardless of whether commitString is empty, to get rid of selection. 1084 1088 editor->confirmComposition(ev->commitString()); 1085 else if (!hasSelection && !ev->preeditString().isEmpty()) 1089 } else if (!ev->commitString().isEmpty()) 1090 editor->confirmComposition(ev->commitString()); 1091 if (!hasSelection && !ev->preeditString().isEmpty()) 1086 1092 editor->setComposition(ev->preeditString(), underlines, 0, 0); 1087 1093 -
trunk/WebKit/qt/ChangeLog
r72467 r72471 1 2010-11-19 Kristian Amlie <kristian.amlie@nokia.com> 2 3 Reviewed by Andreas Kling. 4 5 Fixed handling of QInputMethodEvents with nonzero replacementLength. 6 7 These types of events replace text that is already in the widget, but 8 WebKit did not check for replacementLength at all. 9 10 Also made sure that the preeditString is always respected, even if 11 there is committed text. This is how QLineEdit does it. 12 13 https://bugs.webkit.org/show_bug.cgi?id=49787 14 15 * Api/qwebpage.cpp: 16 (QWebPagePrivate::inputMethodEvent): 17 * tests/qwebpage/tst_qwebpage.cpp: 18 (tst_QWebPage::inputMethods): 19 1 20 2010-11-19 Benjamin Poulain <benjamin.poulain@nokia.com> 2 21 -
trunk/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
r72370 r72471 1569 1569 page->event(&evrel); 1570 1570 1571 { 1572 QList<QInputMethodEvent::Attribute> attributes; 1573 QInputMethodEvent event(QString(), attributes); 1574 event.setCommitString("XXX", 0, 0); 1575 page->event(&event); 1576 event.setCommitString(QString(), -2, 2); // Erase two characters. 1577 page->event(&event); 1578 event.setCommitString(QString(), -1, 1); // Erase one character. 1579 page->event(&event); 1580 variant = page->inputMethodQuery(Qt::ImSurroundingText); 1581 value = variant.value<QString>(); 1582 QCOMPARE(value, QString("QtWebKit")); 1583 } 1584 1571 1585 //Move to the start of the line 1572 1586 page->triggerAction(QWebPage::MoveToStartOfLine);
Note: See TracChangeset
for help on using the changeset viewer.