Derived InputPickerPopup from Webpopup and ColorPicker popup issue fixed
[framework/osp/web.git] / src / controls / FWebCtrl_Web.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FWebCtrl_Web.cpp
20  * @brief               The file contains the definition of _Web class.
21  *
22  * The file contains the definition of _Web class.
23  */
24 #include <Ecore_X.h>
25 #include <Elementary.h>
26 #include <memory>
27 #include <FBaseByteBuffer.h>
28 #include <FBaseColLinkedListT.h>
29 #include <FBaseSysLog.h>
30 #include <FBaseColIListT.h>
31 #include <FGrpFloatPoint.h>
32 #include <FGrpPoint.h>
33 #include <FGrpBitmap.h>
34 #include <FGrpCanvas.h>
35 #include <FGrpFloatRectangle.h>
36 #include <FSysVibrator.h>
37 #include <FWebCtrlWebSetting.h>
38 #include <FGrp_CoordinateSystem.h>
39 #include <FSys_VibratorImpl.h>
40 #include <FUiAnim_EflNode.h>
41 #include <FUiAnim_VisualElement.h>
42 #include <FUiAnim_VisualElementImpl.h>
43 #include <FUi_CoordinateSystemUtils.h>
44 #include <FUi_AccessibilityContainer.h>
45 #include <FUi_AccessibilityElement.h>
46 #include <FUi_UiEventManager.h>
47 #include <FUi_IAccessibilityFocusHandler.h>
48 #include <FUi_IAccessibilityListener.h>
49 #include <FUi_Math.h>
50 #include <FUi_TouchManager.h>
51 #include "FWebCtrl_EflWebkit.h"
52 #include "FWebCtrl_GestureState.h"
53 #include "FWebCtrl_Web.h"
54 #include "FWebCtrl_WebSettingImpl.h"
55 #include "FWebCtrl_Utility.h"
56
57
58 using namespace Tizen::Base;
59 using namespace Tizen::Base::Collection;
60 using namespace Tizen::Graphics;
61 using namespace Tizen::Ui;
62 using namespace Tizen::Ui::Animations;
63
64
65 namespace
66 {
67
68
69 class _WebAccessibilityListener
70         : public Tizen::Ui::_IAccessibilityListener
71 {
72 public:
73         _WebAccessibilityListener(Evas_Object* pView);
74
75         virtual ~_WebAccessibilityListener(void);
76
77         virtual bool OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element);
78
79         virtual bool OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element);
80
81         virtual bool OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element);
82
83         virtual bool OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element);
84
85         virtual bool OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element);
86
87         virtual bool OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element);
88
89         virtual bool OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element);
90
91         virtual bool OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element);
92
93         virtual bool OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element);
94
95 private:
96         Evas_Object* __pView;
97 };
98
99
100 _WebAccessibilityListener::_WebAccessibilityListener(Evas_Object* pView)
101         : __pView(pView)
102 {
103 }
104
105
106 _WebAccessibilityListener::~_WebAccessibilityListener(void)
107 {
108 }
109
110
111 bool
112 _WebAccessibilityListener::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
113 {
114         return true;
115 }
116
117
118 bool
119 _WebAccessibilityListener::OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element)
120 {
121         return true;
122 }
123
124
125 bool
126 _WebAccessibilityListener::OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
127 {
128         return true;
129 }
130
131
132 bool
133 _WebAccessibilityListener::OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
134 {
135         return true;
136 }
137
138
139 bool
140 _WebAccessibilityListener::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
141 {
142         return true;
143 }
144
145
146 bool
147 _WebAccessibilityListener::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
148 {
149         Ewk_View_Smart_Data* pSmartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(__pView));
150         SysAssertf(pSmartData, "Failed to get webkit smart data.");
151
152         Elm_Access_Action_Info* pActionInfo = new Elm_Access_Action_Info();
153         SysTryReturn(NID_WEB_CTRL, pActionInfo, false, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
154
155         bool result = false;
156
157         pActionInfo->action_type = ELM_ACCESS_ACTION_UNHIGHLIGHT;
158
159         result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
160         delete pActionInfo;
161
162         return result;
163 }
164
165
166 bool
167 _WebAccessibilityListener::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
168 {
169         Ewk_View_Smart_Data* pSmartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(__pView));
170         SysAssertf(pSmartData, "Failed to get webkit smart data.");
171
172         Elm_Access_Action_Info* pActionInfo = new Elm_Access_Action_Info();
173         SysTryReturn(NID_WEB_CTRL, pActionInfo, false, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
174
175         bool result = false;
176
177         pActionInfo->action_type = ELM_ACCESS_ACTION_ACTIVATE;
178
179         result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
180         delete pActionInfo;
181
182         return result;
183 }
184
185
186 bool
187 _WebAccessibilityListener::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
188 {
189         return true;
190 }
191
192
193 bool
194 _WebAccessibilityListener::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
195 {
196         return true;
197 }
198
199
200 class _WebAccessibilityFocusHandler
201         : public Tizen::Ui::_IAccessibilityFocusHandler
202 {
203 public:
204         _WebAccessibilityFocusHandler(Evas_Object* pView);
205
206         virtual ~_WebAccessibilityFocusHandler(void);
207
208         virtual bool OnMoveFocus(Tizen::Ui::_AccessibilityFocusDirection direction);
209
210         virtual bool OnMoveFocus(const Tizen::Graphics::Point& point);
211
212 private:
213         Evas_Object* __pView;
214 };
215
216
217 _WebAccessibilityFocusHandler::_WebAccessibilityFocusHandler(Evas_Object* pView)
218         : __pView(pView)
219 {
220 }
221
222
223 _WebAccessibilityFocusHandler::~_WebAccessibilityFocusHandler(void)
224 {
225 }
226
227
228 bool
229 _WebAccessibilityFocusHandler::OnMoveFocus(Tizen::Ui::_AccessibilityFocusDirection direction)
230 {
231         Ewk_View_Smart_Data* pSmartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(__pView));
232         SysAssertf(pSmartData, "Failed to get webkit smart data.");
233
234         Elm_Access_Action_Info* pActionInfo = new Elm_Access_Action_Info();
235         SysTryReturn(NID_WEB_CTRL, pActionInfo, false, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
236
237         bool result = false;
238
239         if (direction == Tizen::Ui::_ACCESSIBILITY_FOCUS_DIRECTION_PREVIOUS)
240         {
241                 pActionInfo->action_type = ELM_ACCESS_ACTION_HIGHLIGHT;
242
243                 pActionInfo->action_by = ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
244
245                 result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
246         }
247         else if (direction == Tizen::Ui::_ACCESSIBILITY_FOCUS_DIRECTION_NEXT)
248         {
249                 pActionInfo->action_type = ELM_ACCESS_ACTION_HIGHLIGHT;
250
251                 pActionInfo->action_by = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
252
253                 result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
254         }
255         delete pActionInfo;
256
257         return result;
258 }
259
260
261 bool
262 _WebAccessibilityFocusHandler::OnMoveFocus(const Tizen::Graphics::Point& point)
263 {
264         Ewk_View_Smart_Data* pSmartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(__pView));
265         SysAssertf(pSmartData, "Failed to get webkit smart data.");
266
267         Elm_Access_Action_Info* pActionInfo = new Elm_Access_Action_Info();
268         SysTryReturn(NID_WEB_CTRL, pActionInfo, false, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
269
270         bool result = false;
271
272         pActionInfo->action_type = ELM_ACCESS_ACTION_READ;
273         pActionInfo->x = point.x;
274         pActionInfo->y = point.y;
275
276         result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
277         delete pActionInfo;
278
279         return result;
280 }
281
282
283 }
284
285
286 namespace Tizen { namespace Web { namespace Controls
287 {
288
289
290 void
291 OnEdgeLeft(void* pUserData, Evas_Object* pView, void* pEventInfo)
292 {
293         _Web* pCore = reinterpret_cast< _Web* >(pUserData);
294         SysAssertf(pCore, "Failed to request");
295
296         pCore->SetEdgeReachedEvent(WEB_EDGE_LEFT);
297 }
298
299
300 void
301 OnEdgeRight(void* pUserData, Evas_Object* pView, void* pEventInfo)
302 {
303         _Web* pCore = reinterpret_cast< _Web* >(pUserData);
304         SysAssertf(pCore, "Failed to request");
305
306         pCore->SetEdgeReachedEvent(WEB_EDGE_RIGHT);
307 }
308
309
310 void
311 OnEdgeTop(void* pUserData, Evas_Object* pView, void* pEventInfo)
312 {
313         _Web* pCore = reinterpret_cast< _Web* >(pUserData);
314         SysAssertf(pCore, "Failed to request");
315
316         pCore->SetEdgeReachedEvent(WEB_EDGE_TOP);
317 }
318
319
320 void
321 OnEdgeBottom(void* pUserData, Evas_Object* pView, void* pEventInfo)
322 {
323         _Web* pCore = reinterpret_cast< _Web* >(pUserData);
324         SysAssertf(pCore, "Failed to request");
325
326         pCore->SetEdgeReachedEvent(WEB_EDGE_BOTTOM);
327 }
328
329
330 _Web::_Web(void)
331         : __pGestureHandler(null)
332         , __pEflWebkit(null)
333         , __pWebSetting(null)
334         , __pGestureFlick(null)
335         , __pGestureLongPress(null)
336         , __pGesturePinch(null)
337         , __pGestureDoubleTap(null)
338         , __pTouchEventInfoList(null)
339         , __pTapGestureHandler(null)
340         , __pPanningGestureHandler(null)
341         , __pFlickGestureHandler(null)
342         , __pPinchGestureHandler(null)
343         , __gestureType(WEB_GESTURE_TYPE_TAP)
344         , __edgeType(WEB_EDGE_NONE)
345         , __focus(false)
346         , __pTextElement(null)
347         , __previousTouchedPosition(0.0f, 0.0f)
348         , __isFullScreenEntered(false)
349         , __isRotated(false)
350 {
351         SetBackgroundColor(Color(0, 0, 0, 0));
352 }
353
354
355 _Web::~_Web(void)
356 {
357         RemoveGestureListener();
358 }
359
360
361 _Web*
362 _Web::CreateWebN(void)
363 {
364         result r = E_SUCCESS;
365
366         std::unique_ptr<_Web> pWeb(new (std::nothrow) _Web());
367         SysTryReturn(NID_WEB_CTRL, pWeb.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
368
369         pWeb->__pWebSetting = std::unique_ptr<WebSetting>(new (std::nothrow) WebSetting());
370         SysTryReturn(NID_WEB_CTRL, pWeb->__pWebSetting.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
371
372         pWeb->AcquireHandle();
373         pWeb->SetMultiTouchEnabled(true);
374         pWeb->SetTouchPressThreshold(0.08);
375
376         r = pWeb->AddGestureListeners();
377         SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
378
379         r = pWeb->InitializeGestureStates();
380         SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
381
382         return pWeb.release();
383 }
384
385
386 result
387 _Web::CreateWebkitEvasObject(void)
388 {
389         result r = E_SUCCESS;
390
391         std::unique_ptr<_EflWebkit> pEflWebkit(new (std::nothrow) _EflWebkit());
392         SysTryReturnResult(NID_WEB_CTRL, pEflWebkit.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
393
394         _VisualElement* pVe = GetVisualElement();
395         r = pEflWebkit->Construct(GetAbsoluteBounds(), *pVe, this);
396         SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
397
398         _VisualElementImpl* pVeImpl = _VisualElementImpl::GetInstance(*pVe);
399         pVeImpl->SetCaptureProvider(this);
400
401         __pEflWebkit = std::move(pEflWebkit);
402
403         Evas_Object* pView = GetWebNativeNode();
404         evas_object_smart_callback_add(pView, "edge,left", OnEdgeLeft, this);
405         evas_object_smart_callback_add(pView, "edge,right", OnEdgeRight, this);
406         evas_object_smart_callback_add(pView, "edge,top", OnEdgeTop, this);
407         evas_object_smart_callback_add(pView, "edge,bottom", OnEdgeBottom, this);
408
409         return E_SUCCESS;
410 }
411
412
413 result
414 _Web::InitializeGestureStates(void)
415 {
416         __pPinchGestureHandler = std::unique_ptr<_PinchGestureState>(new (std::nothrow) _PinchGestureState(this));
417         SysTryReturnResult(NID_WEB_CTRL, __pPinchGestureHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
418
419         __pTapGestureHandler = std::unique_ptr<_TapGestureState>(new (std::nothrow) _TapGestureState(this));
420         SysTryReturnResult(NID_WEB_CTRL, __pTapGestureHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
421
422         __pPanningGestureHandler = std::unique_ptr<_PanningGestureState>(new (std::nothrow) _PanningGestureState(this));
423         SysTryReturnResult(NID_WEB_CTRL, __pPanningGestureHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
424
425         __pFlickGestureHandler = std::unique_ptr<_FlickGestureState>(new (std::nothrow) _FlickGestureState(this));
426         SysTryReturnResult(NID_WEB_CTRL, __pFlickGestureHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
427
428         __pGestureHandler = __pTapGestureHandler.get();
429
430         return E_SUCCESS;
431 }
432
433
434 result
435 _Web::AddGestureListeners(void)
436 {
437         result r = E_SUCCESS;
438
439         std::unique_ptr<_TouchFlickGestureDetector> pGestureFlick(new (std::nothrow) _TouchFlickGestureDetector());
440         SysTryReturnResult(NID_WEB_CTRL, pGestureFlick.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
441
442         r = pGestureFlick->AddGestureListener(*this);
443         SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
444
445         r = AddGestureDetector(*pGestureFlick.get());
446         SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
447
448         __pGestureFlick = std::move(pGestureFlick);
449
450         std::unique_ptr<_TouchLongPressGestureDetector> pGestureLongPress(new (std::nothrow) _TouchLongPressGestureDetector());
451         SysTryReturnResult(NID_WEB_CTRL, pGestureLongPress.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
452
453         r = pGestureLongPress->AddGestureListener(*this);
454         SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
455
456         r = AddGestureDetector(*pGestureLongPress.get());
457         SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
458
459         __pGestureLongPress = std::move(pGestureLongPress);
460
461         std::unique_ptr<_TouchTapGestureDetector> pGestureDoubleTap(new (std::nothrow) _TouchTapGestureDetector());
462         SysTryReturnResult(NID_WEB_CTRL, pGestureDoubleTap.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
463
464         r = pGestureDoubleTap->AddGestureListener(*this);
465         SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
466
467         r = AddGestureDetector(*pGestureDoubleTap.get());
468         SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
469
470         __pGestureDoubleTap = std::move(pGestureDoubleTap);
471
472         std::unique_ptr<_TouchPinchGestureDetector> pGesturePinch(new (std::nothrow) _TouchPinchGestureDetector());
473         SysTryReturnResult(NID_WEB_CTRL, pGesturePinch.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
474
475         r = pGesturePinch->AddGestureListener(*this);
476         SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
477
478         r = AddGestureDetector(*pGesturePinch.get());
479         SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
480
481         __pGesturePinch = std::move(pGesturePinch);
482
483         return E_SUCCESS;
484 }
485
486
487 void
488 _Web::RemoveGestureListener(void)
489 {
490         if (__pGestureFlick.get())
491         {
492                 __pGestureFlick->RemoveGestureListener(*this);
493                 RemoveGestureDetector(*__pGestureFlick);
494         }
495
496         if (__pGestureLongPress.get())
497         {
498                 __pGestureLongPress->RemoveGestureListener(*this);
499                 RemoveGestureDetector(*__pGestureLongPress);
500         }
501
502         if (__pGestureDoubleTap.get())
503         {
504                 __pGestureDoubleTap->RemoveGestureListener(*this);
505                 RemoveGestureDetector(*__pGestureDoubleTap);
506         }
507
508         if (__pGesturePinch.get())
509         {
510                 __pGesturePinch->RemoveGestureListener(*this);
511                 RemoveGestureDetector(*__pGesturePinch);
512         }
513
514         Evas_Object* pView = GetWebNativeNode();
515         if (pView)
516         {
517                 evas_object_smart_callback_del(pView, "edge,left", OnEdgeLeft);
518                 evas_object_smart_callback_del(pView, "edge,right", OnEdgeRight);
519                 evas_object_smart_callback_del(pView, "edge,top", OnEdgeTop);
520                 evas_object_smart_callback_del(pView, "edge,bottom", OnEdgeBottom);
521         }
522 }
523
524
525 result
526 _Web::InitializeWebNativeNode(void)
527 {
528         result r = E_SUCCESS;
529
530         r = CreateWebkitEvasObject();
531         SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
532
533         SetNativeObjectFocusable(false);
534
535         _AccessibilityContainer* pContainer = GetAccessibilityContainer();
536         SysTryReturn(NID_WEB_CTRL, pContainer, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(E_SYSTEM));
537
538         __pTextElement = new (std::nothrow) _AccessibilityElement(true);
539         SysTryReturn(NID_WEB_CTRL, __pTextElement, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
540
541         __pTextElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
542         __pTextElement->SetLabel(L"Web control");
543
544         pContainer->AddElement(*__pTextElement);
545         pContainer->Activate(true);
546
547         _WebAccessibilityListener* pListener = new (std::nothrow) _WebAccessibilityListener(GetWebNativeNode());
548         SysTryReturn(NID_WEB_CTRL, pListener, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
549
550         pContainer->AddListener(*dynamic_cast<_IAccessibilityListener*>(pListener));
551
552         _WebAccessibilityFocusHandler* pFocusHandler = new (std::nothrow) _WebAccessibilityFocusHandler(GetWebNativeNode());
553         SysTryReturn(NID_WEB_CTRL, pFocusHandler, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
554
555         pContainer->SetFocusHandler(dynamic_cast<_IAccessibilityFocusHandler*>(pFocusHandler));
556
557         return E_SUCCESS;
558 }
559
560
561 Point
562 _Web::GetAbsoluteCoordinate(Point relativePoint)
563 {
564         return _CoordinateSystemUtils::Transform(ConvertToScreenPosition(relativePoint));
565 }
566
567
568 FloatPoint
569 _Web::GetAbsoluteCoordinate(FloatPoint relativePoint)
570 {
571         return _CoordinateSystemUtils::Transform(ConvertToScreenPosition(relativePoint));
572 }
573
574
575 Point
576 _Web::GetRelativeCoordinate(Point absolutePoint)
577 {
578         return ConvertToControlPosition(_CoordinateSystemUtils::InverseTransform(absolutePoint));
579 }
580
581
582 FloatPoint
583 _Web::GetRelativeCoordinate(FloatPoint absolutePoint)
584 {
585         return ConvertToControlPosition(_CoordinateSystemUtils::InverseTransform(absolutePoint));
586 }
587
588
589 Evas_Object*
590 _Web::GetWebNativeNode(void)
591 {
592         if (__pEflWebkit.get())
593         {
594                 return __pEflWebkit->GetWebEvasObject();
595         }
596
597         return null;
598 }
599
600
601 WebSetting*
602 _Web::GetSetting(void) const
603 {
604         return __pWebSetting.get();
605 }
606
607 _EflWebkit*
608 _Web::GetEflWebkit(void) const
609 {
610         return __pEflWebkit.get();
611 }
612
613
614 result
615 _Web::OnAttaching(const _Control* pParent)
616 {
617         if (__pEflWebkit.get())
618         {
619                 evas_object_show(__pEflWebkit->GetWebEvasObject());
620                 evas_object_focus_set(__pEflWebkit->GetWebEvasObject(), EINA_TRUE);
621         }
622
623         return E_SUCCESS;
624 }
625
626
627 result
628 _Web::OnBoundsChanging(const Rectangle& bounds)
629 {
630         Rectangle absoluteBounds = GetAbsoluteBounds();
631         Rectangle webBounds = GetBounds();
632         _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetTransformer();
633         SysTryReturnResult(NID_WEB_CTRL, pXformer, E_SYSTEM, "[%s] A system error has been occurred. Failed to get coordinate transformer.", GetErrorMessage(E_SYSTEM));
634
635         if (__pEflWebkit.get() && __isRotated == false)
636         {
637                 evas_object_move(__pEflWebkit->GetWebEvasObject(), pXformer->TransformHorizontal(absoluteBounds.x - webBounds.x + bounds.x), pXformer->TransformVertical(absoluteBounds.y - webBounds.y + bounds.y));
638                 evas_object_resize(__pEflWebkit->GetWebEvasObject(), pXformer->TransformHorizontal(bounds.width), pXformer->TransformVertical(bounds.height));
639         }
640
641         return E_SUCCESS;
642 }
643
644
645 void
646 _Web::OnBoundsChanged(void)
647 {
648         __isRotated = false;
649 }
650
651
652 void
653 _Web::OnChangeLayout(_ControlOrientation orientation)
654 {
655         __isRotated = true;
656 }
657
658
659 void
660 _Web::ChangeGesture(_WebGestureType type)
661 {
662         switch (type)
663         {
664         case WEB_GESTURE_TYPE_TAP:
665                 __pGestureHandler = __pTapGestureHandler.get();
666                 __gestureType = WEB_GESTURE_TYPE_TAP;
667                 break;
668
669         case WEB_GESTURE_TYPE_PANNING:
670                 __pGestureHandler = __pPanningGestureHandler.get();
671                 __gestureType = WEB_GESTURE_TYPE_PANNING;
672                 break;
673
674         case WEB_GESTURE_TYPE_FLICK:
675                 __pGestureHandler = __pFlickGestureHandler.get();
676                 __gestureType = WEB_GESTURE_TYPE_FLICK;
677                 break;
678
679         case WEB_GESTURE_TYPE_PINCH:
680                 __pGestureHandler = __pPinchGestureHandler.get();
681                 __gestureType = WEB_GESTURE_TYPE_PINCH;
682                 break;
683
684         default:
685                 SysAssert(false);
686         }
687 }
688
689
690 void
691 _Web::SetEdgeReachedEvent(_WebEdgeType type)
692 {
693         __edgeType |= type;
694
695         switch(type)
696         {
697         case WEB_EDGE_LEFT:
698                 __edgeType &= ~WEB_EDGE_RIGHT;
699                 break;
700
701         case WEB_EDGE_RIGHT:
702                 __edgeType &= ~WEB_EDGE_LEFT;
703                 break;
704
705         case WEB_EDGE_TOP:
706                 __edgeType &= ~WEB_EDGE_BOTTOM;
707                 break;
708
709         case WEB_EDGE_BOTTOM:
710                 __edgeType &= ~WEB_EDGE_TOP;
711                 break;
712
713         default:
714                 SysAssert(false);
715         }
716 }
717
718
719 bool
720 _Web::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
721 {
722         if (__pEflWebkit.get())
723         {
724                 __edgeType = WEB_EDGE_NONE;
725                 __previousTouchedPosition = touchInfo.GetCurrentPosition();
726
727                 SendTouchEventForJavaScript(touchInfo);
728
729                 return __pGestureHandler->OnTouchPressed(source, touchInfo);
730         }
731
732         return false;
733 }
734
735
736 bool
737 _Web::CanOutOfEdgeLeft(float scrollDistanceX, int pageDistance)
738 {
739         if (scrollDistanceX < 0.0f)
740         {
741                 __edgeType &= ~WEB_EDGE_RIGHT;
742
743                 return false;
744         }
745         else if (scrollDistanceX > 0.0f && pageDistance != 0)
746         {
747                 __edgeType &= ~WEB_EDGE_LEFT;
748         }
749
750         return true;
751 }
752
753
754 bool
755 _Web::CanOutOfEdgeRight(float scrollDistanceX, int pageDistance)
756 {
757         if (scrollDistanceX > 0.0f)
758         {
759                 __edgeType &= ~WEB_EDGE_LEFT;
760
761                 return false;
762         }
763         else if (scrollDistanceX < 0.0f &&  pageDistance != 0)
764         {
765                 __edgeType &= ~WEB_EDGE_RIGHT;
766         }
767
768         return true;
769 }
770
771
772 bool
773 _Web::CanOutOfEdgeTop(float scrollDistanceY, int pageDistance)
774 {
775         if (scrollDistanceY < 0.0f)
776         {
777                 __edgeType &= ~WEB_EDGE_BOTTOM;
778
779                 return false;
780         }
781         else if (scrollDistanceY > 0.0f && pageDistance != 0)
782         {
783                 __edgeType &= ~WEB_EDGE_TOP;
784         }
785
786         return true;
787 }
788
789
790 bool
791 _Web::CanOutOfEdgeBottom(float scrollDistanceY, int pageDistance)
792 {
793         if (scrollDistanceY > 0.0f)
794         {
795                 __edgeType &= ~WEB_EDGE_TOP;
796
797                 return false;
798         }
799         else if (scrollDistanceY < 0.0f && pageDistance != 0)
800         {
801                 __edgeType &= ~WEB_EDGE_BOTTOM;
802         }
803
804         return true;
805 }
806
807
808 bool
809 _Web::CanConsumeTouchMoved(float scrollDistanceX, float scrollDistanceY)
810 {
811         if (__edgeType ==  WEB_EDGE_NONE)
812         {
813                 return true;
814         }
815
816         bool ret = true;
817
818         int scrollWidth = 0;
819         int scrollHeight = 0;
820         ewk_view_scroll_size_get(GetWebNativeNode(), &scrollWidth, &scrollHeight);
821
822         int scrollX = 0;
823         int scrollY = 0;
824         ewk_view_scroll_pos_get(GetWebNativeNode(), &scrollX, &scrollY);
825
826         if (scrollWidth == 0)
827         {
828                 if (__edgeType & WEB_EDGE_TOP)
829                 {
830                         if (!CanOutOfEdgeTop(scrollDistanceY, scrollY - 0))
831                         {
832                                 return false;
833                         }
834                 }
835                 else if (__edgeType & WEB_EDGE_BOTTOM)
836                 {
837                         if (!CanOutOfEdgeBottom(scrollDistanceY, scrollY - scrollHeight))
838                         {
839                                 return false;
840                         }
841                 }
842         }
843
844         if (scrollHeight == 0)
845         {
846                 if (__edgeType & WEB_EDGE_LEFT)
847                 {
848                         if (!CanOutOfEdgeLeft(scrollDistanceX, scrollX - 0))
849                         {
850                                 return false;
851                         }
852                 }
853                 else if  (__edgeType & WEB_EDGE_RIGHT)
854                 {
855                         if (!CanOutOfEdgeRight(scrollDistanceX, scrollX - scrollWidth))
856                         {
857                                 return false;
858                         }
859                 }
860         }
861
862         if (scrollWidth > 0 && scrollHeight > 0)
863         {
864                 if  ((__edgeType & WEB_EDGE_LEFT) && (__edgeType & WEB_EDGE_TOP))
865                 {
866                         if (!CanOutOfEdgeLeft(scrollDistanceX, scrollX - 0) || !CanOutOfEdgeTop(scrollDistanceY, scrollY - 0))
867                         {
868                                 return false;
869                         }
870                 }
871                 else if  ((__edgeType & WEB_EDGE_LEFT) && (__edgeType & WEB_EDGE_BOTTOM))
872                 {
873                         if (!CanOutOfEdgeLeft(scrollDistanceX, scrollX - 0) || !CanOutOfEdgeBottom(scrollDistanceY, scrollY - scrollHeight))
874                         {
875                                 return false;
876                         }
877                 }
878                 else if  ((__edgeType & WEB_EDGE_RIGHT) && (__edgeType & WEB_EDGE_TOP))
879                 {
880                         if (!CanOutOfEdgeRight(scrollDistanceX, scrollX - scrollWidth) || !CanOutOfEdgeTop(scrollDistanceY, scrollY - 0))
881                         {
882                                 return false;
883                         }
884                 }
885                 else if  ((__edgeType & WEB_EDGE_RIGHT) && (__edgeType & WEB_EDGE_BOTTOM))
886                 {
887                         if (!CanOutOfEdgeRight(scrollDistanceX, scrollX - scrollWidth) || !CanOutOfEdgeBottom(scrollDistanceY, scrollY - scrollHeight))
888                         {
889                                 return false;
890                         }
891                 }
892         }
893
894         return true;
895 }
896
897
898 bool
899 _Web::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
900 {
901         if (__pEflWebkit.get())
902         {
903                 SendTouchEventForJavaScript(touchInfo);
904
905                 float scrollDistanceX = __previousTouchedPosition.x - touchInfo.GetCurrentPosition().x;
906                 float scrollDistanceY = __previousTouchedPosition.y - touchInfo.GetCurrentPosition().y;
907                 __previousTouchedPosition = touchInfo.GetCurrentPosition();
908
909                 if (CanConsumeTouchMoved(scrollDistanceX, scrollDistanceY))
910                 {
911                         return __pGestureHandler->OnTouchMoved(source, touchInfo);
912                 }
913         }
914
915         return false;
916 }
917
918
919 bool
920 _Web::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
921 {
922         SetFocused();
923
924         if (__pEflWebkit.get())
925         {
926                 SendTouchEventForJavaScript(touchInfo);
927
928                 return __pGestureHandler->OnTouchReleased(source, touchInfo);
929         }
930
931         return false;
932 }
933
934
935 bool
936 _Web::OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
937 {
938         if (__pEflWebkit.get())
939         {
940                 SendTouchEventForJavaScript(touchInfo);
941
942                 return __pGestureHandler->OnTouchCanceled(source, touchInfo);
943         }
944
945         return false;
946 }
947
948
949 bool
950 _Web::OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture)
951 {
952         if (__pEflWebkit.get() && __gestureType == WEB_GESTURE_TYPE_TAP)
953         {
954                 return __pTapGestureHandler->OnLongPressGestureDetected(gesture);
955         }
956
957         return false;
958 }
959
960
961 bool
962 _Web::OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture)
963 {
964         return false;
965 }
966
967
968 bool
969 _Web::OnTapGestureDetected(_TouchTapGestureDetector& gesture)
970 {
971         if (__pEflWebkit.get())
972         {
973                 return __pTapGestureHandler->OnTapGestureDetected(gesture);
974         }
975
976         return false;
977 }
978
979
980 bool
981 _Web::OnTapGestureCanceled(_TouchTapGestureDetector& gesture)
982 {
983         return false;
984 }
985
986
987 bool
988 _Web::OnFlickGestureDetected(_TouchFlickGestureDetector& gesture)
989 {
990         if (__pEflWebkit.get())
991         {
992                 return __pFlickGestureHandler->OnFlickGestureDetected(gesture);
993         }
994
995         return false;
996 }
997
998
999 bool
1000 _Web::OnFlickGestureCanceled(_TouchFlickGestureDetector& gesture)
1001 {
1002         return false;
1003 }
1004
1005
1006 bool
1007 _Web::OnPinchGestureStarted(Tizen::Ui::_TouchPinchGestureDetector& gesture)
1008 {
1009         if (__pEflWebkit.get())
1010         {
1011                 return __pPinchGestureHandler->OnPinchGestureStarted(gesture);
1012         }
1013
1014         return false;
1015 }
1016
1017
1018 bool
1019 _Web::OnPinchGestureChanged(Tizen::Ui::_TouchPinchGestureDetector& gesture)
1020 {
1021         if (__pEflWebkit.get() && __gestureType == WEB_GESTURE_TYPE_PINCH)
1022         {
1023                 return __pPinchGestureHandler->OnPinchGestureChanged(gesture);
1024         }
1025
1026         return false;
1027 }
1028
1029
1030 bool
1031 _Web::OnPinchGestureFinished(Tizen::Ui::_TouchPinchGestureDetector& gesture)
1032 {
1033         if (__pEflWebkit.get() && __gestureType == WEB_GESTURE_TYPE_PINCH)
1034         {
1035                 return __pPinchGestureHandler->OnPinchGestureFinished(gesture);
1036         }
1037
1038         return false;
1039 }
1040
1041
1042 bool
1043 _Web::OnPinchGestureCanceled(Tizen::Ui::_TouchPinchGestureDetector& gesture)
1044 {
1045         return false;
1046 }
1047
1048
1049 Canvas*
1050 _Web::OnCanvasRequestedN(const FloatRectangle& bounds)
1051 {
1052         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);
1053         if (bounds.width == 0.0f || bounds.height == 0.0f)
1054         {
1055                 FloatDimension size(GetSizeF());
1056                 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.");
1057         }
1058
1059         result r = E_SUCCESS;
1060
1061         Rectangle absBounds(_CoordinateSystemUtils::ConvertToInteger(_CoordinateSystemUtils::Transform(bounds)));
1062
1063         Eina_Rectangle rect;
1064         EINA_RECTANGLE_SET(&rect, absBounds.x, absBounds.y, absBounds.width, absBounds.height);
1065
1066         Evas_Object* pWebFrame = GetWebNativeNode();
1067         Evas_Object* pScreenShot = ewk_view_screenshot_contents_get(pWebFrame, rect, 1.0f, evas_object_evas_get(pWebFrame));
1068
1069         std::unique_ptr<Canvas> pCanvas(new (std::nothrow) Canvas());
1070         SysTryReturn(NID_WEB_CTRL, pCanvas.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1071
1072         if (pScreenShot)
1073         {
1074                 BufferInfo bufferInfo;
1075
1076                 r = _Utility::GetPixelBufferFromEvasObject(pScreenShot, bufferInfo);
1077                 evas_object_del(pScreenShot);
1078                 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
1079
1080                 r = pCanvas->Construct(bufferInfo);
1081                 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
1082         }
1083         else
1084         {
1085                 r = pCanvas->Construct(bounds);
1086                 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
1087         }
1088
1089         return pCanvas.release();
1090 }
1091
1092
1093 Bitmap*
1094 _Web::OnCapturedBitmapRequestedN(void)
1095 {
1096         result r = E_SUCCESS;
1097
1098         BufferInfo bufferInfo;
1099         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));
1100
1101         ByteBuffer buffer;
1102         int bufferSize = bufferInfo.bitsPerPixel * bufferInfo.width * bufferInfo.height;
1103
1104         r = buffer.Construct(reinterpret_cast < byte* >(bufferInfo.pPixels), 0, bufferSize, bufferSize);
1105         SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
1106
1107         std::unique_ptr<Bitmap> pBitmap(new (std::nothrow) Bitmap());
1108         SysTryReturn(NID_WEB_CTRL, pBitmap.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1109
1110         r = pBitmap->Construct(buffer, Dimension(bufferInfo.width, bufferInfo.height), BITMAP_PIXEL_FORMAT_ARGB8888);
1111         SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
1112
1113         return pBitmap.release();
1114 }
1115
1116
1117 bool
1118 _Web::OnCaptureAcquire(BufferInfo& output)
1119 {
1120         result r = E_SUCCESS;
1121
1122         FloatPoint position(GetPositionF());
1123         FloatDimension size(GetSizeF());
1124
1125         Dimension absSize(_CoordinateSystemUtils::ConvertToInteger(_CoordinateSystemUtils::Transform(size)));
1126
1127         Eina_Rectangle rect;
1128         EINA_RECTANGLE_SET(&rect, 0, 0, absSize.width, absSize.height);
1129
1130         Evas_Object* pWebFrame = GetWebNativeNode();
1131         Evas_Object* pScreenShot = ewk_view_screenshot_contents_get(pWebFrame, rect, 1.0f, evas_object_evas_get(pWebFrame));
1132         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));
1133
1134         r = _Utility::GetPixelBufferFromEvasObject(pScreenShot, output);
1135         evas_object_del(pScreenShot);
1136         SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] propagating", GetErrorMessage(r));
1137
1138         return true;
1139 }
1140
1141
1142 void
1143 _Web::SendTouchEventForJavaScript(const _TouchInfo& touchInfo)
1144 {
1145         result r = E_SUCCESS;
1146
1147         _TouchManager* pTouchManager = _TouchManager::GetInstance();
1148         SysAssertf(pTouchManager, "Failed to get touch manager.");
1149
1150         std::unique_ptr<IListT<_FingerInfo*> > pTouchList(pTouchManager->GetMultiFingerInfoListN());
1151         SysTryReturnVoidResult(NID_WEB_CTRL, pTouchList.get(), GetLastResult(), "[%s] Failed to get touch list.", GetErrorMessage(GetLastResult()));
1152
1153         std::unique_ptr<IBidirectionalEnumeratorT<_FingerInfo*> > pTouchListEnum(pTouchList->GetBidirectionalEnumeratorN());
1154         SysAssertf(pTouchListEnum.get() != null, "Failed to get enumerator of touch list.");
1155
1156         Eina_List* pPointList = null;
1157         _FingerInfo* pFingerInfo = null;
1158         while(pTouchListEnum->MoveNext() == E_SUCCESS)
1159         {
1160                 r = pTouchListEnum->GetCurrent(pFingerInfo);
1161                 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1162
1163                 _TouchStatus state = pFingerInfo->GetStatus();
1164                 if(state == _TOUCH_PRESSED || state == _TOUCH_MOVED || state == _TOUCH_RELEASED || state == _TOUCH_CANCELED)
1165                 {
1166                         Point integerPoint(_CoordinateSystemUtils::ConvertToInteger(GetAbsoluteCoordinate(pFingerInfo->GetPoint())));
1167
1168                         Ewk_Touch_Point* pPoint = static_cast<Ewk_Touch_Point*>(calloc(1, sizeof(Ewk_Touch_Point)));
1169                         pPoint->id = pFingerInfo->GetPointId();
1170                         pPoint->x = integerPoint.x;
1171                         pPoint->y = integerPoint.y;
1172                         pPoint->state = GetEvasTouchState((TouchStatus)pFingerInfo->GetStatus());
1173                         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);
1174
1175                         pPointList = eina_list_append(pPointList, pPoint);
1176                 }
1177         }
1178
1179         ewk_view_feed_touch_event(__pEflWebkit->GetWebEvasObject(), GetEwkTouchEvent(touchInfo.GetTouchStatus()), pPointList, null);
1180
1181         void* pData = null;
1182         EINA_LIST_FREE(pPointList, pData)
1183         free(pData);
1184 }
1185
1186
1187 Ewk_Touch_Event_Type
1188 _Web::GetEwkTouchEvent(_TouchStatus touchStatus)
1189 {
1190         Ewk_Touch_Event_Type ewkTouchEvent = EWK_TOUCH_CANCEL;
1191
1192         switch (touchStatus)
1193         {
1194         case _TOUCH_PRESSED :
1195                 ewkTouchEvent = EWK_TOUCH_START;
1196                 break;
1197         case _TOUCH_MOVED :
1198                 ewkTouchEvent = EWK_TOUCH_MOVE;
1199                 break;
1200         case _TOUCH_RELEASED :
1201                 ewkTouchEvent = EWK_TOUCH_END;
1202                 break;
1203         case _TOUCH_CANCELED :
1204                 //fall through
1205         default :
1206                 ewkTouchEvent = EWK_TOUCH_CANCEL;
1207                 break;
1208         }
1209
1210         return ewkTouchEvent;
1211 }
1212
1213
1214 Evas_Touch_Point_State
1215 _Web::GetEvasTouchState(TouchStatus touchStatus)
1216 {
1217         Evas_Touch_Point_State evasTouchState = EVAS_TOUCH_POINT_CANCEL;
1218
1219         switch (touchStatus)
1220         {
1221         case TOUCH_PRESSED :
1222                 evasTouchState = EVAS_TOUCH_POINT_DOWN;
1223                 break;
1224         case TOUCH_MOVED :
1225                 evasTouchState = EVAS_TOUCH_POINT_MOVE;
1226                 break;
1227         case TOUCH_RELEASED :
1228                 evasTouchState = EVAS_TOUCH_POINT_UP;
1229                 break;
1230         case TOUCH_CANCELED :
1231                 //fall through
1232         default :
1233                 evasTouchState = EVAS_TOUCH_POINT_CANCEL;
1234                 //todo : mapping    EVAS_TOUCH_POINT_STILL, /**< Touch point is not moved af
1235                 break;
1236         }
1237
1238         return evasTouchState;
1239 }
1240
1241
1242 void
1243 _Web::SetFullScreenEntered(bool isFullScreenEntered)
1244 {
1245         __isFullScreenEntered = isFullScreenEntered;
1246 }
1247
1248
1249 void
1250 _Web::SetFocusEnd(bool focus)
1251 {
1252         __focus = focus;
1253 }
1254
1255
1256 bool
1257 _Web::IsFocusEnd(void)
1258 {
1259         return __focus;
1260 }
1261
1262
1263 bool
1264 _Web::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
1265 {
1266         Ecore_X_Window rootWindow = ecore_x_window_root_first_get();
1267         Ecore_X_Atom keyboardExist = ecore_x_atom_get("X External Keyboard Exist");
1268         unsigned int keyboardNumber = 0;
1269         int ret = ecore_x_window_prop_card32_get(rootWindow, keyboardExist, &keyboardNumber, 1);
1270         if (keyboardNumber == 0)
1271         {
1272                 return false;
1273         }
1274
1275         _KeyCode keyCode = keyInfo.GetKeyCode();
1276
1277         if (IsFocusEnd() == true)
1278         {
1279                 SetFocusEnd(false);
1280                 evas_object_focus_set(GetWebNativeNode(), EINA_FALSE);
1281                 return false;
1282         }
1283
1284         switch(keyCode)
1285         {
1286         case _KEY_UP:
1287         case _KEY_DOWN:
1288                 evas_object_focus_set(GetWebNativeNode(), EINA_FALSE);
1289                 return false;
1290                 break;
1291         default:
1292                 break;
1293         }
1294
1295         evas_object_focus_set(GetWebNativeNode(), EINA_TRUE);
1296
1297         return true;
1298 }
1299
1300
1301 bool
1302 _Web::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
1303 {
1304         if (__isFullScreenEntered)
1305         {
1306                 if (keyInfo.GetKeyCode() == _KEY_ESC || keyInfo.GetKeyCode() == _KEY_BACK)
1307                 {
1308                         __isFullScreenEntered = false;
1309
1310                         ewk_view_fullscreen_exit(GetWebNativeNode());
1311
1312                         return true;
1313                 }
1314         }
1315
1316         return false;
1317 }
1318
1319
1320 void
1321 _Web::OnDrawFocus(void)
1322 {
1323 }
1324
1325
1326 }}} // Tizen::Web::Controls