*
* The file contains the definition of _Web class.
*/
+#include <Elementary.h>
#include <memory>
#include <FBaseByteBuffer.h>
#include <FBaseColLinkedListT.h>
#include <FGrpBitmap.h>
#include <FGrpCanvas.h>
#include <FGrpFloatRectangle.h>
+#include <FSysVibrator.h>
#include <FWebCtrlWebSetting.h>
#include <FGrp_CoordinateSystem.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 <FUi_TouchManager.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"
namespace
{
-static int __animationAccessibilityCount = 0;
+
+
+class _WebAccessibilityListener
+ : public Tizen::Ui::_IAccessibilityListener
+{
+public:
+ _WebAccessibilityListener(Evas_Object* pView);
+
+ virtual ~_WebAccessibilityListener(void);
+
+ virtual bool OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+ virtual bool OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+ virtual bool OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+ virtual bool OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+ virtual bool OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+ virtual bool OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+ virtual bool OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+ virtual bool OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+ virtual bool OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+private:
+ Evas_Object* __pView;
+};
+
+
+_WebAccessibilityListener::_WebAccessibilityListener(Evas_Object* pView)
+ : __pView(pView)
+{
+}
+
+
+_WebAccessibilityListener::~_WebAccessibilityListener(void)
+{
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return true;
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return true;
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return true;
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return true;
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return true;
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ 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)
+{
+ 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_ACTIVATE;
+
+ result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
+ delete pActionInfo;
+
+ return result;
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return true;
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return true;
+}
+
+
class _WebAccessibilityFocusHandler
- :public Tizen::Ui::_IAccessibilityFocusHandler
+ : public Tizen::Ui::_IAccessibilityFocusHandler
{
public:
- _WebAccessibilityFocusHandler(void)
- {
- }
- virtual ~_WebAccessibilityFocusHandler(void)
- {
- }
- virtual bool OnMoveFocus(Tizen::Ui::_AccessibilityFocusDirection direction)
+ _WebAccessibilityFocusHandler(Evas_Object* pView);
+
+ virtual ~_WebAccessibilityFocusHandler(void);
+
+ virtual bool OnMoveFocus(Tizen::Ui::_AccessibilityFocusDirection direction);
+
+ virtual bool OnMoveFocus(const Tizen::Graphics::Point& point);
+
+private:
+ Evas_Object* __pView;
+};
+
+
+_WebAccessibilityFocusHandler::_WebAccessibilityFocusHandler(Evas_Object* pView)
+ : __pView(pView)
+{
+}
+
+
+_WebAccessibilityFocusHandler::~_WebAccessibilityFocusHandler(void)
+{
+}
+
+
+bool
+_WebAccessibilityFocusHandler::OnMoveFocus(Tizen::Ui::_AccessibilityFocusDirection direction)
+{
+ 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;
+
+ if (direction == Tizen::Ui::_ACCESSIBILITY_FOCUS_DIRECTION_PREVIOUS)
{
- __animationAccessibilityCount++;
- if (direction == Tizen::Ui::_ACCESSIBILITY_FOCUS_DIRECTION_PREVIOUS)
- {
- if(__animationAccessibilityCount %3 == 0)
- {
- SysLog(NID_WEB_CTRL, "_WebAccessibilityFocusHandler can move focus , :direction : PREVIOUS");
- return false;
- }
- SysLog(NID_WEB_CTRL, "!!!_WebAccessibilityFocusHandler can NOT move focus , :direction : PREVIOUS");
- return true;
- }
- else if (direction == Tizen::Ui::_ACCESSIBILITY_FOCUS_DIRECTION_NEXT)
- {
- if(__animationAccessibilityCount %3 == 0)
- {
- SysLog(NID_WEB_CTRL, "_WebAccessibilityFocusHandler can move focus , :direction : NEXT");
- return false;
- }
- SysLog(NID_WEB_CTRL, "!!!_WebAccessibilityFocusHandler can NOT move focus , :direction : NEXT");
- return true;
- }
- return true;
+ pActionInfo->action_type = ELM_ACCESS_ACTION_HIGHLIGHT;
+
+ pActionInfo->action_by = ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
+
+ result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
}
- virtual bool OnMoveFocus(const Tizen::Graphics::Point& point)
+ else if (direction == Tizen::Ui::_ACCESSIBILITY_FOCUS_DIRECTION_NEXT)
{
- if(__animationAccessibilityCount %2 == 0)
- {
- SysLog(NID_WEB_CTRL, "_WebAccessibilityFocusHandler can read element at the point (%d,%d)", point.x, point.y);
- return true;
- }
- else
- {
- SysLog(NID_WEB_CTRL, "_WebAccessibilityFocusHandler can NOT read element at the point (%d,%d)", point.x, point.y);
- return false;
- }
+ pActionInfo->action_type = ELM_ACCESS_ACTION_HIGHLIGHT;
+
+ pActionInfo->action_by = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
+ result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
}
-};
+ delete pActionInfo;
+
+ return result;
+}
+
+
+bool
+_WebAccessibilityFocusHandler::OnMoveFocus(const Tizen::Graphics::Point& point)
+{
+ 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_READ;
+ pActionInfo->x = point.x;
+ pActionInfo->y = point.y;
+
+ 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)
+{
+ _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)
- : __gestureType(WEB_GESTURE_TYPE_TAP)
- , __pGestureHandler(null)
+ : __pGestureHandler(null)
, __pEflWebkit(null)
+ , __pWebSetting(null)
, __pGestureFlick(null)
, __pGestureLongPress(null)
, __pGesturePinch(null)
, __pPanningGestureHandler(null)
, __pFlickGestureHandler(null)
, __pPinchGestureHandler(null)
+ , __gestureType(WEB_GESTURE_TYPE_TAP)
+ , __edgeType(WEB_EDGE_NONE)
+ , __pTextElement(null)
+ , __previousTouchedPosition(0.0f, 0.0f)
+ , __isFullScreenEntered(false)
{
SetBackgroundColor(Color(0, 0, 0, 0));
}
_Web::~_Web(void)
{
+ _UiEventManager* pManager = _UiEventManager::GetInstance();
+ SysAssertf(pManager, "Failed to get ui evnet manager.");
+
+ pManager->RemoveKeyEventListener(*this);
+
RemoveGestureListener();
}
std::unique_ptr<_Web> pWeb(new (std::nothrow) _Web());
SysTryReturn(NID_WEB_CTRL, pWeb.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ pWeb->__pWebSetting = std::unique_ptr<WebSetting>(new (std::nothrow) WebSetting());
+ SysTryReturn(NID_WEB_CTRL, pWeb->__pWebSetting.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
pWeb->AcquireHandle();
pWeb->SetMultiTouchEnabled(true);
pWeb->SetTouchPressThreshold(0.08);
r = pWeb->InitializeGestureStates();
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+ _UiEventManager* pManager = _UiEventManager::GetInstance();
+ SysAssertf(pManager, "Failed to get ui evnet manager.");
+
+ pManager->AddKeyEventListener(*pWeb.get());
+
return pWeb.release();
}
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());
+ _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();
+ evas_object_smart_callback_add(pView, "edge,left", OnEdgeLeft, this);
+ evas_object_smart_callback_add(pView, "edge,right", OnEdgeRight, this);
+ evas_object_smart_callback_add(pView, "edge,top", OnEdgeTop, this);
+ evas_object_smart_callback_add(pView, "edge,bottom", OnEdgeBottom, this);
+
return E_SUCCESS;
}
__pGesturePinch->RemoveGestureListener(*this);
RemoveGestureDetector(*__pGesturePinch);
}
+
+ Evas_Object* pView = GetWebNativeNode();
+ if (pView)
+ {
+ evas_object_smart_callback_del(pView, "edge,left", OnEdgeLeft);
+ evas_object_smart_callback_del(pView, "edge,right", OnEdgeRight);
+ evas_object_smart_callback_del(pView, "edge,top", OnEdgeTop);
+ evas_object_smart_callback_del(pView, "edge,bottom", OnEdgeBottom);
+ }
}
SetNativeObjectFocusable(false);
_AccessibilityContainer* pContainer = GetAccessibilityContainer();
- if (pContainer)
- {
- pContainer->Activate(true);
- }
+ SysTryReturn(NID_WEB_CTRL, pContainer, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(E_SYSTEM));
+
+ __pTextElement = new (std::nothrow) _AccessibilityElement(true);
+ SysTryReturn(NID_WEB_CTRL, __pTextElement, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ __pTextElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
+ __pTextElement->SetLabel(L"Web control");
+
+ pContainer->AddElement(*__pTextElement);
+ pContainer->Activate(true);
+
+ _WebAccessibilityListener* pListener = new (std::nothrow) _WebAccessibilityListener(GetWebNativeNode());
+ SysTryReturn(NID_WEB_CTRL, pListener, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- _WebAccessibilityFocusHandler* pFocusHandler = new (std::nothrow) _WebAccessibilityFocusHandler();
+ pContainer->AddListener(*dynamic_cast<_IAccessibilityListener*>(pListener));
+
+ _WebAccessibilityFocusHandler* pFocusHandler = new (std::nothrow) _WebAccessibilityFocusHandler(GetWebNativeNode());
+ SysTryReturn(NID_WEB_CTRL, pFocusHandler, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
pContainer->SetFocusHandler(dynamic_cast<_IAccessibilityFocusHandler*>(pFocusHandler));
Point
_Web::GetRelativeCoordinate(Point absolutePoint)
{
- return _CoordinateSystemUtils::InverseTransform(ConvertToControlPosition(absolutePoint));
+ return ConvertToControlPosition(_CoordinateSystemUtils::InverseTransform(absolutePoint));
}
FloatPoint
_Web::GetRelativeCoordinate(FloatPoint absolutePoint)
{
- return _CoordinateSystemUtils::InverseTransform(ConvertToControlPosition(absolutePoint));
+ return ConvertToControlPosition(_CoordinateSystemUtils::InverseTransform(absolutePoint));
}
Evas_Object*
_Web::GetWebNativeNode(void)
{
- SysTryReturn(NID_WEB_CTRL, __pEflWebkit.get(), null, E_INVALID_STATE, "[%s] Native node is in an invalid state.", GetErrorMessage(E_INVALID_STATE));
-
- return __pEflWebkit->GetWebEvasObject();
-}
-
+ if (__pEflWebkit.get())
+ {
+ return __pEflWebkit->GetWebEvasObject();
+ }
-void
-_Web::SetWebSettingImpl(_WebSettingImpl* pWebSettingImpl)
-{
- __pWebSettingImpl = pWebSettingImpl;
+ return null;
}
-_WebSettingImpl*
-_Web::GetWebSettingImpl(void) const
+WebSetting*
+_Web::GetSetting(void) const
{
- return __pWebSettingImpl;
+ return __pWebSetting.get();
}
}
+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)
{
+ evas_object_focus_set(GetWebNativeNode(), EINA_TRUE);
+
if (__pEflWebkit.get())
{
+ __edgeType = WEB_EDGE_NONE;
+ __previousTouchedPosition = touchInfo.GetCurrentPosition();
+
SendTouchEventForJavaScript(touchInfo);
return __pGestureHandler->OnTouchPressed(source, touchInfo);
}
- return true;
+ return false;
}
bool
_Web::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
{
- if (__pEflWebkit.get() && __pWebSettingImpl->IsScrollEnabled())
+ if (__pEflWebkit.get())
{
+ if (__gestureType == WEB_GESTURE_TYPE_TAP)
+ {
+ __pPanningGestureHandler->InitializeTextSelectionStatus();
+ }
+
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;
}
bool
_Web::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
{
+ SetFocused();
+
if (__pEflWebkit.get())
{
SendTouchEventForJavaScript(touchInfo);
return __pGestureHandler->OnTouchReleased(source, touchInfo);
-
- _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(GetWebNativeNode(), WEB_CTRL));
-
- if (pWebImpl->GetLoadingListener() && pWebImpl->GetTextFromBlock().GetLength() > 0)
- {
- pWebImpl->FireWebPageBlockSelectedEvent();
- }
}
- SetFocused();
-
- return true;
+ return false;
}
{
SendTouchEventForJavaScript(touchInfo);
- __pGestureHandler->OnTouchCanceled(source, touchInfo);
+ return __pGestureHandler->OnTouchCanceled(source, touchInfo);
}
- return true;
+ return false;
}
bool
_Web::OnFlickGestureDetected(_TouchFlickGestureDetector& gesture)
{
- if (__pEflWebkit.get() && __pWebSettingImpl->IsScrollEnabled())
+ if (__pEflWebkit.get() && _WebSettingImpl::GetInstance(__pWebSetting.get())->IsScrollEnabled())
{
return __pFlickGestureHandler->OnFlickGestureDetected(gesture);
}
Canvas*
-_Web::OnCanvasRequestedFN(const FloatRectangle& bounds)
+_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));
- 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));
std::unique_ptr<Canvas> pCanvas(new (std::nothrow) Canvas());
SysTryReturn(NID_WEB_CTRL, pCanvas.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = pCanvas->Construct(bufferInfo);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
+ 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));
+
+ r = pCanvas->Construct(bufferInfo);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
+ }
+ else
+ {
+ r = pCanvas->Construct(bounds);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
+ }
return pCanvas.release();
}
{
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);
-
- for(; pList; pList = eina_list_next(pList))
- {
- Ewk_Touch_Point* pPointDump = static_cast<Ewk_Touch_Point*>(eina_list_data_get(pList));
- SysLog(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);
- }
+ result r = E_SUCCESS;
+
+ 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)
- {
+ {
r = pTouchListEnum->GetCurrent(pFingerInfo);
- SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
_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));
+ Point integerPoint(_CoordinateSystemUtils::ConvertToInteger(GetAbsoluteCoordinate(pFingerInfo->GetPoint())));
- pPoint = static_cast<Ewk_Touch_Point*>(calloc(1, sizeof(Ewk_Touch_Point)));
-
- pPoint->id = pFingerInfo->GetPointId();
+ 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);
+ 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;
+}
+
+
+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;
+}
+
+
}}} // Tizen::Web::Controls