Source/WebKit2/ChangeLog

 12012-09-17 Eunmi Lee <eunmi15.lee@samsung.com>
 2
 3 [EFL][WK2] Add NativeWebTouchEvent and handle the Touch event.
 4 https://bugs.webkit.org/show_bug.cgi?id=90662
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Implement codes to handle touch event for WebKit2 EFL port.
 9 Additionally, types and structure for touch event are defined because
 10 they are not in the Evas.
 11
 12 * PlatformEfl.cmake:
 13 * Shared/NativeWebTouchEvent.h:
 14 (NativeWebTouchEvent):
 15 * Shared/efl/NativeWebTouchEventEfl.cpp: Added.
 16 (WebKit):
 17 (WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
 18 * Shared/efl/WebEventFactory.cpp:
 19 (WebKit):
 20 (WebKit::WebEventFactory::createWebTouchEvent):
 21 * Shared/efl/WebEventFactory.h:
 22 (WebEventFactory):
 23 * UIProcess/API/efl/ewk_touch.h: Added.
 24
1252012-09-15 Vivek Galatage <vivekgalatage@gmail.com>
226
327 WinCairo build fix due to missing symbols for setImagesEnabled and setStorageBlockingPolicy

Source/WebKit2/PlatformEfl.cmake

@@LIST(APPEND WebKit2_SOURCES
110110 WebProcess/soup/WebKitSoupRequestInputStream.cpp
111111)
112112
 113IF (ENABLE_TOUCH_EVENTS)
 114 LIST(APPEND WebKit2_SOURCES
 115 Shared/efl/NativeWebTouchEventEfl.cpp
 116 )
 117ENDIF ()
 118
113119LIST(APPEND WebKit2_MESSAGES_IN_FILES
114120 UIProcess/soup/WebSoupRequestManagerProxy.messages.in
115121 WebProcess/soup/WebSoupRequestManager.messages.in

Source/WebKit2/Shared/NativeWebTouchEvent.h

3030
3131#if PLATFORM(QT)
3232#include <QTouchEvent>
 33#elif PLATFORM(EFL)
 34#include "ewk_touch.h"
 35#include <Evas.h>
3336#endif
3437
3538namespace WebKit {

@@class NativeWebTouchEvent : public WebTouchEvent {
3841public:
3942#if PLATFORM(QT)
4043 explicit NativeWebTouchEvent(const QTouchEvent*, const QTransform& fromItemTransform);
 44#elif PLATFORM(EFL)
 45 NativeWebTouchEvent(Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const Evas_Point*, double timestamp);
4146#endif
4247
4348#if PLATFORM(QT)

Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp

 1/*
 2 * Copyright (C) 2012 Samsung Electronics
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27#include "NativeWebTouchEvent.h"
 28
 29#include "WebEventFactory.h"
 30
 31namespace WebKit {
 32
 33NativeWebTouchEvent::NativeWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const Evas_Point* position, double timestamp)
 34 : WebTouchEvent(WebEventFactory::createWebTouchEvent(type, points, modifiers, position, timestamp))
 35{
 36}
 37
 38} // namespace WebKit

Source/WebKit2/Shared/efl/WebEventFactory.cpp

@@WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const Evas_Event_Key_Up
192192 event->timestamp);
193193}
194194
 195#if ENABLE(TOUCH_EVENTS)
 196WebTouchEvent WebEventFactory::createWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const Evas_Point* position, double timestamp)
 197{
 198 WebEvent::Type webEventType;
 199 switch (type) {
 200 case EWK_TOUCH_START:
 201 webEventType = WebEvent::TouchStart;
 202 break;
 203 case EWK_TOUCH_MOVE:
 204 webEventType = WebEvent::TouchMove;
 205 break;
 206 case EWK_TOUCH_END:
 207 webEventType = WebEvent::TouchEnd;
 208 break;
 209 case EWK_TOUCH_CANCEL:
 210 webEventType = WebEvent::TouchCancel;
 211 break;
 212 default:
 213 ASSERT_NOT_REACHED();
 214 break;
 215 }
 216
 217 Vector<WebPlatformTouchPoint> touchPoints;
 218 WebPlatformTouchPoint::TouchPointState state = static_cast<WebPlatformTouchPoint::TouchPointState>(0);
 219 const Eina_List* list;
 220 void* item;
 221 EINA_LIST_FOREACH(points, list, item) {
 222 Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(item);
 223
 224 switch (point->state) {
 225 case EVAS_TOUCH_POINT_UP:
 226 state = WebPlatformTouchPoint::TouchReleased;
 227 break;
 228 case EVAS_TOUCH_POINT_MOVE:
 229 state = WebPlatformTouchPoint::TouchMoved;
 230 break;
 231 case EVAS_TOUCH_POINT_DOWN:
 232 state = WebPlatformTouchPoint::TouchPressed;
 233 break;
 234 case EVAS_TOUCH_POINT_STILL:
 235 state = WebPlatformTouchPoint::TouchStationary;
 236 break;
 237 case EVAS_TOUCH_POINT_CANCEL:
 238 state = WebPlatformTouchPoint::TouchCancelled;
 239 break;
 240 default:
 241 ASSERT_NOT_REACHED();
 242 break;
 243 }
 244
 245 touchPoints.append(WebPlatformTouchPoint(point->id, state, IntPoint(point->x, point->y), IntPoint(point->x - position->x, point->y - position->y)));
 246 }
 247
 248 return WebTouchEvent(webEventType, touchPoints, modifiersForEvent(modifiers), timestamp);
 249}
 250#endif
 251
195252} // namespace WebKit

Source/WebKit2/Shared/efl/WebEventFactory.h

2727#define WebEventFactory_h
2828
2929#include "WebEvent.h"
 30#include "ewk_touch.h"
3031#include <Evas.h>
3132
3233namespace WebKit {

@@public:
3940 static WebWheelEvent createWebWheelEvent(const Evas_Event_Mouse_Wheel*, const Evas_Point*);
4041 static WebKeyboardEvent createWebKeyboardEvent(const Evas_Event_Key_Down*);
4142 static WebKeyboardEvent createWebKeyboardEvent(const Evas_Event_Key_Up*);
 43#if ENABLE(TOUCH_EVENTS)
 44 static WebTouchEvent createWebTouchEvent(Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const Evas_Point*, double timestamp);
 45#endif
4246};
4347
4448} // namespace WebKit

Source/WebKit2/UIProcess/API/efl/ewk_touch.h

 1/*
 2 * Copyright (C) 2012 Samsung Electronics
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#ifndef ewk_touch_h
 27#define ewk_touch_h
 28
 29#include <Evas.h>
 30
 31#ifdef __cplusplus
 32extern "C" {
 33#endif
 34
 35/// Represents types of touch event.
 36typedef enum {
 37 EWK_TOUCH_START,
 38 EWK_TOUCH_MOVE,
 39 EWK_TOUCH_END,
 40 EWK_TOUCH_CANCEL
 41} Ewk_Touch_Event_Type;
 42
 43/// Creates a type name for _Ewk_Touch_Point.
 44typedef struct _Ewk_Touch_Point Ewk_Touch_Point;
 45
 46/// Represents a touch point.
 47struct _Ewk_Touch_Point {
 48 int id; /**< identifier of the touch event */
 49 int x; /**< the horizontal position of the touch event */
 50 int y; /**< the vertical position of the touch event */
 51 Evas_Touch_Point_State state; /**< state of the touch event */
 52};
 53
 54#ifdef __cplusplus
 55}
 56#endif
 57
 58#endif // ewk_touch_h