2 Copyright (C) 2011 Samsung Electronics
3 Copyright (C) 2012 Intel Corporation. All rights reserved.
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
24 #include "EwkViewImpl.h"
25 #include "FindClientEfl.h"
26 #include "FormClientEfl.h"
27 #include "LayerTreeCoordinatorProxy.h"
28 #include "InputMethodContextEfl.h"
29 #include "NativeWebKeyboardEvent.h"
30 #include "NativeWebMouseEvent.h"
31 #include "NativeWebWheelEvent.h"
32 #include "PageClientImpl.h"
33 #include "PageLoadClientEfl.h"
34 #include "PagePolicyClientEfl.h"
35 #include "PageUIClientEfl.h"
36 #include "ResourceLoadClientEfl.h"
37 #include "WKAPICast.h"
38 #include "WKEinaSharedString.h"
39 #include "WKFindOptions.h"
40 #include "WKRetainPtr.h"
42 #include "WebContext.h"
44 #include "WebPageGroup.h"
45 #include "WebPopupItem.h"
46 #include "WebPopupMenuProxyEfl.h"
47 #include "WebPreferences.h"
48 #include "ewk_back_forward_list_private.h"
49 #include "ewk_context.h"
50 #include "ewk_context_private.h"
51 #include "ewk_favicon_database_private.h"
52 #include "ewk_intent_private.h"
53 #include "ewk_popup_menu_item_private.h"
54 #include "ewk_private.h"
55 #include "ewk_settings_private.h"
56 #include "ewk_view_private.h"
57 #include <Ecore_Evas.h>
59 #include <WebKit2/WKPageGroup.h>
60 #include <wtf/text/CString.h>
62 #if ENABLE(FULLSCREEN_API)
63 #include "WebFullScreenManagerProxy.h"
66 #if ENABLE(TIZEN_WEBKIT2_DDK_CHECK)
73 #include "DrawingAreaProxyImpl.h"
76 #include "WKDownload.h"
78 #include "WKGeolocationPermissionRequest.h"
79 #include "WKImageCairo.h"
80 #include "WKOpenPanelParameters.h"
81 #include "WKOpenPanelResultListener.h"
83 #include "WKPageGroup.h"
85 #include "WKPageTizen.h"
86 #include "WKPreferences.h"
87 #include "WKSerializedScriptValue.h"
89 #include "WKURLRequest.h"
90 #include "ewk_context_menu_private.h"
91 #include "ewk_error.h"
92 #include "ewk_error_private.h"
93 #include "ewk_history_private.h"
94 #include "ewk_popup_menu_item.h"
95 #include "ewk_popup_menu_item_private.h"
96 #include "ewk_view_context_menu_client.h"
97 #include "ewk_view_icondatabase_client.h"
98 #include "ewk_view_tizen_client.h"
100 #include <Elementary.h>
101 #include <WebCore/EflScreenUtilities.h>
102 #include <WebCore/NotImplemented.h>
105 #if ENABLE(TIZEN_ICON_DATABASE)
106 #include "WKContextPrivate.h"
109 #if ENABLE(TIZEN_GEOLOCATION)
110 #include "ewk_geolocation_private.h"
111 #include "ewk_security_origin.h"
112 #include "ewk_view_geolocation_provider.h"
115 #if ENABLE(TOUCH_EVENTS)
116 #include "NativeWebTouchEvent.h"
117 #include "WebEvent.h"
120 #if ENABLE(TIZEN_ISF_PORT)
121 #include <Ecore_IMF.h>
124 #if ENABLE(TIZEN_NOTIFICATIONS)
126 #include "WKNotificationManager.h"
127 #include "WKNumber.h"
128 #include "ewk_notification_private.h"
129 #include "ewk_view_notification_provider.h"
132 #if ENABLE(TIZEN_MEDIA_STREAM)
133 #include "WKUserMediaPermissionRequest.h"
134 #include "ewk_user_media_private.h"
137 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
138 #include "WebPageGroup.h"
139 #include "WebPreferences.h"
142 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
143 #include "ewk_hit_test_private.h"
146 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
147 #include "ewk_text_style.h"
150 #if ENABLE(TIZEN_SCREEN_READER)
151 #include "ScreenReaderProxy.h"
154 #if ENABLE(TIZEN_CSP)
155 #include <WebCore/ContentSecurityPolicy.h>
158 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
159 #include "WKDictionary.h"
160 #include "ewk_web_application_icon_data_private.h"
162 #endif // #if OS(TIZEN)
164 using namespace WebKit;
165 using namespace WebCore;
167 static const char EWK_VIEW_TYPE_STR[] = "EWK2_View";
169 #define EWK_VIEW_TYPE_CHECK(ewkView, result) \
170 bool result = true; \
173 EINA_LOG_CRIT("null is not a ewk_view"); \
177 const char* _tmp_otype = evas_object_type_get(ewkView); \
178 const Evas_Smart* _tmp_s = evas_object_smart_smart_get(ewkView); \
179 if (EINA_UNLIKELY(!_tmp_s)) { \
181 ("%p (%s) is not a smart object!", \
182 ewkView, _tmp_otype ? _tmp_otype : "(null)"); \
186 const Evas_Smart_Class* _tmp_sc = evas_smart_class_get(_tmp_s); \
187 if (EINA_UNLIKELY(!_tmp_sc)) { \
189 ("%p (%s) is not a smart object!", \
190 ewkView, _tmp_otype ? _tmp_otype : "(null)"); \
194 else if (EINA_UNLIKELY(_tmp_sc->data != EWK_VIEW_TYPE_STR)) { \
196 ("%p (%s) is not of an ewk_view (need %p, got %p)!", \
197 ewkView, _tmp_otype ? _tmp_otype : "(null)", \
198 EWK_VIEW_TYPE_STR, _tmp_sc->data); \
203 #define EWK_VIEW_SD_GET(ewkView, smartData) \
204 EWK_VIEW_TYPE_CHECK(ewkView, _tmp_result); \
205 Ewk_View_Smart_Data* smartData = 0; \
207 smartData = (Ewk_View_Smart_Data*)evas_object_smart_data_get(ewkView)
209 #define EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, ...) \
210 EWK_VIEW_SD_GET(ewkView, smartData); \
213 EINA_LOG_CRIT("no smart data for object %p (%s)", \
214 ewkView, evas_object_type_get(ewkView)); \
215 return __VA_ARGS__; \
220 static Eina_Bool _ewk_view_default_javascript_alert(Evas_Object*, const char* alertText, void* userData);
221 static Eina_Bool _ewk_view_default_javascript_confirm(Evas_Object*, const char* message, void* userData);
222 static Eina_Bool _ewk_view_default_javascript_prompt(Evas_Object*, const char* message, const char* defaultValue, void* userData);
223 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
224 static Eina_Bool _ewk_view_default_before_unload_confirm_panel(Evas_Object*, const char* message, void* userData);
226 static Eina_Bool _ewk_view_default_open_panel(Evas_Object*, Eina_Bool allow_multiple_files, Eina_List *accepted_mime_types, const char* capture, void* userData);
228 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
229 Eina_Bool _ewk_view_popup_menu_show(Ewk_View_Smart_Data*, Eina_Rectangle, Ewk_Text_Direction, double page_scale_factor, Eina_List* items, int selectedIndex);
230 #if ENABLE(TIZEN_MULTIPLE_SELECT)
231 Eina_Bool _ewk_view_multiple_popup_menu_show(Ewk_View_Smart_Data*, Eina_Rectangle, Ewk_Text_Direction, double page_scale_factor, Eina_List* items);
233 Eina_Bool _ewk_view_popup_menu_hide(Ewk_View_Smart_Data*);
234 Eina_Bool _ewk_view_popup_menu_update(Ewk_View_Smart_Data*, Eina_Rectangle, Ewk_Text_Direction, Eina_List*, int);
236 #if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL)
237 Eina_Bool _ewk_orientation_lock(Ewk_View_Smart_Data *sd, int orientations);
238 void _ewk_orientation_unlock(Ewk_View_Smart_Data *sd);
241 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
242 static Eina_Bool _ewk_view_input_picker_show(Ewk_View_Smart_Data*, Ewk_Input_Type, const char* inputValue);
245 #if ENABLE(TIZEN_DATALIST_ELEMENT)
246 static Eina_Bool _ewk_view_data_list_show(Ewk_View_Smart_Data*, Ewk_Input_Type, Eina_List*);
247 static Eina_Bool _ewk_view_data_list_hide(Ewk_View_Smart_Data*, Ewk_Input_Type);
250 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
251 static Eina_Bool _ewk_input_picker_color_request(Ewk_View_Smart_Data*, int, int, int, int);
252 static Eina_Bool _ewk_input_picker_color_dismiss(Ewk_View_Smart_Data*);
254 #endif // #if OS(TIZEN)
256 static void _ewk_view_smart_changed(Ewk_View_Smart_Data* smartData)
258 if (smartData->changed.any)
260 smartData->changed.any = true;
261 evas_object_smart_changed(smartData->self);
264 static void _ewk_view_on_favicon_changed(const char* pageURL, void* eventInfo)
266 Evas_Object* ewkView = static_cast<Evas_Object*>(eventInfo);
267 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
268 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
270 const char* viewURL = ewk_view_url_get(ewkView);
271 if (!viewURL || strcasecmp(viewURL, pageURL))
274 impl->informIconChange();
277 // Default Event Handling.
278 static Eina_Bool _ewk_view_smart_focus_in(Ewk_View_Smart_Data* smartData)
280 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
284 impl->pageClient->setViewFocused(true);
285 #endif // #if OS(TIZEN)
286 impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive);
287 #if ENABLE(TIZEN_ISF_PORT)
288 if (impl->inputMethodContext())
289 impl->inputMethodContext()->onFocusIn();
294 static Eina_Bool _ewk_view_smart_focus_out(Ewk_View_Smart_Data* smartData)
296 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
300 #if ENABLE(TIZEN_ISF_PORT)
301 // Keypad should be hidden rapidly when moving focus on elementary
302 // because Ecore-ime doesn't support it.
303 if (impl->inputMethodContext())
304 impl->inputMethodContext()->onFocusOut();
307 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
308 if (impl->pageClient->isTextSelectionMode())
309 impl->pageClient->setIsTextSelectionMode(false);
312 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
313 if (impl->pageClient->isContextMenuVisible())
314 impl->pageProxy->hideContextMenu();
317 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
318 impl->pageClient->clearClipboardSelectionHandler();
321 #if ENABLE(TIZEN_DRAG_SUPPORT)
322 if (impl->pageClient->isDragMode())
323 impl->pageClient->setDragMode(false);
326 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
327 if (smartData->api->formdata_candidate_is_showing(smartData))
328 smartData->api->formdata_candidate_hide(smartData);
331 impl->pageClient->setViewFocused(false);
332 #endif // #if OS(TIZEN)
333 impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive);
337 static Eina_Bool _ewk_view_smart_mouse_wheel(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Wheel* wheelEvent)
339 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
341 impl->page()->handleWheelEvent(NativeWebWheelEvent(wheelEvent, impl->transformFromScene(), impl->transformToScreen()));
345 static Eina_Bool _ewk_view_smart_mouse_down(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Down* downEvent)
347 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
349 impl->page()->handleMouseEvent(NativeWebMouseEvent(downEvent, impl->transformFromScene(), impl->transformToScreen()));
353 static Eina_Bool _ewk_view_smart_mouse_up(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Up* upEvent)
355 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
357 impl->page()->handleMouseEvent(NativeWebMouseEvent(upEvent, impl->transformFromScene(), impl->transformToScreen()));
359 InputMethodContextEfl* inputMethodContext = impl->inputMethodContext();
360 if (inputMethodContext)
361 inputMethodContext->handleMouseUpEvent(upEvent);
366 static Eina_Bool _ewk_view_smart_mouse_move(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Move* moveEvent)
368 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
370 // FIXME: impl->page() is used in the webkit opensource, but tizen webkit does not use it yet.
371 impl->page()->handleMouseEvent(NativeWebMouseEvent(moveEvent, impl->transformFromScene(), impl->transformToScreen()));
375 static Eina_Bool _ewk_view_smart_key_down(Ewk_View_Smart_Data* smartData, const Evas_Event_Key_Down* downEvent)
377 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
379 bool isFiltered = false;
380 InputMethodContextEfl* inputMethodContext = impl->inputMethodContext();
381 if (inputMethodContext)
382 inputMethodContext->handleKeyDownEvent(downEvent, &isFiltered);
384 impl->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(downEvent, isFiltered));
388 static Eina_Bool _ewk_view_smart_key_up(Ewk_View_Smart_Data* smartData, const Evas_Event_Key_Up* upEvent)
390 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
392 impl->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(upEvent));
397 static Eina_Bool _ewk_view_smart_gesture_start(Ewk_View_Smart_Data* smartData, const Ewk_Event_Gesture* event)
399 #if ENABLE(TIZEN_GESTURE)
400 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
402 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
403 if (impl->pageClient->isTextSelectionMode() && impl->pageClient->isTextSelectionHandleDowned())
407 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
408 if (impl->focusRing) {
409 if (event->type == EWK_GESTURE_TAP && event->count == 1) {
410 impl->focusRing->requestToShow(IntPoint(event->position.x, event->position.y));
411 } else if (event->type == EWK_GESTURE_PAN) {
412 if (impl->exceedTouchMoveThreshold)
413 impl->focusRing->hide();
415 if (event->type != EWK_GESTURE_LONG_PRESS) {
416 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
417 if (!impl->pageClient->isContextMenuVisible())
419 impl->focusRing->hide();
425 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
426 if (smartData->api->formdata_candidate_is_showing(smartData))
427 smartData->api->formdata_candidate_hide(smartData);
430 switch (event->type) {
431 case EWK_GESTURE_TAP:
432 impl->gestureClient->startTap(IntPoint(event->position.x, event->position.y));
434 case EWK_GESTURE_LONG_PRESS: {
435 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
436 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
437 if (ewk_settings_text_selection_enabled_get(impl->settings()))
438 impl->pageClient->setIsTextSelectionMode(false);
440 IntPoint scenePoint(event->position.x, event->position.y);
441 IntPoint contentsPoint = impl->transformFromScene().mapPoint(scenePoint);
442 WebHitTestResult::Data hitTestResultData = impl->pageProxy->hitTestResultAtPoint(contentsPoint);
443 #if ENABLE(TIZEN_DRAG_SUPPORT)
444 // 1. Check to start dragging.
445 if (hitTestResultData.isDragSupport) {
446 impl->pageClient->setDragPoint(scenePoint);
447 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
449 impl->focusRing->show(IntRect(), true);
451 impl->gestureClient->showContextMenu(scenePoint);
455 // 2. Check to show context menu.
456 if (!hitTestResultData.absoluteImageURL.isEmpty()
457 || !hitTestResultData.absoluteLinkURL.isEmpty()
458 || !hitTestResultData.absoluteMediaURL.isEmpty()) {
459 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
461 impl->focusRing->show(IntRect(), true);
463 impl->gestureClient->showContextMenu(scenePoint);
466 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
467 // 3. Check for text selection.
468 if (ewk_settings_text_selection_enabled_get(impl->settings())) {
469 // Process gesture_end(EWK_GESTURE_TAP) to activate the editing if node under point is editable.
470 if (hitTestResultData.context & WebHitTestResult::HitTestResultContextEditable) {
471 if (smartData->api && smartData->api->gesture_end) {
472 Ewk_Event_Gesture tapEvent = {EWK_GESTURE_TAP, event->position, {0, 0}, 0, 1, ecore_time_get() * 1000};
473 smartData->api->gesture_end(smartData, &tapEvent);
477 if (impl->pageClient->textSelectionDown(scenePoint)) {
478 impl->gestureClient->setGestureEnabled(false);
479 impl->feedTouchEventsByType(EWK_TOUCH_CANCEL);
484 #endif // #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
486 case EWK_GESTURE_PAN:
487 impl->gestureClient->startPan(IntPoint(event->position.x, event->position.y));
489 case EWK_GESTURE_FLICK:
490 impl->gestureClient->startFlick(IntPoint(event->position.x, event->position.y), IntPoint(event->velocity.x, event->velocity.y));
492 case EWK_GESTURE_PINCH:
493 if (impl->pageClient->viewportConstraints().userScalable)
494 impl->gestureClient->startPinch(IntPoint(event->position.x, event->position.y), event->scale);
497 ASSERT_NOT_REACHED();
504 #endif // #if ENABLE(TIZEN_GESTURE)
507 static Eina_Bool _ewk_view_smart_gesture_end(Ewk_View_Smart_Data* smartData, const Ewk_Event_Gesture* event)
509 #if ENABLE(TIZEN_GESTURE)
510 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
512 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
513 if (impl->pageClient->isTextSelectionMode() && impl->pageClient->isTextSelectionHandleDowned())
517 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
518 if (impl->focusRing) {
519 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
520 if (!impl->pageClient->isContextMenuVisible())
522 impl->focusRing->hide();
526 switch (event->type) {
527 case EWK_GESTURE_TAP:
528 if (event->count == 1) {
529 #if ENABLE(TIZEN_DRAG_SUPPORT)
530 if (impl->pageClient->isDragMode())
531 impl->pageClient->setDragMode(false);
533 impl->gestureClient->endTap(IntPoint(event->position.x, event->position.y));
534 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
535 if (impl->pageClient->isTextSelectionMode())
536 impl->pageClient->setIsTextSelectionMode(false);
538 #if ENABLE(TIZEN_ISF_PORT)
539 evas_object_focus_set(smartData->self, true);
541 } else if (event->count == 2)
542 impl->gestureClient->endDoubleTap(IntPoint(event->position.x, event->position.y));
544 case EWK_GESTURE_LONG_PRESS:
545 #if ENABLE(TIZEN_DRAG_SUPPORT)
546 if (impl->pageClient->isDragMode())
547 impl->pageClient->setDragMode(false);
549 // Prcess endTap for LONG_PRESS gesture if text-selection and context menu did not work
550 impl->gestureClient->endTap(IntPoint(event->position.x, event->position.y));
552 case EWK_GESTURE_PAN:
553 impl->gestureClient->endPan(IntPoint(event->position.x, event->position.y));
555 case EWK_GESTURE_FLICK:
556 impl->gestureClient->endFlick(IntPoint(event->position.x, event->position.y), IntPoint(event->velocity.x, event->velocity.y));
558 case EWK_GESTURE_PINCH:
559 impl->gestureClient->endPinch(IntPoint(event->position.x, event->position.y), event->scale);
562 ASSERT_NOT_REACHED();
569 #endif // #if ENABLE(TIZEN_GESTURE)
572 static Eina_Bool _ewk_view_smart_gesture_move(Ewk_View_Smart_Data* smartData, const Ewk_Event_Gesture* event)
574 #if ENABLE(TIZEN_GESTURE)
575 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
577 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
578 if (impl->pageClient->isTextSelectionMode() && impl->pageClient->isTextSelectionHandleDowned())
582 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
583 if (impl->focusRing && !(event->type == EWK_GESTURE_PAN && !impl->exceedTouchMoveThreshold))
584 impl->focusRing->hide();
587 switch (event->type) {
588 case EWK_GESTURE_PAN:
589 impl->gestureClient->movePan(IntPoint(event->position.x, event->position.y));
591 case EWK_GESTURE_TAP:
592 case EWK_GESTURE_LONG_PRESS:
593 case EWK_GESTURE_FLICK:
595 case EWK_GESTURE_PINCH:
596 if (impl->pageClient->viewportConstraints().userScalable)
597 impl->gestureClient->movePinch(IntPoint(event->position.x, event->position.y), event->scale);
600 ASSERT_NOT_REACHED();
607 #endif // #if ENABLE(TIZEN_GESTURE)
609 #endif //#if OS(TIZEN)
612 static void _ewk_view_on_focus_in(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo)
614 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
615 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
616 EINA_SAFETY_ON_NULL_RETURN(smartData->api->focus_in);
617 smartData->api->focus_in(smartData);
620 static void _ewk_view_on_focus_out(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo)
622 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
623 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
624 EINA_SAFETY_ON_NULL_RETURN(smartData->api->focus_out);
625 smartData->api->focus_out(smartData);
628 static void _ewk_view_on_mouse_wheel(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo)
630 Evas_Event_Mouse_Wheel* wheelEvent = static_cast<Evas_Event_Mouse_Wheel*>(eventInfo);
631 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
632 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
633 EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_wheel);
634 smartData->api->mouse_wheel(smartData, wheelEvent);
637 static void _ewk_view_on_key_down(void* data, Evas*, Evas_Object*, void* eventInfo)
639 Evas_Event_Key_Down* downEvent = static_cast<Evas_Event_Key_Down*>(eventInfo);
640 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
641 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
642 EINA_SAFETY_ON_NULL_RETURN(smartData->api->key_down);
643 smartData->api->key_down(smartData, downEvent);
646 static void _ewk_view_on_key_up(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo)
648 Evas_Event_Key_Up* upEvent = static_cast<Evas_Event_Key_Up*>(eventInfo);
649 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
650 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
651 EINA_SAFETY_ON_NULL_RETURN(smartData->api->key_up);
652 smartData->api->key_up(smartData, upEvent);
655 static void _ewk_view_on_show(void* data, Evas*, Evas_Object*, void* /*eventInfo*/)
657 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
658 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
659 impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible);
662 static void _ewk_view_on_hide(void* data, Evas*, Evas_Object*, void* /*eventInfo*/)
664 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
665 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
667 // This call may look wrong, but we really need to pass ViewIsVisible here.
668 // viewStateDidChange() itself is responsible for actually setting the visibility to Visible or Hidden
669 // depending on what WebPageProxy::isViewVisible() returns, this simply triggers the process.
670 impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible);
674 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
675 Eina_Bool _ewk_view_text_selection_down(Ewk_View_Smart_Data* smartData, int x, int y)
677 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
679 return impl->pageClient->textSelectionDown(IntPoint(x, y), true);
682 Eina_Bool _ewk_view_text_selection_move(Ewk_View_Smart_Data* smartData, int x, int y)
684 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
686 IntPoint point(x, y);
687 impl->pageClient->textSelectionMove(point, true);
692 Eina_Bool _ewk_view_text_selection_up(Ewk_View_Smart_Data* smartData, int x, int y)
694 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
696 IntPoint point(x, y);
697 impl->pageClient->textSelectionUp(point, true);
703 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
704 Eina_Bool _ewk_view_smart_formdata_candidate_show(Ewk_View_Smart_Data* smartData, int x, int y, int w, int h)
706 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
708 impl->pageClient->showFormDataCandidate(IntRect(x, y, w, h));
713 Eina_Bool _ewk_view_smart_formdata_candidate_hide(Ewk_View_Smart_Data* smartData)
715 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
717 impl->pageClient->hideFormDataCandidate();
722 Eina_Bool _ewk_view_smart_formdata_candidate_update_data(Ewk_View_Smart_Data* smartData, Eina_List* dataList)
724 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
726 Vector<String> formData;
729 EINA_LIST_FOREACH(dataList, list, data)
730 formData.append(String::fromUTF8(static_cast<char*>(data)));
732 impl->pageClient->updateFormDataCandidate(formData);
737 Eina_Bool _ewk_view_smart_formdata_candidate_is_showing(Ewk_View_Smart_Data* smartData)
739 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
741 return impl->pageClient->isShowingFormDataCandidate();
745 #if ENABLE(TIZEN_SCREEN_READER)
746 Eina_Bool _ewk_view_screen_reader_command_execute(Ewk_View_Smart_Data* smartData, unsigned int command, int data1, int data2)
748 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
750 return ScreenReaderProxy::screenReader().executeCommand(impl, command, data1, data2);
753 #endif // #if OS(TIZEN)
755 static Evas_Smart_Class g_parentSmartClass = EVAS_SMART_CLASS_INIT_NULL;
757 static void _ewk_view_impl_del(EwkViewImpl* impl)
759 /* Unregister icon change callback */
760 Ewk_Favicon_Database* iconDatabase = impl->context->faviconDatabase();
761 iconDatabase->unwatchChanges(_ewk_view_on_favicon_changed);
766 static void _ewk_view_smart_add(Evas_Object* ewkView)
768 const Evas_Smart* smart = evas_object_smart_smart_get(ewkView);
769 const Evas_Smart_Class* smartClass = evas_smart_class_get(smart);
770 const Ewk_View_Smart_Class* api = reinterpret_cast<const Ewk_View_Smart_Class*>(smartClass);
771 EWK_VIEW_SD_GET(ewkView, smartData);
774 smartData = static_cast<Ewk_View_Smart_Data*>(calloc(1, sizeof(Ewk_View_Smart_Data)));
776 EINA_LOG_CRIT("could not allocate Ewk_View_Smart_Data");
779 evas_object_smart_data_set(ewkView, smartData);
782 smartData->self = ewkView;
783 smartData->api = api;
785 g_parentSmartClass.add(ewkView);
787 smartData->priv = new EwkViewImpl(ewkView);
788 if (!smartData->priv) {
789 EINA_LOG_CRIT("could not allocate EwkViewImpl");
790 evas_object_smart_data_set(ewkView, 0);
795 // Create evas_object_image to draw web contents.
796 smartData->image = evas_object_image_add(smartData->base.evas);
797 evas_object_image_alpha_set(smartData->image, false);
798 evas_object_image_filled_set(smartData->image, true);
799 evas_object_smart_member_add(smartData->image, ewkView);
802 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
803 Ecore_Evas* ee = ecore_evas_ecore_evas_get(smartData->base.evas);
804 const char *engine = ecore_evas_engine_name_get(ee);
805 if (engine && !strcmp(engine, "opengl_x11"))
806 evas_object_image_content_hint_set(smartData->image, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
808 ewk_view_mouse_events_enabled_set(ewkView, false);
809 ewk_view_touch_events_enabled_set(ewkView, true);
811 // FIXME: This code should be removed if side effect occur.
812 // WebView does not have focus after url loading.
813 // If focus is set as true to webview,
814 // elementary steal webview's focus during mouse up event
815 // So, added code that events are not propagated to smart parent according to guide from EFL
816 evas_object_propagate_events_set(ewkView, false);
818 #if ENABLE(TIZEN_SCREEN_READER)
819 ScreenReaderProxy::screenReader().addView(smartData->priv);
821 #endif // #if OS(TIZEN)
823 #define CONNECT(s, c) evas_object_event_callback_add(ewkView, s, c, smartData)
824 CONNECT(EVAS_CALLBACK_FOCUS_IN, _ewk_view_on_focus_in);
825 CONNECT(EVAS_CALLBACK_FOCUS_OUT, _ewk_view_on_focus_out);
826 CONNECT(EVAS_CALLBACK_MOUSE_WHEEL, _ewk_view_on_mouse_wheel);
827 CONNECT(EVAS_CALLBACK_KEY_DOWN, _ewk_view_on_key_down);
828 CONNECT(EVAS_CALLBACK_KEY_UP, _ewk_view_on_key_up);
829 CONNECT(EVAS_CALLBACK_SHOW, _ewk_view_on_show);
830 CONNECT(EVAS_CALLBACK_HIDE, _ewk_view_on_hide);
834 static void _ewk_view_smart_del(Evas_Object* ewkView)
836 EwkViewImpl::removeFromPageViewMap(ewkView);
837 EWK_VIEW_SD_GET(ewkView, smartData);
838 #if ENABLE(TIZEN_SCREEN_READER)
839 ScreenReaderProxy::screenReader().removeView(smartData->priv);
841 if (smartData && smartData->priv)
842 _ewk_view_impl_del(smartData->priv);
844 g_parentSmartClass.del(ewkView);
847 static Eina_Bool _ewk_view_composite(void* data);
849 static void _ewk_view_smart_resize(Evas_Object* ewkView, Evas_Coord width, Evas_Coord height)
851 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
853 evas_object_resize(smartData->image, width, height);
854 evas_object_image_size_set(smartData->image, width, height);
855 evas_object_image_fill_set(smartData->image, 0, 0, width, height);
857 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
858 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
859 evas_object_image_native_surface_set(smartData->image, 0);
861 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
862 if (!ewk_view_is_opengl_backend(ewkView))
863 _ewk_view_composite(smartData);
864 else // OpenGL backend
866 impl->pageClient->displayViewport();
868 #endif // #if OS(TIZEN)
870 smartData->changed.size = true;
871 _ewk_view_smart_changed(smartData);
874 static void _ewk_view_smart_move(Evas_Object* ewkView, Evas_Coord x, Evas_Coord y)
876 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
878 smartData->changed.position = true;
879 _ewk_view_smart_changed(smartData);
882 static void _ewk_view_smart_calculate(Evas_Object* ewkView)
884 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
885 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
887 Evas_Coord x, y, width, height;
889 smartData->changed.any = false;
891 evas_object_geometry_get(ewkView, &x, &y, &width, &height);
893 if (smartData->changed.size) {
895 #if USE(COORDINATED_GRAPHICS)
896 impl->pageViewportControllerClient->updateViewportSize(IntSize(width, height));
898 #if USE(ACCELERATED_COMPOSITING)
899 needsNewSurface = impl->evasGlSurface;
902 if (impl->pageProxy->drawingArea())
903 impl->pageProxy->drawingArea()->setSize(IntSize(width, height), IntSize());
905 #if USE(ACCELERATED_COMPOSITING)
906 if (!impl->evasGlSurface)
908 evas_gl_surface_destroy(impl->evasGl, impl->evasGlSurface);
909 impl->evasGlSurface = 0;
910 ewk_view_create_gl_surface(ewkView, IntSize(width, height));
911 ewk_view_display(ewkView, IntRect(IntPoint(), IntSize(width, height)));
913 #endif // #if !OS(TIZEN)
915 smartData->view.w = width;
916 smartData->view.h = height;
917 smartData->changed.size = false;
920 if (impl->pageClient) {
921 if (DrawingAreaProxy* drawingArea = impl->pageProxy->drawingArea()) {
922 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
923 if (impl->pageProxy->isViewVisible())
924 drawingArea->setSize(IntSize(width, height), IntSize());
926 drawingArea->setSize(IntSize(width, height), IntSize());
928 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) && !ENABLE(TIZEN_WEBKIT2_EFL_WTR)
929 impl->pageClient->updateViewportSize(IntSize(width, height));
930 if (ewk_view_is_opengl_backend(ewkView))
931 impl->pageClient->displayViewport();
934 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
935 impl->pageClient->frameRectChanged();
938 #endif // #if OS(TIZEN)
941 if (smartData->changed.position) {
942 evas_object_move(smartData->image, x, y);
943 smartData->view.x = x;
944 smartData->view.y = y;
945 smartData->changed.position = false;
947 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
948 impl->pageClient->frameRectChanged();
950 #if ENABLE(TIZEN_SCREEN_READER)
951 impl->pageProxy->recalcScreenReaderFocusRect();
953 #endif // #if OS(TIZEN)
956 if (impl->popupPicker)
957 ewk_popup_picker_resize(impl->popupPicker);
958 #endif // #if OS(TIZEN)
961 static void _ewk_view_smart_show(Evas_Object* ewkView)
963 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
964 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
966 if (evas_object_clipees_get(smartData->base.clipper))
967 evas_object_show(smartData->base.clipper);
968 evas_object_show(smartData->image);
971 static void _ewk_view_smart_hide(Evas_Object* ewkView)
973 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
975 evas_object_hide(smartData->base.clipper);
976 evas_object_hide(smartData->image);
977 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
978 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
979 if (impl->pageClient->isTextSelectionMode())
980 impl->pageClient->setIsTextSelectionMode(false);
984 static void _ewk_view_smart_color_set(Evas_Object* ewkView, int red, int green, int blue, int alpha)
986 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
987 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
991 else if (alpha > 255)
994 #define CHECK_COLOR(color, alpha) \
997 else if (color > alpha) \
999 CHECK_COLOR(red, alpha);
1000 CHECK_COLOR(green, alpha);
1001 CHECK_COLOR(blue, alpha);
1004 evas_object_image_alpha_set(smartData->image, alpha < 255);
1005 impl->pageProxy->setDrawsBackground(red || green || blue);
1006 impl->pageProxy->setDrawsTransparentBackground(alpha < 255);
1007 impl->pageClient->setBackgroundColor(red/255.0, green/255.0, blue/255.0, alpha/255.0);
1010 g_parentSmartClass.color_set(ewkView, red, green, blue, alpha);
1014 Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api)
1016 EINA_SAFETY_ON_NULL_RETURN_VAL(api, false);
1018 if (api->version != EWK_VIEW_SMART_CLASS_VERSION) {
1019 EINA_LOG_CRIT("Ewk_View_Smart_Class %p is version %lu while %lu was expected.",
1020 api, api->version, EWK_VIEW_SMART_CLASS_VERSION);
1024 if (EINA_UNLIKELY(!g_parentSmartClass.add))
1025 evas_object_smart_clipped_smart_set(&g_parentSmartClass);
1027 evas_object_smart_clipped_smart_set(&api->sc);
1029 // Set Evas_Smart_Class functions.
1030 api->sc.add = _ewk_view_smart_add;
1031 api->sc.del = _ewk_view_smart_del;
1032 api->sc.move = _ewk_view_smart_move;
1033 api->sc.resize = _ewk_view_smart_resize;
1034 api->sc.show = _ewk_view_smart_show;
1035 api->sc.hide = _ewk_view_smart_hide;
1036 api->sc.color_set = _ewk_view_smart_color_set;
1037 api->sc.calculate = _ewk_view_smart_calculate;
1038 api->sc.data = EWK_VIEW_TYPE_STR; // It is used by type checking.
1040 // Set Ewk_View_Smart_Class functions.
1041 api->focus_in = _ewk_view_smart_focus_in;
1042 api->focus_out = _ewk_view_smart_focus_out;
1043 api->mouse_wheel = _ewk_view_smart_mouse_wheel;
1044 api->mouse_down = _ewk_view_smart_mouse_down;
1045 api->mouse_up = _ewk_view_smart_mouse_up;
1046 api->mouse_move = _ewk_view_smart_mouse_move;
1047 api->key_down = _ewk_view_smart_key_down;
1048 api->key_up = _ewk_view_smart_key_up;
1050 api->gesture_start = _ewk_view_smart_gesture_start;
1051 api->gesture_end = _ewk_view_smart_gesture_end;
1052 api->gesture_move = _ewk_view_smart_gesture_move;
1054 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
1055 api->popup_menu_show = _ewk_view_popup_menu_show;
1056 #if ENABLE(TIZEN_MULTIPLE_SELECT)
1057 api->multiple_popup_menu_show = _ewk_view_multiple_popup_menu_show;
1059 api->popup_menu_hide = _ewk_view_popup_menu_hide;
1060 api->popup_menu_update = _ewk_view_popup_menu_update;
1062 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
1063 api->text_selection_down = _ewk_view_text_selection_down;
1064 api->text_selection_move = _ewk_view_text_selection_move;
1065 api->text_selection_up = _ewk_view_text_selection_up;
1067 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1068 api->input_picker_show = _ewk_view_input_picker_show;
1070 #if ENABLE(TIZEN_DATALIST_ELEMENT)
1071 api->data_list_show = _ewk_view_data_list_show;
1072 api->data_list_hide = _ewk_view_data_list_hide;
1074 #if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL)
1075 api->orientation_lock = _ewk_orientation_lock;
1076 api->orientation_unlock = _ewk_orientation_unlock;
1078 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
1079 api->input_picker_color_request = _ewk_input_picker_color_request;
1080 api->input_picker_color_dismiss = _ewk_input_picker_color_dismiss;
1082 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
1083 api->formdata_candidate_show = _ewk_view_smart_formdata_candidate_show;
1084 api->formdata_candidate_hide = _ewk_view_smart_formdata_candidate_hide;
1085 api->formdata_candidate_update_data = _ewk_view_smart_formdata_candidate_update_data;
1086 api->formdata_candidate_is_showing = _ewk_view_smart_formdata_candidate_is_showing;
1088 #if ENABLE(TIZEN_SCREEN_READER)
1089 api->screen_reader_command_execute = _ewk_view_screen_reader_command_execute;
1091 #endif //#if OS(TIZEN)
1096 static inline Evas_Smart* _ewk_view_smart_class_new(void)
1098 static Ewk_View_Smart_Class api = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("Ewk_View");
1099 static Evas_Smart* smart = 0;
1101 if (EINA_UNLIKELY(!smart)) {
1102 ewk_view_smart_class_set(&api);
1103 smart = evas_smart_class_new(&api.sc);
1109 static void _ewk_view_initialize(Evas_Object* ewkView, PassRefPtr<Ewk_Context> context, WKPageGroupRef pageGroupRef)
1111 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1112 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1113 EINA_SAFETY_ON_NULL_RETURN(context);
1115 if (impl->pageClient)
1118 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
1119 bool isOpenGL = ewk_view_is_opengl_backend(ewkView);
1121 impl->pageClient = PageClientEvasGL::create(impl);
1123 impl->pageClient = PageClientImpl::create(impl);
1125 impl->pageClient = PageClientImpl::create(impl);
1129 impl->pageProxy = toImpl(context->wkContext())->createWebPage(impl->pageClient.get(), toImpl(pageGroupRef));
1131 impl->pageProxy = toImpl(context->wkContext())->createWebPage(impl->pageClient.get(), WebPageGroup::create().get());
1133 EwkViewImpl::addToPageViewMap(ewkView);
1136 impl->pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true);
1137 impl->pageProxy->pageGroup()->preferences()->setForceCompositingMode(true);
1138 impl->pageProxy->pageGroup()->preferences()->setFrameFlatteningEnabled(true);
1139 impl->pageProxy->pageGroup()->preferences()->setAllowUniversalAccessFromFileURLs(true);
1141 int deviceWidth, deviceHeight;
1142 ecore_evas_screen_geometry_get(ecore_evas_ecore_evas_get(evas_object_evas_get(ewkView)), 0, 0, &deviceWidth, &deviceHeight);
1143 impl->pageProxy->pageGroup()->preferences()->setDeviceWidth(deviceWidth);
1144 impl->pageProxy->pageGroup()->preferences()->setDeviceHeight(deviceHeight);
1147 impl->pageProxy->initializeWebPage();
1149 #if ENABLE(TIZEN_VIEWPORT_META_TAG)
1150 impl->pageProxy->setCustomDeviceScaleFactor((float)getMobileDPI() / 160);
1152 impl->pageProxy->setCustomDeviceScaleFactor((float)getDPI() / 160);
1155 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) && !ENABLE(TIZEN_WEBKIT2_EFL_WTR)
1156 impl->pageProxy->setUseFixedLayout(true);
1158 #if ENABLE(FULLSCREEN_API)
1159 impl->pageProxy->fullScreenManager()->setWebView(ewkView);
1162 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
1164 impl->pageProxy->drawingArea()->layerTreeCoordinatorProxy()->initializeAcceleratedCompositingMode(true);
1166 impl->pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(false);
1167 impl->pageProxy->pageGroup()->preferences()->setWebGLEnabled(false);
1168 impl->pageProxy->drawingArea()->layerTreeCoordinatorProxy()->initializeAcceleratedCompositingMode(false);
1172 impl->backForwardList = Ewk_Back_Forward_List::create(toAPI(impl->pageProxy->backForwardList()));
1174 impl->context = context;
1177 ewkViewContextMenuClientAttachClient(ewkView);
1178 ewkViewTizenClientAttachClient(ewkView);
1180 #if ENABLE(TIZEN_GEOLOCATION)
1181 ewkViewGeolocationProviderAttachProvider(ewkView, impl->context->wkContext());
1184 #if ENABLE(TIZEN_NOTIFICATIONS)
1185 ewkViewNotificationProviderAttachProvider(ewkView, impl->context->wkContext());
1188 #if ENABLE(TIZEN_ICON_DATABASE)
1189 ewk_view_icondatabase_client_attach(ewkView, impl->context->wkContext());
1192 ewk_view_javascript_alert_callback_set(ewkView, _ewk_view_default_javascript_alert, 0);
1193 ewk_view_javascript_confirm_callback_set(ewkView, _ewk_view_default_javascript_confirm, 0);
1194 ewk_view_javascript_prompt_callback_set(ewkView, _ewk_view_default_javascript_prompt, 0);
1195 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
1196 ewk_view_before_unload_confirm_panel_callback_set(ewkView, _ewk_view_default_before_unload_confirm_panel, 0);
1198 ewk_view_open_panel_callback_set(ewkView, _ewk_view_default_open_panel, 0);
1199 #else // #if OS(TIZEN)
1200 #if USE(COORDINATED_GRAPHICS)
1201 impl->viewportHandler = EflViewportHandler::create(impl->pageClient.get());
1203 #endif // #if OS(TIZEN)
1205 #if ENABLE(FULLSCREEN_API)
1206 impl->pageProxy->fullScreenManager()->setWebView(ewkView);
1207 impl->pageProxy->pageGroup()->preferences()->setFullScreenEnabled(true);
1210 // Initialize page clients.
1211 impl->pageLoadClient = PageLoadClientEfl::create(impl);
1212 impl->pagePolicyClient = PagePolicyClientEfl::create(impl);
1213 impl->pageUIClient = PageUIClientEfl::create(impl);
1214 impl->resourceLoadClient = ResourceLoadClientEfl::create(impl);
1215 impl->findClient = FindClientEfl::create(impl);
1216 impl->formClient = FormClientEfl::create(impl);
1218 /* Listen for favicon changes */
1219 Ewk_Favicon_Database* iconDatabase = impl->context->faviconDatabase();
1220 iconDatabase->watchChanges(IconChangeCallbackData(_ewk_view_on_favicon_changed, ewkView));
1222 #if ENABLE(TIZEN_WEBKIT2_THEME_SET_INTERNAL)
1223 ewk_view_theme_set(ewkView, "/usr/share/edje/webkit.edj");
1226 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_X_WINDOW)
1227 if (!impl->context->xWindow())
1228 impl->context->setXWindow(elm_win_xwindow_get(ewkView));
1231 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
1232 impl->focusRing = FocusRing::create(impl);
1236 static Evas_Object* _ewk_view_add_with_smart(Evas* canvas, Evas_Smart* smart)
1238 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
1239 EINA_SAFETY_ON_NULL_RETURN_VAL(smart, 0);
1241 #if ENABLE(TIZEN_WEBKIT2_DDK_CHECK)
1243 using namespace EGL;
1244 if(!eglGetDisplay(EGL_DEFAULT_DISPLAY)) {
1245 EINA_LOG_CRIT("Fail in initiziling view because No DDK is installed.");
1251 Evas_Object* ewkView = evas_object_smart_add(canvas, smart);
1255 EWK_VIEW_SD_GET(ewkView, smartData);
1257 evas_object_del(ewkView);
1261 EWK_VIEW_IMPL_GET(smartData, impl);
1263 evas_object_del(ewkView);
1272 * Constructs a ewk_view Evas_Object with WKType parameters.
1274 Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
1276 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
1277 EINA_SAFETY_ON_NULL_RETURN_VAL(contextRef, 0);
1279 Evas_Object* ewkView = _ewk_view_add_with_smart(canvas, _ewk_view_smart_class_new());
1283 _ewk_view_initialize(ewkView, Ewk_Context::create(contextRef), pageGroupRef);
1288 Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* context)
1290 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
1291 EINA_SAFETY_ON_NULL_RETURN_VAL(smart, 0);
1292 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
1294 Evas_Object* ewkView = _ewk_view_add_with_smart(canvas, smart);
1298 #if ENABLE(TIZEN_ICON_DATABASE)
1299 //set default iconDatabasePath
1300 WKContextRef contextRef = context->wkContext();
1301 toImpl(contextRef)->setIconDatabasePath(toImpl(contextRef)->iconDatabasePath());
1304 #if ENABLE(TIZEN_WEBKIT2_CREATE_VIEW_WITH_CREATED_PAGE_GROUP_WITH_IDENTIFIER)
1305 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1306 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1307 _ewk_view_initialize(ewkView, context, toAPI(impl->pageGroup.get()));
1309 _ewk_view_initialize(ewkView, context, 0);
1315 Evas_Object* ewk_view_add_with_context(Evas* canvas, Ewk_Context* context)
1317 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
1318 return ewk_view_smart_add(canvas, _ewk_view_smart_class_new(), context);
1321 Evas_Object* ewk_view_add(Evas* canvas)
1323 return ewk_view_add_with_context(canvas, ewk_context_default_get());
1326 Ewk_Context* ewk_view_context_get(const Evas_Object* ewkView)
1328 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1329 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1331 return impl->ewkContext();
1334 Eina_Bool ewk_view_url_set(Evas_Object* ewkView, const char* url)
1336 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1337 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1338 EINA_SAFETY_ON_NULL_RETURN_VAL(url, false);
1340 impl->pageProxy->loadURL(url);
1341 impl->informURLChange();
1346 const char* ewk_view_url_get(const Evas_Object* ewkView)
1348 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1349 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1354 const char *ewk_view_icon_url_get(const Evas_Object *ewkView)
1356 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1357 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1359 return impl->faviconURL();
1362 Eina_Bool ewk_view_reload(Evas_Object* ewkView)
1364 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1365 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1367 impl->pageProxy->reload(/*reloadFromOrigin*/ false);
1368 impl->informURLChange();
1373 Eina_Bool ewk_view_reload_bypass_cache(Evas_Object* ewkView)
1375 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1376 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1378 impl->pageProxy->reload(/*reloadFromOrigin*/ true);
1379 impl->informURLChange();
1384 Eina_Bool ewk_view_stop(Evas_Object* ewkView)
1386 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1387 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1389 impl->pageProxy->stopLoading();
1394 Ewk_Settings* ewk_view_settings_get(const Evas_Object* ewkView)
1396 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1397 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1399 return impl->settings();
1402 const char* ewk_view_title_get(const Evas_Object* ewkView)
1404 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1405 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1407 return impl->title();
1412 * Reports that the requested text was found.
1414 * Emits signal: "text,found" with the number of matches.
1416 void ewk_view_text_found(Evas_Object* ewkView, unsigned int matchCount)
1418 evas_object_smart_callback_call(ewkView, "text,found", &matchCount);
1421 double ewk_view_load_progress_get(const Evas_Object* ewkView)
1423 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
1424 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1.0);
1426 return impl->pageProxy->estimatedProgress();
1429 Eina_Bool ewk_view_scale_set(Evas_Object* ewkView, double scaleFactor, int x, int y)
1431 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1432 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1438 scaleFactor = impl->pageClient->adjustScaleWithViewport(scaleFactor);
1440 IntPoint scrollPosition = impl->pageClient->scrollPosition();
1441 double scaleDifference = scaleFactor / impl->pageClient->scaleFactor();
1442 int newScrollX = (scrollPosition.x() + centerX - smartData->view.x) * scaleDifference - (centerX - smartData->view.x);
1443 int newScrollY = (scrollPosition.y() + centerY - smartData->view.y) * scaleDifference - (centerY - smartData->view.y);
1445 impl->pageProxy->scale(scaleFactor, IntPoint(newScrollX, newScrollY));
1447 impl->pageProxy->scalePage(scaleFactor, IntPoint(x, y));
1452 double ewk_view_scale_get(const Evas_Object* ewkView)
1454 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1);
1455 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1);
1458 return impl->pageProxy->scaleFactor();
1460 return impl->pageProxy->pageScaleFactor();
1464 Eina_Bool ewk_view_device_pixel_ratio_set(Evas_Object* ewkView, float ratio)
1466 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1467 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1469 impl->pageProxy->setCustomDeviceScaleFactor(ratio);
1474 float ewk_view_device_pixel_ratio_get(const Evas_Object* ewkView)
1476 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
1477 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1.0);
1479 return impl->pageProxy->deviceScaleFactor();
1482 void ewk_view_theme_set(Evas_Object* ewkView, const char* path)
1484 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1485 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1487 impl->setThemePath(path);
1490 const char* ewk_view_theme_get(const Evas_Object* ewkView)
1492 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1493 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1495 return impl->themePath();
1498 Eina_Bool ewk_view_back(Evas_Object* ewkView)
1500 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1501 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1503 WebPageProxy* page = impl->pageProxy.get();
1504 if (page->canGoBack()) {
1512 Eina_Bool ewk_view_forward(Evas_Object* ewkView)
1514 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1515 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1517 WebPageProxy* page = impl->pageProxy.get();
1518 if (page->canGoForward()) {
1526 Eina_Bool ewk_view_intent_deliver(Evas_Object* ewkView, Ewk_Intent* intent)
1528 #if ENABLE(WEB_INTENTS)
1529 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1530 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1531 EINA_SAFETY_ON_NULL_RETURN_VAL(intent, false);
1533 WebPageProxy* page = impl->pageProxy.get();
1534 page->deliverIntentToFrame(page->mainFrame(), intent->webIntentData());
1542 Eina_Bool ewk_view_back_possible(Evas_Object* ewkView)
1544 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1545 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1547 return impl->pageProxy->canGoBack();
1550 Eina_Bool ewk_view_forward_possible(Evas_Object* ewkView)
1552 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1553 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1555 return impl->pageProxy->canGoForward();
1558 Ewk_Back_Forward_List* ewk_view_back_forward_list_get(const Evas_Object* ewkView)
1560 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1561 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1563 return impl->backForwardList.get();
1566 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
1567 void ewk_view_text_change_in_textfield(Evas_Object* ewkView, const String& name, const String& value)
1569 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1570 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1572 if (!ewk_settings_form_candidate_data_enabled_get(ewk_view_settings_get(ewkView)))
1575 InputMethodContextEfl* imfContext = impl->inputMethodContext();
1576 if (!imfContext || !imfContext->isShow())
1579 if (value.isEmpty()) {
1580 if(smartData->api->formdata_candidate_is_showing(smartData))
1581 smartData->api->formdata_candidate_hide(smartData);
1585 Vector<String> popupCandidates;
1586 ewk_view_form_candidate_data_get(ewkView, name, popupCandidates);
1587 std::sort(popupCandidates.begin(), popupCandidates.end(), WTF::codePointCompareLessThan);
1589 Eina_List* candidateList = 0;
1590 for (size_t i = 0; i < popupCandidates.size(); ++i) {
1591 if (popupCandidates[i].startsWith(value, false))
1592 candidateList = eina_list_append(candidateList, eina_stringshare_add(popupCandidates[i].utf8().data()));
1595 if (!eina_list_count(candidateList)) {
1596 if(smartData->api->formdata_candidate_is_showing(smartData))
1597 smartData->api->formdata_candidate_hide(smartData);
1601 smartData->api->formdata_candidate_update_data(smartData, candidateList);
1603 if (!smartData->api->formdata_candidate_is_showing(smartData))
1604 smartData->api->formdata_candidate_hide(smartData);
1606 IntRect inputFieldRect = impl->pageClient->focusedNodeRect();
1607 smartData->api->formdata_candidate_show(smartData, inputFieldRect.x(), inputFieldRect.y(), inputFieldRect.width(), inputFieldRect.height());
1610 void ewk_view_form_data_add(Evas_Object* ewkView, WKDictionaryRef& formData, bool isPasswordForm)
1612 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1613 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1614 if (!ewk_settings_autofill_password_form_enabled_get(ewk_view_settings_get(ewkView))
1615 && !ewk_settings_form_candidate_data_enabled_get(ewk_view_settings_get(ewkView)))
1617 ewk_view_context_get(ewkView)->addFormData(impl->url(), formData, isPasswordForm);
1620 void ewk_view_form_password_data_fill(Evas_Object* ewkView)
1622 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1623 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1625 if (!ewk_settings_autofill_password_form_enabled_get(ewk_view_settings_get(ewkView)))
1628 Vector<std::pair<String, String> > passwordFormData;
1629 ewk_view_context_get(ewkView)->passwordFormData(impl->url(), passwordFormData);
1631 if (!passwordFormData.size())
1634 String passwordFormAutofill = "try { function passwordFormAutofill() { var inputFields;";
1635 for (size_t i = 0; i < passwordFormData.size(); i++) {
1636 passwordFormAutofill += String::format(" inputFields = document.getElementsByName(\"%s\");"
1637 " for (var i = 0; i < inputFields.length; i++)"
1638 " if (inputFields[i].tagName.toLowerCase() == \"input\" && (inputFields[i].type.toLowerCase() == \"text\" || inputFields[i].type.toLowerCase() == \"password\"))"
1639 " inputFields[i].value = \"%s\";",
1640 passwordFormData[i].first.utf8().data(), passwordFormData[i].second.utf8().data());
1642 passwordFormAutofill += "} passwordFormAutofill(); } catch(e) { }";
1643 ewk_view_script_execute(ewkView, passwordFormAutofill.utf8().data(), 0, 0);
1646 void ewk_view_form_candidate_data_get(Evas_Object* ewkView, const String& name, Vector<String>& candidates)
1648 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1649 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1650 ewk_view_context_get(ewkView)->candidateFormData(name, candidates);
1654 Eina_Bool ewk_view_html_string_load(Evas_Object* ewkView, const char* html, const char* baseUrl, const char* unreachableUrl)
1656 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1657 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1658 EINA_SAFETY_ON_NULL_RETURN_VAL(html, false);
1660 if (unreachableUrl && *unreachableUrl)
1661 impl->pageProxy->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl));
1663 impl->pageProxy->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "");
1665 impl->informURLChange();
1670 const char* ewk_view_custom_encoding_get(const Evas_Object* ewkView)
1672 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1673 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1675 return impl->customTextEncodingName();
1678 Eina_Bool ewk_view_custom_encoding_set(Evas_Object* ewkView, const char* encoding)
1680 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1681 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1683 impl->setCustomTextEncodingName(encoding);
1689 // FIXME: It should be removed.
1690 WKPageRef ewk_view_WKPage_get(Evas_Object* ewkView)
1692 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1693 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1695 return toAPI(impl->pageProxy.get());
1698 Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object* ewkView, Eina_Bool enabled)
1700 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1701 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1703 impl->setMouseEventsEnabled(!!enabled);
1708 Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object* ewkView)
1710 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1711 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1713 return impl->mouseEventsEnabled();
1716 Eina_Bool ewk_view_color_picker_color_set(Evas_Object* ewkView, int r, int g, int b, int a)
1718 #if ENABLE(INPUT_TYPE_COLOR)
1719 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1720 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1722 return impl->setColorPickerColor(WebCore::Color(r, g, b, a));
1728 static Eina_Bool _ewk_view_default_javascript_alert(Evas_Object* ewkView, const char* alertText, void* userData)
1730 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1731 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1733 return impl->javascriptPopup->alert(alertText);
1736 static Eina_Bool _ewk_view_default_javascript_confirm(Evas_Object* ewkView, const char* message, void* userData)
1738 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1739 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1741 return impl->javascriptPopup->confirm(message);
1744 static Eina_Bool _ewk_view_default_javascript_prompt(Evas_Object* ewkView, const char* message, const char* defaultValue, void* userData)
1746 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1747 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1749 return impl->javascriptPopup->prompt(message, defaultValue);
1752 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
1753 static Eina_Bool _ewk_view_default_before_unload_confirm_panel(Evas_Object* ewkView, const char* message, void* userData)
1755 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1756 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1758 return impl->javascriptPopup->beforeUnloadConfirmPanel(message);
1762 static Eina_Bool _ewk_view_default_open_panel(Evas_Object* ewkView, Eina_Bool allow_multiple_files, Eina_List *accepted_mime_types, const char* capture, void* userData)
1764 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1765 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1767 return impl->openPanel->openPanel(ewkView, allow_multiple_files, accepted_mime_types, capture, impl);
1770 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
1771 Eina_Bool _ewk_view_popup_menu_show(Ewk_View_Smart_Data* smartData, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items, int selectedIndex)
1773 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1775 if (impl->popupPicker)
1776 ewk_popup_picker_del(impl->popupPicker);
1778 #if ENABLE(TIZEN_MULTIPLE_SELECT)
1779 impl->popupPicker = ewk_popup_picker_new(smartData->self, items, selectedIndex, false);
1781 impl->popupPicker = ewk_popup_picker_new(smartData->self, items, selectedIndex);
1787 #if ENABLE(TIZEN_MULTIPLE_SELECT)
1788 Eina_Bool _ewk_view_multiple_popup_menu_show(Ewk_View_Smart_Data* smartData, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items)
1790 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1792 if (impl->popupPicker)
1793 ewk_popup_picker_del(impl->popupPicker);
1795 impl->popupPicker = ewk_popup_picker_new(smartData->self, items, 0, true);
1801 Eina_Bool _ewk_view_popup_menu_hide(Ewk_View_Smart_Data* smartData)
1803 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1805 if (!impl->popupPicker)
1808 ewk_popup_picker_del(impl->popupPicker);
1809 impl->popupPicker = 0;
1814 Eina_Bool _ewk_view_popup_menu_update(Ewk_View_Smart_Data* smartData, Eina_Rectangle rect, Ewk_Text_Direction text_direction, Eina_List* items, int selectedIndex)
1816 // FIXME: The rect should be updated if it was changed
1818 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1820 if (!impl->popupPicker)
1823 ewk_popup_picker_update(smartData->self, impl->popupPicker, items, selectedIndex);
1829 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1830 static Eina_Bool _ewk_view_input_picker_show(Ewk_View_Smart_Data* smartData, Ewk_Input_Type inputType, const char* inputValue)
1832 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1834 impl->inputPicker->show(inputType, inputValue);
1839 #if ENABLE(TIZEN_DATALIST_ELEMENT)
1840 static Eina_Bool _ewk_view_data_list_show(Ewk_View_Smart_Data* smartData, Ewk_Input_Type inputType, Eina_List* optionList)
1842 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1844 impl->inputPicker->showDataList(inputType, optionList);
1848 static Eina_Bool _ewk_view_data_list_hide(Ewk_View_Smart_Data* smartData, Ewk_Input_Type inputType)
1850 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1852 impl->inputPicker->hideDataList(inputType);
1857 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
1858 static Eina_Bool _ewk_input_picker_color_request(Ewk_View_Smart_Data* smartData, int r, int g, int b, int a)
1860 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1862 impl->inputPicker->showColorPicker(r, g, b, a);
1866 static Eina_Bool _ewk_input_picker_color_dismiss(Ewk_View_Smart_Data* smartData)
1868 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1870 impl->inputPicker->hideColorPicker();
1875 PageClientImpl* ewkViewGetPageClient(const Evas_Object* ewkView)
1877 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1878 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1880 return impl->pageClient.get();
1883 double ewk_view_text_zoom_get(const Evas_Object* ewkView)
1885 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 1);
1886 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 1);
1888 return WKPageGetTextZoomFactor(toAPI(impl->pageProxy.get()));
1891 Eina_Bool ewk_view_text_zoom_set(Evas_Object* ewkView, double textZoomFactor)
1893 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1894 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1896 WKPageSetTextZoomFactor(toAPI(impl->pageProxy.get()), textZoomFactor);
1900 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
1901 FocusRing* ewkViewGetFocusRing(Evas_Object* ewkView)
1903 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1904 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1906 return impl->focusRing.get();
1910 Ewk_Frame_Ref ewk_view_main_frame_get(Evas_Object* ewkView)
1912 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1913 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1915 return static_cast<Ewk_Frame_Ref>(WKPageGetMainFrame(toAPI(impl->pageProxy.get())));
1918 Ewk_Frame_Ref ewk_view_focused_frame_get(Evas_Object* ewkView)
1920 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1921 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1923 return static_cast<Ewk_Frame_Ref>(WKPageGetFocusedFrame(toAPI(impl->pageProxy.get())));
1926 JSGlobalContextRef ewkViewGetJavascriptGlobalContext(Evas_Object* ewkView)
1928 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1929 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1931 if (!impl->javascriptGlobalContext)
1932 impl->javascriptGlobalContext = JSGlobalContextCreate(0);
1933 return impl->javascriptGlobalContext;
1936 void ewkViewLoadCommitted(Evas_Object* ewkView)
1938 #if ENABLE(TIZEN_GESTURE)
1939 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1940 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1941 impl->gestureClient->reset();
1943 #if ENABLE(TIZEN_ISF_PORT)
1944 impl->inputMethodContext()->hideIMFContext();
1946 impl->informURLChange();
1947 evas_object_smart_callback_call(ewkView, "load,committed", 0);
1950 void ewkViewLoadError(Evas_Object* ewkView, WKErrorRef error)
1952 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1953 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1955 OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(error);
1956 ewk_error_load_error_page(ewkError.get(), toAPI(impl->pageProxy.get()));
1957 evas_object_smart_callback_call(ewkView, "load,error", ewkError.get());
1960 void ewkViewDidFirstVisuallyNonEmptyLayout(Evas_Object* ewkView)
1962 #if ENABLE(TIZEN_GESTURE)
1963 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1964 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1965 impl->gestureClient->reset();
1967 evas_object_smart_callback_call(ewkView, "load,nonemptylayout,finished", 0);
1970 void ewkViewDidReceiveAuthenticationChallenge(Evas_Object* ewkView, Ewk_Auth_Challenge* authChallenge)
1972 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1973 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1975 if (impl->authChallenge)
1976 ewkAuthChallengeDelete(impl->authChallenge);
1977 impl->authChallenge = authChallenge;
1979 evas_object_smart_callback_call(ewkView, "authentication,challenge", impl->authChallenge);
1982 void ewk_view_process_crashed(Evas_Object* ewkView)
1984 bool handled = false;
1985 evas_object_smart_callback_call(ewkView, "process,crashed", &handled);
1991 #if ENABLE(TIZEN_SQL_DATABASE)
1992 unsigned long long ewkViewExceededDatabaseQuota(Evas_Object* ewkView, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage)
1994 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, currentQuota);
1995 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, currentQuota);
1997 TIZEN_LOGI("database,quota,exceeded");
1998 uint64_t defaultQuota = ewkContextGetDatabaseQuota(impl->context.get());
1999 if (defaultQuota >= expectedUsage + currentQuota)
2000 return defaultQuota;
2002 if (impl->exceededDatabaseQuota)
2003 ewkContextDeleteExceededQuota(impl->exceededDatabaseQuota);
2004 impl->exceededDatabaseQuota = ewkContextCreateExceededQuota(origin, databaseName, displayName, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage);
2005 evas_object_smart_callback_call(ewkView, "database,quota,exceeded", impl->exceededDatabaseQuota);
2007 return ewkContextGetNewQuotaForExceededQuota(impl->context.get(), impl->exceededDatabaseQuota);
2011 #if ENABLE(TIZEN_NOTIFICATIONS)
2012 void ewkViewCancelNotification(Evas_Object* ewkView, uint64_t notificationID)
2014 TIZEN_LOGI("notification,cancel");
2015 evas_object_smart_callback_call(ewkView, "notification,cancel", ¬ificationID);
2018 void ewkViewRequestNotificationPermission(Evas_Object* ewkView, Ewk_Notification_Permission_Request* notificationPermissionRequest)
2020 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2021 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2023 TIZEN_LOGI("notification,permission,request");
2024 impl->notificationPermissionRequests = eina_list_append(impl->notificationPermissionRequests, notificationPermissionRequest);
2025 evas_object_smart_callback_call(ewkView, "notification,permission,request", notificationPermissionRequest);
2028 void ewkViewShowNotification(Evas_Object* ewkView, Ewk_Notification* notification)
2030 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2031 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2033 TIZEN_LOGI("notification,show");
2034 Eina_List* listIterator=0;
2036 const char* replaceID = ewkNotificationGetReplaceID(notification);
2037 if(strlen(replaceID)) {
2038 EINA_LIST_FOREACH(impl->notifications, listIterator, data) {
2039 Ewk_Notification* notificationForReplace = static_cast<Ewk_Notification*>(data);
2040 if(!strcmp(ewkNotificationGetReplaceID(notificationForReplace), replaceID))
2041 ewkViewCancelNotification(ewkView, ewk_notification_id_get(notificationForReplace));
2045 impl->notifications = eina_list_append(impl->notifications, notification);
2046 evas_object_smart_callback_call(ewkView, "notification,show", notification);
2049 void ewkViewDeleteNotificationPermissionRequest(Evas_Object* ewkView, Ewk_Notification_Permission_Request* ewkNotificationPermissionRequest)
2051 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2052 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2054 impl->notificationPermissionRequests = eina_list_remove(impl->notificationPermissionRequests, ewkNotificationPermissionRequest);
2058 #if ENABLE(TIZEN_REGISTER_PROTOCOL_HANDLER)
2059 void ewkViewRegisterProtocolHandlers(Evas_Object* ewkView, const char* scheme, const char* baseUrl, const char* url, const char* title)
2061 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2063 TIZEN_LOGI("protocolhandler,registration,requested");
2064 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(scheme, baseUrl, url, title);
2065 evas_object_smart_callback_call(ewkView, "protocolhandler,registration,requested", static_cast<void*>(customHandlersData));
2066 ewkCustomHandlersDeleteData(customHandlersData);
2070 #if ENABLE(TIZEN_CUSTOM_SCHEME_HANDLER)
2071 Ewk_Custom_Handlers_State ewkViewIsProtocolHandlerRegistered(Evas_Object* ewkView, const char* scheme, const char* baseURL, const char* url)
2073 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, EWK_CUSTOM_HANDLERS_DECLINED);
2075 TIZEN_LOGI("protocolhandler,isregistered");
2076 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(scheme, baseURL, url);
2077 evas_object_smart_callback_call(ewkView, "protocolhandler,isregistered", static_cast<void*>(customHandlersData));
2079 Ewk_Custom_Handlers_State result;
2080 result = ewkGetCustomHandlersDataResult(customHandlersData);
2081 ewkCustomHandlersDeleteData(customHandlersData);
2086 void ewkViewUnregisterProtocolHandlers(Evas_Object* ewkView, const char* scheme, const char* baseURL, const char* url)
2088 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2090 TIZEN_LOGI("protocolhandler,unregistration,requested");
2091 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(scheme, baseURL, url);
2092 evas_object_smart_callback_call(ewkView, "protocolhandler,unregistration,requested", static_cast<void*>(customHandlersData));
2093 ewkCustomHandlersDeleteData(customHandlersData);
2097 #if ENABLE(TIZEN_REGISTER_CONTENT_HANDLER)
2098 void ewkViewRegisterContentHandlers(Evas_Object* ewkView, const char* mimeType, const char* baseUrl, const char* url, const char* title)
2100 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2102 TIZEN_LOGI("contenthandler,registration,requested");
2103 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(mimeType, baseUrl, url, title);
2104 evas_object_smart_callback_call(ewkView, "contenthandler,registration,requested", static_cast<void*>(customHandlersData));
2105 ewkCustomHandlersDeleteData(customHandlersData);
2108 Ewk_Custom_Handlers_State ewkViewIsContentHandlerRegistered(Evas_Object* ewkView, const char* mimeType, const char* baseURL, const char* url)
2110 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, EWK_CUSTOM_HANDLERS_DECLINED);
2112 TIZEN_LOGI("contenthandler,isregistered");
2113 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(mimeType, baseURL, url);
2114 evas_object_smart_callback_call(ewkView, "contenthandler,isregistered", static_cast<void*>(customHandlersData));
2116 Ewk_Custom_Handlers_State result;
2117 result = ewkGetCustomHandlersDataResult(customHandlersData);
2118 ewkCustomHandlersDeleteData(customHandlersData);
2123 void ewkViewUnregisterContentHandlers(Evas_Object* ewkView, const char* mimeType, const char* baseURL, const char* url)
2125 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2127 TIZEN_LOGI("contenthandler,unregistration,requested");
2128 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(mimeType, baseURL, url);
2129 evas_object_smart_callback_call(ewkView, "contenthandler,unregistration,requested", static_cast<void*>(customHandlersData));
2130 ewkCustomHandlersDeleteData(customHandlersData);
2134 #if ENABLE(TIZEN_SEARCH_PROVIDER)
2135 void ewkViewAddSearchProvider(Evas_Object* ewkView, const char* baseURL, const char* engineURL)
2137 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2139 TIZEN_LOGI("searchProvider,add");
2140 Ewk_Search_Provider_Data* searchProviderData = ewkSearchProviderCreateData(baseURL, engineURL);
2141 evas_object_smart_callback_call(ewkView, "searchProvider,add", static_cast<void*>(searchProviderData));
2142 ewkSearchProviderDeleteData(searchProviderData);
2145 unsigned long ewkViewIsSearchProviderInstalled(Evas_Object* ewkView, const char* baseURL, const char* engineURL)
2147 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, 0);
2149 TIZEN_LOGI("searchProvider,installed");
2150 Ewk_Search_Provider_Data* searchProviderData = ewkSearchProviderCreateData(baseURL, engineURL);
2151 evas_object_smart_callback_call(ewkView, "searchProvider,installed", static_cast<void*>(searchProviderData));
2152 unsigned long result;
2153 result = ewkGetSearchProviderResult(searchProviderData);
2154 ewkSearchProviderDeleteData(searchProviderData);
2159 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
2160 bool ewkViewGetStandaloneStatus(Evas_Object* ewkView)
2162 TIZEN_LOGI("webapp,metatag,standalone");
2163 bool standalone = true;
2164 evas_object_smart_callback_call(ewkView, "webapp,metatag,standalone", (void*)&standalone);
2169 #if ENABLE(TIZEN_MEDIA_STREAM)
2170 void ewkViewRequestUserMediaPermission(Evas_Object* ewkView, Ewk_User_Media_Permission_Request* userMediaPermission)
2172 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2173 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2175 impl->userMediaPermissionRequests = eina_list_append(impl->userMediaPermissionRequests, userMediaPermission);
2176 evas_object_smart_callback_call(ewkView, "usermedia,permission,request", userMediaPermission);
2179 void ewkViewDeleteUserMediaPermissionRequest(Evas_Object* ewkView, Ewk_User_Media_Permission_Request* permission)
2181 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2182 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2184 impl->userMediaPermissionRequests = eina_list_remove(impl->userMediaPermissionRequests, permission);
2189 #if ENABLE(TIZEN_JSBRIDGE_PLUGIN)
2190 void ewkViewProcessJSBridgePlugin(Evas_Object* ewkView, WKStringRef request, WKStringRef message)
2192 int requestLength = WKStringGetMaximumUTF8CStringSize(request);
2193 OwnArrayPtr<char> requestBuffer = adoptArrayPtr(new char[requestLength]);
2194 int messageLength = WKStringGetMaximumUTF8CStringSize(message);
2195 OwnArrayPtr<char> messageBuffer = adoptArrayPtr(new char[messageLength]);
2196 WKStringGetUTF8CString(request, requestBuffer.get(), requestLength);
2197 WKStringGetUTF8CString(message, messageBuffer.get(), messageLength);
2199 evas_object_smart_callback_call(ewkView, requestBuffer.get(), static_cast<void*>(messageBuffer.get()));
2203 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
2204 void ewkViewRequestCertificateConfirm(Evas_Object* ewkView, Ewk_Certificate_Policy_Decision* certificatePolicyDecision)
2206 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
2207 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
2208 if (impl->certificatePolicyDecision)
2209 ewkCertificatePolicyDecisionDelete(impl->certificatePolicyDecision);
2210 impl->certificatePolicyDecision = certificatePolicyDecision;
2212 evas_object_smart_callback_call(ewkView, "request,certificate,confirm", certificatePolicyDecision);
2216 void ewkViewCustomizeContextMenu(Evas_Object* ewkView, Ewk_Context_Menu* menu)
2218 evas_object_smart_callback_call(ewkView, "contextmenu,customize", static_cast<void*>(menu));
2221 void ewkViewCustomContextMenuItemSelected(Evas_Object* ewkView, Ewk_Context_Menu_Item* item)
2223 evas_object_smart_callback_call(ewkView, "contextmenu,selected", static_cast<void*>(item));
2226 #if ENABLE(TIZEN_GEOLOCATION)
2227 void ewkViewRequestGeolocationPermission(Evas_Object* ewkView, Ewk_Geolocation_Permission_Request* geolocationPermissionRequest)
2229 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2230 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2232 TIZEN_LOGI("geolocation,permission,request");
2233 impl->geolocationPermissionRequests = eina_list_append(impl->geolocationPermissionRequests, geolocationPermissionRequest);
2234 evas_object_smart_callback_call(ewkView, "geolocation,permission,request", geolocationPermissionRequest);
2237 void ewkViewDeleteGeolocationPermission(Evas_Object* ewkView, Ewk_Geolocation_Permission_Request* geolocationPermissionRequest)
2239 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2240 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2242 impl->geolocationPermissionRequests = eina_list_remove(impl->geolocationPermissionRequests, geolocationPermissionRequest);
2245 void ewkViewSetGeolocation(Evas_Object* ewkView, Ewk_Geolocation* geolocation)
2247 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2248 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2250 impl->geolocation = geolocation;
2253 Ewk_Geolocation* ewkViewGetGeolocation(Evas_Object* ewkView)
2255 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2256 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
2258 return impl->geolocation;
2261 bool ewkViewIsValidLocationService(Evas_Object* ewkView)
2263 TIZEN_LOGI("geolocation,valid");
2266 evas_object_smart_callback_call(ewkView, "geolocation,valid", &valid);
2271 void ewkViewFormSubmit(Evas_Object* ewkView, Ewk_Form_Data* formData)
2273 evas_object_smart_callback_call(ewkView, "form,submit", formData);
2276 void ewkViewPolicyNavigationDecide(Evas_Object* ewkView, Ewk_Policy_Decision* policyDecision)
2278 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
2279 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
2280 if (impl->policyDecision)
2281 ewkPolicyDecisionDelete(impl->policyDecision);
2282 impl->policyDecision = policyDecision;
2284 evas_object_smart_callback_call(ewkView, "policy,navigation,decide", impl->policyDecision);
2287 void ewkViewPolicyNewWindowDecide(Evas_Object* ewkView, Ewk_Policy_Decision* policyDecision)
2289 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
2290 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
2291 if (impl->policyDecision)
2292 ewkPolicyDecisionDelete(impl->policyDecision);
2293 impl->policyDecision = policyDecision;
2295 evas_object_smart_callback_call(ewkView, "policy,newwindow,decide", impl->policyDecision);
2298 void ewkViewPolicyResponseDecide(Evas_Object* ewkView, Ewk_Policy_Decision* policyDecision)
2300 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
2301 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
2302 if (impl->policyDecision)
2303 ewkPolicyDecisionDelete(impl->policyDecision);
2304 impl->policyDecision = policyDecision;
2306 evas_object_smart_callback_call(ewkView, "policy,response,decide", impl->policyDecision);
2309 void ewkViewSendScrollEvent(Evas_Object* ewkView, int deltaX, int deltaY)
2311 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2312 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2314 IntPoint scrollPosition = impl->pageClient->scrollPosition();
2315 IntSize contentsSize = impl->pageProxy->contentsSize();
2316 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2317 contentsSize.scale(impl->pageClient->scaleFactor());
2320 // some website's contents size is smaller than view size,
2321 // so we have to adjust contents size to view size for that case.
2322 if (contentsSize.width() < smartData->view.w)
2323 contentsSize.setWidth(smartData->view.w);
2324 if (contentsSize.height() < smartData->view.h)
2325 contentsSize.setHeight(smartData->view.h);
2327 // Call "scroll,down" if webview can be scrolled down.
2328 if (deltaY > 0 && (scrollPosition.y() + smartData->view.h) < contentsSize.height())
2329 evas_object_smart_callback_call(ewkView, "scroll,down", 0);
2330 // Call "scroll,up" if webview can be scrolled up.
2331 else if (deltaY < 0 && scrollPosition.y() > 0)
2332 evas_object_smart_callback_call(ewkView, "scroll,up", 0);
2334 // Call "scroll,right" if webview can be scrolled down.
2335 if (deltaX > 0 && (scrollPosition.x() + smartData->view.w) < contentsSize.width())
2336 evas_object_smart_callback_call(ewkView, "scroll,right", 0);
2337 // Call "scroll,left" if webview can be scrolled up.
2338 else if (deltaX < 0 && scrollPosition.x() > 0)
2339 evas_object_smart_callback_call(ewkView, "scroll,left", 0);
2342 void ewkViewSendEdgeEvent(Evas_Object* ewkView, const IntPoint& scrollPosition, int deltaX, int deltaY)
2344 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2345 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2347 IntSize contentsSize = impl->pageProxy->contentsSize();
2348 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2349 contentsSize.scale(impl->pageClient->scaleFactor());
2352 int maxScrollY = contentsSize.height() - smartData->view.h;
2353 if (!impl->isVerticalEdge) {
2354 if (deltaY < 0 && (scrollPosition.y() + deltaY) <= 0) {
2355 evas_object_smart_callback_call(ewkView, "edge,top", NULL);
2356 impl->isVerticalEdge = true;
2357 } else if (deltaY > 0 && (scrollPosition.y() + deltaY) >= maxScrollY) {
2358 evas_object_smart_callback_call(ewkView, "edge,bottom", NULL);
2359 impl->isVerticalEdge = true;
2362 if (maxScrollY && ((scrollPosition.y() == 0 && deltaY > 0)
2363 || (scrollPosition.y() == maxScrollY && deltaY < 0)))
2364 impl->isVerticalEdge = false;
2367 int maxScrollX = contentsSize.width() - smartData->view.w;
2368 if (!impl->isHorizontalEdge) {
2369 if (deltaX < 0 && (scrollPosition.x() + deltaX) <= 0) {
2370 evas_object_smart_callback_call(ewkView, "edge,left", NULL);
2371 impl->isHorizontalEdge = true;
2372 } else if (deltaX > 0 && (scrollPosition.x() + deltaX) >= maxScrollX) {
2373 evas_object_smart_callback_call(ewkView, "edge,right", NULL);
2374 impl->isHorizontalEdge = true;
2377 if (maxScrollX && ((scrollPosition.x() == 0 && deltaX > 0)
2378 || (scrollPosition.x() == maxScrollX && deltaX < 0)))
2379 impl->isHorizontalEdge = false;
2383 void ewkViewClearEdges(Evas_Object* ewkView)
2385 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2386 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2388 impl->isVerticalEdge = false;
2389 impl->isHorizontalEdge = false;
2392 void ewk_view_scale_range_get(Evas_Object* ewkView, double* minimumScale, double* maximumScale)
2394 EWK_VIEW_SD_GET(ewkView, smartData);
2395 if (!smartData || !smartData->priv) {
2403 PageClientImpl::ViewportConstraints constraints = smartData->priv->pageClient->viewportConstraints();
2405 *minimumScale = constraints.minimumScale;
2407 *maximumScale = constraints.maximumScale;
2410 bool ewk_view_focused_node_adjust(Evas_Object* ewkView, Eina_Bool adjustForExternalKeyboard)
2412 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2413 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2415 double scaleFactor = impl->pageClient->scaleFactor();
2416 IntSize contentsSize = impl->pageProxy->contentsSize();
2418 double newScaleFactor = scaleFactor;
2419 // Readable zoom value is dependent on device DPI
2420 if (scaleFactor < impl->pageProxy->deviceScaleFactor()
2421 && impl->pageClient->viewportConstraints().userScalable)
2422 newScaleFactor = impl->pageProxy->deviceScaleFactor();
2424 // Readable zoom value should be inside of viewport scale range
2425 newScaleFactor = impl->pageClient->adjustScaleWithViewport(newScaleFactor);
2427 // scale contents' size with new scale factor
2428 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2429 contentsSize.scale(newScaleFactor);
2431 contentsSize.scale(newScaleFactor / scaleFactor);
2434 #if ENABLE(TIZEN_ISF_PORT)
2435 Ecore_X_Window rootWin = ecore_x_window_root_first_get();
2436 ecore_x_event_mask_set(rootWin, ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
2437 Ecore_X_Atom xAtom = ecore_x_atom_get("X External Keyboard Exist");
2438 unsigned int connectedKeyboardNum = 0;
2439 bool isExternalKeyboardConnected = false;
2441 // get connected keyboard number
2442 if (ecore_x_window_prop_card32_get(rootWin, xAtom, &connectedKeyboardNum, 1)
2443 && connectedKeyboardNum)
2444 isExternalKeyboardConnected = true;
2446 // We should treat both of ECORE_IMF_INPUT_PANEL_STATE_SHOW and ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW
2447 // as IME is shown. ECORE_IMF_INPUT_PANEL_STATE_HIDE is ignored at here.
2448 // input field zoom should not work with below conditions
2449 // 1. view is not focused
2450 // 2. external keyboard is not connected(if adjustForExternalKeyboard is true)
2451 // 3. imfContext is null(if adjustForExternalKeyboard is false)
2452 // 4. input panel state is hidden(if adjustForExternalKeyboard is false)
2453 if ((!(static_cast<PageClient*>(impl->pageClient.get()))->isViewFocused()
2454 || (adjustForExternalKeyboard && !isExternalKeyboardConnected)
2455 || (!adjustForExternalKeyboard && !impl->inputMethodContext())
2456 || (!adjustForExternalKeyboard && !impl->inputMethodContext()->isShow()))
2457 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
2458 && !(impl->pageClient->isClipboardWindowOpened())
2464 IntSize visibleSize(smartData->view.w, smartData->view.h);
2465 // caret position can be outside of visible rect.
2466 // we need to consider it.
2467 IntRect selectionRect = impl->pageProxy->getSelectionRect(true);
2468 IntRect focusedNodeRect = impl->pageClient->focusedNodeRect();
2469 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2470 selectionRect.scale(newScaleFactor);
2471 focusedNodeRect.scale(newScaleFactor);
2473 selectionRect.scale(newScaleFactor / scaleFactor);
2474 focusedNodeRect.scale(newScaleFactor / scaleFactor);
2476 if (selectionRect.isEmpty())
2480 IntPoint scrollPosition(selectionRect.x() - visibleSize.width() / 3, selectionRect.y() - visibleSize.height() / 3);
2481 // If both input field's position x and selection rect can be displayed together,
2482 // adjust scroll position to input field's position x.
2483 if (!focusedNodeRect.isEmpty()
2484 && selectionRect.x() - focusedNodeRect.x() < visibleSize.width() * 4 / 5)
2485 scrollPosition.setX(focusedNodeRect.x());
2487 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2488 impl->pageClient->setVisibleContentRect(IntRect(scrollPosition, impl->size()), newScaleFactor);
2490 if (newScaleFactor != scaleFactor)
2491 impl->pageProxy->scalePage(newScaleFactor, scrollPosition);
2493 impl->pageProxy->scrollMainFrameTo(scrollPosition);
2495 evas_object_move(smartData->image, smartData->view.x, smartData->view.y);
2499 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
2500 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
2501 static Eina_Bool _ewk_view_composite(void* data)
2503 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
2504 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2506 if (!evas_object_visible_get(smartData->image))
2507 return ECORE_CALLBACK_CANCEL;
2510 evas_object_image_size_get(smartData->image, &ow, &oh);
2511 uint8_t* pixels = static_cast<uint8_t*>(evas_object_image_data_get(smartData->image, true));
2513 RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create_for_data(pixels, CAIRO_FORMAT_ARGB32, ow, oh, cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, ow)));
2514 RefPtr<cairo_t> context = adoptRef(cairo_create(surface.get()));
2516 cairo_save(context.get());
2517 cairo_set_operator(context.get(), CAIRO_OPERATOR_CLEAR);
2518 cairo_rectangle(context.get(), 0, 0, ow, oh);
2519 cairo_fill(context.get());
2520 cairo_restore(context.get());
2522 impl->pageClient->drawContents(context.get());
2524 evas_object_image_data_set(smartData->image, pixels);
2525 evas_object_image_data_update_add(smartData->image, 0, 0, ow, oh);
2527 ewkViewFrameRendered(smartData->self);
2529 impl->compositionAnimator = 0;
2531 return ECORE_CALLBACK_CANCEL;
2535 void ewk_view_mark_for_sync(Evas_Object* ewkView)
2537 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2538 EINA_SAFETY_ON_NULL_RETURN(smartData->image);
2540 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
2541 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2543 if (!ewk_view_is_opengl_backend(ewkView)) {
2544 if (!impl->compositionAnimator)
2545 impl->compositionAnimator = ecore_animator_add(_ewk_view_composite, smartData);
2550 evas_object_image_pixels_dirty_set(smartData->image, true);
2553 static void on_pixels_for_accelerated_compositing(void* data, Evas_Object* obj)
2555 Evas_Object* ewkView = static_cast<Evas_Object*>(data);
2556 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2557 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2558 impl->pageClient->drawContents();
2561 bool ewk_view_image_native_surface_set(Evas_Object* ewkView, Evas_Native_Surface* nativeSurface)
2563 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2564 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2566 if (!smartData->image)
2569 evas_object_image_native_surface_set(smartData->image, nativeSurface);
2570 evas_object_image_pixels_get_callback_set(smartData->image, on_pixels_for_accelerated_compositing, ewkView);
2576 void _ewk_view_suspend_painting(Evas_Object* ewkView)
2578 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2579 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2581 if (!impl->suspendedPainting) {
2582 impl->pageProxy->suspendPainting();
2583 impl->suspendedPainting = true;
2587 void _ewk_view_resume_painting(Evas_Object* ewkView)
2589 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2590 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2592 if (impl->suspendedPainting) {
2593 impl->pageProxy->resumePainting();
2594 impl->suspendedPainting = false;
2598 void ewk_view_suspend(Evas_Object* ewkView)
2600 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2601 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2603 if (impl->pageProxy->estimatedProgress() < 1.0) {
2604 impl->suspendRequested = true;
2607 impl->suspendRequested = false;
2609 _ewk_view_suspend_painting(ewkView);
2611 // FIXME Workaround for suspend/resume while javascript popup is displayed.
2612 // condition ' && !private->isWaitingForJavaScriptPopupReply' is added to
2613 // skip suspendJavaScriptAndResource to prevent multiple ActiveDOMObject
2615 // During the javascript popup is displayed, PageGroupLoadDeferrer is activated,
2616 // which suspends resource loading and scheduled tasks, including ActiveDOMObject.
2617 // When ewk_view_suspend() is called during the javascript popup, scheduled tasks
2618 // will be suspended again.
2619 // Multiple suspend of ActiveDOMObject makes unintended suspend/resume status of
2620 // the ActiveDOMObject.
2621 if (!impl->suspendedResources && (!impl->isWaitingForJavaScriptPopupReply || !impl->isWaitingForApplicationCachePermission || !impl->isWaitingForExceededQuotaPopupReply)) {
2622 impl->pageProxy->suspendJavaScriptAndResource();
2623 impl->suspendedResources = true;
2626 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
2627 impl->pageProxy->suspendPlugin();
2631 void ewk_view_resume(Evas_Object* ewkView)
2633 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2634 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2636 if (impl->suspendRequested) {
2637 impl->suspendRequested = false;
2641 _ewk_view_resume_painting(ewkView);
2643 // FIXME Workaround for suspend/resume while javascript popup is displayed.
2644 // condition ' && !private->isWaitingForJavaScriptPopupReply' is added to
2645 // skip suspendJavaScriptAndResource to prevent multiple ActiveDOMObject
2647 // During the javascript popup is displayed, PageGroupLoadDeferrer is activated,
2648 // which suspends resource loading and scheduled tasks, including ActiveDOMObject.
2649 // When ewk_view_suspend() is called during the javascript popup, scheduled tasks
2650 // will be suspended again.
2651 // Multiple suspend of ActiveDOMObject makes unintended suspend/resume status of
2652 // the ActiveDOMObject.
2653 if (impl->suspendedResources && (!impl->isWaitingForJavaScriptPopupReply || !impl->isWaitingForApplicationCachePermission || !impl->isWaitingForExceededQuotaPopupReply)) {
2654 impl->pageProxy->resumeJavaScriptAndResource();
2655 impl->suspendedResources = false;
2658 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
2659 impl->pageProxy->resumePlugin();
2663 Eina_Bool ewk_view_url_request_set(Evas_Object* ewkView, const char* url, Ewk_Http_Method method, Eina_Hash* headers, const char* body)
2665 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2666 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2667 EINA_SAFETY_ON_NULL_RETURN_VAL(url, false);
2669 ResourceRequest request(String::fromUTF8(url));
2672 case EWK_HTTP_METHOD_GET:
2673 request.setHTTPMethod("GET");
2675 case EWK_HTTP_METHOD_HEAD:
2676 request.setHTTPMethod("HEAD");
2678 case EWK_HTTP_METHOD_POST:
2679 request.setHTTPMethod("POST");
2681 case EWK_HTTP_METHOD_PUT:
2682 request.setHTTPMethod("PUT");
2684 case EWK_HTTP_METHOD_DELETE:
2685 request.setHTTPMethod("DELETE");
2692 Eina_Iterator* it = eina_hash_iterator_tuple_new(headers);
2694 while (eina_iterator_next(it, &data)) {
2695 Eina_Hash_Tuple* t = static_cast<Eina_Hash_Tuple*>(data);
2696 const char* name = static_cast<const char*>(t->key);
2697 const char* value = static_cast<const char*>(t->data);
2698 request.addHTTPHeaderField(name, value);
2700 eina_iterator_free(it);
2704 request.setHTTPBody(FormData::create(body));
2706 WKRetainPtr<WKURLRequestRef> urlRequest(AdoptWK,toAPI(WebURLRequest::create(request).leakRef()));
2707 WKPageLoadURLRequest(toAPI(impl->pageProxy.get()), urlRequest.get());
2712 Eina_Bool ewk_view_plain_text_set(Evas_Object* ewkView, const char* plainText)
2714 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2715 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2717 WKRetainPtr<WKStringRef> plainTextRef(AdoptWK, WKStringCreateWithUTF8CString(plainText));
2718 WKPageLoadPlainTextString(toAPI(impl->pageProxy.get()), plainTextRef.get());
2723 Eina_Bool ewk_view_contents_set(Evas_Object* ewkView, const char* contents, size_t contentsSize, char* mimeType, char* encoding, char* baseUri)
2725 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2726 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2727 EINA_SAFETY_ON_NULL_RETURN_VAL(contents, false);
2729 if (contentsSize == 0)
2732 String mimeTypeString;
2734 mimeTypeString = String::fromUTF8(mimeType);
2736 mimeTypeString = String::fromUTF8("text/html");
2738 String encodingString;
2740 encodingString = String::fromUTF8(encoding);
2742 encodingString = String::fromUTF8("UTF-8");
2744 String baseUriString;
2746 baseUriString = String::fromUTF8(baseUri);
2748 baseUriString = String::fromUTF8("about:blank");
2750 WKRetainPtr<WKDataRef> contentsRef(AdoptWK, WKDataCreate(reinterpret_cast<const unsigned char*>(contents), contentsSize));
2751 impl->pageProxy->loadContentsbyMimeType(toImpl(contentsRef.get()), mimeTypeString, encodingString, baseUriString);
2756 Eina_Bool ewk_view_html_contents_set(Evas_Object* ewkView, const char* html, const char* baseUri)
2758 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2759 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2761 WKRetainPtr<WKStringRef> htmlString(AdoptWK, WKStringCreateWithUTF8CString(html));
2762 WKRetainPtr<WKURLRef> baseURL(AdoptWK, WKURLCreateWithUTF8CString(baseUri));
2764 WKPageLoadHTMLString(toAPI(impl->pageProxy.get()), htmlString.get(), baseURL.get());
2769 Eina_Bool ewk_view_page_visibility_state_set(Evas_Object* ewkView, Ewk_Page_Visibility_State pageVisibilityState, Eina_Bool initialState)
2771 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2772 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2774 TIZEN_LOGI("initialState (%d)", initialState);
2775 #if ENABLE(TIZEN_PAGE_VISIBILITY_API)
2776 WKPageSetPageVisibility(toAPI(impl->pageProxy.get()), static_cast<WKPageVisibilityState>(pageVisibilityState), initialState);
2783 Eina_Bool ewk_view_user_agent_set(Evas_Object* ewkView, const char* userAgent)
2785 EINA_SAFETY_ON_NULL_RETURN_VAL(userAgent, false);
2787 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2788 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2790 impl->userAgent = userAgent;
2792 WKRetainPtr<WKStringRef> userAgentString(AdoptWK, WKStringCreateWithUTF8CString(userAgent));
2793 WKPageSetCustomUserAgent(toAPI(impl->pageProxy.get()), userAgentString.get());
2798 const char* ewk_view_user_agent_get(const Evas_Object* ewkView)
2800 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2801 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
2803 if (!impl->userAgent) {
2804 WKRetainPtr<WKStringRef> userAgentString(AdoptWK, WKPageCopyUserAgent(toAPI(impl->pageProxy.get())));
2806 int length = WKStringGetMaximumUTF8CStringSize(userAgentString.get());
2807 OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length]);
2808 WKStringGetUTF8CString(userAgentString.get(), buffer.get(), length);
2809 impl->userAgent = buffer.get();
2812 return impl->userAgent;
2814 Eina_Bool ewk_view_custom_header_add(const Evas_Object* ewkView, const char* name, const char* value)
2816 #if ENABLE(TIZEN_CUSTOM_HEADERS)
2817 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2818 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2820 WKRetainPtr<WKStringRef> customHeaderName(AdoptWK, WKStringCreateWithUTF8CString(name));
2821 WKRetainPtr<WKStringRef> customHeaderValue(AdoptWK, WKStringCreateWithUTF8CString(value));
2823 WKPageAddCustomHeader(toAPI(impl->pageProxy.get()), customHeaderName.get(), customHeaderValue.get());
2826 ERR("TIZEN_CUSTOM_HEADERS not enabled!");
2831 Eina_Bool ewk_view_custom_header_remove(const Evas_Object* ewkView, const char* name)
2833 #if ENABLE(TIZEN_CUSTOM_HEADERS)
2834 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2835 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2837 WKRetainPtr<WKStringRef> customHeaderName(AdoptWK, WKStringCreateWithUTF8CString(name));
2839 WKPageRemoveCustomHeader(toAPI(impl->pageProxy.get()), customHeaderName.get());
2842 ERR("TIZEN_CUSTOM_HEADERS not enabled!");
2847 Eina_Bool ewk_view_custom_header_clear(const Evas_Object* ewkView)
2849 #if ENABLE(TIZEN_CUSTOM_HEADERS)
2850 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2851 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2853 WKPageClearCustomHeaders(toAPI(impl->pageProxy.get()));
2856 ERR("TIZEN_CUSTOM_HEADERS not enabled!");
2861 #if ENABLE(TIZEN_WEBKIT2_VIEW_VISIBILITY)
2862 Eina_Bool ewk_view_visibility_set(Evas_Object* ewkView, Eina_Bool enable)
2864 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2865 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2867 #if ENABLE(TIZEN_DRAG_SUPPORT)
2868 if (impl->pageClient->isDragMode())
2869 impl->pageClient->setDragMode(false);
2872 impl->pageClient->setIsVisible(enable);
2877 Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* ewkView, Eina_Rectangle viewArea, float scaleFactor, Evas* canvas)
2879 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
2881 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2882 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
2885 rect.origin.x = viewArea.x;
2886 rect.origin.y = viewArea.y;
2887 rect.size.width = viewArea.w;
2888 rect.size.height = viewArea.h;
2890 WKRetainPtr<WKImageRef> snapshot(AdoptWK, WKPageCreateSnapshot(toAPI(impl->pageProxy.get()), rect, scaleFactor));
2891 if (!snapshot.get())
2894 RefPtr<cairo_surface_t> screenshotSurface = adoptRef(WKImageCreateCairoSurface(snapshot.get()));
2896 Evas_Object* screenshotImage = evas_object_image_add(canvas);
2897 int surfaceWidth = cairo_image_surface_get_width(screenshotSurface.get());
2898 int surfaceHeight = cairo_image_surface_get_height(screenshotSurface.get());
2899 evas_object_image_size_set(screenshotImage, surfaceWidth, surfaceHeight);
2900 evas_object_image_colorspace_set(screenshotImage, EVAS_COLORSPACE_ARGB8888);
2902 uint8_t* pixels = static_cast<uint8_t*>(evas_object_image_data_get(screenshotImage, true));
2904 RefPtr<cairo_surface_t> imageSurface = adoptRef(cairo_image_surface_create_for_data(pixels, CAIRO_FORMAT_RGB24, surfaceWidth, surfaceHeight, cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, surfaceWidth)));
2905 RefPtr<cairo_t> cairo = adoptRef(cairo_create(imageSurface.get()));
2907 cairo_set_source_surface(cairo.get(), screenshotSurface.get(), 0, 0);
2908 cairo_rectangle(cairo.get(), 0, 0, surfaceWidth, surfaceHeight);
2909 cairo_fill(cairo.get());
2911 evas_object_image_smooth_scale_set(screenshotImage, true);
2912 evas_object_size_hint_min_set(screenshotImage, surfaceWidth, surfaceHeight);
2913 evas_object_resize(screenshotImage, surfaceWidth, surfaceHeight);
2914 evas_object_image_fill_set(screenshotImage, 0, 0, surfaceWidth, surfaceHeight);
2915 evas_object_image_data_set(screenshotImage, pixels);
2917 return screenshotImage;
2920 unsigned int ewk_view_inspector_server_start(Evas_Object* ewkView, unsigned int port)
2922 #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
2923 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd, 0);
2924 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl, 0);
2926 return impl->pageProxy->startInspectorServer(port);
2928 LOG_ERROR("TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR is disabled.\n");
2933 Eina_Bool ewk_view_inspector_server_stop(Evas_Object* ewkView)
2935 #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
2936 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd, false);
2937 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl, false);
2939 return impl->pageProxy->stopInspectorServer();
2941 LOG_ERROR("TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR is disabled.\n");
2946 void ewk_view_scroll_by(Evas_Object* ewkView, int deltaX, int deltaY)
2948 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2949 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2951 WKPageScrollBy(toAPI(impl->pageProxy.get()), toAPI(IntSize(deltaX, deltaY)));
2954 Eina_Bool ewk_view_scroll_pos_get(Evas_Object* ewkView, int* x, int* y)
2960 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2961 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2963 IntPoint scrollPosition = impl->pageClient->scrollPosition();
2965 *x = scrollPosition.x();
2967 *y = scrollPosition.y();
2972 Eina_Bool ewk_view_scroll_set(Evas_Object* ewkView, int x, int y)
2974 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2975 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2977 impl->pageProxy->scrollMainFrameTo(IntPoint(x, y));
2981 Eina_Bool ewk_view_scroll_size_get(const Evas_Object* ewkView, int* width, int* height)
2987 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2988 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2990 IntSize contentsSize = impl->pageProxy->contentsSize();
2991 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2992 contentsSize.scale(impl->pageClient->scaleFactor());
2995 if (width && contentsSize.width() > smartData->view.w)
2996 *width = contentsSize.width() - smartData->view.w;
2997 if (height && contentsSize.height() > smartData->view.h)
2998 *height = contentsSize.height() - smartData->view.h;
3002 bool ewkViewRunJavaScriptAlert(Evas_Object* ewkView, WKStringRef alertText)
3004 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3005 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3006 if (!impl->alertContext || !impl->alertContext->javascriptAlertCallback)
3008 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->alertContext->ewkView == ewkView, false);
3010 impl->isWaitingForJavaScriptPopupReply = true;
3011 int length = WKStringGetMaximumUTF8CStringSize(alertText);
3012 OwnArrayPtr<char> alertTextBuffer = adoptArrayPtr(new char[length]);
3013 WKStringGetUTF8CString(alertText, alertTextBuffer.get(), length);
3014 return impl->alertContext->javascriptAlertCallback(impl->alertContext->ewkView, alertTextBuffer.get(), impl->alertContext->userData) == EINA_TRUE;
3017 bool ewkViewRunJavaScriptConfirm(Evas_Object* ewkView, WKStringRef message)
3019 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3020 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3021 if (!impl->confirmContext || !impl->confirmContext->javascriptConfirmCallback)
3023 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->confirmContext->ewkView == ewkView, false);
3025 impl->isWaitingForJavaScriptPopupReply = true;
3026 int length = WKStringGetMaximumUTF8CStringSize(message);
3027 OwnArrayPtr<char> messageBuffer = adoptArrayPtr(new char[length]);
3028 WKStringGetUTF8CString(message, messageBuffer.get(), length);
3029 return impl->confirmContext->javascriptConfirmCallback(impl->confirmContext->ewkView, messageBuffer.get(), impl->confirmContext->userData) == EINA_TRUE;
3032 bool ewkViewRunJavaScriptPrompt(Evas_Object* ewkView, WKStringRef message, WKStringRef defaultValue)
3034 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3035 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3036 if (!impl->promptContext || !impl->promptContext->javascriptPromptCallback)
3038 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->promptContext->ewkView == ewkView, false);
3040 impl->isWaitingForJavaScriptPopupReply = true;
3041 int length = WKStringGetMaximumUTF8CStringSize(message);
3042 OwnArrayPtr<char> messageBuffer = adoptArrayPtr(new char[length]);
3043 WKStringGetUTF8CString(message, messageBuffer.get(), length);
3044 length = WKStringGetMaximumUTF8CStringSize(defaultValue);
3045 OwnArrayPtr<char> defaultValueBuffer = adoptArrayPtr(new char[length]);
3046 WKStringGetUTF8CString(defaultValue, defaultValueBuffer.get(), length);
3047 return impl->promptContext->javascriptPromptCallback(impl->promptContext->ewkView, messageBuffer.get(), defaultValueBuffer.get(), impl->promptContext->userData) == EINA_TRUE;
3050 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
3051 bool ewk_view_run_before_unload_confirm_panel(Evas_Object* ewkView, WKStringRef message)
3053 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3054 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3055 if (!impl->beforeUnloadConfirmPanelContext || !impl->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback)
3057 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->beforeUnloadConfirmPanelContext->ewkView == ewkView, false);
3059 impl->isWaitingForJavaScriptPopupReply = true;
3060 int length = WKStringGetMaximumUTF8CStringSize(message);
3061 OwnArrayPtr<char> messageBuffer = adoptArrayPtr(new char[length]);
3062 WKStringGetUTF8CString(message, messageBuffer.get(), length);
3063 bool result = impl->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback(impl->beforeUnloadConfirmPanelContext->ewkView, messageBuffer.get(), impl->beforeUnloadConfirmPanelContext->userData) == EINA_TRUE;
3068 bool ewkViewRunOpenPanel(Evas_Object* ewkView, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener)
3070 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3071 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3072 if (!impl->openpanelContext || !impl->openpanelContext->openPanelCallback)
3075 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->openpanelContext->ewkView == ewkView, false);
3077 impl->openPanelListener = listener;
3079 Eina_Bool allowMultipleFiles = WKOpenPanelParametersGetAllowsMultipleFiles(parameters) ? EINA_TRUE : EINA_FALSE;
3080 Eina_List* acceptedMimeTypes = 0;
3081 WKRetainPtr<WKArrayRef> array(AdoptWK, WKOpenPanelParametersCopyAcceptedMIMETypes(parameters));
3082 size_t len = WKArrayGetSize(array.get());
3083 for (size_t i = 0; i < len; i++) {
3084 WKTypeRef item = WKArrayGetItemAtIndex(array.get(), i);
3085 if (WKGetTypeID(item) != WKStringGetTypeID())
3087 WKStringRef mime = static_cast<WKStringRef>(item);
3088 int length = WKStringGetMaximumUTF8CStringSize(mime);
3089 char* buffer = new char[length];
3090 WKStringGetUTF8CString(mime, buffer, length);
3091 acceptedMimeTypes = eina_list_append(acceptedMimeTypes, static_cast<const void*>(const_cast<const char*>(buffer)));
3093 const char* capture = 0;
3094 #if ENABLE(MEDIA_CAPTURE)
3095 WKRetainPtr<WKStringRef> captureRef(AdoptWK, WKOpenPanelParametersCopyCapture(parameters));
3096 capture = eina_stringshare_add(toImpl(captureRef.get())->string().utf8().data());
3098 bool result = impl->openpanelContext->openPanelCallback(impl->openpanelContext->ewkView, allowMultipleFiles, acceptedMimeTypes, capture, 0);
3099 if (!acceptedMimeTypes)
3104 EINA_LIST_FOREACH(acceptedMimeTypes, list, data)
3105 delete[] (char*)data;
3106 eina_list_free(acceptedMimeTypes);
3110 void ewk_view_javascript_alert_callback_set(Evas_Object* ewkView, Ewk_View_JavaScript_Alert_Callback callback, void* userData)
3112 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3113 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3115 if (!impl->alertContext)
3116 impl->alertContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3117 impl->alertContext->javascriptAlertCallback = callback;
3118 impl->alertContext->ewkView = ewkView;
3119 impl->alertContext->userData = userData;
3122 void ewk_view_javascript_alert_reply(Evas_Object* ewkView)
3124 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3125 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3127 WKPageReplyJavaScriptAlert(toAPI(impl->page()));
3128 impl->isWaitingForJavaScriptPopupReply = false;
3131 void ewk_view_javascript_confirm_callback_set(Evas_Object* ewkView, Ewk_View_JavaScript_Confirm_Callback callback, void* userData)
3133 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3134 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3136 if (!impl->confirmContext)
3137 impl->confirmContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3138 impl->confirmContext->javascriptConfirmCallback = callback;
3139 impl->confirmContext->ewkView = ewkView;
3140 impl->confirmContext->userData = userData;
3143 void ewk_view_javascript_confirm_reply(Evas_Object* ewkView, Eina_Bool result)
3145 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3146 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3148 WKPageReplyJavaScriptConfirm(toAPI(impl->page()), result == EINA_TRUE);
3149 impl->isWaitingForJavaScriptPopupReply = false;
3152 void ewk_view_javascript_prompt_callback_set(Evas_Object* ewkView, Ewk_View_JavaScript_Prompt_Callback callback, void* userData)
3154 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3155 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3157 if (!impl->promptContext)
3158 impl->promptContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3159 impl->promptContext->javascriptPromptCallback = callback;
3160 impl->promptContext->ewkView = ewkView;
3161 impl->promptContext->userData = userData;
3164 void ewk_view_javascript_prompt_reply(Evas_Object* ewkView, const char* result)
3166 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3167 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3169 WKRetainPtr<WKStringRef> resultString(AdoptWK, WKStringCreateWithUTF8CString(result));
3170 WKPageReplyJavaScriptPrompt(toAPI(impl->page()), result ? resultString.get() : 0);
3171 impl->isWaitingForJavaScriptPopupReply = false;
3174 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
3175 void ewk_view_before_unload_confirm_panel_callback_set(Evas_Object* ewkView, Ewk_View_Before_Unload_Confirm_Panel_Callback callback, void* userData)
3177 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3178 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3180 if (!impl->beforeUnloadConfirmPanelContext)
3181 impl->beforeUnloadConfirmPanelContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3182 impl->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback = callback;
3183 impl->beforeUnloadConfirmPanelContext->ewkView = ewkView;
3184 impl->beforeUnloadConfirmPanelContext->userData = userData;
3187 void ewk_view_before_unload_confirm_panel_reply(Evas_Object* ewkView, Eina_Bool result)
3189 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3190 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3192 WKPageReplyBeforeUnloadConfirmPanel(toAPI(impl->page()), result == EINA_TRUE);
3193 impl->isWaitingForJavaScriptPopupReply = false;
3197 void ewk_view_open_panel_callback_set(Evas_Object* ewkView, Ewk_View_Open_Panel_Callback callback, void* userData)
3199 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3200 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3202 if (!impl->openpanelContext)
3203 impl->openpanelContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3205 impl->openpanelContext->openPanelCallback = callback;
3206 impl->openpanelContext->ewkView = ewkView;
3207 impl->openpanelContext->userData = userData;
3210 void ewk_view_open_panel_reply(Evas_Object* ewkView, Eina_List* fileUrls, Eina_Bool result)
3212 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3213 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3215 if (!impl->openPanelListener)
3218 unsigned int size = eina_list_count(fileUrls);
3219 if ((result == EINA_FALSE) || (size == 0)) {
3220 WKOpenPanelResultListenerCancel(impl->openPanelListener);
3221 impl->openPanelListener = 0;
3225 WKTypeRef* items = new WKTypeRef[size];
3229 KURL base(KURL(), "file://");
3230 EINA_LIST_FOREACH(fileUrls, list, data) {
3231 KURL url(base, static_cast<char*>(data));
3232 items[i++] = WKURLCreateWithUTF8CString(url.string().utf8().data());
3234 WKRetainPtr<WKArrayRef> filesArray(AdoptWK, WKArrayCreate(items, size));
3235 WKOpenPanelResultListenerChooseFiles(impl->openPanelListener, filesArray.get());
3236 impl->openPanelListener = 0;
3238 eina_list_free(fileUrls);
3241 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3242 static void didGetWebAppCapable(WKBooleanRef capable, WKErrorRef, void* context)
3244 EINA_SAFETY_ON_NULL_RETURN(capable);
3245 EINA_SAFETY_ON_NULL_RETURN(context);
3247 Ewk_View_Callback_Context* webAppContext = static_cast<Ewk_View_Callback_Context*>(context);
3249 ASSERT(webAppContext->webAppCapableCallback);
3251 TIZEN_LOGI("webAppCapableCallback exist. capable(%b)", capable);
3253 webAppContext->webAppCapableCallback(toImpl(capable)->value(), webAppContext->userData);
3255 webAppContext->webAppCapableCallback(0, webAppContext->userData);
3257 delete webAppContext;
3260 static void didGetWebAppIconURL(WKStringRef iconURL, WKErrorRef, void* context)
3262 EINA_SAFETY_ON_NULL_RETURN(iconURL);
3263 EINA_SAFETY_ON_NULL_RETURN(context);
3265 Ewk_View_Callback_Context* webAppContext = static_cast<Ewk_View_Callback_Context*>(context);
3267 EWK_VIEW_SD_GET_OR_RETURN(webAppContext->ewkView, smartData);
3268 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3270 ASSERT(webAppContext->webAppIconURLCallback);
3273 impl->webAppIconURL = toImpl(iconURL)->string().utf8().data();
3274 webAppContext->webAppIconURLCallback(impl->webAppIconURL, webAppContext->userData);
3276 webAppContext->webAppIconURLCallback(0, webAppContext->userData);
3278 delete webAppContext;
3281 static void didGetWebAppIconURLs(WKDictionaryRef iconURLs, WKErrorRef, void* context)
3283 EINA_SAFETY_ON_NULL_RETURN(iconURLs);
3284 EINA_SAFETY_ON_NULL_RETURN(context);
3286 Ewk_View_Callback_Context* webAppContext = static_cast<Ewk_View_Callback_Context*>(context);
3288 EWK_VIEW_SD_GET_OR_RETURN(webAppContext->ewkView, smartData);
3289 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3291 ASSERT(webAppContext->webAppIconURLsCallback);
3293 if (impl->webAppIconURLs) {
3295 EINA_LIST_FREE(impl->webAppIconURLs, data)
3296 ewkWebAppIconDataDelete(static_cast<Ewk_Web_App_Icon_Data*>(data));
3299 WKRetainPtr<WKArrayRef> wkKeys(AdoptWK, WKDictionaryCopyKeys(iconURLs));
3300 size_t iconURLCount = WKArrayGetSize(wkKeys.get());
3301 for (size_t i = 0; i < iconURLCount; i++) {
3302 WKStringRef urlRef = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkKeys.get(), i));
3303 WKStringRef sizeRef = static_cast<WKStringRef>(WKDictionaryGetItemForKey(iconURLs, urlRef));
3304 impl->webAppIconURLs = eina_list_append(impl->webAppIconURLs, ewkWebAppIconDataCreate(sizeRef, urlRef));
3306 TIZEN_LOGI("webAppIconURLsCallback exist. found %d icon urls", iconURLCount);
3308 webAppContext->webAppIconURLsCallback(impl->webAppIconURLs, webAppContext->userData);
3309 delete webAppContext;
3313 Eina_Bool ewk_view_web_application_capable_get(Evas_Object* ewkView, Ewk_Web_App_Capable_Get_Callback callback, void* userData)
3315 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3316 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3317 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3318 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3320 TIZEN_LOGI("callback(%d), userData(%d)", callback, userData);
3321 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3322 context->webAppCapableCallback = callback;
3323 context->ewkView = ewkView;
3324 context->userData = userData;
3326 WKPageGetWebAppCapable(toAPI(impl->pageProxy.get()), context, didGetWebAppCapable);
3334 Eina_Bool ewk_view_web_application_icon_url_get(Evas_Object* ewkView, Ewk_Web_App_Icon_URL_Get_Callback callback, void* userData)
3336 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3337 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3338 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3339 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3341 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3342 context->webAppIconURLCallback = callback;
3343 context->ewkView = ewkView;
3344 context->userData = userData;
3346 WKPageGetWebAppIconURL(toAPI(impl->page()), context, didGetWebAppIconURL);
3354 Eina_Bool ewk_view_web_application_icon_urls_get(Evas_Object* ewkView, Ewk_Web_App_Icon_URLs_Get_Callback callback, void* userData)
3356 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3357 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3358 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3359 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3361 TIZEN_LOGI("callback(%d), userData(%d)", callback, userData);
3362 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3363 context->webAppIconURLsCallback = callback;
3364 context->ewkView = ewkView;
3365 context->userData = userData;
3367 WKPageGetWebAppIconURLs(toAPI(impl->page()), context, didGetWebAppIconURLs);
3371 UNUSED_PARAM(ewkView);
3372 UNUSED_PARAM(callback);
3373 UNUSED_PARAM(userData);
3378 Eina_Bool ewk_view_command_execute(Evas_Object* ewkView, const char* command, const char* value)
3380 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3381 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3382 EINA_SAFETY_ON_NULL_RETURN_VAL(command, false);
3384 WKRetainPtr<WKStringRef> commandString(AdoptWK, WKStringCreateWithUTF8CString(command));
3385 WKRetainPtr<WKStringRef> valueString(AdoptWK, WKStringCreateWithUTF8CString(value));
3386 WKPageExecuteCommandWithArgument(toAPI(impl->pageProxy.get()), commandString.get(), valueString.get());
3391 Eina_Bool ewk_view_contents_size_get(Evas_Object* ewkView, Evas_Coord* width, Evas_Coord* height)
3398 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3399 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3401 IntSize contentsSize = impl->pageProxy->contentsSize();
3404 *width = contentsSize.width();
3406 *height = contentsSize.height();
3411 Eina_Bool ewk_view_contents_pdf_get_temp(Evas_Object* ewkView, int width, int height, const char* fileName)
3413 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
3414 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3415 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3416 EINA_SAFETY_ON_NULL_RETURN_VAL(fileName, false);
3418 IntSize contentsSize = impl->pageProxy->contentsSize();
3419 WKPageGetSnapshotPdfFile(toAPI(impl->pageProxy.get()), toAPI(IntSize(width, height)), toAPI(IntSize(contentsSize.width(), contentsSize.height())), WKStringCreateWithUTF8CString(fileName));
3427 Eina_Bool ewk_view_contents_pdf_get(Evas_Object* ewkView, int width, int height, const char* fileName)
3429 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
3430 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3431 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3432 EINA_SAFETY_ON_NULL_RETURN_VAL(fileName, false);
3434 IntSize contentsSize = impl->pageProxy->contentsSize();
3435 WKPageGetSnapshotPdfFile(toAPI(impl->pageProxy.get()), toAPI(IntSize(width, height)), toAPI(IntSize(contentsSize.width(), contentsSize.height())), WKStringCreateWithUTF8CString(fileName));
3443 static void runJavaScriptCallback(WKSerializedScriptValueRef scriptValue, WKErrorRef error, void* context)
3445 EINA_SAFETY_ON_NULL_RETURN(context);
3446 Ewk_View_Callback_Context* callbackContext = static_cast<Ewk_View_Callback_Context*>(context);
3448 if (!callbackContext->scriptExecuteCallback) {
3449 delete callbackContext;
3453 JSGlobalContextRef jsGlobalContext = ewkViewGetJavascriptGlobalContext(callbackContext->ewkView);
3456 JSValueRef value = WKSerializedScriptValueDeserialize(scriptValue, jsGlobalContext, 0);
3457 JSRetainPtr<JSStringRef> jsStringValue(JSValueToStringCopy(jsGlobalContext, value, 0));
3458 size_t length = JSStringGetMaximumUTF8CStringSize(jsStringValue.get());
3459 OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length]);
3460 JSStringGetUTF8CString(jsStringValue.get(), buffer.get(), length);
3461 callbackContext->scriptExecuteCallback(callbackContext->ewkView, buffer.get(), callbackContext->userData);
3463 callbackContext->scriptExecuteCallback(callbackContext->ewkView, 0, callbackContext->userData);
3465 delete callbackContext;
3468 Eina_Bool ewk_view_script_execute(Evas_Object* ewkView, const char* script, Ewk_View_Script_Execute_Callback callback, void* user_data)
3470 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3471 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3472 EINA_SAFETY_ON_NULL_RETURN_VAL(script, false);
3473 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->pageClient, false);
3475 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3476 context->scriptExecuteCallback = callback;
3477 context->ewkView = ewkView;
3478 context->userData = user_data;
3479 WKRetainPtr<WKStringRef> scriptString(AdoptWK, WKStringCreateWithUTF8CString(script));
3480 WKPageRunJavaScriptInMainFrame(toAPI(impl->pageProxy.get()), scriptString.get(), context, runJavaScriptCallback);
3485 #if ENABLE(TIZEN_WEB_STORAGE) && ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
3486 static void didGetWebStorageQuota(WKUInt32Ref quota, WKErrorRef error, void* context)
3488 Ewk_View_Callback_Context* storageContext = static_cast<Ewk_View_Callback_Context*>(context);
3491 storageContext->webStorageQuotaCallback(toImpl(quota)->value(), storageContext->userData);
3493 storageContext->webStorageQuotaCallback(0, storageContext->userData);
3495 delete storageContext;
3499 Eina_Bool ewk_view_web_storage_quota_get(const Evas_Object* ewkView, Ewk_Web_Storage_Quota_Get_Callback resultCallback, void* userData)
3501 #if ENABLE(TIZEN_WEB_STORAGE) && ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
3502 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, false);
3503 EINA_SAFETY_ON_NULL_RETURN_VAL(resultCallback, false);
3504 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3505 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3506 TIZEN_LOGI("resultCallback (%p)", resultCallback);
3508 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3509 context->webStorageQuotaCallback = resultCallback;
3510 context->userData = userData;
3512 WKPageRef pageRef = toAPI(impl->page());
3513 WKPageGetWebStorageQuota(pageRef, context, didGetWebStorageQuota);
3521 Eina_Bool ewk_view_web_storage_quota_set(Evas_Object* ewkView, uint32_t quota)
3523 #if ENABLE(TIZEN_WEB_STORAGE)
3524 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, false);
3525 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3526 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3528 TIZEN_LOGI("quota (%d)", quota);
3529 WKPageRef pageRef = toAPI(impl->page());
3530 WKPageSetWebStorageQuota(pageRef, quota);
3538 static void getContentsAsStringCallback(WKStringRef plain_text, WKErrorRef error, void* context)
3540 EINA_SAFETY_ON_NULL_RETURN(context);
3541 Ewk_View_Callback_Context* callbackContext = static_cast<Ewk_View_Callback_Context*>(context);
3543 ASSERT(callbackContext->plainTextGetCallback);
3546 size_t length = WKStringGetMaximumUTF8CStringSize(plain_text);
3547 OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length]);
3548 WKStringGetUTF8CString(plain_text, buffer.get(), length);
3550 callbackContext->plainTextGetCallback(callbackContext->ewkView, buffer.get(), callbackContext->userData);
3552 callbackContext->plainTextGetCallback(callbackContext->ewkView, 0, callbackContext->userData);
3554 delete callbackContext;
3557 Eina_Bool ewk_view_plain_text_get(Evas_Object* ewkView, Ewk_View_Plain_Text_Get_Callback callback, void* user_data)
3559 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3560 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3561 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3562 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->pageClient, false);
3564 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3565 context->plainTextGetCallback = callback;
3566 context->ewkView = ewkView;
3567 context->userData = user_data;
3568 WKPageGetContentsAsString(toAPI(impl->pageProxy.get()), context, getContentsAsStringCallback);
3573 #if ENABLE(TIZEN_SUPPORT_MHTML)
3576 * Callback function used for ewk_view_mhtml_data_get().
3578 static void getContentsAsMHTMLCallback(WKDataRef wkData, WKErrorRef, void* context)
3580 EINA_SAFETY_ON_NULL_RETURN(context);
3581 Ewk_View_Callback_Context* callbackContext = static_cast<Ewk_View_Callback_Context*>(context);
3583 ASSERT(callbackContext->mhtmlDataGetCallback);
3585 callbackContext->mhtmlDataGetCallback(callbackContext->ewkView, reinterpret_cast<const char*>(WKDataGetBytes(wkData)), callbackContext->userData);
3587 delete callbackContext;
3590 Eina_Bool ewk_view_mhtml_data_get(Evas_Object* ewkView, Ewk_View_MHTML_Data_Get_Callback callback, void* user_data)
3592 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3593 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3594 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3596 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3597 context->mhtmlDataGetCallback = callback;
3598 context->ewkView = ewkView;
3599 context->userData = user_data;
3601 WKPageGetContentsAsMHTMLData(toAPI(impl->page()), false, context, getContentsAsMHTMLCallback);
3605 #endif // ENABLE(TIZEN_SUPPORT_MHTML)
3607 Ewk_Hit_Test* ewk_view_hit_test_new(Evas_Object* ewkView, int x, int y, int hitTestMode)
3609 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
3610 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3611 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3613 IntPoint pointForHitTest = impl->transformFromScene().mapPoint(IntPoint(x, y));
3614 WebHitTestResult::Data hitTestResultData = impl->pageProxy->hitTestResultAtPoint(pointForHitTest, hitTestMode);
3615 Ewk_Hit_Test* hitTest = ewkHitTestCreate(hitTestResultData);
3623 Ewk_History* ewk_view_history_get(Evas_Object* ewkView)
3625 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, 0);
3626 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3627 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3628 WebPageProxy* page = impl->page();
3629 EINA_SAFETY_ON_NULL_RETURN_VAL(page, 0);
3631 return ewkHistoryCreate(WKPageGetBackForwardList(toAPI(page)));
3634 Eina_Bool ewk_view_recording_surface_enable_set(Evas_Object* ewkView, Eina_Bool enable)
3636 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3637 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3639 WKPageRecordingSurfaceSetEnable(toAPI(impl->pageProxy.get()), enable);
3644 Eina_Bool ewk_view_notification_closed(Evas_Object* ewkView, Eina_List* ewkNotifications)
3646 #if ENABLE(TIZEN_NOTIFICATIONS)
3647 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3648 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3649 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context, false);
3651 TIZEN_LOGI("ewkNotifications (%p)", ewkNotifications);
3652 if (!eina_list_count(ewkNotifications))
3655 Eina_List* listIterator = 0;
3657 Vector<WKTypeRef> ids;
3658 EINA_LIST_FOREACH(ewkNotifications, listIterator, data) {
3659 Ewk_Notification* notification = static_cast<Ewk_Notification*>(data);
3660 WKUInt64Ref idRef = WKUInt64Create(ewk_notification_id_get(notification));
3662 impl->notifications = eina_list_remove(impl->notifications, notification);
3665 WKRetainPtr<WKArrayRef> notificationIDsArray(AdoptWK, WKArrayCreate(ids.data(), ids.size()));
3666 WKNotificationManagerRef notificationManager = WKContextGetNotificationManager(impl->context->wkContext());
3667 WKNotificationManagerProviderDidCloseNotifications(notificationManager, notificationIDsArray.get());
3668 ewkNotificationDeleteNotificationList(ewkNotifications);
3676 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
3677 static Eina_List* createPopupMenuList(const Vector<WebPopupItem>& items)
3679 Eina_List* popupItems = 0;
3680 size_t size = items.size();
3681 for (size_t i = 0; i < size; ++i)
3682 popupItems = eina_list_append(popupItems, Ewk_Popup_Menu_Item::create(items[i]).leakPtr());
3683 TIZEN_LOGI("size : %d", size);
3687 static void releasePopupMenuList(Eina_List* popupMenuItems)
3689 if (!popupMenuItems)
3693 EINA_LIST_FREE(popupMenuItems, item)
3694 delete static_cast<Ewk_Popup_Menu_Item*>(item);
3698 Eina_Bool ewk_view_popup_menu_close(Evas_Object* ewkView)
3700 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3701 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3702 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
3704 TIZEN_LOGI("proxy : %p", impl->popupMenuProxy);
3707 if (!impl->popupMenuProxy)
3710 impl->popupMenuProxy = 0;
3712 if (smartData->api->popup_menu_hide)
3713 smartData->api->popup_menu_hide(smartData);
3714 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
3715 ewk_view_touch_events_enabled_set(ewkView, true);
3717 releasePopupMenuList(impl->popupMenuItems);
3718 impl->popupMenuItems = 0;
3721 EINA_LIST_FREE(impl->popupMenuItems, item)
3722 delete static_cast<Ewk_Popup_Menu_Item*>(item);
3728 Eina_Bool ewk_view_popup_menu_select(Evas_Object* ewkView, unsigned int selectedIndex)
3730 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3731 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3732 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->popupMenuProxy, false);
3734 TIZEN_LOGI("proxy : %p / index : %d", impl->popupMenuProxy, selectedIndex);
3736 if (!impl->popupMenuItems)
3740 if (selectedIndex >= eina_list_count(impl->popupMenuItems))
3743 impl->popupMenuProxy->valueChanged(selectedIndex);
3748 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
3749 void ewk_view_popup_menu_update(Evas_Object* ewkView, TextDirection textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex)
3751 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3752 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3753 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
3754 TIZEN_LOGI("proxy : %p", impl->popupMenuProxy);
3756 if (!impl->popupMenuProxy)
3759 if (!smartData->api->popup_menu_update)
3762 releasePopupMenuList(impl->popupMenuItems);
3763 impl->popupMenuItems = createPopupMenuList(items);
3765 // TODO: Instead of passing a dummy rect, updated rect should be coming from WebProcess
3766 smartData->api->popup_menu_update(smartData, IntRect(), static_cast<Ewk_Text_Direction>(textDirection), impl->popupMenuItems, selectedIndex);
3770 #if ENABLE(TIZEN_MULTIPLE_SELECT)
3771 Eina_Bool ewk_view_popup_menu_multiple_select(Evas_Object* ewkView, Eina_Inarray* changeList)
3773 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3774 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3775 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->popupMenuProxy, false);
3777 Vector<int> selectedIndex;
3779 if (!impl->popupMenuItems)
3784 itr = eina_inarray_iterator_new(changeList);
3785 EINA_ITERATOR_FOREACH(itr, data)
3787 int* pData = static_cast<int*>(data);
3788 selectedIndex.append(*pData);
3790 eina_iterator_free(itr);
3792 impl->popupMenuProxy->multipleValueChanged(selectedIndex);
3797 void ewk_view_orientation_send(Evas_Object* ewkView, int orientation)
3799 #if ENABLE(TIZEN_ORIENTATION_EVENTS)
3800 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3801 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3802 TIZEN_LOGI("orientation : %d", orientation);
3804 if (orientation != 0 && orientation != 90 && orientation != -90 && orientation != 180)
3807 if (impl->orientation == orientation)
3810 impl->orientation = orientation;
3812 impl->pageProxy->sendOrientationChangeEvent(orientation);
3816 void ewkViewFrameRendered(Evas_Object* ewkView)
3818 evas_object_smart_callback_call(ewkView, "frame,rendered", 0);
3821 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3822 Eina_Bool ewk_view_text_selection_enable_set(Evas_Object* ewkView, Eina_Bool enable)
3824 return ewk_settings_text_selection_enabled_set(ewk_view_settings_get(ewkView), enable);
3827 Eina_Bool ewk_view_text_selection_range_get(Evas_Object* ewkView, Eina_Rectangle* leftRect, Eina_Rectangle* rightRect)
3829 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3830 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3832 IntRect leftSelectionRect;
3833 IntRect rightSelectionRect;
3834 if (!impl->pageProxy->getSelectionHandlers(leftSelectionRect, rightSelectionRect)) {
3847 AffineTransform contentToScreen = impl->transformToScene();
3848 leftSelectionRect = contentToScreen.mapRect(leftSelectionRect);
3849 rightSelectionRect = contentToScreen.mapRect(rightSelectionRect);
3851 leftRect->x = leftSelectionRect.x();
3852 leftRect->y = leftSelectionRect.y();
3853 leftRect->w = leftSelectionRect.width();
3854 leftRect->h = leftSelectionRect.height();
3856 rightRect->x = rightSelectionRect.x();
3857 rightRect->y = rightSelectionRect.y();
3858 rightRect->w = rightSelectionRect.width();
3859 rightRect->h = rightSelectionRect.height();
3864 const char* ewk_view_text_selection_text_get(Evas_Object* ewkView)
3866 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3867 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3869 const CString selectedString = impl->pageProxy->getSelectionText().utf8();
3870 impl->selectedText = selectedString.data();
3872 return impl->selectedText;
3875 Eina_Bool ewk_view_auto_clear_text_selection_mode_set(Evas_Object* ewkView, Eina_Bool enable)
3877 return ewk_settings_clear_text_selection_automatically_set(ewk_view_settings_get(ewkView), enable);
3880 Eina_Bool ewk_view_auto_clear_text_selection_mode_get(Evas_Object* ewkView)
3882 return ewk_settings_clear_text_selection_automatically_get(ewk_view_settings_get(ewkView));
3884 #endif // #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3886 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3887 void ewkViewInputPickerRequest(Evas_Object* ewkView, Ewk_Input_Type inputType, const String& inputValue)
3889 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3890 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
3891 EINA_SAFETY_ON_NULL_RETURN(smartData->api->input_picker_show);
3893 smartData->api->input_picker_show(smartData, inputType, inputValue.utf8().data());
3897 #if ENABLE(TIZEN_VIEWPORT_META_TAG)
3898 void ewkViewGetWindowFrame(Evas_Object* ewkView, int *x, int *y, int *w, int *h)
3900 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3901 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3902 IntPoint drawingPosition = (IntPoint)(impl->pageClient->visibleContentRect().location() - impl->pageClient->scrollPosition());
3904 *x = drawingPosition.x();
3906 *y = drawingPosition.y();
3908 *w = impl->pageClient->visibleContentRect().width();
3910 *h = impl->pageClient->visibleContentRect().height();
3914 void ewk_view_focused_input_element_value_set(Evas_Object* ewkView, const char* value)
3916 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3917 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3918 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3920 impl->pageProxy->setFocusedInputElementValue(String::fromUTF8(value));
3921 #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3924 const char* ewk_view_focused_input_element_value_get(Evas_Object* ewkView)
3926 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3927 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3928 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3930 impl->inputValue = impl->pageProxy->getFocusedInputElementValue().utf8().data();
3931 return impl->inputValue;
3934 #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3937 #if ENABLE(TIZEN_DATALIST_ELEMENT)
3938 void ewkViewDataListShowRequest(Evas_Object* ewkView, Ewk_Input_Type inputType, Vector<String> optionList)
3940 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3941 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3942 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
3943 EINA_SAFETY_ON_NULL_RETURN(smartData->api->data_list_show);
3946 ewkViewDataListHideRequest(ewkView, inputType);
3948 for (Vector<String>::const_iterator it = optionList.begin(); it != optionList.end(); ++it) {
3950 impl->dataList = eina_list_append(impl->dataList, eina_stringshare_add(value.utf8().data()));
3953 smartData->api->data_list_show(smartData, inputType, impl->dataList);
3956 void ewkViewDataListHideRequest(Evas_Object* ewkView, Ewk_Input_Type inputType)
3958 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3959 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3960 EINA_SAFETY_ON_NULL_RETURN(impl->dataList);
3961 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
3962 EINA_SAFETY_ON_NULL_RETURN(smartData->api->data_list_hide);
3964 impl->deleteDataList();
3966 smartData->api->data_list_hide(smartData, inputType);
3970 void ewk_view_data_list_close(Evas_Object* ewkView, const char* value)
3972 #if ENABLE(TIZEN_DATALIST_ELEMENT)
3973 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3974 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3976 impl->deleteDataList();
3978 ewk_view_focused_input_element_value_set(ewkView, value);
3982 Eina_Bool ewk_view_horizontal_panning_hold_get(Evas_Object* ewkView)
3984 #if ENABLE(TIZEN_GESTURE)
3985 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3986 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3987 return impl->holdHorizontalPanning;
3993 void ewk_view_horizontal_panning_hold_set(Evas_Object* ewkView, Eina_Bool hold)
3995 #if ENABLE(TIZEN_GESTURE)
3996 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3997 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3998 impl->holdHorizontalPanning = hold;
4002 Eina_Bool ewk_view_vertical_panning_hold_get(Evas_Object* ewkView)
4004 #if ENABLE(TIZEN_GESTURE)
4005 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4006 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4007 return impl->holdVerticalPanning;
4013 void ewk_view_vertical_panning_hold_set(Evas_Object* ewkView, Eina_Bool hold)
4015 #if ENABLE(TIZEN_GESTURE)
4016 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4017 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4018 impl->holdVerticalPanning = hold;
4022 void ewk_view_touch_event_handler_result_set(Evas_Object* ewkView, WebKit::WebEvent::Type type, bool wasHandled)
4024 #if ENABLE(TIZEN_GESTURE)
4025 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4026 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4028 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
4029 if (impl->focusRing && wasHandled)
4030 impl->focusRing->hide();
4031 #endif // #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
4033 if (impl->mouseEventsEnabled())
4036 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
4037 if (wasHandled && impl->pageClient->isTextSelectionMode()) {
4038 if (type == WebEvent::TouchStart)
4039 impl->pageClient->updateTextSelectionHandlesAndContextMenu(false);
4040 else if (type == WebEvent::TouchMove)
4041 impl->pageClient->updateTextSelectionHandlesAndContextMenu(false);
4042 else if (type == WebEvent::TouchEnd)
4043 impl->pageClient->requestToShowTextSelectionHandlesAndContextMenu();
4047 // We have to check TouchStart, TouchMove and TouchEnd with handled.
4048 // The Pan and Flick will be enabled if Touch Start was not handled,
4049 // and Touch Move was not handled or did not occur.
4050 // Tap will be enabled if Touch Start and End was not handled
4051 // and Touch Move did not occur.
4052 // The gestures are disabled as a default.
4053 // o: handled, x: not handled
4054 // ------------------------------------------------------------
4055 // Touch Start | Touch Move | Touch End || Tap | Pan, Flick
4056 // ------------------------------------------------------------
4057 // o | o or x | o or x || disable | disable
4058 // x | o | o or x || disable | disable
4059 // x | x | o or x || disable | enable
4060 // x |not occured | x || enable | enable
4061 // ------------------------------------------------------------
4062 if (type == WebEvent::TouchStart) {
4063 impl->gestureClient->setGestureEnabled(!wasHandled);
4064 impl->wasHandledTouchStart = wasHandled;
4066 // Initialize wasHandledTouchMove to true and notify that to the application
4067 // to prevent applications scrolling at the beginning of touch.
4068 impl->wasHandledTouchMove = true;
4069 evas_object_smart_callback_call(ewkView, "touchmove,handled", static_cast<void*>(&impl->wasHandledTouchMove));
4070 } else if (type == WebEvent::TouchMove) {
4071 impl->gestureClient->setMovingEnabled(!wasHandled);
4073 // We have to set wasHandled to true if touchstart was handled even though current touchmove was not handled.
4074 if (impl->wasHandledTouchStart)
4077 // Notify the result of touchmove to applications when handled value is changed
4078 // in order to make applications to choose whether scrolling its scrollable objects or not.
4079 if (impl->wasHandledTouchMove != wasHandled)
4080 evas_object_smart_callback_call(ewkView, "touchmove,handled", static_cast<void*>(&wasHandled));
4081 impl->wasHandledTouchMove = wasHandled;
4082 } else if (type == WebEvent::TouchEnd && !impl->exceedTouchMoveThreshold && !wasHandled) {
4083 impl->gestureClient->setMovingEnabled(!wasHandled);
4084 impl->gestureClient->setTapEnabled(!wasHandled);
4089 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
4090 void ewkViewDidGetTextStyleStateForSelection(Evas_Object* ewkView, int underlineState, int italicState, int boldState, const IntPoint& startPoint, const IntPoint& endPoint)
4092 Ewk_Text_Style* textStyle = ewkTextStyleCreate(underlineState, italicState, boldState, startPoint, endPoint);
4093 evas_object_smart_callback_call(ewkView, "text,style,state", static_cast<void*>(textStyle));
4094 ewkTextStyleDelete(textStyle);
4098 #if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT)
4099 bool ewk_view_orientation_lock(Evas_Object* ewkView, int willLockOrientation)
4101 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4102 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
4104 TIZEN_LOGI("willLockOrientation (%d)", willLockOrientation);
4105 if (!smartData->api->orientation_lock) {
4110 return smartData->api->orientation_lock(smartData, willLockOrientation);
4113 void ewk_view_orientation_unlock(Evas_Object* ewkView)
4115 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4116 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
4118 TIZEN_LOGI("ewkView (%p)", ewkView);
4119 if (!smartData->api->orientation_unlock) {
4124 smartData->api->orientation_unlock(smartData);
4128 void ewk_view_orientation_lock_callback_set(Evas_Object* ewkView, Ewk_Orientation_Lock_Cb func, void* data)
4130 #if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL)
4131 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4132 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4133 TIZEN_LOGI("callbacks: %p / data: %p", func, data);
4135 impl->orientationLock.callback = func;
4136 impl->orientationLock.data = data;
4140 #if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL)
4141 Eina_Bool _ewk_orientation_lock(Ewk_View_Smart_Data *sd, int orientations)
4143 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl, false);
4144 TIZEN_LOGI("locked orientations : %d", orientations);
4146 if (impl->orientationLock.callback)
4147 return impl->orientationLock.callback(sd->self, true, orientations, impl->orientationLock.data);
4152 void _ewk_orientation_unlock(Ewk_View_Smart_Data *sd)
4154 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
4155 TIZEN_LOGI("unlock is requested");
4157 if (impl->orientationLock.callback)
4158 impl->orientationLock.callback(sd->self, false, 0, impl->orientationLock.data);
4162 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
4163 bool ewk_view_is_opengl_backend(Evas_Object* ewkView)
4165 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4167 Ecore_Evas* ee = ecore_evas_ecore_evas_get(smartData->base.evas);
4168 const char *engine = ecore_evas_engine_name_get(ee);
4169 if (engine && !strcmp(engine, "opengl_x11"))
4175 void ewk_view_zoomable_area_set(Evas_Object* ewkView, const IntPoint& target, const IntRect& area)
4177 #if ENABLE(TIZEN_GESTURE)
4178 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4179 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4181 impl->gestureClient->setZoomableArea(target, area);
4185 #if ENABLE(TIZEN_BACKFORWARD_LIST_CLEAR)
4186 void ewk_view_back_forward_list_clear(const Evas_Object* ewkView)
4188 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4189 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4191 WKBackForwardListClearBackForwardList(WKPageGetBackForwardList(toAPI(impl->pageProxy.get())));
4195 #if ENABLE(TIZEN_SIGNAL_APP_BACK_FORWARD_LIST_CHANGED)
4196 void ewkViewBackForwardListChanged(Evas_Object* ewkView)
4198 evas_object_smart_callback_call(ewkView, "back,forward,list,changed", 0);
4202 #if ENABLE(TIZEN_ICON_DATABASE)
4203 void ewkViewIconReceived(Evas_Object* ewkView)
4207 evas_object_smart_callback_call(ewkView, "icon,received", 0);
4211 #endif // #if OS(TIZEN)
4213 Eina_Bool ewk_view_feed_touch_event(Evas_Object* ewkView, Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers)
4215 #if ENABLE(TOUCH_EVENTS)
4216 EINA_SAFETY_ON_NULL_RETURN_VAL(points, false);
4217 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4218 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4220 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
4221 if (impl->pageClient->isTextSelectionMode() && eina_list_count(points) == 1) {
4222 Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(eina_list_data_get(points));
4223 IntPoint handlePoint(point->x, point->y);
4225 if (type == EWK_TOUCH_START)
4226 impl->pageClient->textSelectonHandleDown(handlePoint);
4227 else if (type == EWK_TOUCH_MOVE)
4228 impl->pageClient->textSelectonHandleMove(handlePoint);
4230 impl->pageClient->textSelectonHandleUp();
4234 #if ENABLE(TIZEN_GESTURE)
4235 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
4236 // We don't want to process touch event when context menu is shown.
4237 if (impl->pageClient->isContextMenuVisible() && type != EWK_TOUCH_CANCEL)
4240 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
4241 if (impl->pageClient->isTextSelectionDowned() && type != EWK_TOUCH_CANCEL)
4245 if (type == EWK_TOUCH_START) {
4246 if (eina_list_count(points) == 1) {
4247 impl->gestureClient->reset();
4248 Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(eina_list_data_get(points));
4249 impl->touchDownPoint.x = point->x;
4250 impl->touchDownPoint.y = point->y;
4251 impl->exceedTouchMoveThreshold = false;
4253 } else if (type == EWK_TOUCH_MOVE && !impl->exceedTouchMoveThreshold) {
4254 if (eina_list_count(points) == 1) {
4255 unsigned int threshold = elm_config_scroll_thumbscroll_threshold_get();
4256 Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(eina_list_data_get(points));
4257 int diffX = impl->touchDownPoint.x - point->x;
4258 int diffY = impl->touchDownPoint.y - point->y;
4259 if (static_cast<unsigned int>(diffX * diffX + diffY * diffY) > threshold * threshold)
4260 impl->exceedTouchMoveThreshold = true;
4264 impl->exceedTouchMoveThreshold = true;
4267 #endif // #if ENABLE(TIZEN_GESTURE)
4269 // FIXME: impl is used in the webkit opensource, but tizen webkit does not use it yet.
4270 //impl->page()->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, impl->transformFromScene(), impl->transformToScreen(), ecore_time_get()));
4271 impl->pageProxy->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, impl->transformFromScene(), impl->transformToScreen(), ecore_time_get()));
4279 Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object* ewkView, Eina_Bool enabled)
4281 #if ENABLE(TOUCH_EVENTS)
4282 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4283 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4285 impl->setTouchEventsEnabled(!!enabled);
4293 Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object* ewkView)
4295 #if ENABLE(TOUCH_EVENTS)
4296 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4297 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4299 return impl->touchEventsEnabled();
4305 Eina_Bool ewk_view_main_frame_scrollbar_visible_set(Evas_Object* ewkView, Eina_Bool visible)
4307 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
4308 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4309 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4311 impl->mainFrameScrollbarVisibility = visible;
4312 impl->pageClient->updateVisibility();
4320 Eina_Bool ewk_view_main_frame_scrollbar_visible_get(const Evas_Object* ewkView)
4322 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
4323 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4324 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4326 return impl->mainFrameScrollbarVisibility;
4332 Eina_Bool ewk_view_page_save(Evas_Object* ewkView, const char* path)
4334 #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE)
4335 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4336 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4337 EINA_SAFETY_ON_NULL_RETURN_VAL(path, false);
4339 String title = ewk_view_title_get(ewkView);
4340 String url = ewk_view_url_get(ewkView);
4341 String directoryPath(path);
4342 impl->pageClient->startOfflinePageSave(directoryPath, url, title);
4346 UNUSED_PARAM(ewkView);
4354 * Callback function used for ewk_view_page_contents_get().
4356 static void ewkViewPageContentsAsMHTMLCallback(WKDataRef wkData, WKErrorRef, void* context)
4358 EINA_SAFETY_ON_NULL_RETURN(context);
4360 RefPtr<WebData> webData = toImpl(wkData);
4361 Ewk_Page_Contents_Context* contentsContext= static_cast<Ewk_Page_Contents_Context*>(context);
4362 contentsContext->callback(contentsContext->type, reinterpret_cast<const char*>(webData->bytes()));
4367 * Callback function used for ewk_view_page_contents_get().
4369 static void ewkViewPageContentsAsStringCallback(WKStringRef wkString, WKErrorRef, void* context)
4371 EINA_SAFETY_ON_NULL_RETURN(context);
4373 RefPtr<WebString> webString = toImpl(wkString);
4374 Ewk_Page_Contents_Context* contentsContext= static_cast<Ewk_Page_Contents_Context*>(context);
4375 contentsContext->callback(contentsContext->type, webString->string().utf8().data());
4378 Eina_Bool ewk_view_page_contents_get(const Evas_Object* ewkView, Ewk_Page_Contents_Context* context)
4380 EINA_SAFETY_ON_NULL_RETURN_VAL(context, false);
4381 EINA_SAFETY_ON_NULL_RETURN_VAL(context->callback, false);
4382 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4383 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4385 switch (context->type) {
4386 case EWK_PAGE_CONTENTS_TYPE_MHTML:
4387 impl->pageProxy->getContentsAsMHTMLData(DataCallback::create(context, ewkViewPageContentsAsMHTMLCallback), false);
4390 case EWK_PAGE_CONTENTS_TYPE_STRING:
4391 impl->pageProxy->getContentsAsString(StringCallback::create(context, ewkViewPageContentsAsStringCallback));
4395 ASSERT_NOT_REACHED();
4402 Eina_Bool ewk_view_animated_scroll_set(Evas_Object* ewkView, int x, int y)
4404 #if ENABLE(TIZEN_GESTURE)
4405 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4406 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4408 return impl->gestureClient->scrollToWithAnimation(x, y);
4410 UNUSED_PARAM(ewkView);
4417 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
4418 void ewkViewFocusRingHide(Evas_Object* ewkView)
4420 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4421 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4423 if (impl->focusRing)
4424 impl->focusRing->hide();
4428 void ewk_view_content_security_policy_set(Evas_Object* ewkView, const char* policy, Ewk_CSP_Header_Type type)
4430 #if ENABLE(TIZEN_CSP)
4431 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
4432 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
4434 TIZEN_LOGI("policy(%s), type(%d)\n", policy, type);
4435 impl->pageProxy->setContentSecurityPolicy(String::fromUTF8(policy), static_cast<WebCore::ContentSecurityPolicy::HeaderType>(type));
4439 #if ENABLE(TIZEN_APPLICATION_CACHE)
4440 Eina_Bool ewkViewRequestApplicationCachePermission(Evas_Object* ewkView, WKSecurityOriginRef origin)
4442 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4443 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4445 if (!impl->applicationCachePermissionContext || !impl->applicationCachePermissionContext->applicationCachePermissionCallback)
4448 impl->isWaitingForApplicationCachePermission = true;
4449 if (impl->applicationCachePermissionOrigin)
4450 deleteSecurityOrigin(impl->applicationCachePermissionOrigin);
4451 impl->applicationCachePermissionOrigin = createSecurityOrigin(origin);
4453 return impl->applicationCachePermissionContext->applicationCachePermissionCallback(ewkView, impl->applicationCachePermissionOrigin, impl->applicationCachePermissionContext->userData) == EINA_TRUE;
4457 void ewk_view_application_cache_permission_callback_set(Evas_Object* ewkView, Ewk_View_Applicacion_Cache_Permission_Callback callback, void* userData)
4459 #if ENABLE(TIZEN_APPLICATION_CACHE)
4460 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4461 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4463 if (!impl->applicationCachePermissionContext)
4464 impl->applicationCachePermissionContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
4465 impl->applicationCachePermissionContext->applicationCachePermissionCallback = callback;
4466 impl->applicationCachePermissionContext->userData = userData;
4468 UNUSED_PARAM(ewkView);
4469 UNUSED_PARAM(callback);
4470 UNUSED_PARAM(userData);
4474 void ewk_view_application_cache_permission_reply(Evas_Object* ewkView, Eina_Bool allow)
4476 #if ENABLE(TIZEN_APPLICATION_CACHE)
4477 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4478 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4480 TIZEN_LOGI("allow %d", allow);
4481 WKPageReplyApplicationCachePermission(toAPI(impl->page()), allow);
4482 if (impl->applicationCachePermissionOrigin)
4483 deleteSecurityOrigin(impl->applicationCachePermissionOrigin);
4484 impl->applicationCachePermissionOrigin = 0;
4485 impl->isWaitingForApplicationCachePermission = false;
4487 UNUSED_PARAM(ewkView);
4488 UNUSED_PARAM(allow);
4492 #if ENABLE(TIZEN_INDEXED_DATABASE)
4493 bool ewkViewExceededIndexedDatabaseQuota(Evas_Object* ewkView, WKSecurityOriginRef origin, long long currentUsage)
4495 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4496 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4498 if (!impl->exceededIndexedDatabaseQuotaContext || !impl->exceededIndexedDatabaseQuotaContext->exceededIndexedDatabaseQuotaCallback)
4501 impl->isWaitingForExceededQuotaPopupReply = true;
4502 if (impl->exceededQuotaOrigin)
4503 deleteSecurityOrigin(impl->exceededQuotaOrigin);
4504 impl->exceededQuotaOrigin = createSecurityOrigin(origin);
4506 TIZEN_LOGI("currentUsage(%lld)", currentUsage);
4508 return impl->exceededIndexedDatabaseQuotaContext->exceededIndexedDatabaseQuotaCallback(ewkView, impl->exceededQuotaOrigin, currentUsage, impl->exceededIndexedDatabaseQuotaContext->userData) == EINA_TRUE;
4512 void ewk_view_exceeded_indexed_database_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback, void* userData)
4514 #if ENABLE(TIZEN_INDEXED_DATABASE)
4515 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4516 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4518 if (!impl->exceededIndexedDatabaseQuotaContext)
4519 impl->exceededIndexedDatabaseQuotaContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
4520 impl->exceededIndexedDatabaseQuotaContext->exceededIndexedDatabaseQuotaCallback = callback;
4521 impl->exceededIndexedDatabaseQuotaContext->userData = userData;
4523 UNUSED_PARAM(ewkView);
4524 UNUSED_PARAM(callback);
4525 UNUSED_PARAM(userData);
4529 void ewk_view_exceeded_indexed_database_quota_reply(Evas_Object* ewkView, Eina_Bool allow)
4531 #if ENABLE(TIZEN_INDEXED_DATABASE)
4532 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4533 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4535 TIZEN_LOGI("allow %d", allow);
4536 WKPageReplyExceededIndexedDatabaseQuota(toAPI(impl->page()), allow == EINA_TRUE);
4537 if (impl->exceededQuotaOrigin)
4538 deleteSecurityOrigin(impl->exceededQuotaOrigin);
4539 impl->exceededQuotaOrigin = 0;
4540 impl->isWaitingForExceededQuotaPopupReply = false;
4542 UNUSED_PARAM(ewkView);
4543 UNUSED_PARAM(allow);
4547 // EwkFindOptions should be matched up orders with WkFindOptions.
4548 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_CASE_INSENSITIVE, kWKFindOptionsCaseInsensitive);
4549 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_AT_WORD_STARTS, kWKFindOptionsAtWordStarts);
4550 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START, kWKFindOptionsTreatMedialCapitalAsWordStart);
4551 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_BACKWARDS, kWKFindOptionsBackwards);
4552 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_WRAP_AROUND, kWKFindOptionsWrapAround);
4553 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_OVERLAY, kWKFindOptionsShowOverlay);
4554 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_FIND_INDICATOR, kWKFindOptionsShowFindIndicator);
4555 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT, kWKFindOptionsShowHighlight);
4557 Eina_Bool ewk_view_text_find(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount)
4559 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4560 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4561 EINA_SAFETY_ON_NULL_RETURN_VAL(text, false);
4563 impl->pageProxy->findString(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount);
4568 Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object* ewkView)
4570 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4571 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4573 impl->pageProxy->hideFindUI();
4578 Eina_Bool ewk_view_text_matches_count(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount)
4580 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4581 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4582 EINA_SAFETY_ON_NULL_RETURN_VAL(text, false);
4584 impl->pageProxy->countStringMatches(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount);