summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/qt/TextInputControllerQt.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-05-11 18:35:50 +0100
committerBen Murdoch <benm@google.com>2010-05-14 10:23:05 +0100
commit21939df44de1705786c545cd1bf519d47250322d (patch)
treeef56c310f5c0cdc379c2abb2e212308a3281ce20 /WebKitTools/DumpRenderTree/qt/TextInputControllerQt.cpp
parent4ff1d8891d520763f17675827154340c7c740f90 (diff)
downloadexternal_webkit-21939df44de1705786c545cd1bf519d47250322d.zip
external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.gz
external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.bz2
Merge Webkit at r58956: Initial merge by Git.
Change-Id: I1d9fb60ea2c3f2ddc04c17a871acdb39353be228
Diffstat (limited to 'WebKitTools/DumpRenderTree/qt/TextInputControllerQt.cpp')
-rw-r--r--WebKitTools/DumpRenderTree/qt/TextInputControllerQt.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/WebKitTools/DumpRenderTree/qt/TextInputControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/TextInputControllerQt.cpp
index 7b8f120..e0c9b61 100644
--- a/WebKitTools/DumpRenderTree/qt/TextInputControllerQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/TextInputControllerQt.cpp
@@ -28,8 +28,10 @@
*/
#include "config.h"
#include "TextInputControllerQt.h"
+#include "../../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h"
#include <QApplication>
+#include <QInputMethodEvent>
#include <QKeyEvent>
TextInputController::TextInputController(QWebPage* parent)
@@ -127,3 +129,32 @@ void TextInputController::doCommand(const QString& command)
QKeyEvent event2(QEvent::KeyRelease, keycode, modifiers);
QApplication::sendEvent(parent(), &event2);
}
+
+void TextInputController::setMarkedText(const QString& string, int start, int end)
+{
+ QList<QInputMethodEvent::Attribute> attributes;
+#if QT_VERSION >= 0x040600
+ QInputMethodEvent::Attribute selection(QInputMethodEvent::Selection, start, end, QVariant());
+ attributes << selection;
+#endif
+ QInputMethodEvent event(string, attributes);
+ QApplication::sendEvent(parent(), &event);
+}
+
+void TextInputController::insertText(const QString& string)
+{
+ QList<QInputMethodEvent::Attribute> attributes;
+ QInputMethodEvent event(string, attributes);
+ event.setCommitString(string);
+ QApplication::sendEvent(parent(), &event);
+}
+
+QVariantList TextInputController::selectedRange()
+{
+ return DumpRenderTreeSupportQt::selectedRange(qobject_cast<QWebPage*>(parent()));
+}
+
+QVariantList TextInputController::firstRectForCharacterRange(int location, int length)
+{
+ return DumpRenderTreeSupportQt::firstRectForCharacterRange(qobject_cast<QWebPage*>(parent()), location, length);
+}