*
* The file contains the definition of _Web class.
*/
+#include <Ecore_X.h>
#include <Elementary.h>
#include <memory>
#include <FBaseByteBuffer.h>
#include <FSys_VibratorImpl.h>
#include <FUiAnim_EflNode.h>
#include <FUiAnim_VisualElement.h>
+#include <FUiAnim_VisualElementImpl.h>
#include <FUi_CoordinateSystemUtils.h>
#include <FUi_AccessibilityContainer.h>
#include <FUi_AccessibilityElement.h>
+#include <FUi_UiEventManager.h>
#include <FUi_IAccessibilityFocusHandler.h>
#include <FUi_IAccessibilityListener.h>
#include <FUi_Math.h>
#include "FWebCtrl_EflWebkit.h"
#include "FWebCtrl_GestureState.h"
#include "FWebCtrl_Web.h"
-#include "FWebCtrl_WebImpl.h"
#include "FWebCtrl_WebSettingImpl.h"
#include "FWebCtrl_Utility.h"
bool
_WebAccessibilityListener::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
{
- return true;
+ Ewk_View_Smart_Data* pSmartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(__pView));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+
+ Elm_Access_Action_Info* pActionInfo = new Elm_Access_Action_Info();
+ SysTryReturn(NID_WEB_CTRL, pActionInfo, false, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ bool result = false;
+
+ pActionInfo->action_type = ELM_ACCESS_ACTION_UNHIGHLIGHT;
+
+ result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
+ delete pActionInfo;
+
+ return result;
}
bool
_WebAccessibilityListener::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
{
- const Ewk_View_Smart_Data* pSmartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(__pView));
+ Ewk_View_Smart_Data* pSmartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(__pView));
SysAssertf(pSmartData, "Failed to get webkit smart data.");
Elm_Access_Action_Info* pActionInfo = new Elm_Access_Action_Info();
pActionInfo->action_type = ELM_ACCESS_ACTION_ACTIVATE;
- result = pSmartData->api->screen_reader_action_execute(const_cast<Ewk_View_Smart_Data*>(pSmartData), pActionInfo);
+ result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
delete pActionInfo;
return result;
bool
_WebAccessibilityFocusHandler::OnMoveFocus(Tizen::Ui::_AccessibilityFocusDirection direction)
{
- const Ewk_View_Smart_Data* pSmartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(__pView));
+ Ewk_View_Smart_Data* pSmartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(__pView));
SysAssertf(pSmartData, "Failed to get webkit smart data.");
Elm_Access_Action_Info* pActionInfo = new Elm_Access_Action_Info();
if (direction == Tizen::Ui::_ACCESSIBILITY_FOCUS_DIRECTION_PREVIOUS)
{
- pActionInfo->action_type = ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
+ pActionInfo->action_type = ELM_ACCESS_ACTION_HIGHLIGHT;
+
+ pActionInfo->action_by = ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
- result = pSmartData->api->screen_reader_action_execute(const_cast<Ewk_View_Smart_Data*>(pSmartData), pActionInfo);
+ result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
}
else if (direction == Tizen::Ui::_ACCESSIBILITY_FOCUS_DIRECTION_NEXT)
{
- pActionInfo->action_type = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
+ pActionInfo->action_type = ELM_ACCESS_ACTION_HIGHLIGHT;
- result = pSmartData->api->screen_reader_action_execute(const_cast<Ewk_View_Smart_Data*>(pSmartData), pActionInfo);
+ pActionInfo->action_by = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
+
+ result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
}
delete pActionInfo;
bool
_WebAccessibilityFocusHandler::OnMoveFocus(const Tizen::Graphics::Point& point)
{
- const Ewk_View_Smart_Data* pSmartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(__pView));
+ Ewk_View_Smart_Data* pSmartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(__pView));
SysAssertf(pSmartData, "Failed to get webkit smart data.");
Elm_Access_Action_Info* pActionInfo = new Elm_Access_Action_Info();
pActionInfo->x = point.x;
pActionInfo->y = point.y;
- result = pSmartData->api->screen_reader_action_execute(const_cast<Ewk_View_Smart_Data*>(pSmartData), pActionInfo);
+ result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
delete pActionInfo;
return result;
{
-static const char WEB_CTRL[] = "webcontrol";
-
-
void
OnEdgeLeft(void* pUserData, Evas_Object* pView, void* pEventInfo)
{
, __pPinchGestureHandler(null)
, __gestureType(WEB_GESTURE_TYPE_TAP)
, __edgeType(WEB_EDGE_NONE)
+ , __focus(false)
, __pTextElement(null)
, __previousTouchedPosition(0.0f, 0.0f)
+ , __isFullScreenEntered(false)
+ , __isRotated(false)
+ , __touchPressed(false)
{
SetBackgroundColor(Color(0, 0, 0, 0));
}
std::unique_ptr<_EflWebkit> pEflWebkit(new (std::nothrow) _EflWebkit());
SysTryReturnResult(NID_WEB_CTRL, pEflWebkit.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = pEflWebkit->Construct(GetAbsoluteBounds(), *GetVisualElement(), this);
+ _VisualElement* pVe = GetVisualElement();
+ r = pEflWebkit->Construct(GetAbsoluteBounds(), *pVe, this);
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ _VisualElementImpl* pVeImpl = _VisualElementImpl::GetInstance(*pVe);
+ pVeImpl->SetCaptureProvider(this);
+
__pEflWebkit = std::move(pEflWebkit);
Evas_Object* pView = GetWebNativeNode();
return __pWebSetting.get();
}
+_EflWebkit*
+_Web::GetEflWebkit(void) const
+{
+ return __pEflWebkit.get();
+}
+
result
_Web::OnAttaching(const _Control* pParent)
_ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetTransformer();
SysTryReturnResult(NID_WEB_CTRL, pXformer, E_SYSTEM, "[%s] A system error has been occurred. Failed to get coordinate transformer.", GetErrorMessage(E_SYSTEM));
- if (__pEflWebkit.get())
+ if (__pEflWebkit.get() && __isRotated == false)
{
evas_object_move(__pEflWebkit->GetWebEvasObject(), pXformer->TransformHorizontal(absoluteBounds.x - webBounds.x + bounds.x), pXformer->TransformVertical(absoluteBounds.y - webBounds.y + bounds.y));
evas_object_resize(__pEflWebkit->GetWebEvasObject(), pXformer->TransformHorizontal(bounds.width), pXformer->TransformVertical(bounds.height));
void
+_Web::OnBoundsChanged(void)
+{
+ __isRotated = false;
+}
+
+
+void
+_Web::OnChangeLayout(_ControlOrientation orientation)
+{
+ __isRotated = true;
+}
+
+
+void
_Web::ChangeGesture(_WebGestureType type)
{
switch (type)
bool
_Web::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
{
+ __touchPressed = true;
+
if (__pEflWebkit.get())
{
__edgeType = WEB_EDGE_NONE;
bool
-_Web::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+_Web::CanOutOfEdgeLeft(float scrollDistanceX, int pageDistance)
{
- if (__pEflWebkit.get())
+ if (scrollDistanceX < 0.0f)
{
- SendTouchEventForJavaScript(touchInfo);
+ __edgeType &= ~WEB_EDGE_RIGHT;
+
+ return false;
+ }
+ else if (scrollDistanceX > 0.0f && pageDistance != 0)
+ {
+ __edgeType &= ~WEB_EDGE_LEFT;
+ }
+
+ return true;
+}
- __pGestureHandler->OnTouchMoved(source, touchInfo);
- float scrollDistanceX = __previousTouchedPosition.x - touchInfo.GetCurrentPosition().x;
- float scrollDistanceY = __previousTouchedPosition.y - touchInfo.GetCurrentPosition().y;
- __previousTouchedPosition = touchInfo.GetCurrentPosition();
+bool
+_Web::CanOutOfEdgeRight(float scrollDistanceX, int pageDistance)
+{
+ if (scrollDistanceX > 0.0f)
+ {
+ __edgeType &= ~WEB_EDGE_LEFT;
+
+ return false;
+ }
+ else if (scrollDistanceX < 0.0f && pageDistance != 0)
+ {
+ __edgeType &= ~WEB_EDGE_RIGHT;
+ }
+
+ return true;
+}
+
+
+bool
+_Web::CanOutOfEdgeTop(float scrollDistanceY, int pageDistance)
+{
+ if (scrollDistanceY < 0.0f)
+ {
+ __edgeType &= ~WEB_EDGE_BOTTOM;
- if (__edgeType != WEB_EDGE_NONE && __gestureType == WEB_GESTURE_TYPE_PANNING)
+ return false;
+ }
+ else if (scrollDistanceY > 0.0f && pageDistance != 0)
+ {
+ __edgeType &= ~WEB_EDGE_TOP;
+ }
+
+ return true;
+}
+
+
+bool
+_Web::CanOutOfEdgeBottom(float scrollDistanceY, int pageDistance)
+{
+ if (scrollDistanceY > 0.0f)
+ {
+ __edgeType &= ~WEB_EDGE_TOP;
+
+ return false;
+ }
+ else if (scrollDistanceY < 0.0f && pageDistance != 0)
+ {
+ __edgeType &= ~WEB_EDGE_BOTTOM;
+ }
+
+ return true;
+}
+
+
+bool
+_Web::CanConsumeTouchMoved(float scrollDistanceX, float scrollDistanceY)
+{
+ if (__edgeType == WEB_EDGE_NONE)
+ {
+ return true;
+ }
+
+ bool ret = true;
+
+ int scrollWidth = 0;
+ int scrollHeight = 0;
+ ewk_view_scroll_size_get(GetWebNativeNode(), &scrollWidth, &scrollHeight);
+
+ int scrollX = 0;
+ int scrollY = 0;
+ ewk_view_scroll_pos_get(GetWebNativeNode(), &scrollX, &scrollY);
+
+ if (scrollWidth == 0)
+ {
+ if (__edgeType & WEB_EDGE_TOP)
{
- if (_Abs(scrollDistanceY) < _Abs(scrollDistanceX))
+ if (!CanOutOfEdgeTop(scrollDistanceY, scrollY - 0))
{
- 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;
- }
- }
+ return false;
}
- else if (_Abs(scrollDistanceY) > _Abs(scrollDistanceX))
+ }
+ else if (__edgeType & WEB_EDGE_BOTTOM)
+ {
+ if (!CanOutOfEdgeBottom(scrollDistanceY, scrollY - scrollHeight))
{
- 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 false;
}
}
+ }
- return true;
+ if (scrollHeight == 0)
+ {
+ if (__edgeType & WEB_EDGE_LEFT)
+ {
+ if (!CanOutOfEdgeLeft(scrollDistanceX, scrollX - 0))
+ {
+ return false;
+ }
+ }
+ else if (__edgeType & WEB_EDGE_RIGHT)
+ {
+ if (!CanOutOfEdgeRight(scrollDistanceX, scrollX - scrollWidth))
+ {
+ return false;
+ }
+ }
}
- return false;
+ if (scrollWidth > 0 && scrollHeight > 0)
+ {
+ if ((__edgeType & WEB_EDGE_LEFT) && (__edgeType & WEB_EDGE_TOP))
+ {
+ if (!CanOutOfEdgeLeft(scrollDistanceX, scrollX - 0) || !CanOutOfEdgeTop(scrollDistanceY, scrollY - 0))
+ {
+ return false;
+ }
+ }
+ else if ((__edgeType & WEB_EDGE_LEFT) && (__edgeType & WEB_EDGE_BOTTOM))
+ {
+ if (!CanOutOfEdgeLeft(scrollDistanceX, scrollX - 0) || !CanOutOfEdgeBottom(scrollDistanceY, scrollY - scrollHeight))
+ {
+ return false;
+ }
+ }
+ else if ((__edgeType & WEB_EDGE_RIGHT) && (__edgeType & WEB_EDGE_TOP))
+ {
+ if (!CanOutOfEdgeRight(scrollDistanceX, scrollX - scrollWidth) || !CanOutOfEdgeTop(scrollDistanceY, scrollY - 0))
+ {
+ return false;
+ }
+ }
+ else if ((__edgeType & WEB_EDGE_RIGHT) && (__edgeType & WEB_EDGE_BOTTOM))
+ {
+ if (!CanOutOfEdgeRight(scrollDistanceX, scrollX - scrollWidth) || !CanOutOfEdgeBottom(scrollDistanceY, scrollY - scrollHeight))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
}
bool
-_Web::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+_Web::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
{
- SetFocused();
-
if (__pEflWebkit.get())
{
SendTouchEventForJavaScript(touchInfo);
- Evas_Object* pView = GetWebNativeNode();
- _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, WEB_CTRL));
+ float scrollDistanceX = __previousTouchedPosition.x - touchInfo.GetCurrentPosition().x;
+ float scrollDistanceY = __previousTouchedPosition.y - touchInfo.GetCurrentPosition().y;
+ __previousTouchedPosition = touchInfo.GetCurrentPosition();
- if (pImpl && pImpl->GetTextFromBlock().GetLength() > 0)
+ if (CanConsumeTouchMoved(scrollDistanceX, scrollDistanceY))
{
- evas_object_smart_callback_call(pView, "text,selected", NULL);
+ return __pGestureHandler->OnTouchMoved(source, touchInfo);
}
-
- return __pGestureHandler->OnTouchReleased(source, touchInfo);
}
return false;
bool
-_Web::OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
+_Web::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
{
+ __touchPressed = false;
+
+ SetFocused();
+
if (__pEflWebkit.get())
{
SendTouchEventForJavaScript(touchInfo);
- return __pGestureHandler->OnTouchCanceled(source, touchInfo);
+ return __pGestureHandler->OnTouchReleased(source, touchInfo);
}
return false;
}
-void
-_Web::OnTouchPressHandled(const _Control& control)
-{
-}
-
-
-void
-_Web::OnTouchReleaseHandled(const _Control& control)
-{
-}
-
-
-void
-_Web::OnTouchMoveHandled(const _Control& control)
+bool
+_Web::OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
{
-}
+ if (__pEflWebkit.get())
+ {
+ SendTouchEventForJavaScript(touchInfo);
+ return __pGestureHandler->OnTouchCanceled(source, touchInfo);
+ }
-void
-_Web::OnTouchCancelHandled(const _Control& control)
-{
+ return false;
}
return __pTapGestureHandler->OnLongPressGestureDetected(gesture);
}
- return true;
+ return false;
}
bool
_Web::OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture)
{
- return true;
+ return false;
}
return __pTapGestureHandler->OnTapGestureDetected(gesture);
}
- return true;
+ return false;
}
bool
_Web::OnTapGestureCanceled(_TouchTapGestureDetector& gesture)
{
- return true;
+ return false;
}
bool
_Web::OnFlickGestureDetected(_TouchFlickGestureDetector& gesture)
{
- if (__pEflWebkit.get() && _WebSettingImpl::GetInstance(__pWebSetting.get())->IsScrollEnabled())
+ if (__pEflWebkit.get())
{
return __pFlickGestureHandler->OnFlickGestureDetected(gesture);
}
- return true;
+ return false;
}
bool
_Web::OnFlickGestureCanceled(_TouchFlickGestureDetector& gesture)
{
- return true;
+ return false;
}
return __pPinchGestureHandler->OnPinchGestureStarted(gesture);
}
- return true;
+ return false;
}
return __pPinchGestureHandler->OnPinchGestureChanged(gesture);
}
- return true;
+ return false;
}
return __pPinchGestureHandler->OnPinchGestureFinished(gesture);
}
- return true;
+ return false;
}
bool
_Web::OnPinchGestureCanceled(Tizen::Ui::_TouchPinchGestureDetector& gesture)
{
- return true;
+ return false;
}
Canvas*
_Web::OnCanvasRequestedN(const FloatRectangle& bounds)
{
- result r = E_SUCCESS;
+ SysTryReturn(NID_WEB_CTRL, bounds.width >= 0.0f && bounds.height >= 0.0f, null, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] Canvas size is out of range. size = (%f, %f)", bounds.width, bounds.height);
+ if (bounds.width == 0.0f || bounds.height == 0.0f)
+ {
+ FloatDimension size(GetSizeF());
+ SysTryReturn(NID_WEB_CTRL, bounds.x >= 0.0f && bounds.y >= 0.0f && bounds.x <= size.width && bounds.y <= size.height, null, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] Bounds is out of range.");
+ }
- Evas_Object* pWebFrame = GetWebNativeNode();
- Eina_Rectangle rect;
- BufferInfo bufferInfo;
+ result r = E_SUCCESS;
- Point absPoint(_CoordinateSystemUtils::ConvertToInteger(GetAbsoluteCoordinate(FloatPoint(bounds.x, bounds.y))));
- Dimension absSize(_CoordinateSystemUtils::ConvertToInteger(_CoordinateSystemUtils::HorizontalTransform(bounds.width)),
- _CoordinateSystemUtils::ConvertToInteger(_CoordinateSystemUtils::VerticalTransform(bounds.height)));
+ Rectangle absBounds(_CoordinateSystemUtils::ConvertToInteger(_CoordinateSystemUtils::Transform(bounds)));
- EINA_RECTANGLE_SET(&rect, absPoint.x, absPoint.y, absSize.width, absSize.height);
+ Eina_Rectangle rect;
+ EINA_RECTANGLE_SET(&rect, absBounds.x, absBounds.y, absBounds.width, absBounds.height);
+ Evas_Object* pWebFrame = GetWebNativeNode();
Evas_Object* pScreenShot = ewk_view_screenshot_contents_get(pWebFrame, rect, 1.0f, evas_object_evas_get(pWebFrame));
std::unique_ptr<Canvas> pCanvas(new (std::nothrow) Canvas());
if (pScreenShot)
{
+ BufferInfo bufferInfo;
+
r = _Utility::GetPixelBufferFromEvasObject(pScreenShot, bufferInfo);
evas_object_del(pScreenShot);
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
{
result r = E_SUCCESS;
- Evas_Object* pWebFrame = GetWebNativeNode();
- Eina_Rectangle rect;
- ByteBuffer buffer;
BufferInfo bufferInfo;
+ SysTryReturn(NID_WEB_CTRL, OnCaptureAcquire(bufferInfo), null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get snapshot of Web control", GetErrorMessage(E_SYSTEM));
- Dimension size(GetSize());
- Point absSize(GetAbsoluteCoordinate(Point(size.width, size.height)));
-
- EINA_RECTANGLE_SET(&rect, 0, 0, absSize.x, absSize.y);
-
- Evas_Object* pScreenShot = ewk_view_screenshot_contents_get(pWebFrame, rect, 1.0f, evas_object_evas_get(pWebFrame));
- SysTryReturn(NID_WEB_CTRL, pScreenShot, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get snapshot of Web control", GetErrorMessage(E_SYSTEM));
-
- r = _Utility::GetPixelBufferFromEvasObject(pScreenShot, bufferInfo);
- evas_object_del(pScreenShot);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
-
+ ByteBuffer buffer;
int bufferSize = bufferInfo.bitsPerPixel * bufferInfo.width * bufferInfo.height;
+
r = buffer.Construct(reinterpret_cast < byte* >(bufferInfo.pPixels), 0, bufferSize, bufferSize);
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
}
-void
-_Web::DumpPointList(void* pData)
+bool
+_Web::OnCaptureAcquire(BufferInfo& output)
{
- Eina_List* pList = reinterpret_cast< Eina_List* >(pData);
+ result r = E_SUCCESS;
- for(; pList; pList = eina_list_next(pList))
- {
- Ewk_Touch_Point* pPointDump = static_cast<Ewk_Touch_Point*>(eina_list_data_get(pList));
- SysSecureLog(NID_WEB_CTRL, "The current value of id is %lu, x is %d, y is %d, state is %d", pPointDump->id, pPointDump->x, pPointDump->y, pPointDump->state);
- }
+ FloatPoint position(GetPositionF());
+ FloatDimension size(GetSizeF());
+
+ Dimension absSize(_CoordinateSystemUtils::ConvertToInteger(_CoordinateSystemUtils::Transform(size)));
+
+ Eina_Rectangle rect;
+ EINA_RECTANGLE_SET(&rect, 0, 0, absSize.width, absSize.height);
+
+ Evas_Object* pWebFrame = GetWebNativeNode();
+ Evas_Object* pScreenShot = ewk_view_screenshot_contents_get(pWebFrame, rect, 1.0f, evas_object_evas_get(pWebFrame));
+ SysTryReturn(NID_WEB_CTRL, pScreenShot, false, E_SYSTEM, "[%s] A system error has been occurred. Failed to get snapshot of Web control", GetErrorMessage(E_SYSTEM));
+
+ r = _Utility::GetPixelBufferFromEvasObject(pScreenShot, output);
+ evas_object_del(pScreenShot);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] propagating", GetErrorMessage(r));
+
+ return true;
}
{
result r = E_SUCCESS;
- Eina_List* pPointList = null;
- Ewk_Touch_Point* pPoint = null;
-
_TouchManager* pTouchManager = _TouchManager::GetInstance();
SysAssertf(pTouchManager, "Failed to get touch manager.");
std::unique_ptr<IBidirectionalEnumeratorT<_FingerInfo*> > pTouchListEnum(pTouchList->GetBidirectionalEnumeratorN());
SysAssertf(pTouchListEnum.get() != null, "Failed to get enumerator of touch list.");
- FloatPoint currentPoint;
+ Eina_List* pPointList = null;
_FingerInfo* pFingerInfo = null;
while(pTouchListEnum->MoveNext() == E_SUCCESS)
{
_TouchStatus state = pFingerInfo->GetStatus();
if(state == _TOUCH_PRESSED || state == _TOUCH_MOVED || state == _TOUCH_RELEASED || state == _TOUCH_CANCELED)
{
- currentPoint = GetAbsoluteCoordinate(pFingerInfo->GetPoint());
- Point integerPoint(_CoordinateSystemUtils::ConvertToInteger(currentPoint));
-
- pPoint = static_cast<Ewk_Touch_Point*>(calloc(1, sizeof(Ewk_Touch_Point)));
+ Point integerPoint(_CoordinateSystemUtils::ConvertToInteger(GetAbsoluteCoordinate(pFingerInfo->GetPoint())));
+ Ewk_Touch_Point* pPoint = static_cast<Ewk_Touch_Point*>(calloc(1, sizeof(Ewk_Touch_Point)));
pPoint->id = pFingerInfo->GetPointId();
pPoint->x = integerPoint.x;
pPoint->y = integerPoint.y;
pPoint->state = GetEvasTouchState((TouchStatus)pFingerInfo->GetStatus());
+ SysSecureLog(NID_WEB_CTRL, "The current value of id is %lu, x is %d, y is %d, state is %d", pPoint->id, pPoint->x, pPoint->y, pPoint->state);
pPointList = eina_list_append(pPointList, pPoint);
}
}
- DumpPointList(pPointList);
- Eina_Bool ret = ewk_view_feed_touch_event(__pEflWebkit->GetWebEvasObject(), GetEwkTouchEvent(touchInfo.GetTouchStatus()), pPointList, null);
- SysTryReturnVoidResult(NID_WEB_CTRL, ret == EINA_TRUE, E_SYSTEM, "[%s] A system error has been occurred. Failed to deliver touch event to javascript.", GetErrorMessage(E_SYSTEM));
+ ewk_view_feed_touch_event(__pEflWebkit->GetWebEvasObject(), GetEwkTouchEvent(touchInfo.GetTouchStatus()), pPointList, null);
void* pData = null;
-
EINA_LIST_FREE(pPointList, pData)
free(pData);
}
}
+void
+_Web::SetFullScreenEntered(bool isFullScreenEntered)
+{
+ __isFullScreenEntered = isFullScreenEntered;
+}
+
+
+void
+_Web::SetFocusEnd(bool focus)
+{
+ __focus = focus;
+}
+
+
+bool
+_Web::IsFocusEnd(void) const
+{
+ return __focus;
+}
+
+
+bool
+_Web::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+ Ecore_X_Window rootWindow = ecore_x_window_root_first_get();
+ Ecore_X_Atom keyboardExist = ecore_x_atom_get("X External Keyboard Exist");
+ unsigned int keyboardNumber = 0;
+ int ret = ecore_x_window_prop_card32_get(rootWindow, keyboardExist, &keyboardNumber, 1);
+ if (keyboardNumber == 0)
+ {
+ return false;
+ }
+
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+
+ if (IsFocusEnd() == true)
+ {
+ SetFocusEnd(false);
+ evas_object_focus_set(GetWebNativeNode(), EINA_FALSE);
+ return false;
+ }
+
+ switch(keyCode)
+ {
+ case _KEY_UP:
+ case _KEY_DOWN:
+ evas_object_focus_set(GetWebNativeNode(), EINA_FALSE);
+ return false;
+ break;
+ default:
+ break;
+ }
+
+ evas_object_focus_set(GetWebNativeNode(), EINA_TRUE);
+
+ return true;
+}
+
+
+bool
+_Web::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
+{
+ if (__isFullScreenEntered)
+ {
+ if (keyInfo.GetKeyCode() == _KEY_ESC || keyInfo.GetKeyCode() == _KEY_BACK)
+ {
+ __isFullScreenEntered = false;
+
+ ewk_view_fullscreen_exit(GetWebNativeNode());
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+void
+_Web::OnDrawFocus(void)
+{
+}
+
+
+bool
+_Web::OnFocusLost(const _Control& source)
+{
+ _Control::OnFocusLost(*this);
+
+ if (__touchPressed == true)
+ {
+ _TouchManager* pTouchManager = _TouchManager::GetInstance();
+ SysAssertf(pTouchManager, "Failed to get touch manager.");
+
+ Point absPoint(_CoordinateSystemUtils::ConvertToInteger(pTouchManager->GetPosition(pTouchManager->GetCurrentPointId())));
+
+ Ewk_Touch_Point* pPoint = static_cast< Ewk_Touch_Point* >(calloc(1, sizeof(Ewk_Touch_Point)));
+ pPoint->id = 0;
+ pPoint->x = absPoint.x;
+ pPoint->y = absPoint.y;
+ pPoint->state = EVAS_TOUCH_POINT_CANCEL;
+
+ Eina_List* pPointList = null;
+ pPointList = eina_list_append(pPointList, pPoint);
+
+ ewk_view_feed_touch_event(GetWebNativeNode(), EWK_TOUCH_CANCEL, pPointList, null);
+
+ void* pData = null;
+ EINA_LIST_FREE(pPointList, pData)
+ free(pData);
+
+ __touchPressed = false;
+ }
+
+ return false;
+}
+
+
}}} // Tizen::Web::Controls