X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=Source%2FWebKit2%2FUIProcess%2FAPI%2Fefl%2Fewk_view.cpp;h=b86f6dc658593ba38ce4dada0a402d6941fb49b0;hb=d67a0ea473a836af56a2023af93864e93da6bdcc;hp=88e7d01ef6dc73182aea22a16fb237af375182db;hpb=93636ed9f10b7ce4ae4a4c5e2771aa6d42d0057a;p=framework%2Fweb%2Fwebkit-efl.git diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index 88e7d01..2e410b9 100755 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -22,53 +22,55 @@ #include "ewk_view.h" #include "EwkViewImpl.h" +#include "FindClientEfl.h" +#include "FormClientEfl.h" #include "LayerTreeCoordinatorProxy.h" +#include "InputMethodContextEfl.h" #include "NativeWebKeyboardEvent.h" #include "NativeWebMouseEvent.h" #include "NativeWebWheelEvent.h" #include "PageClientImpl.h" +#include "PageLoadClientEfl.h" +#include "PagePolicyClientEfl.h" +#include "PageUIClientEfl.h" +#include "ResourceLoadClientEfl.h" #include "WKAPICast.h" -#if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream -#include "WKColorPickerResultListener.h" -#endif +#include "WKEinaSharedString.h" +#include "WKFindOptions.h" #include "WKRetainPtr.h" #include "WKString.h" -#include "WKURL.h" +#include "WebContext.h" #include "WebData.h" #include "WebPageGroup.h" #include "WebPopupItem.h" #include "WebPopupMenuProxyEfl.h" +#include "WebPreferences.h" +#include "ewk_back_forward_list_private.h" #include "ewk_context.h" #include "ewk_context_private.h" +#include "ewk_favicon_database_private.h" #include "ewk_intent_private.h" +#include "ewk_popup_menu_item_private.h" +#include "ewk_private.h" #include "ewk_settings_private.h" -#include "ewk_view_form_client_private.h" -#include "ewk_view_loader_client_private.h" -#include "ewk_view_policy_client_private.h" #include "ewk_view_private.h" -#include "ewk_view_resource_load_client_private.h" -#include "ewk_web_resource.h" #include #include -#include -#include -#include #include #include -#if USE(ACCELERATED_COMPOSITING) -#include +#if ENABLE(FULLSCREEN_API) +#include "WebFullScreenManagerProxy.h" #endif #if ENABLE(TIZEN_WEBKIT2_DDK_CHECK) +namespace EGL { #include -#define Cursor WebCore::Cursor +} #endif #if OS(TIZEN) #include "DrawingAreaProxyImpl.h" -#include "JavaScriptPopup.h" -#include "OpenPanel.h" #include "WKArray.h" #include "WKData.h" #include "WKDownload.h" @@ -85,7 +87,6 @@ #include "WKSerializedScriptValue.h" #include "WKString.h" #include "WKURLRequest.h" -#include "ewk_auth_challenge_private.h" #include "ewk_context_menu_private.h" #include "ewk_error.h" #include "ewk_error_private.h" @@ -93,20 +94,16 @@ #include "ewk_popup_menu_item.h" #include "ewk_popup_menu_item_private.h" #include "ewk_view_context_menu_client.h" -#include "ewk_view_find_client.h" #include "ewk_view_icondatabase_client.h" #include "ewk_view_tizen_client.h" -#include "ewk_view_ui_client.h" #include -#include #include -#include +#include #include #include #if ENABLE(TIZEN_ICON_DATABASE) #include "WKContextPrivate.h" -#include "WebContext.h" #endif #if ENABLE(TIZEN_GEOLOCATION) @@ -115,15 +112,6 @@ #include "ewk_view_geolocation_provider.h" #endif -#if ENABLE(TIZEN_INPUT_TAG_EXTENSION) -#include "InputPicker.h" -#endif - -#if ENABLE(TIZEN_GESTURE) -#include "GestureRecognizer.h" -#include "GestureClient.h" -#endif - #if ENABLE(TOUCH_EVENTS) #include "NativeWebTouchEvent.h" #include "WebEvent.h" @@ -141,10 +129,6 @@ #include "ewk_view_notification_provider.h" #endif -#if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL) -#include "ewk_popup_picker.h" -#endif - #if ENABLE(TIZEN_MEDIA_STREAM) #include "WKUserMediaPermissionRequest.h" #include "ewk_user_media_private.h" @@ -159,10 +143,6 @@ #include "ewk_hit_test_private.h" #endif -#if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) -#include "FocusRing.h" -#endif - #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION) #include "ewk_text_style.h" #endif @@ -179,7 +159,6 @@ #include "WKDictionary.h" #include "ewk_web_application_icon_data_private.h" #endif - #endif // #if OS(TIZEN) using namespace WebKit; @@ -187,232 +166,14 @@ using namespace WebCore; static const char EWK_VIEW_TYPE_STR[] = "EWK2_View"; -#if OS(TIZEN) -typedef struct _Ewk_View_Callback_Context Ewk_View_Callback_Context; -#endif // #if OS(TIZEN) - -static const int defaultCursorSize = 16; - -typedef HashMap LoadingResourcesMap; -static void _ewk_view_priv_loading_resources_clear(LoadingResourcesMap& loadingResourcesMap); - -struct _Ewk_View_Private_Data { - OwnPtr pageClient; - - const char* uri; - const char* title; - const char* theme; - const char* customEncoding; - const char* cursorGroup; - Evas_Object* cursorObject; - LoadingResourcesMap loadingResourcesMap; -#if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream - WKColorPickerResultListenerRef colorPickerResultListener; -#endif -#if ENABLE(TOUCH_EVENTS) - bool areTouchEventsEnabled; -#endif - OwnPtr settings; - -#ifdef HAVE_ECORE_X - bool isUsingEcoreX; -#endif - -#if USE(ACCELERATED_COMPOSITING) - Evas_GL* evasGl; - Evas_GL_Context* evasGlContext; - Evas_GL_Surface* evasGlSurface; -#endif - -#if OS(TIZEN) - bool areMouseEventsEnabled; -#if ENABLE(TIZEN_ORIENTATION_EVENTS) - int orientation; -#endif - - JSGlobalContextRef javascriptGlobalContext; - - const char* userAgent; - const char* encoding; -#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG) - const char* webAppIconURL; - Eina_List* webAppIconURLs; -#endif - - OwnPtr alertContext; - OwnPtr confirmContext; - OwnPtr promptContext; -#if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL) - OwnPtr beforeUnloadConfirmPanelContext; -#endif - OwnPtr openpanelContext; - OwnPtr javascriptPopup; - bool isWaitingForJavaScriptPopupReply; - OwnPtr openPanel; -#if ENABLE(TIZEN_INPUT_TAG_EXTENSION) - OwnPtr inputPicker; - const char* inputValue; -#endif - - Ewk_Auth_Challenge* authChallenge; - Ewk_Policy_Decision* policyDecision; - WKOpenPanelResultListenerRef openPanelListener; - -#if ENABLE(TIZEN_CERTIFICATE_HANDLING) - Ewk_Certificate_Policy_Decision* certificatePolicyDecision; -#endif - -#if ENABLE(TIZEN_MEDIA_STREAM) - Eina_List* userMediaPermissionRequests; -#endif - - Ewk_Context* context; - -#if ENABLE(TIZEN_GEOLOCATION) - Ewk_Geolocation* geolocation; - Eina_List* geolocationPermissionRequests; -#endif - -#if ENABLE(TIZEN_ISF_PORT) - Eina_List* imfContextList; - Ecore_IMF_Context* imfContext; -#endif - - bool suspendRequested; - bool suspendedPainting; - bool suspendedResources; - -#if ENABLE(TIZEN_NOTIFICATIONS) - Eina_List* notifications; - Eina_List* notificationPermissionRequests; -#endif -#if ENABLE(TIZEN_SQL_DATABASE) - Ewk_Context_Exceeded_Quota* exceededDatabaseQuota; -#endif - WebPopupMenuProxyEfl* popupMenuProxy; - Eina_List* popupMenuItems; -#if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL) - Ewk_Popup_Picker* popupPicker; -#endif - - bool isVerticalEdge; - bool isHorizontalEdge; -#if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) - OwnPtr focusRing; -#endif // #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) - -#if ENABLE(TIZEN_GESTURE) - OwnPtr gestureRecognizer; - OwnPtr gestureClient; -#if ENABLE(TOUCH_EVENTS) - Evas_Coord_Point touchDownPoint; - bool exceedTouchMoveThreshold; - bool wasHandledTouchStart; - bool wasHandledTouchMove; -#endif // #if ENABLE(TOUCH_EVENTS) - bool holdHorizontalPanning; - bool holdVerticalPanning; -#endif // #if ENABLE(TIZEN_GESTURE) -#if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR) - bool mainFrameScrollbarVisibility; -#endif - -#if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION) - Ecore_Animator* compositionAnimator; -#endif - -#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) - const char* selectedText; -#endif -#if ENABLE(TIZEN_DATALIST_ELEMENT) - Eina_List* dataList; -#endif -#if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL) - struct { - Ewk_Orientation_Lock_Cb callback; - void* data; - } orientationLock; -#endif -#if ENABLE(TIZEN_WEBKIT2_CREATE_VIEW_WITH_CREATED_PAGE_GROUP_WITH_IDENTIFIER) - RefPtr pageGroup; -#endif -#endif // #if OS(TIZEN) - - _Ewk_View_Private_Data() - : uri(0) - , title(0) - , theme(0) - , customEncoding(0) - , cursorGroup(0) - , cursorObject(0) -#if ENABLE(TIZEN_INPUT_COLOR_TYPE) // wait for upstream - , colorPickerResultListener(0) -#endif -#if ENABLE(TOUCH_EVENTS) - , areTouchEventsEnabled(false) -#endif -#ifdef HAVE_ECORE_X - , isUsingEcoreX(false) -#endif -#if USE(ACCELERATED_COMPOSITING) - , evasGl(0) - , evasGlContext(0) - , evasGlSurface(0) -#endif - { } - - ~_Ewk_View_Private_Data() - { - eina_stringshare_del(uri); - eina_stringshare_del(title); - eina_stringshare_del(theme); - eina_stringshare_del(customEncoding); - _ewk_view_priv_loading_resources_clear(loadingResourcesMap); - - if (cursorObject) - evas_object_del(cursorObject); - -#if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION) - if (compositionAnimator) { - ecore_animator_del(compositionAnimator); - compositionAnimator = 0; - } -#endif - - } -}; - -#if OS(TIZEN) -struct _Ewk_View_Callback_Context { - union { - Ewk_Web_App_Capable_Get_Callback webAppCapableCallback; - Ewk_Web_App_Icon_URL_Get_Callback webAppIconURLCallback; - Ewk_Web_App_Icon_URLs_Get_Callback webAppIconURLsCallback; -#if ENABLE(TIZEN_WEB_STORAGE) && ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT) - Ewk_Web_Storage_Quota_Get_Callback webStorageQuotaCallback; -#endif - Ewk_View_Script_Execute_Callback scriptExecuteCallback; - Ewk_View_Plain_Text_Get_Callback plainTextGetCallback; -#if ENABLE(TIZEN_SUPPORT_MHTML) - Ewk_View_MHTML_Data_Get_Callback mhtmlDataGetCallback; -#endif - Ewk_View_JavaScript_Alert_Callback javascriptAlertCallback; - Ewk_View_JavaScript_Confirm_Callback javascriptConfirmCallback; - Ewk_View_JavaScript_Prompt_Callback javascriptPromptCallback; -#if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL) - Ewk_View_Before_Unload_Confirm_Panel_Callback beforeUnloadConfirmPanelCallback; -#endif - Ewk_View_Open_Panel_Callback openPanelCallback; - }; - - Evas_Object* ewkView; - void* userData; -}; -#endif // #if OS(TIZEN) - #define EWK_VIEW_TYPE_CHECK(ewkView, result) \ bool result = true; \ do { \ + if (!ewkView) { \ + EINA_LOG_CRIT("null is not a ewk_view"); \ + result = false; \ + break; \ + } \ const char* _tmp_otype = evas_object_type_get(ewkView); \ const Evas_Smart* _tmp_s = evas_object_smart_smart_get(ewkView); \ if (EINA_UNLIKELY(!_tmp_s)) { \ @@ -443,53 +204,14 @@ struct _Ewk_View_Callback_Context { EWK_VIEW_TYPE_CHECK(ewkView, _tmp_result); \ Ewk_View_Smart_Data* smartData = 0; \ if (_tmp_result) \ - smartData = (Ewk_View_Smart_Data*)evas_object_smart_data_get(ewkView); + smartData = (Ewk_View_Smart_Data*)evas_object_smart_data_get(ewkView) #define EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, ...) \ EWK_VIEW_SD_GET(ewkView, smartData); \ - if (!smartData) { \ - EINA_LOG_CRIT("no smart data for object %p (%s)", \ - ewkView, evas_object_type_get(ewkView)); \ - return __VA_ARGS__; \ - } - -#define EWK_VIEW_PRIV_GET(smartData, priv) \ - Ewk_View_Private_Data* priv = smartData->priv - -#define EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, ...) \ - if (!smartData) { \ - EINA_LOG_CRIT("smart data is null"); \ - return __VA_ARGS__; \ - } \ - EWK_VIEW_PRIV_GET(smartData, priv); \ - if (!priv) { \ - EINA_LOG_CRIT("no private data for object %p (%s)", \ - smartData->self, evas_object_type_get(smartData->self)); \ - return __VA_ARGS__; \ - } - -#define EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, ...) \ - if (!smartData) { \ - EINA_LOG_CRIT("smart data is null"); \ - return __VA_ARGS__; \ - } \ - EwkViewImpl* impl = smartData->ewkViewImpl; \ - do { \ - if (!impl) { \ - EINA_LOG_CRIT("no private data for object %p (%s)", \ - smartData->self, evas_object_type_get(smartData->self)); \ - return __VA_ARGS__; \ - } \ - } while (0) - -#define EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, ...) \ - EwkViewImpl* impl = 0; \ do { \ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, __VA_ARGS__); \ - impl = smartData->ewkViewImpl; \ - if (!impl) { \ - EINA_LOG_CRIT("no private data for object %p (%s)", \ - smartData->self, evas_object_type_get(smartData->self)); \ + if (!smartData) { \ + EINA_LOG_CRIT("no smart data for object %p (%s)", \ + ewkView, evas_object_type_get(ewkView)); \ return __VA_ARGS__; \ } \ } while (0) @@ -529,11 +251,6 @@ static Eina_Bool _ewk_view_data_list_hide(Ewk_View_Smart_Data*, Ewk_Input_Type); static Eina_Bool _ewk_input_picker_color_request(Ewk_View_Smart_Data*, int, int, int, int); static Eina_Bool _ewk_input_picker_color_dismiss(Ewk_View_Smart_Data*); #endif - -#if ENABLE(TIZEN_ISF_PORT) -static void _ewk_view_imf_context_destroy(Ewk_View_Private_Data*); -#endif - #endif // #if OS(TIZEN) static void _ewk_view_smart_changed(Ewk_View_Smart_Data* smartData) @@ -544,57 +261,69 @@ static void _ewk_view_smart_changed(Ewk_View_Smart_Data* smartData) evas_object_smart_changed(smartData->self); } +#if !ENABLE(TIZEN_ICON_DATABASE) +static void _ewk_view_on_favicon_changed(const char* pageURL, void* eventInfo) +{ + Evas_Object* ewkView = static_cast(eventInfo); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + + const char* viewURL = ewk_view_url_get(ewkView); + if (!viewURL || strcasecmp(viewURL, pageURL)) + return; + + impl->informIconChange(); +} +#endif + // Default Event Handling. static Eina_Bool _ewk_view_smart_focus_in(Ewk_View_Smart_Data* smartData) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false) + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); TIZEN_LOGI(""); #if OS(TIZEN) - priv->pageClient->setViewFocused(true); + impl->pageClient->setViewFocused(true); #endif // #if OS(TIZEN) - priv->pageClient->page()->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive); + impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive); #if ENABLE(TIZEN_ISF_PORT) - if (priv->imfContext) { - ecore_imf_context_focus_in(priv->imfContext); - ecore_imf_context_input_panel_show(priv->imfContext); - } + if (impl->inputMethodContext()) + impl->inputMethodContext()->onFocusIn(); #endif return true; } static Eina_Bool _ewk_view_smart_focus_out(Ewk_View_Smart_Data* smartData) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); TIZEN_LOGI(""); #if OS(TIZEN) #if ENABLE(TIZEN_ISF_PORT) // Keypad should be hidden rapidly when moving focus on elementary // because Ecore-ime doesn't support it. - if (priv->imfContext) { - ecore_imf_context_input_panel_hide(priv->imfContext); - ecore_imf_context_focus_out(priv->imfContext); - } + if (impl->inputMethodContext()) + impl->inputMethodContext()->onFocusOut(); #endif #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) - if (priv->pageClient->isTextSelectionMode()) - priv->pageClient->setIsTextSelectionMode(false); + if (impl->pageClient->isTextSelectionMode()) + impl->pageClient->setIsTextSelectionMode(false); #endif #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2) - if (priv->pageClient->isContextMenuVisible()) - priv->pageClient->page()->hideContextMenu(); + if (impl->pageClient->isContextMenuVisible()) + impl->pageProxy->hideContextMenu(); #endif #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD) - priv->pageClient->clearClipboardSelectionHandler(); + if (impl->pageClient->isClipboardWindowOpened()) + impl->pageClient->closeClipboardWindow(); #endif #if ENABLE(TIZEN_DRAG_SUPPORT) - if (priv->pageClient->isDragMode()) - priv->pageClient->setDragMode(false); + if (impl->pageClient->isDragMode()) + impl->pageClient->setDragMode(false); #endif #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE) @@ -602,77 +331,68 @@ static Eina_Bool _ewk_view_smart_focus_out(Ewk_View_Smart_Data* smartData) smartData->api->formdata_candidate_hide(smartData); #endif - priv->pageClient->setViewFocused(false); + impl->pageClient->setViewFocused(false); #endif // #if OS(TIZEN) - priv->pageClient->page()->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive); + impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive); return true; } static Eina_Bool _ewk_view_smart_mouse_wheel(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Wheel* wheelEvent) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false) - EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - // FIXME: impl->page() is used in the webkit opensource, but tizen webkit does not use it yet. - //impl->page()->handleWheelEvent(NativeWebWheelEvent(wheelEvent, impl->transformFromScene(), impl->transformToScreen())); - priv->pageClient->page()->handleWheelEvent(NativeWebWheelEvent(wheelEvent, impl->transformFromScene(), impl->transformToScreen())); + impl->page()->handleWheelEvent(NativeWebWheelEvent(wheelEvent, impl->transformFromScene(), impl->transformToScreen())); return true; } static Eina_Bool _ewk_view_smart_mouse_down(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Down* downEvent) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false) - EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - // FIXME: impl->page() is used in the webkit opensource, but tizen webkit does not use it yet. - //impl->page()->handleMouseEvent(NativeWebMouseEvent(downEvent, impl->transformFromScene(), impl->transformToScreen())); - priv->pageClient->page()->handleMouseEvent(NativeWebMouseEvent(downEvent, impl->transformFromScene(), impl->transformToScreen())); + impl->page()->handleMouseEvent(NativeWebMouseEvent(downEvent, impl->transformFromScene(), impl->transformToScreen())); return true; } static Eina_Bool _ewk_view_smart_mouse_up(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Up* upEvent) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false) - EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + + impl->page()->handleMouseEvent(NativeWebMouseEvent(upEvent, impl->transformFromScene(), impl->transformToScreen())); + + InputMethodContextEfl* inputMethodContext = impl->inputMethodContext(); + if (inputMethodContext) + inputMethodContext->handleMouseUpEvent(upEvent); - // FIXME: impl->page() is used in the webkit opensource, but tizen webkit does not use it yet. - //impl->page()->handleMouseEvent(NativeWebMouseEvent(upEvent, impl->transformFromScene(), impl->transformToScreen())); - priv->pageClient->page()->handleMouseEvent(NativeWebMouseEvent(upEvent, impl->transformFromScene(), impl->transformToScreen())); return true; } static Eina_Bool _ewk_view_smart_mouse_move(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Move* moveEvent) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false) - EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); // FIXME: impl->page() is used in the webkit opensource, but tizen webkit does not use it yet. - //impl->page()->handleMouseEvent(NativeWebMouseEvent(moveEvent, impl->transformFromScene(), impl->transformToScreen())); - priv->pageClient->page()->handleMouseEvent(NativeWebMouseEvent(moveEvent, impl->transformFromScene(), impl->transformToScreen())); + impl->page()->handleMouseEvent(NativeWebMouseEvent(moveEvent, impl->transformFromScene(), impl->transformToScreen())); return true; } static Eina_Bool _ewk_view_smart_key_down(Ewk_View_Smart_Data* smartData, const Evas_Event_Key_Down* downEvent) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false) + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); -#if ENABLE(TIZEN_ISF_PORT) - Ecore_IMF_Event IMFEvent; - ecore_imf_evas_event_key_down_wrap(const_cast(downEvent), &IMFEvent.key_down); - bool filtered = ecore_imf_context_filter_event(priv->imfContext, ECORE_IMF_EVENT_KEY_DOWN, &IMFEvent); + bool isFiltered = false; + InputMethodContextEfl* inputMethodContext = impl->inputMethodContext(); + if (inputMethodContext) + inputMethodContext->handleKeyDownEvent(downEvent, &isFiltered); - priv->pageClient->page()->handleKeyboardEvent(NativeWebKeyboardEvent(downEvent, filtered)); -#else - priv->pageClient->page()->handleKeyboardEvent(NativeWebKeyboardEvent(downEvent)); -#endif // #if ENABLE(TIZEN_ISF_PORT) + impl->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(downEvent, isFiltered)); return true; } static Eina_Bool _ewk_view_smart_key_up(Ewk_View_Smart_Data* smartData, const Evas_Event_Key_Up* upEvent) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false) + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - priv->pageClient->page()->handleKeyboardEvent(NativeWebKeyboardEvent(upEvent)); + impl->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(upEvent)); return true; } @@ -680,27 +400,26 @@ static Eina_Bool _ewk_view_smart_key_up(Ewk_View_Smart_Data* smartData, const Ev static Eina_Bool _ewk_view_smart_gesture_start(Ewk_View_Smart_Data* smartData, const Ewk_Event_Gesture* event) { #if ENABLE(TIZEN_GESTURE) - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false) - EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP) - if (priv->pageClient->isTextSelectionMode() && priv->pageClient->isTextSelectionHandleDowned()) + if (impl->pageClient->isTextSelectionMode() && impl->pageClient->isTextSelectionHandleDowned()) return true; #endif #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) - if (priv->focusRing) { + if (impl->focusRing) { if (event->type == EWK_GESTURE_TAP && event->count == 1) { - priv->focusRing->requestToShow(IntPoint(event->position.x, event->position.y)); + impl->focusRing->requestToShow(IntPoint(event->position.x, event->position.y)); } else if (event->type == EWK_GESTURE_PAN) { - if (priv->exceedTouchMoveThreshold) - priv->focusRing->hide(); + if (impl->exceedTouchMoveThreshold) + impl->focusRing->requestToHide(); } else { - if (!event->type == EWK_GESTURE_LONG_PRESS) { + if (event->type != EWK_GESTURE_LONG_PRESS) { #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2) - if (!priv->pageClient->isContextMenuVisible()) + if (!impl->pageClient->isContextMenuVisible()) #endif - priv->focusRing->hide(); + impl->focusRing->requestToHide(); } } } @@ -713,35 +432,47 @@ static Eina_Bool _ewk_view_smart_gesture_start(Ewk_View_Smart_Data* smartData, c switch (event->type) { case EWK_GESTURE_TAP: - priv->gestureClient->startTap(IntPoint(event->position.x, event->position.y)); + impl->gestureClient->startTap(IntPoint(event->position.x, event->position.y)); break; case EWK_GESTURE_LONG_PRESS: { #if ENABLE(TIZEN_WEBKIT2_HIT_TEST) #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) - if (ewk_settings_text_selection_enabled_get(priv->settings.get())) - priv->pageClient->setIsTextSelectionMode(false); + if (ewk_settings_text_selection_enabled_get(impl->settings())) + impl->pageClient->setIsTextSelectionMode(false); #endif IntPoint scenePoint(event->position.x, event->position.y); IntPoint contentsPoint = impl->transformFromScene().mapPoint(scenePoint); - WebHitTestResult::Data hitTestResultData = priv->pageClient->page()->hitTestResultAtPoint(contentsPoint); + WebHitTestResult::Data hitTestResultData = impl->pageProxy->hitTestResultAtPoint(contentsPoint); + if (!hitTestResultData.absoluteMediaURL.isEmpty()) + break; #if ENABLE(TIZEN_DRAG_SUPPORT) // 1. Check to start dragging. - if (hitTestResultData.isDragSupport) { - priv->pageClient->setDragPoint(scenePoint); - priv->gestureClient->showContextMenu(scenePoint); + if (hitTestResultData.isDragSupport && !hitTestResultData.isContentEditable) { + impl->pageClient->setDragPoint(scenePoint); + if (impl->pageClient->isDragMode()) { + impl->pageClient->setDragMode(false); + } +#if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) + if (impl->focusRing) + impl->focusRing->show(IntRect(), true); +#endif + impl->gestureClient->showContextMenu(scenePoint); break; } #endif // 2. Check to show context menu. - if (!hitTestResultData.absoluteImageURL.isEmpty() - || !hitTestResultData.absoluteLinkURL.isEmpty() - || !hitTestResultData.absoluteMediaURL.isEmpty()) { - priv->gestureClient->showContextMenu(scenePoint); + if ((!hitTestResultData.absoluteImageURL.isEmpty() || !hitTestResultData.absoluteLinkURL.isEmpty()) + && !hitTestResultData.isContentEditable) { +#if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) + if (impl->focusRing) + impl->focusRing->show(IntRect(), true); +#endif + impl->gestureClient->showContextMenu(scenePoint); break; } #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) // 3. Check for text selection. - if (ewk_settings_text_selection_enabled_get(priv->settings.get())) { + if (ewk_settings_text_selection_enabled_get(impl->settings())) { // Process gesture_end(EWK_GESTURE_TAP) to activate the editing if node under point is editable. if (hitTestResultData.context & WebHitTestResult::HitTestResultContextEditable) { if (smartData->api && smartData->api->gesture_end) { @@ -750,9 +481,9 @@ static Eina_Bool _ewk_view_smart_gesture_start(Ewk_View_Smart_Data* smartData, c } } - if (priv->pageClient->textSelectionDown(scenePoint)) { - priv->gestureClient->setGestureEnabled(false); - ewkViewHandleTouchEvent(smartData->self, EWK_TOUCH_CANCEL); + if (impl->pageClient->textSelectionDown(scenePoint)) { + impl->gestureClient->setGestureEnabled(false); + impl->feedTouchEventsByType(EWK_TOUCH_CANCEL); } } #endif @@ -760,14 +491,14 @@ static Eina_Bool _ewk_view_smart_gesture_start(Ewk_View_Smart_Data* smartData, c #endif // #if ENABLE(TIZEN_WEBKIT2_HIT_TEST) } case EWK_GESTURE_PAN: - priv->gestureClient->startPan(IntPoint(event->position.x, event->position.y)); + impl->gestureClient->startPan(IntPoint(event->position.x, event->position.y)); break; case EWK_GESTURE_FLICK: - priv->gestureClient->startFlick(IntPoint(event->position.x, event->position.y), IntPoint(event->velocity.x, event->velocity.y)); + impl->gestureClient->startFlick(IntPoint(event->position.x, event->position.y), IntPoint(event->velocity.x, event->velocity.y)); break; case EWK_GESTURE_PINCH: - if (priv->pageClient->viewportConstraints().userScalable) - priv->gestureClient->startPinch(IntPoint(event->position.x, event->position.y), event->scale); + if (impl->pageClient->viewportConstraints().userScalable) + impl->gestureClient->startPinch(IntPoint(event->position.x, event->position.y), event->scale); break; default: ASSERT_NOT_REACHED(); @@ -783,19 +514,19 @@ static Eina_Bool _ewk_view_smart_gesture_start(Ewk_View_Smart_Data* smartData, c static Eina_Bool _ewk_view_smart_gesture_end(Ewk_View_Smart_Data* smartData, const Ewk_Event_Gesture* event) { #if ENABLE(TIZEN_GESTURE) - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false) + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP) - if (priv->pageClient->isTextSelectionMode() && priv->pageClient->isTextSelectionHandleDowned()) + if (impl->pageClient->isTextSelectionMode() && impl->pageClient->isTextSelectionHandleDowned()) return true; #endif #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) - if (priv->focusRing) { + if (impl->focusRing) { #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2) - if (!priv->pageClient->isContextMenuVisible()) + if (!impl->pageClient->isContextMenuVisible() || impl->pageClient->isTextSelectionMode()) #endif - priv->focusRing->hide(); + impl->focusRing->requestToHide(); } #endif @@ -803,36 +534,40 @@ static Eina_Bool _ewk_view_smart_gesture_end(Ewk_View_Smart_Data* smartData, con case EWK_GESTURE_TAP: if (event->count == 1) { #if ENABLE(TIZEN_DRAG_SUPPORT) - if (priv->pageClient->isDragMode()) - priv->pageClient->setDragMode(false); + if (impl->pageClient->isDragMode()) + impl->pageClient->setDragMode(false); #endif - priv->gestureClient->endTap(IntPoint(event->position.x, event->position.y)); #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) - if (priv->pageClient->isTextSelectionMode()) - priv->pageClient->setIsTextSelectionMode(false); + if (impl->pageClient->isTextSelectionMode()) + impl->pageClient->setIsTextSelectionMode(false); #endif + #if ENABLE(TIZEN_ISF_PORT) - evas_object_focus_set(smartData->self, true); + if (impl->inputMethodContext()->isIMEPostion(event->position.x, event->position.y)) + return false; +#endif + + impl->gestureClient->endTap(IntPoint(event->position.x, event->position.y)); + } else if (event->count == 2) { +#if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) + if (impl->focusRing) + impl->focusRing->requestToHide(true); #endif - } else if (event->count == 2) - priv->gestureClient->endDoubleTap(IntPoint(event->position.x, event->position.y)); + impl->gestureClient->endDoubleTap(IntPoint(event->position.x, event->position.y)); + } break; case EWK_GESTURE_LONG_PRESS: -#if ENABLE(TIZEN_DRAG_SUPPORT) - if (priv->pageClient->isDragMode()) - priv->pageClient->setDragMode(false); -#endif // Prcess endTap for LONG_PRESS gesture if text-selection and context menu did not work - priv->gestureClient->endTap(IntPoint(event->position.x, event->position.y)); + impl->gestureClient->endTap(IntPoint(event->position.x, event->position.y)); break; case EWK_GESTURE_PAN: - priv->gestureClient->endPan(IntPoint(event->position.x, event->position.y)); + impl->gestureClient->endPan(IntPoint(event->position.x, event->position.y)); break; case EWK_GESTURE_FLICK: - priv->gestureClient->endFlick(IntPoint(event->position.x, event->position.y), IntPoint(event->velocity.x, event->velocity.y)); + impl->gestureClient->endFlick(IntPoint(event->position.x, event->position.y), IntPoint(event->velocity.x, event->velocity.y)); break; case EWK_GESTURE_PINCH: - priv->gestureClient->endPinch(IntPoint(event->position.x, event->position.y), event->scale); + impl->gestureClient->endPinch(IntPoint(event->position.x, event->position.y), event->scale); break; default: ASSERT_NOT_REACHED(); @@ -848,29 +583,33 @@ static Eina_Bool _ewk_view_smart_gesture_end(Ewk_View_Smart_Data* smartData, con static Eina_Bool _ewk_view_smart_gesture_move(Ewk_View_Smart_Data* smartData, const Ewk_Event_Gesture* event) { #if ENABLE(TIZEN_GESTURE) - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false) + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP) - if (priv->pageClient->isTextSelectionMode() && priv->pageClient->isTextSelectionHandleDowned()) + if (impl->pageClient->isTextSelectionMode() && impl->pageClient->isTextSelectionHandleDowned()) return true; #endif #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) - if (priv->focusRing && !(event->type == EWK_GESTURE_PAN && !priv->exceedTouchMoveThreshold)) - priv->focusRing->hide(); + if (impl->focusRing && !(event->type == EWK_GESTURE_PAN && !impl->exceedTouchMoveThreshold)) { +#if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2) + if (!impl->pageClient->isContextMenuVisible()) +#endif + impl->focusRing->requestToHide(true); + } #endif switch (event->type) { case EWK_GESTURE_PAN: - priv->gestureClient->movePan(IntPoint(event->position.x, event->position.y)); + impl->gestureClient->movePan(IntPoint(event->position.x, event->position.y)); break; case EWK_GESTURE_TAP: case EWK_GESTURE_LONG_PRESS: case EWK_GESTURE_FLICK: break; case EWK_GESTURE_PINCH: - if (priv->pageClient->viewportConstraints().userScalable) - priv->gestureClient->movePinch(IntPoint(event->position.x, event->position.y), event->scale); + if (impl->pageClient->viewportConstraints().userScalable) + impl->gestureClient->movePinch(IntPoint(event->position.x, event->position.y), event->scale); break; default: ASSERT_NOT_REACHED(); @@ -910,34 +649,7 @@ static void _ewk_view_on_mouse_wheel(void* data, Evas* canvas, Evas_Object* ewkV smartData->api->mouse_wheel(smartData, wheelEvent); } -static void _ewk_view_on_mouse_down(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo) -{ - Evas_Event_Mouse_Down* downEvent = static_cast(eventInfo); - Ewk_View_Smart_Data* smartData = static_cast(data); - EINA_SAFETY_ON_NULL_RETURN(smartData->api); - EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_down); - smartData->api->mouse_down(smartData, downEvent); -} - -static void _ewk_view_on_mouse_up(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo) -{ - Evas_Event_Mouse_Up* upEvent = static_cast(eventInfo); - Ewk_View_Smart_Data* smartData = static_cast(data); - EINA_SAFETY_ON_NULL_RETURN(smartData->api); - EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_up); - smartData->api->mouse_up(smartData, upEvent); -} - -static void _ewk_view_on_mouse_move(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo) -{ - Evas_Event_Mouse_Move* moveEvent = static_cast(eventInfo); - Ewk_View_Smart_Data* smartData = static_cast(data); - EINA_SAFETY_ON_NULL_RETURN(smartData->api); - EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_move); - smartData->api->mouse_move(smartData, moveEvent); -} - -static void _ewk_view_on_key_down(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo) +static void _ewk_view_on_key_down(void* data, Evas*, Evas_Object*, void* eventInfo) { Evas_Event_Key_Down* downEvent = static_cast(eventInfo); Ewk_View_Smart_Data* smartData = static_cast(data); @@ -955,121 +667,97 @@ static void _ewk_view_on_key_up(void* data, Evas* canvas, Evas_Object* ewkView, smartData->api->key_up(smartData, upEvent); } -#if ENABLE(TOUCH_EVENTS) -static inline void _ewk_view_feed_touch_event_using_touch_point_list_of_evas(Evas_Object* ewkView, Ewk_Touch_Event_Type type) +static void _ewk_view_on_show(void* data, Evas*, Evas_Object*, void* /*eventInfo*/) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - - unsigned count = evas_touch_point_list_count(smartData->base.evas); - if (!count) - return; - - Eina_List* points = 0; - for (unsigned i = 0; i < count; ++i) { - Ewk_Touch_Point* point = new Ewk_Touch_Point; - point->id = evas_touch_point_list_nth_id_get(smartData->base.evas, i); - evas_touch_point_list_nth_xy_get(smartData->base.evas, i, &point->x, &point->y); - point->state = evas_touch_point_list_nth_state_get(smartData->base.evas, i); -#if ENABLE(TOUCH_EVENTS) && ENABLE(TIZEN_GESTURE) - if (type == EWK_TOUCH_CANCEL) - point->state = EVAS_TOUCH_POINT_CANCEL; -#endif - points = eina_list_append(points, point); - } - - ewk_view_feed_touch_event(ewkView, type, points, evas_key_modifier_get(smartData->base.evas)); - - void* data; - EINA_LIST_FREE(points, data) - delete static_cast(data); + Ewk_View_Smart_Data* smartData = static_cast(data); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible); } -static void _ewk_view_on_touch_down(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo) +static void _ewk_view_on_hide(void* data, Evas*, Evas_Object*, void* /*eventInfo*/) { - _ewk_view_feed_touch_event_using_touch_point_list_of_evas(ewkView, EWK_TOUCH_START); -} + Ewk_View_Smart_Data* smartData = static_cast(data); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); -static void _ewk_view_on_touch_up(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo) -{ - _ewk_view_feed_touch_event_using_touch_point_list_of_evas(ewkView, EWK_TOUCH_END); + // This call may look wrong, but we really need to pass ViewIsVisible here. + // viewStateDidChange() itself is responsible for actually setting the visibility to Visible or Hidden + // depending on what WebPageProxy::isViewVisible() returns, this simply triggers the process. + impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible); } -static void _ewk_view_on_touch_move(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo) +#if OS(TIZEN) + +#if ENABLE(TIZEN_FULLSCREEN_API) +Eina_Bool _ewk_view_smart_fullscreen_enter(Ewk_View_Smart_Data* smartData) { - _ewk_view_feed_touch_event_using_touch_point_list_of_evas(ewkView, EWK_TOUCH_MOVE); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + + ewk_view_main_frame_scrollbar_visible_set(impl->view(), false); + evas_object_smart_callback_call(impl->view(), "fullscreen,enterfullscreen", 0); + return true; } -#if OS(TIZEN) -void ewkViewHandleTouchEvent(Evas_Object* ewkView, Ewk_Touch_Event_Type type) +Eina_Bool _ewk_view_smart_fullscreen_exit(Ewk_View_Smart_Data* smartData) { - _ewk_view_feed_touch_event_using_touch_point_list_of_evas(ewkView, type); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + + ewk_view_main_frame_scrollbar_visible_set(impl->view(), true); + evas_object_smart_callback_call(impl->view(), "fullscreen,exitfullscreen", 0); + return true; } #endif -#endif -#if OS(TIZEN) #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) Eina_Bool _ewk_view_text_selection_down(Ewk_View_Smart_Data* smartData, int x, int y) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - return priv->pageClient->textSelectionDown(IntPoint(x, y), true); + return impl->pageClient->textSelectionDown(IntPoint(x, y)); } Eina_Bool _ewk_view_text_selection_move(Ewk_View_Smart_Data* smartData, int x, int y) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); IntPoint point(x, y); - priv->pageClient->textSelectionMove(point, true); + impl->pageClient->textSelectionMove(point); return true; } Eina_Bool _ewk_view_text_selection_up(Ewk_View_Smart_Data* smartData, int x, int y) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); IntPoint point(x, y); - priv->pageClient->textSelectionUp(point, true); + impl->pageClient->textSelectionUp(point, true); return true; } #endif -#if ENABLE(TIZEN_DATALIST_ELEMENT) -static void _ewk_view_data_list_del(Eina_List* dataList) -{ - EINA_SAFETY_ON_NULL_RETURN(dataList); - - void* item; - EINA_LIST_FREE(dataList, item) - eina_stringshare_del(static_cast(item)); -} -#endif - #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE) Eina_Bool _ewk_view_smart_formdata_candidate_show(Ewk_View_Smart_Data* smartData, int x, int y, int w, int h) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - priv->pageClient->showFormDataCandidate(IntRect(x, y, w, h)); + impl->pageClient->showFormDataCandidate(IntRect(x, y, w, h)); return true; } Eina_Bool _ewk_view_smart_formdata_candidate_hide(Ewk_View_Smart_Data* smartData) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - priv->pageClient->hideFormDataCandidate(); + impl->pageClient->hideFormDataCandidate(); return true; } Eina_Bool _ewk_view_smart_formdata_candidate_update_data(Ewk_View_Smart_Data* smartData, Eina_List* dataList) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); Vector formData; Eina_List* list; @@ -1077,232 +765,76 @@ Eina_Bool _ewk_view_smart_formdata_candidate_update_data(Ewk_View_Smart_Data* sm EINA_LIST_FOREACH(dataList, list, data) formData.append(String::fromUTF8(static_cast(data))); - priv->pageClient->updateFormDataCandidate(formData); + impl->pageClient->updateFormDataCandidate(formData); return true; } Eina_Bool _ewk_view_smart_formdata_candidate_is_showing(Ewk_View_Smart_Data* smartData) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - return priv->pageClient->isShowingFormDataCandidate(); + return impl->pageClient->isShowingFormDataCandidate(); } #endif #if ENABLE(TIZEN_SCREEN_READER) -Eina_Bool _ewk_view_screen_reader_command_execute(Ewk_View_Smart_Data* smartData, unsigned int command, int data1, int data2) +Eina_Bool _ewk_view_screen_reader_action_execute(Ewk_View_Smart_Data* smartData, void* actionInfo) { - return ScreenReaderProxy::screenReader().executeCommand(smartData->self, command, data1, data2); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + + return ScreenReaderProxy::executeAction(impl, 0, static_cast(actionInfo)); } #endif #endif // #if OS(TIZEN) static Evas_Smart_Class g_parentSmartClass = EVAS_SMART_CLASS_INIT_NULL; -#if ENABLE(TIZEN_WEBKIT2_CREATE_VIEW_WITH_CREATED_PAGE_GROUP_WITH_IDENTIFIER) -static uint64_t generatePageGroupIdentifierID() +static void _ewk_view_impl_del(EwkViewImpl* impl) { - static uint64_t uniquePageGroupIdentifierID = 1; - return uniquePageGroupIdentifierID++; -} +#if !ENABLE(TIZEN_ICON_DATABASE) + /* Unregister icon change callback */ + Ewk_Favicon_Database* iconDatabase = impl->context->faviconDatabase(); + iconDatabase->unwatchChanges(_ewk_view_on_favicon_changed); #endif -static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData) + delete impl; +} + +static void _ewk_view_smart_add(Evas_Object* ewkView) { - Ewk_View_Private_Data* priv = new Ewk_View_Private_Data; - memset(priv, 0, sizeof(Ewk_View_Private_Data)); // FIXME : below code should be considered to move to constructor. -#if OS(TIZEN) - priv->areMouseEventsEnabled = false; + const Evas_Smart* smart = evas_object_smart_smart_get(ewkView); + const Evas_Smart_Class* smartClass = evas_smart_class_get(smart); + const Ewk_View_Smart_Class* api = reinterpret_cast(smartClass); + EWK_VIEW_SD_GET(ewkView, smartData); - priv->javascriptPopup = adoptPtr(new JavaScriptPopup(smartData->self)); - priv->openPanel = adoptPtr(new OpenPanel(smartData->self)); + if (!smartData) { + smartData = static_cast(calloc(1, sizeof(Ewk_View_Smart_Data))); + if (!smartData) { + EINA_LOG_CRIT("could not allocate Ewk_View_Smart_Data"); + return; + } + evas_object_smart_data_set(ewkView, smartData); + } -#if ENABLE(TIZEN_INPUT_TAG_EXTENSION) - priv->inputPicker = adoptPtr(new InputPicker(smartData->self)); -#endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION) + smartData->self = ewkView; + smartData->api = api; -#if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) - priv->focusRing = FocusRing::create(smartData->self); -#endif // #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) + g_parentSmartClass.add(ewkView); -#if ENABLE(TIZEN_GESTURE) - priv->gestureRecognizer = GestureRecognizer::create(smartData->self); - priv->gestureClient = GestureClient::create(smartData->ewkViewImpl); -#endif // #if ENABLE(TIZEN_GESTURE) -#if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR) - const char* hideScrollbar = getenv("TIZEN_WEBKIT2_TILED_SCROLLBAR_HIDE"); - if (hideScrollbar && atoi(hideScrollbar) == 1) - priv->mainFrameScrollbarVisibility = false; - else - priv->mainFrameScrollbarVisibility = true; -#endif + smartData->priv = new EwkViewImpl(ewkView); + if (!smartData->priv) { + EINA_LOG_CRIT("could not allocate EwkViewImpl"); + evas_object_smart_data_set(ewkView, 0); + free(smartData); + return; + } -#if ENABLE(TIZEN_DATALIST_ELEMENT) - priv->dataList = 0; -#endif - -#if ENABLE(TIZEN_WEBKIT2_CREATE_VIEW_WITH_CREATED_PAGE_GROUP_WITH_IDENTIFIER) - String pageGroupIdentifierID = String::number(generatePageGroupIdentifierID()); - String pageGroupIdentifier = String::format("PageGroup%s", pageGroupIdentifierID.utf8().data()); - - WKRetainPtr pageGroupIdentifierRef(AdoptWK, WKStringCreateWithUTF8CString(pageGroupIdentifier.utf8().data())); - priv->pageGroup = WebPageGroup::create(toWTFString(pageGroupIdentifierRef.get())); -#endif - - priv->suspendRequested = false; - priv->suspendedPainting = false; - priv->suspendedResources = false; -#endif // #if OS(TIZEN) - -#ifdef HAVE_ECORE_X - priv->isUsingEcoreX = WebCore::isUsingEcoreX(smartData->base.evas); -#endif - - return priv; -} - -static void _ewk_view_priv_loading_resources_clear(LoadingResourcesMap& loadingResourcesMap) -{ - // Clear the loadingResources HashMap. - LoadingResourcesMap::iterator it = loadingResourcesMap.begin(); - LoadingResourcesMap::iterator end = loadingResourcesMap.end(); - for ( ; it != end; ++it) - ewk_web_resource_unref(it->second); - - loadingResourcesMap.clear(); -} - -static void _ewk_view_priv_del(Ewk_View_Private_Data* priv) -{ - if (!priv) - return; - -#if OS(TIZEN) - if (priv->javascriptGlobalContext) - JSGlobalContextRelease(priv->javascriptGlobalContext); - - eina_stringshare_del(priv->userAgent); - eina_stringshare_del(priv->encoding); -#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG) - eina_stringshare_del(priv->webAppIconURL); - if (priv->webAppIconURLs) { - void* data = 0; - EINA_LIST_FREE(priv->webAppIconURLs, data) - ewkWebAppIconDataDelete(static_cast(data)); - } -#endif - - if (priv->authChallenge) - ewkAuthChallengeDelete(priv->authChallenge); - if (priv->policyDecision) - ewkPolicyDecisionDelete(priv->policyDecision); - -#if ENABLE(TIZEN_CERTIFICATE_HANDLING) - if (priv->certificatePolicyDecision) - ewkCertificatePolicyDecisionDelete(priv->certificatePolicyDecision); -#endif - -#if ENABLE(TIZEN_MEDIA_STREAM) - if (priv->userMediaPermissionRequests) - ewkUserMediaDeletePermissionRequestList(priv->userMediaPermissionRequests); -#endif - - priv->openPanelListener = 0; - priv->openPanel = nullptr; - priv->javascriptPopup = nullptr; - priv->alertContext = nullptr; - priv->confirmContext = nullptr; -#if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL) - priv->beforeUnloadConfirmPanelContext = nullptr; -#endif - priv->promptContext = nullptr; - priv->isWaitingForJavaScriptPopupReply = false; - priv->openpanelContext = nullptr; -#if ENABLE(TIZEN_INPUT_TAG_EXTENSION) - priv->inputPicker = nullptr; - eina_stringshare_del(priv->inputValue); -#endif - -#if ENABLE(TIZEN_DATALIST_ELEMENT) - if (priv->dataList) { - _ewk_view_data_list_del(priv->dataList); - priv->dataList = 0; - } -#endif - -#if ENABLE(TIZEN_GEOLOCATION) - if (priv->geolocation) - ewkGeolocationDeleteGeolocation(priv->geolocation); - if (priv->geolocationPermissionRequests) - ewkGeolocationDeletePermissionRequestList(priv->geolocationPermissionRequests); -#endif - -#if ENABLE(TIZEN_NOTIFICATIONS) - if (priv->notifications) - ewkNotificationDeleteNotificationList(priv->notifications); - if (priv->notificationPermissionRequests) - ewkNotificationDeletePermissionRequestList(priv->notificationPermissionRequests); -#endif -#if ENABLE(TIZEN_SQL_DATABASE) - if (priv->exceededDatabaseQuota) - ewkContextDeleteExceededQuota(priv->exceededDatabaseQuota); -#endif -#if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) - priv->focusRing = nullptr; -#endif // #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) -#if ENABLE(TIZEN_GESTURE) - priv->gestureRecognizer = nullptr; - priv->gestureClient = nullptr; -#endif // #if ENABLE(TIZEN_GESTURE) - -#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) - eina_stringshare_del(priv->selectedText); -#endif -#if ENABLE(TIZEN_WEBKIT2_CREATE_VIEW_WITH_CREATED_PAGE_GROUP_WITH_IDENTIFIER) - priv->pageGroup = nullptr; -#endif - -#if ENABLE(TIZEN_ISF_PORT) - _ewk_view_imf_context_destroy(priv); -#endif -#endif // #if OS(TIZEN) - - delete priv; -} - -static void _ewk_view_smart_add(Evas_Object* ewkView) -{ - const Evas_Smart* smart = evas_object_smart_smart_get(ewkView); - const Evas_Smart_Class* smartClass = evas_smart_class_get(smart); - const Ewk_View_Smart_Class* api = reinterpret_cast(smartClass); - EWK_VIEW_SD_GET(ewkView, smartData); - - if (!smartData) { - smartData = static_cast(calloc(1, sizeof(Ewk_View_Smart_Data))); - if (!smartData) { - EINA_LOG_CRIT("could not allocate Ewk_View_Smart_Data"); - return; - } - evas_object_smart_data_set(ewkView, smartData); - } - - smartData->self = ewkView; - smartData->api = api; - - g_parentSmartClass.add(ewkView); - - // FIXME: Ewk_View_Private_Data was replaced with EwkViewImpl in the webkit opensource. - // So, we have both Ewk_View_Private_Data and EwkViewImpl now, - // but Ewk_View_Private_Data should be removed later. - smartData->ewkViewImpl = new EwkViewImpl(ewkView); - smartData->priv = _ewk_view_priv_new(smartData); - - // Create evas_object_image to draw web contents. - smartData->image = evas_object_image_add(smartData->base.evas); - evas_object_image_alpha_set(smartData->image, false); - evas_object_image_filled_set(smartData->image, true); - evas_object_smart_member_add(smartData->image, ewkView); + // Create evas_object_image to draw web contents. + smartData->image = evas_object_image_add(smartData->base.evas); + evas_object_image_alpha_set(smartData->image, false); + evas_object_image_filled_set(smartData->image, true); + evas_object_smart_member_add(smartData->image, ewkView); #if OS(TIZEN) #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) @@ -1320,41 +852,33 @@ static void _ewk_view_smart_add(Evas_Object* ewkView) // elementary steal webview's focus during mouse up event // So, added code that events are not propagated to smart parent according to guide from EFL evas_object_propagate_events_set(ewkView, false); - -#if ENABLE(TIZEN_SCREEN_READER) - ScreenReaderProxy::screenReader().addView(ewkView); -#endif #endif // #if OS(TIZEN) #define CONNECT(s, c) evas_object_event_callback_add(ewkView, s, c, smartData) CONNECT(EVAS_CALLBACK_FOCUS_IN, _ewk_view_on_focus_in); CONNECT(EVAS_CALLBACK_FOCUS_OUT, _ewk_view_on_focus_out); CONNECT(EVAS_CALLBACK_MOUSE_WHEEL, _ewk_view_on_mouse_wheel); -#if !OS(TIZEN) - CONNECT(EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_mouse_down); - CONNECT(EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_mouse_up); - CONNECT(EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_mouse_move); -#endif CONNECT(EVAS_CALLBACK_KEY_DOWN, _ewk_view_on_key_down); CONNECT(EVAS_CALLBACK_KEY_UP, _ewk_view_on_key_up); + CONNECT(EVAS_CALLBACK_SHOW, _ewk_view_on_show); + CONNECT(EVAS_CALLBACK_HIDE, _ewk_view_on_hide); #undef CONNECT } static void _ewk_view_smart_del(Evas_Object* ewkView) { + EwkViewImpl::removeFromPageViewMap(ewkView); EWK_VIEW_SD_GET(ewkView, smartData); #if ENABLE(TIZEN_SCREEN_READER) - ScreenReaderProxy::screenReader().removeView(ewkView); + ScreenReaderProxy::screenReader().finalize(smartData->priv); #endif - if (smartData && smartData->priv) { - _ewk_view_priv_del(smartData->priv); - smartData->priv = 0; - } - - // FIXME: Ewk_View_Private_Data was replaced with EwkViewImpl in the webkit opensource. - // If then, ewkViewImpl will be changed to priv. - if (smartData) - delete smartData->ewkViewImpl; +#if ENABLE(TIZEN_INPUT_COLOR_PICKER) + // Close color picker if it's opened. + if (smartData && smartData->priv && smartData->priv->inputPicker->isColorPickerShown()) + ewk_view_color_picker_color_set(ewkView, 0, 0, 0, 0); +#endif + if (smartData && smartData->priv) + _ewk_view_impl_del(smartData->priv); g_parentSmartClass.del(ewkView); } @@ -1369,16 +893,27 @@ static void _ewk_view_smart_resize(Evas_Object* ewkView, Evas_Coord width, Evas_ evas_object_image_size_set(smartData->image, width, height); evas_object_image_fill_set(smartData->image, 0, 0, width, height); #if OS(TIZEN) - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); #if ENABLE(TIZEN_WEBKIT2_TILED_AC) evas_object_image_native_surface_set(smartData->image, 0); +#if ENABLE(TIZEN_WEBKIT2_VIEW_VISIBILITY) + if (impl->pageClient->isVisible()) { + Ecore_Evas* ee = ecore_evas_ecore_evas_get(smartData->base.evas); + impl->pageClient->updateViewportSize(IntSize(width, height), ecore_evas_rotation_get(ee)); + } else + impl->pageClient->setDeferUpdateViewportSize(true); +#else + Ecore_Evas* ee = ecore_evas_ecore_evas_get(smartData->base.evas); + impl->pageClient->updateViewportSize(IntSize(width, height), ecore_evas_rotation_get(ee)); +#endif + #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION) if (!ewk_view_is_opengl_backend(ewkView)) _ewk_view_composite(smartData); else // OpenGL backend #endif - priv->pageClient->displayViewport(); + impl->pageClient->displayViewport(); #endif #endif // #if OS(TIZEN) @@ -1394,98 +929,11 @@ static void _ewk_view_smart_move(Evas_Object* ewkView, Evas_Coord x, Evas_Coord _ewk_view_smart_changed(smartData); } -IntSize ewk_view_size_get(const Evas_Object* ewkView) -{ - int width, height; - evas_object_geometry_get(ewkView, 0, 0, &width, &height); - return IntSize(width, height); -} - -#if USE(ACCELERATED_COMPOSITING) -static bool ewk_view_create_gl_surface(const Evas_Object* ewkView, const IntSize& viewSize) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - - Evas_GL_Config evasGlConfig = { - EVAS_GL_RGBA_8888, - EVAS_GL_DEPTH_BIT_8, - EVAS_GL_STENCIL_NONE, - EVAS_GL_OPTIONS_NONE, - EVAS_GL_MULTISAMPLE_NONE - }; - - ASSERT(!priv->evasGlSurface); - priv->evasGlSurface = evas_gl_surface_create(priv->evasGl, &evasGlConfig, viewSize.width(), viewSize.height()); - if (!priv->evasGlSurface) - return false; - - Evas_Native_Surface nativeSurface; - evas_gl_native_surface_get(priv->evasGl, priv->evasGlSurface, &nativeSurface); - evas_object_image_native_surface_set(smartData->image, &nativeSurface); - - return true; -} - -bool ewk_view_accelerated_compositing_mode_enter(const Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - - EINA_SAFETY_ON_TRUE_RETURN_VAL(!!priv->evasGl, false); - - Evas* evas = evas_object_evas_get(ewkView); - priv->evasGl = evas_gl_new(evas); - if (!priv->evasGl) - return false; - - priv->evasGlContext = evas_gl_context_create(priv->evasGl, 0); - if (!priv->evasGlContext) { - evas_gl_free(priv->evasGl); - priv->evasGl = 0; - return false; - } - - if (!ewk_view_create_gl_surface(ewkView, ewk_view_size_get(ewkView))) { - evas_gl_context_destroy(priv->evasGl, priv->evasGlContext); - priv->evasGlContext = 0; - - evas_gl_free(priv->evasGl); - priv->evasGl = 0; - return false; - } - - return true; -} - -bool ewk_view_accelerated_compositing_mode_exit(const Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - - EINA_SAFETY_ON_NULL_RETURN_VAL(priv->evasGl, false); - - if (priv->evasGlSurface) { - evas_gl_surface_destroy(priv->evasGl, priv->evasGlSurface); - priv->evasGlSurface = 0; - } - - if (priv->evasGlContext) { - evas_gl_context_destroy(priv->evasGl, priv->evasGlContext); - priv->evasGlContext = 0; - } - - evas_gl_free(priv->evasGl); - priv->evasGl = 0; - - return true; -} -#endif - static void _ewk_view_smart_calculate(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + Evas_Coord x, y, width, height; smartData->changed.any = false; @@ -1494,14 +942,21 @@ static void _ewk_view_smart_calculate(Evas_Object* ewkView) if (smartData->changed.size) { #if !OS(TIZEN) - if (priv->pageClient->page()->drawingArea()) - priv->pageClient->page()->drawingArea()->setSize(IntSize(width, height), IntSize()); +#if USE(COORDINATED_GRAPHICS) + impl->pageViewportControllerClient->updateViewportSize(IntSize(width, height)); +#endif +#if USE(ACCELERATED_COMPOSITING) + needsNewSurface = impl->evasGlSurface; +#endif + + if (impl->pageProxy->drawingArea()) + impl->pageProxy->drawingArea()->setSize(IntSize(width, height), IntSize()); #if USE(ACCELERATED_COMPOSITING) - if (!priv->evasGlSurface) + if (!impl->evasGlSurface) return; - evas_gl_surface_destroy(priv->evasGl, priv->evasGlSurface); - priv->evasGlSurface = 0; + evas_gl_surface_destroy(impl->evasGl, impl->evasGlSurface); + impl->evasGlSurface = 0; ewk_view_create_gl_surface(ewkView, IntSize(width, height)); ewk_view_display(ewkView, IntRect(IntPoint(), IntSize(width, height))); #endif @@ -1512,22 +967,29 @@ static void _ewk_view_smart_calculate(Evas_Object* ewkView) smartData->changed.size = false; #if OS(TIZEN) - if (priv->pageClient) { - if (DrawingAreaProxy* drawingArea = priv->pageClient->page()->drawingArea()) { + if (impl->pageClient) { + if (DrawingAreaProxy* drawingArea = impl->pageProxy->drawingArea()) { #if ENABLE(TIZEN_WEBKIT2_TILED_AC) - if (priv->pageClient->page()->isViewVisible()) + if (impl->pageProxy->isViewVisible()) drawingArea->setSize(IntSize(width, height), IntSize()); #else drawingArea->setSize(IntSize(width, height), IntSize()); #endif #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) && !ENABLE(TIZEN_WEBKIT2_EFL_WTR) - priv->pageClient->updateViewportSize(IntSize(width, height)); + Ecore_Evas* ee = ecore_evas_ecore_evas_get(smartData->base.evas); + int newAngle = ecore_evas_rotation_get(ee); +#if ENABLE(TIZEN_WEBKIT2_VIEW_VISIBILITY) + if (impl->pageClient->deferUpdateViewportSize()) { + impl->pageClient->updateViewportSize(IntSize(width, height), newAngle); + } +#endif + impl->pageClient->updateVisibleContentRectSize(IntSize(width, height)); if (ewk_view_is_opengl_backend(ewkView)) - priv->pageClient->displayViewport(); + impl->pageClient->displayViewport(); #endif } #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR) - priv->pageClient->frameRectChanged(); + impl->pageClient->frameRectChanged(); #endif } #endif // #if OS(TIZEN) @@ -1540,27 +1002,34 @@ static void _ewk_view_smart_calculate(Evas_Object* ewkView) smartData->changed.position = false; #if OS(TIZEN) #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR) - priv->pageClient->frameRectChanged(); + impl->pageClient->frameRectChanged(); #endif #if ENABLE(TIZEN_SCREEN_READER) - priv->pageClient->page()->recalcScreenReaderFocusRect(); + impl->pageProxy->recalcScreenReaderFocusRect(); +#endif +#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) + impl->pageClient->updateTextSelectionHandlesAndContextMenu(true); #endif #endif // #if OS(TIZEN) } #if OS(TIZEN) - if (priv->popupPicker) - ewk_popup_picker_resize(priv->popupPicker); + if (impl->popupPicker) + ewk_popup_picker_resize(impl->popupPicker); #endif // #if OS(TIZEN) } static void _ewk_view_smart_show(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); if (evas_object_clipees_get(smartData->base.clipper)) evas_object_show(smartData->base.clipper); evas_object_show(smartData->image); + +#if ENABLE(TIZEN_SCREEN_READER) + ScreenReaderProxy::screenReader().initialize(impl); +#endif } static void _ewk_view_smart_hide(Evas_Object* ewkView) @@ -1570,16 +1039,16 @@ static void _ewk_view_smart_hide(Evas_Object* ewkView) evas_object_hide(smartData->base.clipper); evas_object_hide(smartData->image); #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - if (priv->pageClient->isTextSelectionMode()) - priv->pageClient->setIsTextSelectionMode(false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + if (impl->pageClient->isTextSelectionMode()) + impl->pageClient->setIsTextSelectionMode(false); #endif } static void _ewk_view_smart_color_set(Evas_Object* ewkView, int red, int green, int blue, int alpha) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); if (alpha < 0) alpha = 0; @@ -1597,9 +1066,9 @@ static void _ewk_view_smart_color_set(Evas_Object* ewkView, int red, int green, #undef CHECK_COLOR evas_object_image_alpha_set(smartData->image, alpha < 255); - priv->pageClient->page()->setDrawsBackground(red || green || blue); - priv->pageClient->page()->setDrawsTransparentBackground(alpha < 255); - priv->pageClient->setBackgroundColor(red/255.0, green/255.0, blue/255.0, alpha/255.0); + impl->pageProxy->setDrawsBackground(red || green || blue); + impl->pageProxy->setDrawsTransparentBackground(alpha < 255); + impl->pageClient->setBackgroundColor(red/255.0, green/255.0, blue/255.0, alpha/255.0); #if !OS(TIZEN) g_parentSmartClass.color_set(ewkView, red, green, blue, alpha); @@ -1646,6 +1115,11 @@ Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api) api->gesture_end = _ewk_view_smart_gesture_end; api->gesture_move = _ewk_view_smart_gesture_move; +#if ENABLE(TIZEN_FULLSCREEN_API) + api->fullscreen_enter = _ewk_view_smart_fullscreen_enter; + api->fullscreen_exit = _ewk_view_smart_fullscreen_exit; +#endif + #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL) api->popup_menu_show = _ewk_view_popup_menu_show; #if ENABLE(TIZEN_MULTIPLE_SELECT) @@ -1681,7 +1155,7 @@ Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api) api->formdata_candidate_is_showing = _ewk_view_smart_formdata_candidate_is_showing; #endif #if ENABLE(TIZEN_SCREEN_READER) - api->screen_reader_command_execute = _ewk_view_screen_reader_command_execute; + api->screen_reader_action_execute = _ewk_view_screen_reader_action_execute; #endif #endif //#if OS(TIZEN) @@ -1701,51 +1175,82 @@ static inline Evas_Smart* _ewk_view_smart_class_new(void) return smart; } -static void _ewk_view_initialize(Evas_Object* ewkView, Ewk_Context* context, WKPageGroupRef pageGroupRef) +static void _ewk_view_initialize(Evas_Object* ewkView, PassRefPtr context, WKPageGroupRef pageGroupRef) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv) + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); EINA_SAFETY_ON_NULL_RETURN(context); - if (priv->pageClient) + if (impl->pageClient) return; #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION) - if (ewk_view_is_opengl_backend(ewkView)) { - priv->pageClient = PageClientEvasGL::create(toImpl(ewk_context_WKContext_get(context)), toImpl(pageGroupRef), ewkView); - priv->pageClient->page()->drawingArea()->layerTreeCoordinatorProxy()->initializeAcceleratedCompositingMode(true); - } - else { - priv->pageClient = PageClientImpl::create(toImpl(ewk_context_WKContext_get(context)), toImpl(pageGroupRef), ewkView); - priv->pageClient->page()->pageGroup()->preferences()->setAcceleratedCompositingEnabled(false); - priv->pageClient->page()->pageGroup()->preferences()->setWebGLEnabled(false); - priv->pageClient->page()->drawingArea()->layerTreeCoordinatorProxy()->initializeAcceleratedCompositingMode(false); - } + bool isOpenGL = ewk_view_is_opengl_backend(ewkView); + if (isOpenGL) + impl->pageClient = PageClientEvasGL::create(impl); + else + impl->pageClient = PageClientImpl::create(impl); #else - priv->pageClient = PageClientImpl::create(toImpl(ewk_context_WKContext_get(context)), toImpl(pageGroupRef), ewkView); + impl->pageClient = PageClientImpl::create(impl); #endif - // FixMe: Comment should be removed when pageClient is removed. - //priv->settings = adoptPtr(new Ewk_Settings(WKPageGroupGetPreferences(WKPageGetPageGroup(toAPI(priv->pageProxy.get()))))); - priv->settings = adoptPtr(new Ewk_Settings(WKPageGroupGetPreferences(WKPageGetPageGroup(toAPI(priv->pageClient->page()))))); + + if (pageGroupRef) + impl->pageProxy = toImpl(context->wkContext())->createWebPage(impl->pageClient.get(), toImpl(pageGroupRef)); + else + impl->pageProxy = toImpl(context->wkContext())->createWebPage(impl->pageClient.get(), WebPageGroup::create().get()); + + EwkViewImpl::addToPageViewMap(ewkView); #if OS(TIZEN) - priv->context = context; + impl->pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true); + impl->pageProxy->pageGroup()->preferences()->setForceCompositingMode(true); + impl->pageProxy->pageGroup()->preferences()->setFrameFlatteningEnabled(true); + impl->pageProxy->pageGroup()->preferences()->setAllowUniversalAccessFromFileURLs(true); +#endif + + impl->pageProxy->initializeWebPage(); + +#if ENABLE(TIZEN_VIEWPORT_META_TAG) + impl->pageProxy->setCustomDeviceScaleFactor((float)getMobileDPI() / 160); +#else + impl->pageProxy->setCustomDeviceScaleFactor((float)getDPI() / 160); +#endif + +#if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) && !ENABLE(TIZEN_WEBKIT2_EFL_WTR) + impl->pageProxy->setUseFixedLayout(true); +#endif +#if ENABLE(FULLSCREEN_API) + impl->pageProxy->fullScreenManager()->setWebView(ewkView); +#endif + +#if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION) + if (isOpenGL) + impl->pageProxy->drawingArea()->layerTreeCoordinatorProxy()->initializeAcceleratedCompositingMode(true); + else { + impl->pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(false); + impl->pageProxy->pageGroup()->preferences()->setWebGLEnabled(false); + impl->pageProxy->drawingArea()->layerTreeCoordinatorProxy()->initializeAcceleratedCompositingMode(false); + } +#endif + + impl->backForwardList = Ewk_Back_Forward_List::create(toAPI(impl->pageProxy->backForwardList())); + + impl->context = context; +#if OS(TIZEN) ewkViewContextMenuClientAttachClient(ewkView); - ewkViewFindClientAttatchClient(ewkView); ewkViewTizenClientAttachClient(ewkView); - ewkViewUIClientAttatchClient(ewkView); #if ENABLE(TIZEN_GEOLOCATION) - ewkViewGeolocationProviderAttachProvider(ewkView, ewk_context_WKContext_get(context)); + ewkViewGeolocationProviderAttachProvider(ewkView, impl->context->wkContext()); #endif #if ENABLE(TIZEN_NOTIFICATIONS) - ewkViewNotificationProviderAttachProvider(ewkView, ewk_context_WKContext_get(context)); + ewkViewNotificationProviderAttachProvider(ewkView, impl->context->wkContext()); #endif #if ENABLE(TIZEN_ICON_DATABASE) - ewk_view_icondatabase_client_attach(ewkView, ewk_context_WKContext_get(context)); + ewk_view_icondatabase_client_attach(ewkView, impl->context->wkContext()); #endif ewk_view_javascript_alert_callback_set(ewkView, _ewk_view_default_javascript_alert, 0); @@ -1756,26 +1261,39 @@ static void _ewk_view_initialize(Evas_Object* ewkView, Ewk_Context* context, WKP #endif ewk_view_open_panel_callback_set(ewkView, _ewk_view_default_open_panel, 0); #else // #if OS(TIZEN) - priv->backForwardList = ewk_back_forward_list_new(toAPI(priv->pageClient->page()->backForwardList())); - #if USE(COORDINATED_GRAPHICS) - priv->viewportHandler = EflViewportHandler::create(priv->pageClient.get()); + impl->viewportHandler = EflViewportHandler::create(impl->pageClient.get()); #endif #endif // #if OS(TIZEN) - WKPageRef wkPage = toAPI(priv->pageClient->page()); - ewk_view_form_client_attach(wkPage, ewkView); - ewk_view_loader_client_attach(wkPage, ewkView); - ewk_view_policy_client_attach(wkPage, ewkView); - ewk_view_resource_load_client_attach(wkPage, ewkView); +#if ENABLE(FULLSCREEN_API) + impl->pageProxy->fullScreenManager()->setWebView(ewkView); + impl->pageProxy->pageGroup()->preferences()->setFullScreenEnabled(true); +#endif + // Initialize page clients. + impl->pageLoadClient = PageLoadClientEfl::create(impl); + impl->pagePolicyClient = PagePolicyClientEfl::create(impl); + impl->pageUIClient = PageUIClientEfl::create(impl); + impl->resourceLoadClient = ResourceLoadClientEfl::create(impl); + impl->findClient = FindClientEfl::create(impl); + impl->formClient = FormClientEfl::create(impl); +#if !ENABLE(TIZEN_ICON_DATABASE) + /* Listen for favicon changes */ + Ewk_Favicon_Database* iconDatabase = impl->context->faviconDatabase(); + iconDatabase->watchChanges(IconChangeCallbackData(_ewk_view_on_favicon_changed, ewkView)); +#endif #if ENABLE(TIZEN_WEBKIT2_THEME_SET_INTERNAL) ewk_view_theme_set(ewkView, "/usr/share/edje/webkit.edj"); #endif #if ENABLE(TIZEN_WEBKIT2_CONTEXT_X_WINDOW) - if (!ewk_context_x_window_get(context)) - ewk_context_x_window_set(context, elm_win_xwindow_get(ewkView)); + if (!impl->context->xWindow()) + impl->context->setXWindow(elm_win_xwindow_get(ewkView)); +#endif + +#if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) + impl->focusRing = FocusRing::create(impl); #endif } @@ -1785,9 +1303,12 @@ static Evas_Object* _ewk_view_add_with_smart(Evas* canvas, Evas_Smart* smart) EINA_SAFETY_ON_NULL_RETURN_VAL(smart, 0); #if ENABLE(TIZEN_WEBKIT2_DDK_CHECK) - if(!eglGetDisplay(EGL_DEFAULT_DISPLAY)) { - EINA_LOG_CRIT("Fail in initiziling view because No DDK is installed."); - return 0; + { + using namespace EGL; + if(!eglGetDisplay(EGL_DEFAULT_DISPLAY)) { + EINA_LOG_CRIT("Fail in initiziling view because No DDK is installed."); + return 0; + } } #endif @@ -1801,8 +1322,8 @@ static Evas_Object* _ewk_view_add_with_smart(Evas* canvas, Evas_Smart* smart) return 0; } - EWK_VIEW_PRIV_GET(smartData, priv); - if (!priv) { + EWK_VIEW_IMPL_GET(smartData, impl); + if (!impl) { evas_object_del(ewkView); return 0; } @@ -1823,7 +1344,7 @@ Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGrou if (!ewkView) return 0; - _ewk_view_initialize(ewkView, ewk_context_new_from_WKContext(contextRef), pageGroupRef); + _ewk_view_initialize(ewkView, Ewk_Context::create(contextRef), pageGroupRef); return ewkView; } @@ -1840,14 +1361,14 @@ Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* co #if ENABLE(TIZEN_ICON_DATABASE) //set default iconDatabasePath - WKContextRef contextRef = ewk_context_WKContext_get(context); + WKContextRef contextRef = context->wkContext(); toImpl(contextRef)->setIconDatabasePath(toImpl(contextRef)->iconDatabasePath()); #endif #if ENABLE(TIZEN_WEBKIT2_CREATE_VIEW_WITH_CREATED_PAGE_GROUP_WITH_IDENTIFIER) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); - _ewk_view_initialize(ewkView, context, toAPI(priv->pageGroup.get())); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); + _ewk_view_initialize(ewkView, context, toAPI(impl->pageGroup.get())); #else _ewk_view_initialize(ewkView, context, 0); #endif @@ -1857,6 +1378,7 @@ Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* co Evas_Object* ewk_view_add_with_context(Evas* canvas, Ewk_Context* context) { + EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0); return ewk_view_smart_add(canvas, _ewk_view_smart_class_new(), context); } @@ -1865,36 +1387,22 @@ Evas_Object* ewk_view_add(Evas* canvas) return ewk_view_add_with_context(canvas, ewk_context_default_get()); } -/** - * @internal - * The uri of view was changed by the frame loader. - * - * Emits signal: "uri,changed" with pointer to new uri string. - */ -void ewk_view_uri_update(Evas_Object* ewkView) +Ewk_Context* ewk_view_context_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - String activeURL = priv->pageClient->page()->activeURL(); - if (activeURL.isEmpty()) - return; - - if (!eina_stringshare_replace(&priv->uri, activeURL.utf8().data())) - return; + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); - evas_object_smart_callback_call(ewkView, "uri,changed", static_cast(const_cast(priv->uri))); - evas_object_smart_callback_call(ewkView, "url,changed", static_cast(const_cast(priv->uri))); + return impl->ewkContext(); } -Eina_Bool ewk_view_url_set(Evas_Object* ewkView, const char* uri) +Eina_Bool ewk_view_url_set(Evas_Object* ewkView, const char* url) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(uri, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(url, false); - priv->pageClient->page()->loadURL(String::fromUTF8(uri)); - ewk_view_uri_update(ewkView); + impl->pageProxy->loadURL(String::fromUTF8(url)); + impl->informURLChange(); return true; } @@ -1902,18 +1410,27 @@ Eina_Bool ewk_view_url_set(Evas_Object* ewkView, const char* uri) const char* ewk_view_url_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); + + return impl->url(); +} + +const char *ewk_view_icon_url_get(const Evas_Object *ewkView) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); - return priv->uri; + return impl->faviconURL(); } Eina_Bool ewk_view_reload(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - priv->pageClient->page()->reload(/*reloadFromOrigin*/ false); - ewk_view_uri_update(ewkView); + impl->pageClient->prepareRestoredVisibleContectRect(); + impl->pageProxy->reload(/*reloadFromOrigin*/ false); + impl->informURLChange(); return true; } @@ -1921,10 +1438,10 @@ Eina_Bool ewk_view_reload(Evas_Object* ewkView) Eina_Bool ewk_view_reload_bypass_cache(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - priv->pageClient->page()->reload(/*reloadFromOrigin*/ true); - ewk_view_uri_update(ewkView); + impl->pageProxy->reload(/*reloadFromOrigin*/ true); + impl->informURLChange(); return true; } @@ -1932,9 +1449,9 @@ Eina_Bool ewk_view_reload_bypass_cache(Evas_Object* ewkView) Eina_Bool ewk_view_stop(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - priv->pageClient->page()->stopLoading(); + impl->pageProxy->stopLoading(); return true; } @@ -1942,169 +1459,57 @@ Eina_Bool ewk_view_stop(Evas_Object* ewkView) Ewk_Settings* ewk_view_settings_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); - return priv->settings.get(); + return impl->settings(); } -/** - * @internal - * Load was initiated for a resource in the view. - * - * Emits signal: "resource,request,new" with pointer to resource request. - */ -void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Resource* resource, Ewk_Url_Request* request) +const char* ewk_view_title_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - Ewk_Web_Resource_Request resourceRequest = {resource, request, 0}; - - // Keep the resource internally to reuse it later. - ewk_web_resource_ref(resource); - priv->loadingResourcesMap.add(resourceIdentifier, resource); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); - evas_object_smart_callback_call(ewkView, "resource,request,new", &resourceRequest); + return impl->title(); } /** * @internal - * Received a response to a resource load request in the view. + * Reports that the requested text was found. * - * Emits signal: "resource,request,response" with pointer to resource response. + * Emits signal: "text,found" with the number of matches. */ -void ewk_view_resource_load_response(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Response* response) +void ewk_view_text_found(Evas_Object* ewkView, unsigned int matchCount) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - if (!priv->loadingResourcesMap.contains(resourceIdentifier)) - return; - - Ewk_Web_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); - Ewk_Web_Resource_Load_Response resourceLoadResponse = {resource, response}; - evas_object_smart_callback_call(ewkView, "resource,request,response", &resourceLoadResponse); + evas_object_smart_callback_call(ewkView, "text,found", &matchCount); } -/** - * @internal - * Failed loading a resource in the view. - * - * Emits signal: "resource,request,finished" with pointer to the resource load error. - */ -void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Error* error) +double ewk_view_load_progress_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - if (!priv->loadingResourcesMap.contains(resourceIdentifier)) - return; + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1.0); - Ewk_Web_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); - Ewk_Web_Resource_Load_Error resourceLoadError = {resource, error}; - evas_object_smart_callback_call(ewkView, "resource,request,failed", &resourceLoadError); + return impl->pageProxy->estimatedProgress(); } -/** - * @internal - * Finished loading a resource in the view. - * - * Emits signal: "resource,request,finished" with pointer to the resource. - */ -void ewk_view_resource_load_finished(Evas_Object* ewkView, uint64_t resourceIdentifier) +Eina_Bool ewk_view_scale_set(Evas_Object* ewkView, double scaleFactor, int x, int y) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - if (!priv->loadingResourcesMap.contains(resourceIdentifier)) - return; +#if OS(TIZEN) + // FIXME + int centerX = x; + int centerY = y; + scaleFactor = impl->pageClient->adjustScaleWithViewport(scaleFactor); - Ewk_Web_Resource* resource = priv->loadingResourcesMap.take(resourceIdentifier); - evas_object_smart_callback_call(ewkView, "resource,request,finished", resource); + IntPoint scrollPosition = impl->pageClient->scrollPosition(); + double scaleDifference = scaleFactor / impl->pageClient->scaleFactor(); + int newScrollX = (scrollPosition.x() + centerX - smartData->view.x) * scaleDifference - (centerX - smartData->view.x); + int newScrollY = (scrollPosition.y() + centerY - smartData->view.y) * scaleDifference - (centerY - smartData->view.y); - ewk_web_resource_unref(resource); -} - -/** - * @internal - * Request was sent for a resource in the view. - * - * Emits signal: "resource,request,sent" with pointer to resource request and possible redirect response. - */ -void ewk_view_resource_request_sent(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Request* request, Ewk_Url_Response* redirectResponse) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - if (!priv->loadingResourcesMap.contains(resourceIdentifier)) - return; - - Ewk_Web_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); - Ewk_Web_Resource_Request resourceRequest = {resource, request, redirectResponse}; - - evas_object_smart_callback_call(ewkView, "resource,request,sent", &resourceRequest); -} - -const char* ewk_view_title_get(const Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); - - CString title = priv->pageClient->page()->pageTitle().utf8(); - eina_stringshare_replace(&priv->title, title.data()); - - return priv->title; -} - -/** - * @internal - * Reports that the requested text was found. - * - * Emits signal: "text,found" with the number of matches. - */ -void ewk_view_text_found(Evas_Object* ewkView, unsigned int matchCount) -{ - evas_object_smart_callback_call(ewkView, "text,found", &matchCount); -} - -/** - * @internal - * The view title was changed by the frame loader. - * - * Emits signal: "title,changed" with pointer to new title string. - */ -void ewk_view_title_changed(Evas_Object* ewkView, const char* title) -{ - evas_object_smart_callback_call(ewkView, "title,changed", const_cast(title)); -} - -double ewk_view_load_progress_get(const Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1.0); - - return priv->pageClient->page()->estimatedProgress(); -} - -Eina_Bool ewk_view_scale_set(Evas_Object* ewkView, double scaleFactor, int x, int y) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - -#if OS(TIZEN) - // FIXME - int centerX = x; - int centerY = y; - scaleFactor = priv->pageClient->adjustScaleWithViewport(scaleFactor); - - IntPoint scrollPosition = priv->pageClient->scrollPosition(); - double scaleDifference = scaleFactor / priv->pageClient->scaleFactor(); - int newScrollX = (scrollPosition.x() + centerX - smartData->view.x) * scaleDifference - (centerX - smartData->view.x); - int newScrollY = (scrollPosition.y() + centerY - smartData->view.y) * scaleDifference - (centerY - smartData->view.y); - - priv->pageClient->page()->scale(scaleFactor, IntPoint(newScrollX, newScrollY)); + impl->pageProxy->scale(scaleFactor, IntPoint(newScrollX, newScrollY)); #else - priv->pageClient->page()->scalePage(scaleFactor, IntPoint(x, y)); + impl->pageProxy->scalePage(scaleFactor, IntPoint(x, y)); #endif return true; } @@ -2112,21 +1517,21 @@ Eina_Bool ewk_view_scale_set(Evas_Object* ewkView, double scaleFactor, int x, in double ewk_view_scale_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1); #if OS(TIZEN) - return priv->pageClient->page()->scaleFactor(); + return impl->pageProxy->scaleFactor(); #else - return priv->pageClient->page()->pageScaleFactor(); + return impl->pageProxy->pageScaleFactor(); #endif } Eina_Bool ewk_view_device_pixel_ratio_set(Evas_Object* ewkView, float ratio) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - priv->pageClient->page()->setCustomDeviceScaleFactor(ratio); + impl->pageProxy->setCustomDeviceScaleFactor(ratio); return true; } @@ -2134,180 +1539,33 @@ Eina_Bool ewk_view_device_pixel_ratio_set(Evas_Object* ewkView, float ratio) float ewk_view_device_pixel_ratio_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1.0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1.0); - return priv->pageClient->page()->deviceScaleFactor(); + return impl->pageProxy->deviceScaleFactor(); } -#if ENABLE(TIZEN_WEBKIT2_SEPERATE_LOAD_PROGRESS) -void ewk_view_load_progress_started(Evas_Object* ewkView) -{ - evas_object_smart_callback_call(ewkView, "load,progress,started", 0); -} -#endif - -/** - * @internal - * Reports load progress changed. - * - * Emits signal: "load,progress" with pointer to a double from 0.0 to 1.0. - */ -void ewk_view_load_progress_changed(Evas_Object* ewkView, double progress) -{ - evas_object_smart_callback_call(ewkView, "load,progress", &progress); -} - -#if ENABLE(TIZEN_WEBKIT2_SEPERATE_LOAD_PROGRESS) -void ewk_view_load_progress_finished(Evas_Object* ewkView) -{ - evas_object_smart_callback_call(ewkView, "load,progress,finished", 0); -} -#endif - -#if ENABLE(WEB_INTENTS) -/** - * @internal - * The view received a new intent request. - * - * Emits signal: "intent,request,new" with pointer to a Ewk_Intent. - */ -void ewk_view_intent_request_new(Evas_Object* ewkView, const Ewk_Intent* ewkIntent) -{ - evas_object_smart_callback_call(ewkView, "intent,request,new", const_cast(ewkIntent)); -} -#endif - void ewk_view_theme_set(Evas_Object* ewkView, const char* path) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - if (!eina_stringshare_replace(&priv->theme, path)) - return; + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - priv->pageClient->page()->setThemePath(path); + impl->setThemePath(path); } const char* ewk_view_theme_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); - - return priv->theme; -} - -void ewk_view_cursor_set(Evas_Object* ewkView, const Cursor& cursor) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - const char* group = cursor.platformCursor(); - if (!group || group == priv->cursorGroup) - return; - - priv->cursorGroup = group; - - if (priv->cursorObject) - evas_object_del(priv->cursorObject); - priv->cursorObject = edje_object_add(smartData->base.evas); - - Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas); - if (!priv->theme || !edje_object_file_set(priv->cursorObject, priv->theme, group)) { - evas_object_del(priv->cursorObject); - priv->cursorObject = 0; - - ecore_evas_object_cursor_set(ecoreEvas, 0, 0, 0, 0); -#ifdef HAVE_ECORE_X - if (priv->isUsingEcoreX) - WebCore::applyFallbackCursor(ecoreEvas, group); -#endif - return; - } - - Evas_Coord width, height; - edje_object_size_min_get(priv->cursorObject, &width, &height); - if (width <= 0 || height <= 0) - edje_object_size_min_calc(priv->cursorObject, &width, &height); - if (width <= 0 || height <= 0) { - width = defaultCursorSize; - height = defaultCursorSize; - } - evas_object_resize(priv->cursorObject, width, height); - - const char* data; - int hotspotX = 0; - data = edje_object_data_get(priv->cursorObject, "hot.x"); - if (data) - hotspotX = atoi(data); - - int hotspotY = 0; - data = edje_object_data_get(priv->cursorObject, "hot.y"); - if (data) - hotspotY = atoi(data); - - ecore_evas_object_cursor_set(ecoreEvas, priv->cursorObject, EVAS_LAYER_MAX, hotspotX, hotspotY); -} - -void ewk_view_display(Evas_Object* ewkView, const IntRect& rect) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - if (!smartData->image) - return; - - evas_object_image_data_update_add(smartData->image, rect.x(), rect.y(), rect.width(), rect.height()); -} - -/** - * @internal - * A download for that view was cancelled. - * - * Emits signal: "download,cancelled" with pointer to a Ewk_Download_Job. - */ -void ewk_view_download_job_cancelled(Evas_Object* ewkView, Ewk_Download_Job* download) -{ - evas_object_smart_callback_call(ewkView, "download,cancelled", download); -} + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); -/** - * @internal - * A new download has been requested for that view. - * - * Emits signal: "download,request" with pointer to a Ewk_Download_Job. - */ -void ewk_view_download_job_requested(Evas_Object* ewkView, Ewk_Download_Job* download) -{ - evas_object_smart_callback_call(ewkView, "download,request", download); -} - -/** - * @internal - * A download for that view has failed. - * - * Emits signal: "download,failed" with pointer to a Ewk_Download_Job_Error. - */ -void ewk_view_download_job_failed(Evas_Object* ewkView, Ewk_Download_Job* download, Ewk_Web_Error* error) -{ - Ewk_Download_Job_Error downloadError = { download, error }; - evas_object_smart_callback_call(ewkView, "download,failed", &downloadError); -} - -/** - * @internal - * A download for that view finished successfully. - * - * Emits signal: "download,finished" with pointer to a Ewk_Download_Job. - */ -void ewk_view_download_job_finished(Evas_Object* ewkView, Ewk_Download_Job* download) -{ - evas_object_smart_callback_call(ewkView, "download,finished", download); + return impl->themePath(); } Eina_Bool ewk_view_back(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - WebPageProxy* page = priv->pageClient->page(); + WebPageProxy* page = impl->pageProxy.get(); if (page->canGoBack()) { page->goBack(); return true; @@ -2319,9 +1577,9 @@ Eina_Bool ewk_view_back(Evas_Object* ewkView) Eina_Bool ewk_view_forward(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - WebPageProxy* page = priv->pageClient->page(); + WebPageProxy* page = impl->pageProxy.get(); if (page->canGoForward()) { page->goForward(); return true; @@ -2334,11 +1592,11 @@ Eina_Bool ewk_view_intent_deliver(Evas_Object* ewkView, Ewk_Intent* intent) { #if ENABLE(WEB_INTENTS) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(intent, false); - WebPageProxy* page = priv->pageClient->page(); - page->deliverIntentToFrame(page->mainFrame(), toImpl(ewk_intent_WKIntentDataRef_get(intent))); + WebPageProxy* page = impl->pageProxy.get(); + page->deliverIntentToFrame(page->mainFrame(), intent->webIntentData()); return true; #else @@ -2349,54 +1607,36 @@ Eina_Bool ewk_view_intent_deliver(Evas_Object* ewkView, Ewk_Intent* intent) Eina_Bool ewk_view_back_possible(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - return priv->pageClient->page()->canGoBack(); + return impl->pageProxy->canGoBack(); } Eina_Bool ewk_view_forward_possible(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - return priv->pageClient->page()->canGoForward(); + return impl->pageProxy->canGoForward(); } -void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const IntSize& size) +Ewk_Back_Forward_List* ewk_view_back_forward_list_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - if (!imageData || !smartData->image) - return; - - evas_object_resize(smartData->image, size.width(), size.height()); - evas_object_image_size_set(smartData->image, size.width(), size.height()); - evas_object_image_data_copy_set(smartData->image, imageData); -} + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); -/** - * @internal - * Reports that a form request is about to be submitted. - * - * Emits signal: "form,submission,request" with pointer to Ewk_Form_Submission_Request. - */ -void ewk_view_form_submission_request_new(Evas_Object* ewkView, Ewk_Form_Submission_Request* request) -{ - evas_object_smart_callback_call(ewkView, "form,submission,request", request); + return impl->backForwardList.get(); } #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE) void ewk_view_text_change_in_textfield(Evas_Object* ewkView, const String& name, const String& value) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); if (!ewk_settings_form_candidate_data_enabled_get(ewk_view_settings_get(ewkView))) return; - Ecore_IMF_Context* imfContext = ewk_view_imf_context_get(ewkView); - if (!imfContext || ecore_imf_context_input_panel_state_get(imfContext) == ECORE_IMF_INPUT_PANEL_STATE_HIDE) - return; - if (value.isEmpty()) { if(smartData->api->formdata_candidate_is_showing(smartData)) smartData->api->formdata_candidate_hide(smartData); @@ -2421,279 +1661,107 @@ void ewk_view_text_change_in_textfield(Evas_Object* ewkView, const String& name, smartData->api->formdata_candidate_update_data(smartData, candidateList); - if (!smartData->api->formdata_candidate_is_showing(smartData)) - smartData->api->formdata_candidate_hide(smartData); - - IntRect inputFieldRect = priv->pageClient->focusedNodeRect(); + IntRect inputFieldRect = impl->transformToScene().mapRect(impl->pageClient->focusedNodeRect()); smartData->api->formdata_candidate_show(smartData, inputFieldRect.x(), inputFieldRect.y(), inputFieldRect.width(), inputFieldRect.height()); } void ewk_view_form_data_add(Evas_Object* ewkView, WKDictionaryRef& formData, bool isPasswordForm) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); if (!ewk_settings_autofill_password_form_enabled_get(ewk_view_settings_get(ewkView)) && !ewk_settings_form_candidate_data_enabled_get(ewk_view_settings_get(ewkView))) return; - ewk_context_form_data_add(ewk_view_context_get(ewkView), priv->uri, formData, isPasswordForm); + ewk_view_context_get(ewkView)->addFormData(impl->url(), formData, isPasswordForm); } void ewk_view_form_password_data_fill(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); if (!ewk_settings_autofill_password_form_enabled_get(ewk_view_settings_get(ewkView))) return; Vector > passwordFormData; - ewk_context_form_password_data_get(ewk_view_context_get(ewkView), priv->uri, passwordFormData); + ewk_view_context_get(ewkView)->passwordFormData(impl->url(), passwordFormData); if (!passwordFormData.size()) return; - String passwordFormAutofill = "try { function passwordFormAutofill() { var inputFields;"; + String passwordFormAutofill = String::fromUTF8("try { function passwordFormAutofill() { var inputFields;"); for (size_t i = 0; i < passwordFormData.size(); i++) { - passwordFormAutofill += String::format(" inputFields = document.getElementsByName(\"%s\");" - " for (var i = 0; i < inputFields.length; i++)" - " if (inputFields[i].tagName.toLowerCase() == \"input\" && (inputFields[i].type.toLowerCase() == \"text\" || inputFields[i].type.toLowerCase() == \"password\"))" - " inputFields[i].value = \"%s\";", - passwordFormData[i].first.utf8().data(), passwordFormData[i].second.utf8().data()); + passwordFormAutofill += String::fromUTF8(" inputFields = document.getElementsByName(\""); + passwordFormAutofill += passwordFormData[i].first; + passwordFormAutofill += String::fromUTF8("\");"); + passwordFormAutofill += String::fromUTF8(" for (var i = 0; i < inputFields.length; i++)"); + passwordFormAutofill += String::fromUTF8(" if (inputFields[i].tagName.toLowerCase() == \"input\" && (inputFields[i].type.toLowerCase() == \"text\" || inputFields[i].type.toLowerCase() == \"password\" || inputFields[i].type.toLowerCase() == \"email\"))"); + passwordFormAutofill += String::fromUTF8(" inputFields[i].value = \""); + passwordFormAutofill += passwordFormData[i].second; + passwordFormAutofill += String::fromUTF8("\";"); } - passwordFormAutofill += "} passwordFormAutofill(); } catch(e) { }"; + passwordFormAutofill += String::fromUTF8("} passwordFormAutofill(); } catch(e) { }"); ewk_view_script_execute(ewkView, passwordFormAutofill.utf8().data(), 0, 0); } void ewk_view_form_candidate_data_get(Evas_Object* ewkView, const String& name, Vector& candidates) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - ewk_context_form_candidate_data_get(ewk_view_context_get(ewkView), name, candidates); -} -#endif - -/** - * @internal - * Reports load failed with error information. - * - * Emits signal: "load,error" with pointer to Ewk_Web_Error. - */ -void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Web_Error* error) -{ - evas_object_smart_callback_call(ewkView, "load,error", const_cast(error)); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + ewk_view_context_get(ewkView)->candidateFormData(name, candidates); } - -/** - * @internal - * Reports load finished. - * - * Emits signal: "load,finished". - */ -void ewk_view_load_finished(Evas_Object* ewkView) -{ - ewk_view_uri_update(ewkView); - evas_object_smart_callback_call(ewkView, "load,finished", 0); - - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - -#if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION) - priv->pageClient->page()->setLoadingFinished(true); -#endif - -#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE) - ewk_view_form_password_data_fill(ewkView); #endif - if (!priv->suspendRequested) - return; - - priv->suspendRequested = false; - - if (!priv->suspendedPainting) { - priv->pageClient->page()->suspendPainting(); - priv->suspendedPainting = true; - } - if (!priv->suspendedResources) { - priv->pageClient->page()->suspendJavaScriptAndResource(); - priv->suspendedResources = true; - } -} - -/** - * @internal - * Reports view provisional load failed with error information. - * - * Emits signal: "load,provisional,failed" with pointer to Ewk_Web_Error. - */ -void ewk_view_load_provisional_failed(Evas_Object* ewkView, const Ewk_Web_Error* error) -{ - evas_object_smart_callback_call(ewkView, "load,provisional,failed", const_cast(error)); -} - -/** - * @internal - * Reports view received redirect for provisional load. - * - * Emits signal: "load,provisional,redirect". - */ -void ewk_view_load_provisional_redirect(Evas_Object* ewkView) -{ - ewk_view_uri_update(ewkView); - evas_object_smart_callback_call(ewkView, "load,provisional,redirect", 0); -} - -/** - * @internal - * Reports view provisional load started. - * - * Emits signal: "load,provisional,started". - */ -void ewk_view_load_provisional_started(Evas_Object* ewkView) -{ -#if OS(TIZEN) - evas_object_smart_callback_call(ewkView, "load,started", 0); -#endif - - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - -#if ENABLE(TIZEN_DRAG_SUPPORT) - if (priv->pageClient->isDragMode()) - priv->pageClient->setDragMode(false); -#endif - -#if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION) - priv->pageClient->page()->setLoadingFinished(false); -#endif - - // The main frame started provisional load, we should clear - // the loadingResources HashMap to start clean. - _ewk_view_priv_loading_resources_clear(priv->loadingResourcesMap); - - ewk_view_uri_update(ewkView); - evas_object_smart_callback_call(ewkView, "load,provisional,started", 0); -} - -/** - * @internal - * Reports that a navigation policy decision should be taken. - * - * Emits signal: "policy,decision,navigation". - */ -void ewk_view_navigation_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Policy_Decision* decision) -{ - evas_object_smart_callback_call(ewkView, "policy,decision,navigation", decision); -} - -/** - * @internal - * Reports that a new window policy decision should be taken. - * - * Emits signal: "policy,decision,new,window". - */ -void ewk_view_new_window_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Policy_Decision* decision) -{ - evas_object_smart_callback_call(ewkView, "policy,decision,new,window", decision); -} - Eina_Bool ewk_view_html_string_load(Evas_Object* ewkView, const char* html, const char* baseUrl, const char* unreachableUrl) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(html, false); if (unreachableUrl && *unreachableUrl) - priv->pageClient->page()->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl)); + impl->pageProxy->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl)); else - priv->pageClient->page()->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : ""); - ewk_view_uri_update(ewkView); + impl->pageProxy->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : ""); - return true; -} - -#if ENABLE(WEB_INTENTS_TAG) -/** - * @internal - * The view received a new intent service registration. - * - * Emits signal: "intent,service,register" with pointer to a Ewk_Intent_Service. - */ -void ewk_view_intent_service_register(Evas_Object* ewkView, const Ewk_Intent_Service* ewkIntentService) -{ - evas_object_smart_callback_call(ewkView, "intent,service,register", const_cast(ewkIntentService)); -} -#endif // ENABLE(WEB_INTENTS_TAG) + impl->informURLChange(); -WebPageProxy* ewk_view_page_get(const Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); - - return priv->pageClient->page(); + return true; } const char* ewk_view_custom_encoding_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); - - String customEncoding = priv->pageClient->page()->customTextEncodingName(); - if (customEncoding.isEmpty()) - return 0; - - eina_stringshare_replace(&priv->customEncoding, customEncoding.utf8().data()); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); - return priv->customEncoding; + return impl->customTextEncodingName(); } Eina_Bool ewk_view_custom_encoding_set(Evas_Object* ewkView, const char* encoding) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - if (eina_stringshare_replace(&priv->customEncoding, encoding)) - priv->pageClient->page()->setCustomTextEncodingName(encoding ? String::fromUTF8(encoding) : String()); + impl->setCustomTextEncodingName(encoding); return true; } #if OS(TIZEN) -Ewk_Context* ewk_view_context_get(const Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); - return priv->context; -} - // FIXME: It should be removed. WKPageRef ewk_view_WKPage_get(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); - return toAPI(priv->pageClient->page()); + return toAPI(impl->pageProxy.get()); } Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object* ewkView, Eina_Bool enabled) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - - enabled = !!enabled; - if (priv->areMouseEventsEnabled == enabled) - return true; + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - priv->areMouseEventsEnabled = enabled; - if (enabled) { - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_mouse_down, smartData); - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_mouse_up, smartData); - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_mouse_move, smartData); - } else { - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_mouse_down); - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_mouse_up); - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_mouse_move); - } + impl->setMouseEventsEnabled(!!enabled); return true; } @@ -2701,65 +1769,77 @@ Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object* ewkView, Eina_Bool enab Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + + return impl->mouseEventsEnabled(); +} + +Eina_Bool ewk_view_color_picker_color_set(Evas_Object* ewkView, int r, int g, int b, int a) +{ +#if ENABLE(INPUT_TYPE_COLOR) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - return priv->areMouseEventsEnabled; + return impl->setColorPickerColor(WebCore::Color(r, g, b, a)); +#else + return false; +#endif } static Eina_Bool _ewk_view_default_javascript_alert(Evas_Object* ewkView, const char* alertText, void* userData) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - return priv->javascriptPopup->alert(alertText); + return impl->javascriptPopup->alert(alertText); } static Eina_Bool _ewk_view_default_javascript_confirm(Evas_Object* ewkView, const char* message, void* userData) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - return priv->javascriptPopup->confirm(message); + return impl->javascriptPopup->confirm(message); } static Eina_Bool _ewk_view_default_javascript_prompt(Evas_Object* ewkView, const char* message, const char* defaultValue, void* userData) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - return priv->javascriptPopup->prompt(message, defaultValue); + return impl->javascriptPopup->prompt(message, defaultValue); } #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL) static Eina_Bool _ewk_view_default_before_unload_confirm_panel(Evas_Object* ewkView, const char* message, void* userData) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - return priv->javascriptPopup->beforeUnloadConfirmPanel(message); + return impl->javascriptPopup->beforeUnloadConfirmPanel(message); } #endif 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) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - return priv->openPanel->openPanel(ewkView, allow_multiple_files, accepted_mime_types, capture, priv); + return impl->openPanel->openPanel(ewkView, allow_multiple_files, accepted_mime_types, capture, impl); } #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL) 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) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - if (priv->popupPicker) - ewk_popup_picker_del(priv->popupPicker); + if (impl->popupPicker) + ewk_popup_picker_del(impl->popupPicker); #if ENABLE(TIZEN_MULTIPLE_SELECT) - priv->popupPicker = ewk_popup_picker_new(smartData->self, items, selectedIndex, false); + impl->popupPicker = ewk_popup_picker_new(smartData->self, items, selectedIndex, false); #else - priv->popupPicker = ewk_popup_picker_new(smartData->self, items, selectedIndex); + impl->popupPicker = ewk_popup_picker_new(smartData->self, items, selectedIndex); #endif return true; @@ -2768,12 +1848,12 @@ Eina_Bool _ewk_view_popup_menu_show(Ewk_View_Smart_Data* smartData, Eina_Rectang #if ENABLE(TIZEN_MULTIPLE_SELECT) 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) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - if (priv->popupPicker) - ewk_popup_picker_del(priv->popupPicker); + if (impl->popupPicker) + ewk_popup_picker_del(impl->popupPicker); - priv->popupPicker = ewk_popup_picker_new(smartData->self, items, 0, true); + impl->popupPicker = ewk_popup_picker_new(smartData->self, items, 0, true); return true; } @@ -2781,13 +1861,13 @@ Eina_Bool _ewk_view_multiple_popup_menu_show(Ewk_View_Smart_Data* smartData, Ein Eina_Bool _ewk_view_popup_menu_hide(Ewk_View_Smart_Data* smartData) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - if (!priv->popupPicker) + if (!impl->popupPicker) return false; - ewk_popup_picker_del(priv->popupPicker); - priv->popupPicker = 0; + ewk_popup_picker_del(impl->popupPicker); + impl->popupPicker = 0; return true; } @@ -2796,12 +1876,12 @@ Eina_Bool _ewk_view_popup_menu_update(Ewk_View_Smart_Data* smartData, Eina_Recta { // FIXME: The rect should be updated if it was changed - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - if (!priv->popupPicker) + if (!impl->popupPicker) return false; - ewk_popup_picker_update(smartData->self, priv->popupPicker, items, selectedIndex); + ewk_popup_picker_update(smartData->self, impl->popupPicker, items, selectedIndex); return true; } @@ -2810,9 +1890,9 @@ Eina_Bool _ewk_view_popup_menu_update(Ewk_View_Smart_Data* smartData, Eina_Recta #if ENABLE(TIZEN_INPUT_TAG_EXTENSION) static Eina_Bool _ewk_view_input_picker_show(Ewk_View_Smart_Data* smartData, Ewk_Input_Type inputType, const char* inputValue) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - priv->inputPicker->show(inputType, inputValue); + impl->inputPicker->show(inputType, inputValue); return true; } #endif @@ -2820,17 +1900,17 @@ static Eina_Bool _ewk_view_input_picker_show(Ewk_View_Smart_Data* smartData, Ewk #if ENABLE(TIZEN_DATALIST_ELEMENT) static Eina_Bool _ewk_view_data_list_show(Ewk_View_Smart_Data* smartData, Ewk_Input_Type inputType, Eina_List* optionList) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - priv->inputPicker->showDataList(inputType, optionList); + impl->inputPicker->showDataList(inputType, optionList); return true; } static Eina_Bool _ewk_view_data_list_hide(Ewk_View_Smart_Data* smartData, Ewk_Input_Type inputType) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - priv->inputPicker->hideDataList(inputType); + impl->inputPicker->hideDataList(inputType); return true; } #endif @@ -2838,17 +1918,17 @@ static Eina_Bool _ewk_view_data_list_hide(Ewk_View_Smart_Data* smartData, Ewk_In #if ENABLE(TIZEN_INPUT_COLOR_PICKER) static Eina_Bool _ewk_input_picker_color_request(Ewk_View_Smart_Data* smartData, int r, int g, int b, int a) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - priv->inputPicker->showColorPicker(r, g, b, a); + impl->inputPicker->showColorPicker(r, g, b, a); return true; } static Eina_Bool _ewk_input_picker_color_dismiss(Ewk_View_Smart_Data* smartData) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - priv->inputPicker->hideColorPicker(); + impl->inputPicker->hideColorPicker(); return true; } #endif @@ -2856,25 +1936,25 @@ static Eina_Bool _ewk_input_picker_color_dismiss(Ewk_View_Smart_Data* smartData) PageClientImpl* ewkViewGetPageClient(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); - return priv->pageClient.get(); + return impl->pageClient.get(); } double ewk_view_text_zoom_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 1); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 1); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 1); - return WKPageGetTextZoomFactor(toAPI(priv->pageClient->page())); + return WKPageGetTextZoomFactor(toAPI(impl->pageProxy.get())); } Eina_Bool ewk_view_text_zoom_set(Evas_Object* ewkView, double textZoomFactor) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - WKPageSetTextZoomFactor(toAPI(priv->pageClient->page()), textZoomFactor); + WKPageSetTextZoomFactor(toAPI(impl->pageProxy.get()), textZoomFactor); return true; } @@ -2882,80 +1962,76 @@ Eina_Bool ewk_view_text_zoom_set(Evas_Object* ewkView, double textZoomFactor) FocusRing* ewkViewGetFocusRing(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); - return priv->focusRing.get(); + return impl->focusRing.get(); } #endif Ewk_Frame_Ref ewk_view_main_frame_get(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); - return static_cast(WKPageGetMainFrame(toAPI(priv->pageClient->page()))); + return static_cast(WKPageGetMainFrame(toAPI(impl->pageProxy.get()))); } Ewk_Frame_Ref ewk_view_focused_frame_get(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); - return static_cast(WKPageGetFocusedFrame(toAPI(priv->pageClient->page()))); + return static_cast(WKPageGetFocusedFrame(toAPI(impl->pageProxy.get()))); } JSGlobalContextRef ewkViewGetJavascriptGlobalContext(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); - if (!priv->javascriptGlobalContext) - priv->javascriptGlobalContext = JSGlobalContextCreate(0); - return priv->javascriptGlobalContext; + if (!impl->javascriptGlobalContext) + impl->javascriptGlobalContext = JSGlobalContextCreate(0); + return impl->javascriptGlobalContext; } void ewkViewLoadCommitted(Evas_Object* ewkView) { #if ENABLE(TIZEN_GESTURE) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - priv->gestureClient->reset(); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + impl->gestureClient->reset(); +#endif +#if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) + if (impl->focusRing) + impl->focusRing->hide(); #endif #if ENABLE(TIZEN_ISF_PORT) - ewk_view_imf_context_hide(ewkView); + impl->inputMethodContext()->hideIMFContext(); +#endif +#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE) + if (smartData->api->formdata_candidate_is_showing(smartData)) + smartData->api->formdata_candidate_hide(smartData); #endif - ewk_view_uri_update(ewkView); + impl->informURLChange(); evas_object_smart_callback_call(ewkView, "load,committed", 0); } void ewkViewLoadError(Evas_Object* ewkView, WKErrorRef error) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - Ewk_Error* ewkError = ewkErrorCreate(error); - ewkErrorLoadErrorPage(ewkError, toAPI(priv->pageClient->page())); - evas_object_smart_callback_call(ewkView, "load,error", ewkError); - ewkErrorDelete(ewkError); -} - -void ewkViewSetTitleAndURL(Evas_Object* ewkView, const char* title, const char* url) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - if (title && eina_stringshare_replace(&priv->title, title)) - evas_object_smart_callback_call(ewkView, "title,changed", static_cast(const_cast(priv->title))); - if (url && eina_stringshare_replace(&priv->uri, url)) - evas_object_smart_callback_call(ewkView, "uri,changed", static_cast(const_cast(priv->uri))); + OwnPtr ewkError = Ewk_Error::create(error); + ewk_error_load_error_page(ewkError.get(), toAPI(impl->pageProxy.get())); + evas_object_smart_callback_call(ewkView, "load,error", ewkError.get()); } void ewkViewDidFirstVisuallyNonEmptyLayout(Evas_Object* ewkView) { #if ENABLE(TIZEN_GESTURE) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - priv->gestureClient->reset(); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + impl->gestureClient->reset(); #endif evas_object_smart_callback_call(ewkView, "load,nonemptylayout,finished", 0); } @@ -2963,13 +2039,13 @@ void ewkViewDidFirstVisuallyNonEmptyLayout(Evas_Object* ewkView) void ewkViewDidReceiveAuthenticationChallenge(Evas_Object* ewkView, Ewk_Auth_Challenge* authChallenge) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - if (priv->authChallenge) - ewkAuthChallengeDelete(priv->authChallenge); - priv->authChallenge = authChallenge; + if (impl->authChallenge) + ewkAuthChallengeDelete(impl->authChallenge); + impl->authChallenge = authChallenge; - evas_object_smart_callback_call(ewkView, "authentication,challenge", priv->authChallenge); + evas_object_smart_callback_call(ewkView, "authentication,challenge", impl->authChallenge); } void ewk_view_process_crashed(Evas_Object* ewkView) @@ -2982,22 +2058,25 @@ void ewk_view_process_crashed(Evas_Object* ewkView) } #if ENABLE(TIZEN_SQL_DATABASE) -unsigned long long ewkViewExceededDatabaseQuota(Evas_Object* ewkView, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage) +bool ewkViewExceededDatabaseQuota(Evas_Object* ewkView, WKSecurityOriginRef origin, WKStringRef databaseName, unsigned long long expectedUsage) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, currentQuota); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, currentQuota); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - TIZEN_LOGI("database,quota,exceeded"); - uint64_t defaultQuota = ewkContextGetDatabaseQuota(priv->context); - if (defaultQuota >= expectedUsage + currentQuota) - return defaultQuota; + if (!impl->exceededDatabaseQuotaContext || !impl->exceededDatabaseQuotaContext->exceededDatabaseQuotaCallback) + return false; - if (priv->exceededDatabaseQuota) - ewkContextDeleteExceededQuota(priv->exceededDatabaseQuota); - priv->exceededDatabaseQuota = ewkContextCreateExceededQuota(origin, databaseName, displayName, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage); - evas_object_smart_callback_call(ewkView, "database,quota,exceeded", priv->exceededDatabaseQuota); + TIZEN_LOGI("No error in prameter. Request to display user confirm popup. expectedUsage(%llu)", expectedUsage); + impl->isWaitingForExceededQuotaPopupReply = true; + if (impl->exceededQuotaOrigin) + deleteSecurityOrigin(impl->exceededQuotaOrigin); + impl->exceededQuotaOrigin = createSecurityOrigin(origin); - return ewkContextGetNewQuotaForExceededQuota(priv->context, priv->exceededDatabaseQuota); + int length = WKStringGetMaximumUTF8CStringSize(databaseName); + OwnArrayPtr databaseNameBuffer = adoptArrayPtr(new char[length]); + WKStringGetUTF8CString(databaseName, databaseNameBuffer.get(), length); + + return impl->exceededDatabaseQuotaContext->exceededDatabaseQuotaCallback(ewkView, impl->exceededQuotaOrigin, databaseNameBuffer.get(), expectedUsage, impl->exceededDatabaseQuotaContext->userData) == EINA_TRUE; } #endif @@ -3011,40 +2090,40 @@ void ewkViewCancelNotification(Evas_Object* ewkView, uint64_t notificationID) void ewkViewRequestNotificationPermission(Evas_Object* ewkView, Ewk_Notification_Permission_Request* notificationPermissionRequest) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); TIZEN_LOGI("notification,permission,request"); - priv->notificationPermissionRequests = eina_list_append(priv->notificationPermissionRequests, notificationPermissionRequest); + impl->notificationPermissionRequests = eina_list_append(impl->notificationPermissionRequests, notificationPermissionRequest); evas_object_smart_callback_call(ewkView, "notification,permission,request", notificationPermissionRequest); } void ewkViewShowNotification(Evas_Object* ewkView, Ewk_Notification* notification) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); TIZEN_LOGI("notification,show"); Eina_List* listIterator=0; void* data=0; const char* replaceID = ewkNotificationGetReplaceID(notification); if(strlen(replaceID)) { - EINA_LIST_FOREACH(priv->notifications, listIterator, data) { + EINA_LIST_FOREACH(impl->notifications, listIterator, data) { Ewk_Notification* notificationForReplace = static_cast(data); if(!strcmp(ewkNotificationGetReplaceID(notificationForReplace), replaceID)) ewkViewCancelNotification(ewkView, ewk_notification_id_get(notificationForReplace)); } } - priv->notifications = eina_list_append(priv->notifications, notification); + impl->notifications = eina_list_append(impl->notifications, notification); evas_object_smart_callback_call(ewkView, "notification,show", notification); } void ewkViewDeleteNotificationPermissionRequest(Evas_Object* ewkView, Ewk_Notification_Permission_Request* ewkNotificationPermissionRequest) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - priv->notificationPermissionRequests = eina_list_remove(priv->notificationPermissionRequests, ewkNotificationPermissionRequest); + impl->notificationPermissionRequests = eina_list_remove(impl->notificationPermissionRequests, ewkNotificationPermissionRequest); } #endif @@ -3163,18 +2242,18 @@ bool ewkViewGetStandaloneStatus(Evas_Object* ewkView) void ewkViewRequestUserMediaPermission(Evas_Object* ewkView, Ewk_User_Media_Permission_Request* userMediaPermission) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - priv->userMediaPermissionRequests = eina_list_append(priv->userMediaPermissionRequests, userMediaPermission); + impl->userMediaPermissionRequests = eina_list_append(impl->userMediaPermissionRequests, userMediaPermission); evas_object_smart_callback_call(ewkView, "usermedia,permission,request", userMediaPermission); } void ewkViewDeleteUserMediaPermissionRequest(Evas_Object* ewkView, Ewk_User_Media_Permission_Request* permission) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - priv->userMediaPermissionRequests = eina_list_remove(priv->userMediaPermissionRequests, permission); + impl->userMediaPermissionRequests = eina_list_remove(impl->userMediaPermissionRequests, permission); } #endif @@ -3197,10 +2276,10 @@ void ewkViewProcessJSBridgePlugin(Evas_Object* ewkView, WKStringRef request, WKS void ewkViewRequestCertificateConfirm(Evas_Object* ewkView, Ewk_Certificate_Policy_Decision* certificatePolicyDecision) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd); - EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv); - if (priv->certificatePolicyDecision) - ewkCertificatePolicyDecisionDelete(priv->certificatePolicyDecision); - priv->certificatePolicyDecision = certificatePolicyDecision; + EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl); + if (impl->certificatePolicyDecision) + ewkCertificatePolicyDecisionDelete(impl->certificatePolicyDecision); + impl->certificatePolicyDecision = certificatePolicyDecision; evas_object_smart_callback_call(ewkView, "request,certificate,confirm", certificatePolicyDecision); } @@ -3216,44 +2295,39 @@ void ewkViewCustomContextMenuItemSelected(Evas_Object* ewkView, Ewk_Context_Menu evas_object_smart_callback_call(ewkView, "contextmenu,selected", static_cast(item)); } -void ewkViewClosePage(Evas_Object* ewkView) -{ - evas_object_smart_callback_call(ewkView, "close,window", 0); -} - #if ENABLE(TIZEN_GEOLOCATION) void ewkViewRequestGeolocationPermission(Evas_Object* ewkView, Ewk_Geolocation_Permission_Request* geolocationPermissionRequest) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); TIZEN_LOGI("geolocation,permission,request"); - priv->geolocationPermissionRequests = eina_list_append(priv->geolocationPermissionRequests, geolocationPermissionRequest); + impl->geolocationPermissionRequests = eina_list_append(impl->geolocationPermissionRequests, geolocationPermissionRequest); evas_object_smart_callback_call(ewkView, "geolocation,permission,request", geolocationPermissionRequest); } void ewkViewDeleteGeolocationPermission(Evas_Object* ewkView, Ewk_Geolocation_Permission_Request* geolocationPermissionRequest) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - priv->geolocationPermissionRequests = eina_list_remove(priv->geolocationPermissionRequests, geolocationPermissionRequest); + impl->geolocationPermissionRequests = eina_list_remove(impl->geolocationPermissionRequests, geolocationPermissionRequest); } void ewkViewSetGeolocation(Evas_Object* ewkView, Ewk_Geolocation* geolocation) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - priv->geolocation = geolocation; + impl->geolocation = geolocation; } Ewk_Geolocation* ewkViewGetGeolocation(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); - return priv->geolocation; + return impl->geolocation; } bool ewkViewIsValidLocationService(Evas_Object* ewkView) @@ -3266,18 +2340,6 @@ bool ewkViewIsValidLocationService(Evas_Object* ewkView) } #endif -WKPageRef ewkViewCreateNewPage(Evas_Object* ewkView) -{ - Evas_Object* createdEwkView = 0; - - evas_object_smart_callback_call(ewkView, "create,window", &createdEwkView); - - if (!createdEwkView) - return 0; - - return static_cast(WKRetain(toAPI(ewk_view_page_get(createdEwkView)))); -} - void ewkViewFormSubmit(Evas_Object* ewkView, Ewk_Form_Data* formData) { evas_object_smart_callback_call(ewkView, "form,submit", formData); @@ -3286,45 +2348,45 @@ void ewkViewFormSubmit(Evas_Object* ewkView, Ewk_Form_Data* formData) void ewkViewPolicyNavigationDecide(Evas_Object* ewkView, Ewk_Policy_Decision* policyDecision) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd); - EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv); - if (priv->policyDecision) - ewkPolicyDecisionDelete(priv->policyDecision); - priv->policyDecision = policyDecision; + EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl); + if (impl->policyDecision) + ewkPolicyDecisionDelete(impl->policyDecision); + impl->policyDecision = policyDecision; - evas_object_smart_callback_call(ewkView, "policy,navigation,decide", priv->policyDecision); + evas_object_smart_callback_call(ewkView, "policy,navigation,decide", impl->policyDecision); } void ewkViewPolicyNewWindowDecide(Evas_Object* ewkView, Ewk_Policy_Decision* policyDecision) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd); - EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv); - if (priv->policyDecision) - ewkPolicyDecisionDelete(priv->policyDecision); - priv->policyDecision = policyDecision; + EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl); + if (impl->policyDecision) + ewkPolicyDecisionDelete(impl->policyDecision); + impl->policyDecision = policyDecision; - evas_object_smart_callback_call(ewkView, "policy,newwindow,decide", priv->policyDecision); + evas_object_smart_callback_call(ewkView, "policy,newwindow,decide", impl->policyDecision); } void ewkViewPolicyResponseDecide(Evas_Object* ewkView, Ewk_Policy_Decision* policyDecision) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd); - EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv); - if (priv->policyDecision) - ewkPolicyDecisionDelete(priv->policyDecision); - priv->policyDecision = policyDecision; + EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl); + if (impl->policyDecision) + ewkPolicyDecisionDelete(impl->policyDecision); + impl->policyDecision = policyDecision; - evas_object_smart_callback_call(ewkView, "policy,response,decide", priv->policyDecision); + evas_object_smart_callback_call(ewkView, "policy,response,decide", impl->policyDecision); } void ewkViewSendScrollEvent(Evas_Object* ewkView, int deltaX, int deltaY) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - IntPoint scrollPosition = priv->pageClient->scrollPosition(); - IntSize contentsSize = priv->pageClient->page()->contentsSize(); + IntPoint scrollPosition = impl->pageClient->scrollPosition(); + IntSize contentsSize = impl->pageProxy->contentsSize(); #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) - contentsSize.scale(priv->pageClient->scaleFactor()); + contentsSize.scale(impl->pageClient->scaleFactor()); #endif // some website's contents size is smaller than view size, @@ -3352,51 +2414,51 @@ void ewkViewSendScrollEvent(Evas_Object* ewkView, int deltaX, int deltaY) void ewkViewSendEdgeEvent(Evas_Object* ewkView, const IntPoint& scrollPosition, int deltaX, int deltaY) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - IntSize contentsSize = priv->pageClient->page()->contentsSize(); + IntSize contentsSize = impl->pageProxy->contentsSize(); #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) - contentsSize.scale(priv->pageClient->scaleFactor()); + contentsSize.scale(impl->pageClient->scaleFactor()); #endif int maxScrollY = contentsSize.height() - smartData->view.h; - if (!priv->isVerticalEdge) { + if (!impl->isVerticalEdge) { if (deltaY < 0 && (scrollPosition.y() + deltaY) <= 0) { evas_object_smart_callback_call(ewkView, "edge,top", NULL); - priv->isVerticalEdge = true; + impl->isVerticalEdge = true; } else if (deltaY > 0 && (scrollPosition.y() + deltaY) >= maxScrollY) { evas_object_smart_callback_call(ewkView, "edge,bottom", NULL); - priv->isVerticalEdge = true; + impl->isVerticalEdge = true; } } else { if (maxScrollY && ((scrollPosition.y() == 0 && deltaY > 0) || (scrollPosition.y() == maxScrollY && deltaY < 0))) - priv->isVerticalEdge = false; + impl->isVerticalEdge = false; } int maxScrollX = contentsSize.width() - smartData->view.w; - if (!priv->isHorizontalEdge) { + if (!impl->isHorizontalEdge) { if (deltaX < 0 && (scrollPosition.x() + deltaX) <= 0) { evas_object_smart_callback_call(ewkView, "edge,left", NULL); - priv->isHorizontalEdge = true; + impl->isHorizontalEdge = true; } else if (deltaX > 0 && (scrollPosition.x() + deltaX) >= maxScrollX) { evas_object_smart_callback_call(ewkView, "edge,right", NULL); - priv->isHorizontalEdge = true; + impl->isHorizontalEdge = true; } } else { if (maxScrollX && ((scrollPosition.x() == 0 && deltaX > 0) || (scrollPosition.x() == maxScrollX && deltaX < 0))) - priv->isHorizontalEdge = false; + impl->isHorizontalEdge = false; } } void ewkViewClearEdges(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - priv->isVerticalEdge = false; - priv->isHorizontalEdge = false; + impl->isVerticalEdge = false; + impl->isHorizontalEdge = false; } void ewk_view_scale_range_get(Evas_Object* ewkView, double* minimumScale, double* maximumScale) @@ -3420,19 +2482,19 @@ void ewk_view_scale_range_get(Evas_Object* ewkView, double* minimumScale, double bool ewk_view_focused_node_adjust(Evas_Object* ewkView, Eina_Bool adjustForExternalKeyboard) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - double scaleFactor = priv->pageClient->scaleFactor(); - IntSize contentsSize = priv->pageClient->page()->contentsSize(); + double scaleFactor = impl->pageClient->scaleFactor(); + IntSize contentsSize = impl->pageProxy->contentsSize(); double newScaleFactor = scaleFactor; // Readable zoom value is dependent on device DPI - if (scaleFactor < priv->pageClient->page()->deviceScaleFactor() - && priv->pageClient->viewportConstraints().userScalable) - newScaleFactor = priv->pageClient->page()->deviceScaleFactor(); + if (scaleFactor < impl->pageProxy->deviceScaleFactor() + && impl->pageClient->viewportConstraints().userScalable) + newScaleFactor = impl->pageProxy->deviceScaleFactor(); // Readable zoom value should be inside of viewport scale range - newScaleFactor = priv->pageClient->adjustScaleWithViewport(newScaleFactor); + newScaleFactor = impl->pageClient->adjustScaleWithViewport(newScaleFactor); // scale contents' size with new scale factor #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) @@ -3460,22 +2522,21 @@ bool ewk_view_focused_node_adjust(Evas_Object* ewkView, Eina_Bool adjustForExter // 2. external keyboard is not connected(if adjustForExternalKeyboard is true) // 3. imfContext is null(if adjustForExternalKeyboard is false) // 4. input panel state is hidden(if adjustForExternalKeyboard is false) - if ((!(static_cast(priv->pageClient.get()))->isViewFocused() + if ((!(static_cast(impl->pageClient.get()))->isViewFocused() || (adjustForExternalKeyboard && !isExternalKeyboardConnected) - || (!adjustForExternalKeyboard && !priv->imfContext) - || (!adjustForExternalKeyboard && ecore_imf_context_input_panel_state_get(priv->imfContext) == ECORE_IMF_INPUT_PANEL_STATE_HIDE)) + || (!adjustForExternalKeyboard && !impl->inputMethodContext()) + || (!adjustForExternalKeyboard && !impl->inputMethodContext()->isShow())) #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD) - && !(priv->pageClient->isClipboardWindowOpened()) + && !(impl->pageClient->isClipboardWindowOpened()) #endif ) return false; #endif - IntSize visibleSize(smartData->view.w, smartData->view.h); // caret position can be outside of visible rect. // we need to consider it. - IntRect selectionRect = priv->pageClient->page()->getSelectionRect(true); - IntRect focusedNodeRect = priv->pageClient->focusedNodeRect(); + IntRect selectionRect = impl->pageProxy->getSelectionRect(true); + IntRect focusedNodeRect = impl->pageClient->focusedNodeRect(); #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) selectionRect.scale(newScaleFactor); focusedNodeRect.scale(newScaleFactor); @@ -3486,21 +2547,29 @@ bool ewk_view_focused_node_adjust(Evas_Object* ewkView, Eina_Bool adjustForExter if (selectionRect.isEmpty()) return false; - // set paddings - IntPoint scrollPosition(selectionRect.x() - visibleSize.width() / 3, selectionRect.y() - visibleSize.height() / 3); - // If both input field's position x and selection rect can be displayed together, - // adjust scroll position to input field's position x. - if (!focusedNodeRect.isEmpty() - && selectionRect.x() - focusedNodeRect.x() < visibleSize.width() * 4 / 5) - scrollPosition.setX(focusedNodeRect.x()); + IntRect visibleRect = impl->pageClient->visibleContentRect(); + IntPoint scrollPosition = visibleRect.location(); + // Do not adjust scroll position if content is userscalable or selection rect (caret) is visible after scaling + if (impl->pageClient->userScalable() || !visibleRect.contains(selectionRect)) { + // set paddings + scrollPosition = IntPoint(selectionRect.x() - visibleRect.width() / 3, selectionRect.y() - visibleRect.height() / 3); + // If both input field's position x and selection rect can be displayed together, + // adjust scroll position to input field's position x. + if (!focusedNodeRect.isEmpty() && selectionRect.x() - focusedNodeRect.x() < visibleRect.width() * 4 / 5) + scrollPosition.setX(focusedNodeRect.x()); + } + +#if ENABLE(TIZEN_DLOG_SUPPORT) + TIZEN_LOGI("scroll position: [%d, %d], scale factor: [%.2f]", scrollPosition.x(), scrollPosition.y(), newScaleFactor); +#endif #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) - priv->pageClient->setVisibleContentRect(IntRect(scrollPosition, ewk_view_size_get(ewkView)), newScaleFactor); + impl->pageClient->setVisibleContentRect(IntRect(scrollPosition, impl->size()), newScaleFactor); #else if (newScaleFactor != scaleFactor) - priv->pageClient->page()->scalePage(newScaleFactor, scrollPosition); + impl->pageProxy->scalePage(newScaleFactor, scrollPosition); else - priv->pageClient->page()->scrollMainFrameTo(scrollPosition); + impl->pageProxy->scrollMainFrameTo(scrollPosition); #endif evas_object_move(smartData->image, smartData->view.x, smartData->view.y); return true; @@ -3511,7 +2580,7 @@ bool ewk_view_focused_node_adjust(Evas_Object* ewkView, Eina_Bool adjustForExter static Eina_Bool _ewk_view_composite(void* data) { Ewk_View_Smart_Data* smartData = static_cast(data); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false) + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); if (!evas_object_visible_get(smartData->image)) return ECORE_CALLBACK_CANCEL; @@ -3529,14 +2598,15 @@ static Eina_Bool _ewk_view_composite(void* data) cairo_fill(context.get()); cairo_restore(context.get()); - priv->pageClient->drawContents(context.get()); + impl->pageClient->drawContents(context.get()); evas_object_image_data_set(smartData->image, pixels); evas_object_image_data_update_add(smartData->image, 0, 0, ow, oh); - ewkViewFrameRendered(smartData->self); + if (impl->pageClient->notifiedNonemptyLayout()) + ewkViewFrameRendered(smartData->self); - priv->compositionAnimator = 0; + impl->compositionAnimator = 0; return ECORE_CALLBACK_CANCEL; } @@ -3548,11 +2618,11 @@ void ewk_view_mark_for_sync(Evas_Object* ewkView) EINA_SAFETY_ON_NULL_RETURN(smartData->image); #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION) - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); if (!ewk_view_is_opengl_backend(ewkView)) { - if (!priv->compositionAnimator) - priv->compositionAnimator = ecore_animator_add(_ewk_view_composite, smartData); + if (!impl->compositionAnimator) + impl->compositionAnimator = ecore_animator_add(_ewk_view_composite, smartData); return; } #endif @@ -3564,14 +2634,14 @@ static void on_pixels_for_accelerated_compositing(void* data, Evas_Object* obj) { Evas_Object* ewkView = static_cast(data); EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - priv->pageClient->drawContents(); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + impl->pageClient->drawContents(); } bool ewk_view_image_native_surface_set(Evas_Object* ewkView, Evas_Native_Surface* nativeSurface) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); if (!smartData->image) return false; @@ -3586,35 +2656,35 @@ bool ewk_view_image_native_surface_set(Evas_Object* ewkView, Evas_Native_Surface void _ewk_view_suspend_painting(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - if (!priv->suspendedPainting) { - priv->pageClient->page()->suspendPainting(); - priv->suspendedPainting = true; + if (!impl->suspendedPainting) { + impl->pageProxy->suspendPainting(); + impl->suspendedPainting = true; } } void _ewk_view_resume_painting(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - if (priv->suspendedPainting) { - priv->pageClient->page()->resumePainting(); - priv->suspendedPainting = false; + if (impl->suspendedPainting) { + impl->pageProxy->resumePainting(); + impl->suspendedPainting = false; } } void ewk_view_suspend(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - if (priv->pageClient->page()->estimatedProgress() < 1.0) { - priv->suspendRequested = true; + if (impl->pageProxy->estimatedProgress() < 1.0) { + impl->suspendRequested = true; return; } - priv->suspendRequested = false; + impl->suspendRequested = false; _ewk_view_suspend_painting(ewkView); @@ -3628,23 +2698,24 @@ void ewk_view_suspend(Evas_Object* ewkView) // will be suspended again. // Multiple suspend of ActiveDOMObject makes unintended suspend/resume status of // the ActiveDOMObject. - if (!priv->suspendedResources && !priv->isWaitingForJavaScriptPopupReply) { - priv->pageClient->page()->suspendJavaScriptAndResource(); - priv->suspendedResources = true; + if (!impl->suspendedResources && (!impl->isWaitingForJavaScriptPopupReply || !impl->isWaitingForApplicationCachePermission || !impl->isWaitingForExceededQuotaPopupReply)) { + impl->pageProxy->suspendAnimations(); + impl->pageProxy->suspendJavaScriptAndResource(); + impl->suspendedResources = true; } #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME) - priv->pageClient->page()->suspendPlugin(); + impl->pageProxy->suspendPlugin(); #endif } void ewk_view_resume(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - if (priv->suspendRequested) { - priv->suspendRequested = false; + if (impl->suspendRequested) { + impl->suspendRequested = false; return; } @@ -3660,20 +2731,21 @@ void ewk_view_resume(Evas_Object* ewkView) // will be suspended again. // Multiple suspend of ActiveDOMObject makes unintended suspend/resume status of // the ActiveDOMObject. - if (priv->suspendedResources && !priv->isWaitingForJavaScriptPopupReply) { - priv->pageClient->page()->resumeJavaScriptAndResource(); - priv->suspendedResources = false; + if (impl->suspendedResources && (!impl->isWaitingForJavaScriptPopupReply || !impl->isWaitingForApplicationCachePermission || !impl->isWaitingForExceededQuotaPopupReply)) { + impl->pageProxy->resumeAnimations(); + impl->pageProxy->resumeJavaScriptAndResource(); + impl->suspendedResources = false; } #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME) - priv->pageClient->page()->resumePlugin(); + impl->pageProxy->resumePlugin(); #endif } Eina_Bool ewk_view_url_request_set(Evas_Object* ewkView, const char* url, Ewk_Http_Method method, Eina_Hash* headers, const char* body) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(url, false); ResourceRequest request(String::fromUTF8(url)); @@ -3714,7 +2786,7 @@ Eina_Bool ewk_view_url_request_set(Evas_Object* ewkView, const char* url, Ewk_Ht request.setHTTPBody(FormData::create(body)); WKRetainPtr urlRequest(AdoptWK,toAPI(WebURLRequest::create(request).leakRef())); - WKPageLoadURLRequest(toAPI(priv->pageClient->page()), urlRequest.get()); + WKPageLoadURLRequest(toAPI(impl->pageProxy.get()), urlRequest.get()); return true; } @@ -3722,10 +2794,10 @@ Eina_Bool ewk_view_url_request_set(Evas_Object* ewkView, const char* url, Ewk_Ht Eina_Bool ewk_view_plain_text_set(Evas_Object* ewkView, const char* plainText) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); WKRetainPtr plainTextRef(AdoptWK, WKStringCreateWithUTF8CString(plainText)); - WKPageLoadPlainTextString(toAPI(priv->pageClient->page()), plainTextRef.get()); + WKPageLoadPlainTextString(toAPI(impl->pageProxy.get()), plainTextRef.get()); return true; } @@ -3733,7 +2805,7 @@ Eina_Bool ewk_view_plain_text_set(Evas_Object* ewkView, const char* plainText) Eina_Bool ewk_view_contents_set(Evas_Object* ewkView, const char* contents, size_t contentsSize, char* mimeType, char* encoding, char* baseUri) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(contents, false); if (contentsSize == 0) @@ -3758,7 +2830,7 @@ Eina_Bool ewk_view_contents_set(Evas_Object* ewkView, const char* contents, size baseUriString = String::fromUTF8("about:blank"); WKRetainPtr contentsRef(AdoptWK, WKDataCreate(reinterpret_cast(contents), contentsSize)); - priv->pageClient->page()->loadContentsbyMimeType(toImpl(contentsRef.get()), mimeTypeString, encodingString, baseUriString); + impl->pageProxy->loadContentsbyMimeType(toImpl(contentsRef.get()), mimeTypeString, encodingString, baseUriString); return true; } @@ -3766,12 +2838,12 @@ Eina_Bool ewk_view_contents_set(Evas_Object* ewkView, const char* contents, size Eina_Bool ewk_view_html_contents_set(Evas_Object* ewkView, const char* html, const char* baseUri) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); WKRetainPtr htmlString(AdoptWK, WKStringCreateWithUTF8CString(html)); WKRetainPtr baseURL(AdoptWK, WKURLCreateWithUTF8CString(baseUri)); - WKPageLoadHTMLString(toAPI(priv->pageClient->page()), htmlString.get(), baseURL.get()); + WKPageLoadHTMLString(toAPI(impl->pageProxy.get()), htmlString.get(), baseURL.get()); return true; } @@ -3779,13 +2851,11 @@ Eina_Bool ewk_view_html_contents_set(Evas_Object* ewkView, const char* html, con Eina_Bool ewk_view_page_visibility_state_set(Evas_Object* ewkView, Ewk_Page_Visibility_State pageVisibilityState, Eina_Bool initialState) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); TIZEN_LOGI("initialState (%d)", initialState); #if ENABLE(TIZEN_PAGE_VISIBILITY_API) - WKPageSetPageVisibility(toAPI(priv->pageClient->page()), static_cast(pageVisibilityState), initialState); - + WKPageSetPageVisibility(toAPI(impl->pageProxy.get()), static_cast(pageVisibilityState), initialState); return true; #else return false; @@ -3797,12 +2867,12 @@ Eina_Bool ewk_view_user_agent_set(Evas_Object* ewkView, const char* userAgent) EINA_SAFETY_ON_NULL_RETURN_VAL(userAgent, false); EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - eina_stringshare_replace(&priv->userAgent, userAgent); + impl->userAgent = userAgent; WKRetainPtr userAgentString(AdoptWK, WKStringCreateWithUTF8CString(userAgent)); - WKPageSetCustomUserAgent(toAPI(priv->pageClient->page()), userAgentString.get()); + WKPageSetCustomUserAgent(toAPI(impl->pageProxy.get()), userAgentString.get()); return true; } @@ -3810,29 +2880,29 @@ Eina_Bool ewk_view_user_agent_set(Evas_Object* ewkView, const char* userAgent) const char* ewk_view_user_agent_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); - if (!priv->userAgent) { - WKRetainPtr userAgentString(AdoptWK, WKPageCopyUserAgent(toAPI(priv->pageClient->page()))); + if (!impl->userAgent) { + WKRetainPtr userAgentString(AdoptWK, WKPageCopyUserAgent(toAPI(impl->pageProxy.get()))); int length = WKStringGetMaximumUTF8CStringSize(userAgentString.get()); OwnArrayPtr buffer = adoptArrayPtr(new char[length]); WKStringGetUTF8CString(userAgentString.get(), buffer.get(), length); - eina_stringshare_replace(&priv->userAgent, buffer.get()); + impl->userAgent = buffer.get(); } - return priv->userAgent; + return impl->userAgent; } Eina_Bool ewk_view_custom_header_add(const Evas_Object* ewkView, const char* name, const char* value) { #if ENABLE(TIZEN_CUSTOM_HEADERS) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); WKRetainPtr customHeaderName(AdoptWK, WKStringCreateWithUTF8CString(name)); WKRetainPtr customHeaderValue(AdoptWK, WKStringCreateWithUTF8CString(value)); - WKPageAddCustomHeader(toAPI(priv->pageClient->page()), customHeaderName.get(), customHeaderValue.get()); + WKPageAddCustomHeader(toAPI(impl->pageProxy.get()), customHeaderName.get(), customHeaderValue.get()); return true; #else ERR("TIZEN_CUSTOM_HEADERS not enabled!"); @@ -3844,11 +2914,11 @@ Eina_Bool ewk_view_custom_header_remove(const Evas_Object* ewkView, const char* { #if ENABLE(TIZEN_CUSTOM_HEADERS) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); WKRetainPtr customHeaderName(AdoptWK, WKStringCreateWithUTF8CString(name)); - WKPageRemoveCustomHeader(toAPI(priv->pageClient->page()), customHeaderName.get()); + WKPageRemoveCustomHeader(toAPI(impl->pageProxy.get()), customHeaderName.get()); return true; #else ERR("TIZEN_CUSTOM_HEADERS not enabled!"); @@ -3860,9 +2930,9 @@ Eina_Bool ewk_view_custom_header_clear(const Evas_Object* ewkView) { #if ENABLE(TIZEN_CUSTOM_HEADERS) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - WKPageClearCustomHeaders(toAPI(priv->pageClient->page())); + WKPageClearCustomHeaders(toAPI(impl->pageProxy.get())); return true; #else ERR("TIZEN_CUSTOM_HEADERS not enabled!"); @@ -3874,9 +2944,21 @@ Eina_Bool ewk_view_custom_header_clear(const Evas_Object* ewkView) Eina_Bool ewk_view_visibility_set(Evas_Object* ewkView, Eina_Bool enable) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + +#if ENABLE(TIZEN_DRAG_SUPPORT) + if (impl->pageClient->isDragMode()) + impl->pageClient->setDragMode(false); +#endif - priv->pageClient->setIsVisible(enable); + impl->pageClient->setIsVisible(enable); + return true; +} +#endif + +#if ENABLE(TIZEN_BACKGROUND_DISK_CACHE) +Eina_Bool ewk_view_foreground_set(Evas_Object* ewkView, Eina_Bool enable) +{ return true; } #endif @@ -3886,7 +2968,7 @@ Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* ewkView, Eina_R EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0); EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); WKRect rect; rect.origin.x = viewArea.x; @@ -3894,7 +2976,7 @@ Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* ewkView, Eina_R rect.size.width = viewArea.w; rect.size.height = viewArea.h; - WKRetainPtr snapshot(AdoptWK, WKPageCreateSnapshot(toAPI(priv->pageClient->page()), rect, scaleFactor)); + WKRetainPtr snapshot(AdoptWK, WKPageCreateSnapshot(toAPI(impl->pageProxy.get()), rect, scaleFactor)); if (!snapshot.get()) return 0; @@ -3926,26 +3008,26 @@ Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* ewkView, Eina_R unsigned int ewk_view_inspector_server_start(Evas_Object* ewkView, unsigned int port) { -#if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR) +#if ENABLE(TIZEN_REMOTE_WEB_INSPECTOR) EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl, 0); - return priv->pageClient->page()->startInspectorServer(port); + return impl->pageProxy->startInspectorServer(port); #else - LOG_ERROR("TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR is disabled.\n"); + LOG_ERROR("TIZEN_REMOTE_WEB_INSPECTOR is disabled.\n"); return 0; #endif } Eina_Bool ewk_view_inspector_server_stop(Evas_Object* ewkView) { -#if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR) +#if ENABLE(TIZEN_REMOTE_WEB_INSPECTOR) EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd, false); - EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl, false); - return priv->pageClient->page()->stopInspectorServer(); + return impl->pageProxy->stopInspectorServer(); #else - LOG_ERROR("TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR is disabled.\n"); + LOG_ERROR("TIZEN_REMOTE_WEB_INSPECTOR is disabled.\n"); return false; #endif } @@ -3953,9 +3035,9 @@ Eina_Bool ewk_view_inspector_server_stop(Evas_Object* ewkView) void ewk_view_scroll_by(Evas_Object* ewkView, int deltaX, int deltaY) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - WKPageScrollBy(toAPI(priv->pageClient->page()), toAPI(IntSize(deltaX, deltaY))); + WKPageScrollBy(toAPI(impl->pageProxy.get()), toAPI(IntSize(deltaX, deltaY))); } Eina_Bool ewk_view_scroll_pos_get(Evas_Object* ewkView, int* x, int* y) @@ -3965,9 +3047,9 @@ Eina_Bool ewk_view_scroll_pos_get(Evas_Object* ewkView, int* x, int* y) if (y) *y = 0; EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - IntPoint scrollPosition = priv->pageClient->scrollPosition(); + IntPoint scrollPosition = impl->pageClient->scrollPosition(); if (x) *x = scrollPosition.x(); if (y) @@ -3979,9 +3061,9 @@ Eina_Bool ewk_view_scroll_pos_get(Evas_Object* ewkView, int* x, int* y) Eina_Bool ewk_view_scroll_set(Evas_Object* ewkView, int x, int y) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - priv->pageClient->page()->scrollMainFrameTo(IntPoint(x, y)); + impl->pageProxy->scrollMainFrameTo(IntPoint(x, y)); return true; } @@ -3992,11 +3074,11 @@ Eina_Bool ewk_view_scroll_size_get(const Evas_Object* ewkView, int* width, int* if (height) *height = 0; EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - IntSize contentsSize = priv->pageClient->page()->contentsSize(); + IntSize contentsSize = impl->pageProxy->contentsSize(); #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) - contentsSize.scale(priv->pageClient->scaleFactor()); + contentsSize.scale(impl->pageClient->scaleFactor()); #endif if (width && contentsSize.width() > smartData->view.w) @@ -4006,68 +3088,78 @@ Eina_Bool ewk_view_scroll_size_get(const Evas_Object* ewkView, int* width, int* return true; } +#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS) +void ewkViewNotifyPopupReplyWaitingState(Evas_Object* ewkView, bool isWaiting) +{ + if (isWaiting) + evas_object_smart_callback_call(ewkView, "popup,reply,wait,start", 0); + else + evas_object_smart_callback_call(ewkView, "popup,reply,wait,finish", 0); +} +#endif + bool ewkViewRunJavaScriptAlert(Evas_Object* ewkView, WKStringRef alertText) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - if (!priv->alertContext || !priv->alertContext->javascriptAlertCallback) + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + if (!impl->alertContext || !impl->alertContext->javascriptAlertCallback) return false; - EINA_SAFETY_ON_FALSE_RETURN_VAL(priv->alertContext->ewkView == ewkView, false); + EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->alertContext->ewkView == ewkView, false); - priv->isWaitingForJavaScriptPopupReply = true; + impl->isWaitingForJavaScriptPopupReply = true; int length = WKStringGetMaximumUTF8CStringSize(alertText); OwnArrayPtr alertTextBuffer = adoptArrayPtr(new char[length]); WKStringGetUTF8CString(alertText, alertTextBuffer.get(), length); - return priv->alertContext->javascriptAlertCallback(priv->alertContext->ewkView, alertTextBuffer.get(), priv->alertContext->userData) == EINA_TRUE; + return impl->alertContext->javascriptAlertCallback(impl->alertContext->ewkView, alertTextBuffer.get(), impl->alertContext->userData) == EINA_TRUE; } bool ewkViewRunJavaScriptConfirm(Evas_Object* ewkView, WKStringRef message) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - if (!priv->confirmContext || !priv->confirmContext->javascriptConfirmCallback) + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + if (!impl->confirmContext || !impl->confirmContext->javascriptConfirmCallback) return false; - EINA_SAFETY_ON_FALSE_RETURN_VAL(priv->confirmContext->ewkView == ewkView, false); + EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->confirmContext->ewkView == ewkView, false); - priv->isWaitingForJavaScriptPopupReply = true; + impl->isWaitingForJavaScriptPopupReply = true; int length = WKStringGetMaximumUTF8CStringSize(message); OwnArrayPtr messageBuffer = adoptArrayPtr(new char[length]); WKStringGetUTF8CString(message, messageBuffer.get(), length); - return priv->confirmContext->javascriptConfirmCallback(priv->confirmContext->ewkView, messageBuffer.get(), priv->confirmContext->userData) == EINA_TRUE; + return impl->confirmContext->javascriptConfirmCallback(impl->confirmContext->ewkView, messageBuffer.get(), impl->confirmContext->userData) == EINA_TRUE; } bool ewkViewRunJavaScriptPrompt(Evas_Object* ewkView, WKStringRef message, WKStringRef defaultValue) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - if (!priv->promptContext || !priv->promptContext->javascriptPromptCallback) + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + if (!impl->promptContext || !impl->promptContext->javascriptPromptCallback) return false; - EINA_SAFETY_ON_FALSE_RETURN_VAL(priv->promptContext->ewkView == ewkView, false); + EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->promptContext->ewkView == ewkView, false); - priv->isWaitingForJavaScriptPopupReply = true; + impl->isWaitingForJavaScriptPopupReply = true; int length = WKStringGetMaximumUTF8CStringSize(message); OwnArrayPtr messageBuffer = adoptArrayPtr(new char[length]); WKStringGetUTF8CString(message, messageBuffer.get(), length); length = WKStringGetMaximumUTF8CStringSize(defaultValue); OwnArrayPtr defaultValueBuffer = adoptArrayPtr(new char[length]); WKStringGetUTF8CString(defaultValue, defaultValueBuffer.get(), length); - return priv->promptContext->javascriptPromptCallback(priv->promptContext->ewkView, messageBuffer.get(), defaultValueBuffer.get(), priv->promptContext->userData) == EINA_TRUE; + return impl->promptContext->javascriptPromptCallback(impl->promptContext->ewkView, messageBuffer.get(), defaultValueBuffer.get(), impl->promptContext->userData) == EINA_TRUE; } #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL) bool ewk_view_run_before_unload_confirm_panel(Evas_Object* ewkView, WKStringRef message) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - if (!priv->beforeUnloadConfirmPanelContext || !priv->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback) + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + if (!impl->beforeUnloadConfirmPanelContext || !impl->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback) return false; - EINA_SAFETY_ON_FALSE_RETURN_VAL(priv->beforeUnloadConfirmPanelContext->ewkView == ewkView, false); + EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->beforeUnloadConfirmPanelContext->ewkView == ewkView, false); - priv->isWaitingForJavaScriptPopupReply = true; + impl->isWaitingForJavaScriptPopupReply = true; int length = WKStringGetMaximumUTF8CStringSize(message); OwnArrayPtr messageBuffer = adoptArrayPtr(new char[length]); WKStringGetUTF8CString(message, messageBuffer.get(), length); - bool result = priv->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback(priv->beforeUnloadConfirmPanelContext->ewkView, messageBuffer.get(), priv->beforeUnloadConfirmPanelContext->userData) == EINA_TRUE; + bool result = impl->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback(impl->beforeUnloadConfirmPanelContext->ewkView, messageBuffer.get(), impl->beforeUnloadConfirmPanelContext->userData) == EINA_TRUE; return result; } #endif @@ -4075,13 +3167,13 @@ bool ewk_view_run_before_unload_confirm_panel(Evas_Object* ewkView, WKStringRef bool ewkViewRunOpenPanel(Evas_Object* ewkView, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - if (!priv->openpanelContext || !priv->openpanelContext->openPanelCallback) + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + if (!impl->openpanelContext || !impl->openpanelContext->openPanelCallback) return false; - EINA_SAFETY_ON_FALSE_RETURN_VAL(priv->openpanelContext->ewkView == ewkView, false); + EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->openpanelContext->ewkView == ewkView, false); - priv->openPanelListener = listener; + impl->openPanelListener = listener; Eina_Bool allowMultipleFiles = WKOpenPanelParametersGetAllowsMultipleFiles(parameters) ? EINA_TRUE : EINA_FALSE; Eina_List* acceptedMimeTypes = 0; @@ -4102,7 +3194,7 @@ bool ewkViewRunOpenPanel(Evas_Object* ewkView, WKOpenPanelParametersRef paramete WKRetainPtr captureRef(AdoptWK, WKOpenPanelParametersCopyCapture(parameters)); capture = eina_stringshare_add(toImpl(captureRef.get())->string().utf8().data()); #endif - bool result = priv->openpanelContext->openPanelCallback(priv->openpanelContext->ewkView, allowMultipleFiles, acceptedMimeTypes, capture, 0); + bool result = impl->openpanelContext->openPanelCallback(impl->openpanelContext->ewkView, allowMultipleFiles, acceptedMimeTypes, capture, 0); if (!acceptedMimeTypes) return result; @@ -4117,115 +3209,115 @@ bool ewkViewRunOpenPanel(Evas_Object* ewkView, WKOpenPanelParametersRef paramete void ewk_view_javascript_alert_callback_set(Evas_Object* ewkView, Ewk_View_JavaScript_Alert_Callback callback, void* userData) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - if (!priv->alertContext) - priv->alertContext = adoptPtr(new Ewk_View_Callback_Context); - priv->alertContext->javascriptAlertCallback = callback; - priv->alertContext->ewkView = ewkView; - priv->alertContext->userData = userData; + if (!impl->alertContext) + impl->alertContext = adoptPtr(new Ewk_View_Callback_Context); + impl->alertContext->javascriptAlertCallback = callback; + impl->alertContext->ewkView = ewkView; + impl->alertContext->userData = userData; } void ewk_view_javascript_alert_reply(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - WKPageReplyJavaScriptAlert(toAPI(ewk_view_page_get(ewkView))); - priv->isWaitingForJavaScriptPopupReply = false; + WKPageReplyJavaScriptAlert(toAPI(impl->page())); + impl->isWaitingForJavaScriptPopupReply = false; } void ewk_view_javascript_confirm_callback_set(Evas_Object* ewkView, Ewk_View_JavaScript_Confirm_Callback callback, void* userData) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - if (!priv->confirmContext) - priv->confirmContext = adoptPtr(new Ewk_View_Callback_Context); - priv->confirmContext->javascriptConfirmCallback = callback; - priv->confirmContext->ewkView = ewkView; - priv->confirmContext->userData = userData; + if (!impl->confirmContext) + impl->confirmContext = adoptPtr(new Ewk_View_Callback_Context); + impl->confirmContext->javascriptConfirmCallback = callback; + impl->confirmContext->ewkView = ewkView; + impl->confirmContext->userData = userData; } void ewk_view_javascript_confirm_reply(Evas_Object* ewkView, Eina_Bool result) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - WKPageReplyJavaScriptConfirm(toAPI(ewk_view_page_get(ewkView)), result == EINA_TRUE); - priv->isWaitingForJavaScriptPopupReply = false; + WKPageReplyJavaScriptConfirm(toAPI(impl->page()), result == EINA_TRUE); + impl->isWaitingForJavaScriptPopupReply = false; } void ewk_view_javascript_prompt_callback_set(Evas_Object* ewkView, Ewk_View_JavaScript_Prompt_Callback callback, void* userData) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - if (!priv->promptContext) - priv->promptContext = adoptPtr(new Ewk_View_Callback_Context); - priv->promptContext->javascriptPromptCallback = callback; - priv->promptContext->ewkView = ewkView; - priv->promptContext->userData = userData; + if (!impl->promptContext) + impl->promptContext = adoptPtr(new Ewk_View_Callback_Context); + impl->promptContext->javascriptPromptCallback = callback; + impl->promptContext->ewkView = ewkView; + impl->promptContext->userData = userData; } void ewk_view_javascript_prompt_reply(Evas_Object* ewkView, const char* result) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); WKRetainPtr resultString(AdoptWK, WKStringCreateWithUTF8CString(result)); - WKPageReplyJavaScriptPrompt(toAPI(ewk_view_page_get(ewkView)), result ? resultString.get() : 0); - priv->isWaitingForJavaScriptPopupReply = false; + WKPageReplyJavaScriptPrompt(toAPI(impl->page()), result ? resultString.get() : 0); + impl->isWaitingForJavaScriptPopupReply = false; } #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL) void ewk_view_before_unload_confirm_panel_callback_set(Evas_Object* ewkView, Ewk_View_Before_Unload_Confirm_Panel_Callback callback, void* userData) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - if (!priv->beforeUnloadConfirmPanelContext) - priv->beforeUnloadConfirmPanelContext = adoptPtr(new Ewk_View_Callback_Context); - priv->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback = callback; - priv->beforeUnloadConfirmPanelContext->ewkView = ewkView; - priv->beforeUnloadConfirmPanelContext->userData = userData; + if (!impl->beforeUnloadConfirmPanelContext) + impl->beforeUnloadConfirmPanelContext = adoptPtr(new Ewk_View_Callback_Context); + impl->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback = callback; + impl->beforeUnloadConfirmPanelContext->ewkView = ewkView; + impl->beforeUnloadConfirmPanelContext->userData = userData; } void ewk_view_before_unload_confirm_panel_reply(Evas_Object* ewkView, Eina_Bool result) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - WKPageReplyBeforeUnloadConfirmPanel(toAPI(ewk_view_page_get(ewkView)), result == EINA_TRUE); - priv->isWaitingForJavaScriptPopupReply = false; + WKPageReplyBeforeUnloadConfirmPanel(toAPI(impl->page()), result == EINA_TRUE); + impl->isWaitingForJavaScriptPopupReply = false; } #endif void ewk_view_open_panel_callback_set(Evas_Object* ewkView, Ewk_View_Open_Panel_Callback callback, void* userData) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - if (!priv->openpanelContext) - priv->openpanelContext = adoptPtr(new Ewk_View_Callback_Context); + if (!impl->openpanelContext) + impl->openpanelContext = adoptPtr(new Ewk_View_Callback_Context); - priv->openpanelContext->openPanelCallback = callback; - priv->openpanelContext->ewkView = ewkView; - priv->openpanelContext->userData = userData; + impl->openpanelContext->openPanelCallback = callback; + impl->openpanelContext->ewkView = ewkView; + impl->openpanelContext->userData = userData; } void ewk_view_open_panel_reply(Evas_Object* ewkView, Eina_List* fileUrls, Eina_Bool result) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - if (!priv->openPanelListener) + if (!impl->openPanelListener) return; unsigned int size = eina_list_count(fileUrls); if ((result == EINA_FALSE) || (size == 0)) { - WKOpenPanelResultListenerCancel(priv->openPanelListener); - priv->openPanelListener = 0; + WKOpenPanelResultListenerCancel(impl->openPanelListener); + impl->openPanelListener = 0; return; } @@ -4235,12 +3327,12 @@ void ewk_view_open_panel_reply(Evas_Object* ewkView, Eina_List* fileUrls, Eina_B unsigned int i = 0; KURL base(KURL(), "file://"); EINA_LIST_FOREACH(fileUrls, list, data) { - KURL url(base, static_cast(data)); + KURL url(base, String::fromUTF8(static_cast(data))); items[i++] = WKURLCreateWithUTF8CString(url.string().utf8().data()); } WKRetainPtr filesArray(AdoptWK, WKArrayCreate(items, size)); - WKOpenPanelResultListenerChooseFiles(priv->openPanelListener, filesArray.get()); - priv->openPanelListener = 0; + WKOpenPanelResultListenerChooseFiles(impl->openPanelListener, filesArray.get()); + impl->openPanelListener = 0; delete [] items; eina_list_free(fileUrls); } @@ -4272,13 +3364,13 @@ static void didGetWebAppIconURL(WKStringRef iconURL, WKErrorRef, void* context) Ewk_View_Callback_Context* webAppContext = static_cast(context); EWK_VIEW_SD_GET_OR_RETURN(webAppContext->ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); ASSERT(webAppContext->webAppIconURLCallback); if (iconURL) { - eina_stringshare_replace(&priv->webAppIconURL, toImpl(iconURL)->string().utf8().data()); - webAppContext->webAppIconURLCallback(priv->webAppIconURL, webAppContext->userData); + impl->webAppIconURL = toImpl(iconURL)->string().utf8().data(); + webAppContext->webAppIconURLCallback(impl->webAppIconURL, webAppContext->userData); } else webAppContext->webAppIconURLCallback(0, webAppContext->userData); @@ -4293,13 +3385,13 @@ static void didGetWebAppIconURLs(WKDictionaryRef iconURLs, WKErrorRef, void* con Ewk_View_Callback_Context* webAppContext = static_cast(context); EWK_VIEW_SD_GET_OR_RETURN(webAppContext->ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); ASSERT(webAppContext->webAppIconURLsCallback); - if (priv->webAppIconURLs) { + if (impl->webAppIconURLs) { void* data = 0; - EINA_LIST_FREE(priv->webAppIconURLs, data) + EINA_LIST_FREE(impl->webAppIconURLs, data) ewkWebAppIconDataDelete(static_cast(data)); } @@ -4308,11 +3400,11 @@ static void didGetWebAppIconURLs(WKDictionaryRef iconURLs, WKErrorRef, void* con for (size_t i = 0; i < iconURLCount; i++) { WKStringRef urlRef = static_cast(WKArrayGetItemAtIndex(wkKeys.get(), i)); WKStringRef sizeRef = static_cast(WKDictionaryGetItemForKey(iconURLs, urlRef)); - priv->webAppIconURLs = eina_list_append(priv->webAppIconURLs, ewkWebAppIconDataCreate(sizeRef, urlRef)); + impl->webAppIconURLs = eina_list_append(impl->webAppIconURLs, ewkWebAppIconDataCreate(sizeRef, urlRef)); } TIZEN_LOGI("webAppIconURLsCallback exist. found %d icon urls", iconURLCount); - webAppContext->webAppIconURLsCallback(priv->webAppIconURLs, webAppContext->userData); + webAppContext->webAppIconURLsCallback(impl->webAppIconURLs, webAppContext->userData); delete webAppContext; } #endif @@ -4322,7 +3414,7 @@ Eina_Bool ewk_view_web_application_capable_get(Evas_Object* ewkView, Ewk_Web_App #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG) EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false); EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); TIZEN_LOGI("callback(%d), userData(%d)", callback, userData); Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context; @@ -4330,7 +3422,7 @@ Eina_Bool ewk_view_web_application_capable_get(Evas_Object* ewkView, Ewk_Web_App context->ewkView = ewkView; context->userData = userData; - WKPageGetWebAppCapable(toAPI(priv->pageClient->page()), context, didGetWebAppCapable); + WKPageGetWebAppCapable(toAPI(impl->pageProxy.get()), context, didGetWebAppCapable); return true; #else @@ -4343,14 +3435,14 @@ Eina_Bool ewk_view_web_application_icon_url_get(Evas_Object* ewkView, Ewk_Web_Ap #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG) EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false); EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context; context->webAppIconURLCallback = callback; context->ewkView = ewkView; context->userData = userData; - WKPageGetWebAppIconURL(toAPI(priv->pageClient->page()), context, didGetWebAppIconURL); + WKPageGetWebAppIconURL(toAPI(impl->page()), context, didGetWebAppIconURL); return true; #else @@ -4363,7 +3455,7 @@ Eina_Bool ewk_view_web_application_icon_urls_get(Evas_Object* ewkView, Ewk_Web_A #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG) EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false); EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); TIZEN_LOGI("callback(%d), userData(%d)", callback, userData); Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context; @@ -4371,7 +3463,7 @@ Eina_Bool ewk_view_web_application_icon_urls_get(Evas_Object* ewkView, Ewk_Web_A context->ewkView = ewkView; context->userData = userData; - WKPageGetWebAppIconURLs(toAPI(priv->pageClient->page()), context, didGetWebAppIconURLs); + WKPageGetWebAppIconURLs(toAPI(impl->page()), context, didGetWebAppIconURLs); return true; #else @@ -4385,37 +3477,12 @@ Eina_Bool ewk_view_web_application_icon_urls_get(Evas_Object* ewkView, Ewk_Web_A Eina_Bool ewk_view_command_execute(Evas_Object* ewkView, const char* command, const char* value) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(command, false); WKRetainPtr commandString(AdoptWK, WKStringCreateWithUTF8CString(command)); WKRetainPtr valueString(AdoptWK, WKStringCreateWithUTF8CString(value)); - WKPageExecuteCommandWithArgument(toAPI(priv->pageClient->page()), commandString.get(), valueString.get()); - - return true; -} - -Eina_Bool ewk_view_text_find(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(text, false); - - // FixMe: Comment should be removed when pageClient is removed. - //priv->pageProxy->findString(String::fromUTF8(text), static_cast(options), maxMatchCount); - priv->pageClient->page()->findString(String::fromUTF8(text), static_cast(options), maxMatchCount); - - return true; -} - -Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - - // FixMe: Comment should be removed when pageClient is removed. - //priv->pageProxy->hideFindUI(); - priv->pageClient->page()->hideFindUI(); + WKPageExecuteCommandWithArgument(toAPI(impl->pageProxy.get()), commandString.get(), valueString.get()); return true; } @@ -4428,9 +3495,9 @@ Eina_Bool ewk_view_contents_size_get(Evas_Object* ewkView, Evas_Coord* width, Ev *height = 0; EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - IntSize contentsSize = priv->pageClient->page()->contentsSize(); + IntSize contentsSize = impl->pageProxy->contentsSize(); if (width) *width = contentsSize.width(); @@ -4444,11 +3511,11 @@ Eina_Bool ewk_view_contents_pdf_get_temp(Evas_Object* ewkView, int width, int he { #if ENABLE(TIZEN_MOBILE_WEB_PRINT) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(fileName, false); - IntSize contentsSize = priv->pageClient->page()->contentsSize(); - WKPageGetSnapshotPdfFile(toAPI(priv->pageClient->page()), toAPI(IntSize(width, height)), toAPI(IntSize(contentsSize.width(), contentsSize.height())), WKStringCreateWithUTF8CString(fileName)); + IntSize contentsSize = impl->pageProxy->contentsSize(); + WKPageGetSnapshotPdfFile(toAPI(impl->pageProxy.get()), toAPI(IntSize(width, height)), toAPI(IntSize(contentsSize.width(), contentsSize.height())), WKStringCreateWithUTF8CString(fileName)); return true; #else @@ -4460,11 +3527,11 @@ Eina_Bool ewk_view_contents_pdf_get(Evas_Object* ewkView, int width, int height, { #if ENABLE(TIZEN_MOBILE_WEB_PRINT) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(fileName, false); - IntSize contentsSize = priv->pageClient->page()->contentsSize(); - WKPageGetSnapshotPdfFile(toAPI(priv->pageClient->page()), toAPI(IntSize(width, height)), toAPI(IntSize(contentsSize.width(), contentsSize.height())), WKStringCreateWithUTF8CString(fileName)); + IntSize contentsSize = impl->pageProxy->contentsSize(); + WKPageGetSnapshotPdfFile(toAPI(impl->pageProxy.get()), toAPI(IntSize(width, height)), toAPI(IntSize(contentsSize.width(), contentsSize.height())), WKStringCreateWithUTF8CString(fileName)); return true; #else @@ -4500,16 +3567,16 @@ static void runJavaScriptCallback(WKSerializedScriptValueRef scriptValue, WKErro Eina_Bool ewk_view_script_execute(Evas_Object* ewkView, const char* script, Ewk_View_Script_Execute_Callback callback, void* user_data) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(script, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(priv->pageClient, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(impl->pageClient, false); Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context; context->scriptExecuteCallback = callback; context->ewkView = ewkView; context->userData = user_data; WKRetainPtr scriptString(AdoptWK, WKStringCreateWithUTF8CString(script)); - WKPageRunJavaScriptInMainFrame(toAPI(priv->pageClient->page()), scriptString.get(), context, runJavaScriptCallback); + WKPageRunJavaScriptInMainFrame(toAPI(impl->pageProxy.get()), scriptString.get(), context, runJavaScriptCallback); return true; } @@ -4533,13 +3600,15 @@ Eina_Bool ewk_view_web_storage_quota_get(const Evas_Object* ewkView, Ewk_Web_Sto #if ENABLE(TIZEN_WEB_STORAGE) && ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT) EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, false); EINA_SAFETY_ON_NULL_RETURN_VAL(resultCallback, false); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); TIZEN_LOGI("resultCallback (%p)", resultCallback); Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context; context->webStorageQuotaCallback = resultCallback; context->userData = userData; - WKPageRef pageRef = toAPI(ewk_view_page_get(const_cast(ewkView))); + WKPageRef pageRef = toAPI(impl->page()); WKPageGetWebStorageQuota(pageRef, context, didGetWebStorageQuota); return true; @@ -4552,9 +3621,11 @@ Eina_Bool ewk_view_web_storage_quota_set(Evas_Object* ewkView, uint32_t quota) { #if ENABLE(TIZEN_WEB_STORAGE) EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, false); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); TIZEN_LOGI("quota (%d)", quota); - WKPageRef pageRef = toAPI(ewk_view_page_get(const_cast(ewkView))); + WKPageRef pageRef = toAPI(impl->page()); WKPageSetWebStorageQuota(pageRef, quota); return true; @@ -4585,15 +3656,15 @@ static void getContentsAsStringCallback(WKStringRef plain_text, WKErrorRef error Eina_Bool ewk_view_plain_text_get(Evas_Object* ewkView, Ewk_View_Plain_Text_Get_Callback callback, void* user_data) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(priv->pageClient, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(impl->pageClient, false); Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context; context->plainTextGetCallback = callback; context->ewkView = ewkView; context->userData = user_data; - WKPageGetContentsAsString(toAPI(priv->pageClient->page()), context, getContentsAsStringCallback); + WKPageGetContentsAsString(toAPI(impl->pageProxy.get()), context, getContentsAsStringCallback); return true; } @@ -4619,14 +3690,14 @@ Eina_Bool ewk_view_mhtml_data_get(Evas_Object* ewkView, Ewk_View_MHTML_Data_Get_ { EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false); EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context; context->mhtmlDataGetCallback = callback; context->ewkView = ewkView; context->userData = user_data; - WKPageGetContentsAsMHTMLData(toAPI(priv->pageClient->page()), false, context, getContentsAsMHTMLCallback); + WKPageGetContentsAsMHTMLData(toAPI(impl->page()), false, context, getContentsAsMHTMLCallback); return true; } @@ -4636,11 +3707,10 @@ Ewk_Hit_Test* ewk_view_hit_test_new(Evas_Object* ewkView, int x, int y, int hitT { #if ENABLE(TIZEN_WEBKIT2_HIT_TEST) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); - EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); IntPoint pointForHitTest = impl->transformFromScene().mapPoint(IntPoint(x, y)); - WebHitTestResult::Data hitTestResultData = priv->pageClient->page()->hitTestResultAtPoint(pointForHitTest, hitTestMode); + WebHitTestResult::Data hitTestResultData = impl->pageProxy->hitTestResultAtPoint(pointForHitTest, hitTestMode); Ewk_Hit_Test* hitTest = ewkHitTestCreate(hitTestResultData); return hitTest; @@ -4652,7 +3722,9 @@ Ewk_Hit_Test* ewk_view_hit_test_new(Evas_Object* ewkView, int x, int y, int hitT Ewk_History* ewk_view_history_get(Evas_Object* ewkView) { EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, 0); - WebPageProxy* page = ewk_view_page_get(ewkView); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + WebPageProxy* page = impl->page(); EINA_SAFETY_ON_NULL_RETURN_VAL(page, 0); return ewkHistoryCreate(WKPageGetBackForwardList(toAPI(page))); @@ -4660,20 +3732,15 @@ Ewk_History* ewk_view_history_get(Evas_Object* ewkView) Eina_Bool ewk_view_recording_surface_enable_set(Evas_Object* ewkView, Eina_Bool enable) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - - WKPageRecordingSurfaceSetEnable(toAPI(priv->pageClient->page()), enable); - - return true; + return false; } Eina_Bool ewk_view_notification_closed(Evas_Object* ewkView, Eina_List* ewkNotifications) { #if ENABLE(TIZEN_NOTIFICATIONS) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(priv->context, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context, false); TIZEN_LOGI("ewkNotifications (%p)", ewkNotifications); if (!eina_list_count(ewkNotifications)) @@ -4686,11 +3753,11 @@ Eina_Bool ewk_view_notification_closed(Evas_Object* ewkView, Eina_List* ewkNotif Ewk_Notification* notification = static_cast(data); WKUInt64Ref idRef = WKUInt64Create(ewk_notification_id_get(notification)); ids.append(idRef); - priv->notifications = eina_list_remove(priv->notifications, notification); + impl->notifications = eina_list_remove(impl->notifications, notification); } WKRetainPtr notificationIDsArray(AdoptWK, WKArrayCreate(ids.data(), ids.size())); - WKNotificationManagerRef notificationManager = WKContextGetNotificationManager(ewk_context_WKContext_get(priv->context)); + WKNotificationManagerRef notificationManager = WKContextGetNotificationManager(impl->context->wkContext()); WKNotificationManagerProviderDidCloseNotifications(notificationManager, notificationIDsArray.get()); ewkNotificationDeleteNotificationList(ewkNotifications); @@ -4700,24 +3767,13 @@ Eina_Bool ewk_view_notification_closed(Evas_Object* ewkView, Eina_List* ewkNotif #endif } +#if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL) static Eina_List* createPopupMenuList(const Vector& items) { Eina_List* popupItems = 0; size_t size = items.size(); - for (size_t i = 0; i < size; ++i) { - Ewk_Popup_Menu_Item* item = ewk_popup_menu_item_new(items[i].m_type, - items[i].m_text.utf8().data(), - items[i].m_textDirection, - items[i].m_hasTextDirectionOverride, - items[i].m_toolTip.utf8().data(), - items[i].m_accessibilityText.utf8().data(), - items[i].m_isEnabled, -#if ENABLE(TIZEN_MULTIPLE_SELECT) - items[i].m_isSelected, -#endif - items[i].m_isLabel); - popupItems = eina_list_append(popupItems, item); - } + for (size_t i = 0; i < size; ++i) + popupItems = eina_list_append(popupItems, Ewk_Popup_Menu_Item::create(items[i]).leakPtr()); TIZEN_LOGI("size : %d", size); return popupItems; } @@ -4729,129 +3785,92 @@ static void releasePopupMenuList(Eina_List* popupMenuItems) void* item; EINA_LIST_FREE(popupMenuItems, item) - ewk_popup_menu_item_free(static_cast(item)); + delete static_cast(item); } - -#if ENABLE(TIZEN_MULTIPLE_SELECT) -void ewk_view_popup_menu_request(Evas_Object* ewkView, WebPopupMenuProxyEfl* popupMenu, const IntRect& rect, TextDirection textDirection, double pageScaleFactor, const Vector& items, int32_t selectedIndex, bool multiple) -#else -void ewk_view_popup_menu_request(Evas_Object* ewkView, WebPopupMenuProxyEfl* popupMenu, const IntRect& rect, TextDirection textDirection, double pageScaleFactor, const Vector& items, int32_t selectedIndex) #endif -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - EINA_SAFETY_ON_NULL_RETURN(smartData->api); - TIZEN_LOGI("proxy : %p", priv->popupMenuProxy); - ASSERT(popupMenu); - -#if ENABLE(TIZEN_MULTIPLE_SELECT) - if (!smartData->api->popup_menu_show && !smartData->api->multiple_popup_menu_show) -#else - if (!smartData->api->popup_menu_show) +Eina_Bool ewk_view_popup_menu_close(Evas_Object* ewkView) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false); +#if OS(TIZEN) + TIZEN_LOGI("proxy : %p", impl->popupMenuProxy); #endif - return; - if (priv->popupMenuProxy) - ewk_view_popup_menu_close(ewkView); - priv->popupMenuProxy = popupMenu; + if (!impl->popupMenuProxy) + return false; - priv->popupMenuItems = createPopupMenuList(items); + impl->popupMenuProxy = 0; -#if ENABLE(TIZEN_MULTIPLE_SELECT) - if ((!multiple && smartData->api->popup_menu_show(smartData, rect, static_cast(textDirection), pageScaleFactor, priv->popupMenuItems, selectedIndex)) || - (multiple && smartData->api->multiple_popup_menu_show(smartData, rect, static_cast(textDirection), pageScaleFactor, priv->popupMenuItems))) { -#else - if (smartData->api->popup_menu_show(smartData, rect, static_cast(textDirection), pageScaleFactor, priv->popupMenuItems, selectedIndex)) { -#endif + if (smartData->api->popup_menu_hide) + smartData->api->popup_menu_hide(smartData); #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL) - /* maps.google.com generate mouse event in touch down without preventDefault. - * So, popup menu is opend in touch down event and closed via fake mouse down - * which generated by endTap. - * In order to fix select of maps.google.com (based on touch behavior), - * We should disable touch events when select popup is open. - */ + ewk_view_touch_events_enabled_set(ewkView, true); -#if ENABLE(TIZEN_GESTURE) - priv->gestureClient->reset(); -#endif - ewk_view_touch_events_enabled_set(ewkView, false); + releasePopupMenuList(impl->popupMenuItems); + impl->popupMenuItems = 0; +#else + void* item; + EINA_LIST_FREE(impl->popupMenuItems, item) + delete static_cast(item); #endif - } + + return true; } -Eina_Bool ewk_view_popup_menu_close(Evas_Object* ewkView) +Eina_Bool ewk_view_popup_menu_select(Evas_Object* ewkView, unsigned int selectedIndex) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false); - TIZEN_LOGI("proxy : %p", priv->popupMenuProxy); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(impl->popupMenuProxy, false); +#if OS(TIZEN) + TIZEN_LOGI("proxy : %p / index : %d", impl->popupMenuProxy, selectedIndex); - if (!priv->popupMenuProxy) + if (!impl->popupMenuItems) return false; - - priv->popupMenuProxy = 0; - - if (smartData->api->popup_menu_hide) - smartData->api->popup_menu_hide(smartData); -#if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL) - ewk_view_touch_events_enabled_set(ewkView, true); #endif - releasePopupMenuList(priv->popupMenuItems); - priv->popupMenuItems = 0; + if (selectedIndex >= eina_list_count(impl->popupMenuItems)) + return false; + + impl->popupMenuProxy->valueChanged(selectedIndex); return true; } +#if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL) void ewk_view_popup_menu_update(Evas_Object* ewkView, TextDirection textDirection, const Vector& items, int32_t selectedIndex) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); EINA_SAFETY_ON_NULL_RETURN(smartData->api); - TIZEN_LOGI("proxy : %p", priv->popupMenuProxy); + TIZEN_LOGI("proxy : %p", impl->popupMenuProxy); - if (!priv->popupMenuProxy) + if (!impl->popupMenuProxy) return; if (!smartData->api->popup_menu_update) return; - releasePopupMenuList(priv->popupMenuItems); - priv->popupMenuItems = createPopupMenuList(items); + releasePopupMenuList(impl->popupMenuItems); + impl->popupMenuItems = createPopupMenuList(items); // TODO: Instead of passing a dummy rect, updated rect should be coming from WebProcess - smartData->api->popup_menu_update(smartData, IntRect(), static_cast(textDirection), priv->popupMenuItems, selectedIndex); -} - -Eina_Bool ewk_view_popup_menu_select(Evas_Object* ewkView, unsigned int selectedIndex) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(priv->popupMenuProxy, false); - TIZEN_LOGI("proxy : %p / index : %d", priv->popupMenuProxy, selectedIndex); - - if (!priv->popupMenuItems) - return false; - - if (selectedIndex >= eina_list_count(priv->popupMenuItems)) - return false; - - priv->popupMenuProxy->valueChanged(selectedIndex); - - return true; + smartData->api->popup_menu_update(smartData, IntRect(), static_cast(textDirection), impl->popupMenuItems, selectedIndex); } +#endif #if ENABLE(TIZEN_MULTIPLE_SELECT) Eina_Bool ewk_view_popup_menu_multiple_select(Evas_Object* ewkView, Eina_Inarray* changeList) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(priv->popupMenuProxy, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(impl->popupMenuProxy, false); Vector selectedIndex; - if (!priv->popupMenuItems) + if (!impl->popupMenuItems) return false; Eina_Iterator* itr; @@ -4864,7 +3883,7 @@ Eina_Bool ewk_view_popup_menu_multiple_select(Evas_Object* ewkView, Eina_Inarray } eina_iterator_free(itr); - priv->popupMenuProxy->multipleValueChanged(selectedIndex); + impl->popupMenuProxy->multipleValueChanged(selectedIndex); return true; } #endif @@ -4873,18 +3892,18 @@ void ewk_view_orientation_send(Evas_Object* ewkView, int orientation) { #if ENABLE(TIZEN_ORIENTATION_EVENTS) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); TIZEN_LOGI("orientation : %d", orientation); if (orientation != 0 && orientation != 90 && orientation != -90 && orientation != 180) return; - if (priv->orientation == orientation) + if (impl->orientation == orientation) return; - priv->orientation = orientation; + impl->orientation = orientation; - priv->pageClient->page()->sendOrientationChangeEvent(orientation); + impl->pageProxy->sendOrientationChangeEvent(orientation); #endif } @@ -4902,12 +3921,11 @@ Eina_Bool ewk_view_text_selection_enable_set(Evas_Object* ewkView, Eina_Bool ena Eina_Bool ewk_view_text_selection_range_get(Evas_Object* ewkView, Eina_Rectangle* leftRect, Eina_Rectangle* rightRect) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); IntRect leftSelectionRect; IntRect rightSelectionRect; - if (!priv->pageClient->page()->getSelectionHandlers(leftSelectionRect, rightSelectionRect)) { + if (!impl->pageProxy->getSelectionHandlers(leftSelectionRect, rightSelectionRect)) { leftRect->x = 0; leftRect->y = 0; leftRect->w = 0; @@ -4940,12 +3958,12 @@ Eina_Bool ewk_view_text_selection_range_get(Evas_Object* ewkView, Eina_Rectangle const char* ewk_view_text_selection_text_get(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); - const CString selectedString = priv->pageClient->page()->getSelectionText().utf8(); - eina_stringshare_replace(&priv->selectedText, selectedString.data()); + const CString selectedString = impl->pageProxy->getSelectionText().utf8(); + impl->selectedText = selectedString.data(); - return priv->selectedText; + return impl->selectedText; } Eina_Bool ewk_view_auto_clear_text_selection_mode_set(Evas_Object* ewkView, Eina_Bool enable) @@ -4957,6 +3975,14 @@ Eina_Bool ewk_view_auto_clear_text_selection_mode_get(Evas_Object* ewkView) { return ewk_settings_clear_text_selection_automatically_get(ewk_view_settings_get(ewkView)); } + +void ewk_view_text_selection_range_clear(Evas_Object* ewkView) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + + impl->pageProxy->selectionRangeClear(); +} #endif // #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) #if ENABLE(TIZEN_INPUT_TAG_EXTENSION) @@ -4974,16 +4000,16 @@ void ewkViewInputPickerRequest(Evas_Object* ewkView, Ewk_Input_Type inputType, c void ewkViewGetWindowFrame(Evas_Object* ewkView, int *x, int *y, int *w, int *h) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - IntPoint drawingPosition = (IntPoint)(priv->pageClient->visibleContentRect().location() - priv->pageClient->scrollPosition()); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + IntPoint drawingPosition = (IntPoint)(impl->pageClient->visibleContentRect().location() - impl->pageClient->scrollPosition()); if (x) *x = drawingPosition.x(); if (y) *y = drawingPosition.y(); if (w) - *w = priv->pageClient->visibleContentRect().width(); + *w = impl->pageClient->visibleContentRect().width(); if (h) - *h = priv->pageClient->visibleContentRect().height(); + *h = impl->pageClient->visibleContentRect().height(); } #endif @@ -4991,9 +4017,9 @@ void ewk_view_focused_input_element_value_set(Evas_Object* ewkView, const char* { #if ENABLE(TIZEN_INPUT_TAG_EXTENSION) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - priv->pageClient->page()->setFocusedInputElementValue(String::fromUTF8(value)); + impl->pageProxy->setFocusedInputElementValue(String::fromUTF8(value)); #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION) } @@ -5001,10 +4027,10 @@ const char* ewk_view_focused_input_element_value_get(Evas_Object* ewkView) { #if ENABLE(TIZEN_INPUT_TAG_EXTENSION) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); - eina_stringshare_replace(&priv->inputValue, priv->pageClient->page()->getFocusedInputElementValue().utf8().data()); - return priv->inputValue; + impl->inputValue = impl->pageProxy->getFocusedInputElementValue().utf8().data(); + return impl->inputValue; #else return 0; #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION) @@ -5014,33 +4040,30 @@ const char* ewk_view_focused_input_element_value_get(Evas_Object* ewkView) void ewkViewDataListShowRequest(Evas_Object* ewkView, Ewk_Input_Type inputType, Vector optionList) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); EINA_SAFETY_ON_NULL_RETURN(smartData->api); EINA_SAFETY_ON_NULL_RETURN(smartData->api->data_list_show); - if (priv->dataList) + if (impl->dataList) ewkViewDataListHideRequest(ewkView, inputType); for (Vector::const_iterator it = optionList.begin(); it != optionList.end(); ++it) { String value = *it; - priv->dataList = eina_list_append(priv->dataList, eina_stringshare_add(value.utf8().data())); + impl->dataList = eina_list_append(impl->dataList, eina_stringshare_add(value.utf8().data())); } - smartData->api->data_list_show(smartData, inputType, priv->dataList); + smartData->api->data_list_show(smartData, inputType, impl->dataList); } void ewkViewDataListHideRequest(Evas_Object* ewkView, Ewk_Input_Type inputType) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - EINA_SAFETY_ON_NULL_RETURN(priv->dataList); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + EINA_SAFETY_ON_NULL_RETURN(impl->dataList); EINA_SAFETY_ON_NULL_RETURN(smartData->api); EINA_SAFETY_ON_NULL_RETURN(smartData->api->data_list_hide); - if (priv->dataList) { - _ewk_view_data_list_del(priv->dataList); - priv->dataList = 0; - } + impl->deleteDataList(); smartData->api->data_list_hide(smartData, inputType); } @@ -5050,12 +4073,9 @@ void ewk_view_data_list_close(Evas_Object* ewkView, const char* value) { #if ENABLE(TIZEN_DATALIST_ELEMENT) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - if (priv->dataList) { - _ewk_view_data_list_del(priv->dataList); - priv->dataList = 0; - } + impl->deleteDataList(); ewk_view_focused_input_element_value_set(ewkView, value); #endif @@ -5064,9 +4084,9 @@ void ewk_view_data_list_close(Evas_Object* ewkView, const char* value) Eina_Bool ewk_view_horizontal_panning_hold_get(Evas_Object* ewkView) { #if ENABLE(TIZEN_GESTURE) - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false) - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false) - return priv->holdHorizontalPanning; + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + return impl->holdHorizontalPanning; #else return false; #endif @@ -5075,18 +4095,18 @@ Eina_Bool ewk_view_horizontal_panning_hold_get(Evas_Object* ewkView) void ewk_view_horizontal_panning_hold_set(Evas_Object* ewkView, Eina_Bool hold) { #if ENABLE(TIZEN_GESTURE) - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData) - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv) - priv->holdHorizontalPanning = hold; + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + impl->holdHorizontalPanning = hold; #endif } Eina_Bool ewk_view_vertical_panning_hold_get(Evas_Object* ewkView) { #if ENABLE(TIZEN_GESTURE) - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false) - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false) - return priv->holdVerticalPanning; + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + return impl->holdVerticalPanning; #else return false; #endif @@ -5095,34 +4115,34 @@ Eina_Bool ewk_view_vertical_panning_hold_get(Evas_Object* ewkView) void ewk_view_vertical_panning_hold_set(Evas_Object* ewkView, Eina_Bool hold) { #if ENABLE(TIZEN_GESTURE) - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData) - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv) - priv->holdVerticalPanning = hold; + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + impl->holdVerticalPanning = hold; #endif } void ewk_view_touch_event_handler_result_set(Evas_Object* ewkView, WebKit::WebEvent::Type type, bool wasHandled) { #if ENABLE(TIZEN_GESTURE) - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData) - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) - if (priv->focusRing && wasHandled) - priv->focusRing->hide(); + if (impl->focusRing && wasHandled) + impl->focusRing->hide(); #endif // #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) - if (priv->areMouseEventsEnabled) + if (impl->mouseEventsEnabled()) return; #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) - if (wasHandled && priv->pageClient->isTextSelectionMode()) { + if (wasHandled && impl->pageClient->isTextSelectionMode()) { if (type == WebEvent::TouchStart) - priv->pageClient->updateTextSelectionHandlesAndContextMenu(false); + impl->pageClient->updateTextSelectionHandlesAndContextMenu(false); else if (type == WebEvent::TouchMove) - priv->pageClient->updateTextSelectionHandlesAndContextMenu(false); + impl->pageClient->updateTextSelectionHandlesAndContextMenu(false); else if (type == WebEvent::TouchEnd) - priv->pageClient->requestToShowTextSelectionHandlesAndContextMenu(); + impl->pageClient->requestToShowTextSelectionHandlesAndContextMenu(); } #endif @@ -5142,366 +4162,151 @@ void ewk_view_touch_event_handler_result_set(Evas_Object* ewkView, WebKit::WebEv // x |not occured | x || enable | enable // ------------------------------------------------------------ if (type == WebEvent::TouchStart) { - priv->gestureClient->setGestureEnabled(!wasHandled); - priv->wasHandledTouchStart = wasHandled; + impl->gestureClient->setGestureEnabled(!wasHandled); + impl->wasHandledTouchStart = wasHandled; // Initialize wasHandledTouchMove to true and notify that to the application // to prevent applications scrolling at the beginning of touch. - priv->wasHandledTouchMove = true; - evas_object_smart_callback_call(ewkView, "touchmove,handled", static_cast(&priv->wasHandledTouchMove)); + impl->wasHandledTouchMove = true; + evas_object_smart_callback_call(ewkView, "touchmove,handled", static_cast(&impl->wasHandledTouchMove)); } else if (type == WebEvent::TouchMove) { - priv->gestureClient->setMovingEnabled(!wasHandled); + impl->gestureClient->setMovingEnabled(!wasHandled); // We have to set wasHandled to true if touchstart was handled even though current touchmove was not handled. - if (priv->wasHandledTouchStart) + if (impl->wasHandledTouchStart) wasHandled = true; // Notify the result of touchmove to applications when handled value is changed // in order to make applications to choose whether scrolling its scrollable objects or not. - if (priv->wasHandledTouchMove != wasHandled) + if (impl->wasHandledTouchMove != wasHandled) evas_object_smart_callback_call(ewkView, "touchmove,handled", static_cast(&wasHandled)); - priv->wasHandledTouchMove = wasHandled; - } else if (type == WebEvent::TouchEnd && !priv->exceedTouchMoveThreshold && !wasHandled) { - priv->gestureClient->setMovingEnabled(!wasHandled); - priv->gestureClient->setTapEnabled(!wasHandled); - } -#endif -} - -#if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION) -void ewkViewDidGetTextStyleStateForSelection(Evas_Object* ewkView, int underlineState, int italicState, int boldState, const IntPoint& startPoint, const IntPoint& endPoint) -{ - Ewk_Text_Style* textStyle = ewkTextStyleCreate(underlineState, italicState, boldState, startPoint, endPoint); - evas_object_smart_callback_call(ewkView, "text,style,state", static_cast(textStyle)); - ewkTextStyleDelete(textStyle); -} + impl->wasHandledTouchMove = wasHandled; + } else if (type == WebEvent::TouchEnd && !impl->exceedTouchMoveThreshold) { + if (!wasHandled) { + impl->gestureClient->setMovingEnabled(!wasHandled); + impl->gestureClient->setTapEnabled(!wasHandled); + } +#if ENABLE(TIZEN_ISF_PORT) + else if (impl->pageProxy->isViewVisible()) { + IntPoint pointForHitTest = impl->transformFromScene().mapPoint(IntPoint(impl->touchDownPoint.x, impl->touchDownPoint.y)); + WebHitTestResult::Data hitTestResultData = impl->pageProxy->hitTestResultAtPoint(pointForHitTest); + if (hitTestResultData.isContentEditable && impl->inputMethodContext()) { + evas_object_focus_set(ewkView, true); + impl->inputMethodContext()->updateTextInputState(); + } + } #endif - -#if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT) -bool ewk_view_orientation_lock(Evas_Object* ewkView, int willLockOrientation) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false); - - TIZEN_LOGI("willLockOrientation (%d)", willLockOrientation); - if (!smartData->api->orientation_lock) { - TIZEN_LOGE("fail"); - return false; - } - - return smartData->api->orientation_lock(smartData, willLockOrientation); -} - -void ewk_view_orientation_unlock(Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EINA_SAFETY_ON_NULL_RETURN(smartData->api); - - TIZEN_LOGI("ewkView (%p)", ewkView); - if (!smartData->api->orientation_unlock) { - TIZEN_LOGE("fail"); - return; } - - smartData->api->orientation_unlock(smartData); -} -#endif - -void ewk_view_orientation_lock_callback_set(Evas_Object* ewkView, Ewk_Orientation_Lock_Cb func, void* data) -{ -#if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL) - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - TIZEN_LOGI("callbacks: %p / data: %p", func, data); - - priv->orientationLock.callback = func; - priv->orientationLock.data = data; -#endif -} - -#if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL) -Eina_Bool _ewk_orientation_lock(Ewk_View_Smart_Data *sd, int orientations) -{ - EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, false); - TIZEN_LOGI("locked orientations : %d", orientations); - - if (priv->orientationLock.callback) - return priv->orientationLock.callback(sd->self, true, orientations, priv->orientationLock.data); - - return false; -} - -void _ewk_orientation_unlock(Ewk_View_Smart_Data *sd) -{ - EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv); - TIZEN_LOGI("unlock is requested"); - - if (priv->orientationLock.callback) - priv->orientationLock.callback(sd->self, false, 0, priv->orientationLock.data); -} #endif - -void ewk_view_fullscreen_enter(Evas_Object* ewkView) -{ - TIZEN_LOGI("fullscreen,enterfullscreen"); - ewk_view_main_frame_scrollbar_visible_set(ewkView, false); - evas_object_smart_callback_call(ewkView, "fullscreen,enterfullscreen", 0); -} - -void ewk_view_fullscreen_exit(Evas_Object* ewkView) -{ - TIZEN_LOGI("fullscreen,exitfullscreen"); - ewk_view_main_frame_scrollbar_visible_set(ewkView, true); - evas_object_smart_callback_call(ewkView, "fullscreen,exitfullscreen", 0); -} - -#if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION) -bool ewk_view_is_opengl_backend(Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - - Ecore_Evas* ee = ecore_evas_ecore_evas_get(smartData->base.evas); - const char *engine = ecore_evas_engine_name_get(ee); - if (engine && !strcmp(engine, "opengl_x11")) - return true; - return false; } -#endif -void ewk_view_zoomable_area_set(Evas_Object* ewkView, const IntPoint& target, const IntRect& area) +#if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION) +void ewkViewTextStyleState(Evas_Object* ewkView, const IntPoint& startPoint, const IntPoint& endPoint) { -#if ENABLE(TIZEN_GESTURE) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - priv->gestureClient->setZoomableArea(target, area); -#endif -} - -#if ENABLE(TIZEN_ISF_PORT) -static void imfInputPanelStateEventCb(void* data, Ecore_IMF_Context* ctx, int state) -{ - Ewk_View_Smart_Data* smartData = static_cast(data); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - if (state == ECORE_IMF_INPUT_PANEL_STATE_HIDE) { - evas_object_smart_callback_call(smartData->self, "editorclient,ime,closed", 0); - LOG(ISF, "[SIGNAL] editorclient,ime,closed\n"); - } else if (state == ECORE_IMF_INPUT_PANEL_STATE_SHOW) { - evas_object_smart_callback_call(smartData->self, "editorclient,ime,opened", 0); - LOG(ISF, "[SIGNAL] editorclient,ime,opened\n"); - } -} - -static void imfInputPanelGeometryEventCb(void* data, Ecore_IMF_Context* ctx, int value) -{ - Ewk_View_Smart_Data* smartData = static_cast(data); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - Eina_Rectangle rect; - ecore_imf_context_input_panel_geometry_get(priv->imfContext, &rect.x, &rect.y, &rect.w, &rect.h); - evas_object_smart_callback_call(smartData->self, "inputmethod,changed", &rect); - LOG(ISF, "%s : [SIGNAL] inputmethod,changed (%d,%d,%d,%d)\n", __func__, rect.x, rect.y, rect.w, rect.h); -} - -static void imfCandidatePanelStateEventCb(void* data, Ecore_IMF_Context* ctx, int state) -{ - Ewk_View_Smart_Data* smartData = static_cast(data); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - if (state == ECORE_IMF_CANDIDATE_PANEL_SHOW) - evas_object_smart_callback_call(smartData->self, "editorclient,candidate,opened", 0); - else - evas_object_smart_callback_call(smartData->self, "editorclient,candidate,closed", 0); -} - -static void imfCandidatePanelGeometryEventCb(void* data, Ecore_IMF_Context* ctx, int value) -{ - Ewk_View_Smart_Data* smartData = static_cast(data); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - Eina_Rectangle rect; - ecore_imf_context_candidate_panel_geometry_get(priv->imfContext, &rect.x, &rect.y, &rect.w, &rect.h); - evas_object_smart_callback_call(smartData->self, "editorclient,candidate,changed", &rect); -} - -static Eina_Bool imfRetrieveSurroundingCb(void* data, Ecore_IMF_Context* context, char** text, int* offset) -{ - Ewk_View_Smart_Data* smartData = static_cast(data); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - - if (!priv->pageClient->page()->focusedFrame() || (!text && !offset)) - return false; - - String surroundingText; - int cursorOffset; - priv->pageClient->page()->getSurroundingTextAndCursorOffset(surroundingText, cursorOffset); - - if (text) { - CString utf8Text(surroundingText.utf8()); - size_t length = utf8Text.length(); - - *text = static_cast(malloc((length + 1) * sizeof(char))); - if (!(*text)) - return false; - - if (length) - strncpy(*text, utf8Text.data(), length); - (*text)[length] = 0; - } - - if (offset) - *offset = cursorOffset; - - return true; -} + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); -static void imfPreeditChangedCb(void* data, Ecore_IMF_Context* context, void* eventInfo) -{ - Ewk_View_Smart_Data* smartData = static_cast(data); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - priv->pageClient->imContextPreeditChanged(context); -} - -static void imfEventCommittedCb(void* data, Ecore_IMF_Context* context, void* eventInfo) -{ - Ewk_View_Smart_Data* smartData = static_cast(data); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - priv->pageClient->imContextCommitted(context, static_cast(eventInfo)); -} - -static void imfContextDeleteSurroundingCb(void* data, Ecore_IMF_Context* context, void* eventInfo) -{ - Ewk_View_Smart_Data* smartData = static_cast(data); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - Ecore_IMF_Event_Delete_Surrounding* event = static_cast(eventInfo); - if (!event) - return; - - priv->pageClient->page()->deleteSurroundingText(event->offset, event->n_chars); -} - -Ecore_IMF_Context* ewk_view_imf_context_get(Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); - - return priv->imfContext; -} - -Ecore_IMF_Context* ewk_view_imf_context_set(Evas_Object* ewkView, Ecore_IMF_Input_Panel_Layout layout) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); - - Ecore_IMF_Context* imfContext; - Eina_List* iterator; - void* data; - - EINA_LIST_FOREACH(priv->imfContextList, iterator, data) { - imfContext = static_cast(data); - if (ecore_imf_context_input_panel_layout_get(imfContext) == layout) { - priv->imfContext = imfContext; - return imfContext; - } - } - - imfContext = ecore_imf_context_add(ecore_imf_context_default_id_get()); - if (!imfContext) - return 0; + EditorState editorState = impl->page()->editorState(); + Ewk_Text_Style* textStyle = ewkTextStyleCreate(editorState, startPoint, endPoint); + evas_object_smart_callback_call(ewkView, "text,style,state", static_cast(textStyle)); + ewkTextStyleDelete(textStyle); +} +#endif - ecore_imf_context_input_panel_enabled_set(imfContext, false); - ecore_imf_context_input_panel_event_callback_add(imfContext, ECORE_IMF_INPUT_PANEL_STATE_EVENT, imfInputPanelStateEventCb, smartData); - ecore_imf_context_input_panel_event_callback_add(imfContext, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, imfInputPanelGeometryEventCb, smartData); - ecore_imf_context_input_panel_event_callback_add(imfContext, ECORE_IMF_CANDIDATE_PANEL_STATE_EVENT, imfCandidatePanelStateEventCb, smartData); - ecore_imf_context_input_panel_event_callback_add(imfContext, ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT, imfCandidatePanelGeometryEventCb, smartData); - ecore_imf_context_retrieve_surrounding_callback_set(imfContext, imfRetrieveSurroundingCb, smartData); // Support for Auto Capitalization - ecore_imf_context_event_callback_add(imfContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, imfPreeditChangedCb, smartData); - ecore_imf_context_event_callback_add(imfContext, ECORE_IMF_CALLBACK_COMMIT, imfEventCommittedCb, smartData); - ecore_imf_context_event_callback_add(imfContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, imfContextDeleteSurroundingCb, smartData); //Support for Automatic Full Stop - ecore_imf_context_input_panel_layout_set(imfContext, layout); +#if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT) +bool ewk_view_orientation_lock(Evas_Object* ewkView, int willLockOrientation) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false); - priv->imfContextList = eina_list_append(priv->imfContextList, imfContext); - priv->imfContext = imfContext; + TIZEN_LOGI("willLockOrientation (%d)", willLockOrientation); + if (!smartData->api->orientation_lock) { + TIZEN_LOGE("fail"); + return false; + } - return imfContext; + return smartData->api->orientation_lock(smartData, willLockOrientation); } -void ewk_view_imf_context_reset(Evas_Object* ewkView) +void ewk_view_orientation_unlock(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EINA_SAFETY_ON_NULL_RETURN(smartData->api); - if (!priv->imfContext) + TIZEN_LOGI("ewkView (%p)", ewkView); + if (!smartData->api->orientation_unlock) { + TIZEN_LOGE("fail"); return; + } - ecore_imf_context_reset(priv->imfContext); - - if (ecore_imf_context_input_panel_state_get(priv->imfContext) == ECORE_IMF_INPUT_PANEL_STATE_HIDE) - priv->imfContext = 0; + smartData->api->orientation_unlock(smartData); } +#endif -void ewk_view_imf_context_hide(Evas_Object* ewkView) +void ewk_view_orientation_lock_callback_set(Evas_Object* ewkView, Ewk_Orientation_Lock_Cb func, void* data) { +#if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + TIZEN_LOGI("callbacks: %p / data: %p", func, data); - if (!priv->imfContext) - return; + impl->orientationLock.callback = func; + impl->orientationLock.data = data; +#endif +} - if (ecore_imf_context_input_panel_state_get(priv->imfContext) != ECORE_IMF_INPUT_PANEL_STATE_HIDE) { - ecore_imf_context_reset(priv->imfContext); - ecore_imf_context_input_panel_hide(priv->imfContext); - ecore_imf_context_focus_out(priv->imfContext); - } +#if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL) +Eina_Bool _ewk_orientation_lock(Ewk_View_Smart_Data *sd, int orientations) +{ + EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl, false); + TIZEN_LOGI("locked orientations : %d", orientations); - priv->imfContext = 0; + if (impl->orientationLock.callback) + return impl->orientationLock.callback(sd->self, true, orientations, impl->orientationLock.data); + + return false; } -static void _ewk_view_imf_context_destroy(Ewk_View_Private_Data* priv) +void _ewk_orientation_unlock(Ewk_View_Smart_Data *sd) { - if (!priv->imfContextList) - return; + EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl); + TIZEN_LOGI("unlock is requested"); - void* item; - EINA_LIST_FREE(priv->imfContextList, item) { - Ecore_IMF_Context* imfContext = static_cast(item); - if (!imfContext) - continue; + if (impl->orientationLock.callback) + impl->orientationLock.callback(sd->self, false, 0, impl->orientationLock.data); +} +#endif - ecore_imf_context_input_panel_event_callback_del(imfContext, ECORE_IMF_INPUT_PANEL_STATE_EVENT, imfInputPanelStateEventCb); - ecore_imf_context_input_panel_event_callback_del(imfContext, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, imfInputPanelGeometryEventCb); - ecore_imf_context_input_panel_event_callback_del(imfContext, ECORE_IMF_CANDIDATE_PANEL_STATE_EVENT, imfCandidatePanelStateEventCb); - ecore_imf_context_input_panel_event_callback_del(imfContext, ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT, imfCandidatePanelGeometryEventCb); - ecore_imf_context_event_callback_del(imfContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, imfPreeditChangedCb); - ecore_imf_context_event_callback_del(imfContext, ECORE_IMF_CALLBACK_COMMIT, imfEventCommittedCb); - ecore_imf_context_event_callback_del(imfContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, imfContextDeleteSurroundingCb); - ecore_imf_context_del(imfContext); - } +#if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION) +bool ewk_view_is_opengl_backend(Evas_Object* ewkView) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - priv->imfContextList = 0; - priv->imfContext = 0; + Ecore_Evas* ee = ecore_evas_ecore_evas_get(smartData->base.evas); + const char *engine = ecore_evas_engine_name_get(ee); + if (engine && !strcmp(engine, "opengl_x11")) + return true; + return false; } +#endif -void ewk_view_imf_context_destroy(Evas_Object* ewkView) +void ewk_view_zoomable_area_set(Evas_Object* ewkView, const IntPoint& target, const IntRect& area) { +#if ENABLE(TIZEN_GESTURE) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - _ewk_view_imf_context_destroy(priv); -} + impl->gestureClient->setZoomableArea(target, area); #endif +} #if ENABLE(TIZEN_BACKFORWARD_LIST_CLEAR) void ewk_view_back_forward_list_clear(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - WKBackForwardListClearBackForwardList(WKPageGetBackForwardList(toAPI(priv->pageClient->page()))); + WKBackForwardListClearBackForwardList(WKPageGetBackForwardList(toAPI(impl->pageProxy.get()))); } #endif @@ -5523,118 +4328,72 @@ void ewkViewIconReceived(Evas_Object* ewkView) #endif // #if OS(TIZEN) -#if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream -#if ENABLE(INPUT_TYPE_COLOR) -/** - * @internal - * Reqeusts to show external color picker. - */ -void ewk_view_color_picker_request(Evas_Object* ewkView, int r, int g, int b, int a, WKColorPickerResultListenerRef listener) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - EINA_SAFETY_ON_NULL_RETURN(smartData->api->input_picker_color_request); - - priv->colorPickerResultListener = listener; - - smartData->api->input_picker_color_request(smartData, r, g, b, a); -} - -/** - * @internal - * Reqeusts to hide external color picker. - */ -void ewk_view_color_picker_dismiss(Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - EINA_SAFETY_ON_NULL_RETURN(smartData->api->input_picker_color_dismiss); - - priv->colorPickerResultListener = 0; - - smartData->api->input_picker_color_dismiss(smartData); -} -#endif - -Eina_Bool ewk_view_color_picker_color_set(Evas_Object* ewkView, int r, int g, int b, int a) -{ -#if ENABLE(INPUT_TYPE_COLOR) - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(priv->colorPickerResultListener, false); - - WebCore::Color color = WebCore::Color(r, g, b, a); - WKRetainPtr colorString(AdoptWK, WKStringCreateWithUTF8CString(color.serialized().utf8().data())); - WKColorPickerResultListenerSetColor(priv->colorPickerResultListener, colorString.get()); - priv->colorPickerResultListener = 0; - - return true; -#else - return false; -#endif -} -#endif // ENABLE(TIZEN_INPUT_COLOR_PICKER) - Eina_Bool ewk_view_feed_touch_event(Evas_Object* ewkView, Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers) { #if ENABLE(TOUCH_EVENTS) EINA_SAFETY_ON_NULL_RETURN_VAL(points, false); EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP) - if (priv->pageClient->isTextSelectionMode() && eina_list_count(points) == 1) { + if (impl->pageClient->isTextSelectionMode() && eina_list_count(points) == 1) { Ewk_Touch_Point* point = static_cast(eina_list_data_get(points)); IntPoint handlePoint(point->x, point->y); if (type == EWK_TOUCH_START) - priv->pageClient->textSelectonHandleDown(handlePoint); + impl->pageClient->textSelectonHandleDown(handlePoint); else if (type == EWK_TOUCH_MOVE) - priv->pageClient->textSelectonHandleMove(handlePoint); + impl->pageClient->textSelectonHandleMove(handlePoint); else - priv->pageClient->textSelectonHandleUp(); + impl->pageClient->textSelectonHandleUp(); + + if (impl->pageClient->isTextSelectionHandleDowned()) + return true; } #endif #if ENABLE(TIZEN_GESTURE) #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2) // We don't want to process touch event when context menu is shown. - if (priv->pageClient->isContextMenuVisible() && type != EWK_TOUCH_CANCEL) + if ((impl->pageClient->isContextMenuVisible() && type != EWK_TOUCH_CANCEL) +#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) + && !impl->pageClient->isTextSelectionMode() +#endif + ) return true; #endif #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) - if (priv->pageClient->isTextSelectionDowned() && type != EWK_TOUCH_CANCEL) + if (impl->pageClient->isTextSelectionDowned() && type != EWK_TOUCH_CANCEL) return true; #endif if (type == EWK_TOUCH_START) { if (eina_list_count(points) == 1) { - priv->gestureClient->reset(); + impl->gestureClient->reset(); Ewk_Touch_Point* point = static_cast(eina_list_data_get(points)); - priv->touchDownPoint.x = point->x; - priv->touchDownPoint.y = point->y; - priv->exceedTouchMoveThreshold = false; + impl->touchDownPoint.x = point->x; + impl->touchDownPoint.y = point->y; + impl->exceedTouchMoveThreshold = false; } - } else if (type == EWK_TOUCH_MOVE && !priv->exceedTouchMoveThreshold) { + } else if (type == EWK_TOUCH_MOVE && !impl->exceedTouchMoveThreshold) { if (eina_list_count(points) == 1) { unsigned int threshold = elm_config_scroll_thumbscroll_threshold_get(); Ewk_Touch_Point* point = static_cast(eina_list_data_get(points)); - int diffX = priv->touchDownPoint.x - point->x; - int diffY = priv->touchDownPoint.y - point->y; + int diffX = impl->touchDownPoint.x - point->x; + int diffY = impl->touchDownPoint.y - point->y; if (static_cast(diffX * diffX + diffY * diffY) > threshold * threshold) - priv->exceedTouchMoveThreshold = true; + impl->exceedTouchMoveThreshold = true; else return true; } else { - priv->exceedTouchMoveThreshold = true; + impl->exceedTouchMoveThreshold = true; } } #endif // #if ENABLE(TIZEN_GESTURE) // FIXME: impl is used in the webkit opensource, but tizen webkit does not use it yet. //impl->page()->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, impl->transformFromScene(), impl->transformToScreen(), ecore_time_get())); - priv->pageClient->page()->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, impl->transformFromScene(), impl->transformToScreen(), ecore_time_get())); + impl->pageProxy->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, impl->transformFromScene(), impl->transformToScreen(), ecore_time_get())); return true; #else @@ -5646,33 +4405,9 @@ Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object* ewkView, Eina_Bool enab { #if ENABLE(TOUCH_EVENTS) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - - enabled = !!enabled; - if (priv->areTouchEventsEnabled == enabled) - return true; + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - priv->areTouchEventsEnabled = enabled; - if (enabled) { - // FIXME: We have to connect touch callbacks with mouse and multi events - // because the Evas creates mouse events for first touch and multi events - // for second and third touches. Below codes should be fixed when the Evas - // supports the touch events. - // See https://bugs.webkit.org/show_bug.cgi?id=97785 for details. - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_touch_down, smartData); - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_touch_up, smartData); - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_touch_move, smartData); - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MULTI_DOWN, _ewk_view_on_touch_down, smartData); - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MULTI_UP, _ewk_view_on_touch_up, smartData); - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MULTI_MOVE, _ewk_view_on_touch_move, smartData); - } else { - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_touch_down); - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_touch_up); - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_touch_move); - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MULTI_DOWN, _ewk_view_on_touch_down); - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MULTI_UP, _ewk_view_on_touch_up); - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MULTI_MOVE, _ewk_view_on_touch_move); - } + impl->setTouchEventsEnabled(!!enabled); return true; #else @@ -5684,9 +4419,9 @@ Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object* ewkView) { #if ENABLE(TOUCH_EVENTS) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - return priv->areTouchEventsEnabled; + return impl->touchEventsEnabled(); #else return false; #endif @@ -5696,10 +4431,10 @@ Eina_Bool ewk_view_main_frame_scrollbar_visible_set(Evas_Object* ewkView, Eina_B { #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - priv->mainFrameScrollbarVisibility = visible; - priv->pageClient->updateVisibility(); + impl->mainFrameScrollbarVisibility = visible; + impl->pageClient->updateVisibility(); return true; #else @@ -5711,9 +4446,9 @@ Eina_Bool ewk_view_main_frame_scrollbar_visible_get(const Evas_Object* ewkView) { #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - return priv->mainFrameScrollbarVisibility; + return impl->mainFrameScrollbarVisibility; #else return false; #endif @@ -5723,13 +4458,13 @@ Eina_Bool ewk_view_page_save(Evas_Object* ewkView, const char* path) { #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(path, false); String title = ewk_view_title_get(ewkView); String url = ewk_view_url_get(ewkView); String directoryPath(path); - priv->pageClient->startOfflinePageSave(directoryPath, url, title); + impl->pageClient->startOfflinePageSave(directoryPath, url, title); return true; #else @@ -5770,15 +4505,15 @@ Eina_Bool ewk_view_page_contents_get(const Evas_Object* ewkView, Ewk_Page_Conten EINA_SAFETY_ON_NULL_RETURN_VAL(context, false); EINA_SAFETY_ON_NULL_RETURN_VAL(context->callback, false); EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); switch (context->type) { case EWK_PAGE_CONTENTS_TYPE_MHTML: - priv->pageClient->page()->getContentsAsMHTMLData(DataCallback::create(context, ewkViewPageContentsAsMHTMLCallback), false); + impl->pageProxy->getContentsAsMHTMLData(DataCallback::create(context, ewkViewPageContentsAsMHTMLCallback), false); break; case EWK_PAGE_CONTENTS_TYPE_STRING: - priv->pageClient->page()->getContentsAsString(StringCallback::create(context, ewkViewPageContentsAsStringCallback)); + impl->pageProxy->getContentsAsString(StringCallback::create(context, ewkViewPageContentsAsStringCallback)); break; default: @@ -5793,9 +4528,9 @@ Eina_Bool ewk_view_animated_scroll_set(Evas_Object* ewkView, int x, int y) { #if ENABLE(TIZEN_GESTURE) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); - return priv->gestureClient->scrollToWithAnimation(x, y); + return impl->gestureClient->scrollToWithAnimation(x, y); #else UNUSED_PARAM(ewkView); UNUSED_PARAM(x); @@ -5808,10 +4543,10 @@ Eina_Bool ewk_view_animated_scroll_set(Evas_Object* ewkView, int x, int y) void ewkViewFocusRingHide(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); - if (priv->focusRing) - priv->focusRing->hide(); + if (impl->focusRing) + impl->focusRing->hide(); } #endif @@ -5819,9 +4554,306 @@ void ewk_view_content_security_policy_set(Evas_Object* ewkView, const char* poli { #if ENABLE(TIZEN_CSP) EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd); - EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl); TIZEN_LOGI("policy(%s), type(%d)\n", policy, type); - priv->pageClient->page()->setContentSecurityPolicy(String::fromUTF8(policy), static_cast(type)); + impl->pageProxy->setContentSecurityPolicy(String::fromUTF8(policy), static_cast(type)); +#endif +} + +#if ENABLE(TIZEN_APPLICATION_CACHE) +Eina_Bool ewkViewRequestApplicationCachePermission(Evas_Object* ewkView, WKSecurityOriginRef origin) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + + if (!impl->applicationCachePermissionContext || !impl->applicationCachePermissionContext->applicationCachePermissionCallback) + return false; + + impl->isWaitingForApplicationCachePermission = true; + if (impl->applicationCachePermissionOrigin) + deleteSecurityOrigin(impl->applicationCachePermissionOrigin); + impl->applicationCachePermissionOrigin = createSecurityOrigin(origin); + + return impl->applicationCachePermissionContext->applicationCachePermissionCallback(ewkView, impl->applicationCachePermissionOrigin, impl->applicationCachePermissionContext->userData) == EINA_TRUE; +} +#endif + +void ewk_view_application_cache_permission_callback_set(Evas_Object* ewkView, Ewk_View_Applicacion_Cache_Permission_Callback callback, void* userData) +{ +#if ENABLE(TIZEN_APPLICATION_CACHE) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + + if (!impl->applicationCachePermissionContext) + impl->applicationCachePermissionContext = adoptPtr(new Ewk_View_Callback_Context); + impl->applicationCachePermissionContext->applicationCachePermissionCallback = callback; + impl->applicationCachePermissionContext->userData = userData; +#else + UNUSED_PARAM(ewkView); + UNUSED_PARAM(callback); + UNUSED_PARAM(userData); +#endif +} + +void ewk_view_application_cache_permission_reply(Evas_Object* ewkView, Eina_Bool allow) +{ +#if ENABLE(TIZEN_APPLICATION_CACHE) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + + TIZEN_LOGI("allow %d", allow); + WKPageReplyApplicationCachePermission(toAPI(impl->page()), allow); + if (impl->applicationCachePermissionOrigin) + deleteSecurityOrigin(impl->applicationCachePermissionOrigin); + impl->applicationCachePermissionOrigin = 0; + impl->isWaitingForApplicationCachePermission = false; +#else + UNUSED_PARAM(ewkView); + UNUSED_PARAM(allow); +#endif +} + +#if ENABLE(TIZEN_INDEXED_DATABASE) +bool ewkViewExceededIndexedDatabaseQuota(Evas_Object* ewkView, WKSecurityOriginRef origin, long long currentUsage) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + + if (!impl->exceededIndexedDatabaseQuotaContext || !impl->exceededIndexedDatabaseQuotaContext->exceededIndexedDatabaseQuotaCallback) + return false; + + impl->isWaitingForExceededQuotaPopupReply = true; + if (impl->exceededQuotaOrigin) + deleteSecurityOrigin(impl->exceededQuotaOrigin); + impl->exceededQuotaOrigin = createSecurityOrigin(origin); + + TIZEN_LOGI("currentUsage(%lld)", currentUsage); + + return impl->exceededIndexedDatabaseQuotaContext->exceededIndexedDatabaseQuotaCallback(ewkView, impl->exceededQuotaOrigin, currentUsage, impl->exceededIndexedDatabaseQuotaContext->userData) == EINA_TRUE; +} +#endif + +void ewk_view_exceeded_indexed_database_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback, void* userData) +{ +#if ENABLE(TIZEN_INDEXED_DATABASE) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + + if (!impl->exceededIndexedDatabaseQuotaContext) + impl->exceededIndexedDatabaseQuotaContext = adoptPtr(new Ewk_View_Callback_Context); + impl->exceededIndexedDatabaseQuotaContext->exceededIndexedDatabaseQuotaCallback = callback; + impl->exceededIndexedDatabaseQuotaContext->userData = userData; +#else + UNUSED_PARAM(ewkView); + UNUSED_PARAM(callback); + UNUSED_PARAM(userData); +#endif +} + +void ewk_view_exceeded_indexed_database_quota_reply(Evas_Object* ewkView, Eina_Bool allow) +{ +#if ENABLE(TIZEN_INDEXED_DATABASE) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + + TIZEN_LOGI("allow %d", allow); + WKPageReplyExceededIndexedDatabaseQuota(toAPI(impl->page()), allow == EINA_TRUE); + if (impl->exceededQuotaOrigin) + deleteSecurityOrigin(impl->exceededQuotaOrigin); + impl->exceededQuotaOrigin = 0; + impl->isWaitingForExceededQuotaPopupReply = false; +#else + UNUSED_PARAM(ewkView); + UNUSED_PARAM(allow); +#endif +} + +// EwkFindOptions should be matched up orders with WkFindOptions. +COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_CASE_INSENSITIVE, kWKFindOptionsCaseInsensitive); +COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_AT_WORD_STARTS, kWKFindOptionsAtWordStarts); +COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START, kWKFindOptionsTreatMedialCapitalAsWordStart); +COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_BACKWARDS, kWKFindOptionsBackwards); +COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_WRAP_AROUND, kWKFindOptionsWrapAround); +COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_OVERLAY, kWKFindOptionsShowOverlay); +COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_FIND_INDICATOR, kWKFindOptionsShowFindIndicator); +COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT, kWKFindOptionsShowHighlight); + +Eina_Bool ewk_view_text_find(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(text, false); + + impl->pageProxy->findString(String::fromUTF8(text), static_cast(options), maxMatchCount); + + return true; +} + +Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object* ewkView) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + + impl->pageProxy->hideFindUI(); + + return true; +} + +Eina_Bool ewk_view_text_matches_count(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(text, false); + + impl->pageProxy->countStringMatches(String::fromUTF8(text), static_cast(options), maxMatchCount); + + return true; +} + +void ewk_view_exceeded_database_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Database_Quota_Callback callback, void* userData) +{ +#if ENABLE(TIZEN_SQL_DATABASE) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + + if (!impl->exceededDatabaseQuotaContext) + impl->exceededDatabaseQuotaContext = adoptPtr(new Ewk_View_Callback_Context); + impl->exceededDatabaseQuotaContext->exceededDatabaseQuotaCallback = callback; + impl->exceededDatabaseQuotaContext->userData = userData; +#else + UNUSED_PARAM(ewkView); + UNUSED_PARAM(callback); + UNUSED_PARAM(userData); +#endif +} + +void ewk_view_exceeded_database_quota_reply(Evas_Object* ewkView, Eina_Bool allow) +{ +#if ENABLE(TIZEN_SQL_DATABASE) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + + TIZEN_LOGI("allow %d", allow); + WKPageReplyExceededDatabaseQuota(toAPI(impl->page()), allow == EINA_TRUE); + if (impl->exceededQuotaOrigin) + deleteSecurityOrigin(impl->exceededQuotaOrigin); + impl->exceededQuotaOrigin = 0; + impl->isWaitingForExceededQuotaPopupReply = false; +#else + UNUSED_PARAM(ewkView); + UNUSED_PARAM(allow); +#endif +} + +#if ENABLE(TIZEN_FILE_SYSTEM) +bool ewkViewExceededLocalFileSystemQuota(Evas_Object* ewkView, WKSecurityOriginRef origin, long long currentUsage) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); + + if (!impl->exceededLocalFileSystemQuotaContext || !impl->exceededLocalFileSystemQuotaContext->exceededLocalFileSystemQuotaCallback) + return false; + + impl->isWaitingForExceededQuotaPopupReply = true; + if (impl->exceededQuotaOrigin) + deleteSecurityOrigin(impl->exceededQuotaOrigin); + impl->exceededQuotaOrigin = createSecurityOrigin(origin); + + TIZEN_LOGI("currentUsage(%lld)", currentUsage); + + return impl->exceededLocalFileSystemQuotaContext->exceededLocalFileSystemQuotaCallback(ewkView, impl->exceededQuotaOrigin , currentUsage, impl->exceededLocalFileSystemQuotaContext->userData) == EINA_TRUE; +} +#endif + +void ewk_view_exceeded_local_file_system_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback, void* userData) +{ +#if ENABLE(TIZEN_FILE_SYSTEM) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + + if (!impl->exceededLocalFileSystemQuotaContext) + impl->exceededLocalFileSystemQuotaContext = adoptPtr(new Ewk_View_Callback_Context); + impl->exceededLocalFileSystemQuotaContext->exceededLocalFileSystemQuotaCallback = callback; + impl->exceededLocalFileSystemQuotaContext->userData = userData; +#else + UNUSED_PARAM(ewkView); + UNUSED_PARAM(callback); + UNUSED_PARAM(userData); +#endif +} + +void ewk_view_exceeded_local_file_system_quota_reply(Evas_Object* ewkView, Eina_Bool allow) +{ +#if ENABLE(TIZEN_FILE_SYSTEM) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + + TIZEN_LOGI("allow %d", allow); + WKPageReplyExceededLocalFileSystemQuota(toAPI(impl->page()), allow == EINA_TRUE); + if (impl->exceededQuotaOrigin) + deleteSecurityOrigin(impl->exceededQuotaOrigin); + impl->exceededQuotaOrigin = 0; + impl->isWaitingForExceededQuotaPopupReply = false; +#else + UNUSED_PARAM(ewkView); + UNUSED_PARAM(result); +#endif +} + +void ewk_view_rotation_prepare(Evas_Object* ewkView, int angle) +{ +#if ENABLE(TIZEN_PRERENDERING_FOR_ROTATION) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + + int width, height; + if (angle == 0 || angle == 180) { + width = WebCore::getDefaultScreenResolution().width(); + height = WebCore::getDefaultScreenResolution().height() + 100; + } + if (angle == 90 || angle == 270) { + width = WebCore::getDefaultScreenResolution().height(); + height = WebCore::getDefaultScreenResolution().width() + 100; + } + + impl->pageProxy->drawingArea()->setSize(IntSize(width, height), IntSize()); + impl->pageClient->setWaitFrameOfNewViewortSize(true); + ewk_view_suspend(ewkView); + impl->pageClient->updateViewportSize(IntSize(width, height), angle); +#endif +} + +#if ENABLE(TIZEN_PRERENDERING_FOR_ROTATION) +void ewkViewRotatePrepared(Evas_Object* ewkView) +{ + evas_object_smart_callback_call(ewkView, "rotate,prepared", 0); +} +#endif + +void ewk_view_use_settings_font(Evas_Object* ewkView) +{ +#if ENABLE(TIZEN_USE_SETTINGS_FONT) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + + impl->pageProxy->useSettingsFont(); +#endif +} + +void ewk_view_fullscreen_exit(Evas_Object* ewkView) +{ +#if ENABLE(TIZEN_FULLSCREEN_API) + TIZEN_LOGI(""); + + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + + if (!impl->pageProxy->fullScreenManager()->isFullScreen()) + return; + + impl->pageProxy->fullScreenManager()->requestExitFullScreen(); +#else + UNUSED_PARAM(ewkView); #endif }