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 #if !ENABLE(TIZEN_ICON_DATABASE)
265 static void _ewk_view_on_favicon_changed(const char* pageURL, void* eventInfo)
267 Evas_Object* ewkView = static_cast<Evas_Object*>(eventInfo);
268 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
269 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
271 const char* viewURL = ewk_view_url_get(ewkView);
272 if (!viewURL || strcasecmp(viewURL, pageURL))
275 impl->informIconChange();
279 // Default Event Handling.
280 static Eina_Bool _ewk_view_smart_focus_in(Ewk_View_Smart_Data* smartData)
282 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
286 impl->pageClient->setViewFocused(true);
287 #endif // #if OS(TIZEN)
288 impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive);
289 #if ENABLE(TIZEN_ISF_PORT)
290 if (impl->inputMethodContext())
291 impl->inputMethodContext()->onFocusIn();
296 static Eina_Bool _ewk_view_smart_focus_out(Ewk_View_Smart_Data* smartData)
298 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
302 #if ENABLE(TIZEN_ISF_PORT)
303 // Keypad should be hidden rapidly when moving focus on elementary
304 // because Ecore-ime doesn't support it.
305 if (impl->inputMethodContext())
306 impl->inputMethodContext()->onFocusOut();
309 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
310 if (impl->pageClient->isTextSelectionMode())
311 impl->pageClient->setIsTextSelectionMode(false);
314 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
315 if (impl->pageClient->isContextMenuVisible())
316 impl->pageProxy->hideContextMenu();
319 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
320 if (impl->pageClient->isClipboardWindowOpened())
321 impl->pageClient->closeClipboardWindow();
324 #if ENABLE(TIZEN_DRAG_SUPPORT)
325 if (impl->pageClient->isDragMode())
326 impl->pageClient->setDragMode(false);
329 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
330 if (smartData->api->formdata_candidate_is_showing(smartData))
331 smartData->api->formdata_candidate_hide(smartData);
334 impl->pageClient->setViewFocused(false);
335 #endif // #if OS(TIZEN)
336 impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive);
340 static Eina_Bool _ewk_view_smart_mouse_wheel(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Wheel* wheelEvent)
342 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
344 impl->page()->handleWheelEvent(NativeWebWheelEvent(wheelEvent, impl->transformFromScene(), impl->transformToScreen()));
348 static Eina_Bool _ewk_view_smart_mouse_down(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Down* downEvent)
350 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
352 impl->page()->handleMouseEvent(NativeWebMouseEvent(downEvent, impl->transformFromScene(), impl->transformToScreen()));
356 static Eina_Bool _ewk_view_smart_mouse_up(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Up* upEvent)
358 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
360 impl->page()->handleMouseEvent(NativeWebMouseEvent(upEvent, impl->transformFromScene(), impl->transformToScreen()));
362 InputMethodContextEfl* inputMethodContext = impl->inputMethodContext();
363 if (inputMethodContext)
364 inputMethodContext->handleMouseUpEvent(upEvent);
369 static Eina_Bool _ewk_view_smart_mouse_move(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Move* moveEvent)
371 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
373 // FIXME: impl->page() is used in the webkit opensource, but tizen webkit does not use it yet.
374 impl->page()->handleMouseEvent(NativeWebMouseEvent(moveEvent, impl->transformFromScene(), impl->transformToScreen()));
378 static Eina_Bool _ewk_view_smart_key_down(Ewk_View_Smart_Data* smartData, const Evas_Event_Key_Down* downEvent)
380 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
382 bool isFiltered = false;
383 InputMethodContextEfl* inputMethodContext = impl->inputMethodContext();
384 if (inputMethodContext)
385 inputMethodContext->handleKeyDownEvent(downEvent, &isFiltered);
387 impl->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(downEvent, isFiltered));
391 static Eina_Bool _ewk_view_smart_key_up(Ewk_View_Smart_Data* smartData, const Evas_Event_Key_Up* upEvent)
393 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
395 impl->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(upEvent));
400 static Eina_Bool _ewk_view_smart_gesture_start(Ewk_View_Smart_Data* smartData, const Ewk_Event_Gesture* event)
402 #if ENABLE(TIZEN_GESTURE)
403 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
405 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
406 if (impl->pageClient->isTextSelectionMode() && impl->pageClient->isTextSelectionHandleDowned())
410 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
411 if (impl->focusRing) {
412 if (event->type == EWK_GESTURE_TAP && event->count == 1) {
413 impl->focusRing->requestToShow(IntPoint(event->position.x, event->position.y));
414 } else if (event->type == EWK_GESTURE_PAN) {
415 if (impl->exceedTouchMoveThreshold)
416 impl->focusRing->hide();
418 if (event->type != EWK_GESTURE_LONG_PRESS) {
419 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
420 if (!impl->pageClient->isContextMenuVisible())
422 impl->focusRing->hide();
428 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
429 if (smartData->api->formdata_candidate_is_showing(smartData))
430 smartData->api->formdata_candidate_hide(smartData);
433 switch (event->type) {
434 case EWK_GESTURE_TAP:
435 impl->gestureClient->startTap(IntPoint(event->position.x, event->position.y));
437 case EWK_GESTURE_LONG_PRESS: {
438 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
439 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
440 if (ewk_settings_text_selection_enabled_get(impl->settings()))
441 impl->pageClient->setIsTextSelectionMode(false);
443 IntPoint scenePoint(event->position.x, event->position.y);
444 IntPoint contentsPoint = impl->transformFromScene().mapPoint(scenePoint);
445 WebHitTestResult::Data hitTestResultData = impl->pageProxy->hitTestResultAtPoint(contentsPoint);
446 if (!hitTestResultData.absoluteMediaURL.isEmpty())
448 #if ENABLE(TIZEN_DRAG_SUPPORT)
449 // 1. Check to start dragging.
450 if (hitTestResultData.isDragSupport) {
451 impl->pageClient->setDragPoint(scenePoint);
452 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
454 impl->focusRing->show(IntRect(), true);
456 impl->gestureClient->showContextMenu(scenePoint);
460 // 2. Check to show context menu.
461 if (!hitTestResultData.absoluteImageURL.isEmpty()
462 || !hitTestResultData.absoluteLinkURL.isEmpty()) {
463 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
465 impl->focusRing->show(IntRect(), true);
467 impl->gestureClient->showContextMenu(scenePoint);
470 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
471 // 3. Check for text selection.
472 if (ewk_settings_text_selection_enabled_get(impl->settings())) {
473 // Process gesture_end(EWK_GESTURE_TAP) to activate the editing if node under point is editable.
474 if (hitTestResultData.context & WebHitTestResult::HitTestResultContextEditable) {
475 if (smartData->api && smartData->api->gesture_end) {
476 Ewk_Event_Gesture tapEvent = {EWK_GESTURE_TAP, event->position, {0, 0}, 0, 1, ecore_time_get() * 1000};
477 smartData->api->gesture_end(smartData, &tapEvent);
481 if (impl->pageClient->textSelectionDown(scenePoint)) {
482 impl->gestureClient->setGestureEnabled(false);
483 impl->feedTouchEventsByType(EWK_TOUCH_CANCEL);
488 #endif // #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
490 case EWK_GESTURE_PAN:
491 impl->gestureClient->startPan(IntPoint(event->position.x, event->position.y));
493 case EWK_GESTURE_FLICK:
494 impl->gestureClient->startFlick(IntPoint(event->position.x, event->position.y), IntPoint(event->velocity.x, event->velocity.y));
496 case EWK_GESTURE_PINCH:
497 if (impl->pageClient->viewportConstraints().userScalable)
498 impl->gestureClient->startPinch(IntPoint(event->position.x, event->position.y), event->scale);
501 ASSERT_NOT_REACHED();
508 #endif // #if ENABLE(TIZEN_GESTURE)
511 static Eina_Bool _ewk_view_smart_gesture_end(Ewk_View_Smart_Data* smartData, const Ewk_Event_Gesture* event)
513 #if ENABLE(TIZEN_GESTURE)
514 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
516 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
517 if (impl->pageClient->isTextSelectionMode() && impl->pageClient->isTextSelectionHandleDowned())
521 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
522 if (impl->focusRing) {
523 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
524 if (!impl->pageClient->isContextMenuVisible())
526 impl->focusRing->hide();
530 switch (event->type) {
531 case EWK_GESTURE_TAP:
532 if (event->count == 1) {
533 #if ENABLE(TIZEN_DRAG_SUPPORT)
534 if (impl->pageClient->isDragMode())
535 impl->pageClient->setDragMode(false);
537 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
538 if (impl->pageClient->isTextSelectionMode())
539 impl->pageClient->setIsTextSelectionMode(false);
542 #if ENABLE(TIZEN_ISF_PORT)
543 if (impl->inputMethodContext()->isIMEPostion(event->position.x, event->position.y))
547 impl->gestureClient->endTap(IntPoint(event->position.x, event->position.y));
548 } else if (event->count == 2)
549 impl->gestureClient->endDoubleTap(IntPoint(event->position.x, event->position.y));
551 case EWK_GESTURE_LONG_PRESS:
552 #if ENABLE(TIZEN_DRAG_SUPPORT)
553 if (impl->pageClient->isDragMode())
554 impl->pageClient->setDragMode(false);
556 // Prcess endTap for LONG_PRESS gesture if text-selection and context menu did not work
557 impl->gestureClient->endTap(IntPoint(event->position.x, event->position.y));
559 case EWK_GESTURE_PAN:
560 impl->gestureClient->endPan(IntPoint(event->position.x, event->position.y));
562 case EWK_GESTURE_FLICK:
563 impl->gestureClient->endFlick(IntPoint(event->position.x, event->position.y), IntPoint(event->velocity.x, event->velocity.y));
565 case EWK_GESTURE_PINCH:
566 impl->gestureClient->endPinch(IntPoint(event->position.x, event->position.y), event->scale);
569 ASSERT_NOT_REACHED();
576 #endif // #if ENABLE(TIZEN_GESTURE)
579 static Eina_Bool _ewk_view_smart_gesture_move(Ewk_View_Smart_Data* smartData, const Ewk_Event_Gesture* event)
581 #if ENABLE(TIZEN_GESTURE)
582 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
584 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
585 if (impl->pageClient->isTextSelectionMode() && impl->pageClient->isTextSelectionHandleDowned())
589 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
590 if (impl->focusRing && !(event->type == EWK_GESTURE_PAN && !impl->exceedTouchMoveThreshold))
591 impl->focusRing->hide();
594 switch (event->type) {
595 case EWK_GESTURE_PAN:
596 impl->gestureClient->movePan(IntPoint(event->position.x, event->position.y));
598 case EWK_GESTURE_TAP:
599 case EWK_GESTURE_LONG_PRESS:
600 case EWK_GESTURE_FLICK:
602 case EWK_GESTURE_PINCH:
603 if (impl->pageClient->viewportConstraints().userScalable)
604 impl->gestureClient->movePinch(IntPoint(event->position.x, event->position.y), event->scale);
607 ASSERT_NOT_REACHED();
614 #endif // #if ENABLE(TIZEN_GESTURE)
616 #endif //#if OS(TIZEN)
619 static void _ewk_view_on_focus_in(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo)
621 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
622 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
623 EINA_SAFETY_ON_NULL_RETURN(smartData->api->focus_in);
624 smartData->api->focus_in(smartData);
627 static void _ewk_view_on_focus_out(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo)
629 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
630 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
631 EINA_SAFETY_ON_NULL_RETURN(smartData->api->focus_out);
632 smartData->api->focus_out(smartData);
635 static void _ewk_view_on_mouse_wheel(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo)
637 Evas_Event_Mouse_Wheel* wheelEvent = static_cast<Evas_Event_Mouse_Wheel*>(eventInfo);
638 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
639 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
640 EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_wheel);
641 smartData->api->mouse_wheel(smartData, wheelEvent);
644 static void _ewk_view_on_key_down(void* data, Evas*, Evas_Object*, void* eventInfo)
646 Evas_Event_Key_Down* downEvent = static_cast<Evas_Event_Key_Down*>(eventInfo);
647 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
648 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
649 EINA_SAFETY_ON_NULL_RETURN(smartData->api->key_down);
650 smartData->api->key_down(smartData, downEvent);
653 static void _ewk_view_on_key_up(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo)
655 Evas_Event_Key_Up* upEvent = static_cast<Evas_Event_Key_Up*>(eventInfo);
656 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
657 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
658 EINA_SAFETY_ON_NULL_RETURN(smartData->api->key_up);
659 smartData->api->key_up(smartData, upEvent);
662 static void _ewk_view_on_show(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);
666 impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible);
669 static void _ewk_view_on_hide(void* data, Evas*, Evas_Object*, void* /*eventInfo*/)
671 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
672 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
674 // This call may look wrong, but we really need to pass ViewIsVisible here.
675 // viewStateDidChange() itself is responsible for actually setting the visibility to Visible or Hidden
676 // depending on what WebPageProxy::isViewVisible() returns, this simply triggers the process.
677 impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible);
681 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
682 Eina_Bool _ewk_view_text_selection_down(Ewk_View_Smart_Data* smartData, int x, int y)
684 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
686 return impl->pageClient->textSelectionDown(IntPoint(x, y), true);
689 Eina_Bool _ewk_view_text_selection_move(Ewk_View_Smart_Data* smartData, int x, int y)
691 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
693 IntPoint point(x, y);
694 impl->pageClient->textSelectionMove(point, true);
699 Eina_Bool _ewk_view_text_selection_up(Ewk_View_Smart_Data* smartData, int x, int y)
701 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
703 IntPoint point(x, y);
704 impl->pageClient->textSelectionUp(point, true);
710 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
711 Eina_Bool _ewk_view_smart_formdata_candidate_show(Ewk_View_Smart_Data* smartData, int x, int y, int w, int h)
713 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
715 impl->pageClient->showFormDataCandidate(IntRect(x, y, w, h));
720 Eina_Bool _ewk_view_smart_formdata_candidate_hide(Ewk_View_Smart_Data* smartData)
722 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
724 impl->pageClient->hideFormDataCandidate();
729 Eina_Bool _ewk_view_smart_formdata_candidate_update_data(Ewk_View_Smart_Data* smartData, Eina_List* dataList)
731 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
733 Vector<String> formData;
736 EINA_LIST_FOREACH(dataList, list, data)
737 formData.append(String::fromUTF8(static_cast<char*>(data)));
739 impl->pageClient->updateFormDataCandidate(formData);
744 Eina_Bool _ewk_view_smart_formdata_candidate_is_showing(Ewk_View_Smart_Data* smartData)
746 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
748 return impl->pageClient->isShowingFormDataCandidate();
752 #if ENABLE(TIZEN_SCREEN_READER)
753 Eina_Bool _ewk_view_screen_reader_command_execute(Ewk_View_Smart_Data* smartData, unsigned int command, int data1, int data2)
755 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
757 return ScreenReaderProxy::screenReader().executeCommand(impl, command, data1, data2);
760 #endif // #if OS(TIZEN)
762 static Evas_Smart_Class g_parentSmartClass = EVAS_SMART_CLASS_INIT_NULL;
764 static void _ewk_view_impl_del(EwkViewImpl* impl)
766 #if !ENABLE(TIZEN_ICON_DATABASE)
767 /* Unregister icon change callback */
768 Ewk_Favicon_Database* iconDatabase = impl->context->faviconDatabase();
769 iconDatabase->unwatchChanges(_ewk_view_on_favicon_changed);
775 static void _ewk_view_smart_add(Evas_Object* ewkView)
777 const Evas_Smart* smart = evas_object_smart_smart_get(ewkView);
778 const Evas_Smart_Class* smartClass = evas_smart_class_get(smart);
779 const Ewk_View_Smart_Class* api = reinterpret_cast<const Ewk_View_Smart_Class*>(smartClass);
780 EWK_VIEW_SD_GET(ewkView, smartData);
783 smartData = static_cast<Ewk_View_Smart_Data*>(calloc(1, sizeof(Ewk_View_Smart_Data)));
785 EINA_LOG_CRIT("could not allocate Ewk_View_Smart_Data");
788 evas_object_smart_data_set(ewkView, smartData);
791 smartData->self = ewkView;
792 smartData->api = api;
794 g_parentSmartClass.add(ewkView);
796 smartData->priv = new EwkViewImpl(ewkView);
797 if (!smartData->priv) {
798 EINA_LOG_CRIT("could not allocate EwkViewImpl");
799 evas_object_smart_data_set(ewkView, 0);
804 // Create evas_object_image to draw web contents.
805 smartData->image = evas_object_image_add(smartData->base.evas);
806 evas_object_image_alpha_set(smartData->image, false);
807 evas_object_image_filled_set(smartData->image, true);
808 evas_object_smart_member_add(smartData->image, ewkView);
811 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
812 Ecore_Evas* ee = ecore_evas_ecore_evas_get(smartData->base.evas);
813 const char *engine = ecore_evas_engine_name_get(ee);
814 if (engine && !strcmp(engine, "opengl_x11"))
815 evas_object_image_content_hint_set(smartData->image, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
817 ewk_view_mouse_events_enabled_set(ewkView, false);
818 ewk_view_touch_events_enabled_set(ewkView, true);
820 // FIXME: This code should be removed if side effect occur.
821 // WebView does not have focus after url loading.
822 // If focus is set as true to webview,
823 // elementary steal webview's focus during mouse up event
824 // So, added code that events are not propagated to smart parent according to guide from EFL
825 evas_object_propagate_events_set(ewkView, false);
827 #if ENABLE(TIZEN_SCREEN_READER)
828 ScreenReaderProxy::screenReader().addView(smartData->priv);
830 #endif // #if OS(TIZEN)
832 #define CONNECT(s, c) evas_object_event_callback_add(ewkView, s, c, smartData)
833 CONNECT(EVAS_CALLBACK_FOCUS_IN, _ewk_view_on_focus_in);
834 CONNECT(EVAS_CALLBACK_FOCUS_OUT, _ewk_view_on_focus_out);
835 CONNECT(EVAS_CALLBACK_MOUSE_WHEEL, _ewk_view_on_mouse_wheel);
836 CONNECT(EVAS_CALLBACK_KEY_DOWN, _ewk_view_on_key_down);
837 CONNECT(EVAS_CALLBACK_KEY_UP, _ewk_view_on_key_up);
838 CONNECT(EVAS_CALLBACK_SHOW, _ewk_view_on_show);
839 CONNECT(EVAS_CALLBACK_HIDE, _ewk_view_on_hide);
843 static void _ewk_view_smart_del(Evas_Object* ewkView)
845 EwkViewImpl::removeFromPageViewMap(ewkView);
846 EWK_VIEW_SD_GET(ewkView, smartData);
847 #if ENABLE(TIZEN_SCREEN_READER)
848 ScreenReaderProxy::screenReader().removeView(smartData->priv);
850 if (smartData && smartData->priv)
851 _ewk_view_impl_del(smartData->priv);
853 g_parentSmartClass.del(ewkView);
856 static Eina_Bool _ewk_view_composite(void* data);
858 static void _ewk_view_smart_resize(Evas_Object* ewkView, Evas_Coord width, Evas_Coord height)
860 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
862 evas_object_resize(smartData->image, width, height);
863 evas_object_image_size_set(smartData->image, width, height);
864 evas_object_image_fill_set(smartData->image, 0, 0, width, height);
866 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
867 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
868 evas_object_image_native_surface_set(smartData->image, 0);
870 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
871 if (!ewk_view_is_opengl_backend(ewkView))
872 _ewk_view_composite(smartData);
873 else // OpenGL backend
875 impl->pageClient->displayViewport();
877 #endif // #if OS(TIZEN)
879 smartData->changed.size = true;
880 _ewk_view_smart_changed(smartData);
883 static void _ewk_view_smart_move(Evas_Object* ewkView, Evas_Coord x, Evas_Coord y)
885 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
887 smartData->changed.position = true;
888 _ewk_view_smart_changed(smartData);
891 static void _ewk_view_smart_calculate(Evas_Object* ewkView)
893 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
894 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
896 Evas_Coord x, y, width, height;
898 smartData->changed.any = false;
900 evas_object_geometry_get(ewkView, &x, &y, &width, &height);
902 if (smartData->changed.size) {
904 #if USE(COORDINATED_GRAPHICS)
905 impl->pageViewportControllerClient->updateViewportSize(IntSize(width, height));
907 #if USE(ACCELERATED_COMPOSITING)
908 needsNewSurface = impl->evasGlSurface;
911 if (impl->pageProxy->drawingArea())
912 impl->pageProxy->drawingArea()->setSize(IntSize(width, height), IntSize());
914 #if USE(ACCELERATED_COMPOSITING)
915 if (!impl->evasGlSurface)
917 evas_gl_surface_destroy(impl->evasGl, impl->evasGlSurface);
918 impl->evasGlSurface = 0;
919 ewk_view_create_gl_surface(ewkView, IntSize(width, height));
920 ewk_view_display(ewkView, IntRect(IntPoint(), IntSize(width, height)));
922 #endif // #if !OS(TIZEN)
924 smartData->view.w = width;
925 smartData->view.h = height;
926 smartData->changed.size = false;
929 if (impl->pageClient) {
930 if (DrawingAreaProxy* drawingArea = impl->pageProxy->drawingArea()) {
931 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
932 if (impl->pageProxy->isViewVisible())
933 drawingArea->setSize(IntSize(width, height), IntSize());
935 drawingArea->setSize(IntSize(width, height), IntSize());
937 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) && !ENABLE(TIZEN_WEBKIT2_EFL_WTR)
938 Ecore_Evas* ee = ecore_evas_ecore_evas_get(smartData->base.evas);
939 impl->pageClient->updateViewportSize(IntSize(width, height), ecore_evas_rotation_get(ee));
940 if (ewk_view_is_opengl_backend(ewkView))
941 impl->pageClient->displayViewport();
944 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
945 impl->pageClient->frameRectChanged();
948 #endif // #if OS(TIZEN)
951 if (smartData->changed.position) {
952 evas_object_move(smartData->image, x, y);
953 smartData->view.x = x;
954 smartData->view.y = y;
955 smartData->changed.position = false;
957 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
958 impl->pageClient->frameRectChanged();
960 #if ENABLE(TIZEN_SCREEN_READER)
961 impl->pageProxy->recalcScreenReaderFocusRect();
963 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
964 impl->pageClient->updateTextSelectionHandlesAndContextMenu(true);
966 #endif // #if OS(TIZEN)
969 if (impl->popupPicker)
970 ewk_popup_picker_resize(impl->popupPicker);
971 #endif // #if OS(TIZEN)
974 static void _ewk_view_smart_show(Evas_Object* ewkView)
976 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
977 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
979 if (evas_object_clipees_get(smartData->base.clipper))
980 evas_object_show(smartData->base.clipper);
981 evas_object_show(smartData->image);
984 static void _ewk_view_smart_hide(Evas_Object* ewkView)
986 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
988 evas_object_hide(smartData->base.clipper);
989 evas_object_hide(smartData->image);
990 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
991 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
992 if (impl->pageClient->isTextSelectionMode())
993 impl->pageClient->setIsTextSelectionMode(false);
997 static void _ewk_view_smart_color_set(Evas_Object* ewkView, int red, int green, int blue, int alpha)
999 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1000 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1004 else if (alpha > 255)
1007 #define CHECK_COLOR(color, alpha) \
1010 else if (color > alpha) \
1012 CHECK_COLOR(red, alpha);
1013 CHECK_COLOR(green, alpha);
1014 CHECK_COLOR(blue, alpha);
1017 evas_object_image_alpha_set(smartData->image, alpha < 255);
1018 impl->pageProxy->setDrawsBackground(red || green || blue);
1019 impl->pageProxy->setDrawsTransparentBackground(alpha < 255);
1020 impl->pageClient->setBackgroundColor(red/255.0, green/255.0, blue/255.0, alpha/255.0);
1023 g_parentSmartClass.color_set(ewkView, red, green, blue, alpha);
1027 Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api)
1029 EINA_SAFETY_ON_NULL_RETURN_VAL(api, false);
1031 if (api->version != EWK_VIEW_SMART_CLASS_VERSION) {
1032 EINA_LOG_CRIT("Ewk_View_Smart_Class %p is version %lu while %lu was expected.",
1033 api, api->version, EWK_VIEW_SMART_CLASS_VERSION);
1037 if (EINA_UNLIKELY(!g_parentSmartClass.add))
1038 evas_object_smart_clipped_smart_set(&g_parentSmartClass);
1040 evas_object_smart_clipped_smart_set(&api->sc);
1042 // Set Evas_Smart_Class functions.
1043 api->sc.add = _ewk_view_smart_add;
1044 api->sc.del = _ewk_view_smart_del;
1045 api->sc.move = _ewk_view_smart_move;
1046 api->sc.resize = _ewk_view_smart_resize;
1047 api->sc.show = _ewk_view_smart_show;
1048 api->sc.hide = _ewk_view_smart_hide;
1049 api->sc.color_set = _ewk_view_smart_color_set;
1050 api->sc.calculate = _ewk_view_smart_calculate;
1051 api->sc.data = EWK_VIEW_TYPE_STR; // It is used by type checking.
1053 // Set Ewk_View_Smart_Class functions.
1054 api->focus_in = _ewk_view_smart_focus_in;
1055 api->focus_out = _ewk_view_smart_focus_out;
1056 api->mouse_wheel = _ewk_view_smart_mouse_wheel;
1057 api->mouse_down = _ewk_view_smart_mouse_down;
1058 api->mouse_up = _ewk_view_smart_mouse_up;
1059 api->mouse_move = _ewk_view_smart_mouse_move;
1060 api->key_down = _ewk_view_smart_key_down;
1061 api->key_up = _ewk_view_smart_key_up;
1063 api->gesture_start = _ewk_view_smart_gesture_start;
1064 api->gesture_end = _ewk_view_smart_gesture_end;
1065 api->gesture_move = _ewk_view_smart_gesture_move;
1067 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
1068 api->popup_menu_show = _ewk_view_popup_menu_show;
1069 #if ENABLE(TIZEN_MULTIPLE_SELECT)
1070 api->multiple_popup_menu_show = _ewk_view_multiple_popup_menu_show;
1072 api->popup_menu_hide = _ewk_view_popup_menu_hide;
1073 api->popup_menu_update = _ewk_view_popup_menu_update;
1075 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
1076 api->text_selection_down = _ewk_view_text_selection_down;
1077 api->text_selection_move = _ewk_view_text_selection_move;
1078 api->text_selection_up = _ewk_view_text_selection_up;
1080 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1081 api->input_picker_show = _ewk_view_input_picker_show;
1083 #if ENABLE(TIZEN_DATALIST_ELEMENT)
1084 api->data_list_show = _ewk_view_data_list_show;
1085 api->data_list_hide = _ewk_view_data_list_hide;
1087 #if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL)
1088 api->orientation_lock = _ewk_orientation_lock;
1089 api->orientation_unlock = _ewk_orientation_unlock;
1091 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
1092 api->input_picker_color_request = _ewk_input_picker_color_request;
1093 api->input_picker_color_dismiss = _ewk_input_picker_color_dismiss;
1095 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
1096 api->formdata_candidate_show = _ewk_view_smart_formdata_candidate_show;
1097 api->formdata_candidate_hide = _ewk_view_smart_formdata_candidate_hide;
1098 api->formdata_candidate_update_data = _ewk_view_smart_formdata_candidate_update_data;
1099 api->formdata_candidate_is_showing = _ewk_view_smart_formdata_candidate_is_showing;
1101 #if ENABLE(TIZEN_SCREEN_READER)
1102 api->screen_reader_command_execute = _ewk_view_screen_reader_command_execute;
1104 #endif //#if OS(TIZEN)
1109 static inline Evas_Smart* _ewk_view_smart_class_new(void)
1111 static Ewk_View_Smart_Class api = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("Ewk_View");
1112 static Evas_Smart* smart = 0;
1114 if (EINA_UNLIKELY(!smart)) {
1115 ewk_view_smart_class_set(&api);
1116 smart = evas_smart_class_new(&api.sc);
1122 static void _ewk_view_initialize(Evas_Object* ewkView, PassRefPtr<Ewk_Context> context, WKPageGroupRef pageGroupRef)
1124 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1125 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1126 EINA_SAFETY_ON_NULL_RETURN(context);
1128 if (impl->pageClient)
1131 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
1132 bool isOpenGL = ewk_view_is_opengl_backend(ewkView);
1134 impl->pageClient = PageClientEvasGL::create(impl);
1136 impl->pageClient = PageClientImpl::create(impl);
1138 impl->pageClient = PageClientImpl::create(impl);
1142 impl->pageProxy = toImpl(context->wkContext())->createWebPage(impl->pageClient.get(), toImpl(pageGroupRef));
1144 impl->pageProxy = toImpl(context->wkContext())->createWebPage(impl->pageClient.get(), WebPageGroup::create().get());
1146 EwkViewImpl::addToPageViewMap(ewkView);
1149 impl->pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true);
1150 impl->pageProxy->pageGroup()->preferences()->setForceCompositingMode(true);
1151 impl->pageProxy->pageGroup()->preferences()->setFrameFlatteningEnabled(true);
1152 impl->pageProxy->pageGroup()->preferences()->setAllowUniversalAccessFromFileURLs(true);
1154 int deviceWidth, deviceHeight;
1155 ecore_evas_screen_geometry_get(ecore_evas_ecore_evas_get(evas_object_evas_get(ewkView)), 0, 0, &deviceWidth, &deviceHeight);
1156 impl->pageProxy->pageGroup()->preferences()->setDeviceWidth(deviceWidth);
1157 impl->pageProxy->pageGroup()->preferences()->setDeviceHeight(deviceHeight);
1160 impl->pageProxy->initializeWebPage();
1162 #if ENABLE(TIZEN_VIEWPORT_META_TAG)
1163 impl->pageProxy->setCustomDeviceScaleFactor((float)getMobileDPI() / 160);
1165 impl->pageProxy->setCustomDeviceScaleFactor((float)getDPI() / 160);
1168 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) && !ENABLE(TIZEN_WEBKIT2_EFL_WTR)
1169 impl->pageProxy->setUseFixedLayout(true);
1171 #if ENABLE(FULLSCREEN_API)
1172 impl->pageProxy->fullScreenManager()->setWebView(ewkView);
1175 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
1177 impl->pageProxy->drawingArea()->layerTreeCoordinatorProxy()->initializeAcceleratedCompositingMode(true);
1179 impl->pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(false);
1180 impl->pageProxy->pageGroup()->preferences()->setWebGLEnabled(false);
1181 impl->pageProxy->drawingArea()->layerTreeCoordinatorProxy()->initializeAcceleratedCompositingMode(false);
1185 impl->backForwardList = Ewk_Back_Forward_List::create(toAPI(impl->pageProxy->backForwardList()));
1187 impl->context = context;
1190 ewkViewContextMenuClientAttachClient(ewkView);
1191 ewkViewTizenClientAttachClient(ewkView);
1193 #if ENABLE(TIZEN_GEOLOCATION)
1194 ewkViewGeolocationProviderAttachProvider(ewkView, impl->context->wkContext());
1197 #if ENABLE(TIZEN_NOTIFICATIONS)
1198 ewkViewNotificationProviderAttachProvider(ewkView, impl->context->wkContext());
1201 #if ENABLE(TIZEN_ICON_DATABASE)
1202 ewk_view_icondatabase_client_attach(ewkView, impl->context->wkContext());
1205 ewk_view_javascript_alert_callback_set(ewkView, _ewk_view_default_javascript_alert, 0);
1206 ewk_view_javascript_confirm_callback_set(ewkView, _ewk_view_default_javascript_confirm, 0);
1207 ewk_view_javascript_prompt_callback_set(ewkView, _ewk_view_default_javascript_prompt, 0);
1208 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
1209 ewk_view_before_unload_confirm_panel_callback_set(ewkView, _ewk_view_default_before_unload_confirm_panel, 0);
1211 ewk_view_open_panel_callback_set(ewkView, _ewk_view_default_open_panel, 0);
1212 #else // #if OS(TIZEN)
1213 #if USE(COORDINATED_GRAPHICS)
1214 impl->viewportHandler = EflViewportHandler::create(impl->pageClient.get());
1216 #endif // #if OS(TIZEN)
1218 #if ENABLE(FULLSCREEN_API)
1219 impl->pageProxy->fullScreenManager()->setWebView(ewkView);
1220 impl->pageProxy->pageGroup()->preferences()->setFullScreenEnabled(true);
1223 // Initialize page clients.
1224 impl->pageLoadClient = PageLoadClientEfl::create(impl);
1225 impl->pagePolicyClient = PagePolicyClientEfl::create(impl);
1226 impl->pageUIClient = PageUIClientEfl::create(impl);
1227 impl->resourceLoadClient = ResourceLoadClientEfl::create(impl);
1228 impl->findClient = FindClientEfl::create(impl);
1229 impl->formClient = FormClientEfl::create(impl);
1230 #if !ENABLE(TIZEN_ICON_DATABASE)
1231 /* Listen for favicon changes */
1232 Ewk_Favicon_Database* iconDatabase = impl->context->faviconDatabase();
1233 iconDatabase->watchChanges(IconChangeCallbackData(_ewk_view_on_favicon_changed, ewkView));
1235 #if ENABLE(TIZEN_WEBKIT2_THEME_SET_INTERNAL)
1236 ewk_view_theme_set(ewkView, "/usr/share/edje/webkit.edj");
1239 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_X_WINDOW)
1240 if (!impl->context->xWindow())
1241 impl->context->setXWindow(elm_win_xwindow_get(ewkView));
1244 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
1245 impl->focusRing = FocusRing::create(impl);
1249 static Evas_Object* _ewk_view_add_with_smart(Evas* canvas, Evas_Smart* smart)
1251 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
1252 EINA_SAFETY_ON_NULL_RETURN_VAL(smart, 0);
1254 #if ENABLE(TIZEN_WEBKIT2_DDK_CHECK)
1256 using namespace EGL;
1257 if(!eglGetDisplay(EGL_DEFAULT_DISPLAY)) {
1258 EINA_LOG_CRIT("Fail in initiziling view because No DDK is installed.");
1264 Evas_Object* ewkView = evas_object_smart_add(canvas, smart);
1268 EWK_VIEW_SD_GET(ewkView, smartData);
1270 evas_object_del(ewkView);
1274 EWK_VIEW_IMPL_GET(smartData, impl);
1276 evas_object_del(ewkView);
1285 * Constructs a ewk_view Evas_Object with WKType parameters.
1287 Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
1289 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
1290 EINA_SAFETY_ON_NULL_RETURN_VAL(contextRef, 0);
1292 Evas_Object* ewkView = _ewk_view_add_with_smart(canvas, _ewk_view_smart_class_new());
1296 _ewk_view_initialize(ewkView, Ewk_Context::create(contextRef), pageGroupRef);
1301 Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* context)
1303 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
1304 EINA_SAFETY_ON_NULL_RETURN_VAL(smart, 0);
1305 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
1307 Evas_Object* ewkView = _ewk_view_add_with_smart(canvas, smart);
1311 #if ENABLE(TIZEN_ICON_DATABASE)
1312 //set default iconDatabasePath
1313 WKContextRef contextRef = context->wkContext();
1314 toImpl(contextRef)->setIconDatabasePath(toImpl(contextRef)->iconDatabasePath());
1317 #if ENABLE(TIZEN_WEBKIT2_CREATE_VIEW_WITH_CREATED_PAGE_GROUP_WITH_IDENTIFIER)
1318 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1319 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1320 _ewk_view_initialize(ewkView, context, toAPI(impl->pageGroup.get()));
1322 _ewk_view_initialize(ewkView, context, 0);
1328 Evas_Object* ewk_view_add_with_context(Evas* canvas, Ewk_Context* context)
1330 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
1331 return ewk_view_smart_add(canvas, _ewk_view_smart_class_new(), context);
1334 Evas_Object* ewk_view_add(Evas* canvas)
1336 return ewk_view_add_with_context(canvas, ewk_context_default_get());
1339 Ewk_Context* ewk_view_context_get(const Evas_Object* ewkView)
1341 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1342 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1344 return impl->ewkContext();
1347 Eina_Bool ewk_view_url_set(Evas_Object* ewkView, const char* url)
1349 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1350 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1351 EINA_SAFETY_ON_NULL_RETURN_VAL(url, false);
1353 impl->pageProxy->loadURL(String::fromUTF8(url));
1354 impl->informURLChange();
1359 const char* ewk_view_url_get(const Evas_Object* ewkView)
1361 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1362 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1367 const char *ewk_view_icon_url_get(const Evas_Object *ewkView)
1369 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1370 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1372 return impl->faviconURL();
1375 Eina_Bool ewk_view_reload(Evas_Object* ewkView)
1377 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1378 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1380 impl->pageProxy->reload(/*reloadFromOrigin*/ false);
1381 impl->informURLChange();
1386 Eina_Bool ewk_view_reload_bypass_cache(Evas_Object* ewkView)
1388 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1389 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1391 impl->pageProxy->reload(/*reloadFromOrigin*/ true);
1392 impl->informURLChange();
1397 Eina_Bool ewk_view_stop(Evas_Object* ewkView)
1399 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1400 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1402 impl->pageProxy->stopLoading();
1407 Ewk_Settings* ewk_view_settings_get(const Evas_Object* ewkView)
1409 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1410 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1412 return impl->settings();
1415 const char* ewk_view_title_get(const Evas_Object* ewkView)
1417 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1418 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1420 return impl->title();
1425 * Reports that the requested text was found.
1427 * Emits signal: "text,found" with the number of matches.
1429 void ewk_view_text_found(Evas_Object* ewkView, unsigned int matchCount)
1431 evas_object_smart_callback_call(ewkView, "text,found", &matchCount);
1434 double ewk_view_load_progress_get(const Evas_Object* ewkView)
1436 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
1437 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1.0);
1439 return impl->pageProxy->estimatedProgress();
1442 Eina_Bool ewk_view_scale_set(Evas_Object* ewkView, double scaleFactor, int x, int y)
1444 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1445 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1451 scaleFactor = impl->pageClient->adjustScaleWithViewport(scaleFactor);
1453 IntPoint scrollPosition = impl->pageClient->scrollPosition();
1454 double scaleDifference = scaleFactor / impl->pageClient->scaleFactor();
1455 int newScrollX = (scrollPosition.x() + centerX - smartData->view.x) * scaleDifference - (centerX - smartData->view.x);
1456 int newScrollY = (scrollPosition.y() + centerY - smartData->view.y) * scaleDifference - (centerY - smartData->view.y);
1458 impl->pageProxy->scale(scaleFactor, IntPoint(newScrollX, newScrollY));
1460 impl->pageProxy->scalePage(scaleFactor, IntPoint(x, y));
1465 double ewk_view_scale_get(const Evas_Object* ewkView)
1467 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1);
1468 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1);
1471 return impl->pageProxy->scaleFactor();
1473 return impl->pageProxy->pageScaleFactor();
1477 Eina_Bool ewk_view_device_pixel_ratio_set(Evas_Object* ewkView, float ratio)
1479 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1480 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1482 impl->pageProxy->setCustomDeviceScaleFactor(ratio);
1487 float ewk_view_device_pixel_ratio_get(const Evas_Object* ewkView)
1489 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
1490 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1.0);
1492 return impl->pageProxy->deviceScaleFactor();
1495 void ewk_view_theme_set(Evas_Object* ewkView, const char* path)
1497 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1498 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1500 impl->setThemePath(path);
1503 const char* ewk_view_theme_get(const Evas_Object* ewkView)
1505 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1506 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1508 return impl->themePath();
1511 Eina_Bool ewk_view_back(Evas_Object* ewkView)
1513 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1514 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1516 WebPageProxy* page = impl->pageProxy.get();
1517 if (page->canGoBack()) {
1525 Eina_Bool ewk_view_forward(Evas_Object* ewkView)
1527 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1528 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1530 WebPageProxy* page = impl->pageProxy.get();
1531 if (page->canGoForward()) {
1539 Eina_Bool ewk_view_intent_deliver(Evas_Object* ewkView, Ewk_Intent* intent)
1541 #if ENABLE(WEB_INTENTS)
1542 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1543 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1544 EINA_SAFETY_ON_NULL_RETURN_VAL(intent, false);
1546 WebPageProxy* page = impl->pageProxy.get();
1547 page->deliverIntentToFrame(page->mainFrame(), intent->webIntentData());
1555 Eina_Bool ewk_view_back_possible(Evas_Object* ewkView)
1557 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1558 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1560 return impl->pageProxy->canGoBack();
1563 Eina_Bool ewk_view_forward_possible(Evas_Object* ewkView)
1565 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1566 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1568 return impl->pageProxy->canGoForward();
1571 Ewk_Back_Forward_List* ewk_view_back_forward_list_get(const Evas_Object* ewkView)
1573 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1574 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1576 return impl->backForwardList.get();
1579 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
1580 void ewk_view_text_change_in_textfield(Evas_Object* ewkView, const String& name, const String& value)
1582 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1583 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1585 if (!ewk_settings_form_candidate_data_enabled_get(ewk_view_settings_get(ewkView)))
1588 if (value.isEmpty()) {
1589 if(smartData->api->formdata_candidate_is_showing(smartData))
1590 smartData->api->formdata_candidate_hide(smartData);
1594 Vector<String> popupCandidates;
1595 ewk_view_form_candidate_data_get(ewkView, name, popupCandidates);
1596 std::sort(popupCandidates.begin(), popupCandidates.end(), WTF::codePointCompareLessThan);
1598 Eina_List* candidateList = 0;
1599 for (size_t i = 0; i < popupCandidates.size(); ++i) {
1600 if (popupCandidates[i].startsWith(value, false))
1601 candidateList = eina_list_append(candidateList, eina_stringshare_add(popupCandidates[i].utf8().data()));
1604 if (!eina_list_count(candidateList)) {
1605 if(smartData->api->formdata_candidate_is_showing(smartData))
1606 smartData->api->formdata_candidate_hide(smartData);
1610 smartData->api->formdata_candidate_update_data(smartData, candidateList);
1612 IntRect inputFieldRect = impl->pageClient->focusedNodeRect();
1613 smartData->api->formdata_candidate_show(smartData, inputFieldRect.x(), inputFieldRect.y(), inputFieldRect.width(), inputFieldRect.height());
1616 void ewk_view_form_data_add(Evas_Object* ewkView, WKDictionaryRef& formData, bool isPasswordForm)
1618 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1619 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1620 if (!ewk_settings_autofill_password_form_enabled_get(ewk_view_settings_get(ewkView))
1621 && !ewk_settings_form_candidate_data_enabled_get(ewk_view_settings_get(ewkView)))
1623 ewk_view_context_get(ewkView)->addFormData(impl->url(), formData, isPasswordForm);
1626 void ewk_view_form_password_data_fill(Evas_Object* ewkView)
1628 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1629 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1631 if (!ewk_settings_autofill_password_form_enabled_get(ewk_view_settings_get(ewkView)))
1634 Vector<std::pair<String, String> > passwordFormData;
1635 ewk_view_context_get(ewkView)->passwordFormData(impl->url(), passwordFormData);
1637 if (!passwordFormData.size())
1640 String passwordFormAutofill = "try { function passwordFormAutofill() { var inputFields;";
1641 for (size_t i = 0; i < passwordFormData.size(); i++) {
1642 passwordFormAutofill += String::format(" inputFields = document.getElementsByName(\"%s\");"
1643 " for (var i = 0; i < inputFields.length; i++)"
1644 " if (inputFields[i].tagName.toLowerCase() == \"input\" && (inputFields[i].type.toLowerCase() == \"text\" || inputFields[i].type.toLowerCase() == \"password\" || inputFields[i].type.toLowerCase() == \"email\"))"
1645 " inputFields[i].value = \"%s\";",
1646 passwordFormData[i].first.utf8().data(), passwordFormData[i].second.utf8().data());
1648 passwordFormAutofill += "} passwordFormAutofill(); } catch(e) { }";
1649 ewk_view_script_execute(ewkView, passwordFormAutofill.utf8().data(), 0, 0);
1652 void ewk_view_form_candidate_data_get(Evas_Object* ewkView, const String& name, Vector<String>& candidates)
1654 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1655 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1656 ewk_view_context_get(ewkView)->candidateFormData(name, candidates);
1660 Eina_Bool ewk_view_html_string_load(Evas_Object* ewkView, const char* html, const char* baseUrl, const char* unreachableUrl)
1662 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1663 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1664 EINA_SAFETY_ON_NULL_RETURN_VAL(html, false);
1666 if (unreachableUrl && *unreachableUrl)
1667 impl->pageProxy->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl));
1669 impl->pageProxy->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "");
1671 impl->informURLChange();
1676 const char* ewk_view_custom_encoding_get(const Evas_Object* ewkView)
1678 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1679 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1681 return impl->customTextEncodingName();
1684 Eina_Bool ewk_view_custom_encoding_set(Evas_Object* ewkView, const char* encoding)
1686 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1687 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1689 impl->setCustomTextEncodingName(encoding);
1695 // FIXME: It should be removed.
1696 WKPageRef ewk_view_WKPage_get(Evas_Object* ewkView)
1698 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1699 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1701 return toAPI(impl->pageProxy.get());
1704 Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object* ewkView, Eina_Bool enabled)
1706 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1707 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1709 impl->setMouseEventsEnabled(!!enabled);
1714 Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object* ewkView)
1716 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1717 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1719 return impl->mouseEventsEnabled();
1722 Eina_Bool ewk_view_color_picker_color_set(Evas_Object* ewkView, int r, int g, int b, int a)
1724 #if ENABLE(INPUT_TYPE_COLOR)
1725 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1726 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1728 return impl->setColorPickerColor(WebCore::Color(r, g, b, a));
1734 static Eina_Bool _ewk_view_default_javascript_alert(Evas_Object* ewkView, const char* alertText, void* userData)
1736 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1737 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1739 return impl->javascriptPopup->alert(alertText);
1742 static Eina_Bool _ewk_view_default_javascript_confirm(Evas_Object* ewkView, const char* message, void* userData)
1744 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1745 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1747 return impl->javascriptPopup->confirm(message);
1750 static Eina_Bool _ewk_view_default_javascript_prompt(Evas_Object* ewkView, const char* message, const char* defaultValue, void* userData)
1752 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1753 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1755 return impl->javascriptPopup->prompt(message, defaultValue);
1758 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
1759 static Eina_Bool _ewk_view_default_before_unload_confirm_panel(Evas_Object* ewkView, const char* message, void* userData)
1761 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1762 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1764 return impl->javascriptPopup->beforeUnloadConfirmPanel(message);
1768 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)
1770 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1771 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1773 return impl->openPanel->openPanel(ewkView, allow_multiple_files, accepted_mime_types, capture, impl);
1776 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
1777 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)
1779 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1781 if (impl->popupPicker)
1782 ewk_popup_picker_del(impl->popupPicker);
1784 #if ENABLE(TIZEN_MULTIPLE_SELECT)
1785 impl->popupPicker = ewk_popup_picker_new(smartData->self, items, selectedIndex, false);
1787 impl->popupPicker = ewk_popup_picker_new(smartData->self, items, selectedIndex);
1793 #if ENABLE(TIZEN_MULTIPLE_SELECT)
1794 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)
1796 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1798 if (impl->popupPicker)
1799 ewk_popup_picker_del(impl->popupPicker);
1801 impl->popupPicker = ewk_popup_picker_new(smartData->self, items, 0, true);
1807 Eina_Bool _ewk_view_popup_menu_hide(Ewk_View_Smart_Data* smartData)
1809 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1811 if (!impl->popupPicker)
1814 ewk_popup_picker_del(impl->popupPicker);
1815 impl->popupPicker = 0;
1820 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)
1822 // FIXME: The rect should be updated if it was changed
1824 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1826 if (!impl->popupPicker)
1829 ewk_popup_picker_update(smartData->self, impl->popupPicker, items, selectedIndex);
1835 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1836 static Eina_Bool _ewk_view_input_picker_show(Ewk_View_Smart_Data* smartData, Ewk_Input_Type inputType, const char* inputValue)
1838 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1840 impl->inputPicker->show(inputType, inputValue);
1845 #if ENABLE(TIZEN_DATALIST_ELEMENT)
1846 static Eina_Bool _ewk_view_data_list_show(Ewk_View_Smart_Data* smartData, Ewk_Input_Type inputType, Eina_List* optionList)
1848 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1850 impl->inputPicker->showDataList(inputType, optionList);
1854 static Eina_Bool _ewk_view_data_list_hide(Ewk_View_Smart_Data* smartData, Ewk_Input_Type inputType)
1856 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1858 impl->inputPicker->hideDataList(inputType);
1863 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
1864 static Eina_Bool _ewk_input_picker_color_request(Ewk_View_Smart_Data* smartData, int r, int g, int b, int a)
1866 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1868 impl->inputPicker->showColorPicker(r, g, b, a);
1872 static Eina_Bool _ewk_input_picker_color_dismiss(Ewk_View_Smart_Data* smartData)
1874 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1876 impl->inputPicker->hideColorPicker();
1881 PageClientImpl* ewkViewGetPageClient(const Evas_Object* ewkView)
1883 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1884 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1886 return impl->pageClient.get();
1889 double ewk_view_text_zoom_get(const Evas_Object* ewkView)
1891 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 1);
1892 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 1);
1894 return WKPageGetTextZoomFactor(toAPI(impl->pageProxy.get()));
1897 Eina_Bool ewk_view_text_zoom_set(Evas_Object* ewkView, double textZoomFactor)
1899 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1900 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1902 WKPageSetTextZoomFactor(toAPI(impl->pageProxy.get()), textZoomFactor);
1906 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
1907 FocusRing* ewkViewGetFocusRing(Evas_Object* ewkView)
1909 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1910 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1912 return impl->focusRing.get();
1916 Ewk_Frame_Ref ewk_view_main_frame_get(Evas_Object* ewkView)
1918 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1919 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1921 return static_cast<Ewk_Frame_Ref>(WKPageGetMainFrame(toAPI(impl->pageProxy.get())));
1924 Ewk_Frame_Ref ewk_view_focused_frame_get(Evas_Object* ewkView)
1926 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1927 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1929 return static_cast<Ewk_Frame_Ref>(WKPageGetFocusedFrame(toAPI(impl->pageProxy.get())));
1932 JSGlobalContextRef ewkViewGetJavascriptGlobalContext(Evas_Object* ewkView)
1934 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1935 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1937 if (!impl->javascriptGlobalContext)
1938 impl->javascriptGlobalContext = JSGlobalContextCreate(0);
1939 return impl->javascriptGlobalContext;
1942 void ewkViewLoadCommitted(Evas_Object* ewkView)
1944 #if ENABLE(TIZEN_GESTURE)
1945 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1946 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1947 impl->gestureClient->reset();
1949 #if ENABLE(TIZEN_ISF_PORT)
1950 impl->inputMethodContext()->hideIMFContext();
1952 impl->informURLChange();
1953 evas_object_smart_callback_call(ewkView, "load,committed", 0);
1956 void ewkViewLoadError(Evas_Object* ewkView, WKErrorRef error)
1958 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1959 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1961 OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(error);
1962 ewk_error_load_error_page(ewkError.get(), toAPI(impl->pageProxy.get()));
1963 evas_object_smart_callback_call(ewkView, "load,error", ewkError.get());
1966 void ewkViewDidFirstVisuallyNonEmptyLayout(Evas_Object* ewkView)
1968 #if ENABLE(TIZEN_GESTURE)
1969 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1970 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1971 impl->gestureClient->reset();
1973 evas_object_smart_callback_call(ewkView, "load,nonemptylayout,finished", 0);
1976 void ewkViewDidReceiveAuthenticationChallenge(Evas_Object* ewkView, Ewk_Auth_Challenge* authChallenge)
1978 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1979 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1981 if (impl->authChallenge)
1982 ewkAuthChallengeDelete(impl->authChallenge);
1983 impl->authChallenge = authChallenge;
1985 evas_object_smart_callback_call(ewkView, "authentication,challenge", impl->authChallenge);
1988 void ewk_view_process_crashed(Evas_Object* ewkView)
1990 bool handled = false;
1991 evas_object_smart_callback_call(ewkView, "process,crashed", &handled);
1997 #if ENABLE(TIZEN_SQL_DATABASE)
1998 bool ewkViewExceededDatabaseQuota(Evas_Object* ewkView, WKSecurityOriginRef origin, WKStringRef databaseName, unsigned long long expectedUsage)
2000 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2001 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2003 if (!impl->exceededDatabaseQuotaContext || !impl->exceededDatabaseQuotaContext->exceededDatabaseQuotaCallback)
2006 TIZEN_LOGI("No error in prameter. Request to display user confirm popup. expectedUsage(%llu)", expectedUsage);
2007 impl->isWaitingForExceededQuotaPopupReply = true;
2008 if (impl->exceededQuotaOrigin)
2009 deleteSecurityOrigin(impl->exceededQuotaOrigin);
2010 impl->exceededQuotaOrigin = createSecurityOrigin(origin);
2012 int length = WKStringGetMaximumUTF8CStringSize(databaseName);
2013 OwnArrayPtr<char> databaseNameBuffer = adoptArrayPtr(new char[length]);
2014 WKStringGetUTF8CString(databaseName, databaseNameBuffer.get(), length);
2016 return impl->exceededDatabaseQuotaContext->exceededDatabaseQuotaCallback(ewkView, impl->exceededQuotaOrigin, databaseNameBuffer.get(), expectedUsage, impl->exceededDatabaseQuotaContext->userData) == EINA_TRUE;
2020 #if ENABLE(TIZEN_NOTIFICATIONS)
2021 void ewkViewCancelNotification(Evas_Object* ewkView, uint64_t notificationID)
2023 TIZEN_LOGI("notification,cancel");
2024 evas_object_smart_callback_call(ewkView, "notification,cancel", ¬ificationID);
2027 void ewkViewRequestNotificationPermission(Evas_Object* ewkView, Ewk_Notification_Permission_Request* notificationPermissionRequest)
2029 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2030 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2032 TIZEN_LOGI("notification,permission,request");
2033 impl->notificationPermissionRequests = eina_list_append(impl->notificationPermissionRequests, notificationPermissionRequest);
2034 evas_object_smart_callback_call(ewkView, "notification,permission,request", notificationPermissionRequest);
2037 void ewkViewShowNotification(Evas_Object* ewkView, Ewk_Notification* notification)
2039 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2040 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2042 TIZEN_LOGI("notification,show");
2043 Eina_List* listIterator=0;
2045 const char* replaceID = ewkNotificationGetReplaceID(notification);
2046 if(strlen(replaceID)) {
2047 EINA_LIST_FOREACH(impl->notifications, listIterator, data) {
2048 Ewk_Notification* notificationForReplace = static_cast<Ewk_Notification*>(data);
2049 if(!strcmp(ewkNotificationGetReplaceID(notificationForReplace), replaceID))
2050 ewkViewCancelNotification(ewkView, ewk_notification_id_get(notificationForReplace));
2054 impl->notifications = eina_list_append(impl->notifications, notification);
2055 evas_object_smart_callback_call(ewkView, "notification,show", notification);
2058 void ewkViewDeleteNotificationPermissionRequest(Evas_Object* ewkView, Ewk_Notification_Permission_Request* ewkNotificationPermissionRequest)
2060 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2061 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2063 impl->notificationPermissionRequests = eina_list_remove(impl->notificationPermissionRequests, ewkNotificationPermissionRequest);
2067 #if ENABLE(TIZEN_REGISTER_PROTOCOL_HANDLER)
2068 void ewkViewRegisterProtocolHandlers(Evas_Object* ewkView, const char* scheme, const char* baseUrl, const char* url, const char* title)
2070 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2072 TIZEN_LOGI("protocolhandler,registration,requested");
2073 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(scheme, baseUrl, url, title);
2074 evas_object_smart_callback_call(ewkView, "protocolhandler,registration,requested", static_cast<void*>(customHandlersData));
2075 ewkCustomHandlersDeleteData(customHandlersData);
2079 #if ENABLE(TIZEN_CUSTOM_SCHEME_HANDLER)
2080 Ewk_Custom_Handlers_State ewkViewIsProtocolHandlerRegistered(Evas_Object* ewkView, const char* scheme, const char* baseURL, const char* url)
2082 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, EWK_CUSTOM_HANDLERS_DECLINED);
2084 TIZEN_LOGI("protocolhandler,isregistered");
2085 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(scheme, baseURL, url);
2086 evas_object_smart_callback_call(ewkView, "protocolhandler,isregistered", static_cast<void*>(customHandlersData));
2088 Ewk_Custom_Handlers_State result;
2089 result = ewkGetCustomHandlersDataResult(customHandlersData);
2090 ewkCustomHandlersDeleteData(customHandlersData);
2095 void ewkViewUnregisterProtocolHandlers(Evas_Object* ewkView, const char* scheme, const char* baseURL, const char* url)
2097 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2099 TIZEN_LOGI("protocolhandler,unregistration,requested");
2100 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(scheme, baseURL, url);
2101 evas_object_smart_callback_call(ewkView, "protocolhandler,unregistration,requested", static_cast<void*>(customHandlersData));
2102 ewkCustomHandlersDeleteData(customHandlersData);
2106 #if ENABLE(TIZEN_REGISTER_CONTENT_HANDLER)
2107 void ewkViewRegisterContentHandlers(Evas_Object* ewkView, const char* mimeType, const char* baseUrl, const char* url, const char* title)
2109 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2111 TIZEN_LOGI("contenthandler,registration,requested");
2112 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(mimeType, baseUrl, url, title);
2113 evas_object_smart_callback_call(ewkView, "contenthandler,registration,requested", static_cast<void*>(customHandlersData));
2114 ewkCustomHandlersDeleteData(customHandlersData);
2117 Ewk_Custom_Handlers_State ewkViewIsContentHandlerRegistered(Evas_Object* ewkView, const char* mimeType, const char* baseURL, const char* url)
2119 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, EWK_CUSTOM_HANDLERS_DECLINED);
2121 TIZEN_LOGI("contenthandler,isregistered");
2122 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(mimeType, baseURL, url);
2123 evas_object_smart_callback_call(ewkView, "contenthandler,isregistered", static_cast<void*>(customHandlersData));
2125 Ewk_Custom_Handlers_State result;
2126 result = ewkGetCustomHandlersDataResult(customHandlersData);
2127 ewkCustomHandlersDeleteData(customHandlersData);
2132 void ewkViewUnregisterContentHandlers(Evas_Object* ewkView, const char* mimeType, const char* baseURL, const char* url)
2134 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2136 TIZEN_LOGI("contenthandler,unregistration,requested");
2137 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(mimeType, baseURL, url);
2138 evas_object_smart_callback_call(ewkView, "contenthandler,unregistration,requested", static_cast<void*>(customHandlersData));
2139 ewkCustomHandlersDeleteData(customHandlersData);
2143 #if ENABLE(TIZEN_SEARCH_PROVIDER)
2144 void ewkViewAddSearchProvider(Evas_Object* ewkView, const char* baseURL, const char* engineURL)
2146 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2148 TIZEN_LOGI("searchProvider,add");
2149 Ewk_Search_Provider_Data* searchProviderData = ewkSearchProviderCreateData(baseURL, engineURL);
2150 evas_object_smart_callback_call(ewkView, "searchProvider,add", static_cast<void*>(searchProviderData));
2151 ewkSearchProviderDeleteData(searchProviderData);
2154 unsigned long ewkViewIsSearchProviderInstalled(Evas_Object* ewkView, const char* baseURL, const char* engineURL)
2156 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, 0);
2158 TIZEN_LOGI("searchProvider,installed");
2159 Ewk_Search_Provider_Data* searchProviderData = ewkSearchProviderCreateData(baseURL, engineURL);
2160 evas_object_smart_callback_call(ewkView, "searchProvider,installed", static_cast<void*>(searchProviderData));
2161 unsigned long result;
2162 result = ewkGetSearchProviderResult(searchProviderData);
2163 ewkSearchProviderDeleteData(searchProviderData);
2168 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
2169 bool ewkViewGetStandaloneStatus(Evas_Object* ewkView)
2171 TIZEN_LOGI("webapp,metatag,standalone");
2172 bool standalone = true;
2173 evas_object_smart_callback_call(ewkView, "webapp,metatag,standalone", (void*)&standalone);
2178 #if ENABLE(TIZEN_MEDIA_STREAM)
2179 void ewkViewRequestUserMediaPermission(Evas_Object* ewkView, Ewk_User_Media_Permission_Request* userMediaPermission)
2181 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2182 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2184 impl->userMediaPermissionRequests = eina_list_append(impl->userMediaPermissionRequests, userMediaPermission);
2185 evas_object_smart_callback_call(ewkView, "usermedia,permission,request", userMediaPermission);
2188 void ewkViewDeleteUserMediaPermissionRequest(Evas_Object* ewkView, Ewk_User_Media_Permission_Request* permission)
2190 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2191 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2193 impl->userMediaPermissionRequests = eina_list_remove(impl->userMediaPermissionRequests, permission);
2198 #if ENABLE(TIZEN_JSBRIDGE_PLUGIN)
2199 void ewkViewProcessJSBridgePlugin(Evas_Object* ewkView, WKStringRef request, WKStringRef message)
2201 int requestLength = WKStringGetMaximumUTF8CStringSize(request);
2202 OwnArrayPtr<char> requestBuffer = adoptArrayPtr(new char[requestLength]);
2203 int messageLength = WKStringGetMaximumUTF8CStringSize(message);
2204 OwnArrayPtr<char> messageBuffer = adoptArrayPtr(new char[messageLength]);
2205 WKStringGetUTF8CString(request, requestBuffer.get(), requestLength);
2206 WKStringGetUTF8CString(message, messageBuffer.get(), messageLength);
2208 evas_object_smart_callback_call(ewkView, requestBuffer.get(), static_cast<void*>(messageBuffer.get()));
2212 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
2213 void ewkViewRequestCertificateConfirm(Evas_Object* ewkView, Ewk_Certificate_Policy_Decision* certificatePolicyDecision)
2215 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
2216 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
2217 if (impl->certificatePolicyDecision)
2218 ewkCertificatePolicyDecisionDelete(impl->certificatePolicyDecision);
2219 impl->certificatePolicyDecision = certificatePolicyDecision;
2221 evas_object_smart_callback_call(ewkView, "request,certificate,confirm", certificatePolicyDecision);
2225 void ewkViewCustomizeContextMenu(Evas_Object* ewkView, Ewk_Context_Menu* menu)
2227 evas_object_smart_callback_call(ewkView, "contextmenu,customize", static_cast<void*>(menu));
2230 void ewkViewCustomContextMenuItemSelected(Evas_Object* ewkView, Ewk_Context_Menu_Item* item)
2232 evas_object_smart_callback_call(ewkView, "contextmenu,selected", static_cast<void*>(item));
2235 #if ENABLE(TIZEN_GEOLOCATION)
2236 void ewkViewRequestGeolocationPermission(Evas_Object* ewkView, Ewk_Geolocation_Permission_Request* geolocationPermissionRequest)
2238 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2239 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2241 TIZEN_LOGI("geolocation,permission,request");
2242 impl->geolocationPermissionRequests = eina_list_append(impl->geolocationPermissionRequests, geolocationPermissionRequest);
2243 evas_object_smart_callback_call(ewkView, "geolocation,permission,request", geolocationPermissionRequest);
2246 void ewkViewDeleteGeolocationPermission(Evas_Object* ewkView, Ewk_Geolocation_Permission_Request* geolocationPermissionRequest)
2248 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2249 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2251 impl->geolocationPermissionRequests = eina_list_remove(impl->geolocationPermissionRequests, geolocationPermissionRequest);
2254 void ewkViewSetGeolocation(Evas_Object* ewkView, Ewk_Geolocation* geolocation)
2256 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2257 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2259 impl->geolocation = geolocation;
2262 Ewk_Geolocation* ewkViewGetGeolocation(Evas_Object* ewkView)
2264 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2265 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
2267 return impl->geolocation;
2270 bool ewkViewIsValidLocationService(Evas_Object* ewkView)
2272 TIZEN_LOGI("geolocation,valid");
2275 evas_object_smart_callback_call(ewkView, "geolocation,valid", &valid);
2280 void ewkViewFormSubmit(Evas_Object* ewkView, Ewk_Form_Data* formData)
2282 evas_object_smart_callback_call(ewkView, "form,submit", formData);
2285 void ewkViewPolicyNavigationDecide(Evas_Object* ewkView, Ewk_Policy_Decision* policyDecision)
2287 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
2288 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
2289 if (impl->policyDecision)
2290 ewkPolicyDecisionDelete(impl->policyDecision);
2291 impl->policyDecision = policyDecision;
2293 evas_object_smart_callback_call(ewkView, "policy,navigation,decide", impl->policyDecision);
2296 void ewkViewPolicyNewWindowDecide(Evas_Object* ewkView, Ewk_Policy_Decision* policyDecision)
2298 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
2299 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
2300 if (impl->policyDecision)
2301 ewkPolicyDecisionDelete(impl->policyDecision);
2302 impl->policyDecision = policyDecision;
2304 evas_object_smart_callback_call(ewkView, "policy,newwindow,decide", impl->policyDecision);
2307 void ewkViewPolicyResponseDecide(Evas_Object* ewkView, Ewk_Policy_Decision* policyDecision)
2309 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
2310 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
2311 if (impl->policyDecision)
2312 ewkPolicyDecisionDelete(impl->policyDecision);
2313 impl->policyDecision = policyDecision;
2315 evas_object_smart_callback_call(ewkView, "policy,response,decide", impl->policyDecision);
2318 void ewkViewSendScrollEvent(Evas_Object* ewkView, int deltaX, int deltaY)
2320 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2321 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2323 IntPoint scrollPosition = impl->pageClient->scrollPosition();
2324 IntSize contentsSize = impl->pageProxy->contentsSize();
2325 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2326 contentsSize.scale(impl->pageClient->scaleFactor());
2329 // some website's contents size is smaller than view size,
2330 // so we have to adjust contents size to view size for that case.
2331 if (contentsSize.width() < smartData->view.w)
2332 contentsSize.setWidth(smartData->view.w);
2333 if (contentsSize.height() < smartData->view.h)
2334 contentsSize.setHeight(smartData->view.h);
2336 // Call "scroll,down" if webview can be scrolled down.
2337 if (deltaY > 0 && (scrollPosition.y() + smartData->view.h) < contentsSize.height())
2338 evas_object_smart_callback_call(ewkView, "scroll,down", 0);
2339 // Call "scroll,up" if webview can be scrolled up.
2340 else if (deltaY < 0 && scrollPosition.y() > 0)
2341 evas_object_smart_callback_call(ewkView, "scroll,up", 0);
2343 // Call "scroll,right" if webview can be scrolled down.
2344 if (deltaX > 0 && (scrollPosition.x() + smartData->view.w) < contentsSize.width())
2345 evas_object_smart_callback_call(ewkView, "scroll,right", 0);
2346 // Call "scroll,left" if webview can be scrolled up.
2347 else if (deltaX < 0 && scrollPosition.x() > 0)
2348 evas_object_smart_callback_call(ewkView, "scroll,left", 0);
2351 void ewkViewSendEdgeEvent(Evas_Object* ewkView, const IntPoint& scrollPosition, int deltaX, int deltaY)
2353 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2354 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2356 IntSize contentsSize = impl->pageProxy->contentsSize();
2357 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2358 contentsSize.scale(impl->pageClient->scaleFactor());
2361 int maxScrollY = contentsSize.height() - smartData->view.h;
2362 if (!impl->isVerticalEdge) {
2363 if (deltaY < 0 && (scrollPosition.y() + deltaY) <= 0) {
2364 evas_object_smart_callback_call(ewkView, "edge,top", NULL);
2365 impl->isVerticalEdge = true;
2366 } else if (deltaY > 0 && (scrollPosition.y() + deltaY) >= maxScrollY) {
2367 evas_object_smart_callback_call(ewkView, "edge,bottom", NULL);
2368 impl->isVerticalEdge = true;
2371 if (maxScrollY && ((scrollPosition.y() == 0 && deltaY > 0)
2372 || (scrollPosition.y() == maxScrollY && deltaY < 0)))
2373 impl->isVerticalEdge = false;
2376 int maxScrollX = contentsSize.width() - smartData->view.w;
2377 if (!impl->isHorizontalEdge) {
2378 if (deltaX < 0 && (scrollPosition.x() + deltaX) <= 0) {
2379 evas_object_smart_callback_call(ewkView, "edge,left", NULL);
2380 impl->isHorizontalEdge = true;
2381 } else if (deltaX > 0 && (scrollPosition.x() + deltaX) >= maxScrollX) {
2382 evas_object_smart_callback_call(ewkView, "edge,right", NULL);
2383 impl->isHorizontalEdge = true;
2386 if (maxScrollX && ((scrollPosition.x() == 0 && deltaX > 0)
2387 || (scrollPosition.x() == maxScrollX && deltaX < 0)))
2388 impl->isHorizontalEdge = false;
2392 void ewkViewClearEdges(Evas_Object* ewkView)
2394 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2395 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2397 impl->isVerticalEdge = false;
2398 impl->isHorizontalEdge = false;
2401 void ewk_view_scale_range_get(Evas_Object* ewkView, double* minimumScale, double* maximumScale)
2403 EWK_VIEW_SD_GET(ewkView, smartData);
2404 if (!smartData || !smartData->priv) {
2412 PageClientImpl::ViewportConstraints constraints = smartData->priv->pageClient->viewportConstraints();
2414 *minimumScale = constraints.minimumScale;
2416 *maximumScale = constraints.maximumScale;
2419 bool ewk_view_focused_node_adjust(Evas_Object* ewkView, Eina_Bool adjustForExternalKeyboard)
2421 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2422 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2424 double scaleFactor = impl->pageClient->scaleFactor();
2425 IntSize contentsSize = impl->pageProxy->contentsSize();
2427 double newScaleFactor = scaleFactor;
2428 // Readable zoom value is dependent on device DPI
2429 if (scaleFactor < impl->pageProxy->deviceScaleFactor()
2430 && impl->pageClient->viewportConstraints().userScalable)
2431 newScaleFactor = impl->pageProxy->deviceScaleFactor();
2433 // Readable zoom value should be inside of viewport scale range
2434 newScaleFactor = impl->pageClient->adjustScaleWithViewport(newScaleFactor);
2436 // scale contents' size with new scale factor
2437 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2438 contentsSize.scale(newScaleFactor);
2440 contentsSize.scale(newScaleFactor / scaleFactor);
2443 #if ENABLE(TIZEN_ISF_PORT)
2444 Ecore_X_Window rootWin = ecore_x_window_root_first_get();
2445 ecore_x_event_mask_set(rootWin, ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
2446 Ecore_X_Atom xAtom = ecore_x_atom_get("X External Keyboard Exist");
2447 unsigned int connectedKeyboardNum = 0;
2448 bool isExternalKeyboardConnected = false;
2450 // get connected keyboard number
2451 if (ecore_x_window_prop_card32_get(rootWin, xAtom, &connectedKeyboardNum, 1)
2452 && connectedKeyboardNum)
2453 isExternalKeyboardConnected = true;
2455 // We should treat both of ECORE_IMF_INPUT_PANEL_STATE_SHOW and ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW
2456 // as IME is shown. ECORE_IMF_INPUT_PANEL_STATE_HIDE is ignored at here.
2457 // input field zoom should not work with below conditions
2458 // 1. view is not focused
2459 // 2. external keyboard is not connected(if adjustForExternalKeyboard is true)
2460 // 3. imfContext is null(if adjustForExternalKeyboard is false)
2461 // 4. input panel state is hidden(if adjustForExternalKeyboard is false)
2462 if ((!(static_cast<PageClient*>(impl->pageClient.get()))->isViewFocused()
2463 || (adjustForExternalKeyboard && !isExternalKeyboardConnected)
2464 || (!adjustForExternalKeyboard && !impl->inputMethodContext())
2465 || (!adjustForExternalKeyboard && !impl->inputMethodContext()->isShow()))
2466 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
2467 && !(impl->pageClient->isClipboardWindowOpened())
2473 // caret position can be outside of visible rect.
2474 // we need to consider it.
2475 IntRect selectionRect = impl->pageProxy->getSelectionRect(true);
2476 IntRect focusedNodeRect = impl->pageClient->focusedNodeRect();
2477 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2478 selectionRect.scale(newScaleFactor);
2479 focusedNodeRect.scale(newScaleFactor);
2481 selectionRect.scale(newScaleFactor / scaleFactor);
2482 focusedNodeRect.scale(newScaleFactor / scaleFactor);
2484 if (selectionRect.isEmpty())
2487 IntRect visibleRect = impl->pageClient->visibleContentRect();
2488 IntPoint scrollPosition = visibleRect.location();
2489 // Do not adjust scroll position if selection rect (caret) is visible after scaling.
2490 if (!visibleRect.contains(selectionRect)) {
2492 scrollPosition = IntPoint(selectionRect.x() - visibleRect.width() / 3, selectionRect.y() - visibleRect.height() / 3);
2493 // If both input field's position x and selection rect can be displayed together,
2494 // adjust scroll position to input field's position x.
2495 if (!focusedNodeRect.isEmpty() && selectionRect.x() - focusedNodeRect.x() < visibleRect.width() * 4 / 5)
2496 scrollPosition.setX(focusedNodeRect.x());
2499 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2500 impl->pageClient->setVisibleContentRect(IntRect(scrollPosition, impl->size()), newScaleFactor);
2502 if (newScaleFactor != scaleFactor)
2503 impl->pageProxy->scalePage(newScaleFactor, scrollPosition);
2505 impl->pageProxy->scrollMainFrameTo(scrollPosition);
2507 evas_object_move(smartData->image, smartData->view.x, smartData->view.y);
2511 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
2512 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
2513 static Eina_Bool _ewk_view_composite(void* data)
2515 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
2516 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2518 if (!evas_object_visible_get(smartData->image))
2519 return ECORE_CALLBACK_CANCEL;
2522 evas_object_image_size_get(smartData->image, &ow, &oh);
2523 uint8_t* pixels = static_cast<uint8_t*>(evas_object_image_data_get(smartData->image, true));
2525 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)));
2526 RefPtr<cairo_t> context = adoptRef(cairo_create(surface.get()));
2528 cairo_save(context.get());
2529 cairo_set_operator(context.get(), CAIRO_OPERATOR_CLEAR);
2530 cairo_rectangle(context.get(), 0, 0, ow, oh);
2531 cairo_fill(context.get());
2532 cairo_restore(context.get());
2534 impl->pageClient->drawContents(context.get());
2536 evas_object_image_data_set(smartData->image, pixels);
2537 evas_object_image_data_update_add(smartData->image, 0, 0, ow, oh);
2539 ewkViewFrameRendered(smartData->self);
2541 impl->compositionAnimator = 0;
2543 return ECORE_CALLBACK_CANCEL;
2547 void ewk_view_mark_for_sync(Evas_Object* ewkView)
2549 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2550 EINA_SAFETY_ON_NULL_RETURN(smartData->image);
2552 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
2553 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2555 if (!ewk_view_is_opengl_backend(ewkView)) {
2556 if (!impl->compositionAnimator)
2557 impl->compositionAnimator = ecore_animator_add(_ewk_view_composite, smartData);
2562 evas_object_image_pixels_dirty_set(smartData->image, true);
2565 static void on_pixels_for_accelerated_compositing(void* data, Evas_Object* obj)
2567 Evas_Object* ewkView = static_cast<Evas_Object*>(data);
2568 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2569 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2570 impl->pageClient->drawContents();
2573 bool ewk_view_image_native_surface_set(Evas_Object* ewkView, Evas_Native_Surface* nativeSurface)
2575 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2576 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2578 if (!smartData->image)
2581 evas_object_image_native_surface_set(smartData->image, nativeSurface);
2582 evas_object_image_pixels_get_callback_set(smartData->image, on_pixels_for_accelerated_compositing, ewkView);
2588 void _ewk_view_suspend_painting(Evas_Object* ewkView)
2590 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2591 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2593 if (!impl->suspendedPainting) {
2594 impl->pageProxy->suspendPainting();
2595 impl->suspendedPainting = true;
2599 void _ewk_view_resume_painting(Evas_Object* ewkView)
2601 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2602 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2604 if (impl->suspendedPainting) {
2605 impl->pageProxy->resumePainting();
2606 impl->suspendedPainting = false;
2610 void ewk_view_suspend(Evas_Object* ewkView)
2612 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2613 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2615 if (impl->pageProxy->estimatedProgress() < 1.0) {
2616 impl->suspendRequested = true;
2619 impl->suspendRequested = false;
2621 _ewk_view_suspend_painting(ewkView);
2623 // FIXME Workaround for suspend/resume while javascript popup is displayed.
2624 // condition ' && !private->isWaitingForJavaScriptPopupReply' is added to
2625 // skip suspendJavaScriptAndResource to prevent multiple ActiveDOMObject
2627 // During the javascript popup is displayed, PageGroupLoadDeferrer is activated,
2628 // which suspends resource loading and scheduled tasks, including ActiveDOMObject.
2629 // When ewk_view_suspend() is called during the javascript popup, scheduled tasks
2630 // will be suspended again.
2631 // Multiple suspend of ActiveDOMObject makes unintended suspend/resume status of
2632 // the ActiveDOMObject.
2633 if (!impl->suspendedResources && (!impl->isWaitingForJavaScriptPopupReply || !impl->isWaitingForApplicationCachePermission || !impl->isWaitingForExceededQuotaPopupReply)) {
2634 impl->pageProxy->suspendJavaScriptAndResource();
2635 impl->suspendedResources = true;
2638 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
2639 impl->pageProxy->suspendPlugin();
2643 void ewk_view_resume(Evas_Object* ewkView)
2645 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2646 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2648 if (impl->suspendRequested) {
2649 impl->suspendRequested = false;
2653 _ewk_view_resume_painting(ewkView);
2655 // FIXME Workaround for suspend/resume while javascript popup is displayed.
2656 // condition ' && !private->isWaitingForJavaScriptPopupReply' is added to
2657 // skip suspendJavaScriptAndResource to prevent multiple ActiveDOMObject
2659 // During the javascript popup is displayed, PageGroupLoadDeferrer is activated,
2660 // which suspends resource loading and scheduled tasks, including ActiveDOMObject.
2661 // When ewk_view_suspend() is called during the javascript popup, scheduled tasks
2662 // will be suspended again.
2663 // Multiple suspend of ActiveDOMObject makes unintended suspend/resume status of
2664 // the ActiveDOMObject.
2665 if (impl->suspendedResources && (!impl->isWaitingForJavaScriptPopupReply || !impl->isWaitingForApplicationCachePermission || !impl->isWaitingForExceededQuotaPopupReply)) {
2666 impl->pageProxy->resumeJavaScriptAndResource();
2667 impl->suspendedResources = false;
2670 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
2671 impl->pageProxy->resumePlugin();
2675 Eina_Bool ewk_view_url_request_set(Evas_Object* ewkView, const char* url, Ewk_Http_Method method, Eina_Hash* headers, const char* body)
2677 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2678 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2679 EINA_SAFETY_ON_NULL_RETURN_VAL(url, false);
2681 ResourceRequest request(String::fromUTF8(url));
2684 case EWK_HTTP_METHOD_GET:
2685 request.setHTTPMethod("GET");
2687 case EWK_HTTP_METHOD_HEAD:
2688 request.setHTTPMethod("HEAD");
2690 case EWK_HTTP_METHOD_POST:
2691 request.setHTTPMethod("POST");
2693 case EWK_HTTP_METHOD_PUT:
2694 request.setHTTPMethod("PUT");
2696 case EWK_HTTP_METHOD_DELETE:
2697 request.setHTTPMethod("DELETE");
2704 Eina_Iterator* it = eina_hash_iterator_tuple_new(headers);
2706 while (eina_iterator_next(it, &data)) {
2707 Eina_Hash_Tuple* t = static_cast<Eina_Hash_Tuple*>(data);
2708 const char* name = static_cast<const char*>(t->key);
2709 const char* value = static_cast<const char*>(t->data);
2710 request.addHTTPHeaderField(name, value);
2712 eina_iterator_free(it);
2716 request.setHTTPBody(FormData::create(body));
2718 WKRetainPtr<WKURLRequestRef> urlRequest(AdoptWK,toAPI(WebURLRequest::create(request).leakRef()));
2719 WKPageLoadURLRequest(toAPI(impl->pageProxy.get()), urlRequest.get());
2724 Eina_Bool ewk_view_plain_text_set(Evas_Object* ewkView, const char* plainText)
2726 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2727 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2729 WKRetainPtr<WKStringRef> plainTextRef(AdoptWK, WKStringCreateWithUTF8CString(plainText));
2730 WKPageLoadPlainTextString(toAPI(impl->pageProxy.get()), plainTextRef.get());
2735 Eina_Bool ewk_view_contents_set(Evas_Object* ewkView, const char* contents, size_t contentsSize, char* mimeType, char* encoding, char* baseUri)
2737 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2738 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2739 EINA_SAFETY_ON_NULL_RETURN_VAL(contents, false);
2741 if (contentsSize == 0)
2744 String mimeTypeString;
2746 mimeTypeString = String::fromUTF8(mimeType);
2748 mimeTypeString = String::fromUTF8("text/html");
2750 String encodingString;
2752 encodingString = String::fromUTF8(encoding);
2754 encodingString = String::fromUTF8("UTF-8");
2756 String baseUriString;
2758 baseUriString = String::fromUTF8(baseUri);
2760 baseUriString = String::fromUTF8("about:blank");
2762 WKRetainPtr<WKDataRef> contentsRef(AdoptWK, WKDataCreate(reinterpret_cast<const unsigned char*>(contents), contentsSize));
2763 impl->pageProxy->loadContentsbyMimeType(toImpl(contentsRef.get()), mimeTypeString, encodingString, baseUriString);
2768 Eina_Bool ewk_view_html_contents_set(Evas_Object* ewkView, const char* html, const char* baseUri)
2770 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2771 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2773 WKRetainPtr<WKStringRef> htmlString(AdoptWK, WKStringCreateWithUTF8CString(html));
2774 WKRetainPtr<WKURLRef> baseURL(AdoptWK, WKURLCreateWithUTF8CString(baseUri));
2776 WKPageLoadHTMLString(toAPI(impl->pageProxy.get()), htmlString.get(), baseURL.get());
2781 Eina_Bool ewk_view_page_visibility_state_set(Evas_Object* ewkView, Ewk_Page_Visibility_State pageVisibilityState, Eina_Bool initialState)
2783 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2784 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2786 TIZEN_LOGI("initialState (%d)", initialState);
2787 #if ENABLE(TIZEN_PAGE_VISIBILITY_API)
2788 WKPageSetPageVisibility(toAPI(impl->pageProxy.get()), static_cast<WKPageVisibilityState>(pageVisibilityState), initialState);
2795 Eina_Bool ewk_view_user_agent_set(Evas_Object* ewkView, const char* userAgent)
2797 EINA_SAFETY_ON_NULL_RETURN_VAL(userAgent, false);
2799 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2800 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2802 impl->userAgent = userAgent;
2804 WKRetainPtr<WKStringRef> userAgentString(AdoptWK, WKStringCreateWithUTF8CString(userAgent));
2805 WKPageSetCustomUserAgent(toAPI(impl->pageProxy.get()), userAgentString.get());
2810 const char* ewk_view_user_agent_get(const Evas_Object* ewkView)
2812 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2813 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
2815 if (!impl->userAgent) {
2816 WKRetainPtr<WKStringRef> userAgentString(AdoptWK, WKPageCopyUserAgent(toAPI(impl->pageProxy.get())));
2818 int length = WKStringGetMaximumUTF8CStringSize(userAgentString.get());
2819 OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length]);
2820 WKStringGetUTF8CString(userAgentString.get(), buffer.get(), length);
2821 impl->userAgent = buffer.get();
2824 return impl->userAgent;
2826 Eina_Bool ewk_view_custom_header_add(const Evas_Object* ewkView, const char* name, const char* value)
2828 #if ENABLE(TIZEN_CUSTOM_HEADERS)
2829 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2830 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2832 WKRetainPtr<WKStringRef> customHeaderName(AdoptWK, WKStringCreateWithUTF8CString(name));
2833 WKRetainPtr<WKStringRef> customHeaderValue(AdoptWK, WKStringCreateWithUTF8CString(value));
2835 WKPageAddCustomHeader(toAPI(impl->pageProxy.get()), customHeaderName.get(), customHeaderValue.get());
2838 ERR("TIZEN_CUSTOM_HEADERS not enabled!");
2843 Eina_Bool ewk_view_custom_header_remove(const Evas_Object* ewkView, const char* name)
2845 #if ENABLE(TIZEN_CUSTOM_HEADERS)
2846 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2847 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2849 WKRetainPtr<WKStringRef> customHeaderName(AdoptWK, WKStringCreateWithUTF8CString(name));
2851 WKPageRemoveCustomHeader(toAPI(impl->pageProxy.get()), customHeaderName.get());
2854 ERR("TIZEN_CUSTOM_HEADERS not enabled!");
2859 Eina_Bool ewk_view_custom_header_clear(const Evas_Object* ewkView)
2861 #if ENABLE(TIZEN_CUSTOM_HEADERS)
2862 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2863 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2865 WKPageClearCustomHeaders(toAPI(impl->pageProxy.get()));
2868 ERR("TIZEN_CUSTOM_HEADERS not enabled!");
2873 #if ENABLE(TIZEN_WEBKIT2_VIEW_VISIBILITY)
2874 Eina_Bool ewk_view_visibility_set(Evas_Object* ewkView, Eina_Bool enable)
2876 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2877 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2879 #if ENABLE(TIZEN_DRAG_SUPPORT)
2880 if (impl->pageClient->isDragMode())
2881 impl->pageClient->setDragMode(false);
2884 impl->pageClient->setIsVisible(enable);
2889 Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* ewkView, Eina_Rectangle viewArea, float scaleFactor, Evas* canvas)
2891 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
2893 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2894 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
2897 rect.origin.x = viewArea.x;
2898 rect.origin.y = viewArea.y;
2899 rect.size.width = viewArea.w;
2900 rect.size.height = viewArea.h;
2902 WKRetainPtr<WKImageRef> snapshot(AdoptWK, WKPageCreateSnapshot(toAPI(impl->pageProxy.get()), rect, scaleFactor));
2903 if (!snapshot.get())
2906 RefPtr<cairo_surface_t> screenshotSurface = adoptRef(WKImageCreateCairoSurface(snapshot.get()));
2908 Evas_Object* screenshotImage = evas_object_image_add(canvas);
2909 int surfaceWidth = cairo_image_surface_get_width(screenshotSurface.get());
2910 int surfaceHeight = cairo_image_surface_get_height(screenshotSurface.get());
2911 evas_object_image_size_set(screenshotImage, surfaceWidth, surfaceHeight);
2912 evas_object_image_colorspace_set(screenshotImage, EVAS_COLORSPACE_ARGB8888);
2914 uint8_t* pixels = static_cast<uint8_t*>(evas_object_image_data_get(screenshotImage, true));
2916 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)));
2917 RefPtr<cairo_t> cairo = adoptRef(cairo_create(imageSurface.get()));
2919 cairo_set_source_surface(cairo.get(), screenshotSurface.get(), 0, 0);
2920 cairo_rectangle(cairo.get(), 0, 0, surfaceWidth, surfaceHeight);
2921 cairo_fill(cairo.get());
2923 evas_object_image_smooth_scale_set(screenshotImage, true);
2924 evas_object_size_hint_min_set(screenshotImage, surfaceWidth, surfaceHeight);
2925 evas_object_resize(screenshotImage, surfaceWidth, surfaceHeight);
2926 evas_object_image_fill_set(screenshotImage, 0, 0, surfaceWidth, surfaceHeight);
2927 evas_object_image_data_set(screenshotImage, pixels);
2929 return screenshotImage;
2932 unsigned int ewk_view_inspector_server_start(Evas_Object* ewkView, unsigned int port)
2934 #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
2935 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd, 0);
2936 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl, 0);
2938 return impl->pageProxy->startInspectorServer(port);
2940 LOG_ERROR("TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR is disabled.\n");
2945 Eina_Bool ewk_view_inspector_server_stop(Evas_Object* ewkView)
2947 #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
2948 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd, false);
2949 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl, false);
2951 return impl->pageProxy->stopInspectorServer();
2953 LOG_ERROR("TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR is disabled.\n");
2958 void ewk_view_scroll_by(Evas_Object* ewkView, int deltaX, int deltaY)
2960 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2961 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2963 WKPageScrollBy(toAPI(impl->pageProxy.get()), toAPI(IntSize(deltaX, deltaY)));
2966 Eina_Bool ewk_view_scroll_pos_get(Evas_Object* ewkView, int* x, int* y)
2972 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2973 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2975 IntPoint scrollPosition = impl->pageClient->scrollPosition();
2977 *x = scrollPosition.x();
2979 *y = scrollPosition.y();
2984 Eina_Bool ewk_view_scroll_set(Evas_Object* ewkView, int x, int y)
2986 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2987 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2989 impl->pageProxy->scrollMainFrameTo(IntPoint(x, y));
2993 Eina_Bool ewk_view_scroll_size_get(const Evas_Object* ewkView, int* width, int* height)
2999 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3000 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3002 IntSize contentsSize = impl->pageProxy->contentsSize();
3003 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
3004 contentsSize.scale(impl->pageClient->scaleFactor());
3007 if (width && contentsSize.width() > smartData->view.w)
3008 *width = contentsSize.width() - smartData->view.w;
3009 if (height && contentsSize.height() > smartData->view.h)
3010 *height = contentsSize.height() - smartData->view.h;
3014 bool ewkViewRunJavaScriptAlert(Evas_Object* ewkView, WKStringRef alertText)
3016 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3017 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3018 if (!impl->alertContext || !impl->alertContext->javascriptAlertCallback)
3020 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->alertContext->ewkView == ewkView, false);
3022 impl->isWaitingForJavaScriptPopupReply = true;
3023 int length = WKStringGetMaximumUTF8CStringSize(alertText);
3024 OwnArrayPtr<char> alertTextBuffer = adoptArrayPtr(new char[length]);
3025 WKStringGetUTF8CString(alertText, alertTextBuffer.get(), length);
3026 return impl->alertContext->javascriptAlertCallback(impl->alertContext->ewkView, alertTextBuffer.get(), impl->alertContext->userData) == EINA_TRUE;
3029 bool ewkViewRunJavaScriptConfirm(Evas_Object* ewkView, WKStringRef message)
3031 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3032 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3033 if (!impl->confirmContext || !impl->confirmContext->javascriptConfirmCallback)
3035 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->confirmContext->ewkView == ewkView, false);
3037 impl->isWaitingForJavaScriptPopupReply = true;
3038 int length = WKStringGetMaximumUTF8CStringSize(message);
3039 OwnArrayPtr<char> messageBuffer = adoptArrayPtr(new char[length]);
3040 WKStringGetUTF8CString(message, messageBuffer.get(), length);
3041 return impl->confirmContext->javascriptConfirmCallback(impl->confirmContext->ewkView, messageBuffer.get(), impl->confirmContext->userData) == EINA_TRUE;
3044 bool ewkViewRunJavaScriptPrompt(Evas_Object* ewkView, WKStringRef message, WKStringRef defaultValue)
3046 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3047 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3048 if (!impl->promptContext || !impl->promptContext->javascriptPromptCallback)
3050 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->promptContext->ewkView == ewkView, false);
3052 impl->isWaitingForJavaScriptPopupReply = true;
3053 int length = WKStringGetMaximumUTF8CStringSize(message);
3054 OwnArrayPtr<char> messageBuffer = adoptArrayPtr(new char[length]);
3055 WKStringGetUTF8CString(message, messageBuffer.get(), length);
3056 length = WKStringGetMaximumUTF8CStringSize(defaultValue);
3057 OwnArrayPtr<char> defaultValueBuffer = adoptArrayPtr(new char[length]);
3058 WKStringGetUTF8CString(defaultValue, defaultValueBuffer.get(), length);
3059 return impl->promptContext->javascriptPromptCallback(impl->promptContext->ewkView, messageBuffer.get(), defaultValueBuffer.get(), impl->promptContext->userData) == EINA_TRUE;
3062 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
3063 bool ewk_view_run_before_unload_confirm_panel(Evas_Object* ewkView, WKStringRef message)
3065 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3066 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3067 if (!impl->beforeUnloadConfirmPanelContext || !impl->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback)
3069 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->beforeUnloadConfirmPanelContext->ewkView == ewkView, false);
3071 impl->isWaitingForJavaScriptPopupReply = true;
3072 int length = WKStringGetMaximumUTF8CStringSize(message);
3073 OwnArrayPtr<char> messageBuffer = adoptArrayPtr(new char[length]);
3074 WKStringGetUTF8CString(message, messageBuffer.get(), length);
3075 bool result = impl->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback(impl->beforeUnloadConfirmPanelContext->ewkView, messageBuffer.get(), impl->beforeUnloadConfirmPanelContext->userData) == EINA_TRUE;
3080 bool ewkViewRunOpenPanel(Evas_Object* ewkView, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener)
3082 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3083 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3084 if (!impl->openpanelContext || !impl->openpanelContext->openPanelCallback)
3087 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->openpanelContext->ewkView == ewkView, false);
3089 impl->openPanelListener = listener;
3091 Eina_Bool allowMultipleFiles = WKOpenPanelParametersGetAllowsMultipleFiles(parameters) ? EINA_TRUE : EINA_FALSE;
3092 Eina_List* acceptedMimeTypes = 0;
3093 WKRetainPtr<WKArrayRef> array(AdoptWK, WKOpenPanelParametersCopyAcceptedMIMETypes(parameters));
3094 size_t len = WKArrayGetSize(array.get());
3095 for (size_t i = 0; i < len; i++) {
3096 WKTypeRef item = WKArrayGetItemAtIndex(array.get(), i);
3097 if (WKGetTypeID(item) != WKStringGetTypeID())
3099 WKStringRef mime = static_cast<WKStringRef>(item);
3100 int length = WKStringGetMaximumUTF8CStringSize(mime);
3101 char* buffer = new char[length];
3102 WKStringGetUTF8CString(mime, buffer, length);
3103 acceptedMimeTypes = eina_list_append(acceptedMimeTypes, static_cast<const void*>(const_cast<const char*>(buffer)));
3105 const char* capture = 0;
3106 #if ENABLE(MEDIA_CAPTURE)
3107 WKRetainPtr<WKStringRef> captureRef(AdoptWK, WKOpenPanelParametersCopyCapture(parameters));
3108 capture = eina_stringshare_add(toImpl(captureRef.get())->string().utf8().data());
3110 bool result = impl->openpanelContext->openPanelCallback(impl->openpanelContext->ewkView, allowMultipleFiles, acceptedMimeTypes, capture, 0);
3111 if (!acceptedMimeTypes)
3116 EINA_LIST_FOREACH(acceptedMimeTypes, list, data)
3117 delete[] (char*)data;
3118 eina_list_free(acceptedMimeTypes);
3122 void ewk_view_javascript_alert_callback_set(Evas_Object* ewkView, Ewk_View_JavaScript_Alert_Callback callback, void* userData)
3124 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3125 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3127 if (!impl->alertContext)
3128 impl->alertContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3129 impl->alertContext->javascriptAlertCallback = callback;
3130 impl->alertContext->ewkView = ewkView;
3131 impl->alertContext->userData = userData;
3134 void ewk_view_javascript_alert_reply(Evas_Object* ewkView)
3136 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3137 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3139 WKPageReplyJavaScriptAlert(toAPI(impl->page()));
3140 impl->isWaitingForJavaScriptPopupReply = false;
3143 void ewk_view_javascript_confirm_callback_set(Evas_Object* ewkView, Ewk_View_JavaScript_Confirm_Callback callback, void* userData)
3145 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3146 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3148 if (!impl->confirmContext)
3149 impl->confirmContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3150 impl->confirmContext->javascriptConfirmCallback = callback;
3151 impl->confirmContext->ewkView = ewkView;
3152 impl->confirmContext->userData = userData;
3155 void ewk_view_javascript_confirm_reply(Evas_Object* ewkView, Eina_Bool result)
3157 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3158 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3160 WKPageReplyJavaScriptConfirm(toAPI(impl->page()), result == EINA_TRUE);
3161 impl->isWaitingForJavaScriptPopupReply = false;
3164 void ewk_view_javascript_prompt_callback_set(Evas_Object* ewkView, Ewk_View_JavaScript_Prompt_Callback callback, void* userData)
3166 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3167 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3169 if (!impl->promptContext)
3170 impl->promptContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3171 impl->promptContext->javascriptPromptCallback = callback;
3172 impl->promptContext->ewkView = ewkView;
3173 impl->promptContext->userData = userData;
3176 void ewk_view_javascript_prompt_reply(Evas_Object* ewkView, const char* result)
3178 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3179 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3181 WKRetainPtr<WKStringRef> resultString(AdoptWK, WKStringCreateWithUTF8CString(result));
3182 WKPageReplyJavaScriptPrompt(toAPI(impl->page()), result ? resultString.get() : 0);
3183 impl->isWaitingForJavaScriptPopupReply = false;
3186 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
3187 void ewk_view_before_unload_confirm_panel_callback_set(Evas_Object* ewkView, Ewk_View_Before_Unload_Confirm_Panel_Callback callback, void* userData)
3189 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3190 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3192 if (!impl->beforeUnloadConfirmPanelContext)
3193 impl->beforeUnloadConfirmPanelContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3194 impl->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback = callback;
3195 impl->beforeUnloadConfirmPanelContext->ewkView = ewkView;
3196 impl->beforeUnloadConfirmPanelContext->userData = userData;
3199 void ewk_view_before_unload_confirm_panel_reply(Evas_Object* ewkView, Eina_Bool result)
3201 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3202 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3204 WKPageReplyBeforeUnloadConfirmPanel(toAPI(impl->page()), result == EINA_TRUE);
3205 impl->isWaitingForJavaScriptPopupReply = false;
3209 void ewk_view_open_panel_callback_set(Evas_Object* ewkView, Ewk_View_Open_Panel_Callback callback, void* userData)
3211 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3212 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3214 if (!impl->openpanelContext)
3215 impl->openpanelContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3217 impl->openpanelContext->openPanelCallback = callback;
3218 impl->openpanelContext->ewkView = ewkView;
3219 impl->openpanelContext->userData = userData;
3222 void ewk_view_open_panel_reply(Evas_Object* ewkView, Eina_List* fileUrls, Eina_Bool result)
3224 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3225 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3227 if (!impl->openPanelListener)
3230 unsigned int size = eina_list_count(fileUrls);
3231 if ((result == EINA_FALSE) || (size == 0)) {
3232 WKOpenPanelResultListenerCancel(impl->openPanelListener);
3233 impl->openPanelListener = 0;
3237 WKTypeRef* items = new WKTypeRef[size];
3241 KURL base(KURL(), "file://");
3242 EINA_LIST_FOREACH(fileUrls, list, data) {
3243 KURL url(base, static_cast<char*>(data));
3244 items[i++] = WKURLCreateWithUTF8CString(url.string().utf8().data());
3246 WKRetainPtr<WKArrayRef> filesArray(AdoptWK, WKArrayCreate(items, size));
3247 WKOpenPanelResultListenerChooseFiles(impl->openPanelListener, filesArray.get());
3248 impl->openPanelListener = 0;
3250 eina_list_free(fileUrls);
3253 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3254 static void didGetWebAppCapable(WKBooleanRef capable, WKErrorRef, void* context)
3256 EINA_SAFETY_ON_NULL_RETURN(capable);
3257 EINA_SAFETY_ON_NULL_RETURN(context);
3259 Ewk_View_Callback_Context* webAppContext = static_cast<Ewk_View_Callback_Context*>(context);
3261 ASSERT(webAppContext->webAppCapableCallback);
3263 TIZEN_LOGI("webAppCapableCallback exist. capable(%b)", capable);
3265 webAppContext->webAppCapableCallback(toImpl(capable)->value(), webAppContext->userData);
3267 webAppContext->webAppCapableCallback(0, webAppContext->userData);
3269 delete webAppContext;
3272 static void didGetWebAppIconURL(WKStringRef iconURL, WKErrorRef, void* context)
3274 EINA_SAFETY_ON_NULL_RETURN(iconURL);
3275 EINA_SAFETY_ON_NULL_RETURN(context);
3277 Ewk_View_Callback_Context* webAppContext = static_cast<Ewk_View_Callback_Context*>(context);
3279 EWK_VIEW_SD_GET_OR_RETURN(webAppContext->ewkView, smartData);
3280 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3282 ASSERT(webAppContext->webAppIconURLCallback);
3285 impl->webAppIconURL = toImpl(iconURL)->string().utf8().data();
3286 webAppContext->webAppIconURLCallback(impl->webAppIconURL, webAppContext->userData);
3288 webAppContext->webAppIconURLCallback(0, webAppContext->userData);
3290 delete webAppContext;
3293 static void didGetWebAppIconURLs(WKDictionaryRef iconURLs, WKErrorRef, void* context)
3295 EINA_SAFETY_ON_NULL_RETURN(iconURLs);
3296 EINA_SAFETY_ON_NULL_RETURN(context);
3298 Ewk_View_Callback_Context* webAppContext = static_cast<Ewk_View_Callback_Context*>(context);
3300 EWK_VIEW_SD_GET_OR_RETURN(webAppContext->ewkView, smartData);
3301 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3303 ASSERT(webAppContext->webAppIconURLsCallback);
3305 if (impl->webAppIconURLs) {
3307 EINA_LIST_FREE(impl->webAppIconURLs, data)
3308 ewkWebAppIconDataDelete(static_cast<Ewk_Web_App_Icon_Data*>(data));
3311 WKRetainPtr<WKArrayRef> wkKeys(AdoptWK, WKDictionaryCopyKeys(iconURLs));
3312 size_t iconURLCount = WKArrayGetSize(wkKeys.get());
3313 for (size_t i = 0; i < iconURLCount; i++) {
3314 WKStringRef urlRef = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkKeys.get(), i));
3315 WKStringRef sizeRef = static_cast<WKStringRef>(WKDictionaryGetItemForKey(iconURLs, urlRef));
3316 impl->webAppIconURLs = eina_list_append(impl->webAppIconURLs, ewkWebAppIconDataCreate(sizeRef, urlRef));
3318 TIZEN_LOGI("webAppIconURLsCallback exist. found %d icon urls", iconURLCount);
3320 webAppContext->webAppIconURLsCallback(impl->webAppIconURLs, webAppContext->userData);
3321 delete webAppContext;
3325 Eina_Bool ewk_view_web_application_capable_get(Evas_Object* ewkView, Ewk_Web_App_Capable_Get_Callback callback, void* userData)
3327 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3328 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3329 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3330 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3332 TIZEN_LOGI("callback(%d), userData(%d)", callback, userData);
3333 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3334 context->webAppCapableCallback = callback;
3335 context->ewkView = ewkView;
3336 context->userData = userData;
3338 WKPageGetWebAppCapable(toAPI(impl->pageProxy.get()), context, didGetWebAppCapable);
3346 Eina_Bool ewk_view_web_application_icon_url_get(Evas_Object* ewkView, Ewk_Web_App_Icon_URL_Get_Callback callback, void* userData)
3348 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3349 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3350 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3351 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3353 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3354 context->webAppIconURLCallback = callback;
3355 context->ewkView = ewkView;
3356 context->userData = userData;
3358 WKPageGetWebAppIconURL(toAPI(impl->page()), context, didGetWebAppIconURL);
3366 Eina_Bool ewk_view_web_application_icon_urls_get(Evas_Object* ewkView, Ewk_Web_App_Icon_URLs_Get_Callback callback, void* userData)
3368 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3369 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3370 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3371 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3373 TIZEN_LOGI("callback(%d), userData(%d)", callback, userData);
3374 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3375 context->webAppIconURLsCallback = callback;
3376 context->ewkView = ewkView;
3377 context->userData = userData;
3379 WKPageGetWebAppIconURLs(toAPI(impl->page()), context, didGetWebAppIconURLs);
3383 UNUSED_PARAM(ewkView);
3384 UNUSED_PARAM(callback);
3385 UNUSED_PARAM(userData);
3390 Eina_Bool ewk_view_command_execute(Evas_Object* ewkView, const char* command, const char* value)
3392 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3393 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3394 EINA_SAFETY_ON_NULL_RETURN_VAL(command, false);
3396 WKRetainPtr<WKStringRef> commandString(AdoptWK, WKStringCreateWithUTF8CString(command));
3397 WKRetainPtr<WKStringRef> valueString(AdoptWK, WKStringCreateWithUTF8CString(value));
3398 WKPageExecuteCommandWithArgument(toAPI(impl->pageProxy.get()), commandString.get(), valueString.get());
3403 Eina_Bool ewk_view_contents_size_get(Evas_Object* ewkView, Evas_Coord* width, Evas_Coord* height)
3410 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3411 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3413 IntSize contentsSize = impl->pageProxy->contentsSize();
3416 *width = contentsSize.width();
3418 *height = contentsSize.height();
3423 Eina_Bool ewk_view_contents_pdf_get_temp(Evas_Object* ewkView, int width, int height, const char* fileName)
3425 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
3426 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3427 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3428 EINA_SAFETY_ON_NULL_RETURN_VAL(fileName, false);
3430 IntSize contentsSize = impl->pageProxy->contentsSize();
3431 WKPageGetSnapshotPdfFile(toAPI(impl->pageProxy.get()), toAPI(IntSize(width, height)), toAPI(IntSize(contentsSize.width(), contentsSize.height())), WKStringCreateWithUTF8CString(fileName));
3439 Eina_Bool ewk_view_contents_pdf_get(Evas_Object* ewkView, int width, int height, const char* fileName)
3441 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
3442 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3443 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3444 EINA_SAFETY_ON_NULL_RETURN_VAL(fileName, false);
3446 IntSize contentsSize = impl->pageProxy->contentsSize();
3447 WKPageGetSnapshotPdfFile(toAPI(impl->pageProxy.get()), toAPI(IntSize(width, height)), toAPI(IntSize(contentsSize.width(), contentsSize.height())), WKStringCreateWithUTF8CString(fileName));
3455 static void runJavaScriptCallback(WKSerializedScriptValueRef scriptValue, WKErrorRef error, void* context)
3457 EINA_SAFETY_ON_NULL_RETURN(context);
3458 Ewk_View_Callback_Context* callbackContext = static_cast<Ewk_View_Callback_Context*>(context);
3460 if (!callbackContext->scriptExecuteCallback) {
3461 delete callbackContext;
3465 JSGlobalContextRef jsGlobalContext = ewkViewGetJavascriptGlobalContext(callbackContext->ewkView);
3468 JSValueRef value = WKSerializedScriptValueDeserialize(scriptValue, jsGlobalContext, 0);
3469 JSRetainPtr<JSStringRef> jsStringValue(JSValueToStringCopy(jsGlobalContext, value, 0));
3470 size_t length = JSStringGetMaximumUTF8CStringSize(jsStringValue.get());
3471 OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length]);
3472 JSStringGetUTF8CString(jsStringValue.get(), buffer.get(), length);
3473 callbackContext->scriptExecuteCallback(callbackContext->ewkView, buffer.get(), callbackContext->userData);
3475 callbackContext->scriptExecuteCallback(callbackContext->ewkView, 0, callbackContext->userData);
3477 delete callbackContext;
3480 Eina_Bool ewk_view_script_execute(Evas_Object* ewkView, const char* script, Ewk_View_Script_Execute_Callback callback, void* user_data)
3482 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3483 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3484 EINA_SAFETY_ON_NULL_RETURN_VAL(script, false);
3485 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->pageClient, false);
3487 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3488 context->scriptExecuteCallback = callback;
3489 context->ewkView = ewkView;
3490 context->userData = user_data;
3491 WKRetainPtr<WKStringRef> scriptString(AdoptWK, WKStringCreateWithUTF8CString(script));
3492 WKPageRunJavaScriptInMainFrame(toAPI(impl->pageProxy.get()), scriptString.get(), context, runJavaScriptCallback);
3497 #if ENABLE(TIZEN_WEB_STORAGE) && ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
3498 static void didGetWebStorageQuota(WKUInt32Ref quota, WKErrorRef error, void* context)
3500 Ewk_View_Callback_Context* storageContext = static_cast<Ewk_View_Callback_Context*>(context);
3503 storageContext->webStorageQuotaCallback(toImpl(quota)->value(), storageContext->userData);
3505 storageContext->webStorageQuotaCallback(0, storageContext->userData);
3507 delete storageContext;
3511 Eina_Bool ewk_view_web_storage_quota_get(const Evas_Object* ewkView, Ewk_Web_Storage_Quota_Get_Callback resultCallback, void* userData)
3513 #if ENABLE(TIZEN_WEB_STORAGE) && ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
3514 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, false);
3515 EINA_SAFETY_ON_NULL_RETURN_VAL(resultCallback, false);
3516 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3517 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3518 TIZEN_LOGI("resultCallback (%p)", resultCallback);
3520 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3521 context->webStorageQuotaCallback = resultCallback;
3522 context->userData = userData;
3524 WKPageRef pageRef = toAPI(impl->page());
3525 WKPageGetWebStorageQuota(pageRef, context, didGetWebStorageQuota);
3533 Eina_Bool ewk_view_web_storage_quota_set(Evas_Object* ewkView, uint32_t quota)
3535 #if ENABLE(TIZEN_WEB_STORAGE)
3536 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, false);
3537 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3538 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3540 TIZEN_LOGI("quota (%d)", quota);
3541 WKPageRef pageRef = toAPI(impl->page());
3542 WKPageSetWebStorageQuota(pageRef, quota);
3550 static void getContentsAsStringCallback(WKStringRef plain_text, WKErrorRef error, void* context)
3552 EINA_SAFETY_ON_NULL_RETURN(context);
3553 Ewk_View_Callback_Context* callbackContext = static_cast<Ewk_View_Callback_Context*>(context);
3555 ASSERT(callbackContext->plainTextGetCallback);
3558 size_t length = WKStringGetMaximumUTF8CStringSize(plain_text);
3559 OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length]);
3560 WKStringGetUTF8CString(plain_text, buffer.get(), length);
3562 callbackContext->plainTextGetCallback(callbackContext->ewkView, buffer.get(), callbackContext->userData);
3564 callbackContext->plainTextGetCallback(callbackContext->ewkView, 0, callbackContext->userData);
3566 delete callbackContext;
3569 Eina_Bool ewk_view_plain_text_get(Evas_Object* ewkView, Ewk_View_Plain_Text_Get_Callback callback, void* user_data)
3571 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3572 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3573 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3574 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->pageClient, false);
3576 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3577 context->plainTextGetCallback = callback;
3578 context->ewkView = ewkView;
3579 context->userData = user_data;
3580 WKPageGetContentsAsString(toAPI(impl->pageProxy.get()), context, getContentsAsStringCallback);
3585 #if ENABLE(TIZEN_SUPPORT_MHTML)
3588 * Callback function used for ewk_view_mhtml_data_get().
3590 static void getContentsAsMHTMLCallback(WKDataRef wkData, WKErrorRef, void* context)
3592 EINA_SAFETY_ON_NULL_RETURN(context);
3593 Ewk_View_Callback_Context* callbackContext = static_cast<Ewk_View_Callback_Context*>(context);
3595 ASSERT(callbackContext->mhtmlDataGetCallback);
3597 callbackContext->mhtmlDataGetCallback(callbackContext->ewkView, reinterpret_cast<const char*>(WKDataGetBytes(wkData)), callbackContext->userData);
3599 delete callbackContext;
3602 Eina_Bool ewk_view_mhtml_data_get(Evas_Object* ewkView, Ewk_View_MHTML_Data_Get_Callback callback, void* user_data)
3604 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3605 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3606 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3608 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3609 context->mhtmlDataGetCallback = callback;
3610 context->ewkView = ewkView;
3611 context->userData = user_data;
3613 WKPageGetContentsAsMHTMLData(toAPI(impl->page()), false, context, getContentsAsMHTMLCallback);
3617 #endif // ENABLE(TIZEN_SUPPORT_MHTML)
3619 Ewk_Hit_Test* ewk_view_hit_test_new(Evas_Object* ewkView, int x, int y, int hitTestMode)
3621 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
3622 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3623 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3625 IntPoint pointForHitTest = impl->transformFromScene().mapPoint(IntPoint(x, y));
3626 WebHitTestResult::Data hitTestResultData = impl->pageProxy->hitTestResultAtPoint(pointForHitTest, hitTestMode);
3627 Ewk_Hit_Test* hitTest = ewkHitTestCreate(hitTestResultData);
3635 Ewk_History* ewk_view_history_get(Evas_Object* ewkView)
3637 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, 0);
3638 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3639 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3640 WebPageProxy* page = impl->page();
3641 EINA_SAFETY_ON_NULL_RETURN_VAL(page, 0);
3643 return ewkHistoryCreate(WKPageGetBackForwardList(toAPI(page)));
3646 Eina_Bool ewk_view_recording_surface_enable_set(Evas_Object* ewkView, Eina_Bool enable)
3648 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3649 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3651 WKPageRecordingSurfaceSetEnable(toAPI(impl->pageProxy.get()), enable);
3656 Eina_Bool ewk_view_notification_closed(Evas_Object* ewkView, Eina_List* ewkNotifications)
3658 #if ENABLE(TIZEN_NOTIFICATIONS)
3659 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3660 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3661 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context, false);
3663 TIZEN_LOGI("ewkNotifications (%p)", ewkNotifications);
3664 if (!eina_list_count(ewkNotifications))
3667 Eina_List* listIterator = 0;
3669 Vector<WKTypeRef> ids;
3670 EINA_LIST_FOREACH(ewkNotifications, listIterator, data) {
3671 Ewk_Notification* notification = static_cast<Ewk_Notification*>(data);
3672 WKUInt64Ref idRef = WKUInt64Create(ewk_notification_id_get(notification));
3674 impl->notifications = eina_list_remove(impl->notifications, notification);
3677 WKRetainPtr<WKArrayRef> notificationIDsArray(AdoptWK, WKArrayCreate(ids.data(), ids.size()));
3678 WKNotificationManagerRef notificationManager = WKContextGetNotificationManager(impl->context->wkContext());
3679 WKNotificationManagerProviderDidCloseNotifications(notificationManager, notificationIDsArray.get());
3680 ewkNotificationDeleteNotificationList(ewkNotifications);
3688 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
3689 static Eina_List* createPopupMenuList(const Vector<WebPopupItem>& items)
3691 Eina_List* popupItems = 0;
3692 size_t size = items.size();
3693 for (size_t i = 0; i < size; ++i)
3694 popupItems = eina_list_append(popupItems, Ewk_Popup_Menu_Item::create(items[i]).leakPtr());
3695 TIZEN_LOGI("size : %d", size);
3699 static void releasePopupMenuList(Eina_List* popupMenuItems)
3701 if (!popupMenuItems)
3705 EINA_LIST_FREE(popupMenuItems, item)
3706 delete static_cast<Ewk_Popup_Menu_Item*>(item);
3710 Eina_Bool ewk_view_popup_menu_close(Evas_Object* ewkView)
3712 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3713 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3714 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
3716 TIZEN_LOGI("proxy : %p", impl->popupMenuProxy);
3719 if (!impl->popupMenuProxy)
3722 impl->popupMenuProxy = 0;
3724 if (smartData->api->popup_menu_hide)
3725 smartData->api->popup_menu_hide(smartData);
3726 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
3727 ewk_view_touch_events_enabled_set(ewkView, true);
3729 releasePopupMenuList(impl->popupMenuItems);
3730 impl->popupMenuItems = 0;
3733 EINA_LIST_FREE(impl->popupMenuItems, item)
3734 delete static_cast<Ewk_Popup_Menu_Item*>(item);
3740 Eina_Bool ewk_view_popup_menu_select(Evas_Object* ewkView, unsigned int selectedIndex)
3742 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3743 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3744 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->popupMenuProxy, false);
3746 TIZEN_LOGI("proxy : %p / index : %d", impl->popupMenuProxy, selectedIndex);
3748 if (!impl->popupMenuItems)
3752 if (selectedIndex >= eina_list_count(impl->popupMenuItems))
3755 impl->popupMenuProxy->valueChanged(selectedIndex);
3760 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
3761 void ewk_view_popup_menu_update(Evas_Object* ewkView, TextDirection textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex)
3763 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3764 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3765 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
3766 TIZEN_LOGI("proxy : %p", impl->popupMenuProxy);
3768 if (!impl->popupMenuProxy)
3771 if (!smartData->api->popup_menu_update)
3774 releasePopupMenuList(impl->popupMenuItems);
3775 impl->popupMenuItems = createPopupMenuList(items);
3777 // TODO: Instead of passing a dummy rect, updated rect should be coming from WebProcess
3778 smartData->api->popup_menu_update(smartData, IntRect(), static_cast<Ewk_Text_Direction>(textDirection), impl->popupMenuItems, selectedIndex);
3782 #if ENABLE(TIZEN_MULTIPLE_SELECT)
3783 Eina_Bool ewk_view_popup_menu_multiple_select(Evas_Object* ewkView, Eina_Inarray* changeList)
3785 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3786 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3787 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->popupMenuProxy, false);
3789 Vector<int> selectedIndex;
3791 if (!impl->popupMenuItems)
3796 itr = eina_inarray_iterator_new(changeList);
3797 EINA_ITERATOR_FOREACH(itr, data)
3799 int* pData = static_cast<int*>(data);
3800 selectedIndex.append(*pData);
3802 eina_iterator_free(itr);
3804 impl->popupMenuProxy->multipleValueChanged(selectedIndex);
3809 void ewk_view_orientation_send(Evas_Object* ewkView, int orientation)
3811 #if ENABLE(TIZEN_ORIENTATION_EVENTS)
3812 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3813 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3814 TIZEN_LOGI("orientation : %d", orientation);
3816 if (orientation != 0 && orientation != 90 && orientation != -90 && orientation != 180)
3819 if (impl->orientation == orientation)
3822 impl->orientation = orientation;
3824 impl->pageProxy->sendOrientationChangeEvent(orientation);
3828 void ewkViewFrameRendered(Evas_Object* ewkView)
3830 evas_object_smart_callback_call(ewkView, "frame,rendered", 0);
3833 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3834 Eina_Bool ewk_view_text_selection_enable_set(Evas_Object* ewkView, Eina_Bool enable)
3836 return ewk_settings_text_selection_enabled_set(ewk_view_settings_get(ewkView), enable);
3839 Eina_Bool ewk_view_text_selection_range_get(Evas_Object* ewkView, Eina_Rectangle* leftRect, Eina_Rectangle* rightRect)
3841 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3842 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3844 IntRect leftSelectionRect;
3845 IntRect rightSelectionRect;
3846 if (!impl->pageProxy->getSelectionHandlers(leftSelectionRect, rightSelectionRect)) {
3859 AffineTransform contentToScreen = impl->transformToScene();
3860 leftSelectionRect = contentToScreen.mapRect(leftSelectionRect);
3861 rightSelectionRect = contentToScreen.mapRect(rightSelectionRect);
3863 leftRect->x = leftSelectionRect.x();
3864 leftRect->y = leftSelectionRect.y();
3865 leftRect->w = leftSelectionRect.width();
3866 leftRect->h = leftSelectionRect.height();
3868 rightRect->x = rightSelectionRect.x();
3869 rightRect->y = rightSelectionRect.y();
3870 rightRect->w = rightSelectionRect.width();
3871 rightRect->h = rightSelectionRect.height();
3876 const char* ewk_view_text_selection_text_get(Evas_Object* ewkView)
3878 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3879 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3881 const CString selectedString = impl->pageProxy->getSelectionText().utf8();
3882 impl->selectedText = selectedString.data();
3884 return impl->selectedText;
3887 Eina_Bool ewk_view_auto_clear_text_selection_mode_set(Evas_Object* ewkView, Eina_Bool enable)
3889 return ewk_settings_clear_text_selection_automatically_set(ewk_view_settings_get(ewkView), enable);
3892 Eina_Bool ewk_view_auto_clear_text_selection_mode_get(Evas_Object* ewkView)
3894 return ewk_settings_clear_text_selection_automatically_get(ewk_view_settings_get(ewkView));
3896 #endif // #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3898 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3899 void ewkViewInputPickerRequest(Evas_Object* ewkView, Ewk_Input_Type inputType, const String& inputValue)
3901 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3902 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
3903 EINA_SAFETY_ON_NULL_RETURN(smartData->api->input_picker_show);
3905 smartData->api->input_picker_show(smartData, inputType, inputValue.utf8().data());
3909 #if ENABLE(TIZEN_VIEWPORT_META_TAG)
3910 void ewkViewGetWindowFrame(Evas_Object* ewkView, int *x, int *y, int *w, int *h)
3912 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3913 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3914 IntPoint drawingPosition = (IntPoint)(impl->pageClient->visibleContentRect().location() - impl->pageClient->scrollPosition());
3916 *x = drawingPosition.x();
3918 *y = drawingPosition.y();
3920 *w = impl->pageClient->visibleContentRect().width();
3922 *h = impl->pageClient->visibleContentRect().height();
3926 void ewk_view_focused_input_element_value_set(Evas_Object* ewkView, const char* value)
3928 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3929 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3930 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3932 impl->pageProxy->setFocusedInputElementValue(String::fromUTF8(value));
3933 #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3936 const char* ewk_view_focused_input_element_value_get(Evas_Object* ewkView)
3938 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3939 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3940 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3942 impl->inputValue = impl->pageProxy->getFocusedInputElementValue().utf8().data();
3943 return impl->inputValue;
3946 #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3949 #if ENABLE(TIZEN_DATALIST_ELEMENT)
3950 void ewkViewDataListShowRequest(Evas_Object* ewkView, Ewk_Input_Type inputType, Vector<String> optionList)
3952 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3953 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3954 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
3955 EINA_SAFETY_ON_NULL_RETURN(smartData->api->data_list_show);
3958 ewkViewDataListHideRequest(ewkView, inputType);
3960 for (Vector<String>::const_iterator it = optionList.begin(); it != optionList.end(); ++it) {
3962 impl->dataList = eina_list_append(impl->dataList, eina_stringshare_add(value.utf8().data()));
3965 smartData->api->data_list_show(smartData, inputType, impl->dataList);
3968 void ewkViewDataListHideRequest(Evas_Object* ewkView, Ewk_Input_Type inputType)
3970 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3971 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3972 EINA_SAFETY_ON_NULL_RETURN(impl->dataList);
3973 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
3974 EINA_SAFETY_ON_NULL_RETURN(smartData->api->data_list_hide);
3976 impl->deleteDataList();
3978 smartData->api->data_list_hide(smartData, inputType);
3982 void ewk_view_data_list_close(Evas_Object* ewkView, const char* value)
3984 #if ENABLE(TIZEN_DATALIST_ELEMENT)
3985 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3986 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3988 impl->deleteDataList();
3990 ewk_view_focused_input_element_value_set(ewkView, value);
3994 Eina_Bool ewk_view_horizontal_panning_hold_get(Evas_Object* ewkView)
3996 #if ENABLE(TIZEN_GESTURE)
3997 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3998 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3999 return impl->holdHorizontalPanning;
4005 void ewk_view_horizontal_panning_hold_set(Evas_Object* ewkView, Eina_Bool hold)
4007 #if ENABLE(TIZEN_GESTURE)
4008 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4009 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4010 impl->holdHorizontalPanning = hold;
4014 Eina_Bool ewk_view_vertical_panning_hold_get(Evas_Object* ewkView)
4016 #if ENABLE(TIZEN_GESTURE)
4017 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4018 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4019 return impl->holdVerticalPanning;
4025 void ewk_view_vertical_panning_hold_set(Evas_Object* ewkView, Eina_Bool hold)
4027 #if ENABLE(TIZEN_GESTURE)
4028 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4029 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4030 impl->holdVerticalPanning = hold;
4034 void ewk_view_touch_event_handler_result_set(Evas_Object* ewkView, WebKit::WebEvent::Type type, bool wasHandled)
4036 #if ENABLE(TIZEN_GESTURE)
4037 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4038 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4040 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
4041 if (impl->focusRing && wasHandled)
4042 impl->focusRing->hide();
4043 #endif // #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
4045 if (impl->mouseEventsEnabled())
4048 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
4049 if (wasHandled && impl->pageClient->isTextSelectionMode()) {
4050 if (type == WebEvent::TouchStart)
4051 impl->pageClient->updateTextSelectionHandlesAndContextMenu(false);
4052 else if (type == WebEvent::TouchMove)
4053 impl->pageClient->updateTextSelectionHandlesAndContextMenu(false);
4054 else if (type == WebEvent::TouchEnd)
4055 impl->pageClient->requestToShowTextSelectionHandlesAndContextMenu();
4059 // We have to check TouchStart, TouchMove and TouchEnd with handled.
4060 // The Pan and Flick will be enabled if Touch Start was not handled,
4061 // and Touch Move was not handled or did not occur.
4062 // Tap will be enabled if Touch Start and End was not handled
4063 // and Touch Move did not occur.
4064 // The gestures are disabled as a default.
4065 // o: handled, x: not handled
4066 // ------------------------------------------------------------
4067 // Touch Start | Touch Move | Touch End || Tap | Pan, Flick
4068 // ------------------------------------------------------------
4069 // o | o or x | o or x || disable | disable
4070 // x | o | o or x || disable | disable
4071 // x | x | o or x || disable | enable
4072 // x |not occured | x || enable | enable
4073 // ------------------------------------------------------------
4074 if (type == WebEvent::TouchStart) {
4075 impl->gestureClient->setGestureEnabled(!wasHandled);
4076 impl->wasHandledTouchStart = wasHandled;
4078 // Initialize wasHandledTouchMove to true and notify that to the application
4079 // to prevent applications scrolling at the beginning of touch.
4080 impl->wasHandledTouchMove = true;
4081 evas_object_smart_callback_call(ewkView, "touchmove,handled", static_cast<void*>(&impl->wasHandledTouchMove));
4082 } else if (type == WebEvent::TouchMove) {
4083 impl->gestureClient->setMovingEnabled(!wasHandled);
4085 // We have to set wasHandled to true if touchstart was handled even though current touchmove was not handled.
4086 if (impl->wasHandledTouchStart)
4089 // Notify the result of touchmove to applications when handled value is changed
4090 // in order to make applications to choose whether scrolling its scrollable objects or not.
4091 if (impl->wasHandledTouchMove != wasHandled)
4092 evas_object_smart_callback_call(ewkView, "touchmove,handled", static_cast<void*>(&wasHandled));
4093 impl->wasHandledTouchMove = wasHandled;
4094 } else if (type == WebEvent::TouchEnd && !impl->exceedTouchMoveThreshold) {
4096 impl->gestureClient->setMovingEnabled(!wasHandled);
4097 impl->gestureClient->setTapEnabled(!wasHandled);
4099 #if ENABLE(TIZEN_ISF_PORT)
4101 IntPoint pointForHitTest = impl->transformFromScene().mapPoint(IntPoint(impl->touchDownPoint.x, impl->touchDownPoint.y));
4102 WebHitTestResult::Data hitTestResultData = impl->pageProxy->hitTestResultAtPoint(pointForHitTest);
4103 if (hitTestResultData.isContentEditable && impl->inputMethodContext()) {
4104 evas_object_focus_set(ewkView, true);
4105 impl->inputMethodContext()->updateTextInputState();
4113 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
4114 void ewkViewDidGetTextStyleStateForSelection(Evas_Object* ewkView, int underlineState, int italicState, int boldState, const IntPoint& startPoint, const IntPoint& endPoint)
4116 Ewk_Text_Style* textStyle = ewkTextStyleCreate(underlineState, italicState, boldState, startPoint, endPoint);
4117 evas_object_smart_callback_call(ewkView, "text,style,state", static_cast<void*>(textStyle));
4118 ewkTextStyleDelete(textStyle);
4122 #if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT)
4123 bool ewk_view_orientation_lock(Evas_Object* ewkView, int willLockOrientation)
4125 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4126 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
4128 TIZEN_LOGI("willLockOrientation (%d)", willLockOrientation);
4129 if (!smartData->api->orientation_lock) {
4134 return smartData->api->orientation_lock(smartData, willLockOrientation);
4137 void ewk_view_orientation_unlock(Evas_Object* ewkView)
4139 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4140 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
4142 TIZEN_LOGI("ewkView (%p)", ewkView);
4143 if (!smartData->api->orientation_unlock) {
4148 smartData->api->orientation_unlock(smartData);
4152 void ewk_view_orientation_lock_callback_set(Evas_Object* ewkView, Ewk_Orientation_Lock_Cb func, void* data)
4154 #if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL)
4155 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4156 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4157 TIZEN_LOGI("callbacks: %p / data: %p", func, data);
4159 impl->orientationLock.callback = func;
4160 impl->orientationLock.data = data;
4164 #if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL)
4165 Eina_Bool _ewk_orientation_lock(Ewk_View_Smart_Data *sd, int orientations)
4167 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl, false);
4168 TIZEN_LOGI("locked orientations : %d", orientations);
4170 if (impl->orientationLock.callback)
4171 return impl->orientationLock.callback(sd->self, true, orientations, impl->orientationLock.data);
4176 void _ewk_orientation_unlock(Ewk_View_Smart_Data *sd)
4178 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
4179 TIZEN_LOGI("unlock is requested");
4181 if (impl->orientationLock.callback)
4182 impl->orientationLock.callback(sd->self, false, 0, impl->orientationLock.data);
4186 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
4187 bool ewk_view_is_opengl_backend(Evas_Object* ewkView)
4189 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4191 Ecore_Evas* ee = ecore_evas_ecore_evas_get(smartData->base.evas);
4192 const char *engine = ecore_evas_engine_name_get(ee);
4193 if (engine && !strcmp(engine, "opengl_x11"))
4199 void ewk_view_zoomable_area_set(Evas_Object* ewkView, const IntPoint& target, const IntRect& area)
4201 #if ENABLE(TIZEN_GESTURE)
4202 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4203 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4205 impl->gestureClient->setZoomableArea(target, area);
4209 #if ENABLE(TIZEN_BACKFORWARD_LIST_CLEAR)
4210 void ewk_view_back_forward_list_clear(const Evas_Object* ewkView)
4212 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4213 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4215 WKBackForwardListClearBackForwardList(WKPageGetBackForwardList(toAPI(impl->pageProxy.get())));
4219 #if ENABLE(TIZEN_SIGNAL_APP_BACK_FORWARD_LIST_CHANGED)
4220 void ewkViewBackForwardListChanged(Evas_Object* ewkView)
4222 evas_object_smart_callback_call(ewkView, "back,forward,list,changed", 0);
4226 #if ENABLE(TIZEN_ICON_DATABASE)
4227 void ewkViewIconReceived(Evas_Object* ewkView)
4231 evas_object_smart_callback_call(ewkView, "icon,received", 0);
4235 #endif // #if OS(TIZEN)
4237 Eina_Bool ewk_view_feed_touch_event(Evas_Object* ewkView, Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers)
4239 #if ENABLE(TOUCH_EVENTS)
4240 EINA_SAFETY_ON_NULL_RETURN_VAL(points, false);
4241 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4242 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4244 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
4245 if (impl->pageClient->isTextSelectionMode() && eina_list_count(points) == 1) {
4246 Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(eina_list_data_get(points));
4247 IntPoint handlePoint(point->x, point->y);
4249 if (type == EWK_TOUCH_START)
4250 impl->pageClient->textSelectonHandleDown(handlePoint);
4251 else if (type == EWK_TOUCH_MOVE)
4252 impl->pageClient->textSelectonHandleMove(handlePoint);
4254 impl->pageClient->textSelectonHandleUp();
4258 #if ENABLE(TIZEN_GESTURE)
4259 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
4260 // We don't want to process touch event when context menu is shown.
4261 if (impl->pageClient->isContextMenuVisible() && type != EWK_TOUCH_CANCEL)
4264 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
4265 if (impl->pageClient->isTextSelectionDowned() && type != EWK_TOUCH_CANCEL)
4269 if (type == EWK_TOUCH_START) {
4270 if (eina_list_count(points) == 1) {
4271 impl->gestureClient->reset();
4272 Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(eina_list_data_get(points));
4273 impl->touchDownPoint.x = point->x;
4274 impl->touchDownPoint.y = point->y;
4275 impl->exceedTouchMoveThreshold = false;
4277 } else if (type == EWK_TOUCH_MOVE && !impl->exceedTouchMoveThreshold) {
4278 if (eina_list_count(points) == 1) {
4279 unsigned int threshold = elm_config_scroll_thumbscroll_threshold_get();
4280 Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(eina_list_data_get(points));
4281 int diffX = impl->touchDownPoint.x - point->x;
4282 int diffY = impl->touchDownPoint.y - point->y;
4283 if (static_cast<unsigned int>(diffX * diffX + diffY * diffY) > threshold * threshold)
4284 impl->exceedTouchMoveThreshold = true;
4288 impl->exceedTouchMoveThreshold = true;
4291 #endif // #if ENABLE(TIZEN_GESTURE)
4293 // FIXME: impl is used in the webkit opensource, but tizen webkit does not use it yet.
4294 //impl->page()->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, impl->transformFromScene(), impl->transformToScreen(), ecore_time_get()));
4295 impl->pageProxy->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, impl->transformFromScene(), impl->transformToScreen(), ecore_time_get()));
4303 Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object* ewkView, Eina_Bool enabled)
4305 #if ENABLE(TOUCH_EVENTS)
4306 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4307 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4309 impl->setTouchEventsEnabled(!!enabled);
4317 Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object* ewkView)
4319 #if ENABLE(TOUCH_EVENTS)
4320 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4321 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4323 return impl->touchEventsEnabled();
4329 Eina_Bool ewk_view_main_frame_scrollbar_visible_set(Evas_Object* ewkView, Eina_Bool visible)
4331 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
4332 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4333 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4335 impl->mainFrameScrollbarVisibility = visible;
4336 impl->pageClient->updateVisibility();
4344 Eina_Bool ewk_view_main_frame_scrollbar_visible_get(const Evas_Object* ewkView)
4346 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
4347 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4348 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4350 return impl->mainFrameScrollbarVisibility;
4356 Eina_Bool ewk_view_page_save(Evas_Object* ewkView, const char* path)
4358 #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE)
4359 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4360 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4361 EINA_SAFETY_ON_NULL_RETURN_VAL(path, false);
4363 String title = ewk_view_title_get(ewkView);
4364 String url = ewk_view_url_get(ewkView);
4365 String directoryPath(path);
4366 impl->pageClient->startOfflinePageSave(directoryPath, url, title);
4370 UNUSED_PARAM(ewkView);
4378 * Callback function used for ewk_view_page_contents_get().
4380 static void ewkViewPageContentsAsMHTMLCallback(WKDataRef wkData, WKErrorRef, void* context)
4382 EINA_SAFETY_ON_NULL_RETURN(context);
4384 RefPtr<WebData> webData = toImpl(wkData);
4385 Ewk_Page_Contents_Context* contentsContext= static_cast<Ewk_Page_Contents_Context*>(context);
4386 contentsContext->callback(contentsContext->type, reinterpret_cast<const char*>(webData->bytes()));
4391 * Callback function used for ewk_view_page_contents_get().
4393 static void ewkViewPageContentsAsStringCallback(WKStringRef wkString, WKErrorRef, void* context)
4395 EINA_SAFETY_ON_NULL_RETURN(context);
4397 RefPtr<WebString> webString = toImpl(wkString);
4398 Ewk_Page_Contents_Context* contentsContext= static_cast<Ewk_Page_Contents_Context*>(context);
4399 contentsContext->callback(contentsContext->type, webString->string().utf8().data());
4402 Eina_Bool ewk_view_page_contents_get(const Evas_Object* ewkView, Ewk_Page_Contents_Context* context)
4404 EINA_SAFETY_ON_NULL_RETURN_VAL(context, false);
4405 EINA_SAFETY_ON_NULL_RETURN_VAL(context->callback, false);
4406 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4407 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4409 switch (context->type) {
4410 case EWK_PAGE_CONTENTS_TYPE_MHTML:
4411 impl->pageProxy->getContentsAsMHTMLData(DataCallback::create(context, ewkViewPageContentsAsMHTMLCallback), false);
4414 case EWK_PAGE_CONTENTS_TYPE_STRING:
4415 impl->pageProxy->getContentsAsString(StringCallback::create(context, ewkViewPageContentsAsStringCallback));
4419 ASSERT_NOT_REACHED();
4426 Eina_Bool ewk_view_animated_scroll_set(Evas_Object* ewkView, int x, int y)
4428 #if ENABLE(TIZEN_GESTURE)
4429 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4430 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4432 return impl->gestureClient->scrollToWithAnimation(x, y);
4434 UNUSED_PARAM(ewkView);
4441 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
4442 void ewkViewFocusRingHide(Evas_Object* ewkView)
4444 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4445 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4447 if (impl->focusRing)
4448 impl->focusRing->hide();
4452 void ewk_view_content_security_policy_set(Evas_Object* ewkView, const char* policy, Ewk_CSP_Header_Type type)
4454 #if ENABLE(TIZEN_CSP)
4455 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
4456 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
4458 TIZEN_LOGI("policy(%s), type(%d)\n", policy, type);
4459 impl->pageProxy->setContentSecurityPolicy(String::fromUTF8(policy), static_cast<WebCore::ContentSecurityPolicy::HeaderType>(type));
4463 #if ENABLE(TIZEN_APPLICATION_CACHE)
4464 Eina_Bool ewkViewRequestApplicationCachePermission(Evas_Object* ewkView, WKSecurityOriginRef origin)
4466 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4467 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4469 if (!impl->applicationCachePermissionContext || !impl->applicationCachePermissionContext->applicationCachePermissionCallback)
4472 impl->isWaitingForApplicationCachePermission = true;
4473 if (impl->applicationCachePermissionOrigin)
4474 deleteSecurityOrigin(impl->applicationCachePermissionOrigin);
4475 impl->applicationCachePermissionOrigin = createSecurityOrigin(origin);
4477 return impl->applicationCachePermissionContext->applicationCachePermissionCallback(ewkView, impl->applicationCachePermissionOrigin, impl->applicationCachePermissionContext->userData) == EINA_TRUE;
4481 void ewk_view_application_cache_permission_callback_set(Evas_Object* ewkView, Ewk_View_Applicacion_Cache_Permission_Callback callback, void* userData)
4483 #if ENABLE(TIZEN_APPLICATION_CACHE)
4484 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4485 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4487 if (!impl->applicationCachePermissionContext)
4488 impl->applicationCachePermissionContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
4489 impl->applicationCachePermissionContext->applicationCachePermissionCallback = callback;
4490 impl->applicationCachePermissionContext->userData = userData;
4492 UNUSED_PARAM(ewkView);
4493 UNUSED_PARAM(callback);
4494 UNUSED_PARAM(userData);
4498 void ewk_view_application_cache_permission_reply(Evas_Object* ewkView, Eina_Bool allow)
4500 #if ENABLE(TIZEN_APPLICATION_CACHE)
4501 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4502 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4504 TIZEN_LOGI("allow %d", allow);
4505 WKPageReplyApplicationCachePermission(toAPI(impl->page()), allow);
4506 if (impl->applicationCachePermissionOrigin)
4507 deleteSecurityOrigin(impl->applicationCachePermissionOrigin);
4508 impl->applicationCachePermissionOrigin = 0;
4509 impl->isWaitingForApplicationCachePermission = false;
4511 UNUSED_PARAM(ewkView);
4512 UNUSED_PARAM(allow);
4516 #if ENABLE(TIZEN_INDEXED_DATABASE)
4517 bool ewkViewExceededIndexedDatabaseQuota(Evas_Object* ewkView, WKSecurityOriginRef origin, long long currentUsage)
4519 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4520 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4522 if (!impl->exceededIndexedDatabaseQuotaContext || !impl->exceededIndexedDatabaseQuotaContext->exceededIndexedDatabaseQuotaCallback)
4525 impl->isWaitingForExceededQuotaPopupReply = true;
4526 if (impl->exceededQuotaOrigin)
4527 deleteSecurityOrigin(impl->exceededQuotaOrigin);
4528 impl->exceededQuotaOrigin = createSecurityOrigin(origin);
4530 TIZEN_LOGI("currentUsage(%lld)", currentUsage);
4532 return impl->exceededIndexedDatabaseQuotaContext->exceededIndexedDatabaseQuotaCallback(ewkView, impl->exceededQuotaOrigin, currentUsage, impl->exceededIndexedDatabaseQuotaContext->userData) == EINA_TRUE;
4536 void ewk_view_exceeded_indexed_database_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback, void* userData)
4538 #if ENABLE(TIZEN_INDEXED_DATABASE)
4539 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4540 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4542 if (!impl->exceededIndexedDatabaseQuotaContext)
4543 impl->exceededIndexedDatabaseQuotaContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
4544 impl->exceededIndexedDatabaseQuotaContext->exceededIndexedDatabaseQuotaCallback = callback;
4545 impl->exceededIndexedDatabaseQuotaContext->userData = userData;
4547 UNUSED_PARAM(ewkView);
4548 UNUSED_PARAM(callback);
4549 UNUSED_PARAM(userData);
4553 void ewk_view_exceeded_indexed_database_quota_reply(Evas_Object* ewkView, Eina_Bool allow)
4555 #if ENABLE(TIZEN_INDEXED_DATABASE)
4556 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4557 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4559 TIZEN_LOGI("allow %d", allow);
4560 WKPageReplyExceededIndexedDatabaseQuota(toAPI(impl->page()), allow == EINA_TRUE);
4561 if (impl->exceededQuotaOrigin)
4562 deleteSecurityOrigin(impl->exceededQuotaOrigin);
4563 impl->exceededQuotaOrigin = 0;
4564 impl->isWaitingForExceededQuotaPopupReply = false;
4566 UNUSED_PARAM(ewkView);
4567 UNUSED_PARAM(allow);
4571 // EwkFindOptions should be matched up orders with WkFindOptions.
4572 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_CASE_INSENSITIVE, kWKFindOptionsCaseInsensitive);
4573 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_AT_WORD_STARTS, kWKFindOptionsAtWordStarts);
4574 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START, kWKFindOptionsTreatMedialCapitalAsWordStart);
4575 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_BACKWARDS, kWKFindOptionsBackwards);
4576 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_WRAP_AROUND, kWKFindOptionsWrapAround);
4577 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_OVERLAY, kWKFindOptionsShowOverlay);
4578 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_FIND_INDICATOR, kWKFindOptionsShowFindIndicator);
4579 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT, kWKFindOptionsShowHighlight);
4581 Eina_Bool ewk_view_text_find(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount)
4583 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4584 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4585 EINA_SAFETY_ON_NULL_RETURN_VAL(text, false);
4587 impl->pageProxy->findString(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount);
4592 Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object* ewkView)
4594 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4595 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4597 impl->pageProxy->hideFindUI();
4602 Eina_Bool ewk_view_text_matches_count(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount)
4604 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4605 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4606 EINA_SAFETY_ON_NULL_RETURN_VAL(text, false);
4608 impl->pageProxy->countStringMatches(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount);
4613 void ewk_view_exceeded_database_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Database_Quota_Callback callback, void* userData)
4615 #if ENABLE(TIZEN_SQL_DATABASE)
4616 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4617 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4619 if (!impl->exceededDatabaseQuotaContext)
4620 impl->exceededDatabaseQuotaContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
4621 impl->exceededDatabaseQuotaContext->exceededDatabaseQuotaCallback = callback;
4622 impl->exceededDatabaseQuotaContext->userData = userData;
4624 UNUSED_PARAM(ewkView);
4625 UNUSED_PARAM(callback);
4626 UNUSED_PARAM(userData);
4630 void ewk_view_exceeded_database_quota_reply(Evas_Object* ewkView, Eina_Bool allow)
4632 #if ENABLE(TIZEN_SQL_DATABASE)
4633 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4634 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4636 TIZEN_LOGI("allow %d", allow);
4637 WKPageReplyExceededDatabaseQuota(toAPI(impl->page()), allow == EINA_TRUE);
4638 if (impl->exceededQuotaOrigin)
4639 deleteSecurityOrigin(impl->exceededQuotaOrigin);
4640 impl->exceededQuotaOrigin = 0;
4641 impl->isWaitingForExceededQuotaPopupReply = false;
4643 UNUSED_PARAM(ewkView);
4644 UNUSED_PARAM(allow);
4648 #if ENABLE(TIZEN_FILE_SYSTEM)
4649 bool ewkViewExceededLocalFileSystemQuota(Evas_Object* ewkView, WKSecurityOriginRef origin, long long currentUsage)
4651 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4652 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4654 if (!impl->exceededLocalFileSystemQuotaContext || !impl->exceededLocalFileSystemQuotaContext->exceededLocalFileSystemQuotaCallback)
4657 impl->isWaitingForExceededQuotaPopupReply = true;
4658 if (impl->exceededQuotaOrigin)
4659 deleteSecurityOrigin(impl->exceededQuotaOrigin);
4660 impl->exceededQuotaOrigin = createSecurityOrigin(origin);
4662 TIZEN_LOGI("currentUsage(%lld)", currentUsage);
4664 return impl->exceededLocalFileSystemQuotaContext->exceededLocalFileSystemQuotaCallback(ewkView, impl->exceededQuotaOrigin , currentUsage, impl->exceededLocalFileSystemQuotaContext->userData) == EINA_TRUE;
4668 void ewk_view_exceeded_local_file_system_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback, void* userData)
4670 #if ENABLE(TIZEN_FILE_SYSTEM)
4671 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4672 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4674 if (!impl->exceededLocalFileSystemQuotaContext)
4675 impl->exceededLocalFileSystemQuotaContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
4676 impl->exceededLocalFileSystemQuotaContext->exceededLocalFileSystemQuotaCallback = callback;
4677 impl->exceededLocalFileSystemQuotaContext->userData = userData;
4679 UNUSED_PARAM(ewkView);
4680 UNUSED_PARAM(callback);
4681 UNUSED_PARAM(userData);
4685 void ewk_view_exceeded_local_file_system_quota_reply(Evas_Object* ewkView, Eina_Bool allow)
4687 #if ENABLE(TIZEN_FILE_SYSTEM)
4688 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4689 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4691 TIZEN_LOGI("allow %d", allow);
4692 WKPageReplyExceededLocalFileSystemQuota(toAPI(impl->page()), allow == EINA_TRUE);
4693 if (impl->exceededQuotaOrigin)
4694 deleteSecurityOrigin(impl->exceededQuotaOrigin);
4695 impl->exceededQuotaOrigin = 0;
4696 impl->isWaitingForExceededQuotaPopupReply = false;
4698 UNUSED_PARAM(ewkView);
4699 UNUSED_PARAM(result);
4703 void ewk_view_rotation_prepare(Evas_Object* ewkView, int angle)
4705 #if ENABLE(TIZEN_PRERENDERING_FOR_ROTATION)
4706 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4707 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4710 if (angle == 0 || angle == 180) {
4711 width = WebCore::getDefaultScreenResolution().width();
4712 height = WebCore::getDefaultScreenResolution().height() + 100;
4714 if (angle == 90 || angle == 270) {
4715 width = WebCore::getDefaultScreenResolution().height();
4716 height = WebCore::getDefaultScreenResolution().width() + 100;
4719 impl->pageProxy->drawingArea()->setSize(IntSize(width, height), IntSize());
4720 impl->pageClient->setWaitFrameOfNewViewortSize(true);
4721 ewk_view_suspend(ewkView);
4722 impl->pageClient->updateViewportSize(IntSize(width, height), angle);
4726 #if ENABLE(TIZEN_PRERENDERING_FOR_ROTATION)
4727 void ewkViewRotatePrepared(Evas_Object* ewkView)
4729 evas_object_smart_callback_call(ewkView, "rotate,prepared", 0);