- Revision
- 104557
- Author
- [email protected]
- Date
- 2012-01-10 05:25:27 -0800 (Tue, 10 Jan 2012)
Log Message
Implement the input panel request/close handling
Reviewed by Simon Hausmann.
With the current patch we only request the input panel as a
response to a user tap. Close requests, on the other hand,
is always respected.
As multiple show/hide requests can happen while processing
the tap gesture, input panel visibility changes are postponed
until the tap gesture ends.
The input panel will become visible if the WebCore editor is
in canEdit mode and thus work for content-editable, meaning
that it won't close the input panel if you click on a link
(eg. editCommand) while in content-editable mode.
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleGestureEvent):
(WebKit::WebPageProxy::editorStateChanged):
(WebKit::WebPageProxy::didReceiveEvent):
Add a new doneWithGestureEvent method to the PageClient
as well as add a updateTextInputState similar to that of mac.
* UIProcess/WebPageProxy.h:
* UIProcess/qt/QtPageClient.cpp:
(QtPageClient::updateTextInputState):
(QtPageClient::doneWithGestureEvent):
Propagate the new events to the Qt EventHandler.
* UIProcess/qt/QtPageClient.h:
* UIProcess/qt/QtWebPageEventHandler.cpp:
* UIProcess/qt/QtWebPageEventHandler.h:
(QtWebPageEventHandler::QtWebPageEventHandler):
(QtWebPageEventHandler::handleSingleTapEvent):
(setInputPanelVisible):
(QtWebPageEventHandler::updateTextInputState):
(QtWebPageEventHandler::doneWithGestureEvent):
Handle postponing of the input method visibility change
and the actual showing/hiding.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (104556 => 104557)
--- trunk/Source/WebKit2/ChangeLog 2012-01-10 13:24:58 UTC (rev 104556)
+++ trunk/Source/WebKit2/ChangeLog 2012-01-10 13:25:27 UTC (rev 104557)
@@ -1,3 +1,50 @@
+2012-01-10 Kenneth Rohde Christiansen <[email protected]>
+
+ Implement the input panel request/close handling
+
+ Reviewed by Simon Hausmann.
+
+ With the current patch we only request the input panel as a
+ response to a user tap. Close requests, on the other hand,
+ is always respected.
+
+ As multiple show/hide requests can happen while processing
+ the tap gesture, input panel visibility changes are postponed
+ until the tap gesture ends.
+
+ The input panel will become visible if the WebCore editor is
+ in canEdit mode and thus work for content-editable, meaning
+ that it won't close the input panel if you click on a link
+ (eg. editCommand) while in content-editable mode.
+
+ * UIProcess/PageClient.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::handleGestureEvent):
+ (WebKit::WebPageProxy::editorStateChanged):
+ (WebKit::WebPageProxy::didReceiveEvent):
+
+ Add a new doneWithGestureEvent method to the PageClient
+ as well as add a updateTextInputState similar to that of mac.
+
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/qt/QtPageClient.cpp:
+ (QtPageClient::updateTextInputState):
+ (QtPageClient::doneWithGestureEvent):
+
+ Propagate the new events to the Qt EventHandler.
+
+ * UIProcess/qt/QtPageClient.h:
+ * UIProcess/qt/QtWebPageEventHandler.cpp:
+ * UIProcess/qt/QtWebPageEventHandler.h:
+ (QtWebPageEventHandler::QtWebPageEventHandler):
+ (QtWebPageEventHandler::handleSingleTapEvent):
+ (setInputPanelVisible):
+ (QtWebPageEventHandler::updateTextInputState):
+ (QtWebPageEventHandler::doneWithGestureEvent):
+
+ Handle postponing of the input method visibility change
+ and the actual showing/hiding.
+
2012-01-10 Eunmi Lee <[email protected]>
[EFL][WK2] Remove codes to move and resize the clip.
Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (104556 => 104557)
--- trunk/Source/WebKit2/UIProcess/PageClient.h 2012-01-10 13:24:58 UTC (rev 104556)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h 2012-01-10 13:25:27 UTC (rev 104557)
@@ -106,6 +106,7 @@
virtual void focusEditableArea(const WebCore::IntRect&, const WebCore::IntRect&) = 0;
virtual void didReceiveMessageFromNavigatorQtObject(const String&) = 0;
virtual void handleDownloadRequest(DownloadProxy*) = 0;
+ virtual void updateTextInputState() = 0;
#endif
#if PLATFORM(QT) || PLATFORM(GTK)
@@ -141,6 +142,9 @@
virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) = 0;
virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) = 0;
+#if ENABLE(GESTURE_EVENTS)
+ virtual void doneWithGestureEvent(const WebGestureEvent&, bool wasEventHandled) = 0;
+#endif
#if ENABLE(TOUCH_EVENTS)
virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) = 0;
#endif
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (104556 => 104557)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2012-01-10 13:24:58 UTC (rev 104556)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2012-01-10 13:25:27 UTC (rev 104557)
@@ -968,6 +968,8 @@
if (!isValid())
return;
+ m_gestureEventQueue.append(event);
+
process()->responsivenessTimer()->start();
process()->send(Messages::EventDispatcher::GestureEvent(m_pageID, event), 0);
}
@@ -2427,6 +2429,8 @@
#if PLATFORM(MAC)
m_pageClient->updateTextInputState(couldChangeSecureInputState);
+#elif PLATFORM(QT)
+ m_pageClient->updateTextInputState();
#endif
}
@@ -2911,9 +2915,15 @@
#if ENABLE(GESTURE_EVENTS)
case WebEvent::GestureScrollBegin:
case WebEvent::GestureScrollEnd:
- case WebEvent::GestureSingleTap:
+ case WebEvent::GestureSingleTap: {
+ WebGestureEvent event = m_gestureEventQueue.first();
+ MESSAGE_CHECK(type == event.type());
+
+ m_gestureEventQueue.removeFirst();
+ m_pageClient->doneWithGestureEvent(event, handled);
+ break;
+ }
#endif
- break;
case WebEvent::MouseUp:
m_currentlyProcessedMouseDownEvent = nullptr;
break;
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (104556 => 104557)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2012-01-10 13:24:58 UTC (rev 104556)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2012-01-10 13:25:27 UTC (rev 104557)
@@ -952,6 +952,7 @@
WebCore::PolicyAction m_syncNavigationActionPolicyAction;
uint64_t m_syncNavigationActionPolicyDownloadID;
+ Deque<WebGestureEvent> m_gestureEventQueue;
Deque<NativeWebKeyboardEvent> m_keyEventQueue;
Deque<NativeWebWheelEvent> m_wheelEventQueue;
Vector<NativeWebWheelEvent> m_currentlyProcessedWheelEvents;
Modified: trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp (104556 => 104557)
--- trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp 2012-01-10 13:24:58 UTC (rev 104556)
+++ trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp 2012-01-10 13:25:27 UTC (rev 104557)
@@ -195,6 +195,20 @@
QQuickWebViewPrivate::get(m_webView)->didReceiveMessageFromNavigatorQtObject(message);
}
+void QtPageClient::updateTextInputState()
+{
+ ASSERT(m_eventHandler);
+ m_eventHandler->updateTextInputState();
+}
+
+#if ENABLE(GESTURE_EVENTS)
+void QtPageClient::doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled)
+{
+ ASSERT(m_eventHandler);
+ m_eventHandler->doneWithGestureEvent(event, wasEventHandled);
+}
+#endif
+
#if ENABLE(TOUCH_EVENTS)
void QtPageClient::doneWithTouchEvent(const NativeWebTouchEvent& event, bool wasEventHandled)
{
Modified: trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h (104556 => 104557)
--- trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h 2012-01-10 13:24:58 UTC (rev 104556)
+++ trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h 2012-01-10 13:25:27 UTC (rev 104557)
@@ -93,10 +93,9 @@
virtual void countStringMatchesInCustomRepresentation(const String&, WebKit::FindOptions, unsigned maxMatchCount) { }
virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&);
virtual void focusEditableArea(const WebCore::IntRect&, const WebCore::IntRect&);
-
-#if ENABLE(TOUCH_EVENTS)
+ virtual void updateTextInputState();
+ virtual void doneWithGestureEvent(const WebGestureEvent&, bool wasEventHandled);
virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled);
-#endif
private:
QQuickWebView* m_webView;
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp (104556 => 104557)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp 2012-01-10 13:24:58 UTC (rev 104556)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp 2012-01-10 13:25:27 UTC (rev 104557)
@@ -29,6 +29,7 @@
#include <QDrag>
#include <QGraphicsSceneMouseEvent>
#include <QGuiApplication>
+#include <QInputPanel>
#include <QMimeData>
#include <QtQuick/QQuickCanvas>
#include <QStyleHints>
@@ -91,6 +92,7 @@
, m_webPage(qmlWebPage)
, m_previousClickButton(Qt::NoButton)
, m_clickCount(0)
+ , m_postponeTextInputStateChanged(false)
{
}
@@ -282,6 +284,8 @@
void QtWebPageEventHandler::handleSingleTapEvent(const QTouchEvent::TouchPoint& point)
{
+ m_postponeTextInputStateChanged = true;
+
QTransform fromItemTransform = m_webPage->transformFromItem();
WebGestureEvent gesture(WebEvent::GestureSingleTap, fromItemTransform.map(point.pos()).toPoint(), point.screenPos().toPoint(), WebEvent::Modifiers(0), 0);
m_webPageProxy->handleGestureEvent(gesture);
@@ -417,6 +421,42 @@
m_tapGestureRecognizer.reset();
}
+static void setInputPanelVisible(bool visible)
+{
+ if (qApp->inputPanel()->visible() == visible)
+ return;
+
+ qApp->inputPanel()->setVisible(visible);
+}
+
+void QtWebPageEventHandler::updateTextInputState()
+{
+ if (m_postponeTextInputStateChanged)
+ return;
+
+ const EditorState& editor = m_webPageProxy->editorState();
+
+ // Ignore input method requests not due to a tap gesture.
+ if (!editor.isContentEditable)
+ setInputPanelVisible(false);
+}
+
+void QtWebPageEventHandler::doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled)
+{
+ if (event.type() != WebEvent::GestureSingleTap)
+ return;
+
+ m_postponeTextInputStateChanged = false;
+
+ if (!wasEventHandled)
+ return;
+
+ const EditorState& editor = m_webPageProxy->editorState();
+ bool newVisible = editor.isContentEditable;
+
+ setInputPanelVisible(newVisible);
+}
+
void QtWebPageEventHandler::doneWithTouchEvent(const NativeWebTouchEvent& event, bool wasEventHandled)
{
if (!m_interactionEngine)
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h (104556 => 104557)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h 2012-01-10 13:24:58 UTC (rev 104556)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h 2012-01-10 13:25:27 UTC (rev 104557)
@@ -52,6 +52,8 @@
void didFindZoomableArea(const WebCore::IntPoint& target, const WebCore::IntRect& area);
void focusEditableArea(const WebCore::IntRect& caret, const WebCore::IntRect& area);
+ void updateTextInputState();
+ void doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled);
void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled);
void resetGestureRecognizers();
@@ -92,6 +94,7 @@
QBasicTimer m_clickTimer;
Qt::MouseButton m_previousClickButton;
int m_clickCount;
+ bool m_postponeTextInputStateChanged;
};
#endif /* QtWebPageEventHandler_h */