#include <FUi_AccessibilityContainer.h>
#include <FUi_AccessibilityElement.h>
#include <FUi_IAccessibilityFocusHandler.h>
+#include <FUi_Math.h>
#include <FUi_TouchManager.h>
#include "FWebCtrl_EflWebkit.h"
#include "FWebCtrl_GestureState.h"
static const char WEB_CTRL[] = "webcontrol";
+void
+OnEdgeLeft(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _Web* pCore = reinterpret_cast< _Web* >(pUserData);
+ SysAssertf(pCore, "Failed to request");
+
+ pCore->SetEdgeReachedEvent(WEB_EDGE_LEFT);
+}
+
+
+void
+OnEdgeRight(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _Web* pCore = reinterpret_cast< _Web* >(pUserData);
+ SysAssertf(pCore, "Failed to request");
+
+ pCore->SetEdgeReachedEvent(WEB_EDGE_RIGHT);
+}
+
+
+void
+OnEdgeTop(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _Web* pCore = reinterpret_cast< _Web* >(pUserData);
+ SysAssertf(pCore, "Failed to request");
+
+ pCore->SetEdgeReachedEvent(WEB_EDGE_TOP);
+}
+
+
+void
+OnEdgeBottom(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _Web* pCore = reinterpret_cast< _Web* >(pUserData);
+ SysAssertf(pCore, "Failed to request");
+
+ pCore->SetEdgeReachedEvent(WEB_EDGE_BOTTOM);
+}
+
+
_Web::_Web(void)
: __pGestureHandler(null)
, __pEflWebkit(null)
, __pFlickGestureHandler(null)
, __pPinchGestureHandler(null)
, __gestureType(WEB_GESTURE_TYPE_TAP)
+ , __edgeType(WEB_EDGE_NONE)
, __pTextElement(null)
+ , __previousTouchedPosition(0.0f, 0.0f)
{
SetBackgroundColor(Color(0, 0, 0, 0));
}
__pEflWebkit = std::move(pEflWebkit);
+ evas_object_smart_callback_add(__pEflWebkit->GetWebEvasObject(), "edge,left", OnEdgeLeft, this);
+ evas_object_smart_callback_add(__pEflWebkit->GetWebEvasObject(), "edge,right", OnEdgeRight, this);
+ evas_object_smart_callback_add(__pEflWebkit->GetWebEvasObject(), "edge,top", OnEdgeTop, this);
+ evas_object_smart_callback_add(__pEflWebkit->GetWebEvasObject(), "edge,bottom", OnEdgeBottom, this);
+
return E_SUCCESS;
}
__pGesturePinch->RemoveGestureListener(*this);
RemoveGestureDetector(*__pGesturePinch);
}
+
+ if (__pEflWebkit->GetWebEvasObject())
+ {
+ evas_object_smart_callback_del(__pEflWebkit->GetWebEvasObject(), "edge,left", OnEdgeLeft);
+ evas_object_smart_callback_del(__pEflWebkit->GetWebEvasObject(), "edge,right", OnEdgeRight);
+ evas_object_smart_callback_del(__pEflWebkit->GetWebEvasObject(), "edge,top", OnEdgeTop);
+ evas_object_smart_callback_del(__pEflWebkit->GetWebEvasObject(), "edge,bottom", OnEdgeBottom);
+ }
}
}
+void
+_Web::SetEdgeReachedEvent(_WebEdgeType type)
+{
+ __edgeType |= type;
+
+ switch(type)
+ {
+ case WEB_EDGE_LEFT:
+ __edgeType &= ~WEB_EDGE_RIGHT;
+ break;
+
+ case WEB_EDGE_RIGHT:
+ __edgeType &= ~WEB_EDGE_LEFT;
+ break;
+
+ case WEB_EDGE_TOP:
+ __edgeType &= ~WEB_EDGE_BOTTOM;
+ break;
+
+ case WEB_EDGE_BOTTOM:
+ __edgeType &= ~WEB_EDGE_TOP;
+ break;
+
+ default:
+ SysAssert(false);
+ }
+}
+
+
bool
_Web::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
{
if (__pEflWebkit.get())
{
+ __edgeType = WEB_EDGE_NONE;
+ __previousTouchedPosition = touchInfo.GetCurrentPosition();
+
SendTouchEventForJavaScript(touchInfo);
return __pGestureHandler->OnTouchPressed(source, touchInfo);
}
- return true;
+ return false;
}
{
SendTouchEventForJavaScript(touchInfo);
- return __pGestureHandler->OnTouchMoved(source, touchInfo);
+ __pGestureHandler->OnTouchMoved(source, touchInfo);
+
+ float scrollDistanceX = __previousTouchedPosition.x - touchInfo.GetCurrentPosition().x;
+ float scrollDistanceY = __previousTouchedPosition.y - touchInfo.GetCurrentPosition().y;
+ __previousTouchedPosition = touchInfo.GetCurrentPosition();
+
+ if (__edgeType != WEB_EDGE_NONE && __gestureType == WEB_GESTURE_TYPE_PANNING)
+ {
+ if (_Abs(scrollDistanceY) < _Abs(scrollDistanceX))
+ {
+ if (__edgeType & WEB_EDGE_LEFT)
+ {
+ if (scrollDistanceX < 0)
+ {
+ __edgeType &= ~WEB_EDGE_RIGHT;
+
+ return false;
+ }
+ else
+ {
+ __edgeType &= ~WEB_EDGE_LEFT;
+ }
+ }
+ else if (__edgeType & WEB_EDGE_RIGHT)
+ {
+ if (scrollDistanceX > 0)
+ {
+ __edgeType &= ~WEB_EDGE_LEFT;
+
+ return false;
+ }
+ else
+ {
+ __edgeType &= ~WEB_EDGE_RIGHT;
+ }
+ }
+ }
+ else if (_Abs(scrollDistanceY) > _Abs(scrollDistanceX))
+ {
+ if (__edgeType & WEB_EDGE_TOP)
+ {
+ if (scrollDistanceY < 0)
+ {
+ __edgeType &= ~WEB_EDGE_BOTTOM;
+
+ return false;
+ }
+ else
+ {
+ __edgeType &= ~WEB_EDGE_TOP;
+ }
+ }
+ else if (__edgeType & WEB_EDGE_BOTTOM)
+ {
+ if (scrollDistanceY > 0)
+ {
+ __edgeType &= ~WEB_EDGE_TOP;
+
+ return false;
+ }
+ else
+ {
+ __edgeType &= ~WEB_EDGE_BOTTOM;
+ }
+ }
+ }
+ }
+
+ return true;
}
- return true;
+ return false;
}
return __pGestureHandler->OnTouchReleased(source, touchInfo);
}
- return true;
+ return false;
}
{
SendTouchEventForJavaScript(touchInfo);
- __pGestureHandler->OnTouchCanceled(source, touchInfo);
+ return __pGestureHandler->OnTouchCanceled(source, touchInfo);
}
- return true;
+ return false;
}