Created
January 9, 2012 16:35
-
-
Save kenchris/1583732 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit e2aa0f79a4cd5d3eb8ab72472b4ab4d0f25c4c37 | |
Author: Kenneth Rohde Christiansen <[email protected]> | |
Date: Mon Jan 9 17:19:40 2012 +0100 | |
WIP | |
diff --git a/Source/WebKit2/UIProcess/PageClient.h b/Source/WebKit2/UIProcess/PageClient.h | |
index 1db4eaa..16fc879 100644 | |
--- a/Source/WebKit2/UIProcess/PageClient.h | |
+++ b/Source/WebKit2/UIProcess/PageClient.h | |
@@ -106,6 +106,7 @@ public: | |
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 @@ public: | |
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 | |
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp | |
index 15abf9c..452a435 100644 | |
--- a/Source/WebKit2/UIProcess/WebPageProxy.cpp | |
+++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp | |
@@ -968,6 +968,8 @@ void WebPageProxy::handleGestureEvent(const WebGestureEvent& event) | |
if (!isValid()) | |
return; | |
+ m_gestureEventQueue.append(event); | |
+ | |
process()->responsivenessTimer()->start(); | |
process()->send(Messages::EventDispatcher::GestureEvent(m_pageID, event), 0); | |
} | |
@@ -2427,6 +2429,8 @@ void WebPageProxy::editorStateChanged(const EditorState& editorState) | |
#if PLATFORM(MAC) | |
m_pageClient->updateTextInputState(couldChangeSecureInputState); | |
+#elif PLATFORM(QT) | |
+ m_pageClient->updateTextInputState(); | |
#endif | |
} | |
@@ -2911,9 +2915,15 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled) | |
#if ENABLE(GESTURE_EVENTS) | |
case WebEvent::GestureScrollBegin: | |
case WebEvent::GestureScrollEnd: | |
- case WebEvent::GestureSingleTap: | |
-#endif | |
+ case WebEvent::GestureSingleTap: { | |
+ WebGestureEvent event = m_gestureEventQueue.first(); | |
+ MESSAGE_CHECK(type == event.type()); | |
+ | |
+ m_gestureEventQueue.removeFirst(); | |
+ m_pageClient->doneWithGestureEvent(event, handled); | |
break; | |
+ } | |
+#endif | |
case WebEvent::MouseUp: | |
m_currentlyProcessedMouseDownEvent = nullptr; | |
break; | |
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h | |
index 42a18f3..9a51b36 100644 | |
--- a/Source/WebKit2/UIProcess/WebPageProxy.h | |
+++ b/Source/WebKit2/UIProcess/WebPageProxy.h | |
@@ -952,6 +952,7 @@ private: | |
WebCore::PolicyAction m_syncNavigationActionPolicyAction; | |
uint64_t m_syncNavigationActionPolicyDownloadID; | |
+ Deque<WebGestureEvent> m_gestureEventQueue; | |
Deque<NativeWebKeyboardEvent> m_keyEventQueue; | |
Deque<NativeWebWheelEvent> m_wheelEventQueue; | |
Vector<NativeWebWheelEvent> m_currentlyProcessedWheelEvents; | |
diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp | |
index b173776..cc96876 100644 | |
--- a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp | |
+++ b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp | |
@@ -195,6 +195,20 @@ void QtPageClient::didReceiveMessageFromNavigatorQtObject(const String& message) | |
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) | |
{ | |
diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.h b/Source/WebKit2/UIProcess/qt/QtPageClient.h | |
index a3149b6..7715026 100644 | |
--- a/Source/WebKit2/UIProcess/qt/QtPageClient.h | |
+++ b/Source/WebKit2/UIProcess/qt/QtPageClient.h | |
@@ -93,10 +93,9 @@ public: | |
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; | |
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp | |
index 2576e85..b18d7d9 100644 | |
--- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp | |
+++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp | |
@@ -91,6 +91,7 @@ QtWebPageEventHandler::QtWebPageEventHandler(WKPageRef pageRef, QQuickWebPage* q | |
, m_webPage(qmlWebPage) | |
, m_previousClickButton(Qt::NoButton) | |
, m_clickCount(0) | |
+ , m_postponeTextInputStateChanged(false) | |
{ | |
} | |
@@ -282,6 +283,8 @@ bool QtWebPageEventHandler::handleDropEvent(QDropEvent* ev) | |
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 +420,28 @@ void QtWebPageEventHandler::resetGestureRecognizers() | |
m_tapGestureRecognizer.reset(); | |
} | |
+void QtWebPageEventHandler::updateTextInputState() | |
+{ | |
+ if (m_postponeTextInputStateChanged) | |
+ return; | |
+ | |
+ if (m_webPageProxy->editorState().isContentEditable) | |
+ printf("request!\n"); | |
+ else | |
+ printf("close\n"); | |
+} | |
+ | |
+void QtWebPageEventHandler::doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled) | |
+{ | |
+ if (event.type() != WebEvent::GestureSingleTap) | |
+ return; | |
+ | |
+ m_postponeTextInputStateChanged = false; | |
+ | |
+ if (wasEventHandled) | |
+ updateTextInputState(); | |
+} | |
+ | |
void QtWebPageEventHandler::doneWithTouchEvent(const NativeWebTouchEvent& event, bool wasEventHandled) | |
{ | |
if (!m_interactionEngine) | |
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h | |
index f2de6c7..f5b7fb3 100644 | |
--- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h | |
+++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h | |
@@ -52,6 +52,8 @@ public: | |
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 @@ private: | |
QBasicTimer m_clickTimer; | |
Qt::MouseButton m_previousClickButton; | |
int m_clickCount; | |
+ bool m_postponeTextInputStateChanged; | |
}; | |
#endif /* QtWebPageEventHandler_h */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment