Changeset 128853 in webkit


Ignore:
Timestamp:
Sep 17, 2012 11:45:09 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[EFL][WK2] Add NativeWebTouchEvent and handle the Touch event.
https://bugs.webkit.org/show_bug.cgi?id=90662

Patch by Eunmi Lee <eunmi15.lee@samsung.com> on 2012-09-17
Reviewed by Gyuyoung Kim.

Implement codes to handle touch event for WebKit2 EFL port.
Additionally, types and structure for touch event are defined because
they are not in the Evas.

  • PlatformEfl.cmake:
  • Shared/NativeWebTouchEvent.h:

(NativeWebTouchEvent):

  • Shared/efl/NativeWebTouchEventEfl.cpp: Added.

(WebKit):
(WebKit::NativeWebTouchEvent::NativeWebTouchEvent):

  • Shared/efl/WebEventFactory.cpp:

(WebKit):
(WebKit::typeForTouchEvent):
(WebKit::WebEventFactory::createWebTouchEvent):

  • Shared/efl/WebEventFactory.h:

(WebEventFactory):

  • UIProcess/API/efl/ewk_touch.h: Added.
Location:
trunk/Source/WebKit2
Files:
5 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r128851 r128853  
     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 Gyuyoung Kim.
     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::typeForTouchEvent):
     21        (WebKit::WebEventFactory::createWebTouchEvent):
     22        * Shared/efl/WebEventFactory.h:
     23        (WebEventFactory):
     24        * UIProcess/API/efl/ewk_touch.h: Added.
     25
    1262012-09-17  Csaba Osztrogonác  <ossy@webkit.org>
    227
  • trunk/Source/WebKit2/PlatformEfl.cmake

    r128610 r128853  
    1818    Shared/efl/NativeWebWheelEventEfl.cpp
    1919    Shared/efl/NativeWebMouseEventEfl.cpp
     20    Shared/efl/NativeWebTouchEventEfl.cpp
    2021    Shared/efl/ProcessExecutablePathEfl.cpp
    2122    Shared/efl/WebEventFactory.cpp
  • trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h

    r104450 r128853  
    3131#if PLATFORM(QT)
    3232#include <QTouchEvent>
     33#elif PLATFORM(EFL)
     34#include "ewk_touch.h"
     35#include <Evas.h>
    3336#endif
    3437
     
    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
  • trunk/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp

    r128852 r128853  
    11/*
    2  * Copyright (C) 2011 Benjamin Poulain <benjamin@webkit.org>
     2 * Copyright (C) 2012 Samsung Electronics
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #ifndef NativeWebTouchEvent_h
    27 #define NativeWebTouchEvent_h
     26#include "config.h"
     27#include "NativeWebTouchEvent.h"
    2828
    29 #include "WebEvent.h"
     29#include "WebEventFactory.h"
    3030
    31 #if PLATFORM(QT)
    32 #include <QTouchEvent>
    33 #endif
     31#if ENABLE(TOUCH_EVENTS)
    3432
    3533namespace WebKit {
    3634
    37 class NativeWebTouchEvent : public WebTouchEvent {
    38 public:
    39 #if PLATFORM(QT)
    40     explicit NativeWebTouchEvent(const QTouchEvent*, const QTransform& fromItemTransform);
    41 #endif
    42 
    43 #if PLATFORM(QT)
    44     const QTouchEvent* nativeEvent() const { return &m_nativeEvent; }
    45 #endif
    46 
    47 private:
    48 #if PLATFORM(QT)
    49     const QTouchEvent m_nativeEvent;
    50 #endif
    51 };
     35NativeWebTouchEvent::NativeWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const Evas_Point* position, double timestamp)
     36    : WebTouchEvent(WebEventFactory::createWebTouchEvent(type, points, modifiers, position, timestamp))
     37{
     38}
    5239
    5340} // namespace WebKit
    5441
    55 #endif // NativeWebTouchEvent_h
     42#endif
  • trunk/Source/WebKit2/Shared/efl/WebEventFactory.cpp

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

    r89211 r128853  
    2828
    2929#include "WebEvent.h"
     30#include "ewk_touch.h"
    3031#include <Evas.h>
    3132
     
    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
  • trunk/Source/WebKit2/UIProcess/API/efl/ewk_touch.h

    r128852 r128853  
    11/*
    2  * Copyright (C) 2011 Benjamin Poulain <benjamin@webkit.org>
     2 * Copyright (C) 2012 Samsung Electronics
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #ifndef NativeWebTouchEvent_h
    27 #define NativeWebTouchEvent_h
     26#ifndef ewk_touch_h
     27#define ewk_touch_h
    2828
    29 #include "WebEvent.h"
     29#include <Evas.h>
    3030
    31 #if PLATFORM(QT)
    32 #include <QTouchEvent>
     31#ifdef __cplusplus
     32extern "C" {
    3333#endif
    3434
    35 namespace WebKit {
     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;
    3642
    37 class NativeWebTouchEvent : public WebTouchEvent {
    38 public:
    39 #if PLATFORM(QT)
    40     explicit NativeWebTouchEvent(const QTouchEvent*, const QTransform& fromItemTransform);
     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}
    4156#endif
    4257
    43 #if PLATFORM(QT)
    44     const QTouchEvent* nativeEvent() const { return &m_nativeEvent; }
    45 #endif
    46 
    47 private:
    48 #if PLATFORM(QT)
    49     const QTouchEvent m_nativeEvent;
    50 #endif
    51 };
    52 
    53 } // namespace WebKit
    54 
    55 #endif // NativeWebTouchEvent_h
     58#endif // ewk_touch_h
Note: See TracChangeset for help on using the changeset viewer.