[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
robert at webkit.org
robert at webkit.org
Wed Dec 22 14:50:22 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 528048dd258649c3ff51b6000235fdcf8645f890
Author: robert at webkit.org <robert at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Oct 21 19:53:09 2010 +0000
2010-10-21 Robert Hogan <robert at webkit.org>
Reviewed by Simon Hausmann.
[Qt] Sending a QInputMethodEvent::Selection event forces the
Editor to go into Composition mode
Improve QWebPage handling of input method events:
- Selections don't trigger entering composition mode.
- Handle multiple selections
Also remove redundant cancellation of composition in tst_qwebpage.
There is no composition in progress at that point.
Finally, move infiniteLoopJS() to the end of the tst_qwebpage unit
tests - so you don't have to wait for it to complete when running
other tests.
https://bugs.webkit.org/show_bug.cgi?id=39625
* Api/qwebpage.cpp:
(QWebPagePrivate::inputMethodEvent):
(QWebPage::inputMethodQuery):
* tests/qwebpage/tst_qwebpage.cpp:
(tst_QWebPage::inputMethods):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70259 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp
index 454376c..7c64671 100644
--- a/WebKit/qt/Api/qwebpage.cpp
+++ b/WebKit/qt/Api/qwebpage.cpp
@@ -1008,7 +1008,6 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
{
WebCore::Frame *frame = page->focusController()->focusedOrMainFrame();
WebCore::Editor *editor = frame->editor();
- QInputMethodEvent::Attribute selection(QInputMethodEvent::Selection, 0, 0, QVariant());
if (!editor->canEdit()) {
ev->ignore();
@@ -1048,8 +1047,23 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
break;
}
case QInputMethodEvent::Selection: {
- selection = a;
hasSelection = true;
+ // A selection in the inputMethodEvent is always reflected in the visible text
+ if (renderTextControl) {
+ renderTextControl->setSelectionStart(qMin(a.start, (a.start + a.length)));
+ renderTextControl->setSelectionEnd(qMax(a.start, (a.start + a.length)));
+ }
+
+ if (!ev->preeditString().isEmpty()) {
+ editor->setComposition(ev->preeditString(), underlines,
+ (a.length < 0) ? a.start + a.length : a.start,
+ (a.length < 0) ? a.start : a.start + a.length);
+ } else {
+ // If we are in the middle of a composition, an empty pre-edit string and a selection of zero
+ // cancels the current composition
+ if (editor->hasComposition() && (a.start + a.length == 0))
+ editor->setComposition(QString(), underlines, 0, 0);
+ }
break;
}
}
@@ -1057,22 +1071,8 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
if (!ev->commitString().isEmpty())
editor->confirmComposition(ev->commitString());
- else {
- // 1. empty preedit with a selection attribute, and start/end of 0 cancels composition
- // 2. empty preedit with a selection attribute, and start/end of non-0 updates selection of current preedit text
- // 3. populated preedit with a selection attribute, and start/end of 0 or non-0 updates selection of supplied preedit text
- // 4. otherwise event is updating supplied pre-edit text
- QString preedit = ev->preeditString();
- if (hasSelection) {
- QString text = (renderTextControl) ? QString(renderTextControl->text()) : QString();
- if (preedit.isEmpty() && selection.start + selection.length > 0)
- preedit = text;
- editor->setComposition(preedit, underlines,
- (selection.length < 0) ? selection.start + selection.length : selection.start,
- (selection.length < 0) ? selection.start : selection.start + selection.length);
- } else if (!preedit.isEmpty())
- editor->setComposition(preedit, underlines, preedit.length(), 0);
- }
+ else if (!hasSelection && !ev->preeditString().isEmpty())
+ editor->setComposition(ev->preeditString(), underlines, 0, ev->preeditString().length());
ev->accept();
}
@@ -1329,9 +1329,8 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const
if (renderTextControl) {
QString text = renderTextControl->text();
RefPtr<Range> range = editor->compositionRange();
- if (range) {
+ if (range)
text.remove(range->startPosition().offsetInContainerNode(), TextIterator::rangeLength(range.get()));
- }
return QVariant(text);
}
return QVariant();
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index c1bf664..75d89e9 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,29 @@
+2010-10-21 Robert Hogan <robert at webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Sending a QInputMethodEvent::Selection event forces the
+ Editor to go into Composition mode
+
+ Improve QWebPage handling of input method events:
+ - Selections don't trigger entering composition mode.
+ - Handle multiple selections
+
+ Also remove redundant cancellation of composition in tst_qwebpage.
+ There is no composition in progress at that point.
+
+ Finally, move infiniteLoopJS() to the end of the tst_qwebpage unit
+ tests - so you don't have to wait for it to complete when running
+ other tests.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39625
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::inputMethodEvent):
+ (QWebPage::inputMethodQuery):
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::inputMethods):
+
2010-10-20 Luiz Agostini <luiz.agostini at openbossa.org>
Reviewed by Antonio Gomes.
diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index 0462953..3d9fcb2 100644
--- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -77,7 +77,6 @@ private slots:
void cleanupTestCase();
void acceptNavigationRequest();
- void infiniteLoopJS();
void geolocationRequestJS();
void loadFinished();
void acceptNavigationRequestWithNewWindow();
@@ -128,6 +127,7 @@ private slots:
void testStopScheduledPageRefresh();
void findText();
void supportedContentType();
+ void infiniteLoopJS();
private:
QWebView* m_view;
@@ -1516,11 +1516,6 @@ void tst_QWebPage::inputMethods()
QString selectionValue = variant.value<QString>();
QCOMPARE(selectionValue, QString("eb"));
- //Cancel current composition first
- inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 0, QVariant());
- QInputMethodEvent eventSelection2("",inputAttributes);
- page->event(&eventSelection2);
-
//Set selection with negative length
inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 6, -5, QVariant());
QInputMethodEvent eventSelection3("",inputAttributes);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list