Title: [133012] trunk/Source/WebKit2
Revision
133012
Author
[email protected]
Date
2012-10-31 04:41:13 -0700 (Wed, 31 Oct 2012)

Log Message

[WK2/EFL] Make sure all our events are transformed correctly
https://bugs.webkit.org/show_bug.cgi?id=100836

Reviewed by Alexis Menard.

When moving to using the tiled backing store, we need to
transform our events before sending them to the web process.

We needed to do that before as well, as the webkit view
doesn't have to be positioned at (0,0), but it was done in
a hacking way in the WebEvent creating.

Now we generate two transforms, one for transforming points
to the web content, and one for transforming them into the
device screen coordinate system.

This fixes the global position which was wrong before.

* Shared/NativeWebMouseEvent.h:
(NativeWebMouseEvent):
* Shared/NativeWebTouchEvent.h:
(NativeWebTouchEvent):
* Shared/NativeWebWheelEvent.h:
(NativeWebWheelEvent):
* Shared/efl/NativeWebMouseEventEfl.cpp:
(WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
* Shared/efl/NativeWebTouchEventEfl.cpp:
(WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
* Shared/efl/NativeWebWheelEventEfl.cpp:
(WebKit::NativeWebWheelEvent::NativeWebWheelEvent):
* Shared/efl/WebEventFactory.cpp:
(WebKit::WebEventFactory::createWebMouseEvent):
(WebKit::WebEventFactory::createWebWheelEvent):
(WebKit::WebEventFactory::createWebTouchEvent):
* Shared/efl/WebEventFactory.h:
(WebEventFactory):
* UIProcess/API/efl/ewk_view.cpp:
(toDeviceScreenTransform):
(toWebContentTransform):
(_ewk_view_smart_mouse_wheel):
(_ewk_view_smart_mouse_down):
(_ewk_view_smart_mouse_up):
(_ewk_view_smart_mouse_move):
(ewk_view_feed_touch_event):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (133011 => 133012)


--- trunk/Source/WebKit2/ChangeLog	2012-10-31 11:38:46 UTC (rev 133011)
+++ trunk/Source/WebKit2/ChangeLog	2012-10-31 11:41:13 UTC (rev 133012)
@@ -1,3 +1,50 @@
+2012-10-31  Kenneth Rohde Christiansen  <[email protected]>
+
+        [WK2/EFL] Make sure all our events are transformed correctly
+        https://bugs.webkit.org/show_bug.cgi?id=100836
+
+        Reviewed by Alexis Menard.
+
+        When moving to using the tiled backing store, we need to
+        transform our events before sending them to the web process.
+
+        We needed to do that before as well, as the webkit view
+        doesn't have to be positioned at (0,0), but it was done in
+        a hacking way in the WebEvent creating.
+
+        Now we generate two transforms, one for transforming points
+        to the web content, and one for transforming them into the
+        device screen coordinate system.
+
+        This fixes the global position which was wrong before.
+
+        * Shared/NativeWebMouseEvent.h:
+        (NativeWebMouseEvent):
+        * Shared/NativeWebTouchEvent.h:
+        (NativeWebTouchEvent):
+        * Shared/NativeWebWheelEvent.h:
+        (NativeWebWheelEvent):
+        * Shared/efl/NativeWebMouseEventEfl.cpp:
+        (WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
+        * Shared/efl/NativeWebTouchEventEfl.cpp:
+        (WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
+        * Shared/efl/NativeWebWheelEventEfl.cpp:
+        (WebKit::NativeWebWheelEvent::NativeWebWheelEvent):
+        * Shared/efl/WebEventFactory.cpp:
+        (WebKit::WebEventFactory::createWebMouseEvent):
+        (WebKit::WebEventFactory::createWebWheelEvent):
+        (WebKit::WebEventFactory::createWebTouchEvent):
+        * Shared/efl/WebEventFactory.h:
+        (WebEventFactory):
+        * UIProcess/API/efl/ewk_view.cpp:
+        (toDeviceScreenTransform):
+        (toWebContentTransform):
+        (_ewk_view_smart_mouse_wheel):
+        (_ewk_view_smart_mouse_down):
+        (_ewk_view_smart_mouse_up):
+        (_ewk_view_smart_mouse_move):
+        (ewk_view_feed_touch_event):
+
 2012-10-31  Byungwoo Lee  <[email protected]>
 
         [WK2] Change the scope of locking in CoreIPC::Connection class.

Modified: trunk/Source/WebKit2/Shared/NativeWebMouseEvent.h (133011 => 133012)


--- trunk/Source/WebKit2/Shared/NativeWebMouseEvent.h	2012-10-31 11:38:46 UTC (rev 133011)
+++ trunk/Source/WebKit2/Shared/NativeWebMouseEvent.h	2012-10-31 11:41:13 UTC (rev 133012)
@@ -38,6 +38,7 @@
 typedef union _GdkEvent GdkEvent;
 #elif PLATFORM(EFL)
 #include <Evas.h>
+#include <WebCore/AffineTransform.h>
 #endif
 
 namespace WebKit {
@@ -54,9 +55,9 @@
     NativeWebMouseEvent(const NativeWebMouseEvent&);
     NativeWebMouseEvent(GdkEvent*, int);
 #elif PLATFORM(EFL)
-    NativeWebMouseEvent(const Evas_Event_Mouse_Down*, const Evas_Point*);
-    NativeWebMouseEvent(const Evas_Event_Mouse_Up*, const Evas_Point*);
-    NativeWebMouseEvent(const Evas_Event_Mouse_Move*, const Evas_Point*);
+    NativeWebMouseEvent(const Evas_Event_Mouse_Down*, const WebCore::AffineTransform&, const WebCore::AffineTransform&);
+    NativeWebMouseEvent(const Evas_Event_Mouse_Up*, const WebCore::AffineTransform&, const WebCore::AffineTransform&);
+    NativeWebMouseEvent(const Evas_Event_Mouse_Move*, const WebCore::AffineTransform&, const WebCore::AffineTransform&);
 #endif
 
 #if USE(APPKIT)

Modified: trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h (133011 => 133012)


--- trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h	2012-10-31 11:38:46 UTC (rev 133011)
+++ trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h	2012-10-31 11:41:13 UTC (rev 133012)
@@ -33,6 +33,7 @@
 #elif PLATFORM(EFL)
 #include "ewk_touch.h"
 #include <Evas.h>
+#include <WebCore/AffineTransform.h>
 #endif
 
 namespace WebKit {
@@ -42,7 +43,7 @@
 #if PLATFORM(QT)
     explicit NativeWebTouchEvent(const QTouchEvent*, const QTransform& fromItemTransform);
 #elif PLATFORM(EFL)
-    NativeWebTouchEvent(Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const Evas_Point*, double timestamp);
+    NativeWebTouchEvent(Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen, double timestamp);
 #endif
 
 #if PLATFORM(QT)

Modified: trunk/Source/WebKit2/Shared/NativeWebWheelEvent.h (133011 => 133012)


--- trunk/Source/WebKit2/Shared/NativeWebWheelEvent.h	2012-10-31 11:38:46 UTC (rev 133011)
+++ trunk/Source/WebKit2/Shared/NativeWebWheelEvent.h	2012-10-31 11:41:13 UTC (rev 133012)
@@ -38,6 +38,7 @@
 typedef union _GdkEvent GdkEvent;
 #elif PLATFORM(EFL)
 #include <Evas.h>
+#include <WebCore/AffineTransform.h>
 #endif
 
 namespace WebKit {
@@ -54,7 +55,7 @@
     NativeWebWheelEvent(const NativeWebWheelEvent&);
     NativeWebWheelEvent(GdkEvent*);
 #elif PLATFORM(EFL)
-    NativeWebWheelEvent(const Evas_Event_Mouse_Wheel*, const Evas_Point*);
+    NativeWebWheelEvent(const Evas_Event_Mouse_Wheel*, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen);
 #endif
 
 #if USE(APPKIT)

Modified: trunk/Source/WebKit2/Shared/efl/NativeWebMouseEventEfl.cpp (133011 => 133012)


--- trunk/Source/WebKit2/Shared/efl/NativeWebMouseEventEfl.cpp	2012-10-31 11:38:46 UTC (rev 133011)
+++ trunk/Source/WebKit2/Shared/efl/NativeWebMouseEventEfl.cpp	2012-10-31 11:41:13 UTC (rev 133012)
@@ -30,20 +30,20 @@
 
 namespace WebKit {
 
-NativeWebMouseEvent::NativeWebMouseEvent(const Evas_Event_Mouse_Down* event, const Evas_Point* position)
-    : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, position))
+NativeWebMouseEvent::NativeWebMouseEvent(const Evas_Event_Mouse_Down* event, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen)
+    : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, toWebContent, toDeviceScreen))
     , m_nativeEvent(event)
 {
 }
 
-NativeWebMouseEvent::NativeWebMouseEvent(const Evas_Event_Mouse_Up* event, const Evas_Point* position)
-    : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, position))
+NativeWebMouseEvent::NativeWebMouseEvent(const Evas_Event_Mouse_Up* event, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen)
+    : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, toWebContent, toDeviceScreen))
     , m_nativeEvent(event)
 {
 }
 
-NativeWebMouseEvent::NativeWebMouseEvent(const Evas_Event_Mouse_Move* event, const Evas_Point* position)
-    : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, position))
+NativeWebMouseEvent::NativeWebMouseEvent(const Evas_Event_Mouse_Move* event, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen)
+    : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, toWebContent, toDeviceScreen))
     , m_nativeEvent(event)
 {
 }

Modified: trunk/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp (133011 => 133012)


--- trunk/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp	2012-10-31 11:38:46 UTC (rev 133011)
+++ trunk/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp	2012-10-31 11:41:13 UTC (rev 133012)
@@ -32,8 +32,8 @@
 
 namespace WebKit {
 
-NativeWebTouchEvent::NativeWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const Evas_Point* position, double timestamp)
-    : WebTouchEvent(WebEventFactory::createWebTouchEvent(type, points, modifiers, position, timestamp))
+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)
+    : WebTouchEvent(WebEventFactory::createWebTouchEvent(type, points, modifiers, toWebContent, toDeviceScreen, timestamp))
 {
 }
 

Modified: trunk/Source/WebKit2/Shared/efl/NativeWebWheelEventEfl.cpp (133011 => 133012)


--- trunk/Source/WebKit2/Shared/efl/NativeWebWheelEventEfl.cpp	2012-10-31 11:38:46 UTC (rev 133011)
+++ trunk/Source/WebKit2/Shared/efl/NativeWebWheelEventEfl.cpp	2012-10-31 11:41:13 UTC (rev 133012)
@@ -30,8 +30,8 @@
 
 namespace WebKit {
 
-NativeWebWheelEvent::NativeWebWheelEvent(const Evas_Event_Mouse_Wheel* event, const Evas_Point* position)
-    : WebWheelEvent(WebEventFactory::createWebWheelEvent(event, position))
+NativeWebWheelEvent::NativeWebWheelEvent(const Evas_Event_Mouse_Wheel* event, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen)
+    : WebWheelEvent(WebEventFactory::createWebWheelEvent(event, toWebContent, toDeviceScreen))
     , m_nativeEvent(event)
 {
 }

Modified: trunk/Source/WebKit2/Shared/efl/WebEventFactory.cpp (133011 => 133012)


--- trunk/Source/WebKit2/Shared/efl/WebEventFactory.cpp	2012-10-31 11:38:46 UTC (rev 133011)
+++ trunk/Source/WebKit2/Shared/efl/WebEventFactory.cpp	2012-10-31 11:41:13 UTC (rev 133012)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011 Samsung Electronics
+ * Copyright (C) 2012 Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,6 +28,7 @@
 #include "WebEventFactory.h"
 
 #include "EflKeyboardUtilities.h"
+#include <WebCore/AffineTransform.h>
 #include <WebCore/Scrollbar.h>
 
 using namespace WebCore;
@@ -89,12 +91,13 @@
     return static_cast<double>(timestamp) / 1000;
 }
 
-WebMouseEvent WebEventFactory::createWebMouseEvent(const Evas_Event_Mouse_Down* event, const Evas_Point* position)
+WebMouseEvent WebEventFactory::createWebMouseEvent(const Evas_Event_Mouse_Down* event, const AffineTransform& toWebContent, const AffineTransform& toDeviceScreen)
 {
+    IntPoint pos(event->canvas.x, event->canvas.y);
     return WebMouseEvent(WebEvent::MouseDown,
         buttonForEvent(event->button),
-        IntPoint(event->canvas.x - position->x, event->canvas.y - position->y),
-        IntPoint(event->canvas.x, event->canvas.y),
+        toWebContent.mapPoint(pos),
+        toDeviceScreen.mapPoint(pos),
         0 /* deltaX */,
         0 /* deltaY */,
         0 /* deltaZ */,
@@ -103,12 +106,13 @@
         convertMillisecondToSecond(event->timestamp));
 }
 
-WebMouseEvent WebEventFactory::createWebMouseEvent(const Evas_Event_Mouse_Up* event, const Evas_Point* position)
+WebMouseEvent WebEventFactory::createWebMouseEvent(const Evas_Event_Mouse_Up* event, const AffineTransform& toWebContent, const AffineTransform& toDeviceScreen)
 {
+    IntPoint pos(event->canvas.x, event->canvas.y);
     return WebMouseEvent(WebEvent::MouseUp,
         buttonForEvent(event->button),
-        IntPoint(event->canvas.x - position->x, event->canvas.y - position->y),
-        IntPoint(event->canvas.x, event->canvas.y),
+        toWebContent.mapPoint(pos),
+        toDeviceScreen.mapPoint(pos),
         0 /* deltaX */,
         0 /* deltaY */,
         0 /* deltaZ */,
@@ -117,12 +121,13 @@
         convertMillisecondToSecond(event->timestamp));
 }
 
-WebMouseEvent WebEventFactory::createWebMouseEvent(const Evas_Event_Mouse_Move* event, const Evas_Point* position)
+WebMouseEvent WebEventFactory::createWebMouseEvent(const Evas_Event_Mouse_Move* event, const AffineTransform& toWebContent, const AffineTransform& toDeviceScreen)
 {
+    IntPoint pos(event->cur.canvas.x, event->cur.canvas.y);
     return WebMouseEvent(WebEvent::MouseMove,
         buttonForEvent(event->buttons),
-        IntPoint(event->cur.canvas.x - position->x, event->cur.canvas.y - position->y),
-        IntPoint(event->cur.canvas.x, event->cur.canvas.y),
+        toWebContent.mapPoint(pos),
+        toDeviceScreen.mapPoint(pos),
         0 /* deltaX */,
         0 /* deltaY */,
         0 /* deltaZ */,
@@ -131,7 +136,7 @@
         convertMillisecondToSecond(event->timestamp));
 }
 
-WebWheelEvent WebEventFactory::createWebWheelEvent(const Evas_Event_Mouse_Wheel* event, const Evas_Point* position)
+WebWheelEvent WebEventFactory::createWebWheelEvent(const Evas_Event_Mouse_Wheel* event, const AffineTransform& toWebContent, const AffineTransform& toDeviceScreen)
 {
     float deltaX = 0;
     float deltaY = 0;
@@ -153,9 +158,11 @@
     deltaX *= static_cast<float>(Scrollbar::pixelsPerLineStep());
     deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep());
 
+    IntPoint pos(event->canvas.x, event->canvas.y);
+
     return WebWheelEvent(WebEvent::Wheel,
-        IntPoint(event->canvas.x - position->x, event->canvas.y - position->y),
-        IntPoint(event->canvas.x, event->canvas.y),
+        toWebContent.mapPoint(pos),
+        toDeviceScreen.mapPoint(pos),
         FloatSize(deltaX, deltaY),
         FloatSize(wheelTicksX, wheelTicksY),
         WebWheelEvent::ScrollByPixelWheelEvent,
@@ -212,7 +219,7 @@
     return WebEvent::NoType;
 }
 
-WebTouchEvent WebEventFactory::createWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const Evas_Point* position, double timestamp)
+WebTouchEvent WebEventFactory::createWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const AffineTransform& toWebContent, const AffineTransform& toDeviceScreen, double timestamp)
 {
     Vector<WebPlatformTouchPoint> touchPoints;
     WebPlatformTouchPoint::TouchPointState state;
@@ -242,7 +249,8 @@
             continue;
         }
 
-        touchPoints.append(WebPlatformTouchPoint(point->id, state, IntPoint(point->x, point->y), IntPoint(point->x - position->x, point->y - position->y)));
+        IntPoint pos(point->x, point->y);
+        touchPoints.append(WebPlatformTouchPoint(point->id, state, toWebContent.mapPoint(pos), toDeviceScreen.mapPoint(pos)));
     }
 
     return WebTouchEvent(typeForTouchEvent(type), touchPoints, modifiersForEvent(modifiers), timestamp);

Modified: trunk/Source/WebKit2/Shared/efl/WebEventFactory.h (133011 => 133012)


--- trunk/Source/WebKit2/Shared/efl/WebEventFactory.h	2012-10-31 11:38:46 UTC (rev 133011)
+++ trunk/Source/WebKit2/Shared/efl/WebEventFactory.h	2012-10-31 11:41:13 UTC (rev 133012)
@@ -29,19 +29,20 @@
 #include "WebEvent.h"
 #include "ewk_touch.h"
 #include <Evas.h>
+#include <WebCore/AffineTransform.h>
 
 namespace WebKit {
 
 class WebEventFactory {
 public:
-    static WebMouseEvent createWebMouseEvent(const Evas_Event_Mouse_Down*, const Evas_Point*);
-    static WebMouseEvent createWebMouseEvent(const Evas_Event_Mouse_Up*, const Evas_Point*);
-    static WebMouseEvent createWebMouseEvent(const Evas_Event_Mouse_Move*, const Evas_Point*);
-    static WebWheelEvent createWebWheelEvent(const Evas_Event_Mouse_Wheel*, const Evas_Point*);
+    static WebMouseEvent createWebMouseEvent(const Evas_Event_Mouse_Down*, const WebCore::AffineTransform&, const WebCore::AffineTransform&);
+    static WebMouseEvent createWebMouseEvent(const Evas_Event_Mouse_Up*, const WebCore::AffineTransform&, const WebCore::AffineTransform&);
+    static WebMouseEvent createWebMouseEvent(const Evas_Event_Mouse_Move*, const WebCore::AffineTransform&, const WebCore::AffineTransform&);
+    static WebWheelEvent createWebWheelEvent(const Evas_Event_Mouse_Wheel*, const WebCore::AffineTransform&, const WebCore::AffineTransform&);
     static WebKeyboardEvent createWebKeyboardEvent(const Evas_Event_Key_Down*);
     static WebKeyboardEvent createWebKeyboardEvent(const Evas_Event_Key_Up*);
 #if ENABLE(TOUCH_EVENTS)
-    static WebTouchEvent createWebTouchEvent(Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const Evas_Point*, double timestamp);
+    static WebTouchEvent createWebTouchEvent(Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const WebCore::AffineTransform&, const WebCore::AffineTransform&, double timestamp);
 #endif
 };
 

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (133011 => 133012)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2012-10-31 11:38:46 UTC (rev 133011)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2012-10-31 11:41:13 UTC (rev 133012)
@@ -50,6 +50,7 @@
 #include "ewk_settings_private.h"
 #include "ewk_view_private.h"
 #include <Ecore_Evas.h>
+#include <Ecore_X.h>
 #include <WebKit2/WKPageGroup.h>
 #include <wtf/text/CString.h>
 
@@ -168,30 +169,54 @@
     return true;
 }
 
-#if USE(TILED_BACKING_STORE)
-static Evas_Coord_Point mapToWebContent(Ewk_View_Smart_Data* smartData, Evas_Coord_Point point)
+static AffineTransform toDeviceScreenTransform(Ewk_View_Smart_Data* smartData)
 {
-    Evas_Coord_Point result;
-    EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, result);
+    AffineTransform transform;
+    EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, transform);
 
-    result.x = (point.x  - smartData->view.x) / impl->pageViewportControllerClient()->scaleFactor() + smartData->view.x + impl->pageViewportControllerClient()->scrollPosition().x();
-    result.y = (point.y - smartData->view.y) / impl->pageViewportControllerClient()->scaleFactor() + smartData->view.y + impl->pageViewportControllerClient()->scrollPosition().y();
-    return result;
+    int windowGlobalX = 0;
+    int windowGlobalY = 0;
+
+#ifdef HAVE_ECORE_X
+    Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas);
+    Ecore_X_Window window = ecore_evas_software_x11_window_get(ecoreEvas); // Returns 0 if none.
+
+    int x, y; // x, y are relative to parent (in a reparenting window manager).
+    while (window) {
+        ecore_x_window_geometry_get(window, &x, &y, 0, 0);
+        windowGlobalX += x;
+        windowGlobalY += y;
+        window = ecore_x_window_parent_get(window);
+    }
+#endif
+
+    transform.translate(-smartData->view.x, -smartData->view.y);
+    transform.translate(windowGlobalX, windowGlobalY);
+
+    return transform;
 }
+
+static AffineTransform toWebContentTransform(Ewk_View_Smart_Data* smartData)
+{
+    AffineTransform transform;
+    EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, transform);
+
+    transform.translate(-smartData->view.x, -smartData->view.y);
+
+#if USE(TILED_BACKING_STORE)
+    transform.scale(1 / impl->pageViewportControllerClient()->scaleFactor());
+    IntPoint scrollPos = impl->pageViewportControllerClient()->scrollPosition();
+    transform.translate(scrollPos.x(), scrollPos.y());
 #endif
 
+    return transform;
+}
+
 static Eina_Bool _ewk_view_smart_mouse_wheel(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Wheel* wheelEvent)
 {
     EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false);
 
-    Evas_Point position = {smartData->view.x, smartData->view.y};
-#if USE(TILED_BACKING_STORE)
-    Evas_Event_Mouse_Wheel event(*wheelEvent);
-    event.canvas = mapToWebContent(smartData, event.canvas);
-    impl->page()->handleWheelEvent(NativeWebWheelEvent(&event, &position));
-#else
-    impl->page()->handleWheelEvent(NativeWebWheelEvent(wheelEvent, &position));
-#endif
+    impl->page()->handleWheelEvent(NativeWebWheelEvent(wheelEvent, toWebContentTransform(smartData), toDeviceScreenTransform(smartData)));
     return true;
 }
 
@@ -199,14 +224,7 @@
 {
     EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false);
 
-    Evas_Point position = {smartData->view.x, smartData->view.y};
-#if USE(TILED_BACKING_STORE)
-    Evas_Event_Mouse_Down event(*downEvent);
-    event.canvas = mapToWebContent(smartData, event.canvas);
-    impl->page()->handleMouseEvent(NativeWebMouseEvent(&event, &position));
-#else
-    impl->page()->handleMouseEvent(NativeWebMouseEvent(downEvent, &position));
-#endif
+    impl->page()->handleMouseEvent(NativeWebMouseEvent(downEvent, toWebContentTransform(smartData), toDeviceScreenTransform(smartData)));
     return true;
 }
 
@@ -214,14 +232,7 @@
 {
     EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false);
 
-    Evas_Point position = {smartData->view.x, smartData->view.y};
-#if USE(TILED_BACKING_STORE)
-    Evas_Event_Mouse_Up event(*upEvent);
-    event.canvas = mapToWebContent(smartData, event.canvas);
-    impl->page()->handleMouseEvent(NativeWebMouseEvent(&event, &position));
-#else
-    impl->page()->handleMouseEvent(NativeWebMouseEvent(upEvent, &position));
-#endif
+    impl->page()->handleMouseEvent(NativeWebMouseEvent(upEvent, toWebContentTransform(smartData), toDeviceScreenTransform(smartData)));
 
     InputMethodContextEfl* inputMethodContext = impl->inputMethodContext();
     if (inputMethodContext)
@@ -234,14 +245,7 @@
 {
     EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false);
 
-    Evas_Point position = {smartData->view.x, smartData->view.y};
-#if USE(TILED_BACKING_STORE)
-    Evas_Event_Mouse_Move event(*moveEvent);
-    event.cur.canvas = mapToWebContent(smartData, event.cur.canvas);
-    impl->page()->handleMouseEvent(NativeWebMouseEvent(&event, &position));
-#else
-    impl->page()->handleMouseEvent(NativeWebMouseEvent(moveEvent, &position));
-#endif
+    impl->page()->handleMouseEvent(NativeWebMouseEvent(moveEvent, toWebContentTransform(smartData), toDeviceScreenTransform(smartData)));
     return true;
 }
 
@@ -882,10 +886,7 @@
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
     EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false);
 
-    Evas_Point position = { smartData->view.x, smartData->view.y };
-    // FIXME: Touch points do not take scroll position and scale into account when 
-    // TILED_BACKING_STORE is enabled.
-    impl->page()->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, &position, ecore_time_get()));
+    impl->page()->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, toWebContentTransform(smartData), toDeviceScreenTransform(smartData), ecore_time_get()));
 
     return true;
 #else
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to