https://bugs.webkit.org/show_bug.cgi?id=84434
Patch by Allan Sandfeld Jensen <allan.jensen@nokia.com> on 2012-04-24
Reviewed by Kenneth Rohde Christiansen.
Fix failing test after r114917 by also adding the new EventSender API
to WebKitTestRunner.
* WebKitTestRunner/EventSenderProxy.h:
(EventSenderProxy):
* WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
* WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
(WTR::EventSendingController::setTouchPointRadius):
* WebKitTestRunner/InjectedBundle/EventSendingController.h:
(EventSendingController):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::didReceiveSynchronousMessageFromInjectedBundle):
* WebKitTestRunner/qt/EventSenderProxyQt.cpp:
(WTR::EventSenderProxy::addTouchPoint):
(WTR::EventSenderProxy::updateTouchPoint):
(WTR::EventSenderProxy::setTouchPointRadius):
(WTR::EventSenderProxy::clearTouchPoints):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@115071
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-04-24 Allan Sandfeld Jensen <allan.jensen@nokia.com>
+
+ [Qt][WK2] Convert touch-point area
+ https://bugs.webkit.org/show_bug.cgi?id=84434
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Fix failing test after r114917 by also adding the new EventSender API
+ to WebKitTestRunner.
+
+ * WebKitTestRunner/EventSenderProxy.h:
+ (EventSenderProxy):
+ * WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
+ * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
+ (WTR::EventSendingController::setTouchPointRadius):
+ * WebKitTestRunner/InjectedBundle/EventSendingController.h:
+ (EventSendingController):
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::didReceiveSynchronousMessageFromInjectedBundle):
+ * WebKitTestRunner/qt/EventSenderProxyQt.cpp:
+ (WTR::EventSenderProxy::addTouchPoint):
+ (WTR::EventSenderProxy::updateTouchPoint):
+ (WTR::EventSenderProxy::setTouchPointRadius):
+ (WTR::EventSenderProxy::clearTouchPoints):
+
2012-04-24 Mikhail Naganov <mnaganov@chromium.org>
[Chromium] Unreviewed test expectations update.
void addTouchPoint(int x, int y);
void updateTouchPoint(int index, int x, int y);
void setTouchModifier(WKEventModifiers, bool enable);
+ void setTouchPointRadius(int radiusX, int radiusY);
void touchStart();
void touchMove();
void touchEnd();
#if ENABLE(TOUCH_EVENTS)
QList<QTouchEvent::TouchPoint> m_touchPoints;
Qt::KeyboardModifiers m_touchModifiers;
+ QPoint m_touchPointRadius;
bool m_touchActive;
#endif
#endif
void addTouchPoint(in long x, in long y);
void updateTouchPoint(in long index, in long x, in long y);
void setTouchModifier(in DOMString modifier, in boolean enable);
+ void setTouchPointRadius(in long radiusX, in long radiusY);
void touchStart();
void touchMove();
void touchEnd();
WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
+
+void EventSendingController::setTouchPointRadius(int radiusX, int radiusY)
+{
+ WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
+ WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
+
+ WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
+ WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("SetTouchPointRadius"));
+ WKDictionaryAddItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
+
+ WKRetainPtr<WKStringRef> xKey(AdoptWK, WKStringCreateWithUTF8CString("RadiusX"));
+ WKRetainPtr<WKUInt64Ref> xRef(AdoptWK, WKUInt64Create(radiusX));
+ WKDictionaryAddItem(EventSenderMessageBody.get(), xKey.get(), xRef.get());
+
+ WKRetainPtr<WKStringRef> yKey(AdoptWK, WKStringCreateWithUTF8CString("RadiusY"));
+ WKRetainPtr<WKUInt64Ref> yRef(AdoptWK, WKUInt64Create(radiusY));
+ WKDictionaryAddItem(EventSenderMessageBody.get(), yKey.get(), yRef.get());
+
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+}
+
void EventSendingController::touchStart()
{
WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
void addTouchPoint(int x, int y);
void updateTouchPoint(int index, int x, int y);
void setTouchModifier(const JSStringRef &modifier, bool enable);
+ void setTouchPointRadius(int radiusX, int radiusY);
void touchStart();
void touchMove();
void touchEnd();
return 0;
}
+ if (WKStringIsEqualToUTF8CString(subMessageName, "SetTouchPointRadius")) {
+ WKRetainPtr<WKStringRef> xKey = adoptWK(WKStringCreateWithUTF8CString("RadiusX"));
+ int x = static_cast<int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, xKey.get()))));
+
+ WKRetainPtr<WKStringRef> yKey = adoptWK(WKStringCreateWithUTF8CString("RadiusY"));
+ int y = static_cast<int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, yKey.get()))));
+
+ m_eventSenderProxy->setTouchPointRadius(x, y);
+ return 0;
+ }
+
if (WKStringIsEqualToUTF8CString(subMessageName, "TouchStart")) {
WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), true);
m_eventSenderProxy->touchStart();
point.setPos(pos);
point.setStartPos(pos);
point.setState(Qt::TouchPointPressed);
+ if (!m_touchPointRadius.isNull())
+ point.setRect(QRectF(pos - m_touchPointRadius, pos + m_touchPointRadius));
m_touchPoints.append(point);
}
void EventSenderProxy::updateTouchPoint(int index, int x, int y)
{
ASSERT(index >= 0 && index < m_touchPoints.count());
+ QPointF pos(x, y);
QTouchEvent::TouchPoint &p = m_touchPoints[index];
- p.setPos(QPointF(x, y));
+ p.setPos(pos);
p.setState(Qt::TouchPointMoved);
+ if (!m_touchPointRadius.isNull())
+ p.setRect(QRectF(pos - m_touchPointRadius, pos + m_touchPointRadius));
}
void EventSenderProxy::setTouchModifier(WKEventModifiers modifier, bool enable)
m_touchModifiers &= ~mod;
}
+void EventSenderProxy::setTouchPointRadius(int radiusX, int radiusY)
+{
+ m_touchPointRadius = QPoint(radiusX, radiusY);
+}
+
void EventSenderProxy::touchStart()
{
if (!m_touchActive) {
m_touchPoints.clear();
m_touchModifiers = Qt::KeyboardModifiers();
m_touchActive = false;
+ m_touchPointRadius = QPoint();
}
void EventSenderProxy::releaseTouchPoint(int index)