Skip to content

Instantly share code, notes, and snippets.

@kenchris
Created January 5, 2012 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenchris/1565569 to your computer and use it in GitHub Desktop.
Save kenchris/1565569 to your computer and use it in GitHub Desktop.
commit dc7c5f063c750500c0de7f56dd93a96481cf8636
Author: Kenneth Rohde Christiansen <kenneth@webkit.org>
Date: Thu Jan 5 13:54:16 2012 +0100
[Qt] Implement QQuickWebView::inputMethodQuery
Reviewed by NOBODY (OOPS!).
Implement the non-Maliit dependent parts of inputMethodQuery.
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebView::inputMethodQuery):
* UIProcess/API/qt/qquickwebview_p.h:
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index bd50155..0565c9f 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,15 @@
+2012-01-05 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ [Qt] Implement QQuickWebView::inputMethodQuery
+
+ Reviewed by NOBODY (OOPS!).
+
+ Implement the non-Maliit dependent parts of inputMethodQuery.
+
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebView::inputMethodQuery):
+ * UIProcess/API/qt/qquickwebview_p.h:
+
2012-01-05 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Add methods to get/set the WebView zoom level to WebKit2 GTK+ API
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
index 4dbf938..23bcabb 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
@@ -833,6 +833,32 @@ QString QQuickWebView::title() const
return d->webPageProxy->pageTitle();
}
+QVariant QQuickWebView::inputMethodQuery(Qt::InputMethodQuery property) const
+{
+ Q_D(const QQuickWebView);
+ const EditorState& state = d->webPageProxy->editorState();
+
+ switch(property) {
+ case Qt::ImCursorRectangle:
+ return QRectF(state.microFocus);
+ case Qt::ImFont:
+ return QVariant();
+ case Qt::ImCursorPosition:
+ return QVariant(static_cast<int>(state.cursorPosition));
+ case Qt::ImAnchorPosition:
+ return QVariant(static_cast<int>(state.anchorPosition));
+ case Qt::ImSurroundingText:
+ return QString(state.surroundingText);
+ case Qt::ImCurrentSelection:
+ return QString(state.selectedText);
+ case Qt::ImMaximumTextLength:
+ return QVariant(); // No limit.
+ default:
+ // Rely on the base implementation for ImEnabled, ImHints and ImPreferredLanguage.
+ return QQuickItem::inputMethodQuery(property);
+ }
+}
+
QQuickWebViewExperimental* QQuickWebView::experimental() const
{
return m_experimental;
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
index 420453d..f1b4cbb 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
@@ -87,6 +87,8 @@ public:
bool loading() const;
bool canReload() const;
+ virtual QVariant inputMethodQuery(Qt::InputMethodQuery property) const;
+
QQuickWebPage* page();
QQuickWebViewExperimental* experimental() const;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment