Changeset 152147 in webkit
- Timestamp:
- Jun 27, 2013 6:53:32 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 1 added
- 14 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r152110 r152147 1 2013-06-27 Eunmi Lee <eunmi15.lee@samsung.com> 2 3 [EFL][WK2] Add WK2 C API to handle touch events. 4 https://bugs.webkit.org/show_bug.cgi?id=108915 5 6 Reviewed by Gyuyoung Kim. 7 8 Touch events for our target platforms differ (XInput2, Wayland, Tizen) so 9 for the EFL port we want to be able to feed events manually. 10 11 To keep our current API for desktop EFL/Enlightenment working, we convert 12 our currently limited EFL events to the new EFL specific C EwkTouchPoint 13 and EwkTouchEvent type. 14 15 EwkTouchPoint and EwkTouchEvent are exposed as WKTouchPointRef and 16 WKTouchEventRef, so they are opaque in the applications. 17 18 The WKViewSendTouchEvent can be used for any use-case (platform/product) 19 not involving the EFL events. 20 21 At the same time we make sure to avoid using WK2 internals in our EFL API 22 implementation. 23 24 * PlatformEfl.cmake: 25 * Shared/API/c/efl/WKBaseEfl.h: 26 * Shared/APIObject.h: 27 * Shared/NativeWebTouchEvent.h: 28 (WebKit::NativeWebTouchEvent::nativeEvent): 29 * Shared/efl/NativeWebTouchEventEfl.cpp: 30 (WebKit::NativeWebTouchEvent::NativeWebTouchEvent): 31 * Shared/efl/WebEventFactory.cpp: 32 (WebKit::toWebPlatformTouchPointState): 33 (WebKit::toWebEventType): 34 (WebKit::toWebEventModifiers): 35 (WebKit::WebEventFactory::createWebTouchEvent): 36 * Shared/efl/WebEventFactory.h: 37 * UIProcess/API/C/efl/WKAPICastEfl.h: 38 * UIProcess/API/C/efl/WKEventEfl.cpp: Added. 39 (WKTouchPointCreate): 40 (WKTouchEventCreate): 41 * UIProcess/API/C/efl/WKEventEfl.h: Added. 42 * UIProcess/API/C/efl/WKViewEfl.cpp: 43 (WKViewSendTouchEvent): 44 * UIProcess/API/C/efl/WKViewEfl.h: 45 * UIProcess/API/efl/EwkView.cpp: 46 (toWKTouchPointState): 47 (toWKEventModifiers): 48 (EwkView::feedTouchEvent): 49 (EwkView::feedTouchEvents): 50 * UIProcess/efl/EwkTouchEvent.cpp: Added. 51 (WebKit::EwkTouchEvent::EwkTouchEvent): 52 * UIProcess/efl/EwkTouchEvent.h: Added. 53 (WebKit::EwkTouchEvent::create): 54 (WebKit::EwkTouchEvent::eventType): 55 (WebKit::EwkTouchEvent::touchPoints): 56 (WebKit::EwkTouchEvent::modifiers): 57 (WebKit::EwkTouchEvent::timestamp): 58 (WebKit::EwkTouchEvent::type): 59 * UIProcess/efl/EwkTouchPoint.cpp: Added. 60 (WebKit::EwkTouchPoint::EwkTouchPoint): 61 * UIProcess/efl/EwkTouchPoint.h: Added. 62 (WebKit::EwkTouchPoint::create): 63 (WebKit::EwkTouchPoint::id): 64 (WebKit::EwkTouchPoint::state): 65 (WebKit::EwkTouchPoint::screenPosition): 66 (WebKit::EwkTouchPoint::position): 67 (WebKit::EwkTouchPoint::radius): 68 (WebKit::EwkTouchPoint::rotationAngle): 69 (WebKit::EwkTouchPoint::forceFactor): 70 (WebKit::EwkTouchPoint::type): 71 * UIProcess/efl/WebViewEfl.cpp: 72 (WebKit::WebViewEfl::sendTouchEvent): 73 * UIProcess/efl/WebViewEfl.h: 74 1 75 2013-06-27 Csaba Osztrogonác <ossy@webkit.org> 2 76 -
trunk/Source/WebKit2/PlatformEfl.cmake
r150460 r152147 50 50 UIProcess/API/C/CoordinatedGraphics/WKView.cpp 51 51 52 UIProcess/API/C/efl/WKEventEfl.cpp 52 53 UIProcess/API/C/efl/WKPageEfl.cpp 53 54 UIProcess/API/C/efl/WKPopupItem.cpp … … 105 106 UIProcess/efl/ContextMenuClientEfl.cpp 106 107 UIProcess/efl/DownloadManagerEfl.cpp 108 UIProcess/efl/EwkTouchEvent.cpp 109 UIProcess/efl/EwkTouchPoint.cpp 107 110 UIProcess/efl/FindClientEfl.cpp 108 111 UIProcess/efl/FormClientEfl.cpp -
trunk/Source/WebKit2/Shared/API/c/efl/WKBaseEfl.h
r143275 r152147 28 28 typedef const struct OpaqueWKPopupItem* WKPopupItemRef; 29 29 typedef const struct OpaqueWKPopupMenuListener* WKPopupMenuListenerRef; 30 typedef const struct OpaqueWKTouchPoint* WKTouchPointRef; 31 typedef const struct OpaqueWKTouchEvent* WKTouchEventRef; 30 32 31 33 #endif /* WKBaseEfl_h */ -
trunk/Source/WebKit2/Shared/APIObject.h
r149417 r152147 138 138 #if PLATFORM(EFL) 139 139 TypePopupMenuItem, 140 #if ENABLE(TOUCH_EVENTS) 141 TypeTouchPoint, 142 TypeTouchEvent, 143 #endif 140 144 #endif 141 145 }; -
trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h
r133012 r152147 32 32 #include <QTouchEvent> 33 33 #elif PLATFORM(EFL) 34 #include "ewk_touch.h" 35 #include <Evas.h> 34 #include "EwkTouchEvent.h" 36 35 #include <WebCore/AffineTransform.h> 36 #include <wtf/RefPtr.h> 37 37 #endif 38 38 … … 44 44 explicit NativeWebTouchEvent(const QTouchEvent*, const QTransform& fromItemTransform); 45 45 #elif PLATFORM(EFL) 46 NativeWebTouchEvent(Ewk _Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen, double timestamp);46 NativeWebTouchEvent(EwkTouchEvent*, const WebCore::AffineTransform&); 47 47 #endif 48 48 49 49 #if PLATFORM(QT) 50 50 const QTouchEvent* nativeEvent() const { return &m_nativeEvent; } 51 #elif PLATFORM(EFL) 52 const EwkTouchEvent* nativeEvent() const { return m_nativeEvent.get(); } 51 53 #endif 52 54 … … 54 56 #if PLATFORM(QT) 55 57 const QTouchEvent m_nativeEvent; 58 #elif PLATFORM(EFL) 59 RefPtr<EwkTouchEvent> m_nativeEvent; 56 60 #endif 57 61 }; -
trunk/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp
r139287 r152147 33 33 namespace WebKit { 34 34 35 NativeWebTouchEvent::NativeWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen, double timestamp) 36 : WebTouchEvent(WebEventFactory::createWebTouchEvent(type, points, modifiers, toWebContent, toDeviceScreen, timestamp)) 35 NativeWebTouchEvent::NativeWebTouchEvent(EwkTouchEvent* touchEvent, const WebCore::AffineTransform& toWebContent) 36 : WebTouchEvent(WebEventFactory::createWebTouchEvent(touchEvent, toWebContent)) 37 , m_nativeEvent(touchEvent) 37 38 { 38 39 } -
trunk/Source/WebKit2/Shared/efl/WebEventFactory.cpp
r144898 r152147 32 32 #include <WebCore/Scrollbar.h> 33 33 34 #if ENABLE(TOUCH_EVENTS) 35 #include "EwkTouchEvent.h" 36 #include "EwkTouchPoint.h" 37 #include "ImmutableArray.h" 38 #include "WKAPICast.h" 39 #endif 40 34 41 using namespace WebCore; 35 42 … … 206 213 207 214 #if ENABLE(TOUCH_EVENTS) 208 static inline WebEvent::Type typeForTouchEvent(Ewk_Touch_Event_Type type) 209 { 210 if (type == EWK_TOUCH_START) 215 static inline WebPlatformTouchPoint::TouchPointState toWebPlatformTouchPointState(WKTouchPointState state) 216 { 217 switch (state) { 218 case kWKTouchPointStateTouchReleased: 219 return WebPlatformTouchPoint::TouchReleased; 220 case kWKTouchPointStateTouchMoved: 221 return WebPlatformTouchPoint::TouchMoved; 222 case kWKTouchPointStateTouchPressed: 223 return WebPlatformTouchPoint::TouchPressed; 224 case kWKTouchPointStateTouchStationary: 225 return WebPlatformTouchPoint::TouchStationary; 226 case kWKTouchPointStateTouchCancelled: 227 default: 228 return WebPlatformTouchPoint::TouchCancelled; 229 } 230 } 231 232 static inline WebEvent::Type toWebEventType(WKEventType type) 233 { 234 switch (type) { 235 case kWKEventTypeTouchStart: 211 236 return WebEvent::TouchStart; 212 if (type == EWK_TOUCH_MOVE)237 case kWKEventTypeTouchMove: 213 238 return WebEvent::TouchMove; 214 if (type == EWK_TOUCH_END)239 case kWKEventTypeTouchEnd: 215 240 return WebEvent::TouchEnd; 216 if (type == EWK_TOUCH_CANCEL)241 case kWKEventTypeTouchCancel: 217 242 return WebEvent::TouchCancel; 218 219 return WebEvent::NoType; 220 } 221 222 WebTouchEvent WebEventFactory::createWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const AffineTransform& toWebContent, const AffineTransform& toDeviceScreen, double timestamp) 223 { 243 default: 244 return WebEvent::NoType; 245 } 246 247 } 248 249 static inline WebEvent::Modifiers toWebEventModifiers(unsigned modifiers) 250 { 251 unsigned result = 0; 252 253 if (modifiers & kWKEventModifiersShiftKey) 254 result |= WebEvent::ShiftKey; 255 if (modifiers & kWKEventModifiersControlKey) 256 result |= WebEvent::ControlKey; 257 if (modifiers & kWKEventModifiersAltKey) 258 result |= WebEvent::AltKey; 259 if (modifiers & kWKEventModifiersMetaKey) 260 result |= WebEvent::MetaKey; 261 262 return static_cast<WebEvent::Modifiers>(result); 263 } 264 265 WebTouchEvent WebEventFactory::createWebTouchEvent(const EwkTouchEvent* event, const AffineTransform& toWebContent) 266 { 267 ImmutableArray* touchPointsArray = toImpl(event->touchPoints()); 268 size_t size = touchPointsArray->size(); 269 224 270 Vector<WebPlatformTouchPoint> touchPoints; 225 touchPoints.reserveInitialCapacity(eina_list_count(points)); 226 227 const Eina_List* list; 228 void* item; 229 EINA_LIST_FOREACH(points, list, item) { 230 Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(item); 231 232 WebPlatformTouchPoint::TouchPointState state; 233 switch (point->state) { 234 case EVAS_TOUCH_POINT_UP: 235 state = WebPlatformTouchPoint::TouchReleased; 236 break; 237 case EVAS_TOUCH_POINT_MOVE: 238 state = WebPlatformTouchPoint::TouchMoved; 239 break; 240 case EVAS_TOUCH_POINT_DOWN: 241 state = WebPlatformTouchPoint::TouchPressed; 242 break; 243 case EVAS_TOUCH_POINT_STILL: 244 state = WebPlatformTouchPoint::TouchStationary; 245 break; 246 case EVAS_TOUCH_POINT_CANCEL: 247 state = WebPlatformTouchPoint::TouchCancelled; 248 break; 249 default: 250 ASSERT_NOT_REACHED(); 251 continue; 252 } 253 254 IntPoint pos(point->x, point->y); 255 touchPoints.uncheckedAppend(WebPlatformTouchPoint(point->id, state, toDeviceScreen.mapPoint(pos), toWebContent.mapPoint(pos))); 256 } 257 258 return WebTouchEvent(typeForTouchEvent(type), touchPoints, modifiersForEvent(modifiers), timestamp); 271 touchPoints.reserveInitialCapacity(size); 272 273 for (size_t i = 0; i < size; ++i) { 274 if (EwkTouchPoint* point = touchPointsArray->at<EwkTouchPoint>(i)) 275 touchPoints.uncheckedAppend(WebPlatformTouchPoint(point->id(), toWebPlatformTouchPointState(point->state()), toIntPoint(point->screenPosition()), toWebContent.mapPoint(toIntPoint(point->position())), toIntSize(point->radius()), point->rotationAngle(), point->forceFactor())); 276 } 277 278 return WebTouchEvent(toWebEventType(event->eventType()), touchPoints, toWebEventModifiers(event->modifiers()), event->timestamp()); 259 279 } 260 280 #endif -
trunk/Source/WebKit2/Shared/efl/WebEventFactory.h
r133012 r152147 28 28 29 29 #include "WebEvent.h" 30 #include "ewk_touch.h"31 30 #include <Evas.h> 32 31 #include <WebCore/AffineTransform.h> 33 32 34 33 namespace WebKit { 34 35 #if ENABLE(TOUCH_EVENTS) 36 class EwkTouchEvent; 37 #endif 35 38 36 39 class WebEventFactory { … … 43 46 static WebKeyboardEvent createWebKeyboardEvent(const Evas_Event_Key_Up*); 44 47 #if ENABLE(TOUCH_EVENTS) 45 static WebTouchEvent createWebTouchEvent( Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const WebCore::AffineTransform&, const WebCore::AffineTransform&, double timestamp);48 static WebTouchEvent createWebTouchEvent(const EwkTouchEvent*, const WebCore::AffineTransform&); 46 49 #endif 47 50 }; -
trunk/Source/WebKit2/UIProcess/API/C/efl/WKAPICastEfl.h
r143275 r152147 38 38 WK_ADD_API_MAPPING(WKPopupMenuListenerRef, WebPopupMenuListenerEfl) 39 39 40 #if ENABLE(TOUCH_EVENTS) 41 class EwkTouchEvent; 42 class EwkTouchPoint; 43 44 WK_ADD_API_MAPPING(WKTouchEventRef, EwkTouchEvent) 45 WK_ADD_API_MAPPING(WKTouchPointRef, EwkTouchPoint) 46 #endif 47 40 48 // Enum conversions. 41 49 inline WKPopupItemTextDirection toAPI(WebCore::TextDirection direction) -
trunk/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.cpp
r152144 r152147 1 1 /* 2 * Copyright (C) 2013 Intel Corporation. All rights reserved.2 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 25 25 26 26 #include "config.h" 27 #include "WK ViewEfl.h"27 #include "WKEventEfl.h" 28 28 29 #include "EwkView.h" 29 #include "EwkTouchEvent.h" 30 #include "EwkTouchPoint.h" 31 #include "ImmutableArray.h" 30 32 #include "WKAPICast.h" 31 #include "WebViewEfl.h" 32 #include <WebKit2/WKImageCairo.h> 33 #include "WebEvent.h" 33 34 34 35 using namespace WebKit; 35 36 36 void WKViewPaintToCairoSurface(WKViewRef viewRef, cairo_surface_t* surface)37 WKTouchPointRef WKTouchPointCreate(int id, WKPoint position, WKPoint screenPosition, WKTouchPointState state, WKSize radius, float rotationAngle, float forceFactor) 37 38 { 38 static_cast<WebViewEfl*>(toImpl(viewRef))->paintToCairoSurface(surface); 39 #if ENABLE(TOUCH_EVENTS) 40 return toAPI(EwkTouchPoint::create(id, state, screenPosition, position, radius, rotationAngle, forceFactor).leakRef()); 41 #else 42 UNUSED_PARAM(id); 43 UNUSED_PARAM(position); 44 UNUSED_PARAM(screenPosition); 45 UNUSED_PARAM(state); 46 UNUSED_PARAM(radius); 47 UNUSED_PARAM(rotationAngle); 48 UNUSED_PARAM(forceFactor); 49 return 0; 50 #endif 39 51 } 40 52 41 WK ImageRef WKViewCreateSnapshot(WKViewRef viewRef)53 WKTouchEventRef WKTouchEventCreate(WKEventType type, WKArrayRef wkTouchPoints, WKEventModifiers modifiers, double timestamp) 42 54 { 43 EwkView* ewkView = static_cast<WebViewEfl*>(toImpl(viewRef))->ewkView(); 44 return WKImageCreateFromCairoSurface(ewkView->takeSnapshot().get(), 0 /* options */); 55 #if ENABLE(TOUCH_EVENTS) 56 return toAPI(EwkTouchEvent::create(type, wkTouchPoints, modifiers, timestamp).leakRef()); 57 #else 58 UNUSED_PARAM(type); 59 UNUSED_PARAM(wkTouchPoints); 60 UNUSED_PARAM(modifiers); 61 UNUSED_PARAM(timestamp); 62 return 0; 63 #endif 45 64 } 46 47 void WKViewSetThemePath(WKViewRef viewRef, WKStringRef theme)48 {49 static_cast<WebViewEfl*>(toImpl(viewRef))->setThemePath(toImpl(theme)->string());50 } -
trunk/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.h
r152144 r152147 1 1 /* 2 * Copyright (C) 2013 Intel Corporation. All rights reserved. 2 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2012-2013 Nokia Corporation and/or its subsidiary(-ies). 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 24 25 */ 25 26 26 #ifndef WK ViewEfl_h27 #define WK ViewEfl_h27 #ifndef WKEventEfl_h 28 #define WKEventEfl_h 28 29 29 #include <WebKit2/WKBase.h> 30 31 typedef struct _cairo_surface cairo_surface_t; 30 #include <WebKit2/WKEvent.h> 31 #include <WebKit2/WKGeometry.h> 32 32 33 33 #ifdef __cplusplus … … 35 35 #endif 36 36 37 WK_EXPORT void WKViewPaintToCairoSurface(WKViewRef, cairo_surface_t*); 37 enum WKEventType { 38 kWKEventTypeNoType = -1, 39 kWKEventTypeTouchStart, 40 kWKEventTypeTouchMove, 41 kWKEventTypeTouchEnd, 42 kWKEventTypeTouchCancel 43 }; 44 typedef enum WKEventType WKEventType; 38 45 39 WK_EXPORT WKImageRef WKViewCreateSnapshot(WKViewRef); 46 enum WKTouchPointState { 47 kWKTouchPointStateTouchReleased, 48 kWKTouchPointStateTouchPressed, 49 kWKTouchPointStateTouchMoved, 50 kWKTouchPointStateTouchStationary, 51 kWKTouchPointStateTouchCancelled 52 }; 53 typedef enum WKTouchPointState WKTouchPointState; 40 54 41 WK_EXPORT void WKViewSetThemePath(WKViewRef, WKStringRef); 55 WK_EXPORT WKTouchPointRef WKTouchPointCreate(int id, WKPoint position, WKPoint screenPosition, WKTouchPointState, WKSize radius, float rotationAngle, float forceFactor); 56 WK_EXPORT WKTouchEventRef WKTouchEventCreate(WKEventType, WKArrayRef, WKEventModifiers, double timestamp); 42 57 43 58 #ifdef __cplusplus … … 45 60 #endif 46 61 47 #endif /* WK ViewEfl_h */62 #endif /* WKEventEfl_h */ -
trunk/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.cpp
r149902 r152147 49 49 static_cast<WebViewEfl*>(toImpl(viewRef))->setThemePath(toImpl(theme)->string()); 50 50 } 51 52 void WKViewSendTouchEvent(WKViewRef viewRef, WKTouchEventRef touchEventRef) 53 { 54 #if ENABLE(TOUCH_EVENTS) 55 static_cast<WebViewEfl*>(toImpl(viewRef))->sendTouchEvent(toImpl(touchEventRef)); 56 #else 57 UNUSED_PARAM(viewRef); 58 UNUSED_PARAM(touchEventRef); 59 #endif 60 } -
trunk/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.h
r149902 r152147 41 41 WK_EXPORT void WKViewSetThemePath(WKViewRef, WKStringRef); 42 42 43 WK_EXPORT void WKViewSendTouchEvent(WKViewRef, WKTouchEventRef); 44 43 45 #ifdef __cplusplus 44 46 } -
trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp
r151541 r152147 37 37 #include "SnapshotImageGL.h" 38 38 #include "ViewClientEfl.h" 39 #include "WKArray.h" 39 40 #include "WKDictionary.h" 41 #include "WKEventEfl.h" 40 42 #include "WKGeometry.h" 41 43 #include "WKNumber.h" … … 713 715 714 716 #if ENABLE(TOUCH_EVENTS) 717 static WKTouchPointState toWKTouchPointState(Evas_Touch_Point_State state) 718 { 719 switch (state) { 720 case EVAS_TOUCH_POINT_UP: 721 return kWKTouchPointStateTouchReleased; 722 case EVAS_TOUCH_POINT_MOVE: 723 return kWKTouchPointStateTouchMoved; 724 case EVAS_TOUCH_POINT_DOWN: 725 return kWKTouchPointStateTouchPressed; 726 case EVAS_TOUCH_POINT_STILL: 727 return kWKTouchPointStateTouchStationary; 728 case EVAS_TOUCH_POINT_CANCEL: 729 default: 730 return kWKTouchPointStateTouchCancelled; 731 } 732 } 733 734 static WKEventModifiers toWKEventModifiers(const Evas_Modifier* modifiers) 735 { 736 WKEventModifiers wkModifiers = 0; 737 if (evas_key_modifier_is_set(modifiers, "Shift")) 738 wkModifiers |= kWKEventModifiersShiftKey; 739 if (evas_key_modifier_is_set(modifiers, "Control")) 740 wkModifiers |= kWKEventModifiersControlKey; 741 if (evas_key_modifier_is_set(modifiers, "Alt")) 742 wkModifiers |= kWKEventModifiersAltKey; 743 if (evas_key_modifier_is_set(modifiers, "Meta")) 744 wkModifiers |= kWKEventModifiersMetaKey; 745 746 return wkModifiers; 747 } 748 715 749 void EwkView::feedTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers) 716 750 { 717 page()->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, webView()->transformFromScene(), transformToScreen(), ecore_time_get())); 751 unsigned length = eina_list_count(points); 752 OwnArrayPtr<WKTypeRef> touchPoints = adoptArrayPtr(new WKTypeRef[length]); 753 for (unsigned i = 0; i < length; ++i) { 754 Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(eina_list_nth(points, i)); 755 ASSERT(point); 756 IntPoint position(point->x, point->y); 757 touchPoints[i] = WKTouchPointCreate(point->id, toAPI(IntPoint(position)), toAPI(transformToScreen().mapPoint(position)), toWKTouchPointState(point->state), WKSizeMake(0, 0), 0, 1); 758 } 759 WKRetainPtr<WKArrayRef> wkTouchPoints(AdoptWK, WKArrayCreateAdoptingValues(touchPoints.get(), length)); 760 761 WKViewSendTouchEvent(wkView(), adoptWK(WKTouchEventCreate(static_cast<WKEventType>(type), wkTouchPoints.get(), toWKEventModifiers(modifiers), ecore_time_get())).get()); 718 762 } 719 763 … … 1261 1305 Ewk_View_Smart_Data* sd = smartData(); 1262 1306 1263 unsigned count = evas_touch_point_list_count(sd->base.evas); 1264 if (!count) 1265 return; 1266 1267 Eina_List* points = 0; 1268 for (unsigned i = 0; i < count; ++i) { 1269 Ewk_Touch_Point* point = new Ewk_Touch_Point; 1270 point->id = evas_touch_point_list_nth_id_get(sd->base.evas, i); 1271 evas_touch_point_list_nth_xy_get(sd->base.evas, i, &point->x, &point->y); 1272 point->state = evas_touch_point_list_nth_state_get(sd->base.evas, i); 1273 points = eina_list_append(points, point); 1274 } 1275 1276 feedTouchEvent(type, points, evas_key_modifier_get(sd->base.evas)); 1277 1278 void* data; 1279 EINA_LIST_FREE(points, data) 1280 delete static_cast<Ewk_Touch_Point*>(data); 1307 unsigned length = evas_touch_point_list_count(sd->base.evas); 1308 if (!length) 1309 return; 1310 1311 OwnArrayPtr<WKTypeRef> touchPoints = adoptArrayPtr(new WKTypeRef[length]); 1312 for (unsigned i = 0; i < length; ++i) { 1313 int x, y; 1314 evas_touch_point_list_nth_xy_get(sd->base.evas, i, &x, &y); 1315 IntPoint position(x, y); 1316 Evas_Touch_Point_State state = evas_touch_point_list_nth_state_get(sd->base.evas, i); 1317 int id = evas_touch_point_list_nth_id_get(sd->base.evas, i); 1318 touchPoints[i] = WKTouchPointCreate(id, toAPI(IntPoint(position)), toAPI(transformToScreen().mapPoint(position)), toWKTouchPointState(state), WKSizeMake(0, 0), 0, 1); 1319 } 1320 WKRetainPtr<WKArrayRef> wkTouchPoints(AdoptWK, WKArrayCreateAdoptingValues(touchPoints.get(), length)); 1321 1322 WKViewSendTouchEvent(wkView(), adoptWK(WKTouchEventCreate(static_cast<WKEventType>(type), wkTouchPoints.get(), toWKEventModifiers(evas_key_modifier_get(sd->base.evas)), ecore_time_get())).get()); 1281 1323 } 1282 1324 -
trunk/Source/WebKit2/UIProcess/efl/EwkTouchEvent.cpp
r152144 r152147 1 1 /* 2 * Copyright (C) 201 2 Samsung Electronics2 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 25 25 26 26 #include "config.h" 27 #include "EwkTouchEvent.h" 27 28 28 29 #if ENABLE(TOUCH_EVENTS) 29 #include "NativeWebTouchEvent.h"30 31 #include "WebEventFactory.h"32 30 33 31 namespace WebKit { 34 32 35 NativeWebTouchEvent::NativeWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen, double timestamp) 36 : WebTouchEvent(WebEventFactory::createWebTouchEvent(type, points, modifiers, toWebContent, toDeviceScreen, timestamp)) 33 EwkTouchEvent::EwkTouchEvent(WKEventType type, WKArrayRef touchPoints, WKEventModifiers modifiers, double timestamp) 34 : m_eventType(type) 35 , m_touchPoints(touchPoints) 36 , m_modifiers(modifiers) 37 , m_timestamp(timestamp) 37 38 { 38 39 } … … 40 41 } // namespace WebKit 41 42 42 #endif 43 #endif // ENABLE(TOUCH_EVENTS) -
trunk/Source/WebKit2/UIProcess/efl/EwkTouchEvent.h
r152144 r152147 1 1 /* 2 * Copyright (C) 201 2 Samsung Electronics2 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #include "config.h" 26 #ifndef EwkTouchEvent_h 27 #define EwkTouchEvent_h 27 28 28 29 #if ENABLE(TOUCH_EVENTS) 29 #include "NativeWebTouchEvent.h"30 30 31 #include "WebEventFactory.h" 31 #include "APIObject.h" 32 #include "WKArray.h" 33 #include "WKEventEfl.h" 34 #include "WKRetainPtr.h" 35 #include <wtf/PassRefPtr.h> 32 36 33 37 namespace WebKit { 34 38 35 NativeWebTouchEvent::NativeWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen, double timestamp) 36 : WebTouchEvent(WebEventFactory::createWebTouchEvent(type, points, modifiers, toWebContent, toDeviceScreen, timestamp)) 37 { 38 } 39 class EwkTouchEvent : public APIObject { 40 public: 41 static const APIObject::Type APIType = TypeTouchEvent; 42 43 static PassRefPtr<EwkTouchEvent> create(WKEventType type, WKArrayRef touchPoints, WKEventModifiers modifiers, double timestamp) 44 { 45 return adoptRef(new EwkTouchEvent(type, touchPoints, modifiers, timestamp)); 46 } 47 48 WKEventType eventType() const { return m_eventType; } 49 WKArrayRef touchPoints() const { return m_touchPoints.get(); } 50 WKEventModifiers modifiers() const { return m_modifiers; } 51 double timestamp() const { return m_timestamp; } 52 53 private: 54 EwkTouchEvent(WKEventType, WKArrayRef, WKEventModifiers, double timestamp); 55 56 virtual APIObject::Type type() const { return APIType; } 57 58 WKEventType m_eventType; 59 WKRetainPtr<WKArrayRef> m_touchPoints; 60 WKEventModifiers m_modifiers; 61 double m_timestamp; 62 }; 39 63 40 64 } // namespace WebKit 41 65 42 #endif 66 #endif // ENABLE(TOUCH_EVENTS) 67 68 #endif /* EwkTouchEvent_h */ -
trunk/Source/WebKit2/UIProcess/efl/EwkTouchPoint.cpp
r152144 r152147 1 1 /* 2 * Copyright (C) 201 2 Samsung Electronics2 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 25 25 26 26 #include "config.h" 27 #include "EwkTouchPoint.h" 27 28 28 29 #if ENABLE(TOUCH_EVENTS) 29 #include "NativeWebTouchEvent.h"30 31 #include "WebEventFactory.h"32 30 33 31 namespace WebKit { 34 32 35 NativeWebTouchEvent::NativeWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen, double timestamp) 36 : WebTouchEvent(WebEventFactory::createWebTouchEvent(type, points, modifiers, toWebContent, toDeviceScreen, timestamp)) 33 EwkTouchPoint::EwkTouchPoint(uint32_t id, WKTouchPointState state, const WKPoint& screenPosition, const WKPoint& position, const WKSize& radius, float rotationAngle, float forceFactor) 34 : m_id(id) 35 , m_state(state) 36 , m_screenPosition(screenPosition) 37 , m_position(position) 38 , m_radius(radius) 39 , m_rotationAngle(rotationAngle) 40 , m_forceFactor(forceFactor) 37 41 { 38 42 } … … 40 44 } // namespace WebKit 41 45 42 #endif 46 #endif // ENABLE(TOUCH_EVENTS) -
trunk/Source/WebKit2/UIProcess/efl/WebViewEfl.cpp
r151414 r152147 38 38 #if ENABLE(FULLSCREEN_API) 39 39 #include "WebFullScreenManagerProxy.h" 40 #endif 41 42 #if ENABLE(TOUCH_EVENTS) 43 #include "EwkTouchEvent.h" 40 44 #endif 41 45 … … 113 117 } 114 118 119 #if ENABLE(TOUCH_EVENTS) 120 void WebViewEfl::sendTouchEvent(EwkTouchEvent* touchEvent) 121 { 122 ASSERT(touchEvent); 123 m_page->handleTouchEvent(NativeWebTouchEvent(touchEvent, transformFromScene())); 124 } 125 #endif 126 115 127 } // namespace WebKit -
trunk/Source/WebKit2/UIProcess/efl/WebViewEfl.h
r151414 r152147 33 33 namespace WebKit { 34 34 35 #if ENABLE(TOUCH_EVENTS) 36 class EwkTouchEvent; 37 #endif 38 35 39 class WebViewEfl : public WebView { 36 40 public: … … 40 44 void paintToCairoSurface(cairo_surface_t*); 41 45 void setThemePath(const String&); 46 47 #if ENABLE(TOUCH_EVENTS) 48 void sendTouchEvent(EwkTouchEvent*); 49 #endif 42 50 43 51 private:
Note: See TracChangeset
for help on using the changeset viewer.