#include <cstdio>
#include <wtf/PassOwnPtr.h>
-#if PLATFORM(MAC) || PLATFORM(QT)
+#if PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(GTK)
#include "EventSenderProxy.h"
#endif
, m_didPrintWebProcessCrashedMessage(false)
, m_shouldExitWhenWebProcessCrashes(true)
, m_beforeUnloadReturnValue(true)
-#if PLATFORM(MAC) || PLATFORM(QT)
+#if PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(GTK)
, m_eventSenderProxy(new EventSenderProxy(this))
#endif
{
0, // didFirstLayoutForFrame
0, // didFirstVisuallyNonEmptyLayoutForFrame
0, // didRemoveFrameFromHierarchy
+ 0, // didFailToInitializePlugin
0, // didDisplayInsecureContentForFrame
- 0, // didRunInsecureContentForFrame
0, // canAuthenticateAgainstProtectionSpaceInFrame
0, // didReceiveAuthenticationChallengeInFrame
0, // didStartProgress
processDidCrash,
0, // didChangeBackForwardList
0, // shouldGoToBackForwardListItem
- 0 // didFailToInitializePlugin
+ 0, // didRunInsecureContentForFrame
+ 0 // didDetectXSSForFrame
};
WKPageSetPageLoaderClient(m_mainWebView->page(), &pageLoaderClient);
}
WKRetainPtr<WKTypeRef> TestController::didReceiveSynchronousMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody)
{
-#if PLATFORM(MAC) || PLATFORM(QT)
+#if PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(GTK)
if (WKStringIsEqualToUTF8CString(messageName, "EventSender")) {
ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
return 0;
}
+#if PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(GTK)
if (WKStringIsEqualToUTF8CString(subMessageName, "MouseDown") || WKStringIsEqualToUTF8CString(subMessageName, "MouseUp")) {
WKRetainPtr<WKStringRef> buttonKey = adoptWK(WKStringCreateWithUTF8CString("Button"));
unsigned button = static_cast<unsigned>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, buttonKey.get()))));
m_eventSenderProxy->leapForward(time);
return 0;
}
+#endif
+
+#if ENABLE(TOUCH_EVENTS)
+ if (WKStringIsEqualToUTF8CString(subMessageName, "AddTouchPoint")) {
+ WKRetainPtr<WKStringRef> xKey = adoptWK(WKStringCreateWithUTF8CString("X"));
+ int x = static_cast<int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, xKey.get()))));
+
+ WKRetainPtr<WKStringRef> yKey = adoptWK(WKStringCreateWithUTF8CString("Y"));
+ int y = static_cast<int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, yKey.get()))));
+
+ m_eventSenderProxy->addTouchPoint(x, y);
+ return 0;
+ }
+
+ if (WKStringIsEqualToUTF8CString(subMessageName, "UpdateTouchPoint")) {
+ WKRetainPtr<WKStringRef> indexKey = adoptWK(WKStringCreateWithUTF8CString("Index"));
+ int index = static_cast<int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, indexKey.get()))));
+
+ WKRetainPtr<WKStringRef> xKey = adoptWK(WKStringCreateWithUTF8CString("X"));
+ int x = static_cast<int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, xKey.get()))));
+
+ WKRetainPtr<WKStringRef> yKey = adoptWK(WKStringCreateWithUTF8CString("Y"));
+ int y = static_cast<int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, yKey.get()))));
+
+ m_eventSenderProxy->updateTouchPoint(index, x, y);
+ return 0;
+ }
+
+ if (WKStringIsEqualToUTF8CString(subMessageName, "SetTouchModifier")) {
+ WKRetainPtr<WKStringRef> modifierKey = adoptWK(WKStringCreateWithUTF8CString("Modifier"));
+ WKEventModifiers modifier = static_cast<WKEventModifiers>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, modifierKey.get()))));
+
+ WKRetainPtr<WKStringRef> enableKey = adoptWK(WKStringCreateWithUTF8CString("Enable"));
+ bool enable = static_cast<bool>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, enableKey.get()))));
+
+ m_eventSenderProxy->setTouchModifier(modifier, enable);
+ return 0;
+ }
+
+ if (WKStringIsEqualToUTF8CString(subMessageName, "TouchStart")) {
+ WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), true);
+ m_eventSenderProxy->touchStart();
+ WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), false);
+ return 0;
+ }
+
+ if (WKStringIsEqualToUTF8CString(subMessageName, "TouchMove")) {
+ WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), true);
+ m_eventSenderProxy->touchMove();
+ WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), false);
+ return 0;
+ }
+ if (WKStringIsEqualToUTF8CString(subMessageName, "TouchEnd")) {
+ WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), true);
+ m_eventSenderProxy->touchEnd();
+ WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), false);
+ return 0;
+ }
+
+ if (WKStringIsEqualToUTF8CString(subMessageName, "ClearTouchPoints")) {
+ m_eventSenderProxy->clearTouchPoints();
+ return 0;
+ }
+
+ if (WKStringIsEqualToUTF8CString(subMessageName, "ReleaseTouchPoint")) {
+ WKRetainPtr<WKStringRef> indexKey = adoptWK(WKStringCreateWithUTF8CString("Index"));
+ int index = static_cast<int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, indexKey.get()))));
+ m_eventSenderProxy->releaseTouchPoint(index);
+ return 0;
+ }
+#endif
ASSERT_NOT_REACHED();
}
#endif