WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
patch for testing gesture.
all_gestures_for_test.patch (text/plain), 92.37 KB, created by
Eunmi Lee
on 2013-07-12 07:03:44 PDT
(
hide
)
Description:
patch for testing gesture.
Filename:
MIME Type:
Creator:
Eunmi Lee
Created:
2013-07-12 07:03:44 PDT
Size:
92.37 KB
patch
obsolete
>diff --git a/Source/WebKit2/CMakeLists.txt b/Source/WebKit2/CMakeLists.txt >index a5e2b03..76dc7da 100644 >--- a/Source/WebKit2/CMakeLists.txt >+++ b/Source/WebKit2/CMakeLists.txt >@@ -366,6 +366,7 @@ set(WebKit2_SOURCES > UIProcess/Authentication/WebProtectionSpace.cpp > > UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp >+ UIProcess/CoordinatedGraphics/WebPageProxyCoordinatedGraphics.cpp > > UIProcess/Downloads/DownloadProxy.cpp > UIProcess/Downloads/DownloadProxyMap.cpp >@@ -519,6 +520,7 @@ set(WebKit2_SOURCES > WebProcess/WebPage/WebUndoStep.cpp > > WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp >+ WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp > ) > > set(WebKit2_MESSAGES_IN_FILES >diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake >index 88f9cfb..95f6457 100644 >--- a/Source/WebKit2/PlatformEfl.cmake >+++ b/Source/WebKit2/PlatformEfl.cmake >@@ -61,9 +61,12 @@ list(APPEND WebKit2_SOURCES > UIProcess/API/C/soup/WKCookieManagerSoup.cpp > UIProcess/API/C/soup/WKSoupRequestManager.cpp > >+ UIProcess/API/efl/EasingCurves.cpp > UIProcess/API/efl/EwkView.cpp > UIProcess/API/efl/EvasGLContext.cpp > UIProcess/API/efl/EvasGLSurface.cpp >+ UIProcess/API/efl/GestureRecognizer.cpp >+ UIProcess/API/efl/GestureRecognizerClientEfl.cpp > UIProcess/API/efl/SnapshotImageGL.cpp > UIProcess/API/efl/ewk_auth_request.cpp > UIProcess/API/efl/ewk_back_forward_list.cpp >@@ -105,6 +108,7 @@ list(APPEND WebKit2_SOURCES > UIProcess/efl/ContextHistoryClientEfl.cpp > UIProcess/efl/ContextMenuClientEfl.cpp > UIProcess/efl/DownloadManagerEfl.cpp >+ UIProcess/efl/EwkGestureEvent.cpp > UIProcess/efl/EwkTouchEvent.cpp > UIProcess/efl/EwkTouchPoint.cpp > UIProcess/efl/FindClientEfl.cpp >diff --git a/Source/WebKit2/Shared/API/c/efl/WKBaseEfl.h b/Source/WebKit2/Shared/API/c/efl/WKBaseEfl.h >index 9c07f8e0..e7dc56f 100644 >--- a/Source/WebKit2/Shared/API/c/efl/WKBaseEfl.h >+++ b/Source/WebKit2/Shared/API/c/efl/WKBaseEfl.h >@@ -29,5 +29,6 @@ typedef const struct OpaqueWKPopupItem* WKPopupItemRef; > typedef const struct OpaqueWKPopupMenuListener* WKPopupMenuListenerRef; > typedef const struct OpaqueWKTouchPoint* WKTouchPointRef; > typedef const struct OpaqueWKTouchEvent* WKTouchEventRef; >+typedef const struct OpaqueWKGestureEvent* WKGestureEventRef; > > #endif /* WKBaseEfl_h */ >diff --git a/Source/WebKit2/Shared/APIObject.h b/Source/WebKit2/Shared/APIObject.h >index 441e05e..4259bce 100644 >--- a/Source/WebKit2/Shared/APIObject.h >+++ b/Source/WebKit2/Shared/APIObject.h >@@ -141,6 +141,9 @@ public: > TypeTouchPoint, > TypeTouchEvent, > #endif >+#if ENABLE(GESTURE_EVENTS) >+ TypeGestureEvent, >+#endif > #endif > }; > >diff --git a/Source/WebKit2/Shared/efl/WebEventFactory.cpp b/Source/WebKit2/Shared/efl/WebEventFactory.cpp >index 7f5b3ee..097eed7 100644 >--- a/Source/WebKit2/Shared/efl/WebEventFactory.cpp >+++ b/Source/WebKit2/Shared/efl/WebEventFactory.cpp >@@ -229,39 +229,6 @@ static inline WebPlatformTouchPoint::TouchPointState toWebPlatformTouchPointStat > } > } > >-static inline WebEvent::Type toWebEventType(WKEventType type) >-{ >- switch (type) { >- case kWKEventTypeTouchStart: >- return WebEvent::TouchStart; >- case kWKEventTypeTouchMove: >- return WebEvent::TouchMove; >- case kWKEventTypeTouchEnd: >- return WebEvent::TouchEnd; >- case kWKEventTypeTouchCancel: >- return WebEvent::TouchCancel; >- default: >- return WebEvent::NoType; >- } >- >-} >- >-static inline WebEvent::Modifiers toWebEventModifiers(unsigned modifiers) >-{ >- unsigned result = 0; >- >- if (modifiers & kWKEventModifiersShiftKey) >- result |= WebEvent::ShiftKey; >- if (modifiers & kWKEventModifiersControlKey) >- result |= WebEvent::ControlKey; >- if (modifiers & kWKEventModifiersAltKey) >- result |= WebEvent::AltKey; >- if (modifiers & kWKEventModifiersMetaKey) >- result |= WebEvent::MetaKey; >- >- return static_cast<WebEvent::Modifiers>(result); >-} >- > WebTouchEvent WebEventFactory::createWebTouchEvent(const EwkTouchEvent* event, const AffineTransform& toWebContent) > { > ImmutableArray* touchPointsArray = toImpl(event->touchPoints()); >diff --git a/Source/WebKit2/Target.pri b/Source/WebKit2/Target.pri >index fe6336a..9874bc7 100644 >--- a/Source/WebKit2/Target.pri >+++ b/Source/WebKit2/Target.pri >@@ -565,6 +565,7 @@ SOURCES += \ > UIProcess/BackingStore.cpp \ > UIProcess/qt/BackingStoreQt.cpp \ > UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp \ >+ UIProcess/CoordinatedGraphics/WebPageProxyCoordinatedGraphics.cpp \ > UIProcess/DefaultUndoController.cpp \ > UIProcess/Downloads/DownloadProxy.cpp \ > UIProcess/Downloads/DownloadProxyMap.cpp \ >@@ -748,6 +749,7 @@ SOURCES += \ > WebProcess/WebPage/EventDispatcher.cpp \ > WebProcess/WebPage/FindController.cpp \ > WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp \ >+ WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp \ > WebProcess/WebPage/TapHighlightController.cpp \ > WebProcess/WebPage/LayerTreeHost.cpp \ > WebProcess/WebPage/PageBanner.cpp \ >diff --git a/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp b/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp >index 467365f..2ed74d3 100644 >--- a/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp >+++ b/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp >@@ -26,6 +26,7 @@ > #include "WKAPICast.h" > #include "WebView.h" > >+using namespace WebCore; > using namespace WebKit; > > WKViewRef WKViewCreate(WKContextRef contextRef, WKPageGroupRef pageGroupRef) >@@ -188,4 +189,10 @@ double WKViewOpacity(WKViewRef view) > return toImpl(view)->opacity(); > } > >+void WKViewFindZoomableAreaForRect(WKViewRef viewRef, WKRect wkRect) >+{ >+ IntRect rect = toIntRect(wkRect); >+ toImpl(viewRef)->findZoomableAreaForPoint(rect.center(), rect.size()); >+} >+ > #endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h b/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h >index cd30e48..1ee55ea 100644 >--- a/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h >+++ b/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h >@@ -24,6 +24,10 @@ > #include <WebKit2/WKBase.h> > #include <WebKit2/WKGeometry.h> > >+#ifndef __cplusplus >+#include <stdbool.h> >+#endif >+ > #ifdef __cplusplus > extern "C" { > #endif >@@ -36,6 +40,8 @@ typedef void (*WKViewPageDidChangeContentsPositionCallback)(WKViewRef view, WKPo > typedef void (*WKViewPageDidRenderFrameCallback)(WKViewRef view, WKSize contentsSize, WKRect coveredRect, const void* clientInfo); > typedef void (*WKViewPageDidChangeViewportAttributesCallback)(WKViewRef view, WKViewportAttributesRef, const void* clientInfo); > typedef void (*WKViewPageDidChangeTooltipCallback)(WKViewRef view, WKStringRef newTooltip, const void* clientInfo); >+typedef void (*WKViewDidFindZoomableAreaCallback)(WKViewRef view, WKPoint point, WKRect area, const void* clientInfo); >+typedef void (*WKViewDoneWithTouchEventCallback)(WKViewRef view, WKTouchEventRef touchEvent, bool wasEventHandled, const void* clientInfo); > > struct WKViewClient { > int version; >@@ -51,6 +57,8 @@ struct WKViewClient { > WKViewCallback didCompletePageTransition; > WKViewPageDidChangeViewportAttributesCallback didChangeViewportAttributes; > WKViewPageDidChangeTooltipCallback didChangeTooltip; >+ WKViewDidFindZoomableAreaCallback didFindZoomableArea; >+ WKViewDoneWithTouchEventCallback doneWithTouchEvent; > }; > typedef struct WKViewClient WKViewClient; > >@@ -103,6 +111,8 @@ WK_EXPORT bool WKViewExitFullScreen(WKViewRef); > WK_EXPORT void WKViewSetOpacity(WKViewRef view, double opacity); > WK_EXPORT double WKViewOpacity(WKViewRef view); > >+WK_EXPORT void WKViewFindZoomableAreaForRect(WKViewRef, WKRect); >+ > #ifdef __cplusplus > } > #endif >diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKAPICastEfl.h b/Source/WebKit2/UIProcess/API/C/efl/WKAPICastEfl.h >index 351a19f..abedd68 100644 >--- a/Source/WebKit2/UIProcess/API/C/efl/WKAPICastEfl.h >+++ b/Source/WebKit2/UIProcess/API/C/efl/WKAPICastEfl.h >@@ -27,6 +27,11 @@ > #include <WebCore/TextDirection.h> > #include <WebKit2/WKPopupItem.h> > >+#if ENABLE(TOUCH_EVENTS) >+#include "WebEvent.h" >+#include <WebKit2/WKEventEfl.h> >+#endif >+ > namespace WebKit { > > class WebView; >@@ -45,6 +50,12 @@ WK_ADD_API_MAPPING(WKTouchEventRef, EwkTouchEvent) > WK_ADD_API_MAPPING(WKTouchPointRef, EwkTouchPoint) > #endif > >+#if ENABLE(GESTURE_EVENTS) >+class EwkGestureEvent; >+ >+WK_ADD_API_MAPPING(WKGestureEventRef, EwkGestureEvent) >+#endif >+ > // Enum conversions. > inline WKPopupItemTextDirection toAPI(WebCore::TextDirection direction) > { >@@ -62,6 +73,83 @@ inline WKPopupItemTextDirection toAPI(WebCore::TextDirection direction) > return wkDirection; > } > >+inline WKEventType toAPI(WebEvent::Type type) >+{ >+ switch (type) { >+#if ENABLE(TOUCH_EVENTS) >+ case WebEvent::TouchStart: >+ return kWKEventTypeTouchStart; >+ case WebEvent::TouchMove: >+ return kWKEventTypeTouchMove; >+ case WebEvent::TouchEnd: >+ return kWKEventTypeTouchEnd; >+ case WebEvent::TouchCancel: >+ return kWKEventTypeTouchCancel; >+#endif >+ default: >+ return kWKEventTypeNoType; >+ } >+} >+ >+#if ENABLE(TOUCH_EVENTS) >+inline WKTouchPointState toAPI(WebPlatformTouchPoint::TouchPointState state) >+{ >+ switch (state) { >+ case WebPlatformTouchPoint::TouchReleased: >+ return kWKTouchPointStateTouchReleased; >+ case WebPlatformTouchPoint::TouchPressed: >+ return kWKTouchPointStateTouchPressed; >+ case WebPlatformTouchPoint::TouchMoved: >+ return kWKTouchPointStateTouchMoved; >+ case WebPlatformTouchPoint::TouchStationary: >+ return kWKTouchPointStateTouchStationary; >+ case WebPlatformTouchPoint::TouchCancelled: >+ return kWKTouchPointStateTouchCancelled; >+ } >+ >+ ASSERT_NOT_REACHED(); >+ return kWKTouchPointStateTouchCancelled; >+} >+#endif >+ >+inline WebEvent::Type toWebEventType(WKEventType type) >+{ >+ switch (type) { >+#if ENABLE(TOUCH_EVENTS) >+ case kWKEventTypeTouchStart: >+ return WebEvent::TouchStart; >+ case kWKEventTypeTouchMove: >+ return WebEvent::TouchMove; >+ case kWKEventTypeTouchEnd: >+ return WebEvent::TouchEnd; >+ case kWKEventTypeTouchCancel: >+ return WebEvent::TouchCancel; >+#endif >+#if ENABLE(GESTURE_EVENTS) >+ case kWKEventTypeGestureSingleTap: >+ return WebEvent::GestureSingleTap; >+#endif >+ default: >+ return WebEvent::NoType; >+ } >+} >+ >+inline WebEvent::Modifiers toWebEventModifiers(unsigned modifiers) >+{ >+ unsigned result = 0; >+ >+ if (modifiers & kWKEventModifiersShiftKey) >+ result |= WebEvent::ShiftKey; >+ if (modifiers & kWKEventModifiersControlKey) >+ result |= WebEvent::ControlKey; >+ if (modifiers & kWKEventModifiersAltKey) >+ result |= WebEvent::AltKey; >+ if (modifiers & kWKEventModifiersMetaKey) >+ result |= WebEvent::MetaKey; >+ >+ return static_cast<WebEvent::Modifiers>(result); >+} >+ > } > > #endif // WKAPICastEfl_h >diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.cpp b/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.cpp >index 6d5071f..e97029c 100644 >--- a/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.cpp >+++ b/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.cpp >@@ -32,6 +32,10 @@ > #include "WKAPICast.h" > #include "WebEvent.h" > >+#if ENABLE(GESTURE_EVENTS) >+#include "EwkGestureEvent.h" >+#endif >+ > using namespace WebKit; > > WKTouchPointRef WKTouchPointCreate(int id, WKPoint position, WKPoint screenPosition, WKTouchPointState state, WKSize radius, float rotationAngle, float forceFactor) >@@ -62,3 +66,130 @@ WKTouchEventRef WKTouchEventCreate(WKEventType type, WKArrayRef wkTouchPoints, W > return 0; > #endif > } >+ >+WKEventType WKTouchEventGetType(WKTouchEventRef event) >+{ >+#if ENABLE(TOUCH_EVENTS) >+ return toImpl(event)->eventType(); >+#else >+ UNUSED_PARAM(event); >+ return kWKEventTypeNoType; >+#endif >+} >+ >+WKArrayRef WKTouchEventGetTouchPoints(WKTouchEventRef event) >+{ >+#if ENABLE(TOUCH_EVENTS) >+ return toImpl(event)->touchPoints(); >+#else >+ UNUSED_PARAM(event); >+ return 0; >+#endif >+} >+ >+WKEventModifiers WKTouchEventGetModifiers(WKTouchEventRef event) >+{ >+#if ENABLE(TOUCH_EVENTS) >+ return toImpl(event)->modifiers(); >+#else >+ UNUSED_PARAM(event); >+ return 0; >+#endif >+} >+ >+double WKTouchEventGetTimestamp(WKTouchEventRef event) >+{ >+#if ENABLE(TOUCH_EVENTS) >+ return toImpl(event)->timestamp(); >+#else >+ UNUSED_PARAM(event); >+ return 0; >+#endif >+} >+ >+uint32_t WKTouchPointGetID(WKTouchPointRef point) >+{ >+#if ENABLE(TOUCH_EVENTS) >+ return toImpl(point)->id(); >+#else >+ UNUSED_PARAM(point); >+ return 0; >+#endif >+} >+ >+WKTouchPointState WKTouchPointGetState(WKTouchPointRef point) >+{ >+#if ENABLE(TOUCH_EVENTS) >+ return toImpl(point)->state(); >+#else >+ UNUSED_PARAM(point); >+ return kWKTouchPointStateTouchCancelled; >+#endif >+} >+ >+WKPoint WKTouchPointGetScreenPosition(WKTouchPointRef point) >+{ >+#if ENABLE(TOUCH_EVENTS) >+ return toImpl(point)->screenPosition(); >+#else >+ UNUSED_PARAM(point); >+ return WKPointMake(0, 0); >+#endif >+} >+ >+WKPoint WKTouchPointGetPosition(WKTouchPointRef point) >+{ >+#if ENABLE(TOUCH_EVENTS) >+ return toImpl(point)->position(); >+#else >+ UNUSED_PARAM(point); >+ return WKPointMake(0, 0); >+#endif >+} >+ >+WKSize WKTouchPointGetRadius(WKTouchPointRef point) >+{ >+#if ENABLE(TOUCH_EVENTS) >+ return toImpl(point)->radius(); >+#else >+ UNUSED_PARAM(point); >+ return WKSizeMake(0, 0); >+#endif >+} >+ >+float WKTouchPointGetRotationAngle(WKTouchPointRef point) >+{ >+#if ENABLE(TOUCH_EVENTS) >+ return toImpl(point)->rotationAngle(); >+#else >+ UNUSED_PARAM(point); >+ return 0; >+#endif >+} >+ >+float WKTouchPointGetForceFactor(WKTouchPointRef point) >+{ >+#if ENABLE(TOUCH_EVENTS) >+ return toImpl(point)->forceFactor(); >+#else >+ UNUSED_PARAM(point); >+ return 0; >+#endif >+} >+ >+WKGestureEventRef WKGestureEventCreate(WKEventType type, WKPoint position, WKPoint screenPosition, WKEventModifiers modifiers, double timestamp, WKSize area, float deltaX, float deltaY) >+{ >+#if ENABLE(GESTURE_EVENTS) >+ return toAPI(EwkGestureEvent::create(type, position, screenPosition, modifiers, timestamp, area, deltaX, deltaY).leakRef()); >+#else >+ UNUSED_PARAM(type); >+ UNUSED_PARAM(position); >+ UNUSED_PARAM(screenPosition); >+ UNUSED_PARAM(modifiers); >+ UNUSED_PARAM(timestamp); >+ UNUSED_PARAM(area); >+ UNUSED_PARAM(deltaX); >+ UNUSED_PARAM(deltaY); >+ return 0; >+#endif >+} >diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.h b/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.h >index cda2636..9e75311 100644 >--- a/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.h >+++ b/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.h >@@ -39,7 +39,8 @@ enum WKEventType { > kWKEventTypeTouchStart, > kWKEventTypeTouchMove, > kWKEventTypeTouchEnd, >- kWKEventTypeTouchCancel >+ kWKEventTypeTouchCancel, >+ kWKEventTypeGestureSingleTap > }; > typedef enum WKEventType WKEventType; > >@@ -55,6 +56,21 @@ typedef enum WKTouchPointState WKTouchPointState; > WK_EXPORT WKTouchPointRef WKTouchPointCreate(int id, WKPoint position, WKPoint screenPosition, WKTouchPointState, WKSize radius, float rotationAngle, float forceFactor); > WK_EXPORT WKTouchEventRef WKTouchEventCreate(WKEventType, WKArrayRef, WKEventModifiers, double timestamp); > >+WK_EXPORT WKEventType WKTouchEventGetType(WKTouchEventRef); >+WK_EXPORT WKArrayRef WKTouchEventGetTouchPoints(WKTouchEventRef); >+WK_EXPORT WKEventModifiers WKTouchEventGetModifiers(WKTouchEventRef); >+WK_EXPORT double WKTouchEventGetTimestamp(WKTouchEventRef); >+ >+WK_EXPORT uint32_t WKTouchPointGetID(WKTouchPointRef); >+WK_EXPORT WKTouchPointState WKTouchPointGetState(WKTouchPointRef); >+WK_EXPORT WKPoint WKTouchPointGetScreenPosition(WKTouchPointRef); >+WK_EXPORT WKPoint WKTouchPointGetPosition(WKTouchPointRef); >+WK_EXPORT WKSize WKTouchPointGetRadius(WKTouchPointRef); >+WK_EXPORT float WKTouchPointGetRotationAngle(WKTouchPointRef); >+WK_EXPORT float WKTouchPointGetForceFactor(WKTouchPointRef); >+ >+WK_EXPORT WKGestureEventRef WKGestureEventCreate(WKEventType, WKPoint position, WKPoint screenPosition, WKEventModifiers, double timestamp, WKSize area, float deltaX, float deltaY); >+ > #ifdef __cplusplus > } > #endif >diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.cpp b/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.cpp >index cefa2d3..ce86dc1 100644 >--- a/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.cpp >+++ b/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.cpp >@@ -58,3 +58,13 @@ void WKViewSendTouchEvent(WKViewRef viewRef, WKTouchEventRef touchEventRef) > UNUSED_PARAM(touchEventRef); > #endif > } >+ >+void WKViewSendGestureEvent(WKViewRef viewRef, WKGestureEventRef gestureEventRef) >+{ >+#if ENABLE(GESTURE_EVENTS) >+ static_cast<WebViewEfl*>(toImpl(viewRef))->sendGestureEvent(toImpl(gestureEventRef)); >+#else >+ UNUSED_PARAM(viewRef); >+ UNUSED_PARAM(gestureEventRef); >+#endif >+} >diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.h b/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.h >index d8afdc4..6f7282f 100644 >--- a/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.h >+++ b/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.h >@@ -42,6 +42,8 @@ WK_EXPORT void WKViewSetThemePath(WKViewRef, WKStringRef); > > WK_EXPORT void WKViewSendTouchEvent(WKViewRef, WKTouchEventRef); > >+WK_EXPORT void WKViewSendGestureEvent(WKViewRef, WKGestureEventRef); >+ > #ifdef __cplusplus > } > #endif >diff --git a/Source/WebKit2/UIProcess/API/efl/EasingCurves.cpp b/Source/WebKit2/UIProcess/API/efl/EasingCurves.cpp >new file mode 100644 >index 0000000..f6ccf46 >--- /dev/null >+++ b/Source/WebKit2/UIProcess/API/efl/EasingCurves.cpp >@@ -0,0 +1,47 @@ >+/* >+ * Copyright (C) 2001 Robert Penner All rights reserved. >+ * Copyright (C) 2013 Samsung Electronics. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * 3. Neither the name of the author nor the names of contributors may be >+ * used to endorse or promote products derived from this software >+ * without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"AS IS" >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE >+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE >+ * POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+/* >+ * Robert Penner's easing equations. http://www.robertpenner.com/easing/ >+ * static function easeInOutQuad (t:Number, b:Number, c:Number, d:Number):Number { >+ * if ((t/=d/2) < 1) return c/2*t*t + b; >+ * return -c/2 * ((--t)*(t-2) - 1) + b; >+ * } >+ */ >+float easeInOutQuad(float time, const float base, const float constant, const unsigned duration) >+{ >+ if (time > duration || time < 0) >+ return 0; >+ >+ if ((time /= (duration / 2)) < 1) >+ return (constant / 2) * time * time + base; >+ >+ time -= 1; >+ return -1 * (constant / 2) * (time * (time - 2) - 1) + base; >+} >diff --git a/Source/WebKit2/UIProcess/API/efl/EasingCurves.h b/Source/WebKit2/UIProcess/API/efl/EasingCurves.h >new file mode 100644 >index 0000000..b726c6f >--- /dev/null >+++ b/Source/WebKit2/UIProcess/API/efl/EasingCurves.h >@@ -0,0 +1,35 @@ >+/* >+ * Copyright (C) 2001 Robert Penner All rights reserved. >+ * Copyright (C) 2013 Samsung Electronics. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * 3. Neither the name of the author nor the names of contributors may be >+ * used to endorse or promote products derived from this software >+ * without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"AS IS" >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE >+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE >+ * POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef EasingCurves_h >+#define EasingCurves_h >+ >+float easeInOutQuad(float time, const float base, const float constant, const unsigned duration); >+ >+#endif // EasingCurves_h >diff --git a/Source/WebKit2/UIProcess/API/efl/EwkView.cpp b/Source/WebKit2/UIProcess/API/efl/EwkView.cpp >index b336110..f9f5b45 100644 >--- a/Source/WebKit2/UIProcess/API/efl/EwkView.cpp >+++ b/Source/WebKit2/UIProcess/API/efl/EwkView.cpp >@@ -73,6 +73,7 @@ > #endif > #include <WebCore/CairoUtilitiesEfl.h> > #include <WebCore/Cursor.h> >+#include <WebCore/NotImplemented.h> > #include <WebCore/PlatformContextCairo.h> > #include <WebKit2/WKImageCairo.h> > #include <wtf/MathExtras.h> >@@ -85,6 +86,11 @@ > #include "WebFullScreenManagerProxy.h" > #endif > >+#if ENABLE(TOUCH_EVENTS) >+#include "GestureRecognizer.h" >+#include "GestureRecognizerClientEfl.h" >+#endif >+ > using namespace EwkViewCallbacks; > using namespace WebCore; > using namespace WebKit; >@@ -274,6 +280,8 @@ EwkView::EwkView(WKViewRef view, Evas_Object* evasObject) > , m_mouseEventsEnabled(false) > #if ENABLE(TOUCH_EVENTS) > , m_touchEventsEnabled(false) >+ , m_gestureRecognizerClient(GestureRecognizerClientEfl::create(this)) >+ , m_gestureRecognizer(GestureRecognizer::create(m_gestureRecognizerClient.get())) > #endif > , m_displayTimer(this, &EwkView::displayTimerFired) > , m_inputMethodContext(InputMethodContextEfl::create(this, smartData()->base.evas)) >@@ -790,6 +798,16 @@ void EwkView::setTouchEventsEnabled(bool enabled) > evas_object_event_callback_del(m_evasObject, EVAS_CALLBACK_MULTI_MOVE, handleTouchMove); > } > } >+ >+void EwkView::doneWithTouchEvent(WKTouchEventRef event, bool wasEventHandled) >+{ >+ if (wasEventHandled) { >+ m_gestureRecognizer->reset(); >+ return; >+ } >+ >+ m_gestureRecognizer->processTouchEvent(event); >+} > #endif > > #if USE(ACCELERATED_COMPOSITING) >@@ -897,7 +915,7 @@ void EwkView::showContextMenu(WKPoint position, WKArrayRef items) > > m_contextMenu = EwkContextMenu::create(this, items); > >- position = WKViewContentsToUserViewport(wkView(), position); >+ position = WKViewUserViewportToScene(wkView(), WKViewContentsToUserViewport(wkView(), position)); > > sd->api->context_menu_show(sd, position.x, position.y, m_contextMenu.get()); > } >@@ -934,7 +952,7 @@ void EwkView::requestPopupMenu(WKPopupMenuListenerRef popupMenuListener, const W > > m_popupMenu = EwkPopupMenu::create(this, popupMenuListener, items, selectedIndex); > >- WKPoint popupMenuPosition = WKViewContentsToUserViewport(wkView(), rect.origin); >+ WKPoint popupMenuPosition = WKViewUserViewportToScene(wkView(), WKViewContentsToUserViewport(wkView(), rect.origin)); > > Eina_Rectangle einaRect; > EINA_RECTANGLE_SET(&einaRect, popupMenuPosition.x, popupMenuPosition.y, rect.size.width, rect.size.height); >@@ -1374,6 +1392,28 @@ PassRefPtr<cairo_surface_t> EwkView::takeSnapshot() > return snapshot.release(); > } > >+void EwkView::didFindZoomableArea(const WKPoint& point, const WKRect& area) >+{ >+ m_pageViewportControllerClient->scaleToAreaWithAnimation(toIntPoint(point), toIntRect(area), 5); >+} >+ >+bool EwkView::scrollBy(const IntSize& offset) >+{ >+ WKPoint oldPosition = WKViewGetContentPosition(wkView()); >+ FloatPoint newPosition = FloatPoint(oldPosition.x + offset.width(), oldPosition.y + offset.height()); >+ WKViewSetContentPosition(wkView(), WKPointMake(newPosition.x(), newPosition.y())); >+ >+ WKPoint position = WKViewGetContentPosition(wkView()); >+ float contentScale = WKViewGetContentScaleFactor(wkView()); >+ m_pageViewportController->didChangeContentsVisibility(FloatPoint(position.x / contentScale, position.y / contentScale), contentScale); >+ >+ // If the page position is not changed, notify that using returning value. >+ if (oldPosition == position) >+ return false; >+ >+ return true; >+} >+ > Evas_Smart_Class EwkView::parentSmartClass = EVAS_SMART_CLASS_INIT_NULL; > > // Free Ewk View functions. >diff --git a/Source/WebKit2/UIProcess/API/efl/EwkView.h b/Source/WebKit2/UIProcess/API/efl/EwkView.h >index 04317a6..88356af 100644 >--- a/Source/WebKit2/UIProcess/API/efl/EwkView.h >+++ b/Source/WebKit2/UIProcess/API/efl/EwkView.h >@@ -71,6 +71,11 @@ class WebPageProxy; > #if ENABLE(VIBRATION) > class VibrationClientEfl; > #endif >+ >+#if ENABLE(TOUCH_EVENTS) >+class GestureRecognizer; >+class GestureRecognizerClientEfl; >+#endif > } > > namespace WebCore { >@@ -146,6 +151,7 @@ public: > void feedTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers); > bool touchEventsEnabled() const { return m_touchEventsEnabled; } > void setTouchEventsEnabled(bool enabled); >+ void doneWithTouchEvent(WKTouchEventRef, bool); > #endif > > void setCursor(const WebCore::Cursor& cursor); >@@ -200,6 +206,9 @@ public: > void informURLChange(); > > PassRefPtr<cairo_surface_t> takeSnapshot(); >+ bool scrollBy(const WebCore::IntSize&); >+ >+ void didFindZoomableArea(const WKPoint&, const WKRect&); > > private: > EwkView(WKViewRef, Evas_Object*); >@@ -276,6 +285,8 @@ private: > bool m_mouseEventsEnabled; > #if ENABLE(TOUCH_EVENTS) > bool m_touchEventsEnabled; >+ OwnPtr<WebKit::GestureRecognizerClientEfl> m_gestureRecognizerClient; >+ OwnPtr<WebKit::GestureRecognizer> m_gestureRecognizer; > #endif > WebCore::Timer<EwkView> m_displayTimer; > RefPtr<EwkContextMenu> m_contextMenu; >diff --git a/Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp b/Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp >new file mode 100644 >index 0000000..79894bb >--- /dev/null >+++ b/Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp >@@ -0,0 +1,332 @@ >+/* >+ * Copyright (C) 2013 Samsung Electronics. All rights reserved. >+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies) >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "GestureRecognizer.h" >+ >+#include "EwkView.h" >+#include "WKSharedAPICast.h" >+ >+#if ENABLE(TOUCH_EVENTS) >+ >+using namespace WebCore; >+ >+namespace WebKit { >+ >+const double GestureRecognizer::s_doubleTapTimeoutInSeconds = 0.4; >+const double GestureRecognizer::s_tapAndHoldTimeoutInSeconds = 1.0; >+const int GestureRecognizer::s_squaredDoubleTapThreshold = 10000; >+const int GestureRecognizer::s_squaredPanThreshold = 100; >+const int GestureRecognizer::s_historyCapacity = 5; >+ >+GestureRecognizer::GestureRecognizer(GestureRecognizerClient* client) >+ : m_recognizerFunction(&GestureRecognizer::noGesture) >+ , m_client(client) >+ , m_tapAndHoldTimer(0) >+ , m_doubleTapTimer(0) >+ , m_panAnimator(0) >+ , m_isCurrentPointUpdated(false) >+ , m_firstHistoryItemIndex(0) >+{ >+ m_history.reserveCapacity(s_historyCapacity); >+} >+ >+void GestureRecognizer::processTouchEvent(WKTouchEventRef eventRef) >+{ >+ WKEventType type = WKTouchEventGetType(eventRef); >+ if (type == kWKEventTypeTouchCancel) { >+ reset(); >+ return; >+ } >+ >+ (this->*m_recognizerFunction)(type, WKTouchEventGetTouchPoints(eventRef)); >+} >+ >+Eina_Bool GestureRecognizer::doubleTapTimerCallback(void* data) >+{ >+ GestureRecognizer* gestureRecognizer = static_cast<GestureRecognizer*>(data); >+ gestureRecognizer->m_doubleTapTimer = 0; >+ >+ // If doubleTapTimer is fired we should not process double tap, >+ // so process single tap here if touched point is already released >+ // or do nothing for processing single tap when touch is released. >+ if (gestureRecognizer->m_recognizerFunction == &GestureRecognizer::doubleTapGesture) { >+ gestureRecognizer->m_client->handleSingleTap(gestureRecognizer->m_firstPressedPoint); >+ gestureRecognizer->m_recognizerFunction = &GestureRecognizer::noGesture; >+ } >+ >+ return ECORE_CALLBACK_CANCEL; >+} >+ >+Eina_Bool GestureRecognizer::tapAndHoldTimerCallback(void* data) >+{ >+ GestureRecognizer* gestureRecognizer = static_cast<GestureRecognizer*>(data); >+ gestureRecognizer->m_tapAndHoldTimer = 0; >+ gestureRecognizer->m_client->handleTapAndHold(gestureRecognizer->m_firstPressedPoint); >+ gestureRecognizer->m_recognizerFunction = &GestureRecognizer::noGesture; >+ >+ return ECORE_CALLBACK_CANCEL; >+} >+ >+static inline WKPoint getPointAtIndex(WKArrayRef array, size_t index) >+{ >+ WKTouchPointRef pointRef = static_cast<WKTouchPointRef>(WKArrayGetItemAtIndex(array, index)); >+ ASSERT(pointRef); >+ >+ return WKTouchPointGetPosition(pointRef); >+} >+ >+static inline Vector<IntPoint>* createVectorWithWKArray(WKArrayRef array, size_t size) >+{ >+ Vector<IntPoint>* points = new Vector<IntPoint>(size); >+ for (size_t i = 0; i < size; ++i) >+ points->uncheckedAppend(toIntPoint(getPointAtIndex(array, i))); >+ >+ return points; >+} >+ >+void GestureRecognizer::noGesture(WKEventType type, WKArrayRef touchPoints) >+{ >+ switch (type) { >+ case kWKEventTypeTouchStart: >+ m_client->handleFlickCanceled(); >+ >+ m_recognizerFunction = &GestureRecognizer::singleTapGesture; >+ m_firstPressedPoint = toIntPoint(getPointAtIndex(touchPoints, 0)); >+ ASSERT(m_tapAndHoldTimer); >+ m_tapAndHoldTimer = ecore_timer_add(s_tapAndHoldTimeoutInSeconds, tapAndHoldTimerCallback, this); >+ m_doubleTapTimer = ecore_timer_add(s_doubleTapTimeoutInSeconds, doubleTapTimerCallback, this); >+ break; >+ default: >+ break; >+ } >+} >+ >+void GestureRecognizer::singleTapGesture(WKEventType type, WKArrayRef touchPoints) >+{ >+ switch (type) { >+ case kWKEventTypeTouchStart: >+ stopTapTimers(); >+ m_recognizerFunction = &GestureRecognizer::pinchGesture; >+ m_client->handlePinchStarted(*adoptPtr(createVectorWithWKArray(touchPoints, 2)).get()); >+ break; >+ case kWKEventTypeTouchMove: { >+ IntPoint currentPoint = toIntPoint(getPointAtIndex(touchPoints, 0)); >+ if (m_firstPressedPoint.distanceSquaredToPoint(currentPoint) > s_squaredPanThreshold) { >+ stopTapTimers(); >+ m_recognizerFunction = &GestureRecognizer::panGesture; >+ handlePanStarted(currentPoint); >+ } >+ break; >+ } >+ case kWKEventTypeTouchEnd: >+ if (m_tapAndHoldTimer) { >+ ecore_timer_del(m_tapAndHoldTimer); >+ m_tapAndHoldTimer = 0; >+ } >+ >+ if (m_doubleTapTimer) >+ m_recognizerFunction = &GestureRecognizer::doubleTapGesture; >+ else { >+ m_client->handleSingleTap(m_firstPressedPoint); >+ m_recognizerFunction = &GestureRecognizer::noGesture; >+ } >+ break; >+ default: >+ break; >+ } >+} >+ >+void GestureRecognizer::doubleTapGesture(WKEventType type, WKArrayRef touchPoints) >+{ >+ switch (type) { >+ case kWKEventTypeTouchStart: { >+ if (m_doubleTapTimer) { >+ ecore_timer_del(m_doubleTapTimer); >+ m_doubleTapTimer = 0; >+ } >+ >+ size_t numberOfTouchPoints = WKArrayGetSize(touchPoints); >+ if (numberOfTouchPoints == 1) { >+ if (m_firstPressedPoint.distanceSquaredToPoint(toIntPoint(getPointAtIndex(touchPoints, 0))) > s_squaredDoubleTapThreshold) >+ m_recognizerFunction = &GestureRecognizer::singleTapGesture; >+ } else { >+ m_recognizerFunction = &GestureRecognizer::pinchGesture; >+ m_client->handlePinchStarted(*adoptPtr(createVectorWithWKArray(touchPoints, 2)).get()); >+ } >+ break; >+ } >+ case kWKEventTypeTouchMove: { >+ IntPoint currentPoint = toIntPoint(getPointAtIndex(touchPoints, 0)); >+ if (m_firstPressedPoint.distanceSquaredToPoint(currentPoint) > s_squaredPanThreshold) { >+ m_recognizerFunction = &GestureRecognizer::panGesture; >+ handlePanStarted(currentPoint); >+ } >+ break; >+ } >+ case kWKEventTypeTouchEnd: >+ m_client->handleDoubleTap(m_firstPressedPoint); >+ m_recognizerFunction = &GestureRecognizer::noGesture; >+ break; >+ default: >+ break; >+ } >+} >+ >+void GestureRecognizer::panGesture(WKEventType type, WKArrayRef touchPoints) >+{ >+ switch (type) { >+ case kWKEventTypeTouchStart: >+ m_recognizerFunction = &GestureRecognizer::pinchGesture; >+ m_client->handlePinchStarted(*adoptPtr(createVectorWithWKArray(touchPoints, 2)).get()); >+ break; >+ case kWKEventTypeTouchMove: >+ updateCurrentPoint(toIntPoint(getPointAtIndex(touchPoints, 0))); >+ break; >+ case kWKEventTypeTouchEnd: >+ handlePanFinished(); >+ m_recognizerFunction = &GestureRecognizer::noGesture; >+ break; >+ default: >+ break; >+ } >+} >+ >+void GestureRecognizer::pinchGesture(WKEventType type, WKArrayRef touchPoints) >+{ >+ size_t numberOfTouchPoints = WKArrayGetSize(touchPoints); >+ ASSERT(numberOfTouchPoints >= 2); >+ >+ switch (type) { >+ case kWKEventTypeTouchMove: { >+ m_client->handlePinch(*adoptPtr(createVectorWithWKArray(touchPoints, 2)).get()); >+ break; >+ } >+ case kWKEventTypeTouchEnd: >+ if (numberOfTouchPoints == 2) { >+ m_client->handlePinchFinished(); >+ m_recognizerFunction = &GestureRecognizer::panGesture; >+ WKTouchPointRef pointRef; >+ for (size_t i = 0; i < numberOfTouchPoints; ++i) { >+ pointRef = static_cast<WKTouchPointRef>(WKArrayGetItemAtIndex(touchPoints, i)); >+ WKTouchPointState state = WKTouchPointGetState(pointRef); >+ if (state != kWKTouchPointStateTouchReleased && state != kWKTouchPointStateTouchCancelled) >+ break; >+ } >+ ASSERT(pointRef); >+ handlePanStarted(toIntPoint(WKTouchPointGetPosition(pointRef))); >+ } >+ break; >+ default: >+ break; >+ } >+} >+ >+void GestureRecognizer::reset() >+{ >+ stopTapTimers(); >+ >+ if (m_panAnimator) { >+ ecore_animator_del(m_panAnimator); >+ m_panAnimator = 0; >+ } >+ >+ m_recognizerFunction = &GestureRecognizer::noGesture; >+} >+ >+void GestureRecognizer::stopTapTimers() >+{ >+ if (m_doubleTapTimer) { >+ ecore_timer_del(m_doubleTapTimer); >+ m_doubleTapTimer = 0; >+ } >+ >+ if (m_tapAndHoldTimer) { >+ ecore_timer_del(m_tapAndHoldTimer); >+ m_tapAndHoldTimer = 0; >+ } >+} >+ >+Eina_Bool GestureRecognizer::panAnimatorCallback(void* data) >+{ >+ GestureRecognizer* gestureRecognizer = static_cast<GestureRecognizer*>(data); >+ if (!gestureRecognizer->m_isCurrentPointUpdated) >+ return ECORE_CALLBACK_RENEW; >+ >+ gestureRecognizer->m_client->handlePan(gestureRecognizer->m_currentPoint); >+ gestureRecognizer->m_isCurrentPointUpdated = false; >+ >+ return ECORE_CALLBACK_RENEW; >+} >+ >+void GestureRecognizer::handlePanStarted(const IntPoint& point) >+{ >+ ASSERT(!m_panAnimator); >+ m_panAnimator = ecore_animator_add(panAnimatorCallback, this); >+ m_currentPoint = point; >+ m_firstHistoryItemIndex = 0; >+ m_history.resize(0); >+ >+ m_client->handlePanStarted(point); >+} >+ >+void GestureRecognizer::updateCurrentPoint(const IntPoint& point) >+{ >+ m_currentPoint = point; >+ m_isCurrentPointUpdated = true; >+ >+ // Save current point to use to calculate offset of flick. >+ HistoryItem item = {m_currentPoint, ecore_time_get()}; >+ if (m_history.size() < m_history.capacity()) >+ m_history.uncheckedAppend(item); >+ else { >+ m_history[m_firstHistoryItemIndex++] = item; >+ if (m_firstHistoryItemIndex >= m_history.capacity()) >+ m_firstHistoryItemIndex %= m_history.capacity(); >+ } >+} >+ >+void GestureRecognizer::handlePanFinished() >+{ >+ ASSERT(m_panAnimator); >+ ecore_animator_del(m_panAnimator); >+ m_panAnimator = 0; >+ >+ if (!m_history.isEmpty()) { >+ // Calculate offset to move during one frame. >+ const HistoryItem& firstHistoryItem = m_history[m_firstHistoryItemIndex]; >+ double frame = (ecore_time_get() - firstHistoryItem.timestamp) / ecore_animator_frametime_get(); >+ IntSize offset = firstHistoryItem.point - m_currentPoint; >+ offset.scale(1 / frame); >+ m_client->handleFlick(offset); >+ } >+ >+ m_client->handlePanFinished(); >+} >+ >+} // namespace WebKit >+ >+#endif // ENABLE(TOUCH_EVENTS) >diff --git a/Source/WebKit2/UIProcess/API/efl/GestureRecognizer.h b/Source/WebKit2/UIProcess/API/efl/GestureRecognizer.h >new file mode 100644 >index 0000000..12a4dc8 >--- /dev/null >+++ b/Source/WebKit2/UIProcess/API/efl/GestureRecognizer.h >@@ -0,0 +1,118 @@ >+/* >+ * Copyright (C) 2013 Samsung Electronics. All rights reserved. >+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies) >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef GestureRecognizer_h >+#define GestureRecognizer_h >+ >+#if ENABLE(TOUCH_EVENTS) >+ >+#include <Ecore.h> >+#include <WebCore/IntPoint.h> >+#include <WebKit2/WKEventEfl.h> >+#include <wtf/PassOwnPtr.h> >+#include <wtf/Vector.h> >+ >+namespace WebKit { >+ >+class GestureRecognizerClient { >+public: >+ virtual ~GestureRecognizerClient() { } >+ >+ virtual void handleSingleTap(const WebCore::IntPoint&) { } >+ virtual void handleDoubleTap(const WebCore::IntPoint&) { } >+ virtual void handleTapAndHold(const WebCore::IntPoint&) { } >+ >+ virtual void handlePanStarted(const WebCore::IntPoint&) { } >+ virtual void handlePan(const WebCore::IntPoint&) { } >+ virtual void handlePanFinished() { } >+ virtual void handleFlick(const WebCore::IntSize&) { } >+ virtual void handleFlickCanceled() { } >+ >+ virtual void handlePinchStarted(const Vector<WebCore::IntPoint>&) { } >+ virtual void handlePinch(const Vector<WebCore::IntPoint>&) { } >+ virtual void handlePinchFinished() { } >+}; >+ >+class GestureRecognizer { >+public: >+ static PassOwnPtr<GestureRecognizer> create(GestureRecognizerClient* client) >+ { >+ return adoptPtr(new GestureRecognizer(client)); >+ } >+ >+ void processTouchEvent(WKTouchEventRef); >+ void reset(); >+ >+private: >+ explicit GestureRecognizer(GestureRecognizerClient*); >+ >+ static const double s_doubleTapTimeoutInSeconds; >+ static const double s_tapAndHoldTimeoutInSeconds; >+ static const int s_squaredDoubleTapThreshold; >+ static const int s_squaredPanThreshold; >+ static const int s_historyCapacity; >+ >+ static Eina_Bool doubleTapTimerCallback(void*); >+ static Eina_Bool tapAndHoldTimerCallback(void*); >+ static Eina_Bool panAnimatorCallback(void*); >+ >+ // State functions. >+ void noGesture(WKEventType, WKArrayRef); >+ void singleTapGesture(WKEventType, WKArrayRef); >+ void doubleTapGesture(WKEventType, WKArrayRef); >+ void panGesture(WKEventType, WKArrayRef); >+ void pinchGesture(WKEventType, WKArrayRef); >+ >+ void stopTapTimers(); >+ void handlePanStarted(const WebCore::IntPoint&); >+ void updateCurrentPoint(const WebCore::IntPoint&); >+ void handlePanFinished(); >+ >+ typedef void (GestureRecognizer::*RecognizerFunction)(WKEventType, WKArrayRef); >+ RecognizerFunction m_recognizerFunction; >+ >+ GestureRecognizerClient* m_client; >+ Ecore_Timer* m_tapAndHoldTimer; >+ Ecore_Timer* m_doubleTapTimer; >+ WebCore::IntPoint m_firstPressedPoint; >+ >+ Ecore_Animator* m_panAnimator; >+ WebCore::IntPoint m_currentPoint; >+ bool m_isCurrentPointUpdated; >+ >+ typedef struct { >+ WebCore::IntPoint point; >+ double timestamp; >+ } HistoryItem; >+ Vector<HistoryItem> m_history; >+ unsigned m_firstHistoryItemIndex; >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(TOUCH_EVENTS) >+ >+#endif // GestureRecognizer_h >diff --git a/Source/WebKit2/UIProcess/API/efl/GestureRecognizerClientEfl.cpp b/Source/WebKit2/UIProcess/API/efl/GestureRecognizerClientEfl.cpp >new file mode 100644 >index 0000000..d6cb498 >--- /dev/null >+++ b/Source/WebKit2/UIProcess/API/efl/GestureRecognizerClientEfl.cpp >@@ -0,0 +1,139 @@ >+/* >+ * Copyright (C) 2013 Samsung Electronics. All rights reserved. >+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies) >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "GestureRecognizerClientEfl.h" >+ >+#include "EasingCurves.h" >+#include "EwkView.h" >+#include "WKViewEfl.h" >+#include <WebCore/IntPoint.h> >+#include <WebCore/NotImplemented.h> >+ >+#if ENABLE(TOUCH_EVENTS) >+ >+using namespace WebCore; >+ >+namespace WebKit { >+ >+GestureRecognizerClientEfl::GestureRecognizerClientEfl(EwkView* view) >+ : m_view(view) >+ , m_flickAnimator(0) >+ , m_flickDuration(0) >+ , m_flickIndex(0) >+{ >+} >+ >+void GestureRecognizerClientEfl::handleSingleTap(const IntPoint& position) >+{ >+#if ENABLE(GESTURE_EVENTS) >+ WKViewSendGestureEvent(m_view->wkView(), adoptWK(WKGestureEventCreate(kWKEventTypeGestureSingleTap, toAPI(position), toAPI(m_view->transformToScreen().mapPoint(position)), 0, ecore_time_get(), WKSizeMake(0, 0), 0, 0)).get()); >+#else >+ UNUSED_PARAM(position); >+#endif >+} >+ >+void GestureRecognizerClientEfl::handleDoubleTap(const IntPoint& position) >+{ >+ WKViewFindZoomableAreaForRect(m_view->wkView(), WKRectMake(position.x(), position.y(), 1, 1)); >+} >+ >+void GestureRecognizerClientEfl::handleTapAndHold(const IntPoint&) >+{ >+ notImplemented(); >+} >+ >+void GestureRecognizerClientEfl::handlePanStarted(const IntPoint& point) >+{ >+ m_lastPoint = point; >+} >+ >+void GestureRecognizerClientEfl::handlePan(const IntPoint& point) >+{ >+ if (m_lastPoint == point) >+ return; >+ >+ m_view->scrollBy(m_lastPoint - point); >+ m_lastPoint = point; >+} >+ >+void GestureRecognizerClientEfl::handlePanFinished() >+{ >+ notImplemented(); >+} >+ >+Eina_Bool GestureRecognizerClientEfl::flickAnimatorCallback(void* data) >+{ >+ GestureRecognizerClientEfl* client = static_cast<GestureRecognizerClientEfl*>(data); >+ float multiplier = easeInOutQuad(client->m_flickIndex, 0, 1.0, client->m_flickDuration); >+ float offsetWidth = client->m_flickOffset.width() * multiplier; >+ float offsetHeight = client->m_flickOffset.height() * multiplier; >+ offsetWidth = (offsetWidth > 0) ? ceilf(offsetWidth) : floorf(offsetWidth); >+ offsetHeight = (offsetHeight > 0) ? ceilf(offsetHeight) : floorf(offsetHeight); >+ IntSize offset(offsetWidth, offsetHeight); >+ client->m_flickIndex--; >+ >+ if (offset.isZero() || !client->m_view->scrollBy(offset) || !client->m_flickIndex) { >+ client->m_flickAnimator = 0; >+ return false; >+ } >+ >+ return true; >+} >+ >+void GestureRecognizerClientEfl::handleFlick(const IntSize& offset) >+{ >+ m_flickOffset = offset; >+ m_flickIndex = m_flickDuration = 1 / ecore_animator_frametime_get(); >+ m_flickAnimator = ecore_animator_add(flickAnimatorCallback, this); >+} >+ >+void GestureRecognizerClientEfl::handleFlickCanceled() >+{ >+ if (m_flickAnimator) { >+ ecore_animator_del(m_flickAnimator); >+ m_flickAnimator = 0; >+ } >+} >+ >+void GestureRecognizerClientEfl::handlePinchStarted(const Vector<IntPoint>&) >+{ >+ notImplemented(); >+} >+ >+void GestureRecognizerClientEfl::handlePinch(const Vector<IntPoint>&) >+{ >+ notImplemented(); >+} >+ >+void GestureRecognizerClientEfl::handlePinchFinished() >+{ >+ notImplemented(); >+} >+ >+} // namespace WebKit >+ >+#endif // ENABLE(TOUCH_EVENTS) >diff --git a/Source/WebKit2/UIProcess/API/efl/GestureRecognizerClientEfl.h b/Source/WebKit2/UIProcess/API/efl/GestureRecognizerClientEfl.h >new file mode 100644 >index 0000000..5cf75d1 >--- /dev/null >+++ b/Source/WebKit2/UIProcess/API/efl/GestureRecognizerClientEfl.h >@@ -0,0 +1,83 @@ >+/* >+ * Copyright (C) 2013 Samsung Electronics. All rights reserved. >+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies) >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef GestureRecognizerClientEfl_h >+#define GestureRecognizerClientEfl_h >+ >+#if ENABLE(TOUCH_EVENTS) >+ >+#include "GestureRecognizer.h" >+#include <wtf/PassOwnPtr.h> >+#include <wtf/Vector.h> >+ >+class EwkView; >+ >+namespace WebCore { >+class IntPoint; >+} >+ >+namespace WebKit { >+ >+class GestureRecognizerClientEfl : public GestureRecognizerClient { >+public: >+ static PassOwnPtr<GestureRecognizerClientEfl> create(EwkView* view) >+ { >+ return adoptPtr(new GestureRecognizerClientEfl(view)); >+ } >+ >+ ~GestureRecognizerClientEfl() { } >+ >+ // GestureRecognizerClient. >+ virtual void handleSingleTap(const WebCore::IntPoint&); >+ virtual void handleDoubleTap(const WebCore::IntPoint&); >+ virtual void handleTapAndHold(const WebCore::IntPoint&); >+ virtual void handlePanStarted(const WebCore::IntPoint&); >+ virtual void handlePan(const WebCore::IntPoint&); >+ virtual void handlePanFinished(); >+ virtual void handleFlick(const WebCore::IntSize&); >+ virtual void handleFlickCanceled(); >+ virtual void handlePinchStarted(const Vector<WebCore::IntPoint>&); >+ virtual void handlePinch(const Vector<WebCore::IntPoint>&); >+ virtual void handlePinchFinished(); >+ >+private: >+ explicit GestureRecognizerClientEfl(EwkView*); >+ >+ static Eina_Bool flickAnimatorCallback(void* data); >+ >+ EwkView* m_view; >+ WebCore::IntPoint m_lastPoint; >+ Ecore_Animator* m_flickAnimator; >+ WebCore::IntSize m_flickOffset; >+ unsigned m_flickDuration; >+ unsigned m_flickIndex; >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(TOUCH_EVENTS) >+ >+#endif // GestureRecognizerClientEfl_h >diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/WebPageProxyCoordinatedGraphics.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/WebPageProxyCoordinatedGraphics.cpp >new file mode 100644 >index 0000000..e34a9b3 >--- /dev/null >+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/WebPageProxyCoordinatedGraphics.cpp >@@ -0,0 +1,55 @@ >+/* >+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies) >+ * Copyright (C) 2013 Samsung Electronics. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#if USE(COORDINATED_GRAPHICS) >+ >+#include "WebPageProxy.h" >+ >+#include "PageClient.h" >+#include "WebPageMessages.h" >+#include "WebProcessProxy.h" >+ >+using namespace WebCore; >+ >+namespace WebKit { >+ >+void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area) >+{ >+ if (!isValid()) >+ return; >+ >+ m_process->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID); >+} >+ >+void WebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area) >+{ >+ m_pageClient->didFindZoomableArea(target, area); >+} >+ >+} // namespace WebKit >+ >+#endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp >index e1b44e0..5f2fdca 100644 >--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp >+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp >@@ -105,6 +105,16 @@ void WebView::setVisible(bool visible) > m_page->viewStateDidChange(WebPageProxy::ViewIsVisible); > } > >+void WebView::setContentPosition(const WebCore::FloatPoint& position) >+{ >+ FloatRect bounds; >+ bounds.setWidth(std::max(0.f, ceilf(m_contentsSize.width() * m_contentScaleFactor)) - size().width()); >+ bounds.setHeight(std::max(0.f, ceilf(m_contentsSize.height() * m_contentScaleFactor)) - size().height()); >+ >+ m_contentPosition.setX(clampTo(position.x(), bounds.x(), bounds.width())); >+ m_contentPosition.setY(clampTo(position.y(), bounds.y(), bounds.height())); >+} >+ > void WebView::setUserViewportTranslation(double tx, double ty) > { > m_userViewportTransform = TransformationMatrix().translate(tx, ty); >@@ -112,7 +122,7 @@ void WebView::setUserViewportTranslation(double tx, double ty) > > IntPoint WebView::userViewportToContents(const IntPoint& point) const > { >- return transformFromScene().mapPoint(point); >+ return transformFromUserViewport().mapPoint(point); > } > > IntPoint WebView::userViewportToScene(const WebCore::IntPoint& point) const >@@ -122,7 +132,7 @@ IntPoint WebView::userViewportToScene(const WebCore::IntPoint& point) const > > IntPoint WebView::contentsToUserViewport(const IntPoint& point) const > { >- return transformToScene().mapPoint(point); >+ return transformToUserViewport().mapPoint(point); > } > > void WebView::paintToCurrentGLContext() >@@ -207,24 +217,39 @@ void WebView::didChangeContentsSize(const WebCore::IntSize& size) > updateViewportSize(); > } > >-AffineTransform WebView::transformFromScene() const >+void WebView::didFindZoomableArea(const WebCore::IntPoint& target, const WebCore::IntRect& area) > { >- return transformToScene().inverse(); >+ m_client.didFindZoomableArea(this, target, area); > } > >-AffineTransform WebView::transformToScene() const >+AffineTransform WebView::transformFromUserViewport() const >+{ >+ return transformToUserViewport().inverse(); >+} >+ >+AffineTransform WebView::transformToUserViewport() const > { > FloatPoint position = -m_contentPosition; > float effectiveScale = m_contentScaleFactor * m_page->deviceScaleFactor(); >- position.scale(effectiveScale, effectiveScale); >+ position.scale(m_page->deviceScaleFactor(), m_page->deviceScaleFactor()); > >- TransformationMatrix transform = m_userViewportTransform; >+ TransformationMatrix transform; > transform.translate(position.x(), position.y()); > transform.scale(effectiveScale); > > return transform.toAffineTransform(); > } > >+AffineTransform WebView::transformFromScene() const >+{ >+ return transformToScene().inverse(); >+} >+ >+AffineTransform WebView::transformToScene() const >+{ >+ return m_userViewportTransform.toAffineTransform().multiply(transformToUserViewport()); >+} >+ > CoordinatedGraphicsScene* WebView::coordinatedGraphicsScene() > { > DrawingAreaProxy* drawingArea = m_page->drawingArea(); >@@ -243,7 +268,9 @@ void WebView::updateViewportSize() > if (DrawingAreaProxy* drawingArea = page()->drawingArea()) { > // Web Process expects sizes in UI units, and not raw device units. > drawingArea->setSize(roundedIntSize(dipSize()), IntSize(), IntSize()); >- FloatRect visibleContentsRect(contentPosition(), visibleContentsSize()); >+ FloatPoint position = contentPosition(); >+ position.scale(1 / m_contentScaleFactor, 1 / m_contentScaleFactor); >+ FloatRect visibleContentsRect(position, visibleContentsSize()); > visibleContentsRect.intersect(FloatRect(FloatPoint(), contentsSize())); > drawingArea->setVisibleContentsRect(visibleContentsRect, FloatPoint()); > } >@@ -387,13 +414,20 @@ void WebView::doneWithKeyEvent(const NativeWebKeyboardEvent&, bool) > notImplemented(); > } > >-#if ENABLE(TOUCH_EVENTS) >-void WebView::doneWithTouchEvent(const NativeWebTouchEvent&, bool /*wasEventHandled*/) >+#if ENABLE(GESTURE_EVENTS) >+void WebView::doneWithGestureEvent(const WebGestureEvent&, bool) > { > notImplemented(); > } > #endif > >+#if ENABLE(TOUCH_EVENTS) >+void WebView::doneWithTouchEvent(const NativeWebTouchEvent& event, bool wasEventHandled) >+{ >+ m_client.doneWithTouchEvent(this, event, wasEventHandled); >+} >+#endif >+ > PassRefPtr<WebPopupMenuProxy> WebView::createPopupMenuProxy(WebPageProxy*) > { > notImplemented(); >@@ -530,6 +564,11 @@ void WebView::pageTransitionViewportReady() > m_client.didCompletePageTransition(this); > } > >+void WebView::findZoomableAreaForPoint(const IntPoint& point, const IntSize& size) >+{ >+ m_page->findZoomableAreaForPoint(transformFromScene().mapPoint(point), transformFromScene().mapSize(size)); >+} >+ > } // namespace WebKit > > #endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h >index 7ca3c62..0777895 100644 >--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h >+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h >@@ -66,7 +66,7 @@ public: > void setContentScaleFactor(float scaleFactor) { m_contentScaleFactor = scaleFactor; } > float contentScaleFactor() const { return m_contentScaleFactor; } > >- void setContentPosition(const WebCore::FloatPoint& position) { m_contentPosition = position; } >+ void setContentPosition(const WebCore::FloatPoint&); > const WebCore::FloatPoint& contentPosition() const { return m_contentPosition; } > > void setUserViewportTranslation(double tx, double ty); >@@ -93,6 +93,8 @@ public: > bool exitFullScreen(); > #endif > >+ void findZoomableAreaForPoint(const WebCore::IntPoint&, const WebCore::IntSize&); >+ > // View client. > void initializeClient(const WKViewClient*); > >@@ -101,8 +103,11 @@ public: > void didChangeContentsSize(const WebCore::IntSize&); > const WebCore::IntSize& contentsSize() const { return m_contentsSize; } > WebCore::FloatSize visibleContentsSize() const; >+ void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&); > > // FIXME: Should become private when Web Events creation is moved to WebView. >+ WebCore::AffineTransform transformFromUserViewport() const; >+ WebCore::AffineTransform transformToUserViewport() const; > WebCore::AffineTransform transformFromScene() const; > WebCore::AffineTransform transformToScene() const; > >@@ -167,6 +172,9 @@ protected: > #if ENABLE(TOUCH_EVENTS) > virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) OVERRIDE; > #endif >+#if ENABLE(GESTURE_EVENTS) >+ void doneWithGestureEvent(const WebGestureEvent&, bool) OVERRIDE; >+#endif > > virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) OVERRIDE; > virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) OVERRIDE; >diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/WebViewClient.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/WebViewClient.cpp >index ccc435f..bea9281 100644 >--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/WebViewClient.cpp >+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/WebViewClient.cpp >@@ -29,11 +29,16 @@ > > #include "WebViewClient.h" > >+#include "NotImplemented.h" > #include "WKAPICast.h" > #include "WKBase.h" > #include "WKRetainPtr.h" > #include "WebViewportAttributes.h" > >+#if ENABLE(TOUCH_EVENTS) >+#include "NativeWebTouchEvent.h" >+#endif >+ > using namespace WebCore; > > namespace WebKit { >@@ -111,6 +116,31 @@ void WebViewClient::didChangeTooltip(WebView* view, const String& tooltip) > m_client.didChangeTooltip(toAPI(view), adoptWK(toCopiedAPI(tooltip)).get(), m_client.clientInfo); > } > >+void WebViewClient::didFindZoomableArea(WebView* view, const IntPoint& target, const IntRect& area) >+{ >+ if (!m_client.didFindZoomableArea) >+ return; >+ >+ m_client.didFindZoomableArea(toAPI(view), toAPI(target), toAPI(area), m_client.clientInfo); >+} >+ >+#if ENABLE(TOUCH_EVENTS) >+void WebViewClient::doneWithTouchEvent(WebView* view, const NativeWebTouchEvent& event, bool wasEventHandled) >+{ >+ if (!m_client.doneWithTouchEvent) >+ return; >+ >+#if PLATFORM(EFL) >+ m_client.doneWithTouchEvent(toAPI(view), toAPI(const_cast<EwkTouchEvent*>(event.nativeEvent())), wasEventHandled, m_client.clientInfo); >+#else >+ notImplemented(); >+ UNUSED_PARAM(view); >+ UNUSED_PARAM(event); >+ UNUSED_PARAM(wasEventHandled); >+#endif >+} >+#endif >+ > } // namespace WebKit > > #endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/WebViewClient.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/WebViewClient.h >index 44bf4dd..51979e9 100644 >--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/WebViewClient.h >+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/WebViewClient.h >@@ -43,6 +43,10 @@ namespace WebKit { > > class WebView; > >+#if ENABLE(TOUCH_EVENTS) >+class NativeWebTouchEvent; >+#endif >+ > class WebViewClient: public APIClient<WKViewClient, kWKViewClientCurrentVersion> { > public: > void viewNeedsDisplay(WebView*, const WebCore::IntRect&); >@@ -54,6 +58,10 @@ public: > void didCompletePageTransition(WebView*); > void didChangeViewportAttributes(WebView*, const WebCore::ViewportAttributes&); > void didChangeTooltip(WebView*, const String& tooltip); >+ void didFindZoomableArea(WebView*, const WebCore::IntPoint&, const WebCore::IntRect&); >+#if ENABLE(TOUCH_EVENTS) >+ void doneWithTouchEvent(WebView*, const NativeWebTouchEvent&, bool); >+#endif > }; > > } // namespace WebKit >diff --git a/Source/WebKit2/UIProcess/PageClient.h b/Source/WebKit2/UIProcess/PageClient.h >index 95f6696..95efa31 100644 >--- a/Source/WebKit2/UIProcess/PageClient.h >+++ b/Source/WebKit2/UIProcess/PageClient.h >@@ -121,8 +121,10 @@ public: > virtual void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect) = 0; > virtual void pageTransitionViewportReady() = 0; > #endif >-#if PLATFORM(QT) >+#if USE(COORDINATED_GRAPHICS) > virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) = 0; >+#endif >+#if PLATFORM(QT) > virtual void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) = 0; > virtual void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors) = 0; > virtual void handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password) = 0; >diff --git a/Source/WebKit2/UIProcess/PageViewportController.cpp b/Source/WebKit2/UIProcess/PageViewportController.cpp >index 6254cf7..3fce28c 100644 >--- a/Source/WebKit2/UIProcess/PageViewportController.cpp >+++ b/Source/WebKit2/UIProcess/PageViewportController.cpp >@@ -257,8 +257,7 @@ void PageViewportController::didChangeContentsVisibility(const FloatPoint& posit > { > if (!m_pendingPositionChange) > m_contentsPosition = position; >- if (!m_pendingScaleChange) >- applyScaleAfterRenderingContents(scale); >+ applyScaleAfterRenderingContents(scale); > > syncVisibleContents(trajectoryVector); > } >diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h >index f57b653..4c2331b 100644 >--- a/Source/WebKit2/UIProcess/WebPageProxy.h >+++ b/Source/WebKit2/UIProcess/WebPageProxy.h >@@ -662,7 +662,7 @@ public: > > WebPageCreationParameters creationParameters() const; > >-#if PLATFORM(QT) >+#if USE(COORDINATED_GRAPHICS) > void findZoomableAreaForPoint(const WebCore::IntPoint&, const WebCore::IntSize&); > #endif > >@@ -887,10 +887,9 @@ private: > void pageDidRequestScroll(const WebCore::IntPoint&); > void pageTransitionViewportReady(); > #endif >-#if PLATFORM(QT) >+#if USE(COORDINATED_GRAPHICS) > void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&); > #endif >- > #if PLATFORM(QT) || PLATFORM(EFL) > void didChangeContentsSize(const WebCore::IntSize&); > #endif >diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in >index fc2fc3e..81966d7 100644 >--- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in >+++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in >@@ -77,8 +77,10 @@ messages -> WebPageProxy { > PageDidRequestScroll(WebCore::IntPoint point) > PageTransitionViewportReady() > #endif >-#if PLATFORM(QT) >+#if USE(COORDINATED_GRAPHICS) > DidFindZoomableArea(WebCore::IntPoint target, WebCore::IntRect area) >+#endif >+#if PLATFORM(QT) > AuthenticationRequiredRequest(WTF::String hostname, WTF::String realm, WTF::String prefilledUsername) -> (WTF::String username, WTF::String password) > CertificateVerificationRequest(WTF::String hostname) -> (bool ignoreErrors) > ProxyAuthenticationRequiredRequest(WTF::String hostname, uint16_t port, WTF::String prefilledUsername) -> (WTF::String username, WTF::String password) >diff --git a/Source/WebKit2/UIProcess/efl/EwkGestureEvent.cpp b/Source/WebKit2/UIProcess/efl/EwkGestureEvent.cpp >new file mode 100644 >index 0000000..24e2b96 >--- /dev/null >+++ b/Source/WebKit2/UIProcess/efl/EwkGestureEvent.cpp >@@ -0,0 +1,47 @@ >+/* >+ * Copyright (C) 2013 Samsung Electronics. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "EwkGestureEvent.h" >+ >+#if ENABLE(GESTURE_EVENTS) >+ >+namespace WebKit { >+ >+EwkGestureEvent::EwkGestureEvent(WKEventType type, WKPoint position, WKPoint screenPosition, WKEventModifiers modifiers, double timestamp, WKSize area, float deltaX, float deltaY) >+ : m_eventType(type) >+ , m_modifiers(modifiers) >+ , m_timestamp(timestamp) >+ , m_position(position) >+ , m_screenPosition(screenPosition) >+ , m_area(area) >+ , m_deltaX(deltaX) >+ , m_deltaY(deltaY) >+{ >+} >+ >+} // namespace WebKit >+ >+#endif // ENABLE(GESTURE_EVENTS) >diff --git a/Source/WebKit2/UIProcess/efl/EwkGestureEvent.h b/Source/WebKit2/UIProcess/efl/EwkGestureEvent.h >new file mode 100644 >index 0000000..40bd8c5 >--- /dev/null >+++ b/Source/WebKit2/UIProcess/efl/EwkGestureEvent.h >@@ -0,0 +1,74 @@ >+/* >+ * Copyright (C) 2013 Samsung Electronics. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef EwkGestureEvent_h >+#define EwkGestureEvent_h >+ >+#if ENABLE(GESTURE_EVENTS) >+ >+#include "APIObject.h" >+#include "WKEventEfl.h" >+#include <wtf/PassRefPtr.h> >+ >+namespace WebKit { >+ >+class EwkGestureEvent : public APIObject { >+public: >+ static const APIObject::Type APIType = TypeGestureEvent; >+ >+ static PassRefPtr<EwkGestureEvent> create(WKEventType type, WKPoint position, WKPoint screenPosition, WKEventModifiers modifiers, double timestamp, WKSize area, float deltaX, float deltaY) >+ { >+ return adoptRef(new EwkGestureEvent(type, position, screenPosition, modifiers, timestamp, area, deltaX, deltaY)); >+ } >+ >+ WKEventType eventType() const { return m_eventType; } >+ WKEventModifiers modifiers() const { return m_modifiers; } >+ double timestamp() const { return m_timestamp; } >+ WKPoint position() const { return m_position; } >+ WKPoint screenPosition() const { return m_screenPosition; } >+ WKSize area() const { return m_area; } >+ float deltaX() const { return m_deltaX; } >+ float deltaY() const { return m_deltaY; } >+ >+private: >+ EwkGestureEvent(WKEventType, WKPoint position, WKPoint screenPosition, WKEventModifiers, double timestamp, WKSize area, float deltaX, float deltaY); >+ >+ virtual APIObject::Type type() const { return APIType; } >+ >+ WKEventType m_eventType; >+ WKEventModifiers m_modifiers; >+ double m_timestamp; >+ WKPoint m_position; >+ WKPoint m_screenPosition; >+ WKSize m_area; >+ float m_deltaX; >+ float m_deltaY; >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(GESTURE_EVENTS) >+ >+#endif /* EwkGestureEvent_h */ >diff --git a/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp b/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp >index 22a45b5..c16f5ff 100644 >--- a/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp >+++ b/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp >@@ -1,6 +1,7 @@ > /* >- * Copyright (C) 2012 Samsung Electronics. All rights reserved. >+ * Copyright (C) 2012, 2013 Samsung Electronics. All rights reserved. > * Copyright (C) 2013 Intel Corporation. All rights reserved. >+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies) > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -30,8 +31,10 @@ > > #include "PageViewportControllerClientEfl.h" > >+#include "EasingCurves.h" > #include "EwkView.h" > #include "PageViewportController.h" >+#include <WebCore/AffineTransform.h> > > using namespace WebCore; > >@@ -40,10 +43,12 @@ namespace WebKit { > PageViewportControllerClientEfl::PageViewportControllerClientEfl(EwkView* view) > : m_view(view) > , m_controller(0) >+ , m_transition(new Transition(this)) > { > ASSERT(m_view); > } > >+ > void PageViewportControllerClientEfl::didChangeContentsSize(const WebCore::IntSize&) > { > m_view->scheduleUpdateDisplay(); >@@ -80,5 +85,82 @@ void PageViewportControllerClientEfl::setController(PageViewportController* cont > m_controller = controller; > } > >+void PageViewportControllerClientEfl::Transition::setRects(const FloatRect& baseRect, const FloatRect& targetRect) >+{ >+ m_baseRect = baseRect; >+ m_targetRect = targetRect; >+} >+ >+void PageViewportControllerClientEfl::Transition::start() >+{ >+ m_animator = ecore_animator_add(animatorCallback, this); >+ m_scaleDuration = 1 / ecore_animator_frametime_get() / 3; >+ m_scaleIndex = 1; >+} >+ >+Eina_Bool PageViewportControllerClientEfl::Transition::animatorCallback(void* data) >+{ >+ return static_cast<Transition*>(data)->process(); >+} >+ >+bool PageViewportControllerClientEfl::Transition::process() >+{ >+ FloatRect rect; >+ float multiplier = easeInOutQuad(m_scaleIndex++, 0, 1.0, m_scaleDuration); >+ rect.setX(m_baseRect.x() + (m_targetRect.x() - m_baseRect.x()) * multiplier); >+ rect.setY(m_baseRect.y() + (m_targetRect.y() - m_baseRect.y()) * multiplier); >+ rect.setWidth(m_baseRect.width() + (m_targetRect.width() - m_baseRect.width()) * multiplier); >+ rect.setHeight(m_baseRect.height() + (m_targetRect.height() - m_baseRect.height()) * multiplier); >+ >+ m_controllerClient->setContentsRect(rect); >+ >+ if (m_scaleIndex > m_scaleDuration) { >+ m_animator = 0; >+ return false; >+ } >+ >+ return true; >+} >+ >+void PageViewportControllerClientEfl::scaleToAreaWithAnimation(const IntPoint& target, const FloatRect& area, const float margin) >+{ >+ ASSERT(m_controller); >+ if (!m_controller->allowsUserScaling()) >+ return; >+ >+ if (area.isEmpty()) >+ return; >+ >+ FloatRect targetRect = area; >+ targetRect.inflateX(margin); >+ WKSize viewportSize = WKViewGetSize(m_view->wkView()); >+ >+ float targetScale; >+ if (std::abs(m_controller->minimumScale() - m_controller->currentScale()) < 0.0001) >+ targetScale = m_controller->innerBoundedViewportScale(viewportSize.width / targetRect.width()); >+ else >+ targetScale = m_controller->minimumScale(); >+ >+ FloatRect newContentsRect(targetRect.center(), FloatSize(viewportSize.width / targetScale, viewportSize.height / targetScale)); >+ if (targetRect.height() > newContentsRect.height()) >+ newContentsRect.setY(target.y()); >+ newContentsRect.move(-newContentsRect.width() / 2, -newContentsRect.height() / 2); >+ newContentsRect.setLocation(m_controller->boundContentsPositionAtScale(newContentsRect.location(), targetScale)); >+ >+ WKPoint contentsPosition = WKViewGetContentPosition(m_view->wkView()); >+ float contentScale = WKViewGetContentScaleFactor(m_view->wkView()); >+ FloatRect currentContentsRect = FloatRect(contentsPosition.x, contentsPosition.y, viewportSize.width, viewportSize.height); >+ currentContentsRect.scale(1 / contentScale); >+ m_transition->setRects(currentContentsRect, newContentsRect); >+ m_transition->start(); >+} >+ >+void PageViewportControllerClientEfl::setContentsRect(const FloatRect& contentsRect) >+{ >+ WKSize size = WKViewGetSize(m_view->wkView()); >+ setPageScaleFactor(size.width / contentsRect.width()); >+ setViewportPosition(contentsRect.location()); >+} >+ > } // namespace WebKit > #endif // USE(ACCELERATED_COMPOSITING) >diff --git a/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.h b/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.h >index e4045b6..5b0741d 100644 >--- a/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.h >+++ b/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.h >@@ -1,6 +1,7 @@ > /* >- * Copyright (C) 2012 Samsung Electronics. All rights reserved. >+ * Copyright (C) 2012, 2013 Samsung Electronics. All rights reserved. > * Copyright (C) 2013 Intel Corporation. All rights reserved. >+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies) > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -28,7 +29,9 @@ > #define PageViewportControllerClientEfl_h > > #include "PageViewportControllerClient.h" >+#include <Ecore.h> > #include <WebCore/FloatPoint.h> >+#include <WebCore/FloatRect.h> > #include <wtf/PassOwnPtr.h> > > class EwkView; >@@ -52,12 +55,41 @@ public: > > virtual void setController(PageViewportController*) OVERRIDE; > >+ void scaleToAreaWithAnimation(const WebCore::IntPoint&, const WebCore::FloatRect&, const float margin = 0); >+ void setContentsRect(const WebCore::FloatRect&); >+ >+private: >+ class Transition { >+ public: >+ Transition(PageViewportControllerClientEfl* parent) >+ : m_controllerClient(parent) >+ , m_animator(0) >+ , m_scaleDuration(0) >+ , m_scaleIndex(0) >+ { } >+ >+ void setRects(const WebCore::FloatRect& baseRect, const WebCore::FloatRect& targetRect); >+ void start(); >+ >+ private: >+ static Eina_Bool animatorCallback(void*); >+ bool process(); >+ >+ PageViewportControllerClientEfl* m_controllerClient; >+ Ecore_Animator* m_animator; >+ WebCore::FloatRect m_targetRect; >+ WebCore::FloatRect m_baseRect; >+ unsigned m_scaleDuration; >+ unsigned m_scaleIndex; >+ }; >+ > private: > explicit PageViewportControllerClientEfl(EwkView*); > > EwkView* m_view; > WebCore::FloatPoint m_contentPosition; > PageViewportController* m_controller; >+ Transition* m_transition; > }; > > } // namespace WebKit >diff --git a/Source/WebKit2/UIProcess/efl/ViewClientEfl.cpp b/Source/WebKit2/UIProcess/efl/ViewClientEfl.cpp >index 0e66eab..11dfd28 100644 >--- a/Source/WebKit2/UIProcess/efl/ViewClientEfl.cpp >+++ b/Source/WebKit2/UIProcess/efl/ViewClientEfl.cpp >@@ -154,6 +154,22 @@ void ViewClientEfl::didChangeTooltip(WKViewRef, WKStringRef tooltip, const void* > toEwkView(clientInfo)->smartCallback<TooltipTextSet>().call(WKEinaSharedString(tooltip)); > } > >+void ViewClientEfl::didFindZoomableArea(WKViewRef, WKPoint point, WKRect area, const void* clientInfo) >+{ >+ toEwkView(clientInfo)->didFindZoomableArea(point, area); >+} >+ >+void ViewClientEfl::doneWithTouchEvent(WKViewRef, WKTouchEventRef event, bool wasEventHandled, const void* clientInfo) >+{ >+#if ENABLE(TOUCH_EVENTS) >+ toEwkView(clientInfo)->doneWithTouchEvent(event, wasEventHandled); >+#else >+ UNUSED_PARAM(event); >+ UNUSED_PARAM(wasEventHandled); >+ UNUSED_PARAM(clientInfo); >+#endif >+} >+ > ViewClientEfl::ViewClientEfl(EwkView* view) > : m_view(view) > { >@@ -164,6 +180,7 @@ ViewClientEfl::ViewClientEfl(EwkView* view) > viewClient.version = kWKViewClientCurrentVersion; > viewClient.clientInfo = this; > viewClient.didChangeContentsSize = didChangeContentsSize; >+ viewClient.didFindZoomableArea = didFindZoomableArea; > viewClient.viewNeedsDisplay = viewNeedsDisplay; > viewClient.webProcessCrashed = webProcessCrashed; > viewClient.webProcessDidRelaunch = webProcessDidRelaunch; >@@ -172,6 +189,7 @@ ViewClientEfl::ViewClientEfl(EwkView* view) > viewClient.didCompletePageTransition = didCompletePageTransition; > viewClient.didChangeViewportAttributes = didChangeViewportAttributes; > viewClient.didChangeTooltip = didChangeTooltip; >+ viewClient.doneWithTouchEvent = doneWithTouchEvent; > > WKViewSetViewClient(m_view->wkView(), &viewClient); > } >diff --git a/Source/WebKit2/UIProcess/efl/ViewClientEfl.h b/Source/WebKit2/UIProcess/efl/ViewClientEfl.h >index 3f18bea..03e1b54 100644 >--- a/Source/WebKit2/UIProcess/efl/ViewClientEfl.h >+++ b/Source/WebKit2/UIProcess/efl/ViewClientEfl.h >@@ -56,6 +56,8 @@ private: > static void didCompletePageTransition(WKViewRef, const void* clientInfo); > static void didChangeViewportAttributes(WKViewRef, WKViewportAttributesRef, const void* clientInfo); > static void didChangeTooltip(WKViewRef, WKStringRef, const void* clientInfo); >+ static void didFindZoomableArea(WKViewRef, WKPoint, WKRect, const void* clientInfo); >+ static void doneWithTouchEvent(WKViewRef, WKTouchEventRef, bool, const void* clientInfo); > > EwkView* m_view; > }; >diff --git a/Source/WebKit2/UIProcess/efl/WebViewEfl.cpp b/Source/WebKit2/UIProcess/efl/WebViewEfl.cpp >index 5660be1..e350911 100644 >--- a/Source/WebKit2/UIProcess/efl/WebViewEfl.cpp >+++ b/Source/WebKit2/UIProcess/efl/WebViewEfl.cpp >@@ -43,6 +43,10 @@ > #include "EwkTouchEvent.h" > #endif > >+#if ENABLE(GESTURE_EVENTS) >+#include "EwkGestureEvent.h" >+#endif >+ > using namespace EwkViewCallbacks; > using namespace WebCore; > >@@ -124,4 +128,13 @@ void WebViewEfl::sendTouchEvent(EwkTouchEvent* touchEvent) > } > #endif > >+#if ENABLE(GESTURE_EVENTS) >+void WebViewEfl::sendGestureEvent(const EwkGestureEvent* event) >+{ >+ ASSERT(event); >+ WebGestureEvent gesture(toWebEventType(event->eventType()), transformFromScene().mapPoint(toIntPoint(event->position())), toIntPoint(event->screenPosition()), toWebEventModifiers(event->modifiers()), event->timestamp(), toIntSize(event->area()), FloatPoint(event->deltaX(), event->deltaY())); >+ m_page->handleGestureEvent(gesture); >+} >+#endif >+ > } // namespace WebKit >diff --git a/Source/WebKit2/UIProcess/efl/WebViewEfl.h b/Source/WebKit2/UIProcess/efl/WebViewEfl.h >index d717234..e63b362 100644 >--- a/Source/WebKit2/UIProcess/efl/WebViewEfl.h >+++ b/Source/WebKit2/UIProcess/efl/WebViewEfl.h >@@ -48,6 +48,10 @@ public: > void sendTouchEvent(EwkTouchEvent*); > #endif > >+#if ENABLE(GESTURE_EVENTS) >+ void sendGestureEvent(const EwkGestureEvent*); >+#endif >+ > private: > WebViewEfl(WebContext*, WebPageGroup*); > >diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp >index 4f26d65..a897825 100644 >--- a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp >+++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp >@@ -86,19 +86,6 @@ void WebPageProxy::sendApplicationSchemeReply(const QQuickNetworkReply* reply) > #endif > } > >-void WebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area) >-{ >- m_pageClient->didFindZoomableArea(target, area); >-} >- >-void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area) >-{ >- if (!isValid()) >- return; >- >- m_process->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID); >-} >- > void WebPageProxy::authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) > { > m_pageClient->handleAuthenticationRequiredRequest(hostname, realm, prefilledUsername, username, password); >diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp >new file mode 100644 >index 0000000..bc50059 >--- /dev/null >+++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp >@@ -0,0 +1,105 @@ >+/* >+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies) >+ * Copyright (C) 2013 Samsung Electronics. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#if USE(COORDINATED_GRAPHICS) >+ >+#include "WebPage.h" >+ >+#include "HitTestResult.h" >+#include "WebCoreArgumentCoders.h" >+#include "WebFrame.h" >+#include "WebPageProxyMessages.h" >+#include <WebCore/EventHandler.h> >+#include <WebCore/Frame.h> >+#include <WebCore/FrameView.h> >+#include <WebCore/ScrollView.h> >+ >+using namespace WebCore; >+ >+namespace WebKit { >+ >+#if ENABLE(TOUCH_ADJUSTMENT) >+void WebPage::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area) >+{ >+ Node* node = 0; >+ IntRect zoomableArea; >+ bool foundAreaForTouchPoint = m_mainFrame->coreFrame()->eventHandler()->bestZoomableAreaForTouchPoint(point, IntSize(area.width() / 2, area.height() / 2), zoomableArea, node); >+ >+ if (!foundAreaForTouchPoint) >+ return; >+ >+ ASSERT(node); >+ >+ if (node->document() && node->document()->view()) >+ zoomableArea = node->document()->view()->contentsToWindow(zoomableArea); >+ >+ send(Messages::WebPageProxy::DidFindZoomableArea(point, zoomableArea)); >+} >+ >+#else >+void WebPage::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area) >+{ >+ UNUSED_PARAM(area); >+ Frame* mainframe = m_mainFrame->coreFrame(); >+ HitTestResult result = mainframe->eventHandler()->hitTestResultAtPoint(mainframe->view()->windowToContents(point), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent); >+ >+ Node* node = result.innerNode(); >+ >+ if (!node) >+ return; >+ >+ IntRect zoomableArea = node->pixelSnappedBoundingBox(); >+ >+ while (true) { >+ bool found = !node->isTextNode() && !node->isShadowRoot(); >+ >+ // No candidate found, bail out. >+ if (!found && !node->parentNode()) >+ return; >+ >+ // Candidate found, and it is a better candidate than its parent. >+ // NB: A parent is considered a better candidate iff the node is >+ // contained by it and it is the only child. >+ if (found && (!node->parentNode() || node->parentNode()->childNodeCount() != 1)) >+ break; >+ >+ node = node->parentNode(); >+ zoomableArea.unite(node->pixelSnappedBoundingBox()); >+ } >+ >+ if (node->document() && node->document()->frame() && node->document()->frame()->view()) { >+ const ScrollView* view = node->document()->frame()->view(); >+ zoomableArea = view->contentsToWindow(zoomableArea); >+ } >+ >+ send(Messages::WebPageProxy::DidFindZoomableArea(point, zoomableArea)); >+} >+#endif >+ >+} // namespace WebKit >+ >+#endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp >index a90415c..af59166 100644 >--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp >@@ -3187,66 +3187,6 @@ InjectedBundleBackForwardList* WebPage::backForwardList() > return m_backForwardList.get(); > } > >-#if PLATFORM(QT) >-#if ENABLE(TOUCH_ADJUSTMENT) >-void WebPage::findZoomableAreaForPoint(const WebCore::IntPoint& point, const WebCore::IntSize& area) >-{ >- Node* node = 0; >- IntRect zoomableArea; >- bool foundAreaForTouchPoint = m_mainFrame->coreFrame()->eventHandler()->bestZoomableAreaForTouchPoint(point, IntSize(area.width() / 2, area.height() / 2), zoomableArea, node); >- >- if (!foundAreaForTouchPoint) >- return; >- >- ASSERT(node); >- >- if (node->document() && node->document()->view()) >- zoomableArea = node->document()->view()->contentsToWindow(zoomableArea); >- >- send(Messages::WebPageProxy::DidFindZoomableArea(point, zoomableArea)); >-} >- >-#else >-void WebPage::findZoomableAreaForPoint(const WebCore::IntPoint& point, const WebCore::IntSize& area) >-{ >- UNUSED_PARAM(area); >- Frame* mainframe = m_mainFrame->coreFrame(); >- HitTestResult result = mainframe->eventHandler()->hitTestResultAtPoint(mainframe->view()->windowToContents(point), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent); >- >- Node* node = result.innerNode(); >- >- if (!node) >- return; >- >- IntRect zoomableArea = node->getRect(); >- >- while (true) { >- bool found = !node->isTextNode() && !node->isShadowRoot(); >- >- // No candidate found, bail out. >- if (!found && !node->parentNode()) >- return; >- >- // Candidate found, and it is a better candidate than its parent. >- // NB: A parent is considered a better candidate iff the node is >- // contained by it and it is the only child. >- if (found && (!node->parentNode() || node->parentNode()->childNodeCount() != 1)) >- break; >- >- node = node->parentNode(); >- zoomableArea.unite(node->getRect()); >- } >- >- if (node->document() && node->document()->frame() && node->document()->frame()->view()) { >- const ScrollView* view = node->document()->frame()->view(); >- zoomableArea = view->contentsToWindow(zoomableArea); >- } >- >- send(Messages::WebPageProxy::DidFindZoomableArea(point, zoomableArea)); >-} >-#endif >-#endif >- > WebPage::SandboxExtensionTracker::~SandboxExtensionTracker() > { > invalidate(); >diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h >index ef59ff9..abeedb7 100644 >--- a/Source/WebKit2/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h >@@ -797,7 +797,7 @@ private: > void hideFindUI(); > void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount); > >-#if PLATFORM(QT) >+#if USE(COORDINATED_GRAPHICS) > void findZoomableAreaForPoint(const WebCore::IntPoint&, const WebCore::IntSize& area); > #endif > >diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in >index 49d3c40..8a6b574 100644 >--- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in >+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in >@@ -297,7 +297,7 @@ messages -> WebPage LegacyReceiver { > SetComposition(WTF::String compositionString, WTF::Vector<WebCore::CompositionUnderline> underlines, uint64_t cursorPosition) > CancelComposition() > #endif >-#if PLATFORM(QT) >+#if USE(COORDINATED_GRAPHICS) > FindZoomableAreaForPoint(WebCore::IntPoint point, WebCore::IntSize area) > #endif > >diff --git a/Source/cmake/OptionsEfl.cmake b/Source/cmake/OptionsEfl.cmake >index 5adb549..0aa70a8 100644 >--- a/Source/cmake/OptionsEfl.cmake >+++ b/Source/cmake/OptionsEfl.cmake >@@ -280,3 +280,7 @@ if (ENABLE_INDEXED_DATABASE) > set(WTF_USE_LEVELDB 1) > add_definitions(-DWTF_USE_LEVELDB=1) > endif () >+ >+if (ENABLE_WEBKIT2 AND WTF_USE_TILED_BACKING_STORE) >+ add_definitions(-DENABLE_GESTURE_EVENTS=1) >+endif () >diff --git a/Tools/MiniBrowser/efl/main.c b/Tools/MiniBrowser/efl/main.c >index 03f9cf8..76e8fe83 100644 >--- a/Tools/MiniBrowser/efl/main.c >+++ b/Tools/MiniBrowser/efl/main.c >@@ -1826,6 +1826,10 @@ static Browser_Window *window_create(Evas_Object *opener, const char *url, int w > ewk_view_source_mode_set(window->ewk_view, view_mode); > ewk_view_user_agent_set(window->ewk_view, user_agent_string); > >+ // eunmi >+ ewk_view_touch_events_enabled_set(window->ewk_view, EINA_TRUE); >+ ewk_view_mouse_events_enabled_set(window->ewk_view, EINA_FALSE); >+ > /* Set the zoom level to default */ > window->current_zoom_level = DEFAULT_ZOOM_LEVEL; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 111702
:
206542
|
207644
|
208406