diff options
Diffstat (limited to 'Source/WebKit2/Shared')
| -rw-r--r-- | Source/WebKit2/Shared/APIClientTraits.h | 2 | ||||
| -rw-r--r-- | Source/WebKit2/Shared/NativeWebTouchEvent.h | 5 | ||||
| -rw-r--r-- | Source/WebKit2/Shared/WebHitTestResult.cpp | 4 | ||||
| -rw-r--r-- | Source/WebKit2/Shared/WebHitTestResult.h | 23 | ||||
| -rw-r--r-- | Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp | 42 | ||||
| -rw-r--r-- | Source/WebKit2/Shared/efl/WebEventFactory.cpp | 52 | ||||
| -rw-r--r-- | Source/WebKit2/Shared/efl/WebEventFactory.h | 4 |
7 files changed, 130 insertions, 2 deletions
diff --git a/Source/WebKit2/Shared/APIClientTraits.h b/Source/WebKit2/Shared/APIClientTraits.h index 3fd03cd31..9b7663d0a 100644 --- a/Source/WebKit2/Shared/APIClientTraits.h +++ b/Source/WebKit2/Shared/APIClientTraits.h @@ -55,7 +55,7 @@ template<> struct APIClientTraits<WKBundlePageFullScreenClient> { }; template<> struct APIClientTraits<WKBundlePageUIClient> { - static const size_t interfaceSizesByVersion[2]; + static const size_t interfaceSizesByVersion[3]; }; template<> struct APIClientTraits<WKPageContextMenuClient> { diff --git a/Source/WebKit2/Shared/NativeWebTouchEvent.h b/Source/WebKit2/Shared/NativeWebTouchEvent.h index f20214a8f..49bbf8010 100644 --- a/Source/WebKit2/Shared/NativeWebTouchEvent.h +++ b/Source/WebKit2/Shared/NativeWebTouchEvent.h @@ -30,6 +30,9 @@ #if PLATFORM(QT) #include <QTouchEvent> +#elif PLATFORM(EFL) +#include "ewk_touch.h" +#include <Evas.h> #endif namespace WebKit { @@ -38,6 +41,8 @@ class NativeWebTouchEvent : public WebTouchEvent { public: #if PLATFORM(QT) explicit NativeWebTouchEvent(const QTouchEvent*, const QTransform& fromItemTransform); +#elif PLATFORM(EFL) + NativeWebTouchEvent(Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const Evas_Point*, double timestamp); #endif #if PLATFORM(QT) diff --git a/Source/WebKit2/Shared/WebHitTestResult.cpp b/Source/WebKit2/Shared/WebHitTestResult.cpp index 26eaf6a0a..799ed5220 100644 --- a/Source/WebKit2/Shared/WebHitTestResult.cpp +++ b/Source/WebKit2/Shared/WebHitTestResult.cpp @@ -43,6 +43,7 @@ void WebHitTestResult::Data::encode(CoreIPC::ArgumentEncoder* encoder) const encoder->encode(linkLabel); encoder->encode(linkTitle); encoder->encode(isContentEditable); + encoder->encode(elementBoundingBox); } bool WebHitTestResult::Data::decode(CoreIPC::ArgumentDecoder* decoder, WebHitTestResult::Data& hitTestResultData) @@ -53,7 +54,8 @@ bool WebHitTestResult::Data::decode(CoreIPC::ArgumentDecoder* decoder, WebHitTes || !decoder->decode(hitTestResultData.absoluteMediaURL) || !decoder->decode(hitTestResultData.linkLabel) || !decoder->decode(hitTestResultData.linkTitle) - || !decoder->decode(hitTestResultData.isContentEditable)) + || !decoder->decode(hitTestResultData.isContentEditable) + || !decoder->decode(hitTestResultData.elementBoundingBox)) return false; return true; diff --git a/Source/WebKit2/Shared/WebHitTestResult.h b/Source/WebKit2/Shared/WebHitTestResult.h index 798a2db2b..e53a5c7e2 100644 --- a/Source/WebKit2/Shared/WebHitTestResult.h +++ b/Source/WebKit2/Shared/WebHitTestResult.h @@ -21,8 +21,10 @@ #define WebHitTestResult_h #include "APIObject.h" +#include <WebCore/FrameView.h> #include <WebCore/HitTestResult.h> #include <WebCore/KURL.h> +#include <WebCore/Node.h> #include <wtf/Forward.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -49,11 +51,29 @@ public: String linkLabel; String linkTitle; bool isContentEditable; + WebCore::IntRect elementBoundingBox; Data() { } + WebCore::IntRect elementBoundingBoxInWindowCoordinates(const WebCore::HitTestResult& hitTestResult) + { + WebCore::Node* node = hitTestResult.innerNonSharedNode(); + if (!node) + return WebCore::IntRect(); + + WebCore::Frame* frame = node->document()->frame(); + if (!frame) + return WebCore::IntRect(); + + WebCore::FrameView* view = frame->view(); + if (!view) + return WebCore::IntRect(); + + return view->contentsToWindow(node->pixelSnappedBoundingBox()); + } + explicit Data(const WebCore::HitTestResult& hitTestResult) : absoluteImageURL(hitTestResult.absoluteImageURL().string()) , absolutePDFURL(hitTestResult.absolutePDFURL().string()) @@ -62,6 +82,7 @@ public: , linkLabel(hitTestResult.textContent()) , linkTitle(hitTestResult.titleDisplayString()) , isContentEditable(hitTestResult.isContentEditable()) + , elementBoundingBox(elementBoundingBoxInWindowCoordinates(hitTestResult)) { } @@ -81,6 +102,8 @@ public: bool isContentEditable() const { return m_data.isContentEditable; } + WebCore::IntRect elementBoundingBox() const { return m_data.elementBoundingBox; } + private: explicit WebHitTestResult(const WebHitTestResult::Data& hitTestResultData) : m_data(hitTestResultData) diff --git a/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp b/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp new file mode 100644 index 000000000..70d8bb7c7 --- /dev/null +++ b/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * 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 "NativeWebTouchEvent.h" + +#include "WebEventFactory.h" + +#if ENABLE(TOUCH_EVENTS) + +namespace WebKit { + +NativeWebTouchEvent::NativeWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const Evas_Point* position, double timestamp) + : WebTouchEvent(WebEventFactory::createWebTouchEvent(type, points, modifiers, position, timestamp)) +{ +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit2/Shared/efl/WebEventFactory.cpp b/Source/WebKit2/Shared/efl/WebEventFactory.cpp index 74a0530a3..6e50ed199 100644 --- a/Source/WebKit2/Shared/efl/WebEventFactory.cpp +++ b/Source/WebKit2/Shared/efl/WebEventFactory.cpp @@ -192,4 +192,56 @@ WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const Evas_Event_Key_Up event->timestamp); } +#if ENABLE(TOUCH_EVENTS) +static inline WebEvent::Type typeForTouchEvent(Ewk_Touch_Event_Type type) +{ + if (type == EWK_TOUCH_START) + return WebEvent::TouchStart; + if (type == EWK_TOUCH_MOVE) + return WebEvent::TouchMove; + if (type == EWK_TOUCH_END) + return WebEvent::TouchEnd; + if (type == EWK_TOUCH_CANCEL) + return WebEvent::TouchCancel; + + return WebEvent::NoType; +} + +WebTouchEvent WebEventFactory::createWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const Evas_Point* position, double timestamp) +{ + Vector<WebPlatformTouchPoint> touchPoints; + WebPlatformTouchPoint::TouchPointState state; + const Eina_List* list; + void* item; + EINA_LIST_FOREACH(points, list, item) { + Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(item); + + switch (point->state) { + case EVAS_TOUCH_POINT_UP: + state = WebPlatformTouchPoint::TouchReleased; + break; + case EVAS_TOUCH_POINT_MOVE: + state = WebPlatformTouchPoint::TouchMoved; + break; + case EVAS_TOUCH_POINT_DOWN: + state = WebPlatformTouchPoint::TouchPressed; + break; + case EVAS_TOUCH_POINT_STILL: + state = WebPlatformTouchPoint::TouchStationary; + break; + case EVAS_TOUCH_POINT_CANCEL: + state = WebPlatformTouchPoint::TouchCancelled; + break; + default: + ASSERT_NOT_REACHED(); + break; + } + + touchPoints.append(WebPlatformTouchPoint(point->id, state, IntPoint(point->x, point->y), IntPoint(point->x - position->x, point->y - position->y))); + } + + return WebTouchEvent(typeForTouchEvent(type), touchPoints, modifiersForEvent(modifiers), timestamp); +} +#endif + } // namespace WebKit diff --git a/Source/WebKit2/Shared/efl/WebEventFactory.h b/Source/WebKit2/Shared/efl/WebEventFactory.h index f47a3caed..9a8b1d6bd 100644 --- a/Source/WebKit2/Shared/efl/WebEventFactory.h +++ b/Source/WebKit2/Shared/efl/WebEventFactory.h @@ -27,6 +27,7 @@ #define WebEventFactory_h #include "WebEvent.h" +#include "ewk_touch.h" #include <Evas.h> namespace WebKit { @@ -39,6 +40,9 @@ public: static WebWheelEvent createWebWheelEvent(const Evas_Event_Mouse_Wheel*, const Evas_Point*); static WebKeyboardEvent createWebKeyboardEvent(const Evas_Event_Key_Down*); static WebKeyboardEvent createWebKeyboardEvent(const Evas_Event_Key_Up*); +#if ENABLE(TOUCH_EVENTS) + static WebTouchEvent createWebTouchEvent(Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const Evas_Point*, double timestamp); +#endif }; } // namespace WebKit |
