Precondition: using qgraphicswebview Steps to reproduce: 1. open a page that has a textarea field, and type some characters in that field (e.g. I typed "abcdefg" in the textarea) 2. use your mouse to select (highlight) some words (characters) (e.g. I selected "defg") 3. click on other qgraphics ui component (e.g. url bar) which removes the focus from qgraphicswebview Actual Result: All the selected/highlight words (characters) get deleted (e.g. the "defg" get deleted and only "abcd" left in the textarea) Reason: When focus changed, qgraphicssence sends out an inputmethodevent with empty preedit string and empty QInputMethodEvent::Attribute to qgrapchiswebview, which finally be delivered to the QWebPage::inputMethodEvent(QInputMethodEvent *ev). And eventually, an empty preedit string is passed to WebCore::Editor::setComposition(...) which deletes all the selected text. Fix proposal: Check the preedit string before passing it to the WebCore::Editor::setComposition.
Created attachment 67183 [details] proposal fix
Comment on attachment 67183 [details] proposal fix > + if (!ev->preeditString().isEmpty()) Should be "if (!preedit.isEmpty())" Change looks reasonable, but it needs an autotest (see WebKit/qt/tests/)
yes, you are right. Thanks for reviewing, I will change it. (In reply to comment #2) > (From update of attachment 67183 [details]) > > + if (!ev->preeditString().isEmpty()) > > Should be "if (!preedit.isEmpty())" > > Change looks reasonable, but it needs an autotest (see WebKit/qt/tests/)
Created attachment 67236 [details] patch with test case
Comment on attachment 67236 [details] patch with test case Clearing flags on attachment: 67236 Committed r67289: <http://trac.webkit.org/changeset/67289>
All reviewed patches have been landed. Closing bug.
Ademar, can you cherry pick the fix for QtWebkit 2.1? This fix is required for implementation of some features from browser team.
Revision r67289 cherry-picked into qtwebkit-2.1 with commit 50c6993 <http://gitorious.org/webkit/qtwebkit/commit/50c6993>
Actually last comment should be: Revision r67289 cherry-picked into qtwebkit-2.1 with commit b422ce0 <http://gitorious.org/webkit/qtwebkit/commit/b422ce0>