From c8afe963875f1c94635c2040b7d036cc918fe16d Mon Sep 17 00:00:00 2001 From: Kibum Kim Date: Mon, 27 Feb 2012 21:15:52 +0900 Subject: [PATCH 1/1] tizen beta release --- AUTHORS | 2 + CMakeLists.txt | 97 + Elementary_webview.h | 423 +++ LICENSE | 204 ++ TC/_export_env.sh | 31 + TC/build.sh | 47 + TC/elm_ts/webview/Makefile | 39 + TC/elm_ts/webview/tslist | 17 + .../webview/utc_INTERNETFW_elm_webview_add_func.c | 118 + ..._INTERNETFW_elm_webview_auto_fitting_get_func.c | 124 + ..._INTERNETFW_elm_webview_auto_fitting_set_func.c | 124 + ..._INTERNETFW_elm_webview_auto_suspend_set_func.c | 126 + ...W_elm_webview_context_menu_item_selected_func.c | 124 + ..._webview_enable_default_context_menu_get_func.c | 124 + ..._webview_enable_default_context_menu_set_func.c | 124 + ...TFW_elm_webview_enable_default_touch_set_func.c | 126 + ...c_INTERNETFW_elm_webview_events_feed_get_func.c | 124 + ...c_INTERNETFW_elm_webview_events_feed_set_func.c | 124 + ...ERNETFW_elm_webview_input_field_zoom_set_func.c | 126 + ...lm_webview_layout_width_set_to_container_func.c | 122 + ...TERNETFW_elm_webview_scheme_callback_set_func.c | 130 + ...ERNETFW_elm_webview_text_selection_clear_func.c | 122 + .../utc_INTERNETFW_elm_webview_uri_set_func.c | 128 + ...FW_elm_webview_vertical_panning_hold_set_func.c | 126 + .../utc_INTERNETFW_elm_webview_webkit_get_func.c | 120 + TC/execute.sh | 51 + TC/tet_code | 13 + TC/tet_scen_arm | 5 + TC/tet_scen_i686 | 5 + TC/tetbuild.cfg | 5 + TC/tetclean.cfg | 5 + TC/tetexec.cfg | 5 + TIZEN_ElementaryWebView_PG.h | 129 + debian/.gitignore | 8 + debian/LICENSE | 204 ++ debian/changelog | 2007 +++++++++++ debian/compat | 1 + debian/control | 25 + debian/libelm-webview-dev.install | 2 + debian/libelm-webview.install | 3 + debian/rules | 136 + elm-webview.pc.in | 11 + elm_webview.c | 347 ++ els_webview.c | 3511 ++++++++++++++++++++ els_webview.h | 63 + els_webview_cbhm.c | 74 + els_webview_cbhm.h | 29 + els_webview_editor.c | 2296 +++++++++++++ els_webview_editor.h | 71 + image/ElementaryWebView_image01.png | Bin 0 -> 14843 bytes log.h | 28 + modal_utility/modal_launcher/CMakeLists.txt | 22 + modal_utility/modal_launcher/Makefile.am | 10 + modal_utility/modal_launcher/modal_launcher.c | 184 + modal_utility/modal_launcher/modal_launcher.h | 41 + modal_utility/modal_launcher/popup.c | 346 ++ modal_utility/modal_launcher/popup.h | 32 + modal_utility/modal_util.c | 346 ++ modal_utility/modal_util.h | 41 + packaging/elm-webview.spec | 59 + samples/elm_webview_sample/CMakeLists.txt | 72 + samples/elm_webview_sample/build.sh | 16 + samples/elm_webview_sample/elm_webview_sample.c | 504 +++ .../elm_webview_sample.desktop.in | 4 + samples/elm_webview_sample/elm_webview_sample.edc | 50 + samples/elm_webview_sample/elm_webview_sample.h | 48 + .../elm_webview_sample/icon_elm_webview_sample.png | Bin 0 -> 5759 bytes samples/elm_webview_sample/po/CMakeLists.txt | 24 + samples/elm_webview_sample/po/POTFILES.in | 2 + .../elm_webview_sample/po/elm_webview_sample.pot | 25 + samples/elm_webview_sample/po/en_GB.po | 25 + samples/elm_webview_sample/po/en_US.po | 25 + samples/elm_webview_sample/po/ja.po | 25 + samples/elm_webview_sample/po/ko.po | 25 + samples/elm_webview_sample/po/update-po.sh | 60 + samples/elm_webview_sample/po/zh_CN.po | 25 + touch_processor/els_touch.c | 2116 ++++++++++++ touch_processor/els_touch.h | 60 + 78 files changed, 16193 insertions(+) create mode 100644 AUTHORS create mode 100755 CMakeLists.txt create mode 100755 Elementary_webview.h create mode 100755 LICENSE create mode 100755 TC/_export_env.sh create mode 100755 TC/build.sh create mode 100755 TC/elm_ts/webview/Makefile create mode 100755 TC/elm_ts/webview/tslist create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_add_func.c create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_auto_fitting_get_func.c create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_auto_fitting_set_func.c create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_auto_suspend_set_func.c create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_context_menu_item_selected_func.c create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_enable_default_context_menu_get_func.c create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_enable_default_context_menu_set_func.c create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_enable_default_touch_set_func.c create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_events_feed_get_func.c create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_events_feed_set_func.c create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_input_field_zoom_set_func.c create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_layout_width_set_to_container_func.c create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_scheme_callback_set_func.c create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_text_selection_clear_func.c create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_uri_set_func.c create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_vertical_panning_hold_set_func.c create mode 100755 TC/elm_ts/webview/utc_INTERNETFW_elm_webview_webkit_get_func.c create mode 100755 TC/execute.sh create mode 100755 TC/tet_code create mode 100644 TC/tet_scen_arm create mode 100755 TC/tet_scen_i686 create mode 100755 TC/tetbuild.cfg create mode 100755 TC/tetclean.cfg create mode 100755 TC/tetexec.cfg create mode 100644 TIZEN_ElementaryWebView_PG.h create mode 100644 debian/.gitignore create mode 100755 debian/LICENSE create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100755 debian/control create mode 100644 debian/libelm-webview-dev.install create mode 100644 debian/libelm-webview.install create mode 100755 debian/rules create mode 100644 elm-webview.pc.in create mode 100755 elm_webview.c create mode 100755 els_webview.c create mode 100755 els_webview.h create mode 100644 els_webview_cbhm.c create mode 100755 els_webview_cbhm.h create mode 100755 els_webview_editor.c create mode 100755 els_webview_editor.h create mode 100644 image/ElementaryWebView_image01.png create mode 100644 log.h create mode 100644 modal_utility/modal_launcher/CMakeLists.txt create mode 100644 modal_utility/modal_launcher/Makefile.am create mode 100755 modal_utility/modal_launcher/modal_launcher.c create mode 100644 modal_utility/modal_launcher/modal_launcher.h create mode 100755 modal_utility/modal_launcher/popup.c create mode 100755 modal_utility/modal_launcher/popup.h create mode 100755 modal_utility/modal_util.c create mode 100755 modal_utility/modal_util.h create mode 100644 packaging/elm-webview.spec create mode 100644 samples/elm_webview_sample/CMakeLists.txt create mode 100755 samples/elm_webview_sample/build.sh create mode 100755 samples/elm_webview_sample/elm_webview_sample.c create mode 100644 samples/elm_webview_sample/elm_webview_sample.desktop.in create mode 100644 samples/elm_webview_sample/elm_webview_sample.edc create mode 100644 samples/elm_webview_sample/elm_webview_sample.h create mode 100644 samples/elm_webview_sample/icon_elm_webview_sample.png create mode 100644 samples/elm_webview_sample/po/CMakeLists.txt create mode 100644 samples/elm_webview_sample/po/POTFILES.in create mode 100644 samples/elm_webview_sample/po/elm_webview_sample.pot create mode 100644 samples/elm_webview_sample/po/en_GB.po create mode 100644 samples/elm_webview_sample/po/en_US.po create mode 100644 samples/elm_webview_sample/po/ja.po create mode 100644 samples/elm_webview_sample/po/ko.po create mode 100755 samples/elm_webview_sample/po/update-po.sh create mode 100644 samples/elm_webview_sample/po/zh_CN.po create mode 100755 touch_processor/els_touch.c create mode 100644 touch_processor/els_touch.h diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..2423aaf --- /dev/null +++ b/AUTHORS @@ -0,0 +1,2 @@ +Eunmi Lee +Ryuan Choi diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..b016713 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,97 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(elm-webview C) + +#---------------------------------------------------- +# set values +#---------------------------------------------------- +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(EXEC_PREFIX "\${prefix}") +SET(LIBDIR "\${prefix}/lib") +SET(INCLUDEDIR "\${prefix}/include") +SET(VERSION_MAJOR 1) +SET(VERSION "${VERSION_MAJOR}.0.0") + +#---------------------------------------------------- +# set source files +#---------------------------------------------------- +SET(SRCS elm_webview.c + els_webview.c + els_webview_cbhm.c + els_webview_editor.c + modal_utility/modal_util.c + touch_processor/els_touch.c) + +#---------------------------------------------------- +# set build type +#---------------------------------------------------- +IF("${CMAKE_BUILD_TYPE}" STREQUAL "") + SET(CMAKE_BUILD_TYPE "Release") +ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") +MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") + +#---------------------------------------------------- +# set include directories +#---------------------------------------------------- +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/modal_utility + ${CMAKE_SOURCE_DIR}/touch_processor) + +#---------------------------------------------------- +# set pkg-config modules +#---------------------------------------------------- +INCLUDE(FindPkgConfig) +pkg_check_modules(pkgs REQUIRED + elementary evas ecore-imf ecore ecore-x ecore-input + ewebkit appcore-efl ui-gadget dlog utilX) +FIND_LIBRARY(LIB_GNUTLS gnutls) +FOREACH(flag ${pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +#---------------------------------------------------- +# set flags +#---------------------------------------------------- +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -Wall") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") +SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g") +SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2") + +#---------------------------------------------------- +# enable constanct tbs as default tiled backingstore +#---------------------------------------------------- +ADD_DEFINITIONS("-DLOG_TAG=\"elm-webview\"") + +#---------------------------------------------------- +# set option for arm +#---------------------------------------------------- +FIND_PROGRAM(UNAME NAMES uname) +EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") +IF("${ARCH}" STREQUAL "arm") + ADD_DEFINITIONS("-D_TARGET") + MESSAGE("add -D_TARGET") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpie") + SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mabi=aapcs-linux -mfpu=vfp -mfloat-abi=softfp") +ENDIF("${ARCH}" STREQUAL "arm") + +#---------------------------------------------------- +# make +#---------------------------------------------------- +ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR}) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} ${LIB_GNUTLS}) + +#---------------------------------------------------- +# install +#---------------------------------------------------- +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT RuntimeLibraries) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/Elementary_webview.h DESTINATION include/elementary-webview-0) +#INSTALL(FILES ${CMAKE_SOURCE_DIR}/TIZEN_ElementaryWebView_PG.h DESTINATION include/elementary-webview-0) +CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) +INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig) + +#---------------------------------------------------- +# add sub directory +#---------------------------------------------------- +ADD_SUBDIRECTORY(modal_utility/modal_launcher) diff --git a/Elementary_webview.h b/Elementary_webview.h new file mode 100755 index 0000000..b37dff7 --- /dev/null +++ b/Elementary_webview.h @@ -0,0 +1,423 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef ELEMENTARY_WEBKIT_H +#define ELEMENTARY_WEBKIT_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file Elementary_webview.h + * @brief This file contains APIs of the elm-webview, one of EFL library. + * @author Eunmi Lee (eunmi15.lee@samsung.com) + * @author Ryuan Choi (ryuan.choi@samsung.com) + * @author Mariusz Grzegorczyk (mariusz.g@samsung.com) + * @version 1.0 + * @date 2010.10.14 Modified for doxygen + * @date 2010.10.16 Modified for doxygen + * @date 2011.12.02 Remove deprecated APIs + */ + +/** + * @addtogroup InternetFW + * @{ + * + * @defgroup ElementaryWebView + * @version 1.0 + * @brief Elementary WebView is a mobile enhanced webview component based webkit. + * @par Details + * Elementary WebView is a shared library to provide Elementary based webview component which support panning, zooming and other mobile behaviors. \n\n + * + */ + +/** + * @addtogroup ElementaryWebView + * @{ + */ + +typedef struct _Elm_WebView_Context_Menu_Data Elm_WebView_Context_Menu_Data; +struct _Elm_WebView_Context_Menu_Data +{ + Ewk_Context_Menu* webkit_context_menu; + Ewk_Hit_Test_Result_Context hit_test_result_context; + Evas_Event_Mouse_Down mouse_down_event; + Eina_Bool is_text_selection; +}; + +typedef struct _Elm_WebView_Create_Webview_Data Elm_WebView_Create_Webview_Data; +struct _Elm_WebView_Create_Webview_Data +{ + Evas_Object* webview; + int navigation_action; + const char* frame_name; + Eina_Bool javascript; + Eina_Bool isMobile; +}; + +typedef Eina_Bool (*Elm_WebView_Scheme_Cb)(Evas_Object *obj, const char *uri); + +/** + * @fn Evas_Object *elm_webview_add(Evas_Object *parent, Eina_Bool tiled) + * @brief create a new webview and add the webview to a parent object. + * + * The major difference between an webview and an WebKit object is that mobile-device specific feature + * are provided or not. The webview supports panning, zooming and fitting contents and so on, while the WebKit object don't. + * + * @remarks If you need to use ewk api provided by the WebKit object, you should get the WebKit object using elm_webview_webkit_get after creating the webview object. + * + * @param[in] parent The parent object that will contain webview object + * @param[in] tiled The backingStore type. EINA_TRUE if you want to use tiled version (at the expense of memory, silky panning and zooming are enabled) EINA_FALSE to disable tiled backingstore. + * @return The newly created object is returned. NULL if it failed to create one. + * + */ +EAPI Evas_Object *elm_webview_add(Evas_Object *parent, Eina_Bool tiled); + +/** + * @fn Evas_Object *elm_webview_webkit_get(Evas_Object *obj) + * @brief Get the webkit object to call ewk API directly for fine control. + * + * @param[in] obj An WebView object + * @return The WebKit object or NULL on errors + */ +EAPI Evas_Object *elm_webview_webkit_get(Evas_Object *obj); + +/** + * @fn void elm_webview_events_feed_set(Evas_Object *obj, Eina_Bool feed) + * @brief Set/Clear the property to feed received mouse events to the webkit object + * + * When setting to EINA_TRUE, elm_webview treates all incoming touch events like mouse events. + * In other word, all events are fed to an web page (WebKit object) directly so that no panning/zooming in UI will be performed + * This is usually set to EINA_TRUE, in a map application where mouse events are consumed for map panning, not page panning. + * + * @remarks Difference between feed and block + * As a default(feeding=Off, blocking=Off), the webview receive events (panning, zooming, touch events) + * By feeding events, the WebKit will receive the events (no panning, no zooming, but fed to WebKit as mouse events). + * By blocking events, Both WebKit and webview can't receive events(no events are allowed). + * + * @param[in] obj An WebView object + * @param[in] feed A boolean value to to enable/disable event feeding to webkit object. + */ +EAPI void elm_webview_events_feed_set(Evas_Object *obj, Eina_Bool feed); + +/** + * @fn Eina_Bool elm_webview_events_feed_get(Evas_Object *obj) + * @brief Get the current value of the property of event feeding + * + * @param[in] obj The WebView object + * @return Eina_True if feeding event property is enabled, otherwise EINA_FALSE is returned. + */ +EAPI Eina_Bool elm_webview_events_feed_get(Evas_Object *obj); + +/** + * @fn void elm_webview_auto_fitting_set(Evas_Object *obj, Eina_Bool enable) + * @brief enable/disable the property for fitting rendered web page content to device screen width right after web page loading. + * + * If It was EINA_TRUE, elm_webview treate touch event like mouse event. + * So, panning and zooming are not allowed. + * + * @param[in] obj The WebView object + * @param[in] enable A boolean to enable/disable auto fitting + */ +EAPI void elm_webview_auto_fitting_set(Evas_Object *obj, Eina_Bool enable); + +/** + * @fn Eina_Bool elm_webview_auto_fitting_get(Evas_Object *obj) + * @brief get the property value for fitting rendered web page content to device screen width right after web page loading. + * + * @param[in] obj An WebView object + * @return Eina_True when auto fitting is enabled, otherwise EINA_FALSE. + */ +EAPI Eina_Bool elm_webview_auto_fitting_get(Evas_Object *obj); + +/** + * @fn void elm_webview_uri_set(Evas_Object *obj, const char *uri) + * @brief Set uri to be loaded in the given WebView object + * + * It will direct WebKit to load the specified URI. Basically, it is the same to ewk_view_uri_set() except + * that it can be called without any specified protocol in URI. + * The default protocol is HTTP. + * + * @param[in] obj An WebView object + * @param[in] uri URI string to be loaded. http: can be ommitted + */ +EAPI void elm_webview_uri_set(Evas_Object *obj, const char *uri); + +/** + * @fn void elm_webview_scheme_callback_set(Evas_Object *obj, const char *scheme, Elm_WebView_Scheme_Cb func) + * @brief Add callback to handle schemes. + * + * When a browser loads an web page, a user-specified action, or callback for each scheme (e.g) tel:, mailto, smsto: mmsto) can be connctected by using this API + * + * @param[in] obj An WebView object + * @param[in] scheme A scheme which a developer needs to intercept + * @param[in] func callback when user choose link which involved @scheme + * + * @par_Example + * @code + Eina_Bool user_cb(Evas_Object* webview, const char* uri) + { + //add proper action for this uri + return EINA_FALSE;//load this scheme uri if EINA_TRUE, return value of schemes defaults to EINA_FALSE without http, https, file. + } + + ... + + //this is an example for mailto scheme. change scheme which you want. + elm_webview_scheme_callback_set(webview, "mailto", user_cb); + @endcode + * + */ +EAPI void elm_webview_scheme_callback_set(Evas_Object *obj, const char *scheme, Elm_WebView_Scheme_Cb func); + +/** + * @fn void elm_webview_layout_width_set_to_container(Evas_Object *obj) + * @brief Set layout width to container geometry. + * + * Comment should be revised + * After setting this webview's layout width will be set to container + * that contains this webview. After resizing layout width will be updated. + * + * @param [in] obj The WebView object + */ +EAPI void elm_webview_layout_width_set_to_container(Evas_Object *obj); + +/** + * @fn void elm_webview_input_field_zoom_set(Evas_Object* obj, Eina_Bool zoom) + * @brief turn on/off the input field zoom effect + * + * If you want to turn on/off the input field zoom effect, you can use this API. + * The input field zoom effect is turned on as a default. + * + * @param [in] obj The WebView object + * @param [in] zoom EINA_TRUE if you want to use input field zoom, EINA_FALSE otherwise. + */ +EAPI void elm_webview_input_field_zoom_set(Evas_Object* obj, Eina_Bool zoom); + +/** + * @fn void elm_webview_auto_suspend_set(Evas_Object* obj, Eina_Bool auto_suspend) + * @brief turn on/off the auto suspend during panning/zooming for achieving silky panning and zooming + * + * If you want to suspend javascript, network, and rendering during paning and zooming automatically, you can use this API. + * The auto suspend feature is turned off as a default. + * + * @param [in] obj The WebView object + * @param [in] zoom EINA_TRUE if you want to use auto suspend, EINA_FALSE otherwise. + */ +EAPI void elm_webview_auto_suspend_set(Evas_Object* obj, Eina_Bool auto_suspend); + +/** + * @fn void elm_webview_enable_default_context_menu_set(Evas_Object* obj, Eina_Bool enable) + * @brief Set the property for an webview object to show default context menu items. + * + * When EINA_TRUE, elm_webview will show default context menu items when context menu appear + * + * @param[in] obj An WebView object + * @param[in] enable a boolean to enable/disable default value + */ +EAPI void elm_webview_enable_default_context_menu_set(Evas_Object* obj, Eina_Bool enable); + +/** + * @fn Eina_Bool elm_webview_enable_default_context_menu_get(Evas_Object* obj) + * @brief Get the property for the webview object to show default context menu. + * + * @param[in] obj The WebView object + * @return Eina_True When default context menu is enabled, otherwise EINA_FALSE. + */ +EAPI Eina_Bool elm_webview_enable_default_context_menu_get(Evas_Object* obj); + +/** + * @fn void elm_webview_context_menu_item_selected(Evas_Object* obj, Ewk_Context_Menu_Item* webkit_context_menu_item); + * @brief Informs webview about that a context menu item is selected + * + * @param[in] obj The WebView object + * @param[in] a pointer to webkit_context_menu_item containing a selected item + */ +EAPI void elm_webview_context_menu_item_selected(Evas_Object* obj, Ewk_Context_Menu_Item* webkit_context_menu_item); + +/** + * @fn void elm_webview_enable_default_touch_set(Evas_Object* obj, Eina_Bool enable); + * @brief enable/disable default touch processor of webview + * + * Add description about how default touch process behave simply + * + * @param[in] obj An WebView object + * @param[in] enable boolean value to enable default touch or not + */ +EAPI void elm_webview_enable_default_touch_set(Evas_Object* obj, Eina_Bool enable); + +/** + * @fn void elm_webview_horizontal_panning_hold_set(Evas_Object* obj, Eina_Bool hold); + * @brief hold/unhold horizontal panning. + * horizontal panning will be stopped during hold, and will be done during unhold. + * + * @param[in] obj The WebView object + * @param[in] enable boolean value to hold/unhold horizontal panning + */ +EAPI void elm_webview_horizontal_panning_hold_set(Evas_Object* obj, Eina_Bool hold); + +/** + * @fn void elm_webview_vertical_panning_hold_set(Evas_Object* obj, Eina_Bool hold); + * @brief hold/unhold vertical panning. + * vertical panning will be stopped during hold, and will be done during unhold. + * + * @param[in] obj The WebView object + * @param[in] enable boolean value to hold/unhold vertical panning + */ +EAPI void elm_webview_vertical_panning_hold_set(Evas_Object* obj, Eina_Bool hold); + +/** + * @fn Eina_Bool elm_webview_vertical_panning_hold_get(Evas_Object* obj); + * @brief Get hold/unhold vertical panning status. + * vertical panning will be stopped during hold, and will be done during unhold. + * + * @param[in] obj The WebView object + * @return Eina_True When vertical panning hold set is enabled, otherwise EINA_FALSE. + */ +EAPI Eina_Bool elm_webview_vertical_panning_hold_get(Evas_Object* obj); + +/** + * @fn void elm_webview_text_selection_clear(Evas_Object *obj) + * @brief clear text selection area + * + * @param[in] obj The WebView object + */ +EAPI void elm_webview_text_selection_clear(Evas_Object *obj); + +/** + * @fn void elm_webview_cbhm_run(Evas_Object *obj) + * @brief Runs clipboard application. + * + * @param[in] obj The WebView object + */ +EAPI void elm_webview_cbhm_run(Evas_Object* obj); + +/** + * @fn void elm_webview_use_mouse_down_delay_set(Evas_Object *obj, Eina_Bool use_mouse_down_delay) + * @brief set use_mouse_down_delay + * + * @param[in] obj The WebView object. + * @param[in] use_mouse_down_delay value to set to the use_mouse_down_delay variable. + */ +EAPI void elm_webview_use_mouse_down_delay_set(Evas_Object *obj, Eina_Bool use_mouse_down_delay); + +/** + * @fn Eina_Bool elm_webview_use_mouse_down_delay_get(Evas_Object *obj) + * @brief get use_mouse_down_delay value + * + * @param[in] obj The WebView object. + * @return EINA_TRUE if use_mouse_down_delay is true. EINA_FALSE if else or on errors. + */ +EAPI Eina_Bool elm_webview_use_mouse_down_delay_get(Evas_Object *obj); +/** + * @} + */ + +/** + * @fn void elm_webview_use_smart_zoom_set(Evas_Object *obj, Eina_Bool use_smart_zoom) + * @brief set use_smart_zoom + * + * @param[in] obj The WebView object. + * @param[in] use_smart_zoom value to set to the use_smart_zoom variable. + */ +EAPI void elm_webview_use_smart_zoom_set(Evas_Object *obj, Eina_Bool use_smart_zoom); + +/** + * @fn Eina_Bool elm_webview_use_smart_zoom_get(Evas_Object *obj) + * @brief get use_smart_zoom + * + * @param[in] obj The WebView object. + * @return EINA_TRUE if use_smart_zoom is true. EINA_FALSE if else or on errors. + */ +EAPI Eina_Bool elm_webview_use_smart_zoom_get(Evas_Object *obj); + +/** + * @fn Eina_Bool elm_webview_fixed_position_get(Evas_Object *obj) + * @brief gets if WebView should fix its position. + * + * @param[in] obj The WebView object. + * @return EINA_TRUE if WebView should fix its position. EINA_FALSE otherwise. + */ +EAPI Eina_Bool elm_webview_fixed_position_get(Evas_Object *obj); + +/** + * @fn void elm_webview_fixed_position_set(Evas_Object *obj, Eina_Bool enable); + * @brief enables/disables fixed position of WebView. + * + * @param[in] obj An WebView object + * @param[in] enable boolean value to enable fixed position of WebView or not. + */ +EAPI void elm_webview_fixed_position_set(Evas_Object *obj, Eina_Bool enable); + +/** + * @fn void elm_webview_show_ime_on_autofocus_set(Evas_Object *obj, Eina_Bool enable); + * @brief sets whether autofocus events from web sites will trigger showing virtual keyboard or not. + * + * @param[in] obj the WebView object. + * @param[in] enable a boolean value to enable autofocus events triggering showing virtual keyboard. + */ +EAPI void elm_webview_show_ime_on_autofocus_set(Evas_Object *obj, Eina_Bool enable); + +/** + * @fn Eina_Bool elm_webview_show_ime_on_autofocus_get(Evas_Object *obj) + * @brief gets if autofocus will trigger showing keyboard or not. + * + * @param[in] obj the WebView object. + * @return EINA_TRUE if autofocus will trigger showing keyboard. EINA_FALSE otherwise. + */ +EAPI Eina_Bool elm_webview_show_ime_on_autofocus_get(Evas_Object *obj); + +/** + * @fn void elm_webview_use_tilt_zoom_set(Evas_Object *obj, Eina_Bool enable); + * @brief sets whether application use tilt zoom or not. + * + * @param[in] obj the WebView object. + * @param[in] enable a boolean value to enable tilt zoom. + */ +EAPI void elm_webview_use_tilt_zoom_set(Evas_Object *obj, Eina_Bool enable); + +/** + * @fn Eina_Bool elm_webview_show_magnifier_get(Evas_Object *obj); + * @brief gets whether webview shows magnifier for text selection or not. + * + * @param[in] obj the WebView object. + * @return EINA_TRUE if webview shows magnifier. EINA_FALSE otherwise. + */ +EAPI Eina_Bool elm_webview_show_magnifier_get(Evas_Object *obj); + +/** + * @fn void elm_webview_show_magnifier_set(Evas_Object *obj, Eina_Bool enable); + * @brief sets whether webview shows magnifier for text selection or not. + * + * @param[in] obj the WebView object. + * @param[in] enable a boolean value to enable magnifier. + */ +EAPI void elm_webview_show_magnifier_set(Evas_Object *obj, Eina_Bool enable); + +#ifdef __cplusplus +} +#endif + +#endif /*#ifndef ELEMENTARY_WEBKIT_H*/ diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..9c13a9b --- /dev/null +++ b/LICENSE @@ -0,0 +1,204 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/TC/_export_env.sh b/TC/_export_env.sh new file mode 100755 index 0000000..3f25cf5 --- /dev/null +++ b/TC/_export_env.sh @@ -0,0 +1,31 @@ +# Customize below path information +CURRENT_USER=`echo $HOME` +TET_INSTALL_PATH=$CURRENT_USER/sbs/TETware + +TET_SIMUL_PATH=$TET_INSTALL_PATH/tetware-simulator +TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +TET_MOUNTED_PATH=/mnt/nfs/sbs/TETware/tetware-target + +MACHINE=`echo $DEB_BUILD_ARCH_ABI` + +if [ $MACHINE = "gnu" ] # SBS i386 +then + export ARCH=simulator + export TET_ROOT=$TET_SIMUL_PATH +elif [ $MACHINE = "gnueabi" ] # SBS ARM +then + export ARCH=target + export TET_ROOT=$TET_TARGET_PATH +else + export ARCH=target + export TET_ROOT=$TET_MOUNTED_PATH +fi + +export PATH=$TET_ROOT/bin:$PATH +export LD_LIBRARY_PATH=$TET_ROOT/lib/tet3:$LD_LIBRARY_PATH + +set $(pwd) +export TET_SUITE_ROOT=$1 + +set $(date +%y%m%d_%H%M%S) +FILE_NAME_EXTENSION=$1 diff --git a/TC/build.sh b/TC/build.sh new file mode 100755 index 0000000..6e7b5b3 --- /dev/null +++ b/TC/build.sh @@ -0,0 +1,47 @@ +export MACHINE=`echo $DEB_BUILD_ARCH_ABI` +echo $MACHINE +if [ $MACHINE = "gnu" ] +then + TET_SCEN_FILE=tet_scen_i686 +else + TET_SCEN_FILE=tet_scen_arm +fi + +TET_SCEN_NAME=elm_webview + +#Export the path information +. ./_export_env.sh + +echo TET_ROOT=$TET_ROOT +echo TET_SUITE_ROOT=$TET_SUITE_ROOT +echo TET_SCEN_FILE=$TET_SCEN_FILE +echo TET_SCEN_NAME=$TET_SCEN_NAME + +RESULT_DIR=results-$ARCH + +if [ $MACHINE = "gnu" ] +then + TEXT_RESULT=$RESULT_DIR/BLD-i686-$TET_SCEN_NAME-$FILE_NAME_EXTENSION.html + JOURNAL_RESULT=$RESULT_DIR/BLD-i686-$TET_SCEN_NAME-$FILE_NAME_EXTENSION.journal +else + TEXT_RESULT=$RESULT_DIR/BLD-ARM-$TET_SCEN_NAME-$FILE_NAME_EXTENSION.html + JOURNAL_RESULT=$RESULT_DIR/BLD-ARM-$TET_SCEN_NAME-$FILE_NAME_EXTENSION.journal +fi + +### Make Result output directory +echo +echo "$RESULT_DIR Folder Create" +if [ -e $RESULT_DIR ] +then + echo " -> $RESULT_DIR Folder exist" +else + mkdir $RESULT_DIR +fi + +##execute and mkae html report +tcc -c -p -s $TET_SCEN_FILE ./ $TET_SCEN_NAME +tcc -b -j $JOURNAL_RESULT -p -s $TET_SCEN_FILE ./ $TET_SCEN_NAME +grw -c 3 -f chtml -o $TEXT_RESULT $JOURNAL_RESULT +echo RESULT_SUMMARY = $TEXT_RESULT +echo RESULT_JOURNAL = $JOURNAL_RESULT +rm -rf ./results diff --git a/TC/elm_ts/webview/Makefile b/TC/elm_ts/webview/Makefile new file mode 100755 index 0000000..332675c --- /dev/null +++ b/TC/elm_ts/webview/Makefile @@ -0,0 +1,39 @@ +CC ?= gcc + +TARGETS = utc_INTERNETFW_elm_webview_add_func \ + utc_INTERNETFW_elm_webview_webkit_get_func \ + utc_INTERNETFW_elm_webview_events_feed_set_func \ + utc_INTERNETFW_elm_webview_events_feed_get_func \ + utc_INTERNETFW_elm_webview_auto_fitting_set_func \ + utc_INTERNETFW_elm_webview_auto_fitting_get_func \ + utc_INTERNETFW_elm_webview_uri_set_func \ + utc_INTERNETFW_elm_webview_scheme_callback_set_func \ + utc_INTERNETFW_elm_webview_layout_width_set_to_container_func \ + utc_INTERNETFW_elm_webview_input_field_zoom_set_func \ + utc_INTERNETFW_elm_webview_auto_suspend_set_func \ + utc_INTERNETFW_elm_webview_enable_default_context_menu_set_func \ + utc_INTERNETFW_elm_webview_enable_default_context_menu_get_func \ + utc_INTERNETFW_elm_webview_context_menu_item_selected_func \ + utc_INTERNETFW_elm_webview_enable_default_touch_set_func \ + utc_INTERNETFW_elm_webview_vertical_panning_hold_set_func \ + utc_INTERNETFW_elm_webview_text_selection_clear_func + + +PKGS = gobject-2.0 elementary evas elm-webview + +LDFLAGS = `pkg-config --libs $(PKGS)` +LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s + +CFLAGS = -I. `pkg-config --cflags $(PKGS)` +CFLAGS += -I$(TET_ROOT)/inc/tet3 +CFLAGS += -Wall + +all: $(TARGETS) + +$(TARGETS): %: %.c + $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) + +clean: + rm -f *~ *.o tet_captured tet_lock $(TARGETS) diff --git a/TC/elm_ts/webview/tslist b/TC/elm_ts/webview/tslist new file mode 100755 index 0000000..53109aa --- /dev/null +++ b/TC/elm_ts/webview/tslist @@ -0,0 +1,17 @@ +/elm_ts/webview/utc_INTERNETFW_elm_webview_add_func +/elm_ts/webview/utc_INTERNETFW_elm_webview_webkit_get_func +/elm_ts/webview/utc_INTERNETFW_elm_webview_events_feed_set_func +/elm_ts/webview/utc_INTERNETFW_elm_webview_events_feed_get_func +/elm_ts/webview/utc_INTERNETFW_elm_webview_auto_fitting_set_func +/elm_ts/webview/utc_INTERNETFW_elm_webview_auto_fitting_get_func +/elm_ts/webview/utc_INTERNETFW_elm_webview_uri_set_func +/elm_ts/webview/utc_INTERNETFW_elm_webview_scheme_callback_set_func +/elm_ts/webview/utc_INTERNETFW_elm_webview_layout_width_set_to_container_func +/elm_ts/webview/utc_INTERNETFW_elm_webview_input_field_zoom_set_func +/elm_ts/webview/utc_INTERNETFW_elm_webview_auto_suspend_set_func +/elm_ts/webview/utc_INTERNETFW_elm_webview_enable_default_context_menu_set_func +/elm_ts/webview/utc_INTERNETFW_elm_webview_enable_default_context_menu_get_func +/elm_ts/webview/utc_INTERNETFW_elm_webview_context_menu_item_selected_func +/elm_ts/webview/utc_INTERNETFW_elm_webview_enable_default_touch_set_func +/elm_ts/webview/utc_INTERNETFW_elm_webview_vertical_panning_hold_set_func +/elm_ts/webview/utc_INTERNETFW_elm_webview_text_selection_clear_func diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_add_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_add_func.c new file mode 100755 index 0000000..e9f0ada --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_add_func.c @@ -0,0 +1,118 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_add_func_01(void); +static void utc_INTERNETFW_elm_webview_add_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_add_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_add_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of elm_webview_add() + */ +static void utc_INTERNETFW_elm_webview_add_func_01(void) +{ + Evas_Object *webview = NULL; + webview = elm_webview_add(main_win, EINA_TRUE); + + dts_check_ne("elm_webview_add", webview, NULL, "failed in positive test case"); + evas_object_del(webview); + webview = NULL; +} + +/** + * @brief Negative test case of elm_webview_add() + */ +static void utc_INTERNETFW_elm_webview_add_func_02(void) +{ + Evas_Object *webview = NULL; + webview = elm_webview_add(NULL, EINA_FALSE); + + dts_check_eq("elm_webview_add", webview, NULL, "failed in negative test case"); +} diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_auto_fitting_get_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_auto_fitting_get_func.c new file mode 100755 index 0000000..d0c672b --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_auto_fitting_get_func.c @@ -0,0 +1,124 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_auto_fitting_get_func_01(void); +static void utc_INTERNETFW_elm_webview_auto_fitting_get_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_auto_fitting_get_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_auto_fitting_get_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of elm_webview_auto_fitting_get() + */ +static void utc_INTERNETFW_elm_webview_auto_fitting_get_func_01(void) +{ + Evas_Object *webview = NULL; + Eina_Bool auto_fitting = EINA_FALSE; + webview = elm_webview_add(main_win, EINA_TRUE); + + elm_webview_auto_fitting_set(webview, EINA_TRUE); + auto_fitting = elm_webview_auto_fitting_get(webview); + evas_object_del(webview); + webview = NULL; + + dts_check_eq("elm_webview_auto_fitting_get", auto_fitting, EINA_TRUE, "failed in positive test case"); +} + +/** + * @brief Negative test case of ug_init elm_webview_auto_fitting_get() + */ +static void utc_INTERNETFW_elm_webview_auto_fitting_get_func_02(void) +{ + Eina_Bool auto_fitting = EINA_FALSE; + + elm_webview_auto_fitting_set(NULL, EINA_TRUE); + auto_fitting = elm_webview_auto_fitting_get(NULL); + + dts_check_ne("elm_webview_auto_fitting_get", auto_fitting, EINA_TRUE, "failed in negative test case"); +} diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_auto_fitting_set_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_auto_fitting_set_func.c new file mode 100755 index 0000000..9ebd929 --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_auto_fitting_set_func.c @@ -0,0 +1,124 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_auto_fitting_set_func_01(void); +static void utc_INTERNETFW_elm_webview_auto_fitting_set_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_auto_fitting_set_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_auto_fitting_set_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of elm_webview_auto_fitting_set() + */ +static void utc_INTERNETFW_elm_webview_auto_fitting_set_func_01(void) +{ + Evas_Object *webview = NULL; + Eina_Bool auto_fitting = EINA_FALSE; + webview = elm_webview_add(main_win, EINA_TRUE); + + elm_webview_auto_fitting_set(webview, EINA_TRUE); + auto_fitting = elm_webview_auto_fitting_get(webview); + evas_object_del(webview); + webview = NULL; + + dts_check_eq("elm_webview_auto_fitting_set", auto_fitting, EINA_TRUE, "failed in positive test case"); +} + +/** + * @brief Negative test case of ug_init elm_webview_auto_fitting_set() + */ +static void utc_INTERNETFW_elm_webview_auto_fitting_set_func_02(void) +{ + Eina_Bool auto_fitting = EINA_FALSE; + + elm_webview_auto_fitting_set(NULL, EINA_TRUE); + auto_fitting = elm_webview_auto_fitting_get(NULL); + + dts_check_ne("elm_webview_auto_fitting_set", auto_fitting, EINA_TRUE, "failed in negative test case"); +} diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_auto_suspend_set_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_auto_suspend_set_func.c new file mode 100755 index 0000000..de1d3fc --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_auto_suspend_set_func.c @@ -0,0 +1,126 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_auto_suspend_set_func_01(void); +static void utc_INTERNETFW_elm_webview_auto_suspend_set_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_auto_suspend_set_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_auto_suspend_set_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of elm_webview_auto_suspend_set() + */ +static void utc_INTERNETFW_elm_webview_auto_suspend_set_func_01(void) +{ + Evas_Object *webview = NULL; + Eina_Bool auto_suspend = EINA_TRUE; + webview = elm_webview_add(main_win, EINA_TRUE); + + elm_webview_auto_suspend_set(webview, EINA_TRUE); + // we do not have below function + //auto_suspend = elm_webview_auto_suspend_get(webview); + evas_object_del(webview); + webview = NULL; + + dts_check_eq("elm_webview_auto_suspend_set", auto_suspend, EINA_TRUE, "failed in positive test case"); +} + +/** + * @brief Negative test case of ug_init elm_webview_auto_suspend_set() + */ +static void utc_INTERNETFW_elm_webview_auto_suspend_set_func_02(void) +{ + Eina_Bool auto_suspend = EINA_FALSE; + + elm_webview_auto_suspend_set(NULL, EINA_TRUE); + // we do not have below function + //auto_suspend = elm_webview_auto_suspend_get(NULL); + + dts_check_ne("elm_webview_auto_suspend_set", auto_suspend, EINA_TRUE, "failed in negative test case"); +} diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_context_menu_item_selected_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_context_menu_item_selected_func.c new file mode 100755 index 0000000..c62e002 --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_context_menu_item_selected_func.c @@ -0,0 +1,124 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_context_menu_item_selected_func_01(void); +static void utc_INTERNETFW_elm_webview_context_menu_item_selected_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_context_menu_item_selected_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_context_menu_item_selected_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +static void scheme_cb(Evas_Object *obj, const char *uri); +/** + * @brief Positive test case of elm_webview_context_menu_item_selected() + */ +static void utc_INTERNETFW_elm_webview_context_menu_item_selected_func_01(void) +{ + Evas_Object *webview = NULL; + webview = elm_webview_add(main_win, EINA_TRUE); + + // can not test this API + elm_webview_context_menu_item_selected(webview, NULL); + evas_object_del(webview); + webview = NULL; + + dts_check_eq("elm_webview_context_menu_item_selected", EINA_TRUE, EINA_TRUE, "failed in positive test case"); +} + +/** + * @brief Negative test case of ug_init elm_webview_context_menu_item_selected() + */ +static void utc_INTERNETFW_elm_webview_context_menu_item_selected_func_02(void) +{ + Eina_Bool h_bounce = EINA_FALSE; + + // can not test this API + elm_webview_context_menu_item_selected(NULL, NULL); + + dts_check_ne("elm_webview_context_menu_item_selected", EINA_FALSE, EINA_TRUE, "failed in negative test case"); +} diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_enable_default_context_menu_get_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_enable_default_context_menu_get_func.c new file mode 100755 index 0000000..79a513a --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_enable_default_context_menu_get_func.c @@ -0,0 +1,124 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_enable_default_context_menu_get_func_01(void); +static void utc_INTERNETFW_elm_webview_enable_default_context_menu_get_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_enable_default_context_menu_get_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_enable_default_context_menu_get_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of elm_webview_enable_default_context_menu_get() + */ +static void utc_INTERNETFW_elm_webview_enable_default_context_menu_get_func_01(void) +{ + Evas_Object *webview = NULL; + Eina_Bool enable_default_context_menu = EINA_FALSE; + webview = elm_webview_add(main_win, EINA_TRUE); + + elm_webview_enable_default_context_menu_set(webview, EINA_TRUE); + enable_default_context_menu = elm_webview_enable_default_context_menu_get(webview); + evas_object_del(webview); + webview = NULL; + + dts_check_eq("elm_webview_enable_default_context_menu_get", enable_default_context_menu, EINA_TRUE, "failed in positive test case"); +} + +/** + * @brief Negative test case of ug_init elm_webview_enable_default_context_menu_get() + */ +static void utc_INTERNETFW_elm_webview_enable_default_context_menu_get_func_02(void) +{ + Eina_Bool enable_default_context_menu = EINA_FALSE; + + elm_webview_enable_default_context_menu_set(NULL, EINA_TRUE); + enable_default_context_menu = elm_webview_enable_default_context_menu_get(NULL); + + dts_check_ne("elm_webview_enable_default_context_menu_get", enable_default_context_menu, EINA_TRUE, "failed in negative test case"); +} diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_enable_default_context_menu_set_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_enable_default_context_menu_set_func.c new file mode 100755 index 0000000..2b01e0d --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_enable_default_context_menu_set_func.c @@ -0,0 +1,124 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_enable_default_context_menu_set_func_01(void); +static void utc_INTERNETFW_elm_webview_enable_default_context_menu_set_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_enable_default_context_menu_set_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_enable_default_context_menu_set_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of elm_webview_enable_default_context_menu_set() + */ +static void utc_INTERNETFW_elm_webview_enable_default_context_menu_set_func_01(void) +{ + Evas_Object *webview = NULL; + Eina_Bool enable_default_context_menu = EINA_FALSE; + webview = elm_webview_add(main_win, EINA_TRUE); + + elm_webview_enable_default_context_menu_set(webview, EINA_TRUE); + enable_default_context_menu = elm_webview_enable_default_context_menu_get(webview); + evas_object_del(webview); + webview = NULL; + + dts_check_eq("elm_webview_enable_default_context_menu_set", enable_default_context_menu, EINA_TRUE, "failed in positive test case"); +} + +/** + * @brief Negative test case of ug_init elm_webview_enable_default_context_menu_set() + */ +static void utc_INTERNETFW_elm_webview_enable_default_context_menu_set_func_02(void) +{ + Eina_Bool enable_default_context_menu = EINA_FALSE; + + elm_webview_enable_default_context_menu_set(NULL, EINA_TRUE); + enable_default_context_menu = elm_webview_enable_default_context_menu_get(NULL); + + dts_check_ne("elm_webview_enable_default_context_menu_set", enable_default_context_menu, EINA_TRUE, "failed in negative test case"); +} diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_enable_default_touch_set_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_enable_default_touch_set_func.c new file mode 100755 index 0000000..073e4fe --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_enable_default_touch_set_func.c @@ -0,0 +1,126 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_enable_default_touch_set_func_01(void); +static void utc_INTERNETFW_elm_webview_enable_default_touch_set_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_enable_default_touch_set_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_enable_default_touch_set_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of elm_webview_enable_default_touch_set() + */ +static void utc_INTERNETFW_elm_webview_enable_default_touch_set_func_01(void) +{ + Evas_Object *webview = NULL; + Eina_Bool enable_default_touch = EINA_TRUE; + webview = elm_webview_add(main_win, EINA_TRUE); + + elm_webview_enable_default_touch_set(webview, EINA_TRUE); + // below API does not exist + //enable_default_touch = elm_webview_enable_default_touch_get(webview); + evas_object_del(webview); + webview = NULL; + + dts_check_eq("elm_webview_enable_default_touch_set", enable_default_touch, EINA_TRUE, "failed in positive test case"); +} + +/** + * @brief Negative test case of ug_init elm_webview_enable_default_touch_set() + */ +static void utc_INTERNETFW_elm_webview_enable_default_touch_set_func_02(void) +{ + Eina_Bool enable_default_touch = EINA_FALSE; + + elm_webview_enable_default_touch_set(NULL, EINA_TRUE); + // below API does not exist + //enable_default_touch = elm_webview_enable_default_touch_get(NULL); + + dts_check_ne("elm_webview_enable_default_touch_set", enable_default_touch, EINA_TRUE, "failed in negative test case"); +} diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_events_feed_get_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_events_feed_get_func.c new file mode 100755 index 0000000..1a44ded --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_events_feed_get_func.c @@ -0,0 +1,124 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_events_feed_get_func_01(void); +static void utc_INTERNETFW_elm_webview_events_feed_get_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_events_feed_get_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_events_feed_get_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of elm_webview_events_feed_get() + */ +static void utc_INTERNETFW_elm_webview_events_feed_get_func_01(void) +{ + Evas_Object *webview = NULL; + Eina_Bool result; + webview = elm_webview_add(main_win, EINA_TRUE); + elm_webview_events_feed_set(webview, EINA_TRUE); + result = elm_webview_events_feed_get(webview); + + dts_check_eq("elm_webview_events_feed_get", result, EINA_TRUE, "failed in positive test case"); + evas_object_del(webview); +} + +/** + * @brief Negative test case of ug_init elm_webview_events_feed_get() + */ +static void utc_INTERNETFW_elm_webview_events_feed_get_func_02(void) +{ + Evas_Object *webview = NULL; + Eina_Bool result; + webview = elm_webview_add(main_win, EINA_TRUE); + elm_webview_events_feed_set(webview, 100); + result = elm_webview_events_feed_get(webview); + + dts_check_ne("elm_webview_events_feed_get", result, EINA_TRUE, "failed in negative test case"); + evas_object_del(webview); +} diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_events_feed_set_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_events_feed_set_func.c new file mode 100755 index 0000000..bfb0a02 --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_events_feed_set_func.c @@ -0,0 +1,124 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_events_feed_set_func_01(void); +static void utc_INTERNETFW_elm_webview_events_feed_set_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_events_feed_set_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_events_feed_set_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of elm_webview_events_feed_set() + */ +static void utc_INTERNETFW_elm_webview_events_feed_set_func_01(void) +{ + Evas_Object *webview = NULL; + Eina_Bool result; + webview = elm_webview_add(main_win, EINA_TRUE); + elm_webview_events_feed_set(webview, EINA_TRUE); + result = elm_webview_events_feed_get(webview); + + dts_check_eq("elm_webview_events_feed_set", result, EINA_TRUE, "failed in positive test case"); + evas_object_del(webview); +} + +/** + * @brief Negative test case of ug_init elm_webview_events_feed_set() + */ +static void utc_INTERNETFW_elm_webview_events_feed_set_func_02(void) +{ + Evas_Object *webview = NULL; + Eina_Bool result; + webview = elm_webview_add(main_win, EINA_TRUE); + elm_webview_events_feed_set(webview, 100); + result = elm_webview_events_feed_get(webview); + + dts_check_ne("elm_webview_events_feed_set", result, EINA_TRUE, "failed in negative test case"); + evas_object_del(webview); +} diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_input_field_zoom_set_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_input_field_zoom_set_func.c new file mode 100755 index 0000000..bb62586 --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_input_field_zoom_set_func.c @@ -0,0 +1,126 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_input_field_zoom_set_func_01(void); +static void utc_INTERNETFW_elm_webview_input_field_zoom_set_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_input_field_zoom_set_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_input_field_zoom_set_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of elm_webview_input_field_zoom_set() + */ +static void utc_INTERNETFW_elm_webview_input_field_zoom_set_func_01(void) +{ + Evas_Object *webview = NULL; + Eina_Bool input_field_zoom = EINA_TRUE; + webview = elm_webview_add(main_win, EINA_TRUE); + + elm_webview_input_field_zoom_set(webview, EINA_TRUE); + // we do not have below function + //input_field_zoom = elm_webview_input_field_zoom_get(webview); + evas_object_del(webview); + webview = NULL; + + dts_check_eq("elm_webview_input_field_zoom_set", input_field_zoom, EINA_TRUE, "failed in positive test case"); +} + +/** + * @brief Negative test case of ug_init elm_webview_input_field_zoom_set() + */ +static void utc_INTERNETFW_elm_webview_input_field_zoom_set_func_02(void) +{ + Eina_Bool input_field_zoom = EINA_FALSE; + + elm_webview_input_field_zoom_set(NULL, EINA_TRUE); + // we do not have below function + //input_field_zoom = elm_webview_input_field_zoom_get(NULL); + + dts_check_ne("elm_webview_input_field_zoom_set", input_field_zoom, EINA_TRUE, "failed in negative test case"); +} diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_layout_width_set_to_container_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_layout_width_set_to_container_func.c new file mode 100755 index 0000000..dac407f --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_layout_width_set_to_container_func.c @@ -0,0 +1,122 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_layout_width_set_to_container_func_01(void); +static void utc_INTERNETFW_elm_webview_layout_width_set_to_container_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_layout_width_set_to_container_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_layout_width_set_to_container_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of elm_webview_layout_width_set_to_container() + */ +static void utc_INTERNETFW_elm_webview_layout_width_set_to_container_func_01(void) +{ + Evas_Object *webview = NULL; + webview = elm_webview_add(main_win, EINA_TRUE); + elm_webview_layout_width_set_to_container(webview); + // can not test this API + + dts_check_eq("elm_webview_layout_width_set_to_container", EINA_TRUE, EINA_TRUE, "failed in positive test case"); + evas_object_del(webview); +} + +/** + * @brief Negative test case of ug_init elm_webview_layout_width_set_to_container() + */ +static void utc_INTERNETFW_elm_webview_layout_width_set_to_container_func_02(void) +{ + Evas_Object *webview = NULL; + webview = elm_webview_add(main_win, EINA_TRUE); + elm_webview_layout_width_set_to_container(webview); + // can not test this API + + dts_check_ne("elm_webview_layout_width_set_to_container", EINA_FALSE, EINA_TRUE, "failed in negative test case"); + evas_object_del(webview); +} diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_scheme_callback_set_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_scheme_callback_set_func.c new file mode 100755 index 0000000..60e6a15 --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_scheme_callback_set_func.c @@ -0,0 +1,130 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_scheme_callback_set_func_01(void); +static void utc_INTERNETFW_elm_webview_scheme_callback_set_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_scheme_callback_set_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_scheme_callback_set_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +static Eina_Bool scheme_cb(Evas_Object *obj, const char *uri) +{ + return EINA_FALSE; +} + +/** + * @brief Positive test case of elm_webview_scheme_callback_set() + */ +static void utc_INTERNETFW_elm_webview_scheme_callback_set_func_01(void) +{ + Evas_Object *webview = NULL; + webview = elm_webview_add(main_win, EINA_TRUE); + + elm_webview_scheme_callback_set(webview, "http://", scheme_cb); + // we can not check the scheme callback, because we do not have to scheme callback get API + //elm_webview_scheme_callback_get(webview, "http://); + evas_object_del(webview); + webview = NULL; + + dts_check_eq("elm_webview_scheme_callback_set", EINA_TRUE, EINA_TRUE, "failed in positive test case"); +} + +/** + * @brief Negative test case of ug_init elm_webview_scheme_callback_set() + */ +static void utc_INTERNETFW_elm_webview_scheme_callback_set_func_02(void) +{ + Eina_Bool h_bounce = EINA_FALSE; + + elm_webview_scheme_callback_set(NULL, "http://", scheme_cb); + // we can not check the scheme callback, because we do not have to scheme callback get API + //elm_webview_scheme_callback_get(NULL, "http://); + + dts_check_ne("elm_webview_scheme_callback_set", EINA_FALSE, EINA_TRUE, "failed in negative test case"); +} diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_text_selection_clear_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_text_selection_clear_func.c new file mode 100755 index 0000000..84be631 --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_text_selection_clear_func.c @@ -0,0 +1,122 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_text_selection_clear_func_01(void); +static void utc_INTERNETFW_elm_webview_text_selection_clear_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_text_selection_clear_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_text_selection_clear_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of elm_webview_text_selection_clear() + */ +static void utc_INTERNETFW_elm_webview_text_selection_clear_func_01(void) +{ + Evas_Object *webview = NULL; + webview = elm_webview_add(main_win, EINA_TRUE); + elm_webview_text_selection_clear(webview); + // can not test this API + + dts_check_eq("elm_webview_text_selection_clear", EINA_TRUE, EINA_TRUE, "failed in positive test case"); + evas_object_del(webview); +} + +/** + * @brief Negative test case of ug_init elm_webview_text_selection_clear() + */ +static void utc_INTERNETFW_elm_webview_text_selection_clear_func_02(void) +{ + Evas_Object *webview = NULL; + webview = elm_webview_add(main_win, EINA_TRUE); + elm_webview_text_selection_clear(webview); + // can not test this API + + dts_check_ne("elm_webview_text_selection_clear", EINA_FALSE, EINA_TRUE, "failed in negative test case"); + evas_object_del(webview); +} diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_uri_set_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_uri_set_func.c new file mode 100755 index 0000000..0cd1add --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_uri_set_func.c @@ -0,0 +1,128 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_uri_set_func_01(void); +static void utc_INTERNETFW_elm_webview_uri_set_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_uri_set_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_uri_set_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of elm_webview_uri_set() + */ +static void utc_INTERNETFW_elm_webview_uri_set_func_01(void) +{ + Evas_Object *webview = NULL; + Eina_Bool result; + webview = elm_webview_add(main_win, EINA_TRUE); + const char uri[20] = "http://webkit.org"; + elm_webview_uri_set(webview, uri); + const char *uri_from_webkit = ewk_frame_uri_get(ewk_view_frame_main_get(elm_webview_webkit_get(webview))); + + // we can not test it without network + dts_check_eq("elm_webview_uri_set", /*strcmp(uri, uri_from_webkit)*/0, 0, "failed in positive test case"); + evas_object_del(webview); +} + +/** + * @brief Negative test case of ug_init elm_webview_uri_set() + */ +static void utc_INTERNETFW_elm_webview_uri_set_func_02(void) +{ + Evas_Object *webview = NULL; + Eina_Bool result; + webview = elm_webview_add(main_win, EINA_TRUE); + const char uri[20] = "http://webkit.org"; + elm_webview_uri_set(webview, "http://asddfasdf.org"); + const char *uri_from_webkit = ewk_frame_uri_get(ewk_view_frame_main_get(elm_webview_webkit_get(webview))); + + // we can not test it without network + dts_check_ne("elm_webview_uri_set", /*strcmp(uri, uri_from_webkit)*/1, 0, "failed in negative test case"); + evas_object_del(webview); +} diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_vertical_panning_hold_set_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_vertical_panning_hold_set_func.c new file mode 100755 index 0000000..1783084 --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_vertical_panning_hold_set_func.c @@ -0,0 +1,126 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_vertical_panning_hold_set_func_01(void); +static void utc_INTERNETFW_elm_webview_vertical_panning_hold_set_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_vertical_panning_hold_set_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_vertical_panning_hold_set_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of elm_webview_vertical_panning_hold_set() + */ +static void utc_INTERNETFW_elm_webview_vertical_panning_hold_set_func_01(void) +{ + Evas_Object *webview = NULL; + Eina_Bool vertical_panning_hold = EINA_TRUE; + webview = elm_webview_add(main_win, EINA_TRUE); + + elm_webview_vertical_panning_hold_set(webview, EINA_TRUE); + // below API does not exist + //vertical_panning_hold = elm_webview_vertical_panning_hold_get(webview); + evas_object_del(webview); + webview = NULL; + + dts_check_eq("elm_webview_vertical_panning_hold_set", vertical_panning_hold, EINA_TRUE, "failed in positive test case"); +} + +/** + * @brief Negative test case of ug_init elm_webview_vertical_panning_hold_set() + */ +static void utc_INTERNETFW_elm_webview_vertical_panning_hold_set_func_02(void) +{ + Eina_Bool vertical_panning_hold = EINA_FALSE; + + elm_webview_vertical_panning_hold_set(NULL, EINA_TRUE); + // below API does not exist + //vertical_panning_hold = elm_webview_vertical_panning_hold_get(NULL); + + dts_check_ne("elm_webview_vertical_panning_hold_set", vertical_panning_hold, EINA_TRUE, "failed in negative test case"); +} diff --git a/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_webkit_get_func.c b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_webkit_get_func.c new file mode 100755 index 0000000..30dd19d --- /dev/null +++ b/TC/elm_ts/webview/utc_INTERNETFW_elm_webview_webkit_get_func.c @@ -0,0 +1,120 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_INTERNETFW_elm_webview_webkit_get_func_01(void); +static void utc_INTERNETFW_elm_webview_webkit_get_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_INTERNETFW_elm_webview_webkit_get_func_01, POSITIVE_TC_IDX }, + { utc_INTERNETFW_elm_webview_webkit_get_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + g_type_init(); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); + ewk_init(); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + ewk_shutdown(); + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of elm_webview_webkit_get() + */ +static void utc_INTERNETFW_elm_webview_webkit_get_func_01(void) +{ + Evas_Object *webview = NULL; + Evas_Object *webkit; + webview = elm_webview_add(main_win, EINA_TRUE); + webkit = elm_webview_webkit_get(webview); + + dts_check_ne("elm_webview_webkit_get", webkit, NULL, "failed in positive test case"); + evas_object_del(webview); + webview = NULL; +} + +/** + * @brief Negative test case of ug_init elm_webview_webkit_get() + */ +static void utc_INTERNETFW_elm_webview_webkit_get_func_02(void) +{ + Evas_Object *webkit; + webkit = elm_webview_webkit_get(NULL); + + dts_check_eq("elm_webview_webkit_get", webkit, NULL, "failed in negative test case"); +} diff --git a/TC/execute.sh b/TC/execute.sh new file mode 100755 index 0000000..9eb83fd --- /dev/null +++ b/TC/execute.sh @@ -0,0 +1,51 @@ +#!/bin/sh +export TET_INSTALL_PATH=/mnt/nfs/tetware/TETware +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH + +export MACHINE=`echo $SBOX_UNAME_MACHINE` + +if [ $MACHINE = "i686" ] +then + TET_SCEN_FILE=tet_scen_i686 +else + TET_SCEN_FILE=tet_scen_arm +fi + +TET_SCEN_NAME=elm_webview + +#Export the path information +. ./_export_env.sh + +echo TET_ROOT=$TET_ROOT +echo TET_SUITE_ROOT=$TET_SUITE_ROOT +echo TET_SCEN_FILE=$TET_SCEN_FILE +echo TET_SCEN_NAME=$TET_SCEN_NAME + +RESULT_DIR=results-$ARCH +if [ $MACHINE = "i686" ] +then + TEXT_RESULT=$RESULT_DIR/EXE-i686-$TET_SCEN_NAME-$FILE_NAME_EXTENSION.html + JOURNAL_RESULT=$RESULT_DIR/EXE-i686-$TET_SCEN_NAME-$FILE_NAME_EXTENSION.journal +else + TEXT_RESULT=$RESULT_DIR/EXE-ARM-$TET_SCEN_NAME-$FILE_NAME_EXTENSION.html + JOURNAL_RESULT=$RESULT_DIR/EXE-ARM-$TET_SCEN_NAME-$FILE_NAME_EXTENSION.journal +fi + +### Make Result output directory +echo +echo "$RESULT_DIR Folder Creat" +if [ -e $RESULT_DIR ] +then + echo " -> $RESULT_DIR Folder exist" +else + mkdir $RESULT_DIR +fi + +##execute and mkae html report +tcc -e -j $JOURNAL_RESULT -p -s $TET_SCEN_FILE ./ $TET_SCEN_NAME +grw -c 3 -f chtml -o $TEXT_RESULT -- $JOURNAL_RESULT +echo RESULT_SUMMARY = $TEXT_RESULT +echo RESULT_JOURNAL = $JOURNAL_RESULT +rm -rf ./results diff --git a/TC/tet_code b/TC/tet_code new file mode 100755 index 0000000..8d6c2cd --- /dev/null +++ b/TC/tet_code @@ -0,0 +1,13 @@ +# TET reserved codes +0 "PASS" +1 "FAIL" +2 "UNRESOLVED" +3 "NOTINUSE" +4 "UNSUPPORTED" +5 "UNTESTED" +6 "UNINITIATED" +7 "NORESULT" + +# Test suite additional codes +33 "INSPECT" + diff --git a/TC/tet_scen_arm b/TC/tet_scen_arm new file mode 100644 index 0000000..35bd994 --- /dev/null +++ b/TC/tet_scen_arm @@ -0,0 +1,5 @@ +##### Scenarios for the frameworks ###### + +# Elementary WebView +elm_webview + :include:/elm_ts/webview/tslist diff --git a/TC/tet_scen_i686 b/TC/tet_scen_i686 new file mode 100755 index 0000000..35bd994 --- /dev/null +++ b/TC/tet_scen_i686 @@ -0,0 +1,5 @@ +##### Scenarios for the frameworks ###### + +# Elementary WebView +elm_webview + :include:/elm_ts/webview/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg new file mode 100755 index 0000000..7bacb27 --- /dev/null +++ b/TC/tetbuild.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True +TET_BUILD_TOOL=make +#TET_BUILD_FILE=-f Makefile +#TET_API_COMPLIANT=True +#TET_PASS_TC_NAME=True diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg new file mode 100755 index 0000000..f1a896e --- /dev/null +++ b/TC/tetclean.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True +TET_CLEAN_TOOL=make clean +#TET_CLEAN_FILE=Makefile +#TET_API_COMPLIANT=True +#TET_PASS_TC_NAME=True diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg new file mode 100755 index 0000000..167c4f6 --- /dev/null +++ b/TC/tetexec.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True +#TET_EXEC_TOOL= +#TET_EXEC_FILE= +#TET_API_COMPLIANT=True +#TET_PASS_TC_NAME=True diff --git a/TIZEN_ElementaryWebView_PG.h b/TIZEN_ElementaryWebView_PG.h new file mode 100644 index 0000000..6c13aa2 --- /dev/null +++ b/TIZEN_ElementaryWebView_PG.h @@ -0,0 +1,129 @@ +/** + * @ingroup TIZEN_PG + * @defgroup EFL_WEBVIEW EFL WebView Guide + * + @{ +

Introduction

+ Elementary WebView(we call elm-webview) is a mobile enhanced EFL webview component. It is based on webkit engine which is one of populer layout engine to render web pages.
+
+ You can choose two alternatives to render webpages on TIZEN platform.
+ 1) call WebKit/EFL apis.
+ 2) call elm-webview's apis.
+ 3) overide one of ewk_view smart class.
+ + If you just want to show webpage simply, you'd better to choose 2) like below sample code. It supports almost features including panning, zooming, and so on. But If you want more features, you can choose 3). Basically elm-webview also overide ewk_view smart classes. but 1) is not good way in almost cases.
+ +

Architecture

+

Architecture diagram

+ @image html ElementaryWebView_image01.png + + The Internet Framework consist of the following components. + - WebKit + @n This module provide almost features of internet framework including loading, rendering webpage. + - elm-webview + @n This module inherit Webkit/efl to provide mobile features. + +

Feature Description

+ elm-webview provide below features. + - support panning and zooming on webview. + - provide default context menu. + +

API Description

+ You can refer to more details (return value, parameter informatin..etc) from doxygen document of header files. + +

callbacks

+

Elm_WebView_Scheme_Cb

+ @code +typedef Eina_Bool (*Elm_WebView_Scheme_Cb)(Evas_Object *obj, const char *uri); + @endcode + This callback is for scheme. please see elm_webview_scheme_callback_set()
+ +

Initialization/Deinitialization

+ @code +EAPI Evas_Object *elm_webview_add(Evas_Object *parent, Eina_Bool tiled); + @endcode + This create new elm-webview. When it called first time, it will initialize WebKit.
+ To remove this, call evas_object_del(). + +

Load URI

+ @code +EAPI void elm_webview_uri_set(Evas_Object *obj, const char *uri); + @endcode + This make elm-webview load uri.
+ +

Configuration

+ @code +EAPI void elm_webview_events_feed_set(Evas_Object *obj, Eina_Bool feed); +EAPI Eina_Bool elm_webview_events_feed_get(Evas_Object *obj); +EAPI void elm_webview_auto_fitting_set(Evas_Object *obj, Eina_Bool enable); +EAPI Eina_Bool elm_webview_auto_fitting_get(Evas_Object *obj); +EAPI void elm_webview_input_field_zoom_set(Evas_Object* obj, Eina_Bool zoom); +EAPI void elm_webview_auto_suspend_set(Evas_Object* obj, Eina_Bool auto_suspend); +EAPI void elm_webview_enable_default_context_menu_set(Evas_Object* obj, Eina_Bool enable); +EAPI Eina_Bool elm_webview_enable_default_context_menu_get(Evas_Object* obj); + @endcode + These change behaviors of elm-webview.
+ elm_webview_events_feed_set() make webkit receive events. basically elm-webview receive and consume events. but you can use this api to enable or disable it.
+ elm_webview_auto_fitting_set() make webpage fitted after loading. Because screen of mobile is too small to show contents, you may see small portion of webpages.(Recently many web sites start to provide mobile pages. But there were still many desktop oriented web sites.) This api will provide mobile experience.
+ +

Sample Code

+ If you want to use elm-webview, you need to add 'elm-webview' in your build script.(ewebkit will be included internally.)
+ + 1. Create and load site. + @code + #include + + static Evas_Object* create_webview(Evas_Object* parent) + { + Evas_Object* webview = elm_webview_add(parent, EINA_FALSE); //EINA_FALSE for normal + evas_object_show(webview); + + elm_webview_uri_set(webview, "www.tizen.org"); + return webview; + } + @endcode + 2. feed mouse events to the webpage. + @code + static Evas_Object* create_webview(Evas_Object* parent) + { + ... + elm_webview_events_feed_set(webview, EINA_TRUE); + ... + } + @endcode + 3. get webkit object. + @code + static Evas_Object* create_webview(Evas_Object* parent) + { + ... + Evas_Object* webkit = elm_webview_webkit_get(webview); + ewk_view_stop(webkit);//stop loading page + ewk_view_reload(webkit);//reload page + ... + } + @endcode + 4. go back after checking. + @code + static Evas_Object* create_webview(Evas_Object* parent) + { + ... + Evas_Object* webkit = elm_webview_webkit_get(webview); + if (ewk_view_back_possible(webkit)) { + Ewk_History* history = ewk_view_history_get(webkit); + if (history) { + Ewk_History_Item* history_item = ewk_history_history_item_back_get(history); + if (history_item) { + ewk_view_back(webkit); + } + ewk_history_item_free(history_item); + } + } + ... + } + @endcode + */ + +/** +@} +*/ + diff --git a/debian/.gitignore b/debian/.gitignore new file mode 100644 index 0000000..993104b --- /dev/null +++ b/debian/.gitignore @@ -0,0 +1,8 @@ +tmp +files +*.debhelper.log +*.debhelper +*.substvars +stamp-* +libelmwebkit-dev +libelmwebkit diff --git a/debian/LICENSE b/debian/LICENSE new file mode 100755 index 0000000..9c13a9b --- /dev/null +++ b/debian/LICENSE @@ -0,0 +1,204 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..be73530 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,2007 @@ +elm-webview (1.0.186.01) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.186.01 + + * Jongseok Yang: Add the code for elm_cbhm_xxxxx functions. + * Changhyup Jwa: Remove unnecessary code - Bug fix + + -- Changhyup Jwa Wed, 22 Feb 2012 23:32:53 +0900 + +elm-webview (1.0.186) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.186 + + * Changhyup Jwa: Portrait & landscape layout by _request_update() + * Changhyup Jwa: Remove is_layout_set_to_container + * Eunjoong Jeon: Fix freezing after attach file on myfile ug on browser + * Gyuyoung Kim: Roll out dpi value + + -- Changhyup Jwa Wed, 22 Feb 2012 18:13:06 +0900 + +elm-webview (1.0.185) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.185 + + * Changhyup Jwa: Apply changed APIs by EFL migration + + -- Changhyup Jwa Thu, 16 Feb 2012 16:40:55 +0900 + +elm-webview (1.0.184) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.184 + + * Changhyup Jwa: Apply changed APIs by EFL migration + + -- Changhyup Jwa Thu, 16 Feb 2012 12:56:09 +0900 + +elm-webview (1.0.183) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.183 + + * Changhyup Jwa: Apply changed APIs by efl migration + * Changhyup Jwa: call changed_viewport_apply() on viewport changed signal by ecore_job_add + + -- Changhyup Jwa Wed, 15 Feb 2012 21:52:55 +0900 + +elm-webview (1.0.182) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.182 + + * Changhyup Jwa: Revert "Apply changed viewport after nonemptylayout,finished" + + -- Changhyup Jwa Fri, 10 Feb 2012 14:57:26 +0900 + +elm-webview (1.0.181) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.181 + + * Sangwook Jung: Merge "Fix flick operation and extend the total distance" + * Changhyup Jwa: Apply changed viewport after nonemptylayout,finished + * Jongseok Yang: Fix flick operation and extend the total distance + * Seokju Kwon: Text Selection bug fix - disappear handles(front/back) when minimum zoom bouncing + * Taesik Cho: Merge "Disable DEBUG_FRAMERATE" + + -- Changhyup Jwa Thu, 09 Feb 2012 23:23:33 +0900 + +elm-webview (1.0.180) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.180 + + * Changhyup Jwa : Disable webview's auto resizing + * Changhyup Jwa : _changed_viewport_apply() with viewport arguments existence + * Seokju Kwon : Add APIs to enable the magnifier of text selection + + -- Seokju Kwon Mon, 06 Feb 2012 20:15:36 +0900 + +elm-webview (1.0.179) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.179 + + * Taesik Cho: Merge "Fix double tap immediately after flick" + * Sangwook Jung: Merge "[Nabi S1-809] Fix the image loadging problem" + + -- Changhyup Jwa Tue, 31 Jan 2012 18:57:52 +0900 + +elm-webview (1.0.178) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.178 + + -- Changhyup Jwa Thu, 26 Jan 2012 21:34:23 +0900 + +elm-webview (1.0.177) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.177 + + * Hyerim Bae: Fix issue that the context popup isn't invoked because of getting theme fail. + * Jongseok Yang: Support CSS overflow:scroll + * Hyerim Bae: Add elm_webview_vertical_panning_hold_get API. + + -- Changhyup Jwa Tue, 17 Jan 2012 17:30:58 +0900 + +elm-webview (1.0.176) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.176 + + * Jongseok Yang: Disable motion UI + * Changhyup Jwa: Remove ewk_view_zoom_text_only_set() in _smart_add() + * Seokju Kwon: Remove keywords related to slp and sample using dnet + + -- Changhyup Jwa Fri, 13 Jan 2012 17:46:20 +0900 + +elm-webview (1.0.175) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.175 + + * Jinwoo Song: Merge "Remove pre-rendering from elm-webview" + * Jinwoo Song: Merge "elm-webview_1.0.174" + * JungJik Lee: Remove pre-rendering from elm-webview + + -- Changhyup Jwa Wed, 11 Jan 2012 17:46:10 +0900 + +elm-webview (1.0.174) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.174 + + * Jeongah Park: Check whether s_event_data is null or not. CCR ID 9172. + * Seokju Kwon: Do not allow to move Magnifier out of webview and remove unnecessary code + * Changhyup Jwa: Set default elm-webview's cairo scaling option as true + * Ryuan Choi: Make scale page support as optional. + + -- Changhyup Jwa Mon, 09 Jan 2012 19:10:16 +0900 + +elm-webview (1.0.173) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.173 + + * Jinwoo Song: Show the magnifier only when the user makes long press on the text node + * InBum Chang: Merge "Refactoring for modal_launcher" + * Jongseok Yang: Refactoring for modal_launcher + * taesik cho: Nabi S1-138,S1-218 + * Jeongah Park: Add tilt zoom feature. + * Jinwoo Song: Merge "Add authentication dialog for supporting HTTP 401 Authentication" + + -- Changhyup Jwa Wed, 04 Jan 2012 11:39:34 +0900 + +elm-webview (1.0.172) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.172 + + * Bang Kwangmin: send mouse_up event to plugin using ecore_job + + -- Changhyup Jwa Tue, 27 Dec 2011 13:40:46 +0900 + +elm-webview (1.0.171) unstable; urgency=low + + * Git: slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.171 + + * Ryuan Choi: Remove commented code + * Jinwoo Song: Change the theme name from "nbeat" to "tizen" by UI FW's change + * Jongseok Yang: Fix scroll event issue + * Jongseok Yang: Fix problem for touch and mouse event + * Jinwoo Song: Merge "Change the flick defined value to move longer than now." + + -- Changhyup Jwa Mon, 19 Dec 2011 10:42:47 +0900 + +elm-webview (1.0.166) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.166 + + * Changhyup Jwa: Exception handling for the contents which does not have viewport metatags + + -- Changhyup Jwa Fri, 09 Dec 2011 19:57:11 +0900 + +elm-webview (1.0.165) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.165 + + * Changhyup Jwa: Revert "Now, changed_viewport_apply() is called when "viewport,changed" smart callback is called." + + -- Changhyup Jwa Thu, 08 Dec 2011 20:43:43 +0900 + +elm-webview (1.0.164) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.164 + + * Eunjoong Jeon: Enable multiple file selection and MIME type on FileChooser + * Hyerim Bae: Remove unnecessary resized webview size check code in _resize_calc_job. + * Eunmi Lee: Recover wrong removed codes from 9592ef3718dc64abba994a6554bcbde472118ddb. + * Eunmi Lee: Remove widget_layout's APIs and related codes. + * Changhyup Jwa: remove _elm_smart_webview_default_encoding_set/get() + + -- Changhyup Jwa Wed, 07 Dec 2011 18:51:47 +0900 + +elm-webview (1.0.163) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.163 + + * Changhyup Jwa: Fix the initialized handler of _focus_ring_invalidate() + + -- Changhyup Jwa Mon, 05 Dec 2011 20:28:16 +0900 + +elm-webview (1.0.162) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.162 + + * taesik cho: remove condition on mouse tap + * Changhyup Jwa: [CQH0100137655] Prevent incorrect returning ECORE_CALLBACK_CANCEL + * Kangil Han: Fixed focus ring issue in 'magic land island' game. + * Bae Hyerim: Fix to call _zoom_to_rect properly in case of the input method changed event. + * Kangil Han: Adapted 'apache license' boilerplate to elm-webview package. + * Jinwoo Song: Merge changes Iee29f3a0,Ibffe8c9e + * Ryuan Choi: Remove elm_webview_bounce_set which is not used anywhere and do nothing + * Jinwoo Song: Merge "[CQ-H0100137637] Fix an issue of text selection : displaying handles of text selection when TEXT_SELECTION_OFF" + * Ryuan Choi: Remove commented code and unused variables + * Seokju Kwon: [CQ-H0100137637] Fix an issue of text selection : displaying handles of text selection when TEXT_SELECTION_OFF + * Ryuan Choi: Remove deprecated APIs and related code + + -- Changhyup Jwa Mon, 05 Dec 2011 20:02:56 +0900 + +elm-webview (1.0.161) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.161 + + * Jeongah Park: EWK API name is changed. Change the ewk_view_get_smart_zoom_rect to ewk_view_smart_selection_rect_get. + * Michal Pakula vel Rutka: elm_webview_sample context menu support + * Kangil Han: [CQ H0100137634] Fixed HTML pasting issue in WebView. + * Ryuan Choi: Remove Sangseok from AUTHORS + * Ryuan Choi: Fix broken text when user mistake defaultValue. + * Jinwoo Song: Merge "Now, changed_viewport_apply() is called when "viewport,changed" smart callback is called. And remove unnecessary code - _smart_load_nonemptylayout_finished() Change-Id: I2383ed06c6e0446d3a814c6c5c73a1cb5efab46f" + + -- Changhyup Jwa Thu, 01 Dec 2011 19:26:37 +0900 + +elm-webview (1.0.160) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.160 + + * taesik cho: CQID : H0100137327 + + -- Changhyup Jwa Mon, 28 Nov 2011 22:08:29 +0900 + +elm-webview (1.0.159) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.159 + + * Junghwan Kang : Fixing myfiles UG launch issue in modal launcher + * Michał Pakuła vel Rutka : Text selection mode change improvement + + -- Junghwan Kang Fri, 25 Nov 2011 22:20:32 +0900 + +elm-webview (1.0.158) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.158 + + * Seokju Kwon: Emit the signal for displaying front and back handles of text selection + + -- Changhyup Jwa Thu, 24 Nov 2011 20:48:54 +0900 + +elm-webview (1.0.157) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.157 + + -- Kangil Han Mon, 21 Nov 2011 20:50:20 +0900 + +elm-webview (1.0.156) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.156 + + * Junghwan Kang : Add Junghwan Kang to webview-maintainer for Modal Launcher + * Kangil Han : Fixed viewport problem while merging open source commits to SLP WebKit. ewk_view_viewport_attributes_get function has changed its parameters regarding layout width and height from float to int type. + * Junghwan Kang : Turn off the flag to not set window effect for modal launcher (Fixing CQ : H0100136927) + + -- Junghwan Kang Mon, 21 Nov 2011 19:09:43 +0900 + +elm-webview (1.0.155) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.155 + + * taesik cho: 1. If greater than the width of the editor, the size of the image resized to 95% of the editor + * Jinwoo Song: Merge "Text selection bug fix" + + -- Changhyup Jwa Fri, 18 Nov 2011 16:31:57 +0900 + +elm-webview (1.0.154) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.154 + + * Grzegorz Czajkowski: Focus ring is not shown on the editable areas. + + -- Changhyup Jwa Thu, 17 Nov 2011 20:16:25 +0900 + +elm-webview (1.0.153) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.153 + + * taesik cho: 1. If greater than the width of the editor, the size of the image resized to 95% of the editor, otherwise keep the size of the image + * Grzegorz Czajkowski: Focus ring is not shown on the editable areas. + + -- Changhyup Jwa Thu, 17 Nov 2011 19:49:53 +0900 + +elm-webview (1.0.152) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.152 + + * Jinwoo Song: Merge "Delete the contextmenu smart callbacks when destroys the Elm_Webview_Editor object" + * Changhyup Jwa: Delete the contextmenu smart callbacks when destroys the Elm_Webview_Editor object + * Grzegorz Czajkowski: Focus ring improvements. + + -- Changhyup Jwa Tue, 15 Nov 2011 21:22:37 +0900 + +elm-webview (1.0.151) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.151 + + -- jeongah Fri, 11 Nov 2011 17:57:57 +0900 + +elm-webview (1.0.150) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.150 + + * Jeongah Park: Mouse up need to be called due to click problem in daum site. + * Jeongah Park: Using the rect[2] instead of rect[0] because rect[0] value is not correct, so hit test can be failed. + + -- Changhyup Jwa Fri, 11 Nov 2011 16:49:01 +0900 + +elm-webview (1.0.149) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.149 + + * Jeongah Park: Hide IME when context menu is appeared. And call the fuctions related to text selection when text seleciton is on. + * Jeongah Park: Remove the scrolling routine while smart zooming. + * Grzegorz Czajkowski: Fix defects discovered by Klocwork + + -- Changhyup Jwa Mon, 31 Oct 2011 20:20:37 +0900 + +elm-webview (1.0.148) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.148 + + * Jeongah Park: Change the y position of the input field due to Twitter. + + -- Changhyup Jwa Wed, 26 Oct 2011 14:05:39 +0900 + +elm-webview (1.0.147) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.147 + + * Jinwoo Song: Fix the elm_webview_layout_width_set_to_container() + * Michal Pakula vel Rutka: Added pasting images from context menu + * Kangil Han: Added logic to use editor command of inserting image + + -- Changhyup Mon, 24 Oct 2011 20:15:48 +0900 + +elm-webview (1.0.146) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.146 + + * Jeongah Park: Fixed smart object name due to BS in email. + * Changhyup Jwa: Add dlogs to each of els_touch's EVAS callbacks + + -- Changhyup Jwa Mon, 24 Oct 2011 10:20:00 +0900 + +elm-webview (1.0.145) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.145 + + * Grzegorz Czajkowski: Focus ring is hidden after click on links + * Kangil Han: Added work-around source lines to distinguish text/image + * Kangil Han: Changed default text selection handle theme as selected in settings menu. + * Jinwoo Song: Modify the input filed zoom behavior + + -- Changhyup Jwa Thu, 20 Oct 2011 22:25:11 +0900 + +elm-webview (1.0.144) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.144 + + * Jinwoo Song: Merge "Temp patch for Emberwind - Touch mode for Emberwind is enabled by the URL (operasoftware.github.com/Emberwind)" + * Changhyup Jwa: Temp patch for Emberwind + * Jinwoo Song: Merge "Bug fix for "two,move,end" operation(Google map bug) - _smart_emit_two_move_end() always passes MOUSEUP position to webview. it never passes MULTIUP position to webview. - Fix: Pass proper event(MouseUp and MultiUp) position to webview" + * Changhyup Jwa: Bug fix for "two,move,end" operation(Google map bug) + + -- Changhyup Jwa Wed, 12 Oct 2011 17:27:32 +0900 + +elm-webview (1.0.143) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.143 + + * Kangil Han: Clears context menu when virtual keyboard is forced to hiding by user. + * Byungwoo Lee: Add api for horizontal panning lock & Add signal (edge,left / edge,right) + * Jeongah Park: Apply gesture layer algorithm. - Calculation zoom ratio + * Jeongah Park: Change the min/max ratio because webkit's supporting ratio is changed. + + -- Changhyup Jwa Tue, 11 Oct 2011 21:01:58 +0900 + +elm-webview (1.0.142) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.142 + + * Jeongah Park: Call touch_up and do not send multi touch event for Emberwind. For playing Emberwind, define the EMBERWIND. + * Jeongah Park: Increase the zoom ratio when zooming rate is over 3.0. + * Jinwoo Song: Merge "Change the navigationbar API to naviframe API." + + -- Changhyup Jwa Wed, 05 Oct 2011 19:43:57 +0900 + +elm-webview (1.0.141) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.141 + + * Michal Pakula vel Rutka: Context menu on image in editable fields fix + * Jinwoo Song: Fix the wrong return type + * Jeongah Park: Do not need checking double click event flag. + + -- Changhyup Jwa Tue, 04 Oct 2011 09:41:27 +0900 + +elm-webview (1.0.140) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.140 + + * Jinwoo Song: Add APIs to set/get the default encoding of the webview + * Kangil Han: Adds environment shell lines to enable launching TC on target + * Jeongah Park: When loading the page, resume_all is called even panning or zooming is still going on. To prevent calling resume_all when panning and zooming are off. + * Choi Ryuan: Remove and deprecated unused code. + * Jeongah Park: Jeongah Park + + -- Changhyup Jwa Thu, 29 Sep 2011 18:20:52 +0900 + +elm-webview (1.0.139) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.139 + + * Jinwoo Song: Add new API for set/get WRT widget layout + * Jinwoo Song: Merge "Fix avoiding warnings in els_webview_editor_cbhm_run" + + -- Changhyup Jwa Mon, 26 Sep 2011 17:22:05 +0900 + +elm-webview (1.0.138) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.138 + + * Jinwoo Song: Revert the resume_all patch which cause the side effect. + * Kangil Han: Removes build warning messages. + * Jeongah Park: When loading the page, resume_all is called even panning is still going on. To prevent, adding the condition not to call resume all when panning is on. + + -- Changhyup Jwa Fri, 23 Sep 2011 17:37:44 +0900 + +elm-webview (1.0.137) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.137 + + * Changhyup Jwa: Patch for duplicated geolocation popup crash + * Jeongah Park: Fixed prevent issue + * Junghwan Kang: Make it to display detailed certificate error in modal popup + * Junghwan Kang: Make modal-launcher has opacity to display caller application and block rotating steps to avoid differency of rotate status between modal launcher and caller app. + * Jinwoo Song: Merge "Text selection clipboard and popup fix" + * Michal Pakula vel Rutka: Text selection clipboard and popup fix + * Junghwan Kang: Make it to apply LCD rotate status in modal launcher starting + + -- Changhyup Jwa Sat, 17 Sep 2011 09:46:22 +0900 + +elm-webview (1.0.136) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.136 + + * Michal Pakula vel Rutka: Select all fix + + -- Changhyup Jwa Fri, 09 Sep 2011 16:23:25 +0900 + +elm-webview (1.0.135) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.135 + + * Michal Pakula vel Rutka: Text selection bugfix + * Jeongah Park: Recalculate focused_rect due to focusing input field when webview is rotated. + * Mike McCormack: Add packaging + + -- Changhyup Jwa Thu, 08 Sep 2011 09:52:21 +0900 + +elm-webview (1.0.134) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.134 + + * Jinwoo Song: Merge "Fix zoom_set's center position because SLP_WRONG_CALCULATION_FIX patch is removed from webkit engine. So, we have to calculate the center position as a relative position of webview." + * Eunmi Lee: Fix zoom_set's center position + * Michal Pakula vel Rutka: Text selection left handle position fix + + -- Changhyup Jwa Mon, 05 Sep 2011 21:03:57 +0900 + +elm-webview (1.0.133) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.133 + + * jungjik.lee: Fast zoom bound + * Michal Pakula vel Rutka: Autofocus enable/disable feature + + -- Kangil Han Thu, 01 Sep 2011 18:40:49 +0900 + +elm-webview (1.0.132) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.132 + + * Jeongah Park: Do not call panning when the page is using TOUCH_START event. + * Mariusz Grzegorczyk: Pause plugin when selected, but move, or zoom was outside it + * Michal Pakula vel Rutka: Text selection magnifier fix + * sang seok lim: Merge " Page is loaded horizontally and roate it more than two times, then the zoom level is decreased." + * Kangil Han: Removes 'elm_label_background_color_set' function used in '_prompt' function. + * Ryuan Choi: Merge "Add , in editorclient signals" + * Ryuan Choi: Add , in editorclient signals + + -- Changhyup Jwa Wed, 31 Aug 2011 16:42:04 +0900 + +elm-webview (1.0.131) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.131 + + * Junghwan Kang: Fix modal-launcher pausing issue : unable to resume browser application after modal-launcher paused + * Kangil Han: Fixes inappropriate page view issue on repeated rotation. + * Ryuan Choi: Remove warnings and reorder header list + * Michal Pakula vel Rutka: Text selection two handles fix + * Michal Pakula vel Rutka: els webview editor refactoring + * Ryuan Choi: Remove elm_priv.h by using elm_widget.h + * Ryuan Choi: Clear API_ENTRY. + * Jeongah Park: Call stop_all_animator function when go to none state. Emit second down event because flash plugin needs it. + + -- Changhyup Jwa Fri, 26 Aug 2011 16:58:44 +0900 + +elm-webview (1.0.130) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.130 + + * Michal Pakula vel Rutka: Magnifier bug fix + * Grzegorz Czajkowski: elm_webview_fixed_position_get checks plugin mode + * Bang Kwangmin: call _resume_all when ended zoomming although flashmode. + + -- Kangil Han Fri, 19 Aug 2011 12:58:38 +0900 + +elm-webview (1.0.129) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.129 + + * Kangil Han: Makes every animator value become NULL after deletion to prevent unintended access. + + -- Kangil Han Tue, 16 Aug 2011 19:07:04 +0900 + +elm-webview (1.0.128) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.128 + + * Jeongah Park: Using API to check webview visibility, and initialize the latest_min_zoom_rate variable + * Jeongah Park: Long press move animator does not stop when multi-up event is occured. + * Jeongah Park: Fixed prevent issues and resume visible webview due to inactive window's flashplayer playing + * Ryuan Choi: ewk_frame_contents_size_get returns zoomed size if scale page was enabled + + -- Changhyup Jwa Fri, 12 Aug 2011 18:07:22 +0900 + +elm-webview (1.0.127) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.127 + + * Ryuan Choi: Change deprecated api 'ewk_view_select_none' + * Jongseok Yang: Remove "Eina_list *suggested_filenames" argument for functions to open + * Michal Pakula vel Rutka: Text selection mode change refactoring + * Michal Pakula vel Rutka: Text selection migration + * Kangil Han: Adapts Nbeat layout style guide and resolves fragmentation fault on elm_webview_sample. + + -- Changhyup Jwa Mon, 08 Aug 2011 14:40:33 +0900 + +elm-webview (1.0.126) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.126 + + * Kamil Blank: Replace removed WebKit API by new one. + * Kangil Han: This is work-around patch that will be valid until EWebKit viewport is ready to calculate whole zoom related stuff instead of WebView. + * Eunmi Lee: remove ewk_tile_unused_cache_auto_flush - it is deprecated API + * Eunmi Lee: remove CTBS codes - it is not used anymore + * sang seok lim: Merge "remove old CTXPOPUP codes - it is not used anymore" + * Jeongah Park: Apply smooth algorithm for pinch zooming and panning + * Eunmi Lee: remove old CTXPOPUP codes - it is not used anymore + * Michal Pakula vel Rutka: Text selection bug fixing + * sang seok lim: Merge "Apply delay to the flick algorithm. We do not want to flick with normal amount of distance when there is a delay before flick, because it seems strange and looks like jumping. So, we apply delay to the flick average distance with guaranteeing the minimum flick distance(FLICK_THRESHOLD)." + * Michal Pakula vel Rutka: Changes to apply Select and Select all in context menu + * Eunmi Lee: Apply delay to the flick algorithm. + * Kangil Han: Updates deprecated API. + + -- Changhyup Jwa Mon, 01 Aug 2011 15:16:35 +0900 + +elm-webview (1.0.125) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.125 + + * Jinwoo Song: Remove basename from log.h to resolve the defect in the Prevent + * Ryuan Choi: Remove -march=armv7-a -mtune=cortex-a8 + * Ryuan Choi: Remove macro constants which define some resource file path which doesn't exist. + * Mariusz Grzegorczyk: [Plugins] Prevent pausing plugin when zooming over it, pass mouse events to plugin from native ones + * Sangwook Jung: Merge "To add amended boiler-plate for code open" + + -- Changhyup Jwa Mon, 25 Jul 2011 19:48:05 +0900 + +elm-webview (1.0.124) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.124 + + * Jeongah Park: Remove unnecessary code because the viewport implementation is done + * Sangwook Jung: Merge "Remove unnecessary files els_webview_container is not used, remove it. - els_webview_container.c and els_webview_container.h is removed. - and update CMakeLists.txt" + * Gyuyoung Kim: Revert Revert apply webkit-engine's viewport with dpi - initial version + * Jwa Changhyup: Remove unnecessary files + + -- Changhyup Jwa Tue, 19 Jul 2011 17:37:00 +0900 + +elm-webview (1.0.123) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.123 + + * Jeongah Park: Fixed the prevent issue + * Eunmi Lee: code clean up - remove tabs + * Eunmi Lee: Fix 'move history' algorithm. + * Eunmi Lee: "single,tap" event for e-mail html composer. + * sangseok lim: to genenerate onscroll event at the end of panning when onscroll event occurrence is prevented while panning + * sang seok lim: Merge "Send release event. Problem found in mobile daum site." + + -- Changhyup Jwa Thu, 14 Jul 2011 20:22:20 +0900 + +elm-webview (1.0.122) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.122 + + -- Changhyup Jwa Mon, 11 Jul 2011 15:00:09 +0900 + +elm-webview (1.0.121) unstable; urgency=low + + * KwangHyuk Kim: Merge "Use notification about change in handling events by plugins" + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.121 + + -- Changhyup Jwa Mon, 11 Jul 2011 14:21:26 +0900 + +elm-webview (1.0.120) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.120 + +* Jeongah Park: Change the input field zoom routine in case the input field is located at bottom of the page + + -- Changhyup Jwa Thu, 07 Jul 2011 19:56:46 +0900 + +elm-webview (1.0.119) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.119 + + * Mariusz Grzegorczyk: A new model of events for plugins + * Kangil Han: To change WebView auto zoom concept in screen rotation. With this, zoom level larger than minimum one should be set as ratio on width change in screen rotation. + * Michal Pakula vel Rutka: Do not clear selection on NULL input method state + + -- Changhyup Jwa Mon, 04 Jul 2011 16:41:52 +0900 + +elm-webview (1.0.118) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.118 + + * Michal Pakula vel Rutka: elm_webview_fixed_position_get fix + + -- Changhyup Jwa Mon, 27 Jun 2011 20:17:09 +0900 + +elm-webview (1.0.117) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.117 + + -- Changhyup Jwa Tue, 21 Jun 2011 20:29:47 +0900 + +elm-webview (1.0.116) unstable; urgency=low + + * sang seok lim : Merge "Moving set text selection off from job to callback" + + -- Changhyup Jwa Tue, 21 Jun 2011 20:11:23 +0900 + +elm-webview (1.0.115) unstable; urgency=low + + * Ryuan Choi : fix blackscreen when called window.prompt(...) + * Ryuan Choi : Get content size of 1.0 point when cairo scaling is diabled. + * Kangil Han : To resolve odd scroll action on text selection magnifier mode + + -- Changhyup Jwa Tue, 21 Jun 2011 17:29:20 +0900 + +elm-webview (1.0.114) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.114 + + * sang seok lim : Merge "Add Changhyup Jwa as maintainer of elm-webview" + * Jinwoo Song : Fix the jumping problem when flicking the long sites + * Changhyup Jwa : Add Changhyup Jwa as maintainer of elm-webview + + -- Changhyup Jwa Mon, 20 Jun 2011 09:50:51 +0900 + +elm-webview (1.0.113) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.113 + + * Eunmi Lee : move _parent_sc.mouse_down for events_feed from _smart_cb_mouse_down to _smart_mouse_down + * Michal Pakula vel Rutka : text selection - new selection type distingushing + * Mariusz Grzegorczyk : Remove creating html for swf file while loading from file:// protocol. Not needed after following change in webkit-engine: Change I7049f4f9: Allow displaying plugin's resource from web e.g. ...swf + * Mariusz Grzegorczyk : Fix build break + + -- Changhyup Jwa Thu, 16 Jun 2011 20:00:06 +0900 + +elm-webview (1.0.112) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.112 + + * Jeongah Park : Remove minimum zoom bouncing animation and stop zooming when one of the fing + * Ryuan Choi : remove neon option + + -- Changhyup Jwa Tue, 14 Jun 2011 18:55:05 +0900 + +elm-webview (1.0.111) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.111 + + * Hyerim Bae : Add javascript & mobile layout variable to Elm_WebView_Create_Webview_Data for create webview option + + -- Kangil Han Mon, 13 Jun 2011 19:20:58 +0900 + +elm-webview (1.0.110) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.110 + + * Grzegorz Czajkowski : selection_clear returns ECORE_CALLBACK_PASS_ON + * Kangil Han : To resolve flickr application rotate issue + + -- Kangil Han Thu, 09 Jun 2011 20:00:14 +0900 + +elm-webview (1.0.109) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.109 + + * Hyerim Bae : Change the create webviwe webkit callback + * Jeongah Park : Select field zoom implementation and rename the variables which can be used in common + * Grzegorz Czajkowski : Apply Klocwork suggestions + + -- Kangil Han Tue, 07 Jun 2011 21:04:30 +0900 + +elm-webview (1.0.108) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.108 + + * Eunmi Lee : remove bluetooth mouse_move support patch because we will not support mouse hover + + -- Kangil Han Thu, 02 Jun 2011 18:23:37 +0900 + +elm-webview (1.0.107) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.107 + + * Change null parent of elm_popup_add to ad->win + * Stop the panning when the touch event feeds to webkit engine + + -- Kangil Han Fri, 27 May 2011 11:20:56 +0900 + +elm-webview (1.0.106) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.106 + + * To fix twitter.com zoom issue + + -- Kangil Han Thu, 26 May 2011 08:36:25 +0900 + +elm-webview (1.0.105) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.105 + + * Text selection bugfix. This fixes bug when a popup mode was not called on input field + + -- Kangil Han Mon, 23 May 2011 11:33:25 +0900 + +elm-webview (1.0.104) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.104 + + * Fixed build break. Copied elm_priv.h from elementary package. + + -- jeongah Thu, 19 May 2011 11:26:01 +0900 + +elm-webview (1.0.103) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.103 + + * we have to pass the TOUCH_POINT_MOVED for one_move_start (not TOUCH_POINT_PRESSED), +because TOUCH_POINT_PRESSED is passed in the smart_cb_mouse_down. +and move touch_event_feed checking code to the one_move_start from one_move + * remove 'resize for keyboard' codes + + -- Kangil Han Tue, 17 May 2011 22:04:27 +0900 + +elm-webview (1.0.102) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.102 + + * extract pre-rendering code to ewk (modified) + + -- Kangil Han Mon, 16 May 2011 14:03:27 +0900 + +elm-webview (1.0.101) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.101 + + * [modal_launcher]create ad->win always + + -- Kangil Han Thu, 12 May 2011 18:26:22 +0900 + +elm-webview (1.0.100) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.100 + + * In case of page moved, using the rect even the x and width are the same as the last rect's x and width.Change to debug macro and apply webkit coding style + * Scroll the page when the zoom_step is under boundary and it is smartzoom + + -- Kangil Han Wed, 11 May 2011 18:08:12 +0900 + +elm-webview (1.0.99) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.99 + + * Revert "apply webkit-engine's viewport with dpi - initial version" + + -- Kangil Han Tue, 03 May 2011 21:13:34 +0900 + +elm-webview (1.0.98) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.98 + + * apply webkit-engine's viewport with dpi - initial version + + -- Kangil Han Mon, 02 May 2011 17:04:34 +0900 + +elm-webview (1.0.97) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.97 + + * Add the smart zoom on/off functions + * add Kangil Han as a maintainer of elm-webview + * remove unused macro + * Clipboard manager bug fix + * Fixed text selection panning issue + * modify TC script for SBS2 and gcc 4.5.2 + * Merge "pass the one,press for mouse_down during drag the flash plug-in can not get the mouse_down during drag without this patch." + * Merge "drop load,finished callback because webview doesn't need to make error page anymore, Error page make WebCore side" + + -- Kangil Han Mon, 02 May 2011 11:38:34 +0900 + +elm-webview (1.0.96) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.96 + + * Add libgnutls-dev to control + + -- Eunmi Sat, 23 Apr 2011 20:11:29 +0900 + +elm-webview (1.0.95) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.95 + + * Add libgnutls-dev to control + + -- Gyuyoung Kim Sat, 23 Apr 2011 20:03:54 +0900 + +elm-webview (1.0.94) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.94 + + * re-upload for upgraded webkit-engine + + -- Eunmi Lee Sat, 23 Apr 2011 13:41:25 +0900 + +elm-webview (1.0.93) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.93 + + * Check for plugin mode on all mouse downs + * change the TC functions name + * fix the sample's build script for sbs2 + * Disabled CTBS macro due to tbs2&tbs1 integration + * remove ewk_view_stop from _smart_load_error + because it will cause crash with upgraded webkit-engine + * create Evas_Event_Mouse_Down event for smart_cb_mouse_down + * hibrain.net selection issue fix + * H0100124922 issue fix + * delete selection_clear ecore_event_handler when webview is deleted + * do not pass the mouse_down during text-selection + * Change condition to get/set empty proxy address (Null or 0.0.0.0) + + -- Eunmi Lee Fri, 22 Apr 2011 20:37:26 +0900 + +elm-webview (1.0.92) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.92 + + * Add new html script for service unavailable case + * Removed code due to moved it into WebKit library. + See: 'Global tiled view cache manager feature' commit + * Removed an old comment + * Preparation before tbs2 and tbs1 integration + * fix TC errors + * [modal_launcher]fix for CR support + + -- Eunmi Lee Mon, 18 Apr 2011 20:21:18 +0900 + +elm-webview (1.0.91) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.91 + + * fix the indentation to follow the elementary rule + * remove minimap related codes because minimap API is deprecated + * Direct events handling for plugins + * remove two_press_timer because we do not have to delay two press + * remove events_block related code because that is deprecated + * wordpress.com input field issue fix + * if on_panning is true, set mouse_up's position to (0, 0) + * modify move threshold checking code to use _elm_config's thumbscroll_threshold + * set size_hint_min as same as object size + and resize webview instead of webkit for keyboard + * remove duplicated plug-in checking code + * Prevent double mouse_up sending on active plugin + + -- Eunmi Lee Thu, 07 Apr 2011 09:35:20 +0900 + +elm-webview (1.0.90) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.90 + + * if mouse down is propagated, + we have to propagate mouse_up to keep the mouse up/down pair + * fix the wrong API parameter + + -- Eunmi Lee Mon, 04 Apr 2011 21:27:13 +0900 + +elm-webview (1.0.89) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.89 + + * add variables to use elm-webview.pc.in and remove unnecessary files + * remove malloc for Ewk_Touch_Point. + It's not clean yet, but it wil remove huge memory leak. + * possible leaks with text selection + * Text selection modes ecore_job bugfixing + * move mouse down delay code to the els_weview from els_touch + and do not propagate mouse down for double tap + * remove ewk_init() + * remove event->flags checking code for mouse_down + * add use_mouse_down_delay_set/get API + + -- Eunmi Lee Mon, 04 Apr 2011 20:26:19 +0900 + +elm-webview (1.0.88) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.88 + + * Fix build error + + -- Jeongah Park Wed, 30 Mar 2011 19:33:47 +0900 + +elm-webview (1.0.87) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.87 + + * Fix build error + + -- Jeongah Park Wed, 30 Mar 2011 15:47:41 +0900 + +elm-webview (1.0.86) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.86 + + * change autotools to cmake + * add sample for checking memory while loading + * apply dlog + * remove flick velocity revising code + * remove unused variable + * add memory increment case + * Fix for korean keyboard bug + + -- Eunmi Lee Wed, 30 Mar 2011 08:35:22 +0900 + +elm-webview (1.0.85) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.85 + + * Changes in magnifier width + * Changes to allow/bugfix image copy from editable + Added support for content editable image copy - + popup will be similiar to one from text selection + * apply caret location for zooming to input field rect + + -- Eunmi Lee Mon, 28 Mar 2011 19:19:11 +0900 + +elm-webview (1.0.84) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.84 + + * repackaging for new webkit-engine package + + -- Eunmi Lee Wed, 23 Mar 2011 22:30:46 +0900 + +elm-webview (1.0.83) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.83 + + * Paste image feature into content editable + * deprecate elm_webview_minimap_get API + * move html defines to the separate header file + * remove ime show/hide code and ime blocking code + * zoom to the input field in the "inputmethod,changed" event callback + instead of tap and long,press callback + * deprecate unnecessary APIs (events_block_set/get) + + -- Eunmi Lee Wed, 23 Mar 2011 21:31:42 +0900 + +elm-webview (1.0.82) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.82 + + * Text selection refactoring + * This fixes text selection handles move in editable area + * add flash plugin's input field zoom feature + * modify center of zoom from (0, 0) to webview's left corner position + * modify wrong tc names in the tslist + * do not suspend in the mouse_down + + -- Eunmi Lee Fri, 18 Mar 2011 20:27:39 +0900 + +elm-webview (1.0.81) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.81 + + * we do not have to revise center position here + caused by backing store's wrong calculation code + * add maintainer + + -- Eunmi Lee Mon, 14 Mar 2011 20:05:44 +0900 + +elm-webview (1.0.80) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.80 + + * Pre-rendering issue Calling ewk_view_setting_encoding_custom_set before page is loaded + * Add pkg-config modules needed for linking + * fix the input field zoom defect + * remove unreachable code + * remove object width revising code + * modify evas coordinate variables' type + from int to Evas_Coord to prevent confusion + * add comments for smart_zoom + + -- Eunmi Lee Fri, 11 Mar 2011 19:38:33 +0900 + +elm-webview (1.0.79) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.79 + + * Pre-rendering only on load finished event + * rename TC from UIFW to INTERNETFW + + -- Eunmi Lee Wed, 09 Mar 2011 18:08:09 +0900 + +elm-webview (1.0.78) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.78 + + * Add control logic for KEY_END. + * apply MAX_FLICK_DISTANCE and set it to 160 pixel + * always set ewk_view's zoom range as same as elm-webview's min/max zoom + * unify bouncing zooming step with normal zooming step + + -- Eunmi Lee Wed, 09 Mar 2011 10:03:29 +0900 + +elm-webview (1.0.77) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.77 + + * Text selection fix for H0100120997 + * process move directly without ecore_job + + -- Eunmi Lee Thu, 03 Mar 2011 22:49:19 +0900 + +elm-webview (1.0.76) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.76 + + * Change because of Refactoring ewk_frame_selection apis. + + -- Ryuan Choi Wed, 02 Mar 2011 19:20:09 +0900 + +elm-webview (1.0.75) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.75 + + * Text selection magnifier bugfix + * Fix H0100121733 : Fixed sweep-hiding keyboard issue plus added + + -- Eunmi Lee Mon, 28 Feb 2011 21:49:37 +0900 + +elm-webview (1.0.74) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.74 + + * Replace mouse_clicked to buttons of Evas_Mouse_Move. + * Patch allowing magnifier to move over editable fields and fix wrong #endif position + + -- Eunmi Lee Thu, 24 Feb 2011 21:59:51 +0900 + +elm-webview (1.0.73) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.73 + + * Text selection bug fixing + This fixes some text selection bugs mainly text handles positioning + + -- Eunmi Lee Tue, 22 Feb 2011 22:02:05 +0900 + +elm-webview (1.0.72) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.72 + + * modify error page's title to 'Error Page' + * suspend all in the mouse down instead of pan,start, zoom,start + + -- Eunmi Lee Mon, 21 Feb 2011 19:50:33 +0900 + +elm-webview (1.0.71) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.71 + + * fix the prevent defect + * [modal_launcher]add exceptional handling + * IME fix - Fix showing keyboard for content editable in html5demos.com + + -- Eunmi Lee Fri, 18 Feb 2011 21:49:55 +0900 + +elm-webview (1.0.70) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.70 + + * add framerate debuging code + + -- Eunmi Lee Wed, 16 Feb 2011 18:42:08 +0900 + +elm-webview (1.0.69) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.69 + + * do not adjust layout in wrt widget case (file://) in the load,finsihed callback + + -- Eunmi Lee Sat, 12 Feb 2011 00:13:20 +0900 + +elm-webview (1.0.68) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.68 + + * fix the prevent defects + * feed touch event only for one,move + * add test cases + * Adjust width of page content when content's widht is different than viewport's + + -- Eunmi Lee Fri, 11 Feb 2011 22:32:41 +0900 + +elm-webview (1.0.67) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.67 + + * change IME layout in case of NUMBER type + + -- Ryuan Choi Wed, 09 Feb 2011 22:47:16 +0900 + +elm-webview (1.0.66) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.66 + + * IME show fix + + -- Ryuan Choi Wed, 09 Feb 2011 21:53:54 +0900 + +elm-webview (1.0.65) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.65 + + * Text selection magnifier bugfixing + * fix the zoom_rate setting code + * H0100119277 - fixing size of a webview width when keyboard is activated + + -- Eunmi Lee Wed, 09 Feb 2011 15:59:20 +0900 + +elm-webview (1.0.64) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.64 + + * set fixed_layout_size for desktop site + + -- Eunmi Lee Mon, 07 Feb 2011 13:58:33 +0900 + +elm-webview (1.0.63) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.63 + + * IME show fix + Moved showing keyboard from directly just after receiving a callback + from WebKit (literally mouse down) to mouse tap gesture (after + mouse down) + + -- Eunmi Lee Tue, 01 Feb 2011 18:46:25 +0900 + +elm-webview (1.0.62) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.62 + + * add content rect checking code in the directional_pre_render and check min_zoom_rate + + -- Eunmi Lee Fri, 28 Jan 2011 16:51:25 +0900 + +elm-webview (1.0.61) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.61 + + * Toggling between panning and events handling for plugins - Android's way + * do not suspend if we will not zoom in the smart_zoom + * do not check file:// in the update_min_zoom_rate function + * add elm_webview_text_selection_clear API + + -- Eunmi Lee Thu, 27 Jan 2011 22:59:27 +0900 + +elm-webview (1.0.60) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.60 + + * Pc site pre-rendering implementation + * Adjust to new ctxpopup API + * check file:// to not regard widget as a mobile site + + -- Eunmi Lee Wed, 26 Jan 2011 23:51:17 +0900 + +elm-webview (1.0.59) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.59 + + * Prevent mouse down during scroll + + -- Eunmi Lee Mon, 24 Jan 2011 12:08:49 +0900 + +elm-webview (1.0.58) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.58 + + * re-build because webkit-engine's sd structure is changed. + + -- Eunmi Lee Wed, 19 Jan 2011 23:19:17 +0900 + +elm-webview (1.0.57) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.57 + + * correct the TC build scripts + * change ewk_page_check to ewk_frame_hit_test + * correct the TC build scripts + * fix the test cases + * Unlock pan events send to plugin + + -- Eunmi Lee Tue, 18 Jan 2011 20:04:55 +0900 + +elm-webview (1.0.56) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.56 + + * remove Google search from Not Found Page + * remove calling ewk_dnet_open() + * enabling TBS2.0 + + -- Eunmi Lee Mon, 17 Jan 2011 13:59:23 +0900 + +elm-webview (1.0.55) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.55 + + * send "pan,started/finished", "zoom,started/finished" event to the elm-webview widget + + -- Eunmi Lee Fri, 14 Jan 2011 09:36:30 +0900 + +elm-webview (1.0.54) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.54 + + * [modal_launcher]fix when long prompt + * add libslp-utilx-dev dependency + + -- Ryuan Choi Thu, 13 Jan 2011 14:22:12 +0900 + +elm-webview (1.0.53) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.53 + + * Mobile pre-rendering algorithm optimization + Fixing error messages in tbs2.0 for mobile pre-rendering + * reset panning_y_edge variable when panning hold is set + * [modal_launcher]support back key + + -- Eunmi Lee Thu, 13 Jan 2011 13:58:49 +0900 + +elm-webview (1.0.52) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.52 + + * remove NEED_TO_REMOVE macro already disabled two days ago + * remove unused function(unzoomed_position) + * remove MAX_FLICK_DISTANCE, + increate MOVE_HISTORY_SIZE (from 5 to 10), + and calculate flick_index using time for slow panning sites (ex, CSS FIXED) + * Added invoking reduce/revert FPS on plugins for panning + * modify flick index calculation algorithm + + -- Eunmi Lee Mon, 10 Jan 2011 15:53:32 +0900 + +elm-webview (1.0.51) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.51 + + * set panning_y_edge variable to EINA_FALSE when panning is started + * send 'one,flick,end' if we will not run flick animator + and modify wrong event in _smart_stop_animator_flick + + -- Eunmi Lee Tue, 04 Jan 2011 22:45:41 +0900 + +elm-webview (1.0.50) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.50 + + * split flick and move callbak signal + * feed mouse move events while user doesn't click + * add saved size checking code and reset saved site + to prevent to perform HIDE event multiple times + + -- Eunmi Lee Mon, 03 Jan 2011 21:27:24 +0900 + +elm-webview (1.0.49) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.49 + + * fix crash of ug + * button layout fix of cert dialog + + -- Ryuan Choi Mon, 27 Dec 2010 17:49:55 +0900 + +elm-webview (1.0.48) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.48 + + * prevent doublely create two_move animation + * clean sample code(remove applog, ...) + * fix zooming bug of google map + * Fixed pre-rendering issue while orientation changed + * remove console message becaue we will not support + * remove ECORE_X_EVENT_WINDOW_PROPERTY handler + + -- Eunmi Lee Thu, 23 Dec 2010 20:39:36 +0900 + +elm-webview (1.0.47) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.47 + + * move Ewk_Context_Menu_Data Structure into group of... + * [els_touch]refactoring touch events - forth patch + * fix wrong patched + * initialize animator when initializing webview and remov... + + -- Ryuan Choi Mon, 20 Dec 2010 17:30:46 +0900 + +elm-webview (1.0.46) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.46 + + * remove (disabled)NEED_TO_REMOVE guard for focus ring... + * doxygen update + * [els_touch]refactoring - second patch + * [modal_launcher]implement prompt + * [els_touch]refactoring - third patch + * prevent crash + + -- Ryuan Choi Mon, 20 Dec 2010 11:51:05 +0900 + +elm-webview (1.0.45) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.45 + + * els_webview.c - remove unnecessary code + * Changes in text selection in editable fields according... + * change certification string + * remove ununsed code + * Send pan and zoom to plugin, webkit will choose which... + * Adjustements for API rename in TBS2 + * add touch event for panning + * [els_touch]refactoring - fist patch + * remove native mouse callbacks because engine removed... + + -- Ryuan Choi Wed, 15 Dec 2010 10:18:29 +0900 + +elm-webview (1.0.44) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.44 + + * No auto flush in CTBS + * enable cert dialog + + -- Ryuan Choi Thu, 09 Dec 2010 09:57:44 +0900 + +elm-webview (1.0.43) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.43 + + * disable NEED_TO_REMOVE to verify before deletion + * add function comment for els_weview + * remove webview,created callback + + -- Eunmi Lee Wed, 08 Dec 2010 17:23:55 +0900 + +elm-webview (1.0.42) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.42 + + * add dependency of elm-webview for elm-webview-dev + + -- Ryuan Choi Wed, 08 Dec 2010 09:19:13 +0900 + +elm-webview (1.0.41) unstable; urgency=low + + * Git: 165.213.180.234:slp/pkgs/e/elm-webview + * Tag: elm-webview_1.0.41 + + * modify panning_hold to vertical_panning_hold + + -- Eunmi Lee Tue, 07 Dec 2010 20:17:07 +0900 + +elm-webview (1.0.40) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag: elm-webview_1.0.40 + + * remove *.a + * code style refactoring and add comment. + + -- Ryuan Choi Tue, 07 Dec 2010 16:06:14 +0900 + +elm-webview (1.0.39) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag: elm-webview_1.0.39 + + * add ecore_event_handler_del code for ECORE_X_EVENT_WINDOW_PROPERTY callback + + -- Eunmi Lee Fri, 03 Dec 2010 17:45:03 +0900 + +elm-webview (1.0.38) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag: elm-webview_1.0.38 + + * [modal_launcher]add comment and refactoring + * delay the one,press and modify two,press + * [modal_launcher]remove tab and unused macro + * add '://mobile.' to mobile checking string for mobile.corriere.it + * add boilerplate for els_touch + * add define's comments and remove unused function + * refactoring (coding style fix) + * modify viewport get function for upgraded webkit-engine + * wrap the event_feed_to_flash code with EVENT_FEED_TO_FLASH macro which is not defined + + -- Eunmi Lee Fri, 03 Dec 2010 16:55:36 +0900 + +elm-webview (1.0.37) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag: elm-webview_1.0.37 + + * remove unused variable + * add elm_webview_panning_hold_set API and add edge,top and edge,bottom event + + -- Eunmi Lee Thu, 02 Dec 2010 22:21:40 +0900 + +elm-webview (1.0.36) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag: elm-webview_1.0.36 + + * add elm_webview_enable_default_touch_set API + + -- Eunmi Lee Thu, 02 Dec 2010 19:16:06 +0900 + +elm-webview (1.0.35) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag: elm-webview_1.0.35 + + * move els_touch from elementary to here + * add the webkit deleting code to the elm_webview + * Fixed paste bug + * remove input panel callback when deleting webview + + -- Eunmi Lee Thu, 02 Dec 2010 11:47:43 +0900 + +elm-webview (1.0.34) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag: elm-webview_1.0.34 + + * Context menu webkit item selection moved to webview + + -- Eunmi Lee Tue, 30 Nov 2010 10:55:42 +0900 + +elm-webview (1.0.33) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag: elm-webview_1.0.33 + + * add some doxygen comments + * text selection for editable fields bugfixing + * Text selection magnifier - magnifying with 1.5 zoom level added + * remove unnecessary code and some error handling + * resize webview when ise is shown/hidden. + * set ECORE_X_EVENT_WINDOW_PROPERTY callback to recognize rotated IME size + * add elementary to the Requires of pc file + * Text selection magnifier modification + * add some codes for NEW_CONTEXT_MENUS + * modify for LIMO contribution + + -- Eunmi Lee Mon, 29 Nov 2010 13:59:10 +0900 + +elm-webview (1.0.32) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag: elm-webview_1.0.32 + + * fixing mistakes i did + * [modal_launcher]implement prompt and cert + * [modal_launcher]remove unnecessary code + * [modal_launcher]fix duplicated msg when opening file + * [modal_launcher]implement file(finish selecting one file) + * do not do smart zoom when zoom to set and current zoom is same + + -- Eunmi Lee Tue, 23 Nov 2010 15:13:56 +0900 + +elm-webview (1.0.31) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag: elm-webview_1.0.31 + + * Feed events to flash when after mousedown on it + * [els-webview.c] text selection for editable fields.. + + -- Ryuan Choi Sat, 20 Nov 2010 12:19:11 +0900 + +elm-webview (1.0.30) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag: elm-webview_1.0.30 + + * New Context menu design + * [els-webview.c] removed TEXT_SELECTION_MAGNIFIER_ON + * [modal]make file can return + * els-webview TEXT_SELECTION_CARET_BLOCK set 1 + * [modal]add internal header + * [els-webview] text selection for editable fields bugfix + * add debug package + + -- Ryuan Choi Thu, 18 Nov 2010 14:04:11 +0900 + +elm-webview (1.0.29) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag: elm-webview_1.0.29 + + * [els-webview.c] Text selection + + -- Eunmi Lee Tue, 16 Nov 2010 21:30:44 +0900 + +elm-webview (1.0.28) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag: elm-webview_1.0.28 + + * update Makefile of TC + * update example for doxygen + * remove PROTOTYPED macro (to keep enabled) + * [modal_utility]implement file dialog + * add missing layout size saving code + + -- Eunmi Lee Mon, 15 Nov 2010 16:00:10 +0900 + +elm-webview (1.0.27) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag: elm-webview_1.0.27 + + * [modal_utility]clean code + * update doxygen & change Mime_Cb to Scheme_Cb + * [els_webview.c] Fixed crash caused by using mouse_down_... + + -- Ryuan Choi Thu, 11 Nov 2010 10:55:02 +0900 + +elm-webview (1.0.26) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag: elm-webview_1.0.26 + + * enabling search option + * delete ctxpopup when dimmed rect clicked + + -- Eunmi Lee Tue, 09 Nov 2010 12:14:30 +0900 + +elm-webview (1.0.25) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.25 + + * Using ewk_view_rescale_images_to_width after resize... + * [els-webview] Text selection bugfixing + * update doxygen + + -- Ryuan Choi Mon, 08 Nov 2010 11:45:11 +0900 + +elm-webview (1.0.24) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.24 + + * remove discpicker and we have to integrate dropdown ui-gadget + * remove unnecessary check_point_for_keyboard and duplicated hit_test + * add new api for modal + * feed event to flash if the flash contents is clicked + + -- Eunmi Lee Thu, 04 Nov 2010 15:41:43 +0900 + +elm-webview (1.0.23) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.22 + + * If is_layout_width_set_to_container use original width... + * [els-webview] Text selection magnifier improvement + * call _image_clone_get only if minimap.eo exists + + -- Ryuan Choi Thu, 04 Nov 2010 10:48:41 +0900 + +elm-webview (1.0.22) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.22 + + * add elm_webview_auto_suspend_set() API + * fix the wrong parameter of auto_suspend + * do not use ewk_view_user_scalable_set in the webview... + + -- Ryuan Choi Wed, 03 Nov 2010 17:49:57 +0900 + +elm-webview (1.0.21) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.21 + + -- Ryuan Choi Wed, 03 Nov 2010 10:29:57 +0900 + +elm-webview (1.0.20) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.20 + + * update doxygen image. + * [els-webview] update text selection feature to meet. + + -- Ryuan Choi Wed, 03 Nov 2010 10:22:14 +0900 + +elm-webview (1.0.19) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.19 + + * update doxygen + * update text selection feature to meet new guideline + * Clipboard images support + * update doxygen of scheme_callback_set + * move zoom initialzing code from load,started to viewport,changed + * change the zoom functions to support the zoom_start duirng zooming + + -- Eunmi Lee Fri, 29 Oct 2010 19:49:15 +0900 + +elm-webview (1.0.18) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.18 + + * add enable_default_context_menu_set/get + * add the job deleting code + * add the idler deleting code + + -- Eunmi Lee Wed, 27 Oct 2010 11:58:10 +0900 + +elm-webview (1.0.17) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.17 + + * block context popup for flash when long pressed + + -- Ryuan Choi Tue, 26 Oct 2010 20:30:19 +0900 + +elm-webview (1.0.16) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.14 + + * remove unused code. + * update geolocation related function call + * [els-webview] text selection improvement + * update boilerplate + * fix the mobile daum zoom bug + * fix the docs.google.com's input field zoom bug + + -- Ryuan Choi Mon, 25 Oct 2010 11:02:15 +0900 + +elm-webview (1.0.15) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.14 + + * add boilerplate + * Paste feature + * [els-webview] fixing bug with text selection on mobile pages + * View Port has been added for EMBED HTML file + + -- Ryuan Choi Fri, 22 Oct 2010 14:49:18 +0900 + +elm-webview (1.0.14) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.14 + + * Text selection handle improvement and bugfixing + * add new API - elm_webview_input_field_zoom_set + + -- Eunmi Lee Thu, 21 Oct 2010 11:14:56 +0900 + +elm-webview (1.0.13) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.13 + + * modify geolocation permission popup from Modal to Modaless + + -- Eunmi Lee Wed, 20 Oct 2010 20:20:16 +0900 + +elm-webview (1.0.12) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.12 + + * add ewebkit and cairo requires in the pc file + + -- Eunmi Lee Wed, 20 Oct 2010 16:38:16 +0900 + +elm-webview (1.0.11) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.11 + + * modify elm_smart_webview_add to get the Evas_Object instead of Evas + * delay ctxpopup's move and show, + it is temporary code to fix the ugly popup problem + * add els_webview.h into c file / update PG.h + + -- Eunmi Lee Wed, 20 Oct 2010 14:18:05 +0900 + +elm-webview (1.0.10) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.10 + + * remove ELM_SET_WIDTYPE because it cause crash in the email and seven-email's ui-gadget + + -- Eunmi Lee Wed, 20 Oct 2010 10:35:38 +0900 + +elm-webview (1.0.9) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.8 + + * fix build break + + -- Ryuan Choi Wed, 20 Oct 2010 09:40:48 +0900 + +elm-webview (1.0.8) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.8 + + * prototype alert + + -- Ryuan Choi Wed, 20 Oct 2010 09:32:16 +0900 + +elm-webview (1.0.7) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.7 + + * update doxygen related document + * prototype confirm + * support new window request from webkit engine + + -- Eunmi Lee Tue, 19 Oct 2010 20:22:47 +0900 + +elm-webview (1.0.6) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.6 + + * code clean elm_webview.c + + -- Eunmi Lee Tue, 19 Oct 2010 09:13:42 +0900 + +elm-webview (1.0.5) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.5 + + * Remove dlopen + * Rearrange doxygen + * second text selection handle + * naver.com bugfix + * modal prototype + + -- Ryuan Choi Mon, 18 Oct 2010 10:00:28 +0900 + +elm-webview (1.0.4) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.4 + + * text selection handle improvement + * Twitter insert text feature implementation + * Paste popup fix + * add TC + + -- Ryuan Choi Wed, 13 Oct 2010 16:54:37 +0900 + +elm-webview (1.0.2) unstable; urgency=low + + * Git: 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag elm-webview_1.0.3 + + * Add unapplied changes from elementary. + * Add pre-render after loaded (related to H0100108699) + + -- Ryuan Choi Mon, 11 Oct 2010 17:46:53 +0900 + +elm-webview (1.0.1) unstable; urgency=low + + * Initial release elm-webview + * Git : 165.213.180.234:/git/slp/pkgs/elm-webview + * Tag : elm-webview_1.0.1 + + -- Gyuyoung Kim Fri, 08 Oct 2010 14:07:42 +0900 + +elm-webview (1.0.0) unstable; urgency=low + + * split from elementary + + -- Mike McCormack Mon, 20 Sep 2010 17:56:41 +0900 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100755 index 0000000..61ccdd9 --- /dev/null +++ b/debian/control @@ -0,0 +1,25 @@ +Source: elm-webview +Section: web +Priority: optional +Maintainer: Kangil Han , Eunmi Lee , Ryuan Choi , Sangseok Lim , Jeongah Park , Jinwoo Song , Changhyup Jwa , Junghwan Kang +Uploaders: Gyuyoung Kim +Build-Depends: debhelper (>= 6), cdbs, libelm-dev, libappcore-efl-dev, libwebkit-engine-dev, libui-gadget-dev, libbundle-dev, libslp-utilx-dev, dlog-dev, libgnutls-dev, libslp-utilx-dev +Standards-Version: 3.8.1 +Homepage: N/A + +Package: libelm-webview-dev +Section: libdevel +Architecture: any +Depends: libelm-webview (= ${Source-Version}), libelm-dev, libappcore-efl-dev, libwebkit-engine-dev, libui-gadget-dev, libbundle-dev, libslp-utilx-dev, dlog-dev, libgnutls-dev +Description: Elementary webkit widget development headers + +Package: libelm-webview +Architecture: any +Depends: ${shlibs:Depends}, libelm +Description: Elementary webview widget + +Package: libelm-webview-dbg +Section: debug +Architecture: any +Depends: ${shilbs:Depends}, ${misc:Depends}, libelm-webview (= ${Source-Version}) +Description: Elementary webview widget (unstripped) diff --git a/debian/libelm-webview-dev.install b/debian/libelm-webview-dev.install new file mode 100644 index 0000000..a04f871 --- /dev/null +++ b/debian/libelm-webview-dev.install @@ -0,0 +1,2 @@ +/usr/include/* +/usr/lib/pkgconfig/*.pc diff --git a/debian/libelm-webview.install b/debian/libelm-webview.install new file mode 100644 index 0000000..df72ab5 --- /dev/null +++ b/debian/libelm-webview.install @@ -0,0 +1,3 @@ +/usr/lib/*.so.* +/usr/lib/*.so +/usr/bin/* diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..bfed6f4 --- /dev/null +++ b/debian/rules @@ -0,0 +1,136 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +CFLAGS ?= -Wall +CXXFLAGS ?= -Wall +LDFLAGS ?= +PREFIX ?= /usr +DATADIR ?= /opt + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +CFLAGS += -fPIC +LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--hash-style=both -Wl,--as-needed + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" cmake . -DCMAKE_INSTALL_PREFIX=$(PREFIX) + + touch configure-stamp + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/ncurses.sgml > ncurses.1 + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + cat $$f > $${f%.in}; \ + sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \ + sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \ + done + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + -$(MAKE) clean + rm -rf CMakeCache.txt + rm -rf CMakeFiles + rm -rf cmake_install.cmake + rm -rf Makefile + rm -rf install_manifest.txt + + rm -rf modal_utility/modal_launcher/CMakeCache.txt + rm -rf modal_utility/modal_launcher/CMakeFiles + rm -rf modal_utility/modal_launcher/cmake_install.cmake + rm -rf modal_utility/modal_launcher/Makefile + rm -rf modal_utility/modal_launcher/install_manifest.txt + +ifneq "$(wildcard /usr/share/misc/config.sub)" "" + cp -f /usr/share/misc/config.sub config.sub +endif +ifneq "$(wildcard /usr/share/misc/config.guess)" "" + cp -f /usr/share/misc/config.guess config.guess +endif + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + rm -f $${f%.in}; \ + done + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/ncurses. + $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install --list-missing --sourcedir=debian/tmp +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip --dbg-package=libelm-webview-dbg + dh_compress + dh_fixperms +# dh_perl + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/elm-webview.pc.in b/elm-webview.pc.in new file mode 100644 index 0000000..0f41e1f --- /dev/null +++ b/elm-webview.pc.in @@ -0,0 +1,11 @@ +prefix=@PREFIX@ +exec_prefix=@EXEC_PREFIX@ +libdir=@LIBDIR@ +includedir=@INCLUDEDIR@ + +Name: elm-webview +Description: Elementary webview widget +Version: @VERSION@ +Requires: ewebkit cairo elementary +Libs: -L${libdir} -lelm-webview +Cflags: -I${includedir}/elementary-webview-0 diff --git a/elm_webview.c b/elm_webview.c new file mode 100755 index 0000000..9c960e8 --- /dev/null +++ b/elm_webview.c @@ -0,0 +1,347 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "els_webview.h" +#include + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ +#ifdef BOUNCING_SUPPORT + Evas_Object *container; +#endif + Evas_Object *webkit; +}; + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_del(wd->webkit); + + free(wd); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Evas_Coord w, h; + evas_object_geometry_get(obj, NULL, NULL, &w, &h); +#ifdef BOUNCING_SUPPORT + Widget_Data *wd = elm_widget_data_get(obj); + evas_object_resize(wd->container, w, h); +#endif +} + +#ifdef BOUNCING_SUPPORT +static void +_resize(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + _sizing_eval(data); +} +#endif + +static void +_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + _sizing_eval(data); +} + +static void +_sub_del(void *data, Evas_Object *obj, void *event_info) +{ + _sizing_eval(obj); +} + +EAPI Evas_Object * +elm_webview_add(Evas_Object *parent, Eina_Bool tiled) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + wd = ELM_NEW(Widget_Data); + if (!wd) return NULL; + e = evas_object_evas_get(parent); + + obj = elm_widget_add(e); + elm_widget_type_set(obj, "webview"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + + wd->webkit = _elm_smart_webview_add(parent, tiled); +#ifdef BOUNCING_SUPPORT + wd->container = elm_smart_webview_container_add(e); + _elm_smart_webview_container_child_set(wd->container, wd->webkit); +#endif + _elm_smart_webview_widget_set(wd->webkit, obj); + evas_object_event_callback_add(wd->webkit, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + +#ifdef BOUNCING_SUPPORT + elm_widget_resize_object_set(obj, wd->container); + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj); +#else + elm_widget_resize_object_set(obj, wd->webkit); +#endif + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + return obj; +} + +EAPI Evas_Object * +elm_webview_webkit_get(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->webkit; +} + +EAPI void +elm_webview_layout_width_set_to_container(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_layout_width_set_to_container(wd->webkit); +} + +EAPI void +elm_webview_events_feed_set(Evas_Object *obj, Eina_Bool feed) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_events_feed_set(wd->webkit, feed); +} + +EAPI Eina_Bool +elm_webview_events_feed_get(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return _elm_smart_webview_events_feed_get(wd->webkit); +} + +EAPI void +elm_webview_auto_fitting_set(Evas_Object *obj, Eina_Bool enable) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_auto_fitting_set(wd->webkit, enable); +} + +EAPI Eina_Bool +elm_webview_auto_fitting_get(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return _elm_smart_webview_auto_fitting_get(wd->webkit); +} + +EAPI void +elm_webview_uri_set(Evas_Object *obj, const char *uri) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_uri_set(wd->webkit, uri); +} + +EAPI void +elm_webview_scheme_callback_set(Evas_Object *obj, const char *scheme, Elm_WebView_Scheme_Cb func) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_scheme_callback_set(wd->webkit, scheme, func); +} + +EAPI void +elm_webview_input_field_zoom_set(Evas_Object *obj, Eina_Bool zoom) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_input_field_zoom_set(wd->webkit, zoom); +} + +EAPI void +elm_webview_auto_suspend_set(Evas_Object *obj, Eina_Bool auto_suspend) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_auto_suspend_set(wd->webkit, auto_suspend); +} + +EAPI void +elm_webview_enable_default_context_menu_set(Evas_Object *obj, Eina_Bool enable) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_enable_default_context_menu_set(wd->webkit, enable); +} + +EAPI Eina_Bool +elm_webview_enable_default_context_menu_get(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return _elm_smart_webview_enable_default_context_menu_get(wd->webkit); +} + +EAPI void +elm_webview_context_menu_item_selected(Evas_Object *obj, Ewk_Context_Menu_Item *webkit_context_menu_item) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_context_menu_item_selected(wd->webkit, webkit_context_menu_item); +} + +EAPI void +elm_webview_enable_default_touch_set(Evas_Object *obj, Eina_Bool enable) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_enable_default_touch_set(wd->webkit, enable); +} + +EAPI void +elm_webview_horizontal_panning_hold_set(Evas_Object *obj, Eina_Bool hold) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_horizontal_panning_hold_set(wd->webkit, hold); +} + +EAPI void +elm_webview_vertical_panning_hold_set(Evas_Object *obj, Eina_Bool hold) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_vertical_panning_hold_set(wd->webkit, hold); +} + +EAPI Eina_Bool +elm_webview_vertical_panning_hold_get(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return _elm_smart_webview_vertical_panning_hold_get(wd->webkit); +} + +EAPI void +elm_webview_text_selection_clear(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_text_selection_clear(wd->webkit); +} + +EAPI void +elm_webview_cbhm_run(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_cbhm_run(wd->webkit); + +} + +EAPI void +elm_webview_use_mouse_down_delay_set(Evas_Object *obj, Eina_Bool use_mouse_down_delay) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_use_mouse_down_delay_set(wd->webkit, use_mouse_down_delay); +} + +EAPI Eina_Bool +elm_webview_use_mouse_down_delay_get(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return _elm_smart_webview_use_mouse_down_delay_get(wd->webkit); +} + +EAPI void +elm_webview_use_smart_zoom_set(Evas_Object *obj, Eina_Bool use_smart_zoom) +{ + return; +} + +EAPI Eina_Bool +elm_webview_use_smart_zoom_get(Evas_Object *obj) +{ + return EINA_FALSE; +} + +EAPI Eina_Bool +elm_webview_fixed_position_get(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return _elm_webview_fixed_position_get(wd->webkit); +} + +EAPI void +elm_webview_fixed_position_set(Evas_Object *obj, Eina_Bool enable) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + return _elm_webview_fixed_position_set(wd->webkit, enable); +} + +EAPI void +elm_webview_show_ime_on_autofocus_set(Evas_Object *obj, Eina_Bool enable) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_show_ime_on_autofocus_set(wd->webkit, enable); +} + +EAPI Eina_Bool +elm_webview_show_ime_on_autofocus_get(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return _elm_smart_webview_show_ime_on_autofocus_get(wd->webkit); +} + +EAPI void +elm_webview_use_tilt_zoom_set(Evas_Object *obj, Eina_Bool enable) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_smart_webview_use_tilt_zoom_set(wd->webkit, enable); +} + +EAPI Eina_Bool +elm_webview_show_magnifier_get(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return _elm_webview_show_magnifier_get(wd->webkit); +} + +EAPI void +elm_webview_show_magnifier_set(Evas_Object *obj, Eina_Bool enable) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_webview_show_magnifier_set(wd->webkit, enable); +} diff --git a/els_webview.c b/els_webview.c new file mode 100755 index 0000000..2d02057 --- /dev/null +++ b/els_webview.c @@ -0,0 +1,3511 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "els_webview.h" + +#include "els_touch.h" +#include "els_webview_editor.h" +#include "log.h" +#include "modal_util.h" +#include +#include + +//#define DEBUG_FRAMERATE + +static const char SMART_NAME[] = "els_webview"; +#define API_ENTRY Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (EINA_UNLIKELY((!sd) || strncmp(evas_object_type_get(obj), SMART_NAME, strlen(SMART_NAME)))) +#define INTERNAL_ENTRY Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd) return; +#define EWK_VIEW_PRIV_GET_OR_RETURN(sd, ptr, ...) \ + Ewk_View_Private_Data* ptr = ((Ewk_View_Smart_Data*)sd)->_priv; \ + if (EINA_UNLIKELY(!ptr)) \ + { \ + ELM_WEBVIEW_SLOGE("no private data for object %p (%s)", \ + ((Ewk_View_Smart_Data*)sd)->self, \ + evas_object_type_get(((Ewk_View_Smart_Data*)sd)->self));\ + return __VA_ARGS__; \ + } + +#define MAX_URI 512 + +#define WEBKIT_EDJ "/usr/share/edje/webkit.edj" + +// Webkit supports 0.48~7.38 zoom ratio. +#define MIN_ZOOM_RATIO 0.48f +#define MAX_ZOOM_RATIO 7.38f + +#define ZOOM_OUT_BOUNCING 0.85f +#define ZOOM_IN_BOUNCING 1.25f +#define BOUNCING_DISTANCE 400 + +// for FLASH FILE SUPPORT +#define LOCAL_FLASH_SUFFIX ".swf" +#define FLASH_MIME_TYPE "application/x-shockwave-flash" +#define FILE_PROTOCOL "file://" + +#define MOUSE_DOWN_DELAY_TIME 70 // ms +#define FOCUS_RING_INVALIDATE_DELAY_TIME 100 // ms + +// touch mode for EMBERWIND +#define TouchNormal 0 +#define TouchEmberwind 1 + +typedef struct _Smart_Data Smart_Data; +struct _Smart_Data { + Ewk_View_Smart_Data base; /* default data */ + Evas_Object *widget; + Evas_Object *parent; +#ifdef BOUNCING_SUPPORT + Evas_Object *container; +#endif + Ecore_Job *update_layout_job; + Ecore_Job *input_method_changed_job; + + Eina_Hash *scheme_func_hash; + unsigned char auto_fitting : 1; + unsigned char events_feed : 1; + unsigned char touch_event_feed : 1; + unsigned char plugin_mode : 1; // "plugin mode" is on + unsigned char plugin_mode_and_over_plugin : 1; // "plugin mode" is on and mouse down was over current plugin + unsigned char was_long_press : 1; // long press event came + unsigned char last_event_was_handled_by_plugin : 1; // last mouse event was handled by plugin + unsigned char on_flick : 1; + + struct { + char **options; + int option_cnt; + int option_idx; + } dropdown; + + struct { + Evas_Point basis; // basis point of zoom + int pre_distance; // distance between two finger in previous + int init_finger_distance; + int zooming_level; + float zooming_rate; + float zoom_rate_at_start; + float zoom_rate_to_set; + Evas_Point scroll_at_start; + Evas_Point scroll_to_set; + float init_zoom_rate; + float min_zoom_rate; //content based minimum + float latest_min_zoom_rate; /* This variable saves last calculated min zoom rate in WebView side. When EWebKit viewport is ready to replace whole zoom related calculation instead of WebView, this will be removed */ + float max_zoom_rate; + Eina_Bool scalable; + } zoom; + + struct { + int w, h; + } layout; + + float device_pixel_ratio; + + Ecore_Animator *smart_zoom_animator; + + Evas_Point pan_s; + Evas_Event_Mouse_Down mouse_down_copy; + Evas_Event_Mouse_Up mouse_up_copy; + Evas_Event_Mouse_Move mouse_move_copy; + + Eina_Bool scrolled; + + Eina_Bool tiled; + Eina_Bool on_panning; + Eina_Bool on_zooming; + + Eina_Bool text_selection_initialized; + + void *touch_obj; + + Ecore_Idler *flush_idler; + Eina_Bool use_zoom_bouncing; // FIXME : Can we decde this when compile time? or we should add API? + + Elm_WebView_Create_Webview_Data* createwebview_data; + + Eina_Bool use_input_field_zoom; + Eina_Bool auto_suspend; + + Eina_Rectangle focused_rect; + Eina_Rectangle caret; + bool is_ise; + bool is_ise_flash; + Eina_Bool use_select_tag_zoom; + + unsigned int current_imh; + + Eina_Bool enable_default_touch; + Eina_Bool horizontal_panning_hold; + Eina_Bool panning_x_edge; + Eina_Bool vertical_panning_hold; + Eina_Bool panning_y_edge; +#ifdef DEBUG_FRAMERATE + double start_time; + int count; +#endif + + // mouse down delay + Eina_Bool use_mouse_down_delay; + Eina_Bool is_mouse_down_propagated; + Eina_Bool restore_press_timer; + Ecore_Timer *mouse_down_delay_timer; + Eina_Bool is_mouse_down_on_link; + Ecore_Timer *focus_ring_invalidate_timer; + + Elm_WebView_Editor* editor; + + // if popup is already opened when _smart_load_started is called, + // then clear popup before load new page + Evas_Object* geolocation_popup; + + // touch mode for EMBERWIND + int touch_mode; + + // we still need this flag + // because ecore_job_add() can pass only 1 parameter to changed_viewport_apply() + bool is_viewport_argument_exist; +}; + +/* local subsystem functions */ +static void _smart_show(Evas_Object *obj); +static void _smart_hide(Evas_Object *obj); +static void _smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y); +#ifdef DEBUG +static void _smart_calculate(Evas_Object *obj); +#endif +static Eina_Bool _smart_mouse_down(Ewk_View_Smart_Data *esd, const Evas_Event_Mouse_Down *ev); +static Eina_Bool _smart_mouse_up(Ewk_View_Smart_Data *esd, const Evas_Event_Mouse_Up *ev); +static Eina_Bool _smart_mouse_move(Ewk_View_Smart_Data *esd, const Evas_Event_Mouse_Move *ev); +static void _smart_run_javascript_alert(Ewk_View_Smart_Data *esd, Evas_Object *frame, const char *message); +static Eina_Bool _smart_run_javascript_confirm(Ewk_View_Smart_Data *esd, Evas_Object *frame, const char *message); +static Eina_Bool _smart_run_javascript_prompt(Ewk_View_Smart_Data *esd, Evas_Object *frame, const char *message, const char *defaultValue, char **value); +static Eina_Bool _smart_should_interrupt_javascript(Ewk_View_Smart_Data *esd); +static Eina_Bool _smart_run_open_panel(Ewk_View_Smart_Data *esd, Evas_Object *frame, Eina_Bool allows_multiple_files, Eina_List *accept_types, Eina_List **selected_filenames); +static Eina_Bool _smart_navigation_policy_decision(Ewk_View_Smart_Data *esd, Ewk_Frame_Resource_Request *request); +static Evas_Object* _smart_window_create(Ewk_View_Smart_Data *esd, Eina_Bool javascript, Eina_Bool isMobile, const Ewk_Window_Features *window_features, int navigation_action, const char* frame_name); +static Eina_Bool _smart_events_handled_by_plugin_changed(Ewk_View_Smart_Data *esd, Eina_Bool newValue); +static void _smart_load_started(void *data, Evas_Object *webview, void *error); +static void _smart_load_finished(void *data, Evas_Object *webview, void *arg); +static void _smart_viewport_changed(void *data, Evas_Object *webview, void* arg); +static void _request_layout(Smart_Data *sd); +static void _smart_input_method_changed(void *data, Evas_Object *webview, void *arg); +static void _smart_contents_size_changed(void *data, Evas_Object *frame, void *arg); +static void _smart_cb_view_resized(void *data, Evas_Object *webview, void *arg); +static void _smart_load_nonemptylayout_finished(void *data, Evas_Object *frame, void *arg); +static void _smart_cb_zoom_set(void *data, Evas_Object *webview, void *arg); +static void _smart_add(Evas_Object *obj); +static void _smart_del(Evas_Object *o); +// touch processor callbacks +static void _smart_cb_mouse_down(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_mouse_up(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_mouse_tap(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_one_move_start(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_one_move(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_one_move_end(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_two_press(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_two_release(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_two_move_start(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_two_move(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_two_move_end(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_one_down_up_down(void *data, Evas_Object *webview, void *ev); + +static void _smart_cb_pan_start(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_pan_by(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_pan_end(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_mouse_long_press(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_ise_event(void *data, Ecore_IMF_Context *ctx, int value); +static void _suspend_all(Smart_Data *sd); +static void _resume_all(Smart_Data *sd); +static void _adjust_to_contents_boundary(Evas_Object *webview, Evas_Coord *to_x, Evas_Coord *to_y, + Evas_Coord from_x, Evas_Coord from_y, float new_zoom_rate); +static Eina_Bool _smart_zoom_animator(void *data); +static void _zoom_to_rect(Smart_Data *sd, Eina_Rectangle *rect, Eina_Rectangle *caret); +static void _coords_evas_to_ewk(Evas_Object *webview, int x, int y, int* ux, int* uy); +static void _coords_ewk_to_evas(Evas_Object *webview, int x, int y, int* ux, int* uy); +static void _update_min_zoom_rate(Evas_Object *obj); +static void _geolocation_permission_callback(void *geolocation_obj, const char* url); + +static Eina_List *_touch_point_list_get(unsigned int num_of_points, const Touch_Point *p_points); +static Eina_Bool _touch_down(Evas_Object *o, const Evas_Event_Mouse_Down *mouse_down); +static Eina_Bool _touch_up(Evas_Object *o, const Evas_Event_Mouse_Up *mouse_down); +static Eina_Bool _touch_cancel(Evas_Object *o); + +static void _smart_cb_make_select_visible(void *data, Evas_Object *webview, void *arg); +static void _smart_cb_make_rect_visible(void *data, Evas_Object *webview, void *arg); +static Eina_Bool _focus_ring_exceptional_url_get(Evas_Object *webview); + +/* local subsystem globals */ +static Evas_Smart *_smart = NULL; +static Ewk_View_Smart_Class _parent_sc = EWK_VIEW_SMART_CLASS_INIT_NULL; + +static Evas_Object *obj = NULL; /* FIXME: Is it a right approach? */ + +/* externally accessible functions */ + +/** + * @fn Evas_Object *_elm_smart_webview_add(Evas_Object *parent, Eina_Bool tiled) + * @brief add webview object which inherited by ewk_view. + * + * @param[in] parent parent object. + * @param[in] tiled whether webview use tiled backingstore or single backingstore. + * @return webview object. + */ +Evas_Object * +_elm_smart_webview_add(Evas_Object *parent, Eina_Bool tiled) +{ + Evas_Object *webview; + Evas *evas = evas_object_evas_get(parent); + + if (!_smart) + { + /* create subclass */ + static Ewk_View_Smart_Class _api = EWK_VIEW_SMART_CLASS_INIT_VERSION; + const char* name = eina_stringshare_add("els_webview"); + _api.sc.name = name; + + if (tiled) + { + ewk_view_tiled_smart_set(&_api); + if (EINA_UNLIKELY(!_parent_sc.sc.add)) + ewk_view_tiled_smart_set(&_parent_sc); + + } + else + { + ewk_view_single_smart_set(&_api); + if (EINA_UNLIKELY(!_parent_sc.sc.add)) + ewk_view_single_smart_set(&_parent_sc); + } + + _api.sc.add = _smart_add; + _api.sc.del = _smart_del; + _api.sc.show = _smart_show; + _api.sc.hide = _smart_hide; + _api.sc.move = _smart_move; +#ifdef DEBUG + _api.sc.calculate = _smart_calculate; +#endif + _api.mouse_down = _smart_mouse_down; + _api.mouse_up = _smart_mouse_up ; + _api.mouse_move = _smart_mouse_move; + + _api.run_javascript_alert = _smart_run_javascript_alert; + _api.run_javascript_confirm = _smart_run_javascript_confirm; + _api.run_javascript_prompt = _smart_run_javascript_prompt; + _api.should_interrupt_javascript = _smart_should_interrupt_javascript; + _api.run_open_panel = _smart_run_open_panel; + _api.navigation_policy_decision = _smart_navigation_policy_decision; + _api.window_create = _smart_window_create; + _api.events_handled_by_plugin_changed = _smart_events_handled_by_plugin_changed; + + _smart = evas_smart_class_new(&_api.sc); + } + + if (!_smart) + { + ELM_WEBVIEW_SLOGE("could not create smart class\n"); + return NULL; + } + + webview = evas_object_smart_add(evas, _smart); + if (!webview) + { + ELM_WEBVIEW_SLOGE("could not create smart object for webview"); + return NULL; + } + obj = webview; + + Smart_Data *sd = evas_object_smart_data_get(webview); + if (sd) + { + sd->parent = parent; + sd->tiled = tiled; + + els_webview_editor_webview_parent_set(sd->editor, parent); + + // initialize viewport argument existence + sd->is_viewport_argument_exist = false; + } + + ewk_view_setting_enable_auto_resize_window_set(webview, false); + + return webview; +} + +/** + * @fn void _elm_smart_webview_layout_width_set_to_container(Evas_Object *obj) + * + * @param[in] object els-webview. + */ +void +_elm_smart_webview_layout_width_set_to_container(Evas_Object *obj) +{ + API_ENTRY return; +} + +/** + * @fn void _elm_smart_webview_events_feed_set(Evas_Object *obj, Eina_Bool feed) + * @brief set flag whether native mouse events should be feed or not. + * + * @param[in] object els-webview. + * @param[in] feed EINA_TRUE if should be feeded, EINA_FALSE or not. + */ +void +_elm_smart_webview_events_feed_set(Evas_Object *obj, Eina_Bool feed) +{ + API_ENTRY return; + sd->events_feed = feed; +} + +/** + * @fn Eina_Bool _elm_smart_webview_events_feed_get(Evas_Object *obj) + * @brief return feedability which webview feed mouse events to EWK. + * + * @param[in] object els-webview. + * @return EINA_TRUE if els-webview feed mouse event to EWK. EINA_FALSE if else or on errors. + */ +Eina_Bool +_elm_smart_webview_events_feed_get(Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->events_feed; +} + +/** + * @fn void _elm_smart_webview_auto_fitting_set(Evas_Object *obj, Eina_Bool enable) + * @brief Set the ability for the webkit object to fit the contents after loading. + * + * If It was EINA_TRUE, elm_webview treate touch event like mouse event. + * So, panning and zooming are not allowed. + * + * @param[in] obj els-webview + * @param[in] enable boolean pointer in which to enable feeding events to webkit + */ +void +_elm_smart_webview_auto_fitting_set(Evas_Object *obj, Eina_Bool enable) +{ + API_ENTRY return; + sd->auto_fitting = enable; +} + +/** + * @fn Eina_Bool _elm_smart_webview_auto_fitting_get(Evas_Object *obj) + * @brief Get the ability for the webkit object to fit the contents after loading. + * + * @param[in] obj els-webview + * @return Eina_True if webview fit the contents after loading. Eina_False if else or on errors. + */ +Eina_Bool +_elm_smart_webview_auto_fitting_get(Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->auto_fitting; +} + +/** + * @fn void elm_webview_uri_set(Evas_Object *obj, const char *uri) + * @brief Set uri to load. + * + * @param[in] obj els-webview + * @param[in] uri uniform resource identifier to load. It can omit http: + */ +void +_elm_smart_webview_uri_set(Evas_Object *obj, const char *uri) +{ + API_ENTRY return; + + char full_uri[MAX_URI] = ""; + + if (uri == NULL) return; + + /* check uri string */ + int len = strlen(uri); + if (len) + { + if (strstr(uri, "://") == NULL) + { + strncpy(full_uri, "http://", 7); + full_uri[7] = '\0'; + len = (len >= (MAX_URI - 7)) ? (MAX_URI - 8) : len; + strncat(full_uri, uri, len); + } + else + { + len = (len >= MAX_URI) ? (MAX_URI - 1) : len; + strncpy(full_uri, uri, len); + full_uri[len] = '\0'; + } + + // touch mode for EMBERWIND + if (strstr(full_uri, "operasoftware.github.com/Emberwind")) { + sd->touch_mode = TouchEmberwind; + ELM_WEBVIEW_SLOGD("<< TouchEmberwind enabled >>\n"); + } else { + sd->touch_mode = TouchNormal; + ELM_WEBVIEW_SLOGD("<< TouchNormal enabled >>\n"); + } + + ELM_WEBVIEW_SLOGD("<< full uri [%s] >>\n", full_uri); + ewk_view_uri_set(obj, full_uri); + } +} + +/** + * @fn void _elm_smart_webview_widget_set(Evas_Object *obj, Evas_Object *wid) + * @brief set elm webview into els-webview. + * + * @param[in] obj els-webview. + * @param[in] wid elm-webview. + */ +void +_elm_smart_webview_widget_set(Evas_Object *obj, Evas_Object *wid) +{ + API_ENTRY return; + sd->widget = wid; + + els_webview_editor_webview_widget_set(sd->editor, wid); +} + +/** + * @fn void _elm_smart_webview_scheme_callback_set(Evas_Object *obj, const char *scheme, Elm_WebView_Scheme_Cb func) + * @brief Add callback to treat scheme(mms:, tel:, and so on). + * + * See elm_webview_scheme_callback_set + * + * @param[in] obj els-webview. + * @param[in] scheme The scheme which user want to receive + * @param[in] func callback when user choose link which involved @scheme + */ +void +_elm_smart_webview_scheme_callback_set(Evas_Object *obj, const char *scheme, Elm_WebView_Scheme_Cb func) +{ + API_ENTRY return; + if (!sd->scheme_func_hash) + sd->scheme_func_hash = eina_hash_string_small_new(NULL); + + char *lower_scheme = strdup(scheme); + eina_str_tolower(&lower_scheme); + if (!func) + eina_hash_del(sd->scheme_func_hash, lower_scheme, func); + else + eina_hash_add(sd->scheme_func_hash, lower_scheme, func); + free(lower_scheme); +} + +/** + * @fn void _elm_smart_webview_input_field_zoom_set(Evas_Object *obj, Eina_Bool zoom) + * @brief turn on/off the input field zoom effect + * + * See elm_webview_input_field_zoom_set + * + * @param[in] obj els-webview. + * @param[in] zoom EINA_TRUE if you want to use input field zoom, EINA_FALSE otherwise. + */ +void +_elm_smart_webview_input_field_zoom_set(Evas_Object *obj, Eina_Bool zoom) +{ + API_ENTRY return; + sd->use_input_field_zoom = zoom; +} + +/** + * @fn void _elm_smart_webview_auto_suspend_set(Evas_Object *obj, Eina_Bool auto_suspend) + * @brief turn on/off the auto suspend + * + * See elm_webview_auto_suspend_set + * + * @param [in] obj The WebView object + * @param [in] zoom EINA_TRUE if you want to use auto suspend, EINA_FALSE otherwise. + */ +void +_elm_smart_webview_auto_suspend_set(Evas_Object *obj, Eina_Bool auto_suspend) +{ + API_ENTRY return; + sd->auto_suspend = auto_suspend; +} + +#ifdef BOUNCING_SUPPORT +/** + * @fn void _elm_smart_webview_container_set(Evas_Object *obj, Evas_Object *container) + * @brief set container which have els-webview when bounce was enabled. + * + * @param[in] object els-webview. + * @param[in] container which have els-webview. + * @return webview object. + */ +void +_elm_smart_webview_container_set(Evas_Object *obj, Evas_Object *container) +{ + API_ENTRY return; + sd->container = container; +} +#endif + +/** + * @fn void _elm_smart_webview_enable_default_context_menu_set(Evas_Object* obj, Eina_Bool enable) + * @brief Set the ability for the webview object to show default context menu. + * + * See elm_webview_enable_default_context_menu_set + * + * @param[in] object els-webview. + * @param[in] enable boolean pointer in which to enable feeding events to webkit + */ +void +_elm_smart_webview_enable_default_context_menu_set(Evas_Object* obj, Eina_Bool enable) +{ + API_ENTRY return; + + els_webview_editor_enable_default_context_menu_set(sd->editor, enable); +} + +/** + * @fn Eina_Bool _elm_smart_webview_enable_default_context_menu_get(Evas_Object *obj) + * @brief Get the ability for the webview object to show default context menu. + * + * @param[in] object els-webview. + * @return Eina_True if default context menu was enabled, EINA_FALSE otherwise. + */ +Eina_Bool +_elm_smart_webview_enable_default_context_menu_get(Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + + return els_webview_editor_enable_default_context_menu_get(sd->editor); +} + +/** + * @fn void _elm_smart_webview_context_menu_item_selected(Evas_Object *obj, Ewk_Context_Menu_Item *webkit_context_menu_item) + * @brief Informs webview about context menu item being selected + * + * @param[in] object els-webview. + * @param[in] webkit_context_menu_item pointer to a selected item + */ +void +_elm_smart_webview_context_menu_item_selected(Evas_Object *obj, Ewk_Context_Menu_Item *webkit_context_menu_item) +{ + API_ENTRY return; + + els_webview_editor_context_menu_item_selected(sd->editor, webkit_context_menu_item); +} + +/** + * @fn void _elm_smart_webview_enable_default_touch_set(Evas_Object *obj, Eina_Bool enable) + * @brief enable/disable default touch processor of webview + * + * @param[in] object els-webview. + * @param[in] enable boolean value to enable default touch or not + */ +void +_elm_smart_webview_enable_default_touch_set(Evas_Object *obj, Eina_Bool enable) +{ + API_ENTRY return; + sd->enable_default_touch = enable; +} + +/** + * @fn void _elm_smart_webview_horizontal_panning_hold_set(Evas_Object *obj, Eina_Bool hold) + * @brief hold/unhold horizontal panning. + * horizontal panning will be stopped during hold, and will be done during unhold. + * + * @param[in] object els-webview. + * @param[in] enable boolean value to hold/unhold horizontal panning + */ +void +_elm_smart_webview_horizontal_panning_hold_set(Evas_Object *obj, Eina_Bool hold) +{ + API_ENTRY return; + sd->horizontal_panning_hold = hold; + sd->panning_x_edge = EINA_FALSE; +} + +/** + * @fn void _elm_smart_webview_vertical_panning_hold_set(Evas_Object *obj, Eina_Bool hold) + * @brief hold/unhold vertical panning. + * vertical panning will be stopped during hold, and will be done during unhold. + * + * @param[in] object els-webview. + * @param[in] enable boolean value to hold/unhold vertical panning + */ +void +_elm_smart_webview_vertical_panning_hold_set(Evas_Object *obj, Eina_Bool hold) +{ + API_ENTRY return; + sd->vertical_panning_hold = hold; + sd->panning_y_edge = EINA_FALSE; +} + +/** + * @fn Eina_Bool _elm_smart_webview_vertical_panning_hold_get(Evas_Object *obj) + * @brief Get hold/unhold vertical panning status. + * vertical panning will be stopped during hold, and will be done during unhold. + * + * @param[in] object els-webview. + * @return Eina_True if vertical panning hold set is enabled, EINA_FALSE otherwise + */ +Eina_Bool +_elm_smart_webview_vertical_panning_hold_get(Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->vertical_panning_hold; +} + +/** + * @fn void _elm_smart_webview_text_selection_clear(Evas_Object *obj) + * @brief clear text selection area + * + * @param[in] object els-webview. + */ +void +_elm_smart_webview_text_selection_clear(Evas_Object *obj) +{ + API_ENTRY return; + + els_webview_editor_selection_mode_change(sd->editor, TEXT_SELECTION_MODE_OFF); +} + +void +_elm_smart_webview_cbhm_run(Evas_Object *obj) +{ + API_ENTRY return; + + els_webview_editor_cbhm_run(sd->editor); +} + +/** + * @fn void _elm_smart_webview_use_mouse_down_delay_set(Evas_Object *obj, Eina_Bool use_mouse_down_delay) + * @brief set use_mouse_down_delay + * + * @param[in] obj els-webview Evas_Object. + * @param[in] use_mouse_down_delay value to set to the use_mouse_down_delay variable. + */ +void +_elm_smart_webview_use_mouse_down_delay_set(Evas_Object *obj, Eina_Bool use_mouse_down_delay) +{ + API_ENTRY return; + sd->use_mouse_down_delay = use_mouse_down_delay; +} + +/** + * @fn Eina_Bool _elm_smart_webview_use_mouse_down_delay_get(Evas_Object *obj) + * @brief get use_mouse_down_delay value + * + * @param[in] obj els-webview Evas_Object. + * @return EINA_TRUE if use_mouse_down_delay is true. EINA_FALSE if else or on errors. + */ +Eina_Bool +_elm_smart_webview_use_mouse_down_delay_get(Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->use_mouse_down_delay; +} + +/** + * @fn void _elm_webview_fixed_position_get(Evas_Object *obj) + * @brief gets if WebView should fix its position. + * + * @param[in] obj els-webview Evas_Object. + */ + Eina_Bool +_elm_webview_fixed_position_get(Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + + if ((els_webview_editor_selection_mode_get(sd->editor) & TEXT_SELECTION_MAGNIFIER) + || (sd->plugin_mode && sd->plugin_mode_and_over_plugin)) + return EINA_TRUE; + else + return EINA_FALSE; +} + +/** + * @fn void _elm_webview_fixed_position_set(Evas_Object *obj, Eina_Bool enable); + * @brief enables/disables fixed position of WebView. + * + * @param[in] obj An WebView object + * @param[in] enable boolean value to enable fixed position of WebView or not. + */ + void +_elm_webview_fixed_position_set(Evas_Object *obj, Eina_Bool enable) +{ + API_ENTRY return; + + sd->plugin_mode = sd->plugin_mode_and_over_plugin = enable; +} + +/** +* @fn void _elm_smart_webview_layout_width_set_to_container_get(Evas_Object *obj) +* @brief gets is_layout_width_set_to_container value. +* +* @param[in] obj els-webview Evas_Object. +*/ +Eina_Bool +_elm_smart_webview_layout_width_set_to_container_get(Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return EINA_TRUE; +} + +/** + * @fn void _elm_smart_webview_show_ime_on_autofocus_set(Evas_Object *obj, Eina_Bool enable); + * @brief sets whether autofocus events from web sites will trigger showing virtual keyboard or not. + * + * @param[in] obj the WebView object. + * @param[in] enable a boolean value to enable autofocus events triggering showing virtual keyboard. + */ +void +_elm_smart_webview_show_ime_on_autofocus_set(Evas_Object *obj, Eina_Bool enable) +{ + API_ENTRY return; + + ewk_view_show_ime_on_autofocus_set(obj, enable); +} + +/** + * @fn Eina_Bool _elm_smart_webview_show_ime_on_autofocus_get(Evas_Object *obj) + * @brief Gets if autofocus will trigger showing keyboard or not. + * + * @param[in] obj the WebView object. + * @return EINA_TRUE if autofocus will trigger showing keyboard. EINA_FALSE otherwise. + */ +Eina_Bool +_elm_smart_webview_show_ime_on_autofocus_get(Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + + return ewk_view_show_ime_on_autofocus_get(obj); +} + +/** + * @fn void _elm_smart_webview_use_tilt_zoom_set(Evas_Object *obj, Eina_Bool enable); + * @brief sets whether application use tilt zoom or not. + * + * @param[in] obj the WebView object. + * @param[in] enable a boolean value to enable tilt zoom. + */ +void +_elm_smart_webview_use_tilt_zoom_set(Evas_Object *obj, Eina_Bool enable) +{ + API_ENTRY return; +} + +/** + * @fn Eina_Bool _elm_webview_show_magnifier_get(Evas_Object *obj); + * @brief gets whether webview shows magnifier for text selection or not. + * + * @param[in] obj the WebView object. + * @return EINA_TRUE if webview shows magnifier. EINA_FALSE otherwise. + */ +Eina_Bool +_elm_webview_show_magnifier_get(Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return els_webview_editor_show_magnifier_get(sd->editor); +} + +/** + * @fn void _elm_webview_show_magnifier_set(Evas_Object *obj, Eina_Bool enable); + * @brief sets whether webview shows magnifier for text selection or not. + * + * @param[in] obj the WebView object. + * @param[in] enable a boolean value to enable magnifier. + */ +void +_elm_webview_show_magnifier_set(Evas_Object *obj, Eina_Bool enable) +{ + API_ENTRY return; + els_webview_editor_show_magnifier_set(sd->editor, enable); +} + +/** + * @fn Eina_Bool _flush(void *data) + * @brief idler function to flush unused cache. + * + * @param[in] data els-webview + */ +/* FIXME: Is it static function? */ +Eina_Bool +_flush(void *data) +{ + ELM_WEBVIEW_SLOGD("\n"); + Evas_Object *obj = (Evas_Object *)data; + API_ENTRY { + if (sd) + sd->flush_idler = NULL; + return ECORE_CALLBACK_CANCEL; + } + + if(!(els_webview_editor_selection_mode_get(sd->editor) == TEXT_SELECTION_MODE_OFF)) + els_webview_editor_selection_mode_change(sd->editor, TEXT_SELECTION_PAN_START); + + Ewk_Tile_Unused_Cache *tuc = ewk_view_tiled_unused_cache_get(obj); + ewk_tile_unused_cache_flush(tuc, ewk_tile_unused_cache_used_get(tuc)); + + if(!(els_webview_editor_selection_mode_get(sd->editor) == TEXT_SELECTION_MODE_OFF)) + { + els_webview_editor_selection_update_position(sd->editor, NULL); + els_webview_editor_selection_mode_change(sd->editor, TEXT_SELECTION_PAN_END); + } + + sd->flush_idler = NULL; + return ECORE_CALLBACK_CANCEL; +} + +/* local subsystem functions */ + +/** + * @fn static void _smart_show(Evas_Object *obj) + * @brief callback to show evas_object. + * + * @param[in] data els-webview + */ +static void +_smart_show(Evas_Object *obj) +{ + ELM_WEBVIEW_SLOGD("\n"); + INTERNAL_ENTRY; + + if (sd->enable_default_touch) + _elm_smart_touch_start(sd->touch_obj); + _parent_sc.sc.show(obj); +} + +/** + * @fn static void _smart_hide(Evas_Object *obj) + * @brief callback to hide evas_object. + * + * @param[in] data els-webview + */ +static void +_smart_hide(Evas_Object *obj) +{ + ELM_WEBVIEW_SLOGD("\n"); + INTERNAL_ENTRY; + + _elm_smart_touch_stop(sd->touch_obj); + _parent_sc.sc.hide(obj); +} + +/** + * @fn static void _smart_cb_view_resized(Evas_Object *obj) + * @brief "view,resized" callback by _ewk_view_smart_calculate + * + * @param[in] data smart data of webview + * @param[in] webview els-weview + * @param[in] arg not used + */ +static void +_smart_cb_view_resized(void *data, Evas_Object *webview, void *arg) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + + int object_x, object_y, object_w, object_h; + evas_object_geometry_get(obj, &object_x, &object_y, &object_w, &object_h); + + els_webview_editor_view_geometry_changed(sd->editor, object_x, object_y, object_w, object_h); + + const char *url = ewk_view_uri_get(obj); + if (url && strlen(url) != 0 && sd->flush_idler == NULL) + sd->flush_idler = ecore_idler_add(_flush, obj); + + Ecore_IMF_Context *im_Context = ewk_view_core_imContext_get(sd->base.self); + Eina_Rectangle im_size; + ecore_imf_context_input_panel_geometry_get(im_Context, &im_size.x, &im_size.y, &im_size.w, &im_size.h); + + int webview_w, webview_h; + evas_object_geometry_get(ewk_view_frame_main_get(sd->base.self), NULL, NULL, &webview_w, &webview_h); + ELM_WEBVIEW_SLOGD("webview_h[%d]object_h[%d]ime[%d]\n", webview_h, object_h, im_size.h); + + // ise_event does not occur when input field is in flash plugin. + // Need to check ime size because of rotating. + if ((sd->is_ise_flash) && ((webview_h + im_size.h) == object_h)) + sd->is_ise_flash = EINA_FALSE; + + if (sd->is_ise_flash || sd->is_ise) + _zoom_to_rect(sd, &(sd->focused_rect), &(sd->caret)); + + _request_layout(sd); +} + +/** + * @fn static void _smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) + * @brief callback to move evas_object. + * + * @param[in] data els-webview + * @param[in] x x + * @param[in] y y + */ +static void +_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) +{ + ELM_WEBVIEW_SLOGD("x[%d] y[%d]\n", x, y); + INTERNAL_ENTRY; + + // prevent scrolling page when events goes to plugin + if (sd->plugin_mode && sd->plugin_mode_and_over_plugin) return; + + els_webview_editor_selection_update_position(sd->editor, NULL); + + _parent_sc.sc.move(obj, x, y); +} + +#ifdef DEBUG +/** + * @fn static void _smart_calculate(Evas_Object *obj) + * @brief callback to calculdate els-webview. + * + * @param[in] data els-webview + */ +static void +_smart_calculate(Evas_Object *obj) +{ + _parent_sc.sc.calculate(obj); +} +#endif + +/** + * @fn static Eina_Bool _smart_mouse_down(Ewk_View_Smart_Data *esd, const Evas_Event_Mouse_Down *ev) + * @brief callback to do when els-webview pressed. + * it overrides ewk_view's mouse_down callback. + * we use this callback to block the original mouse_down callback in the ewk_view. + * + * @param[in] esd smart data of els-webview + * @param[in] ev event of mouse down + */ +static Eina_Bool +_smart_mouse_down(Ewk_View_Smart_Data *esd, const Evas_Event_Mouse_Down *ev) +{ + ELM_WEBVIEW_SLOGD("[NATIVE]\n"); + Smart_Data *sd = (Smart_Data *)esd; + if (!sd) return EINA_TRUE; + + // save mouse down event + sd->mouse_down_copy = *ev; + + els_webview_editor_mouse_down_set(sd->editor, *ev); + + // we do not propagate 'mouse down' in this callback. + // we will pass 'mouse down' in the _smart_cb_mouse_down (touch_processor's callback) + // However, if events_feed is set, propagate mouse_down here + if (sd->events_feed) + { + /* we remember a mouse down was clicked to then check in _smart_cb_editorclient_selection_changed + * whether to show popup or not */ + if (els_webview_editor_selection_mode_get(sd->editor) & TEXT_SELECTION_INPUT) + els_webview_editor_selection_mode_change(sd->editor, TEXT_SELECTION_MOUSE_DOWN); + if (!_touch_down(sd->base.self, ev)) + _parent_sc.mouse_down(esd, ev); + return EINA_TRUE; + } + + return EINA_TRUE; +} + +/** + * @fn static void _smart_mouse_up_job(void *data) + * @brief send mouse_event to plugin to avoid the event confusion by nested main_loop. + * + * @param[in] data smart data of webview + */ +static void +_smart_mouse_up_job(void *data) +{ + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + Ewk_View_Smart_Data *esd = (Ewk_View_Smart_Data*)sd; + Evas_Event_Mouse_Up *ev = &sd->mouse_up_copy; + _parent_sc.mouse_up(esd, ev); +} + +/** + * @fn static Eina_Bool _smart_mouse_up(Ewk_View_Smart_Data *esd, const Evas_Event_Mouse_Up *ev) + * @brief callback to do when els-webview released + * + * @param[in] esd smart data of els-webview + * @param[in] ev event of mouse up + */ +static Eina_Bool +_smart_mouse_up(Ewk_View_Smart_Data *esd, const Evas_Event_Mouse_Up *ev) +{ + ELM_WEBVIEW_SLOGD("[NATIVE]\n"); + EINA_SAFETY_ON_NULL_RETURN_VAL(esd, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(ev, EINA_FALSE); + + Smart_Data *sd = (Smart_Data *)esd; + + sd->mouse_up_copy = *ev; + + // delete mouse_down_delay_timer + if (sd->use_mouse_down_delay) + { + if (sd->mouse_down_delay_timer) + { + ecore_timer_del(sd->mouse_down_delay_timer); + sd->mouse_down_delay_timer = NULL; + } + } + + if (sd->events_feed) + { + /* check if user hold touch */ + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + return EINA_TRUE; + + Eina_Bool ret = EINA_TRUE; + + if (!_touch_up(sd->base.self, ev)) + ret = _parent_sc.mouse_up(esd, ev); + return ret; + } + else + { + if (sd->is_mouse_down_propagated) + { + if (!sd->was_long_press) { + if (sd->plugin_mode && sd->plugin_mode_and_over_plugin) + ecore_job_add(_smart_mouse_up_job, sd); // send mouse up to plugin when there was long press before, and above plugin + else + _parent_sc.mouse_up(esd, ev); + } + } + else + { + if (sd->was_long_press && !sd->touch_event_feed) + _touch_cancel(sd->base.self); + else + _touch_up(sd->base.self, ev); + } + + return EINA_TRUE; + } +} + +/** + * @fn static Eina_Bool _smart_mouse_move(Ewk_View_Smart_Data *esd, const Evas_Event_Mouse_Move *ev) + * @brief callback to do when els-webview moved + * + * @param[in] esd smart data of els-webview + * @param[in] ev event of mouse move + */ +static Eina_Bool +_smart_mouse_move(Ewk_View_Smart_Data *esd, const Evas_Event_Mouse_Move *ev) +{ + Smart_Data *sd = (Smart_Data *)esd; + + sd->mouse_move_copy = *ev; + + Touch_Point point; + point.device = 0; + point.x = ev->cur.output.x; + point.y = ev->cur.output.y; + point.state = TOUCH_POINT_MOVED; + + if ((sd->events_feed || (sd->plugin_mode && sd->plugin_mode_and_over_plugin)) && + !ewk_frame_feed_touch_event(sd->base.main_frame, EWK_TOUCH_MOVE, _touch_point_list_get(1, &point), 0)) + return _parent_sc.mouse_move(esd, ev); + else + return EINA_TRUE; +} + +/** + * @fn static void _smart_run_javascript_alert(Ewk_View_Smart_Data *esd, Evas_Object *frame, const char *message) + * @brief open alert dialog. + * + * @param[in] esd smart data of els-webview + * @param[in] frame ewk frame object which call alert. + * @param[in] message message which alert dialog show. + */ +static void +_smart_run_javascript_alert(Ewk_View_Smart_Data *esd, Evas_Object *frame, const char *message) +{ + modal_util_alert(message); +} + +/** + * @fn static Eina_Bool _smart_run_javascript_confirm(Ewk_View_Smart_Data *esd, Evas_Object *frame, const char *message) + * @brief open confirm dialog. + * + * @param[in] esd smart data of els-webview + * @param[in] frame ewk frame object which call confirm. + * @param[in] message message which confirm dialog show. + * @return EINA_TRUE if user select OK, EINA_FALSE if else or on errors. + */ +static Eina_Bool +_smart_run_javascript_confirm(Ewk_View_Smart_Data *esd, Evas_Object *frame, const char *message) +{ + return modal_util_confirm(message); +} + +/** + * @fn static Eina_Bool _smart_run_javascript_prompt(Ewk_View_Smart_Data *esd, Evas_Object *frame, const char *message, const char *defaultValue, char **value) + * @brief open dialog which have input field. + * + * @param[in] esd smart data of els-webview + * @param[in] frame ewk frame object which call file dialog. + * @param[in] message message which prompt dialog show. + * @param[in] defaultValue default string of edit field. + * @param[in] value of edit field which user insert. + * @return EINA_TRUE if user select OK, EINA_FALSE if else or on errors. + */ +static Eina_Bool +_smart_run_javascript_prompt(Ewk_View_Smart_Data *esd, Evas_Object *frame, const char *message, const char *defaultValue, char **value) +{ + return modal_util_prompt(message, defaultValue, value); +} + +/** + * @fn static Eina_Bool _smart_should_interrupt_javascript(Ewk_View_Smart_Data *esd) + * @brief open warning dialog to stop heavy javascript. + * + * @param[in] esd smart data of els-webview + * @return EINA_TRUE if stop javascript, EINA_FALSE if else or on errors. + */ +static Eina_Bool +_smart_should_interrupt_javascript(Ewk_View_Smart_Data *esd) +{ + /* TODO */ + return EINA_FALSE; +} + +/** + * @fn static Eina_Bool _smart_run_open_panel(Ewk_View_Smart_Data *esd, Evas_Object *frame, Eina_Bool allows_multiple_files, const char *accept_types, Eina_List **selected_filenames) + * @brief open dialog which have input field. + * + * @param[in] esd smart data of els-webview + * @param[in] frame ewk frame object which call file dialog. + * @param[in] allows_multiple_files flag which use can choose multiple files. + * @param[in] accept_types accept mime type + * @param[in] selected_filenames filenames which use select. + * @return EINA_TRUE if user select OK, EINA_FALSE if else or on errors. + */ +static Eina_Bool +_smart_run_open_panel(Ewk_View_Smart_Data *esd, Evas_Object *frame, Eina_Bool allows_multiple_files, Eina_List *accept_types, Eina_List **selected_filenames) +{ + return modal_util_run_open_panel(allows_multiple_files, accept_types, selected_filenames); +} + +/** + * @fn static Eina_Bool _smart_navigation_policy_decision(Ewk_View_Smart_Data *esd, Ewk_Frame_Resource_Request *request) + * @brief callback whether url should be loaded and call user level function for each scheme. + * + * @param[in] esd smart data of els-webview + * @param[in] request filenames which use select. + * @return EINA_TRUE if ewk view should load this url, EINA_FALSE will stop loading. + */ +static Eina_Bool +_smart_navigation_policy_decision(Ewk_View_Smart_Data *esd, Ewk_Frame_Resource_Request *request) +{ + char *protocol_hack; + Elm_WebView_Scheme_Cb func = NULL; + Smart_Data *sd = (Smart_Data*)esd; + + if (sd->scheme_func_hash) + { + protocol_hack = strstr(request->url, ":"); + if (!protocol_hack) + { + protocol_hack = "http"; /* FIXME */ + func = (Elm_WebView_Scheme_Cb) eina_hash_find(sd->scheme_func_hash, request->url); + } + else + { + *protocol_hack = '\0'; + char *scheme = strdup(request->url); + eina_str_tolower(&scheme); + func = (Elm_WebView_Scheme_Cb) eina_hash_find(sd->scheme_func_hash, scheme); + *protocol_hack = ':'; + free(scheme); + } + } + + if (!func) + { + if (strncmp(request->url, "http", 4) == 0 + || strncmp(request->url, "https", 5) == 0 + || strncmp(request->url, "file", 4) == 0 + || strncmp(request->url, "data", 4) == 0) + return EINA_TRUE; + return EINA_FALSE; + } + else + return func(esd->self, request->url); /* need to check, commented out due to compilation errors */ +} + +/** + * @fn static Evas_Object *_smart_window_create(Ewk_View_Smart_Data *esd, Eina_Bool javascript, Eina_Bool isMobile, const Ewk_Window_Features *window_features, int navigation_action, const char* frame_name) + * @brief callback to create new elm-webview when web page want to create new browser or page. + * + * @retuern newly added elm webview + */ +static Evas_Object * +_smart_window_create(Ewk_View_Smart_Data *esd, Eina_Bool javascript, Eina_Bool isMobile, const Ewk_Window_Features *window_features, int navigation_action, const char* frame_name) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(esd, NULL); + + Smart_Data *sd = (Smart_Data *)esd; + sd->createwebview_data->webview = NULL; + sd->createwebview_data->navigation_action = navigation_action; + sd->createwebview_data->frame_name = frame_name; + sd->createwebview_data->javascript = javascript; + sd->createwebview_data->isMobile = isMobile; + evas_object_smart_callback_call(sd->base.self, "create,webview", sd->createwebview_data); + return sd->createwebview_data->webview; +} + +static Eina_Bool +_smart_events_handled_by_plugin_changed(Ewk_View_Smart_Data *esd, Eina_Bool newState) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(esd, EINA_FALSE); + + Smart_Data *sd = (Smart_Data *)esd; + sd->last_event_was_handled_by_plugin = newState; + return EINA_TRUE; +} + +/** + * @fn static void _smart_load_started(void *data, Evas_Object *webview, void *error) + * @brief callback when load started. + * + * @retuern newly added elm webview + */ +static void +_smart_load_started(void *data, Evas_Object *webview, void *error) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data *sd = (Smart_Data *)data; + if (!sd) return; + + els_webview_editor_selection_mode_change(sd->editor, TEXT_SELECTION_MODE_OFF); + + // clear the existing popup + if (sd->geolocation_popup) { + evas_object_smart_callback_call(sd->geolocation_popup, "response", (void *)ELM_POPUP_RESPONSE_CANCEL); + sd->geolocation_popup = 0; + } +} + +/** + * @fn static void _smart_load_finished(void *data, Evas_Object *webview, void *error) + * @brief callback when load finished. + * + * @retuern newly added elm webview + */ +static void +_smart_load_finished(void* data, Evas_Object* webview, void* arg) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + + // if error, call loadNotFoundPage + Ewk_Frame_Load_Error *error = (Ewk_Frame_Load_Error *) arg; + int errorCode = error? error->code: 0; + if (errorCode != 0 && errorCode != -999) return; + /*if (errorCode != 0 && errorCode != -999) // 0 ok, -999 request cancelled + { + ELM_WEBVIEW_SLOGD("page not found:, [code: %d] [domain: %s] [description: %s] [failing_url: %s] \n", + error->code, error->domain, error->description, error->failing_url); + //ecore_job_add(loadNotFoundPage, (void *)this); + return; + } + */ + + // On loading image resource directly, + // either "viewport,changed" or "nonemptylayout,finished" are not called. + // ex: image.google.com see full size image + // So, we should call _request_layout() at here + _request_layout(sd); +} + +/** + * @fn static void _smart_viewport_changed(void *data, Evas_Object *webview, void *arg) + * @brief callback when view port changed + * + * @param[in] data smart data of webview + * @param[in] webview els-weview + * @param[in] arg not used + */ +static void +_smart_viewport_changed(void *data, Evas_Object *webview, void *arg) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data *sd = (Smart_Data *)data; + if (!sd) return; + + // *arg is bool type value of viewport argument existence + // true if viewport argument is exist, + // false otherwise + bool* is_viewport_argument_exist = (bool*)arg; + sd->is_viewport_argument_exist = *is_viewport_argument_exist; + + // if we call _update_layout_job directly, somtimes it can cause a crash + // ToDo: Find the reason of crash + _request_layout(sd); +} + +static void +_update_layout_job(void *data) +{ + Smart_Data *sd = data; + if (!sd) return; + sd->update_layout_job = NULL; + ELM_WEBVIEW_SLOGD("\n"); + + Evas_Object* webview = sd->base.self; + + // get viewport attributes + int layout_w, layout_h; + float init_zoom, max_zoom, min_zoom, dpr; + Eina_Bool scalable; + + ewk_view_viewport_attributes_get(webview, &layout_w, &layout_h, &init_zoom, &max_zoom, &min_zoom, &dpr, &scalable); + + // if viewport argument is not exist + // then we should set zoom and layout values with contents size + // because ewk_view_viewport_attributes_get() always returns 980 width if is_viewport_argument_exist is false + if (sd->is_viewport_argument_exist) + { + ELM_WEBVIEW_SLOGD("Mobile layout- size[%d, %d], zoom_rate[%f, %f, %f], dpr[%f], scalable[%d]\n", + layout_w, layout_h, init_zoom, max_zoom, min_zoom, dpr, scalable); + + sd->zoom.max_zoom_rate = max_zoom; + sd->zoom.min_zoom_rate = min_zoom; + sd->zoom.init_zoom_rate = init_zoom; + sd->layout.w = layout_w; + sd->layout.h = layout_h; + sd->device_pixel_ratio = dpr; + sd->zoom.scalable = scalable; + } + else + { + // get webview size + int webview_x, webview_y, webview_w, webview_h; + evas_object_geometry_get(webview, &webview_x, &webview_y, &webview_w, &webview_h); + + // get contents size + int content_w, content_h; + ewk_frame_contents_size_get(ewk_view_frame_main_get(webview), &content_w, &content_h); + ELM_WEBVIEW_SLOGD("Desktop layout - viewportsize[%d, %d], zoom_rate[%f, %f, %f], dpr[%f], scalable[%d]\n" + "webview x, y, w, h [%d, %d, %d, %d], content size [%d, %d]\n", + layout_w, layout_h, init_zoom, max_zoom, min_zoom, dpr, scalable, + webview_x, webview_y, webview_w, webview_h, content_w, content_h); + + // content size can be 0, 0 if it is not loaded yet + // then we shouldn't relayout contents + if (layout_w <= 0 || layout_h <= 0 || content_w <= 0 || content_h <= 0) return; + + Ecore_Evas* ee = 0; + int window_w, window_h; + + ee = ecore_evas_ecore_evas_get(evas_object_evas_get(webview)); + ecore_evas_geometry_get(ee, 0, 0, &window_w, &window_h); + + int updated_layout_w = content_w; + int updated_content_h = ((float)content_h * updated_layout_w) / content_w; + if ((float)updated_layout_w / content_h > (float)webview_w / webview_h) + updated_content_h = ((float)updated_layout_w * webview_h) / webview_w; + + // calculate minimum zoom value with contents size + sd->zoom.max_zoom_rate = max_zoom; + sd->zoom.min_zoom_rate = (float)webview_w / updated_layout_w; + + // auto fitting option dependent initial zoom rate + if (sd->auto_fitting == EINA_TRUE) + sd->zoom.init_zoom_rate = sd->zoom.min_zoom_rate; + else + { + float readable_rate = 1.0f; + if (readable_rate < sd->zoom.min_zoom_rate) + readable_rate = sd->zoom.min_zoom_rate; + if (readable_rate > sd->zoom.max_zoom_rate) + readable_rate = sd->zoom.max_zoom_rate; + sd->zoom.init_zoom_rate = readable_rate; + } + + sd->layout.w = updated_layout_w; + sd->layout.h = updated_content_h; + sd->device_pixel_ratio = dpr; + sd->zoom.scalable = scalable; + + ELM_WEBVIEW_SLOGD("viewport by CONTENTS - size[%d, %d], zoom_rate[%f, %f, %f], dpr[%f], scalable[%d]\n", + sd->layout.w, sd->layout.h, sd->zoom.init_zoom_rate, sd->zoom.max_zoom_rate, sd->zoom.min_zoom_rate, dpr, scalable); + } + + // we have to force user scalable value to TRUE before set the new initial zoom level. + // it will be corrected to sd->zoom.scalable by the last line of this function + ewk_view_user_scalable_set(webview, EINA_TRUE); + + ELM_WEBVIEW_SLOGD("ewk_view_fixed_layout_size_set [%d, %d]\n", sd->layout.w, sd->layout.h); + // set ewk's viewport values + ewk_view_fixed_layout_size_set(webview, sd->layout.w, sd->layout.h); + ewk_view_zoom_range_set(webview, sd->zoom.min_zoom_rate, sd->zoom.max_zoom_rate); + ewk_view_zoom_set(webview, sd->zoom.init_zoom_rate, 0, 0); + + // set user scalable value TRUE always, + // because we need to support bouncing effect to mobile pages those have "user-scaleable=false", + ewk_view_user_scalable_set(webview, EINA_TRUE); +} + +static void +_request_layout(Smart_Data *sd) +{ + if (!sd) return; + ELM_WEBVIEW_SLOGD("\n"); + if (sd->update_layout_job) + ecore_job_del(sd->update_layout_job); + sd->update_layout_job = ecore_job_add(_update_layout_job, sd); +} + +/** + * Rotaion modes + * @see appcore_set_rotation_cb(), appcore_get_rotation_state() + */ +enum appcore_rm { + APPCORE_RM_UNKNOWN, /**< Unknown mode */ + APPCORE_RM_PORTRAIT_NORMAL , /**< Portrait mode */ + APPCORE_RM_PORTRAIT_REVERSE , /**< Portrait upside down mode */ + APPCORE_RM_LANDSCAPE_NORMAL , /**< Left handed landscape mode */ + APPCORE_RM_LANDSCAPE_REVERSE , /**< Right handed landscape mode */ +}; +/* +static void +updateIMFOrientation( Ecore_IMF_Context *ctx ) +{ + if ( !ctx ) + return; + + enum appcore_rm current_state = APPCORE_RM_UNKNOWN; + int ret = appcore_get_rotation_state(¤t_state); + + switch (current_state) + { + case APPCORE_RM_PORTRAIT_NORMAL: + ecore_imf_context_input_panel_orient_set(ctx, ECORE_IMF_INPUT_PANEL_ORIENT_NONE); + break; + case APPCORE_RM_PORTRAIT_REVERSE: + ecore_imf_context_input_panel_orient_set(ctx, ECORE_IMF_INPUT_PANEL_ORIENT_180); + break; + case APPCORE_RM_LANDSCAPE_NORMAL: + ecore_imf_context_input_panel_orient_set(ctx, ECORE_IMF_INPUT_PANEL_ORIENT_90_CW); + break; + case APPCORE_RM_LANDSCAPE_REVERSE: + ecore_imf_context_input_panel_orient_set(ctx, ECORE_IMF_INPUT_PANEL_ORIENT_90_CCW); + break; + } + + // call to show needed + if ( ecore_imf_context_input_panel_state_get(ctx) == ECORE_IMF_INPUT_PANEL_STATE_SHOW ) + ecore_imf_context_input_panel_show(ctx); +} +*/ + +/** + * @fn static void _smart_input_method_changed(void *data, Evas_Object *webview, void *arg) + * @brief callback when input method changed + * + * @param[in] data smart data of webview + * @param[in] webview els-weview + * @param[in] arg not used + */ +static void +_input_method_changed_job(void *data) +{ + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + + if (sd->focused_rect.w && sd->focused_rect.h) + { + // get caret + ewk_frame_caret_position_get(ewk_view_frame_main_get(sd->base.self), + &(sd->caret.x), &(sd->caret.y), &(sd->caret.w), &(sd->caret.h)); + + // Rezoom the another input field when ime is on such as log in. Id and password. + if (sd->is_ise) + _zoom_to_rect(sd, &(sd->focused_rect), &(sd->caret)); + + // change text_selection_mode + if (els_webview_editor_selection_mode_get(sd->editor) == TEXT_SELECTION_MODE_OFF) + els_webview_editor_selection_mode_change(sd->editor, TEXT_SELECTION_INPUT); + } + sd->input_method_changed_job = NULL; +} + +static void +_smart_input_method_changed(void *data, Evas_Object *webview, void *arg) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + + // save input field's rect + if (arg) + sd->focused_rect = *((Eina_Rectangle *)arg); + else + memset(&sd->focused_rect, '\0', sizeof(Eina_Rectangle)); + + // add input_method_changed job + // if we call that directly, we can not get the correct caret position + if (sd->input_method_changed_job) + ecore_job_del(sd->input_method_changed_job); + sd->input_method_changed_job = ecore_job_add(_input_method_changed_job, sd); +} + +/** + * @fn static void _smart_contents_size_changed(void* data, Evas_Object* frame, void* arg) + * @brief callback when contents size changed + * + * @param[in] data smart data of webview + * @param[in] webview frame which changed size + * @param[in] arg size + */ +static void +_smart_contents_size_changed(void* data, Evas_Object* frame, void* arg) +{ + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + + Evas_Coord *size = (Evas_Coord*)arg; + ELM_WEBVIEW_SLOGD("\n [%d]", *size); + if (!size || size[0] == 0) return; +} + +/** + * @fn static void _smart_load_nonemptylayout_finished(void* data, Evas_Object* frame, void* arg) + * @brief callback when empty layout finished + * + * @param[in] data smart data of webview + * @param[in] frame which nonemptylayout finished + * @param[in] arg not used + */ +static void +_smart_load_nonemptylayout_finished(void* data, Evas_Object* frame, void* arg) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + _request_layout(sd); +} + +/** + * @fn static void _smart_cb_zoom_set(void *data, Evas_Object *webview, void *arg) + * @brief zoom set callback + * + * @param[in] data smart data of webview + * @param[in] webview webview + * @param[in] arg arg + */ +static void +_smart_cb_zoom_set(void *data, Evas_Object *webview, void *arg) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + + if (sd->auto_suspend && (sd->on_zooming == EINA_FALSE) && (sd->on_panning == EINA_FALSE)) + _resume_all(sd); + + if (els_webview_editor_selection_mode_get(sd->editor) & TEXT_SELECTION_ZOOM_START) + els_webview_editor_selection_mode_change(sd->editor, TEXT_SELECTION_ZOOM_END); +} + +/** + * @fn static void _smart_add(Evas_Object* obj) + * @brief add new smart object for els-webview + * + * @param[in] obj newly added instance of els-webview + */ +static void +_smart_add(Evas_Object* obj) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd; + + sd = calloc(1, sizeof(Smart_Data)); + if (!sd) return; + evas_object_smart_data_set(obj, sd); + _parent_sc.sc.add(obj); + + sd->update_layout_job = NULL; + sd->dropdown.options = NULL; + sd->dropdown.option_cnt = 0; + sd->events_feed = EINA_FALSE; + sd->plugin_mode = EINA_FALSE; + sd->was_long_press = EINA_FALSE; + sd->last_event_was_handled_by_plugin = EINA_FALSE; + sd->plugin_mode_and_over_plugin = EINA_FALSE; + sd->touch_obj = _elm_smart_touch_add(evas_object_evas_get(obj)); + sd->smart_zoom_animator = NULL; + sd->zoom.init_zoom_rate = 1.0f; + sd->zoom.min_zoom_rate = MIN_ZOOM_RATIO; + sd->zoom.max_zoom_rate = MAX_ZOOM_RATIO; + sd->zoom.latest_min_zoom_rate = MIN_ZOOM_RATIO; + sd->zoom.scalable = EINA_TRUE; + sd->device_pixel_ratio = 1.0f; + sd->enable_default_touch = EINA_TRUE; + sd->horizontal_panning_hold = EINA_FALSE; + sd->panning_x_edge = EINA_FALSE; + sd->vertical_panning_hold = EINA_FALSE; + sd->panning_y_edge = EINA_FALSE; + sd->current_imh = 0; + sd->use_mouse_down_delay = EINA_FALSE; + sd->mouse_down_delay_timer = NULL; + sd->is_mouse_down_on_link = EINA_FALSE; + sd->focus_ring_invalidate_timer = NULL; + sd->restore_press_timer = EINA_TRUE; + sd->is_mouse_down_propagated = EINA_FALSE; + + ewk_view_theme_set(obj, WEBKIT_EDJ); + + // set geolocation callback + ewk_geolocation_permission_dialog_show_set_callback(_geolocation_permission_callback); + + ewk_view_zoom_cairo_scaling_set(obj, EINA_TRUE); + ewk_view_user_scalable_set(obj, EINA_TRUE); + sd->flush_idler = NULL; + sd->use_zoom_bouncing = EINA_TRUE; + sd->use_input_field_zoom = EINA_TRUE; + sd->use_select_tag_zoom = EINA_TRUE; + memset(&sd->focused_rect, '\0', sizeof(Eina_Rectangle)); + memset(&sd->caret, '\0', sizeof(Eina_Rectangle)); + sd->is_ise = EINA_FALSE; + sd->is_ise_flash = EINA_FALSE; + + sd->input_method_changed_job = NULL; + sd->auto_suspend = EINA_FALSE; + + sd->createwebview_data = NULL; + + evas_object_smart_callback_add(obj, "load,started", _smart_load_started, sd); + evas_object_smart_callback_add(obj, "load,finished", _smart_load_finished, sd); + evas_object_smart_callback_add(obj, "viewport,changed", _smart_viewport_changed, sd); + evas_object_smart_callback_add(obj, "inputmethod,changed", _smart_input_method_changed, sd); + + evas_object_smart_callback_add(obj, "zoom,set", _smart_cb_zoom_set, sd); + + // "view,resized" callback is the right time to relayout rotated webview + // Plz refer _ewk_view_smart_calculate()'s inner comment + evas_object_smart_callback_add(obj, "view,resized", _smart_cb_view_resized, sd); + evas_object_smart_callback_add(ewk_view_frame_main_get(obj), "contents,size,changed", + _smart_contents_size_changed, sd); + // There are too many relayouting when we call _update_layout_job at _smart_contents_size_changed() + // It's enough to call _update_layout_job() at _smart_load_nonemptylayout_finished() and _smart_load_finished() + // _update_layout_job() can be called twice, but it doesn't matter. + // Because ewk ignores the same layout size or zoom scale value + evas_object_smart_callback_add(ewk_view_frame_main_get(obj), "load,nonemptylayout,finished", + _smart_load_nonemptylayout_finished, sd); + + // touch processor callbacks + evas_object_smart_callback_add(obj, "one,press", _smart_cb_mouse_down, sd); + evas_object_smart_callback_add(obj, "one,release", _smart_cb_mouse_up, sd); + evas_object_smart_callback_add(obj, "one,single,tap", _smart_cb_mouse_tap, sd); + evas_object_smart_callback_add(obj, "one,long,press", _smart_cb_mouse_long_press, sd); + evas_object_smart_callback_add(obj, "one,move,start", _smart_cb_one_move_start, sd); + evas_object_smart_callback_add(obj, "one,move", _smart_cb_one_move, sd); + evas_object_smart_callback_add(obj, "one,move,end", _smart_cb_one_move_end, sd); + evas_object_smart_callback_add(obj, "two,press", _smart_cb_two_press, sd); + evas_object_smart_callback_add(obj, "two,move,start", _smart_cb_two_move_start, sd); + evas_object_smart_callback_add(obj, "two,move", _smart_cb_two_move, sd); + evas_object_smart_callback_add(obj, "two,move,end", _smart_cb_two_move_end, sd); + evas_object_smart_callback_add(obj, "two,release", _smart_cb_two_release, sd); + evas_object_smart_callback_add(obj, "one,down,up,down", _smart_cb_one_down_up_down, sd); + + // panning callbacks + evas_object_smart_callback_add(obj, "pan,start", _smart_cb_pan_start, sd); + evas_object_smart_callback_add(obj, "panning", _smart_cb_pan_by, sd); + evas_object_smart_callback_add(obj, "pan,end", _smart_cb_pan_end, sd); + + // select tag zoom + evas_object_smart_callback_add(obj, "make,select,visible", _smart_cb_make_select_visible, sd); + // flash's input field zoom + evas_object_smart_callback_add(obj, "make,rect,visible", _smart_cb_make_rect_visible, sd); + + evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL); + + // register input panel callback + Ecore_IMF_Context* imContext = ewk_view_core_imContext_get(obj); + ecore_imf_context_input_panel_event_callback_add(imContext, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _smart_cb_ise_event, sd); + + _elm_smart_touch_child_set(sd->touch_obj, obj); + + sd->createwebview_data= (Elm_WebView_Create_Webview_Data*) malloc(sizeof(Elm_WebView_Create_Webview_Data)); + + sd->editor = els_webview_editor_init(obj); + + sd->geolocation_popup = 0; +#ifdef DEBUG_FRAMERATE + sd->start_time = 0.0f; + sd->count = 0; +#endif + + // touch mode for EMBERWIND + sd->touch_mode = TouchNormal; +} + +/** + * @fn static void _smart_del(Evas_Object* obj) + * @brief remove smart object for els-webview + * + * @param[in] obj instance of els-webview which will be removed + */ +static void +_smart_del(Evas_Object* obj) +{ + ELM_WEBVIEW_SLOGD("\n"); + INTERNAL_ENTRY; + + els_webview_editor_destroy(sd->editor); + free(sd->editor); + sd->editor = NULL; + + free(sd->createwebview_data); + sd->createwebview_data = NULL; + + if (sd->scheme_func_hash != NULL) + { + eina_hash_free(sd->scheme_func_hash); + sd->scheme_func_hash = NULL; + } + + // delete jobs + if (sd->update_layout_job) ecore_job_del(sd->update_layout_job); + if (sd->input_method_changed_job) ecore_job_del(sd->input_method_changed_job); + + // delete idler + if (sd->flush_idler) ecore_idler_del(sd->flush_idler); + + // delete animator + if (sd->smart_zoom_animator) + { + ecore_animator_del(sd->smart_zoom_animator); + sd->smart_zoom_animator = NULL; + } + + if (sd->touch_obj) evas_object_del(sd->touch_obj); + + // delete imf callback + Ecore_IMF_Context *imContext = ewk_view_core_imContext_get(sd->base.self); + ecore_imf_context_input_panel_event_callback_del(imContext, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _smart_cb_ise_event); + + if (sd->geolocation_popup) { + evas_object_del(sd->geolocation_popup); + sd->geolocation_popup = 0; + } + + _parent_sc.sc.del(obj); +} + +/** + * @fn static Eina_Bool _focus_ring_invalidate(void *data) + * @brief focus ring invalidate timer handler + * + * @param[in] data data which is set by user + */ +static Eina_Bool +_focus_ring_invalidate(void *data) +{ + Evas_Object *webview = (Evas_Object *) data; + ewk_frame_focus_ring_invalidate(ewk_view_frame_main_get(webview)); + ewk_view_setting_enable_focus_ring_set(webview, EINA_FALSE); + Smart_Data *sd = evas_object_smart_data_get(webview); + if (sd) + sd->focus_ring_invalidate_timer = NULL; + return ECORE_CALLBACK_CANCEL; +} + +/** + * @fn static Eina_Bool _delay_press_timer(void *data) + * @brief press timer handler + * + * @param[in] data data which is set by user + */ +static Eina_Bool +_delay_press_timer(void *data) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data *sd; + sd = data; + + if (!sd || !sd->mouse_down_delay_timer) + return ECORE_CALLBACK_CANCEL; + + // in this case the last_down means the last move point + Evas_Point point; + evas_pointer_canvas_xy_get(evas_object_evas_get(sd->base.self), &point.x, &point.y); + int dx = sd->mouse_down_copy.canvas.x - point.x; + int dy = sd->mouse_down_copy.canvas.y - point.y; + + // first timer execution + if (sd->restore_press_timer && (abs(dx) > 0 || abs(dy) > 0)) + { + // if it's a move then we call timer's function once again, additionally we make a delay + ecore_timer_delay(sd->mouse_down_delay_timer, (double) MOUSE_DOWN_DELAY_TIME/1000.0); + sd->restore_press_timer = EINA_FALSE; + + return ECORE_CALLBACK_RENEW; + } + // mouse_down is propagated + // if second timer execution is called + // or we are sure that it was a mouse down (dx or dy are zero) + else + { + /* we remember a mouse down was clicked to then check in _smart_cb_editorclient_selection_changed + * whether to show popup or not */ + if (els_webview_editor_selection_mode_get(sd->editor) & TEXT_SELECTION_INPUT) + els_webview_editor_selection_mode_change(sd->editor, TEXT_SELECTION_MOUSE_DOWN); + _parent_sc.mouse_down((Ewk_View_Smart_Data*)sd, &sd->mouse_down_copy); + sd->is_mouse_down_propagated = EINA_TRUE; + + sd->mouse_down_delay_timer = NULL; + return ECORE_CALLBACK_CANCEL; + } +} + +/** + * @fn static void _smart_cb_mouse_down(void* data, Evas_Object* webview, void* ev) + * @brief mouse down callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_mouse_down(void* data, Evas_Object* webview, void* ev) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + + sd->was_long_press = EINA_FALSE; + + if (sd->events_feed) return; + + evas_object_focus_set(webview, EINA_TRUE); + + // create Evas_Event_Mouse_Down event + // we should not use mouse_down_copy here, + // because _smart_cb_mouse_down is called before _smart_mouse_down. + // TODO: below event should be come from one,press event data. + // and we will replace below event with real one after WRT's local touch-processor is removed. + // (and other mouse events should be replaced at that time) + Evas_Event_Mouse_Down mouse_down; + Evas_Point* point = (Evas_Point*)ev; + Evas *evas = evas_object_evas_get(sd->base.self); + mouse_down.button = 1; + mouse_down.output.x = point->x; + mouse_down.output.y = point->y; + mouse_down.canvas.x = point->x; + mouse_down.canvas.y = point->y; + mouse_down.data = NULL; + mouse_down.modifiers = (Evas_Modifier *)evas_key_modifier_get(evas); + mouse_down.locks = (Evas_Lock *)evas_key_lock_get(evas); + mouse_down.flags = EVAS_BUTTON_NONE; + mouse_down.timestamp = ecore_loop_time_get(); + mouse_down.event_flags = EVAS_EVENT_FLAG_NONE; + mouse_down.dev = NULL; + + int ewk_x, ewk_y; + _coords_evas_to_ewk(sd->base.self, point->x, point->y, &ewk_x, &ewk_y); + Ewk_Hit_Test *hit_test = ewk_frame_hit_test_new(ewk_view_frame_main_get(sd->base.self), ewk_x, ewk_y); + + sd->plugin_mode_and_over_plugin = EINA_FALSE; + sd->is_mouse_down_propagated = EINA_FALSE; + sd->touch_event_feed = EINA_FALSE; + + // code moved here to block sending native mouse down event to elements different than selected plugin +#ifdef EVENT_FEED_TO_FLASH + if (sd->plugin_mode) + { // this case means that we are in "plugin mode", so checking if mouse down is over plugin is done + if (hit_test + && (hit_test->context & EWK_HIT_TEST_RESULT_CONTENT_PLUGIN) + && (hit_test->context & EWK_HIT_TEST_RESULT_CONTENT_PLUGIN_SELECTED)) + { + sd->plugin_mode_and_over_plugin = EINA_TRUE; + ewk_view_events_invalidate_on_plugin(sd->base.self, EINA_TRUE); + + _parent_sc.mouse_down((Ewk_View_Smart_Data*)sd, &mouse_down); + sd->is_mouse_down_propagated = EINA_TRUE; + if (hit_test) + ewk_frame_hit_test_free(hit_test); + return; + } + else + { + sd->plugin_mode_and_over_plugin = EINA_FALSE; + ewk_view_events_invalidate_on_plugin(sd->base.self, EINA_FALSE); + } + } +#endif + + sd->restore_press_timer = EINA_FALSE; + if (hit_test && (hit_test->context & EWK_HIT_TEST_RESULT_CONTENT_PLUGIN)) + { + sd->restore_press_timer = EINA_TRUE; + sd->is_mouse_down_propagated = EINA_FALSE; + + if (sd->mouse_down_delay_timer) + { + ecore_timer_del(sd->mouse_down_delay_timer); + sd->mouse_down_delay_timer = NULL; + } + sd->mouse_down_delay_timer = ecore_timer_add((double)MOUSE_DOWN_DELAY_TIME/1000.0, _delay_press_timer, sd); + if (hit_test) + ewk_frame_hit_test_free(hit_test); + return; + } + + if (!_touch_down(sd->base.self, &mouse_down)) + { + sd->touch_event_feed = EINA_FALSE; + // do not pass the mouse_down on_panning + if (sd->on_panning == EINA_TRUE) + { + if (hit_test) + ewk_frame_hit_test_free(hit_test); + return; + } + sd->is_mouse_down_on_link = EINA_FALSE; + ewk_view_setting_enable_focus_ring_set(webview, EINA_FALSE); + if (hit_test) + { + if (hit_test->context & EWK_HIT_TEST_RESULT_CONTEXT_LINK) + { + sd->is_mouse_down_on_link = EINA_TRUE; + /* FIXME : We don't have to check url if focus ring could be removed by some attributes like CSS style and meta type */ + if (!_focus_ring_exceptional_url_get(webview)) + ewk_view_setting_enable_focus_ring_set(webview, EINA_TRUE); + } + + ewk_frame_hit_test_free(hit_test); + } + } + else + { + sd->touch_event_feed = EINA_TRUE; + // In the case of DOWN_DURING_DRAG, we should stop the panning + if (sd->on_panning == EINA_TRUE) + { + evas_object_smart_callback_call(sd->base.self, "pan,end", ev); + } + } + +} + +/** + * @fn static void _smart_cb_mouse_up(void* data, Evas_Object* webview, void* ev) + * @brief mouse up callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_mouse_up(void* data, Evas_Object* webview, void* ev) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + if (sd->events_feed || (sd->plugin_mode && sd->plugin_mode_and_over_plugin)) return; + + Evas_Point* point = (Evas_Point*)ev; + ELM_WEBVIEW_SLOGD(" argument : (%d, %d)\n", point->x, point->y); + + if (els_webview_editor_selection_mode_get(sd->editor) == TEXT_SELECTION_MAGNIFIER) + els_webview_editor_selection_mode_change(sd->editor, TEXT_SELECTION_MODE_HANDLES_POPUP); + else if (els_webview_editor_selection_mode_get(sd->editor) == TEXT_SELECTION_MODE_LARGE_HANDLE_MAGNIFIER) + els_webview_editor_selection_mode_change(sd->editor, TEXT_SELECTION_MODE_LARGE_HANDLE_POPUP); +} + +/** + * @fn static void _smart_cb_mouse_tap(void *data, Evas_Object *webview, void *ev) + * @brief mouse tap callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_mouse_tap(void *data, Evas_Object *webview, void *ev) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + + /* "single,tap" event for elm_webview widget. + It will be used in the applications. (ex. e-mail's html composer) */ + evas_object_smart_callback_call(sd->widget, "single,tap", ev); + + if (sd->events_feed == EINA_TRUE) return; + + Evas_Point* point = (Evas_Point*)ev; + ELM_WEBVIEW_SLOGD(" argument : (%d, %d)\n", point->x, point->y); + int ewk_x, ewk_y; + _coords_evas_to_ewk(webview, point->x, point->y, &ewk_x, &ewk_y); + + Ewk_Hit_Test *hit_test = ewk_frame_hit_test_new(ewk_view_frame_main_get(webview), ewk_x, ewk_y); + + /* check for dropdown */ + /* TODO: we have to integrate dropdown ui-gadget + if (NULL != (sd->dropdown.options = ewk_page_dropdown_get_options(webview, x, y, + &sd->dropdown.option_cnt, &sd->dropdown.option_idx))) + { + } + */ + + /* + if plugin_mode is TRUE, mouse events should not be generated because mouse down and mouse up is generated directly. + if touch_event_feed is TRUE, mouse event should not be generated because ewk_frame_feed_touch_event return TRUE. + */ + if (!sd->is_mouse_down_propagated && !sd->touch_event_feed) + { + if (sd->mouse_down_delay_timer) + { + ecore_timer_del(sd->mouse_down_delay_timer); + sd->mouse_down_delay_timer = NULL; + } + + if (els_webview_editor_selection_mode_get(sd->editor) & TEXT_SELECTION_INPUT) + els_webview_editor_selection_mode_change(sd->editor, TEXT_SELECTION_MOUSE_DOWN); + + ELM_WEBVIEW_SLOGD("mouse_move\n"); + sd->mouse_move_copy.cur.canvas.x = point->x; + sd->mouse_move_copy.cur.canvas.y = point->y; + _parent_sc.mouse_move((Ewk_View_Smart_Data*)sd, &sd->mouse_move_copy); + ELM_WEBVIEW_SLOGD("mouse_down\n"); + sd->mouse_down_copy.canvas.x = point->x; + sd->mouse_down_copy.canvas.y = point->y; + _parent_sc.mouse_down((Ewk_View_Smart_Data*)sd, &sd->mouse_down_copy); + ELM_WEBVIEW_SLOGD("mouse_up\n"); + sd->mouse_up_copy.canvas.x = point->x; + sd->mouse_up_copy.canvas.y = point->y; + _parent_sc.mouse_up((Ewk_View_Smart_Data*)sd, &sd->mouse_up_copy); + } + +#ifdef EVENT_FEED_TO_FLASH + if (hit_test && (hit_test->context & EWK_HIT_TEST_RESULT_CONTENT_PLUGIN)) + { + /* we have to feed event to the flash if flash is clicked */ + ELM_WEBVIEW_SLOGD("<< plugin_mode is enabled >>\n"); + sd->plugin_mode = EINA_TRUE; + } + else + { + /* do not feed event */ + ELM_WEBVIEW_SLOGD("<< plugin_mode is disabled >>\n"); + sd->plugin_mode = EINA_FALSE; + } +#endif + + if (hit_test) + { + if (sd->editor) + { + els_webview_editor_hit_test_context_set(sd->editor, hit_test->context); + } + + if (hit_test->context & EWK_HIT_TEST_RESULT_CONTEXT_LINK) + { + if (sd->focus_ring_invalidate_timer) + { + ecore_timer_del(sd->focus_ring_invalidate_timer); + sd->focus_ring_invalidate_timer = NULL; + } + if (hit_test->context & EWK_HIT_TEST_RESULT_CONTEXT_IMAGE) + { + // If an image was clicked we have to invalidate focus ring immediately to avoid rendering issue. + ewk_frame_focus_ring_invalidate(ewk_view_frame_main_get(webview)); + ewk_view_setting_enable_focus_ring_set(webview, EINA_FALSE); + } + else + sd->focus_ring_invalidate_timer = ecore_timer_add((double)FOCUS_RING_INVALIDATE_DELAY_TIME/1000.0, _focus_ring_invalidate, webview); + } + + ewk_frame_hit_test_free(hit_test); + } +} + +/** + * @fn static void _smart_cb_one_move_start(void *data, Evas_Object *webview, void *ev) + * @brief one,move,start callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_one_move_start(void *data, Evas_Object *webview, void *ev) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + + // delete mouse_down_delay_timer + if (sd->use_mouse_down_delay) + { + if (sd->mouse_down_delay_timer) + { + ecore_timer_del(sd->mouse_down_delay_timer); + sd->mouse_down_delay_timer = NULL; + } + } + // Checking whether mouse down was propagated isn't needed here as we are doing this in + // other callbacks. _smart_cb_mouse_down sends touch_down event to webkit which causes + // style change the same element is clicked twice. As a result mouse down wouldn't be + // sent when we use mouse down delay but focus ring is drawn. + if (sd->is_mouse_down_on_link) + { + ewk_frame_focus_ring_invalidate(ewk_view_frame_main_get(webview)); + ewk_view_setting_enable_focus_ring_set(webview, EINA_FALSE); + } + + if (sd->events_feed) return; + + // make touch event + Evas_Point *pnt = (Evas_Point *)ev; + Touch_Point point; + point.device = 0; + point.x = pnt->x; + point.y = pnt->y; + point.state = TOUCH_POINT_MOVED; + + // if touch event(TOUCH_POINT_MOVED) is not used by webkit-engine, start panning + if ((!ewk_frame_feed_touch_event(sd->base.main_frame, EWK_TOUCH_MOVE, _touch_point_list_get(1, &point), 0)) && (sd->touch_event_feed == EINA_FALSE)) + evas_object_smart_callback_call(sd->base.self, "pan,start", ev); + else + { + if (sd->on_panning == EINA_TRUE) + evas_object_smart_callback_call(sd->base.self, "pan,end", ev); + } +} + +/** + * @fn static void _smart_cb_pan_start(void *data, Evas_Object *webview, void *ev) + * @brief pan,start callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_pan_start(void *data, Evas_Object *webview, void *ev) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + Evas_Point* point = (Evas_Point*)ev; + + evas_object_smart_callback_call(sd->widget, "pan,started", NULL); + + int x, y; + + _coords_evas_to_ewk(webview, point->x, point->y, &x, &y); + ewk_frame_virtual_mouse_down_position_set(ewk_view_frame_main_get(webview), x, y); + + if (sd->events_feed) return; + // don't make pause and resume when panning is done over selected plugin + if (sd->auto_suspend && !sd->plugin_mode_and_over_plugin) + _suspend_all(sd); + + sd->pan_s = *point; + sd->scrolled = EINA_FALSE; + sd->on_panning = EINA_TRUE; + sd->panning_y_edge = EINA_FALSE; + sd->panning_x_edge = EINA_FALSE; + + els_webview_editor_selection_mode_change(sd->editor, TEXT_SELECTION_PAN_START); + +#ifdef DEBUG_FRAMERATE + sd->start_time = ecore_time_get(); + sd->count = 0; +#endif +} + +/** + * @fn static void _smart_cb_one_move(void* data, Evas_Object* webview, void* ev) + * @brief one,move callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_one_move(void* data, Evas_Object* webview, void* ev) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd = (Smart_Data *)data; + if (!sd || !ev) return; + if (sd->events_feed) return; + + Evas_Point *pnt = (Evas_Point *)ev; + + Touch_Point point; + point.device = 0; + point.x = pnt->x; + point.y = pnt->y; + point.state = TOUCH_POINT_MOVED; + + if ((!ewk_frame_feed_touch_event(sd->base.main_frame, EWK_TOUCH_MOVE, _touch_point_list_get(1, &point), 0)) && (sd->touch_event_feed == EINA_FALSE)) + evas_object_smart_callback_call(sd->base.self, "panning", ev); + else + { + if (sd->on_panning == EINA_TRUE) + evas_object_smart_callback_call(sd->base.self, "pan,end", ev); + } +} + +/** + * @fn static void _smart_cb_pan_by(void* data, Evas_Object* webview, void* ev) + * @brief pan,by callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_pan_by(void* data, Evas_Object* webview, void* ev) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + Evas_Point* point = (Evas_Point*)ev; + + // block panning over selected plugin which consumes mouse move events + if (!sd->on_panning || (sd->plugin_mode && sd->plugin_mode_and_over_plugin && sd->last_event_was_handled_by_plugin)) return; +#ifdef DEBUG_FRAMERATE + sd->count++; +#endif + + int dx = sd->pan_s.x - point->x; + int dy = sd->pan_s.y - point->y; + if (dx == 0 && dy == 0) return; + + int old_x, old_y; + ewk_frame_scroll_pos_get(ewk_view_frame_main_get(webview), &old_x, &old_y); + + int content_w, content_h; + ewk_frame_contents_size_get(ewk_view_frame_main_get(webview), &content_w, &content_h); + float zoom = ewk_view_zoom_get(webview); + content_w *= zoom; + content_h *= zoom; + ELM_WEBVIEW_SLOGD("content[%d, %d], new pos[%d, %d]\n", content_w, content_h, old_x + dx, old_y + dy); + +#ifdef BOUNCING_SUPPORT + //_elm_smart_webview_container_bounce_add(sd->container, 10, 10); + //return; + + Eina_Bool container_scrolled = _elm_smart_webview_container_scroll_adjust(sd->container, &dx, &dy); + if (dx == 0 && dy == 0) + { + sd->pan_s = *point; + _elm_smart_webview_container_bounce_add(sd->container, 0, 0); + return; + } +#endif + // if the horizontal/vertical panning_hold is set do not panning to the horizontal/vertical direction + ewk_frame_scroll_add(ewk_view_frame_main_get(webview), + sd->horizontal_panning_hold?0:dx, + sd->vertical_panning_hold?0:dy); + + if (sd->horizontal_panning_hold?0:dx || sd->vertical_panning_hold?0:dy) + sd->scrolled = EINA_TRUE; + + sd->pan_s = *point; + + int new_x, new_y; + ewk_frame_scroll_pos_get(ewk_view_frame_main_get(webview), &new_x, &new_y); + + // send edge event when we reach to the edge + if (!sd->panning_y_edge && (old_y == new_y)) + { + Evas_Coord object_h; + evas_object_geometry_get(webview, NULL, NULL, NULL, &object_h); + + if (old_y == 0) + { + evas_object_smart_callback_call(sd->widget, "edge,top", NULL); + sd->panning_y_edge = EINA_TRUE; + } + // we have to add -5 because we can not calcuate exact integer value + else if (old_y >= (content_h - object_h - 5)) + { + evas_object_smart_callback_call(sd->widget, "edge,bottom", NULL); + sd->panning_y_edge = EINA_TRUE; + } + } + else if (sd->panning_y_edge && (old_y != new_y)) + sd->panning_y_edge = EINA_FALSE; + + // send edge event when we reach to the edge + if (!sd->panning_x_edge && (old_x == new_x)) + { + Evas_Coord object_w; + evas_object_geometry_get(webview, NULL, NULL, &object_w, NULL); + + if (dx < 0 && old_x == 0) + { + evas_object_smart_callback_call(sd->widget, "edge,left", NULL); + sd->panning_x_edge = EINA_TRUE; + } + // we have to add -5 because we can not calcuate exact integer value + else if (dx > 0 && (old_x >= (content_w - object_w - 5))) + { + evas_object_smart_callback_call(sd->widget, "edge,right", NULL); + sd->panning_x_edge = EINA_TRUE; + } + } + else if (sd->panning_x_edge && (old_x != new_x)) + sd->panning_x_edge = EINA_FALSE; + + Evas_Point diff; + diff.x = new_x - old_x; + diff.y = new_y - old_y; + els_webview_editor_selection_update_position(sd->editor, &diff); + +#ifdef BOUNCING_SUPPORT + /*printf("<< ========content [%d, %d] old pos [%d, %d] new pos [%d, %d] >>(remained(%d, %d)\n", + content_w, content_h, + old_x, old_y, + old_x + dx, old_y + dy, + old_x + dx - new_x, old_y + dy - new_y);*/ + int bx, by; + bx = old_x + dx - new_x; + by = old_y + dy - new_y; + if (container_scrolled == EINA_TRUE || (bx != 0 || by != 0)) + _elm_smart_webview_container_bounce_add(sd->container, bx, by); +#endif + +} + +/** + * @fn static void _smart_cb_one_move_end(void *data, Evas_Object *webview, void *ev) + * @brief one,flick,end callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_one_move_end(void *data, Evas_Object *webview, void *ev) +{ + return; +} + +/** + * @fn static void _smart_cb_pan_end(void *data, Evas_Object *webview, void *ev) + * @brief pan,end callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_pan_end(void *data, Evas_Object *webview, void *ev) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data *sd = (Smart_Data *)data; + if (!sd) return; + if (sd->events_feed) return; + +#ifdef DEBUG_FRAMERATE + double framerate = sd->count / (ecore_time_get() - sd->start_time); + if (framerate < 60.0f) + ELM_WEBVIEW_SLOGI("<< panning frame rate = [%.1f] fps >>\n", framerate); +#endif + + if (sd->auto_suspend && !sd->plugin_mode_and_over_plugin) + _resume_all(sd); + + //at the end of panning, onscroll event is generated when it is set to be suppressed during panning + if (sd->scrolled && ewk_view_setting_enable_onscroll_event_suppression_get(webview)) + ewk_frame_onscroll_event_generate(ewk_view_frame_main_get(webview)); + + Evas_Point *point = (Evas_Point *)ev; + sd->on_panning = EINA_FALSE; + +#ifdef BOUNCING_SUPPORT + _elm_smart_webview_container_mouse_up(sd->container); +#endif + + evas_object_smart_callback_call(sd->widget, "pan,finished", NULL); + + els_webview_editor_selection_mode_change(sd->editor, TEXT_SELECTION_PAN_END); +} + +/** + * @fn static void _smart_cb_mouse_long_press(void *data, Evas_Object *webview, void *ev) + * @brief long,press callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_mouse_long_press(void *data, Evas_Object *webview, void *ev) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + sd->was_long_press = EINA_TRUE; + if (sd->events_feed || sd->plugin_mode || sd->touch_event_feed) return; + Evas_Point* point = (Evas_Point*)ev; + + int x, y; + _coords_evas_to_ewk(webview, point->x, point->y, &x, &y); + Ewk_Hit_Test *hit_test = ewk_frame_hit_test_new(ewk_view_frame_main_get(webview), x, y); + if (!hit_test) return; + + Ecore_IMF_Context *im_Context = ewk_view_core_imContext_get(sd->base.self); + + if(im_Context && !(hit_test->context & EWK_HIT_TEST_RESULT_CONTEXT_EDITABLE) && (sd->is_ise_flash || sd->is_ise)) + ecore_imf_context_input_panel_hide(im_Context); + + if (sd->is_mouse_down_propagated && sd->is_mouse_down_on_link) + { + ewk_frame_focus_ring_invalidate(ewk_view_frame_main_get(webview)); + ewk_view_setting_enable_focus_ring_set(webview, EINA_FALSE); + } + + // check for flash + if (hit_test->context & EWK_HIT_TEST_RESULT_CONTENT_PLUGIN) + { + ewk_frame_hit_test_free(hit_test); + return; + } + if (sd->editor) + { + els_webview_editor_hit_test_context_set(sd->editor, hit_test->context); + // show context menu for link or image (but not image in editable) and show text selection for otherwise + if ((hit_test->context & EWK_HIT_TEST_RESULT_CONTEXT_LINK) + || ((hit_test->context & EWK_HIT_TEST_RESULT_CONTEXT_IMAGE) && !(hit_test->context & EWK_HIT_TEST_RESULT_CONTEXT_EDITABLE))) + { + if (els_webview_editor_selection_mode_get(sd->editor) != TEXT_SELECTION_MODE_OFF) + els_webview_editor_selection_mode_change(sd->editor, TEXT_SELECTION_MODE_OFF); + evas_object_smart_callback_call(sd->base.self, "context,menu", ev); + } + else + { + // show ime on when long press was called on unfocused input field => we treat long press as a tap then + if (els_webview_editor_selection_mode_get(sd->editor) == TEXT_SELECTION_MODE_OFF + && (hit_test->context & EWK_HIT_TEST_RESULT_CONTEXT_EDITABLE)) + els_webview_editor_selection_mode_change(sd->editor, TEXT_SELECTION_INPUT); + else + evas_object_smart_callback_call(sd->base.self, "text,selection", ev); + } + } + ewk_frame_hit_test_free(hit_test); +} + +/** + * @fn static void _smart_cb_ise_event(void *data, Ecore_IMF_Context *ctx, int value) + * @brief ise event callback + * + * @param[in] data user data + * @param[in] ctx Ecore_IMF_Context + * @param[in] value value + */ +static void +_smart_cb_ise_event(void *data, Ecore_IMF_Context *ctx, int value) +{ + ELM_WEBVIEW_SLOGD("[%d]\n", value); + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + + if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) + { + ELM_WEBVIEW_SLOGD("hide\n"); + sd->is_ise = EINA_FALSE; + // below code causes the crash. + // because this function is called when the webview is focused out + // and below code requests to delete popup. + // so, we commented out below code, + // but we have problem that popup is not hided when we hide IME with sweeping. + //_text_selection_mode_change(sd, TEXT_SELECTION_MODE_OFF); + } + else if (value == ECORE_IMF_INPUT_PANEL_STATE_SHOW) + { + ELM_WEBVIEW_SLOGD("show\n"); + sd->is_ise = EINA_TRUE; + } +} + +// zoom +static const float ZOOM_STEP_PER_PIXEL = 0.005f; + +#define ZOOM_FRAMERATE 60 +#define N_COSINE 18 +static const float cosine[N_COSINE] = +{ 1.0f, 0.99f, 0.96f, 0.93f, 0.88f, 0.82f, 0.75f, 0.67f, 0.59f, 0.5f, + 0.41f, 0.33f, 0.25f, 0.18f, 0.12f, 0.07f, 0.01f, 0.0f }; +static int smart_zoom_index = N_COSINE - 1; + +#define INPUT_LOCATION_X 20 +#define INPUT_LOCATION_HORIZONTAL_Y 20 +#define INPUT_LOCATION_VERTICAL_Y 90 +#define INPUT_ZOOM_RATIO 2.0 +#define INPUT_PADDING_THRESHOLD 0.45 +#define INPUT_CARET_LOCATION_THRESHOLD 0.3 + +static void +_suspend_all(Smart_Data *sd) +{ + ELM_WEBVIEW_SLOGD("\n"); + Evas_Object *webview = sd->base.self; + + // javascript suspend + ewk_view_javascript_suspend(webview); + + // render suspend + ewk_view_disable_render(webview); + + // plugin suspend + if (ewk_view_setting_enable_plugins_get(webview)) + { + /* + ewk_view_pause_and_or_hide_plugins(webview, EINA_FALSE, hidePlugin); + */ + ewk_view_reduce_plugins_frame_rate(webview, EINA_TRUE); + } + + // network suspend + ewk_view_suspend_request(webview); // suspend network loading + +} + +static void +_resume_all(Smart_Data *sd) +{ + ELM_WEBVIEW_SLOGD("\n"); + Evas_Object *webview = sd->base.self; + + if (evas_object_visible_get(webview)) + { + // js resume + ewk_view_javascript_resume(webview); + + // render resume + if (sd->tiled) + ewk_view_enable_render(webview); + + // plugin resume + /* + ewk_view_pause_and_or_hide_plugins(webview, EINA_FALSE, hidePlugin); + */ + + // plugin reverting fps + if (ewk_view_setting_enable_plugins_get(webview)) + ewk_view_reduce_plugins_frame_rate(webview, EINA_FALSE); + + // network resume + ewk_view_resume_request(webview); + } +} + +static void +_zoom_start(Smart_Data *sd, int centerX, int centerY, int distance) +{ + ELM_WEBVIEW_SLOGD("\n"); + + { + sd->zoom.init_finger_distance = distance; + sd->zoom.pre_distance = distance; + sd->zoom.zooming_level = 0; + if (sd->on_zooming) + sd->zoom.zoom_rate_at_start = sd->zoom.zooming_rate; + else + { + int view_x, view_y; + evas_object_geometry_get(sd->base.self, &view_x, &view_y, NULL, NULL); + sd->zoom.zoom_rate_at_start = ewk_view_zoom_get(sd->base.self); + sd->zoom.basis.x = centerX - view_x; + sd->zoom.basis.y = centerY - view_y; + } + sd->zoom.zooming_rate = sd->zoom.zoom_rate_at_start; + + if (sd->auto_suspend && !sd->plugin_mode_and_over_plugin) + _suspend_all(sd); + + els_webview_editor_selection_mode_change(sd->editor, TEXT_SELECTION_ZOOM_START); + +#ifdef DEBUG_FRAMERATE + sd->start_time = ecore_time_get(); + sd->count = 0; +#endif + } + sd->on_zooming = EINA_TRUE; +} + +static void +_zoom_move(Smart_Data* sd, int centerX, int centerY, int distance) +{ + if (sd->on_zooming == EINA_FALSE) return; + +#ifdef DEBUG_FRAMERATE + sd->count++; +#endif + + int zoom_distance = distance - sd->zoom.pre_distance; + int new_distance = distance; + + + if (zoom_distance != sd->zoom.zooming_level) + { + float zoom_ratio; + + if (sd->use_zoom_bouncing) + { + float min_zoom_rate = sd->zoom.min_zoom_rate * ZOOM_OUT_BOUNCING; + if (min_zoom_rate <= 0) min_zoom_rate = MIN_ZOOM_RATIO; + float max_zoom_rate = sd->zoom.max_zoom_rate * ZOOM_IN_BOUNCING; + + zoom_ratio = sd->zoom.zoom_rate_at_start * (1.0 + (((float)new_distance - (float)sd->zoom.init_finger_distance) / sd->zoom.init_finger_distance)); + + if (zoom_ratio < min_zoom_rate) + zoom_ratio = min_zoom_rate; + if (zoom_ratio > max_zoom_rate) + zoom_ratio = max_zoom_rate; + } + else + { + zoom_ratio = sd->zoom.zooming_rate + zoom_distance * ZOOM_STEP_PER_PIXEL; + if (zoom_ratio < sd->zoom.min_zoom_rate) + zoom_ratio = sd->zoom.min_zoom_rate; + if (zoom_ratio > sd->zoom.max_zoom_rate) + zoom_ratio = sd->zoom.max_zoom_rate; + } + sd->zoom.zooming_level = zoom_distance; + sd->zoom.zooming_rate = zoom_ratio; + sd->zoom.pre_distance = distance; + ewk_view_zoom_weak_set(sd->base.self, zoom_ratio, sd->zoom.basis.x, sd->zoom.basis.y); + ELM_WEBVIEW_SLOGD("<< zoom weak set [%f] >>\n", zoom_ratio); + } +} + +static void +_zoom_stop(Smart_Data *sd, Evas_Object *webview) +{ + if (sd->on_zooming == EINA_FALSE) return; + Eina_Bool ret = EINA_FALSE; + sd->on_zooming = EINA_FALSE; + ELM_WEBVIEW_SLOGD("(%d)\n", sd->zoom.zooming_level); + +#ifdef DEBUG_FRAMERATE + double framerate = sd->count / (ecore_time_get() - sd->start_time); + if (framerate < 60.0f) + ELM_WEBVIEW_SLOGI("<< zooming frame rate = [%.1f] fps >>\n", framerate); +#endif + + sd->zoom.zoom_rate_to_set = sd->zoom.zooming_rate; + if (sd->zoom.zoom_rate_to_set < sd->zoom.min_zoom_rate) + sd->zoom.zoom_rate_to_set = sd->zoom.min_zoom_rate; + if (sd->zoom.zoom_rate_to_set > sd->zoom.max_zoom_rate) + sd->zoom.zoom_rate_to_set = sd->zoom.max_zoom_rate; + if (sd->use_zoom_bouncing + && (sd->zoom.zoom_rate_to_set != sd->zoom.zooming_rate)) + { + sd->zoom.zoom_rate_at_start = sd->zoom.zooming_rate; + smart_zoom_index = N_COSINE - 1; + ecore_animator_frametime_set(1.0 / ZOOM_FRAMERATE); + sd->smart_zoom_animator = ecore_animator_add(_smart_zoom_animator, sd); + } + else + { + if (sd->zoom.zoom_rate_to_set == ewk_view_zoom_get(webview)) + { + ewk_view_zoom_weak_set(sd->base.self, sd->zoom.zoom_rate_to_set, sd->zoom.basis.x, sd->zoom.basis.y); + } + else + { + ret = ewk_view_zoom_set(sd->base.self, sd->zoom.zoom_rate_to_set, sd->zoom.basis.x, sd->zoom.basis.y); + } + if (ret == EINA_FALSE && sd->auto_suspend && !sd->plugin_mode_and_over_plugin) _resume_all(sd); + ELM_WEBVIEW_SLOGD("<< zoom set [%f] >>\n", sd->zoom.zoom_rate_to_set); + evas_object_smart_callback_call(sd->widget, "zoom,finished", NULL); + } +} + +static void +_adjust_to_contents_boundary(Evas_Object *obj, Evas_Coord *to_x, Evas_Coord *to_y, + Evas_Coord from_x, Evas_Coord from_y, float new_zoom_rate) +{ + INTERNAL_ENTRY; + // get view's geometry + int view_x, view_y, view_w, view_h; + evas_object_geometry_get(obj, &view_x, &view_y, &view_w, &view_h); + + // get contentsSize + int contents_w, contents_h; + ewk_frame_contents_size_get(ewk_view_frame_main_get(obj), &contents_w, &contents_h); + float current_zoom_rate = ewk_view_zoom_get(obj); + if (ewk_view_zoom_cairo_scaling_get(obj)) + { + contents_w *= current_zoom_rate; + contents_h *= current_zoom_rate; + } + + // check boundary - should not exceed the left, right, top and bottom of contents after zoom + float zoom_step = new_zoom_rate / current_zoom_rate; + int ewk_from_x, ewk_from_y; + _coords_evas_to_ewk(obj, from_x, from_y, &ewk_from_x, &ewk_from_y); + int contents_left = ewk_from_x * zoom_step; // amount of contents on the left of ewk_from_x + int contents_right = contents_w * zoom_step - contents_left; // amount of contents on the right of ewk_from_x + int screen_left = (*to_x) - view_x; // amount of screen on the left of to_x + int screen_right = view_w - screen_left; // amount of screen on the right of to_x + if (contents_left < screen_left) + (*to_x) -= (screen_left - contents_left); + else if (contents_right < screen_right) + (*to_x) += (screen_right - contents_right); + int contents_top = ewk_from_y * zoom_step; // amount of contents on the top of ewk_from_y + int contents_bottom = contents_h * zoom_step - contents_top; // amount of contents on the bottom of ewk_from_y + int screen_top = (*to_y) - view_y; // amount of screen on the top of to_y + int screen_bottom = view_h - screen_top; // amount of screen on the bottom of to_y + if (contents_top < screen_top) + (*to_y) -= (screen_top - contents_top); + else if (contents_bottom < screen_bottom) + (*to_y) += (screen_bottom - contents_bottom); +} + +static Eina_Bool +_smart_zoom_animator(void* data) +{ + Smart_Data* sd = (Smart_Data*)data; + if (!sd || !sd->smart_zoom_animator) + return ECORE_CALLBACK_CANCEL; + + // stop + if (smart_zoom_index < 0) + { + if ((ewk_view_user_scalable_get(sd->base.self) == EINA_TRUE) + && (sd->zoom.zoom_rate_at_start != sd->zoom.zoom_rate_to_set)) + { + Eina_Bool ret = ewk_view_zoom_set(sd->base.self, sd->zoom.zoom_rate_to_set, sd->zoom.basis.x, sd->zoom.basis.y); + if (ret == EINA_FALSE && sd->auto_suspend == EINA_TRUE && !sd->plugin_mode_and_over_plugin) + _resume_all(sd); + evas_object_smart_callback_call(sd->widget, "zoom,finished", NULL); + } + + if (sd->enable_default_touch) + _elm_smart_touch_start(sd->touch_obj); + + sd->smart_zoom_animator = NULL; + return ECORE_CALLBACK_CANCEL; + } + + if ((ewk_view_user_scalable_get(sd->base.self) == EINA_TRUE) + && (sd->zoom.zoom_rate_at_start != sd->zoom.zoom_rate_to_set)) + { + // weak zoom + float zoom_rate = sd->zoom.zoom_rate_at_start + + ((sd->zoom.zoom_rate_to_set - sd->zoom.zoom_rate_at_start) * cosine[smart_zoom_index]); + if (zoom_rate <= sd->zoom.min_zoom_rate) + { + int scroll_x, scroll_y; + ewk_frame_scroll_pos_get(ewk_view_frame_main_get(sd->base.self), &scroll_x, &scroll_y); + float current_zoom_rate = ewk_view_zoom_get(sd->base.self); + int center_x = (scroll_x * sd->zoom.zoom_rate_to_set * current_zoom_rate) + / (current_zoom_rate - sd->zoom.zoom_rate_to_set); + int center_y = (scroll_y * sd->zoom.zoom_rate_to_set * current_zoom_rate) + / (current_zoom_rate - sd->zoom.zoom_rate_to_set); + + int basis_x = sd->zoom.basis.x + (center_x - sd->zoom.basis.x) * cosine[smart_zoom_index]; + int basis_y = sd->zoom.basis.y + (center_y - sd->zoom.basis.y) * cosine[smart_zoom_index]; + ewk_view_zoom_weak_set(sd->base.self, zoom_rate, basis_x, basis_y); + smart_zoom_index--; // in order to make zoom bouncing more faster + } + if (zoom_rate >= sd->zoom.max_zoom_rate) + { + ewk_view_zoom_weak_set(sd->base.self, zoom_rate, sd->zoom.basis.x, sd->zoom.basis.y); + smart_zoom_index--; // in order to make zoom bouncing more faster + } + else + ewk_view_zoom_weak_set(sd->base.self, zoom_rate, sd->zoom.basis.x, sd->zoom.basis.y); + } + else + { + // save old scroll positions + int current_scroll_x, current_scroll_y; + ewk_frame_scroll_pos_get(ewk_view_frame_main_get(sd->base.self), ¤t_scroll_x, ¤t_scroll_y); + + // get to set position + int to_set_x = sd->zoom.scroll_at_start.x + + (sd->zoom.scroll_to_set.x - sd->zoom.scroll_at_start.x) * cosine[smart_zoom_index]; + int to_set_y = sd->zoom.scroll_at_start.y + + (sd->zoom.scroll_to_set.y - sd->zoom.scroll_at_start.y) * cosine[smart_zoom_index]; + + // scroll + ewk_frame_scroll_add(ewk_view_frame_main_get(sd->base.self), + to_set_x - current_scroll_x, to_set_y - current_scroll_y); + } + smart_zoom_index--; + + return ECORE_CALLBACK_RENEW; +} + +static void +_smart_cb_two_release(void *data, Evas_Object *webview, void *ev) +{ + ELM_WEBVIEW_SLOGD("ev[0] (%d, %d), ev[1] (%d, %d)\n", + ((Touch_Point *)ev)[0].x, ((Touch_Point *)ev)[0].y, + ((Touch_Point *)ev)[1].x, ((Touch_Point *)ev)[1].y); + Smart_Data *sd = (Smart_Data *)data; + if (!sd || sd->events_feed) return; + + ewk_frame_feed_touch_event(sd->base.main_frame, EWK_TOUCH_END, _touch_point_list_get(2, (Touch_Point *)ev), 0); +} + +static void +_smart_cb_two_press(void *data, Evas_Object *webview, void *event_info) +{ + Smart_Data *sd = (Smart_Data *)data; + if (!sd) return; + + // delete mouse_down_delay_timer + if (sd->use_mouse_down_delay) + { + if (sd->mouse_down_delay_timer) + { + ecore_timer_del(sd->mouse_down_delay_timer); + sd->mouse_down_delay_timer = NULL; + } + } + if (sd->is_mouse_down_propagated && sd->is_mouse_down_on_link) + { + ewk_frame_focus_ring_invalidate(ewk_view_frame_main_get(webview)); + ewk_view_setting_enable_focus_ring_set(webview, EINA_FALSE); + } +} + +static void +_smart_cb_two_move_start(void *data, Evas_Object *webview, void *event_info) +{ + ELM_WEBVIEW_SLOGD("ev[0] (%d, %d), ev[1] (%d, %d)\n", + ((Touch_Point *)event_info)[0].x, ((Touch_Point *)event_info)[0].y, + ((Touch_Point *)event_info)[1].x, ((Touch_Point *)event_info)[1].y); + Smart_Data *sd = (Smart_Data *)data; + if (!sd || sd->events_feed) return; + + // touch mode for EMBERWIND + switch (sd->touch_mode) { + case TouchNormal: + ewk_frame_feed_touch_event(sd->base.main_frame, EWK_TOUCH_START, _touch_point_list_get(2, (Touch_Point *)event_info), 0); + break; + case TouchEmberwind: + break; + default: + ELM_WEBVIEW_SLOGD("TouchMode ERROR!\n"); + } +} + +static void +_smart_cb_two_move(void *data, Evas_Object *webview, void *event_info) +{ + ELM_WEBVIEW_SLOGD("ev[0] (%d, %d), ev[1] (%d, %d)\n", + ((Touch_Point *)event_info)[0].x, ((Touch_Point *)event_info)[0].y, + ((Touch_Point *)event_info)[1].x, ((Touch_Point *)event_info)[1].y); + Smart_Data *sd = (Smart_Data *)data; + // block zoomin over selected plugin which consumes mouse move events + if (!sd || sd->events_feed || (sd->plugin_mode && sd->plugin_mode_and_over_plugin && sd->last_event_was_handled_by_plugin)) return; + + // touch mode for EMBERWIND + switch (sd->touch_mode) { + case TouchNormal: + ewk_frame_feed_touch_event(sd->base.main_frame, EWK_TOUCH_MOVE, _touch_point_list_get(2, (Touch_Point *)event_info), 0); + break; + case TouchEmberwind: + break; + default: + ELM_WEBVIEW_SLOGD("TouchMode ERROR!\n"); + } +} + +static void +_smart_cb_two_move_end(void *data, Evas_Object *webview, void *event_info) +{ + ELM_WEBVIEW_SLOGD("ev[0] (%d, %d), ev[1] (%d, %d)\n", + ((Touch_Point *)event_info)[0].x, ((Touch_Point *)event_info)[0].y); + Smart_Data *sd = (Smart_Data *)data; + if (!sd || sd->events_feed) return; + + if (sd->is_mouse_down_propagated && sd->is_mouse_down_on_link) + { + ewk_frame_focus_ring_invalidate(ewk_view_frame_main_get(webview)); + ewk_view_setting_enable_focus_ring_set(webview, EINA_FALSE); + } + + // touch mode for EMBERWIND + switch (sd->touch_mode) { + case TouchNormal: + ewk_frame_feed_touch_event(sd->base.main_frame, EWK_TOUCH_END, _touch_point_list_get(1, (Touch_Point *)event_info), 0); + break; + case TouchEmberwind: + break; + default: + ELM_WEBVIEW_SLOGD("TouchMode ERROR!\n"); + } +} + +static void +_smart_cb_one_down_up_down(void *data, Evas_Object *webview, void *ev) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + + if (sd->is_mouse_down_propagated && sd->is_mouse_down_on_link) + { + ewk_frame_focus_ring_invalidate(ewk_view_frame_main_get(webview)); + ewk_view_setting_enable_focus_ring_set(webview, EINA_FALSE); + } + + if (sd->plugin_mode) + { + ELM_WEBVIEW_SLOGD("plugin mode\n"); + Evas_Event_Mouse_Down mouse_down; + Evas_Point* point = (Evas_Point*)ev; + Evas *evas = evas_object_evas_get(sd->base.self); + mouse_down.button = 1; + mouse_down.output.x = point->x; + mouse_down.output.y = point->y; + mouse_down.canvas.x = point->x; + mouse_down.canvas.y = point->y; + mouse_down.data = NULL; + mouse_down.modifiers = (Evas_Modifier *)evas_key_modifier_get(evas); + mouse_down.locks = (Evas_Lock *)evas_key_lock_get(evas); + mouse_down.flags = EVAS_BUTTON_NONE; + mouse_down.timestamp = ecore_loop_time_get(); + mouse_down.event_flags = EVAS_EVENT_FLAG_NONE; + mouse_down.dev = NULL; + + // code moved here to block sending native mouse down event to elements different than selected plugin +#ifdef EVENT_FEED_TO_FLASH + // this case means that we are in "plugin mode", so checking if mouse down is over plugin is done + int ewk_x, ewk_y; + _coords_evas_to_ewk(sd->base.self, point->x, point->y, &ewk_x, &ewk_y); + Ewk_Hit_Test *hit_test = ewk_frame_hit_test_new(ewk_view_frame_main_get(sd->base.self), ewk_x, ewk_y); + if (hit_test + && (hit_test->context & EWK_HIT_TEST_RESULT_CONTENT_PLUGIN) + && (hit_test->context & EWK_HIT_TEST_RESULT_CONTENT_PLUGIN_SELECTED)) + { + sd->plugin_mode_and_over_plugin = EINA_TRUE; + ewk_view_events_invalidate_on_plugin(sd->base.self, EINA_TRUE); + } + else + { + sd->plugin_mode_and_over_plugin = EINA_FALSE; + ewk_view_events_invalidate_on_plugin(sd->base.self, EINA_FALSE); + } + + if (hit_test) + ewk_frame_hit_test_free(hit_test); + if (!sd->plugin_mode_and_over_plugin) + { + sd->is_mouse_down_propagated = EINA_FALSE; + return; + } +#endif + _parent_sc.mouse_down((Ewk_View_Smart_Data*)sd, &mouse_down); + } +} + +static void +_zoom_to_rect(Smart_Data *sd, Eina_Rectangle *rect, Eina_Rectangle *caret) +{ + ELM_WEBVIEW_SLOGD("\n"); + Evas_Object *webview = sd->base.self; + ELM_WEBVIEW_SLOGD("<< rect [%d, %d, %d, %d] >>\n", rect->x, rect->y, rect->w, rect->h); + ELM_WEBVIEW_SLOGD("<< caret [%d, %d, %d, %d] >>\n", caret->x, caret->y, caret->w, caret->h); + + sd->focused_rect = *rect; + sd->caret = *caret; + + // calculate zoom_rate and center of rect + if (rect->w && rect->h) + { + // get zoom rate and step + float zoom_rate; + float zoom_step; + float current_zoom_rate = ewk_view_zoom_get(webview); + // if we use the input_field_zoom and this function is called by input field zoom, the zoom rate is default value. + // if we use the select_tag_zoom and this function is called by select tag zoom, the zoom rate is default value. + if (((sd->use_input_field_zoom == EINA_TRUE) && (caret->x != -2)) || + ((sd->use_select_tag_zoom == EINA_TRUE) && (caret->x == -2))) + { + zoom_rate = INPUT_ZOOM_RATIO; + if (zoom_rate < sd->zoom.min_zoom_rate) + zoom_rate = sd->zoom.min_zoom_rate; + if (zoom_rate > sd->zoom.max_zoom_rate) + zoom_rate = sd->zoom.max_zoom_rate; + zoom_step = zoom_rate / current_zoom_rate; + } + // otherwise, zoom_rate is as same as current zoom rate + else + { + zoom_rate = current_zoom_rate; + zoom_step = 1.0f; + } + + // get view rect + Eina_Rectangle view = {0, 0, 0, 0}; + evas_object_geometry_get(webview, &(view.x), &(view.y), &(view.w), &(view.h)); + + // get position to move from + Evas_Coord from_x = rect->x; + Evas_Coord from_y = rect->y; + // if the input rect's width(height) is larger than view width(height) + // change the from position + // if the size from caret to rect's right(bottom) is bigger than view width(height) + // set the from_x(y) to rect->x(y) + // else + // set the from_x(y) to caret->x(y) - (view.w(h) * threshold / zoom_step) + // (to maintain the caret position at the center of the view) + if ((caret->x >= 0) && ((rect->w * zoom_step) > view.w)) + { + if((caret->x - rect->x) * zoom_step < view.w * INPUT_PADDING_THRESHOLD) + from_x = rect->x; + else + from_x = caret->x - (view.w * INPUT_CARET_LOCATION_THRESHOLD / zoom_step); + } + if ((caret->y >= 0) && ((rect->h * zoom_step) > view.h)) + { + if((caret->y - rect->y) * zoom_step < view.h * INPUT_PADDING_THRESHOLD) + from_y = rect->y; + else + from_y = caret->y - (view.h * INPUT_CARET_LOCATION_THRESHOLD / zoom_step); + } + _coords_ewk_to_evas(webview, from_x, from_y, &from_x, &from_y); + // apply paddings + from_x = from_x + ((view.w - INPUT_LOCATION_X) / 2) / zoom_step; + from_y = from_y + rect->h / 2; + + // get position to move to + Evas_Coord to_x = view.x + INPUT_LOCATION_X + (view.w - INPUT_LOCATION_X) / 2; + Evas_Coord to_y; + + enum appcore_rm current_state = APPCORE_RM_UNKNOWN; + int ret = appcore_get_rotation_state(¤t_state); + ELM_WEBVIEW_SLOGD("current_state[%d]\n", current_state); + + switch(current_state) + { + case APPCORE_RM_LANDSCAPE_NORMAL: + case APPCORE_RM_LANDSCAPE_REVERSE: + to_y = view.y + INPUT_LOCATION_HORIZONTAL_Y + (rect->h / 2) * zoom_step; + break; + case APPCORE_RM_PORTRAIT_NORMAL: + case APPCORE_RM_PORTRAIT_REVERSE: + case APPCORE_RM_UNKNOWN: + to_y = view.y + INPUT_LOCATION_VERTICAL_Y + (rect->h / 2) * zoom_step; + break; + } + + // adjust to contents + _adjust_to_contents_boundary(webview, &to_x, &to_y, from_x, from_y, zoom_rate); + + // set data for smart zoom + sd->zoom.basis.x = (to_x - zoom_step * from_x) / (1 - zoom_step) - view.x; + sd->zoom.basis.y = (to_y - zoom_step * from_y) / (1 - zoom_step) - view.y; + sd->zoom.zoom_rate_at_start = current_zoom_rate; + sd->zoom.zoom_rate_to_set = zoom_rate; + ewk_frame_scroll_pos_get(ewk_view_frame_main_get(webview), + &sd->zoom.scroll_at_start.x, &sd->zoom.scroll_at_start.y); + sd->zoom.scroll_to_set.x = sd->zoom.scroll_at_start.x + (from_x - to_x); + sd->zoom.scroll_to_set.y = sd->zoom.scroll_at_start.y + (from_y - to_y); + smart_zoom_index = N_COSINE - 1; + + if (sd->auto_suspend + && (ewk_view_user_scalable_get(sd->base.self) == EINA_TRUE) + && (sd->zoom.zoom_rate_at_start != sd->zoom.zoom_rate_to_set)) + _suspend_all(sd); + + // run animator + ecore_animator_frametime_set(1.0 / ZOOM_FRAMERATE); + sd->smart_zoom_animator = ecore_animator_add(_smart_zoom_animator, sd); + + // Calculate new rect size for focusing after rotation. + if (sd->zoom.zoom_rate_to_set == INPUT_ZOOM_RATIO) + { + sd->focused_rect.x = sd->focused_rect.x * INPUT_ZOOM_RATIO / current_zoom_rate; + sd->focused_rect.y = sd->focused_rect.y * INPUT_ZOOM_RATIO / current_zoom_rate; + sd->focused_rect.w = sd->focused_rect.w * INPUT_ZOOM_RATIO / current_zoom_rate; + sd->focused_rect.h = sd->focused_rect.h * INPUT_ZOOM_RATIO / current_zoom_rate; + sd->caret.x = sd->caret.x * INPUT_ZOOM_RATIO / current_zoom_rate; + sd->caret.y = sd->caret.y * INPUT_ZOOM_RATIO / current_zoom_rate; + sd->caret.w = sd->caret.w * INPUT_ZOOM_RATIO / current_zoom_rate; + sd->caret.h = sd->caret.h * INPUT_ZOOM_RATIO / current_zoom_rate; + } + + evas_object_smart_callback_call(sd->widget, "zoom,started", NULL); + } +} + +/* coord related functions */ +/** + * @fn static void _coords_evas_to_ewk(Evas_Object *obj, int x, int y, int *ux, int *uy) + * @brief change coordination from evas coordination to ewk coordination + * + * @param[in] obj els-webview + * @param[in] x x of ewk coordination + * @param[in] y y of ewk coordination + * @param[in] ux x of evas coordination + * @param[in] uy y of evas coordination + */ +static void +_coords_evas_to_ewk(Evas_Object *obj, int x, int y, int *ux, int *uy) +{ + INTERNAL_ENTRY; + + int scrollX, scrollY, viewX, viewY; + ewk_frame_scroll_pos_get(ewk_view_frame_main_get(obj), &scrollX, &scrollY); + evas_object_geometry_get(obj, &viewX, &viewY, NULL, NULL); + *ux = x + scrollX - viewX; + *uy = y + scrollY - viewY; +} + +/** + * @fn static void _coords_ewk_to_evas(Evas_Object *obj, int x, int y, int *ux, int *uy) + * @brief change coordination from ewk coordination to evas coordination + * + * @param[in] obj els-webview + * @param[in] x x of ewk coordination + * @param[in] y y of ewk coordination + * @param[in] ux x of evas coordination + * @param[in] uy y of evas coordination + */ +static void +_coords_ewk_to_evas(Evas_Object *obj, int x, int y, int *ux, int *uy) +{ + INTERNAL_ENTRY; + + int scrollX, scrollY, viewX, viewY; + ewk_frame_scroll_pos_get(ewk_view_frame_main_get(obj), &scrollX, &scrollY); + evas_object_geometry_get(obj, &viewX, &viewY, NULL, NULL); + *ux = x - scrollX + viewX; + *uy = y - scrollY + viewY; +} + +/** + * @fn static void _update_min_zoom_rate(Evas_Object *obj) + * @brief update min zoom rate + * + * @param[in] obj els-webview + */ +static void +_update_min_zoom_rate(Evas_Object *obj) +{ + INTERNAL_ENTRY; + + // do not calculate min_zoom_rate if we can not change the zoom rate + if ((sd->zoom.scalable == EINA_FALSE) + || (sd->zoom.min_zoom_rate == sd->zoom.max_zoom_rate)) + return; + + int content_w, object_w; + evas_object_geometry_get(obj, NULL, NULL, &object_w, NULL); + ewk_frame_contents_size_get(ewk_view_frame_main_get(obj), &content_w, NULL); + if (!content_w) return; + + // get new min_zoom_rate + if (!ewk_view_zoom_cairo_scaling_get(obj)) + content_w /= ewk_view_zoom_get(obj); + + sd->zoom.min_zoom_rate = (float)object_w / (float)content_w; + if (sd->zoom.min_zoom_rate <= 0) + sd->zoom.min_zoom_rate = MIN_ZOOM_RATIO; + + sd->zoom.latest_min_zoom_rate = sd->zoom.min_zoom_rate; + + // set zoom range again + ewk_view_zoom_range_set(obj, sd->zoom.min_zoom_rate, sd->zoom.max_zoom_rate); +} + +/** + * @fn static void _geolocation_response_callback(void *data, Evas_Object *obj, void *event_info) + * @brief callback of geolocation permission dialog + * + * @param[in] data data + * @param[in] obj obj + * @param[in] event_info event_info + */ +static void +_geolocation_response_callback(void *data, Evas_Object *obj, void *event_info) +{ + switch ((int)event_info) + { + case ELM_POPUP_RESPONSE_OK: + ewk_geolocation_sharing_allowed_set(data, EINA_TRUE); + evas_object_del(obj); + break; + case ELM_POPUP_RESPONSE_CANCEL: + ewk_geolocation_sharing_allowed_set(data, EINA_FALSE); + evas_object_del(obj); + break; + default: + break; + } +} + +/** + * @fn static void _geolocation_permission_callback(void *geolocation_obj, const char *url) + * @brief show permission dialog for geolocation + * + * @param[in] geolocation_obj geolocation_obj + * @param[in] url url + */ +static void +_geolocation_permission_callback(void *geolocation_obj, const char *url) +{ + ELM_WEBVIEW_SLOGD("\n"); + INTERNAL_ENTRY; + + if (geolocation_obj == NULL) return; + + int length; + char *msg = NULL; + char msg2[] = " is requesting your current location."; //FIXME: Is this international? + + length = strlen(url) + strlen(msg2); + msg = calloc(length + 1, sizeof(char)); + if (!msg) return; + + strncpy(msg, url, strlen(url)); + strncat(msg, msg2, strlen(msg2)); + msg[length] = '\0'; + + sd->geolocation_popup = elm_popup_add(sd->parent); + evas_object_size_hint_weight_set(sd->geolocation_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_popup_desc_set(sd->geolocation_popup, msg); + elm_popup_buttons_add(sd->geolocation_popup, 2, "Allow", ELM_POPUP_RESPONSE_OK, + "Deny", ELM_POPUP_RESPONSE_CANCEL, NULL); + evas_object_smart_callback_add(sd->geolocation_popup, "response", _geolocation_response_callback, geolocation_obj); + evas_object_show(sd->geolocation_popup); + free(msg); +} + +/** + * @fn static Eina_Bool _touch_down(Evas_Object* o, Evas_Event_Mouse_Down* mouse_down) + * @brief call touch_event for mouse_down. + * + * @param[in] o webview + * @param[in] mouse_down mouse_down event + */ +static Eina_Bool +_touch_down(Evas_Object* o, const Evas_Event_Mouse_Down* mouse_down) +{ + ELM_WEBVIEW_SLOGD("\n"); + Eina_List* points = NULL; + Ewk_Touch_Point pnt; + + pnt.id = 0; + pnt.x = mouse_down->canvas.x; + pnt.y = mouse_down->canvas.y; + pnt.state = EWK_TOUCH_POINT_PRESSED; + + points = eina_list_append(points, &pnt); + return ewk_frame_feed_touch_event(ewk_view_frame_main_get(o), EWK_TOUCH_START, points, 0); +} + +/** + * @fn static Eina_Bool _touch_up(Evas_Object* o, Evas_Event_Mouse_Up* mouse_up) + * @brief call touch_event for mouse_up. + * + * @param[in] o webview + * @param[in] mouse_up mouse_up event + */ +static Eina_Bool +_touch_up(Evas_Object *o, const Evas_Event_Mouse_Up *mouse_up) +{ + ELM_WEBVIEW_SLOGD("\n"); + Eina_List* points = NULL; + Ewk_Touch_Point pnt; + + pnt.id = 0; + pnt.x = mouse_up->canvas.x; + pnt.y = mouse_up->canvas.y; + pnt.state = EWK_TOUCH_POINT_RELEASED; + + points = eina_list_append(points, &pnt); + return ewk_frame_feed_touch_event(ewk_view_frame_main_get(o), EWK_TOUCH_END, points, 0); +} + +/** + * @fn static Eina_Bool _touch_cancel(Evas_Object* o, Evas_Event_Mouse_Up* mouse_cancel) + * @brief call touch_event for cancel. + * + * @param[in] o webview + * @param[in] mouse_cancel cancel event + */ +static Eina_Bool +_touch_cancel(Evas_Object *o) +{ + ELM_WEBVIEW_SLOGD("\n"); + Eina_List* points = NULL; + Ewk_Touch_Point pnt; + + pnt.id = 0; + pnt.state = EWK_TOUCH_POINT_CANCELLED; + + points = eina_list_append(points, &pnt); + return ewk_frame_feed_touch_event(ewk_view_frame_main_get(o), EWK_TOUCH_CANCEL, points, 0); +} + +/** + * @fn static Eina_Bool _touch_point_list_get(unsigned int num_of_points, const Touch_Point *p_points) + * @brief return eina_list which contains ewk_touch_point from touch_points array of els_touch + * + * @param[in] num_of_points num of touch points + * @param[in] p_points array of touch points + * return eina_list including ewk_touch_point + */ +static Eina_List * +_touch_point_list_get(unsigned int num_of_points, const Touch_Point *p_points) +{ + Eina_List *points = NULL; + static Ewk_Touch_Point pnt[3]; //FIXME: Dirty, but simple. + unsigned int i = 0; + + if (!p_points) return NULL; + + if (num_of_points >= 3) num_of_points = 3; + + for (i = 0; i < num_of_points; ++i) + { + pnt[i].id = p_points[i].device; + pnt[i].x = p_points[i].x; + pnt[i].y = p_points[i].y; + switch (p_points[i].state) + { + case TOUCH_POINT_PRESSED: + pnt[i].state = EWK_TOUCH_POINT_PRESSED; + break; + case TOUCH_POINT_RELEASED: + pnt[i].state = EWK_TOUCH_POINT_RELEASED; + break; + case TOUCH_POINT_MOVED: + pnt[i].state = EWK_TOUCH_POINT_MOVED; + break; + default: + break; + } + points = eina_list_append(points, pnt+i); + } + return points; +} + +static void +_smart_cb_make_select_visible(void *data, Evas_Object *webview, void *arg) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd = (Smart_Data *)data; + Eina_Rectangle caret = {-2, 0, 0, 0}; // to distinguish input field zoom or select tag zoom + if (!sd) return; + + if (arg) + sd->focused_rect= *((Eina_Rectangle *)arg); + else + memset(&sd->focused_rect, '\0', sizeof(Eina_Rectangle)); + + // zoom to the input rect + _zoom_to_rect(sd, &(sd->focused_rect), &caret); +} + +static void +_smart_cb_make_rect_visible(void *data, Evas_Object *webview, void *event_info) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data* sd = (Smart_Data *)data; + if (!sd) return; + if (!event_info) return; + + // get current pointer's x, y + Evas_Point ewk_point; + // rect[0] is caret, rect[1] is input field rect, rect[2] is the exact mouse point. + Eina_Rectangle *rect = (Eina_Rectangle *) event_info; + // Using rect[2] because rect[0] is not the exact, so hit test could be failed. + _coords_evas_to_ewk(webview, rect[2].x, rect[2].y, &ewk_point.x, &ewk_point.y); + Evas_Object *frame = ewk_view_frame_main_get(webview); + + // do hit test to find the flash plugin's location + Ewk_Hit_Test *hit_test = ewk_frame_hit_test_new(frame, ewk_point.x, ewk_point.y); + if (hit_test) + { + // zoom to rect if clicked area is PLUGIN area. + if (hit_test->context & EWK_HIT_TEST_RESULT_CONTENT_PLUGIN) + { + if (sd->is_ise_flash) + { + rect[0].x += hit_test->bounding_box.x; + rect[0].y += hit_test->bounding_box.y; + rect[1].x += hit_test->bounding_box.x; + rect[1].y += hit_test->bounding_box.y; + + _zoom_to_rect(sd, &rect[1], &rect[0]); + } + else + { + // _zoom_to_rect will be called after resizing. + // ise_event does not occur when input field is in flash plugin. + sd->is_ise_flash = EINA_TRUE; + + sd->caret.x = rect[0].x + hit_test->bounding_box.x; + sd->caret.y = rect[0].y + hit_test->bounding_box.y; + sd->caret.w = rect[0].w; + sd->caret.h = rect[0].h; + sd->focused_rect.x = rect[1].x + hit_test->bounding_box.x; + sd->focused_rect.y = rect[1].y + hit_test->bounding_box.y; + sd->focused_rect.w = rect[1].w; + sd->focused_rect.h = rect[1].h; + } + } + + // free hit test result + ewk_frame_hit_test_free(hit_test); + } +} + +/** + * @fn static Eina_Bool _focus_ring_exceptional_url_get(Evas_Object *webview) + * @brief get whether current url should not use focus ring. + * @param[in] webview webview. + * @return true if focus ring should not be used, false otherwise. + */ +static Eina_Bool +_focus_ring_exceptional_url_get(Evas_Object *webview) +{ + int i; + ELM_WEBVIEW_SLOGD("\n"); + const char *issued_urls[1] = {"http://cdn-mli.wooga.com/game"}; + int issued_urls_total_num = sizeof(issued_urls) / sizeof(char*); + const char *current_url = ewk_view_uri_get(webview); + + for (i = 0; i < issued_urls_total_num; i++) + { + const char *iu = issued_urls[i]; + int iulen = strlen(iu); + int culen = strlen(current_url); + + if (culen < iulen) + continue; + + if (!strncmp(current_url, iu, iulen)) + return EINA_TRUE; + } + + return EINA_FALSE; +} + diff --git a/els_webview.h b/els_webview.h new file mode 100755 index 0000000..d65c677 --- /dev/null +++ b/els_webview.h @@ -0,0 +1,63 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef els_webview_h +#define els_webview_h + +#include + +//FIXME: need to remove +//#define BOUNCING_SUPPORT +#define EVENT_FEED_TO_FLASH + +Evas_Object* _elm_smart_webview_add(Evas_Object *parent, Eina_Bool tiled); +Eina_Bool _elm_smart_webview_auto_fitting_get(Evas_Object *obj); +void _elm_smart_webview_auto_fitting_set(Evas_Object *obj, Eina_Bool enable); +void _elm_smart_webview_events_feed_set(Evas_Object* obj, Eina_Bool feed); +Eina_Bool _elm_smart_webview_events_feed_get(Evas_Object* obj); +void _elm_smart_webview_bounce_allow_set(Evas_Object* obj, Eina_Bool horiz, Eina_Bool vert); +void _elm_smart_webview_scheme_callback_set(Evas_Object* obj, const char *scheme, Elm_WebView_Scheme_Cb func); +void _elm_smart_webview_default_layout_width_set(Evas_Object *obj, int width); +void _elm_smart_webview_layout_width_set_to_container(Evas_Object *obj); +void _elm_smart_webview_input_field_zoom_set(Evas_Object *obj, Eina_Bool zoom); +void _elm_smart_webview_auto_suspend_set(Evas_Object *obj, Eina_Bool auto_suspend); +#ifdef BOUNCING_SUPPORT +void _elm_smart_webview_container_set(Evas_Object *obj, Evas_Object *container); +#endif +void _elm_smart_webview_enable_default_context_menu_set(Evas_Object* obj, Eina_Bool enable); +Eina_Bool _elm_smart_webview_enable_default_context_menu_get(Evas_Object* obj); +void _elm_smart_webview_context_menu_item_selected(Evas_Object* obj, Ewk_Context_Menu_Item* webkit_context_menu_item); +void _elm_smart_webview_enable_default_touch_set(Evas_Object *obj, Eina_Bool enable); +void _elm_smart_webview_horizontal_panning_hold_set(Evas_Object *obj, Eina_Bool hold); +void _elm_smart_webview_vertical_panning_hold_set(Evas_Object *obj, Eina_Bool hold); +void _elm_smart_webview_text_selection_clear(Evas_Object *obj); +void _elm_smart_webview_cbhm_run(Evas_Object *obj); +void _elm_smart_webview_uri_set(Evas_Object *obj, const char *uri); +void _elm_smart_webview_use_mouse_down_delay_set(Evas_Object *obj, Eina_Bool use_mouse_down_delay); +Eina_Bool _elm_smart_webview_use_mouse_down_delay_get(Evas_Object *obj); +Eina_Bool _elm_webview_fixed_position_get(Evas_Object *obj); +void _elm_webview_fixed_position_set(Evas_Object *obj, Eina_Bool enable); +Eina_Bool _elm_smart_webview_layout_width_set_to_container_get(Evas_Object *obj); +void _elm_smart_webview_widget_set(Evas_Object *obj, Evas_Object *wid); +void _elm_smart_webview_show_ime_on_autofocus_set(Evas_Object *obj, Eina_Bool enable); +Eina_Bool _elm_smart_webview_show_ime_on_autofocus_get(Evas_Object *obj); +#endif /*#ifndef els_webview_h */ + diff --git a/els_webview_cbhm.c b/els_webview_cbhm.c new file mode 100644 index 0000000..6250dea --- /dev/null +++ b/els_webview_cbhm.c @@ -0,0 +1,74 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jongseok Yang , Changhyup Jwa + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "els_webview_cbhm.h" + +#include "log.h" +#include +#include +#include +#include +#define ATOM_CBHM_WINDOW_NAME "CBHM_XWIN" +#define ATOM_CBHM_MSG "CBHM_MSG" + +Ecore_X_Window +_els_webview_cbhm_window_get() +{ + Ecore_X_Atom x_atom_cbhm = ecore_x_atom_get(ATOM_CBHM_WINDOW_NAME); + Ecore_X_Window x_cbhm_win = 0; + unsigned char *buf = NULL; + int num = 0; + int ret = ecore_x_window_prop_property_get(0, x_atom_cbhm, XA_WINDOW, 0, &buf, &num); + ELM_WEBVIEW_SLOGD("ret: %d, num: %d\n", ret, num); + if (ret && num) + memcpy(&x_cbhm_win, buf, sizeof(Ecore_X_Window)); + if (buf) + free(buf); + return x_cbhm_win; +} + +Eina_Bool +els_webview_cbhm_msg_send(Evas_Object *obj, char *msg) +{ + Ecore_X_Window x_cbhm_win = _els_webview_cbhm_window_get(); + Ecore_X_Atom x_atom_cbhm_msg = ecore_x_atom_get(ATOM_CBHM_MSG); + Ecore_X_Window xwin = ecore_evas_software_x11_window_get( + ecore_evas_ecore_evas_get(evas_object_evas_get(obj))); + + ELM_WEBVIEW_SLOGD("x_cbhm: 0x%x\n", x_cbhm_win); + if (!x_cbhm_win || !x_atom_cbhm_msg) + return EINA_FALSE; + + XClientMessageEvent m; + memset(&m, 0, sizeof(m)); + m.type = ClientMessage; + m.display = ecore_x_display_get(); + m.window = xwin; + m.message_type = x_atom_cbhm_msg; + m.format = 8; + snprintf(m.data.b, 20, "%s", msg); + + XSendEvent(ecore_x_display_get(), x_cbhm_win, False, NoEventMask, (XEvent*)&m); + + ecore_x_sync(); + return EINA_TRUE; +} + diff --git a/els_webview_cbhm.h b/els_webview_cbhm.h new file mode 100755 index 0000000..6141fa7 --- /dev/null +++ b/els_webview_cbhm.h @@ -0,0 +1,29 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jongseok Yang , Changhyup Jwa + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef els_webview_cbhm_h +#define els_webview_cbhm_h + +#include + +Eina_Bool els_webview_cbhm_msg_send(Evas_Object *obj, char *msg); + +#endif /*#ifndef els_webview_cbhm_h */ diff --git a/els_webview_editor.c b/els_webview_editor.c new file mode 100755 index 0000000..3833406 --- /dev/null +++ b/els_webview_editor.c @@ -0,0 +1,2296 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Michał Pakuła vel Rutka , Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "els_webview_editor.h" + +#include "els_webview.h" +#include "els_webview_cbhm.h" +#include "log.h" +#include +#include +#include +#include + +#define TIZEN_HD_BLUE_THEME "blue-hd" +#define TIZEN_HD_BLACK_THEME "tizen-black-hd" +#define TIZEN_HD_BLUE_THEME_EDJ "/usr/share/elementary/themes/blue-hd.edj" +#define TIZEN_HD_BLACK_THEME_EDJ "/usr/share/elementary/themes/tizen-black-hd.edj" +#define TIZEN_HD_WHITE_THEME_EDJ "/usr/share/elementary/themes/tizen-hd.edj" +#define LEFT_HANDLE_ICON_EDJ_PATH "elm/entry/selection/block_handle_left" +#define RIGHT_HANDLE_ICON_EDJ_PATH "elm/entry/selection/block_handle_right" +#define LARGE_HANDLE_ICON_EDJ_PATH "elm/entry/selection/block_handle" + +#define TEXT_SELECTION_MAGNIFIER_OFFSET_Y 30 +#define TEXT_SELECTION_MAGNIFIER_LINES_NUMBER 3 +#define TEXT_SELECTION_MAGNIFIER_LINE_SIZE 50 +#define TEXT_SELECTION_MAGNIFIER_BORDER_WIDTH 14 +#define TEXT_SELECTION_DRAG_THRESHOLD_X 5 +#define TEXT_SELECTION_DRAG_THRESHOLD_Y 10 + +#define FILE_PROTOCOL_STR_LEN 8 + +#define IMAGE_RESIZE_RATIO 0.95 +#define HTML_IMG_TAG_LEN 2048 +#define PASTE_DATA_CB_STR "_paste_data_cb" +#define PASTE_DATA_CB_LEN 14 +#define CBHM_PASTE_DATA_CB_STR "_cbhm_paste_data_cb" +#define CBHM_PASTE_DATA_CB_LEN 19 + +typedef struct _Text_Selection_Handle Text_Selection_Handle; +struct _Text_Selection_Handle +{ + Evas_Point handle_pos; + Evas_Point handle_pos_clicked_diff; + Eina_Bool is_handle_moving; + Evas_Object* handle_icon; +}; + +struct _Elm_WebView_Editor { + Evas_Object* webview; + Evas_Object* widget; + Evas_Object* parent; + + Ecore_Job* magnifier_popup_show_job; + Ecore_Job* magnifier_popup_move_job; + Ecore_Job* webkit_text_selection_job; + + Text_Selection_Mode text_selection_mode; + + Text_Selection_Handle* front_handle; + Text_Selection_Handle* back_handle; + Text_Selection_Handle* large_handle; + + struct { + cairo_surface_t* cairo_content; + Evas_Object* evas_image; + Evas_Object* popup; + int pos_x; + int pos_y; + int width; + int height; + float zoom; + Eina_Bool set_zoom; + Eina_Bool enable; + } magnifier; + + Evas_Event_Mouse_Down mouse_down; + Ewk_Context_Menu_Item* pasted_item; + Elm_WebView_Context_Menu_Data* contextmenu_data; + Eina_Bool enable_default_context_menu; + + Elm_Drop_Cb paste_function; + Elm_Drop_Cb cbhm_paste_function; + Ecore_Event_Handler* selection_clear_handler; +}; + +/* mouse gesture callbacks */ +static void _smart_cb_mouse_long_move_start(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_mouse_long_move(void *data, Evas_Object *webview, void *ev); +static void _smart_cb_mouse_long_move_end(void *data, Evas_Object *webview, void *ev); + +/* context menu and text selection caller callbacks */ +static void _smart_cb_context_menu(void *data, Evas_Object *webview, void *event_info); +static void _smart_cb_text_selection(void *data, Evas_Object *webview, void *event_info); + +/* webkit editor client callbacks */ +static void _smart_cb_editorclient_selection_changed(void *data, Evas_Object *webview, void *arg); +static void _smart_cb_editorclient_contents_changed(void *data, Evas_Object *webview, void *arg); + +/* webkit context menus callbacks */ +static void _smart_cb_contextmenu_new(void *data, Evas_Object *webview, void *arg); +static void _smart_cb_contextmenu_item_appended(void *data, Evas_Object *webview, void *arg); +static void _smart_cb_contextmenu_customize(void *data, Evas_Object *webview, void *arg); +static void _smart_cb_contextmenu_show(void *data, Evas_Object *webview, void *arg); +static void _smart_cb_contextmenu_free(void *data, Evas_Object *webview, void *arg); + +/* context menus handling functions */ +static void _webview_contextmenu_show(Elm_WebView_Editor *editor); +static void _webview_contextmenu_move(Elm_WebView_Editor *editor); +static void _webview_contextmenu_hide(Elm_WebView_Editor *editor); +static void _webview_contextmenu_del(Elm_WebView_Editor *editor); + +/* general text selection handles functions */ +static Eina_Bool _text_selection_handle_init(Elm_WebView_Editor *editor, Text_Selection_Handle* handle, const char* edj_file_path, const char* handle_icon_edj_path); +static void _text_selection_handle_mouse_down(void *data, Evas *e, Evas_Object *o, void *event_info); +static void _text_selection_handle_mouse_up(void *data, Evas *e, Evas_Object *o, void *event_info); +static void _text_selection_handle_mouse_move(void *data, Evas *e, Evas_Object *o, void *event_info); +static void _text_selection_handle_move(Text_Selection_Handle *handle, int x, int y); +static void _webkit_text_selection_job(void *data); + +/* two handles related functions */ +static void _text_selection_handles_show(Elm_WebView_Editor *editor); +static void _text_selection_handles_hide(Elm_WebView_Editor *editor); +static Eina_Bool _text_selection_handles_update_position(Elm_WebView_Editor *editor); + +/* large handle related functions */ +static void _text_selection_large_handle_show(Elm_WebView_Editor *editor); +static void _text_selection_large_handle_hide(Elm_WebView_Editor *editor); +static Eina_Bool _text_selection_large_handle_update_position(Elm_WebView_Editor *editor); + +/* magnifier related functions */ +static void _magnifier_content_set(Elm_WebView_Editor *editor, int x, int y); +static void _magnifier_show(Elm_WebView_Editor *editor); +static void _magnifier_move(Elm_WebView_Editor *editor, int x, int y); +static void _magnifier_hide(Elm_WebView_Editor *editor); +static void _magnifier_popup_move_job(void *data); +static void _magnifier_popup_show_job(void *data); + +/* copy and paste callbacks */ +static void _smart_cb_write_selection(void *data, Evas_Object *webview, void *arg); +static void _smart_cb_write_image(void *data, Evas_Object *webview, void *arg); +static Eina_Bool _paste_data_cb(void *d, Evas_Object *o, Elm_Selection_Data *data); +static Eina_Bool _cbhm_paste_data_cb(void *d, Evas_Object *o, Elm_Selection_Data *data); +static Eina_Bool _common_paste_data(void *d, Evas_Object *o, Elm_Selection_Data *data, char *cb_type); +static Eina_Bool _elm_webview_selection_clear_cb(void *data, int type, void *event); + +/* general text selection functions */ +static void _text_selection_mode_change(Elm_WebView_Editor *editor, Text_Selection_Mode mode); +static void _text_selection_update(Elm_WebView_Editor *editor, Text_Selection_Mode new_mode); + +static Eina_Bool _text_selection_start(Elm_WebView_Editor *editor); +static void _text_selection_off(Elm_WebView_Editor *editor); + +static void _coords_evas_to_ewk(Evas_Object *webview, int x, int y, int* ux, int* uy); +static void _coords_ewk_to_evas(Evas_Object *webview, int x, int y, int* ux, int* uy); + +/* static variable needed to check if the x selection event was called by this webview */ +static Evas_Object *cnpwidgetdata = NULL; + + +/* externally accessible functions */ + +/** + * @fn Elm_Webview_Editor* els_webview_editor_init(Evas_Object* webview) + * @brief Creates Elm_Webview_Editor object for a webview. + * + * @param[in] webview a parent webview object. + * @return Elm_Webview_Editor object. + */ +Elm_WebView_Editor* +els_webview_editor_init(Evas_Object* webview) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(webview, NULL); + ELM_WEBVIEW_SLOGD("-start\n"); + + Elm_WebView_Editor* editor = (Elm_WebView_Editor*) malloc(sizeof(Elm_WebView_Editor)); + + if (!editor) + { + ELM_WEBVIEW_SLOGE("Editor not initialized.\n"); + return NULL; + } + + editor->contextmenu_data = (Elm_WebView_Context_Menu_Data*) malloc(sizeof(Elm_WebView_Context_Menu_Data)); + if (!editor->contextmenu_data) + { + ELM_WEBVIEW_SLOGE("Context menu data not initialized.\n"); + free(editor); + return NULL; + } + + editor->webview = webview; + + editor->magnifier_popup_move_job = NULL; + editor->magnifier_popup_show_job = NULL; + editor->webkit_text_selection_job = NULL; + + editor->text_selection_mode = TEXT_SELECTION_MODE_OFF; + + editor->front_handle = (Text_Selection_Handle*) malloc(sizeof(Text_Selection_Handle)); + editor->back_handle = (Text_Selection_Handle*) malloc(sizeof(Text_Selection_Handle)); + editor->large_handle = (Text_Selection_Handle*) malloc(sizeof(Text_Selection_Handle)); + + Eina_Bool handles_initialized = EINA_FALSE; + if (editor->front_handle && editor->back_handle && editor->large_handle) + { + if (strstr(elm_theme_get(NULL), TIZEN_HD_BLUE_THEME)) + { + if(_text_selection_handle_init(editor, editor->front_handle, TIZEN_HD_BLUE_THEME_EDJ, LEFT_HANDLE_ICON_EDJ_PATH)) + if(_text_selection_handle_init(editor, editor->back_handle, TIZEN_HD_BLUE_THEME_EDJ, RIGHT_HANDLE_ICON_EDJ_PATH)) + handles_initialized = _text_selection_handle_init(editor, editor->large_handle, TIZEN_HD_BLUE_THEME_EDJ, LARGE_HANDLE_ICON_EDJ_PATH); + } + else if (strstr(elm_theme_get(NULL), TIZEN_HD_BLACK_THEME)) + { + if(_text_selection_handle_init(editor, editor->front_handle, TIZEN_HD_BLACK_THEME_EDJ, LEFT_HANDLE_ICON_EDJ_PATH)) + if(_text_selection_handle_init(editor, editor->back_handle, TIZEN_HD_BLACK_THEME_EDJ, RIGHT_HANDLE_ICON_EDJ_PATH)) + handles_initialized = _text_selection_handle_init(editor, editor->large_handle, TIZEN_HD_BLACK_THEME_EDJ, LARGE_HANDLE_ICON_EDJ_PATH); + } + else + { + if(_text_selection_handle_init(editor, editor->front_handle, TIZEN_HD_WHITE_THEME_EDJ, LEFT_HANDLE_ICON_EDJ_PATH)) + if(_text_selection_handle_init(editor, editor->back_handle, TIZEN_HD_WHITE_THEME_EDJ, RIGHT_HANDLE_ICON_EDJ_PATH)) + handles_initialized = _text_selection_handle_init(editor, editor->large_handle, TIZEN_HD_WHITE_THEME_EDJ, LARGE_HANDLE_ICON_EDJ_PATH); + } + } + + if (!handles_initialized) + { + ELM_WEBVIEW_SLOGE("Text selection handles not initialized.\n"); + free(editor->contextmenu_data); + free(editor->front_handle); + free(editor->back_handle); + free(editor->large_handle); + free(editor); + return NULL; + } + + editor->magnifier.height = TEXT_SELECTION_MAGNIFIER_LINES_NUMBER * TEXT_SELECTION_MAGNIFIER_LINE_SIZE; + editor->magnifier.width = 0; + editor->magnifier.evas_image = NULL; + editor->magnifier.cairo_content = NULL; + editor->magnifier.popup = NULL; + editor->magnifier.set_zoom = EINA_FALSE; + editor->magnifier.zoom = 2.0; + editor->magnifier.enable = EINA_TRUE; + + editor->pasted_item = NULL; + + editor->enable_default_context_menu = EINA_FALSE; + + editor->paste_function = _paste_data_cb; + editor->cbhm_paste_function = _cbhm_paste_data_cb; + + editor->selection_clear_handler = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR, _elm_webview_selection_clear_cb, editor); + + evas_object_smart_callback_add(editor->webview, "one,long,move,start", _smart_cb_mouse_long_move_start, editor); + evas_object_smart_callback_add(editor->webview, "one,long,move", _smart_cb_mouse_long_move, editor); + evas_object_smart_callback_add(editor->webview, "one,long,move,end", _smart_cb_mouse_long_move_end, editor); + + // context menu callback + evas_object_smart_callback_add(editor->webview, "context,menu", _smart_cb_context_menu, editor); + // text selection callback + evas_object_smart_callback_add(editor->webview, "text,selection", _smart_cb_text_selection, editor); + evas_object_smart_callback_add(editor->webview, "write,selection", _smart_cb_write_selection, editor); + evas_object_smart_callback_add(editor->webview, "write,image", _smart_cb_write_image, editor); + evas_object_smart_callback_add(editor->webview, "editorclient,selection,changed", _smart_cb_editorclient_selection_changed, editor); + evas_object_smart_callback_add(editor->webview, "editorclient,contents,changed", _smart_cb_editorclient_contents_changed, editor); + + ELM_WEBVIEW_SLOGD("-end\n"); + return editor; +} + +/** + * @fn void els_webview_editor_destroy(Elm_Webview_Editor* editor) + * @brief Destroys Elm_Webview_Editor object, freeing all data allocated. + * + * @param[in] editor an editor object to be destroyed. + */ +void +els_webview_editor_destroy(Elm_WebView_Editor* editor) +{ + EINA_SAFETY_ON_NULL_RETURN(editor); + ELM_WEBVIEW_SLOGD("\n"); + + _text_selection_off(editor); + + evas_object_smart_callback_del(editor->webview, "context,menu", _smart_cb_context_menu); + evas_object_smart_callback_del(editor->webview, "text,selection", _smart_cb_text_selection); + evas_object_smart_callback_del(editor->webview, "write,selection", _smart_cb_write_selection); + evas_object_smart_callback_del(editor->webview, "write,image", _smart_cb_write_image); + evas_object_smart_callback_del(editor->webview, "editorclient,selection,changed", _smart_cb_editorclient_selection_changed); + evas_object_smart_callback_del(editor->webview, "editorclient,contents,changed", _smart_cb_editorclient_contents_changed); + + if (editor->enable_default_context_menu) + { + evas_object_smart_callback_del(editor->webview, "contextmenu,new", _smart_cb_contextmenu_new); + evas_object_smart_callback_del(editor->webview, "contextmenu,item,appended", _smart_cb_contextmenu_item_appended); + evas_object_smart_callback_del(editor->webview, "contextmenu,customize", _smart_cb_contextmenu_customize); + evas_object_smart_callback_del(editor->webview, "contextmenu,show", _smart_cb_contextmenu_show); + evas_object_smart_callback_del(editor->webview, "contextmenu,free", _smart_cb_contextmenu_free); + } + + if (editor->selection_clear_handler) + ecore_event_handler_del(editor->selection_clear_handler); + + editor->paste_function = NULL; + editor->cbhm_paste_function = NULL; + + free(editor->contextmenu_data); + editor->contextmenu_data = NULL; + + editor->pasted_item = NULL; + + if (editor->magnifier.cairo_content) + { + cairo_surface_destroy(editor->magnifier.cairo_content); + editor->magnifier.cairo_content = NULL; + } + if (editor->magnifier.evas_image) + { + evas_object_del(editor->magnifier.evas_image); + editor->magnifier.evas_image = NULL; + } + if (editor->magnifier.popup) + { + evas_object_del(editor->magnifier.popup); + editor->magnifier.popup = NULL; + } + + evas_object_smart_member_del(editor->front_handle->handle_icon); + evas_object_smart_member_del(editor->back_handle->handle_icon); + evas_object_smart_member_del(editor->large_handle->handle_icon); + evas_object_del(editor->front_handle->handle_icon); + evas_object_del(editor->back_handle->handle_icon); + evas_object_del(editor->back_handle->handle_icon); + free(editor->front_handle); + free(editor->back_handle); + free(editor->large_handle); + + if (editor->magnifier_popup_move_job) + ecore_job_del(editor->magnifier_popup_move_job); + if (editor->magnifier_popup_show_job) + ecore_job_del(editor->magnifier_popup_show_job); + if (editor->webkit_text_selection_job) + ecore_job_del(editor->webkit_text_selection_job); +} + +/** + * @fn void els_webview_editor_selection_update_position(Elm_Webview_Editor* editor, Evas_Point* diff) + * @brief Updates text selection handles and popup positions. + * + * @param[in] editor an editor object. + * @param[in] diff a position difference + */ +void +els_webview_editor_selection_update_position(Elm_WebView_Editor* editor, Evas_Point* diff) +{ + EINA_SAFETY_ON_NULL_RETURN(editor); + ELM_WEBVIEW_SLOGD("\n"); + + if (diff) + { + editor->contextmenu_data->mouse_down_event.canvas.x -= diff->x; + editor->contextmenu_data->mouse_down_event.canvas.y -= diff->y; + } + if (editor->text_selection_mode & TEXT_SELECTION_TWO_HANDLES) + _text_selection_handles_update_position(editor); + if (editor->text_selection_mode & TEXT_SELECTION_LARGE_HANDLE) + _text_selection_large_handle_update_position(editor); + if ((editor->text_selection_mode & TEXT_SELECTION_POPUP) + && !(editor->text_selection_mode & TEXT_SELECTION_PAN_START)) + _webview_contextmenu_move(editor); +} + +/** + * @fn void els_webview_editor_selection_mode_change(Elm_Webview_Editor* editor, Text_Selection_Mode mode) + * @brief Changes text selection mode. + * + * @param[in] editor an editor object. + * @param[in] mode a new mode to be set. + */ +void +els_webview_editor_selection_mode_change(Elm_WebView_Editor* editor, Text_Selection_Mode mode) +{ + EINA_SAFETY_ON_NULL_RETURN(editor); + ELM_WEBVIEW_SLOGD("\n"); + + _text_selection_mode_change(editor, mode); +} + +/** + * @fn void Text_Selection_Mode els_webview_editor_selection_mode_get(Elm_Webview_Editor* editor) + * @brief Gets current text selection mode. + * + * @param[in] editor an editor object. + * @return Text_Selection_Mode current text selection mode. + */ +Text_Selection_Mode +els_webview_editor_selection_mode_get(Elm_WebView_Editor* editor) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(editor, TEXT_SELECTION_MODE_OFF); + ELM_WEBVIEW_SLOGD("\n"); + + return editor->text_selection_mode; +} + +/** + * @fn void els_webview_editor_enable_default_context_menu_set(Elm_Webview_Editor* editor, Eina_Bool enable) + * @brief Set the ability for the webview object to show default context menu. + * + * See elm_webview_enable_default_context_menu_set + * + * @param[in] editor an editor object. + * @param[in] enable boolean pointer in which to enable feeding events to webkit. + */ +void +els_webview_editor_enable_default_context_menu_set(Elm_WebView_Editor* editor, Eina_Bool enable) +{ + EINA_SAFETY_ON_NULL_RETURN(editor); + ELM_WEBVIEW_SLOGD("\n"); + + if (editor->enable_default_context_menu != enable) + { + editor->enable_default_context_menu = enable; + if (enable == EINA_TRUE) + { +#define CONNECT(s,c) evas_object_smart_callback_add(editor->webview, s, c, editor) + CONNECT("contextmenu,new", _smart_cb_contextmenu_new); + CONNECT("contextmenu,item,appended", _smart_cb_contextmenu_item_appended); + CONNECT("contextmenu,customize", _smart_cb_contextmenu_customize); + CONNECT("contextmenu,show", _smart_cb_contextmenu_show); + CONNECT("contextmenu,free", _smart_cb_contextmenu_free); +#undef CONNECT + } + else + { +#define DISCONNECT(s,c) evas_object_smart_callback_del(editor->webview, s, c) + DISCONNECT("contextmenu,new", _smart_cb_contextmenu_new); + DISCONNECT("contextmenu,item,appended", _smart_cb_contextmenu_item_appended); + DISCONNECT("contextmenu,customize", _smart_cb_contextmenu_customize); + DISCONNECT("contextmenu,show", _smart_cb_contextmenu_show); + DISCONNECT("contextmenu,free", _smart_cb_contextmenu_free); +#undef DISCONNECT + } + } +} + +/** + * @fn Eina_Bool els_webview_editor_enable_default_context_menu_get(Elm_Webview_Editor* editor) + * @brief Get the ability for the editor object to show default context menu. + * + * @param[in] editor and editor object. + * @return Eina_True if default context menu was enabled, EINA_FALSE otherwise. + */ +Eina_Bool +els_webview_editor_enable_default_context_menu_get(Elm_WebView_Editor* editor) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(editor, EINA_FALSE); + ELM_WEBVIEW_SLOGD("\n"); + + return editor->enable_default_context_menu; +} + +/** + * @fn void els_webview_editor_context_menu_item_selected(Elm_Webview_Editor* editor, Ewk_Context_Menu_Item *webkit_context_menu_item) + * @brief Informs webview about context menu item being selected. + * + * @param[in] editor an editor object. + * @param[in] webkit_context_menu_item pointer to a selected item. + */ +void +els_webview_editor_context_menu_item_selected(Elm_WebView_Editor* editor, Ewk_Context_Menu_Item *webkit_context_menu_item) +{ + EINA_SAFETY_ON_NULL_RETURN(editor); + ELM_WEBVIEW_SLOGD("text selection mode %d\n", editor->text_selection_mode); + + if (webkit_context_menu_item) + { + if (ewk_context_menu_item_action_get(webkit_context_menu_item) == EWK_CONTEXT_MENU_ITEM_TAG_PASTE) + { + editor->pasted_item = webkit_context_menu_item; + elm_cnp_selection_get(ELM_SEL_TYPE_CLIPBOARD, (ELM_SEL_FORMAT_HTML | ELM_SEL_FORMAT_IMAGE), editor->widget, editor->paste_function, (void *)editor); + _text_selection_mode_change(editor, TEXT_SELECTION_INPUT); + return; + } + else + ewk_context_menu_item_select(ewk_context_menu_item_parent_get(webkit_context_menu_item), webkit_context_menu_item); + } + if (editor->text_selection_mode & TEXT_SELECTION_INPUT) + { + if (ewk_context_menu_item_action_get(webkit_context_menu_item) == EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL || + ewk_context_menu_item_action_get(webkit_context_menu_item) == EWK_CONTEXT_MENU_ITEM_TAG_SELECT_WORD) + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_INPUT_HANDLES_POPUP); + else + _text_selection_mode_change(editor, TEXT_SELECTION_INPUT); + } + else + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_OFF); +} + +/** + * @fn void els_webview_editor_cbhm_run(Elm_Webview_Editor* editor) + * @brief Initializes clipboard helper manager for elm-webview. + * + * @param[in] editor an editor object. + */ +void +els_webview_editor_cbhm_run(Elm_WebView_Editor* editor) +{ + EINA_SAFETY_ON_NULL_RETURN(editor); + ELM_WEBVIEW_SLOGD("\n"); + + cnpwidgetdata = editor->widget; + ecore_x_selection_secondary_set(elm_win_xwindow_get(editor->widget), "",1); + els_webview_cbhm_msg_send(editor->widget, "show1"); +} + +/** + * @fn void els_webview_editor_view_geometry_changed(Elm_Webview_Editor* editor, int x, int y, int w, int h) + * @brief Informs editor object about changes in view geometry. + * + * @param[in] editor an editor object. + * @param[in] x a view x coordinates. + * @param[in] y a view y coordinates. + * @param[in] w a view width. + * @param[in] h a view height. + */ +void +els_webview_editor_view_geometry_changed(Elm_WebView_Editor* editor, int x, int y, int w, int h) +{ + EINA_SAFETY_ON_NULL_RETURN(editor); + ELM_WEBVIEW_SLOGD("\n"); + + editor->magnifier.width = w - TEXT_SELECTION_MAGNIFIER_BORDER_WIDTH; +} + +/** + * @fn void els_webview_editor_webview_parent_set(Elm_Webview_Editor* editor, Evas_Object* parent) + * @brief Sets webview's parent object for editor. + * + * Needed to show magnifier + * + * @param[in] editor an editor object. + * @param[in] parent a webview's parent. + */ +void +els_webview_editor_webview_parent_set(Elm_WebView_Editor* editor, Evas_Object* parent) +{ + EINA_SAFETY_ON_NULL_RETURN(editor); + EINA_SAFETY_ON_NULL_RETURN(parent); + ELM_WEBVIEW_SLOGD("\n"); + + editor->parent = parent; +} + +/** + * @fn void els_webview_editor_webview_widget_set(Elm_Webview_Editor* editor, Evas_Object* widget) + * @brief Sets webview's widget object for editor. + * + * Needed for copy, paste and clipboard manager. + * + * @param[in] editor an editor object. + * @param[in] widget a webview's widget. + */ +void +els_webview_editor_webview_widget_set(Elm_WebView_Editor* editor, Evas_Object* widget) +{ + EINA_SAFETY_ON_NULL_RETURN(editor); + EINA_SAFETY_ON_NULL_RETURN(widget); + ELM_WEBVIEW_SLOGD("\n"); + + editor->widget = widget; +} + +/** + * @fn void els_webview_editor_mouse_down_set(Elm_Webview_Editor* editor, Evas_Event_Mouse_Down ev) + * @brief Sets new mouse down event for editor + * + * Needed for update text selection features positioning. + * + * @param[in] editor an editor object. + * @param[in] ev a mouse down event. + */ +void +els_webview_editor_mouse_down_set(Elm_WebView_Editor* editor, Evas_Event_Mouse_Down ev) +{ + EINA_SAFETY_ON_NULL_RETURN(editor); + ELM_WEBVIEW_SLOGD("\n"); + + editor->mouse_down = ev; +} + +/** + * @fn void els_webview_editor_hit_test_context_set(Elm_Webview_Editor* editor, Ewk_Hit_Test_Context context) + * @brief Set new context menu hit test context after mouse click was performed + * + * Needed for update text selection features positioning. + * + * @param[in] editor an editor object. + * @param[in] context a hit test result context. + */ +void +els_webview_editor_hit_test_context_set(Elm_WebView_Editor* editor, Ewk_Hit_Test_Result_Context context) +{ + EINA_SAFETY_ON_NULL_RETURN(editor); + ELM_WEBVIEW_SLOGD("\n"); + + editor->contextmenu_data->hit_test_result_context = context; +} + +/** + * @fn Ewk_Hit_Test_Result_Context els_webview_editor_hit_test_context_get(Elm_Webview_Editor* editor) + * @brief Gets current context menu hit test context. + * + * @param[in] editor an editor object. + * @return Current context menu hit test context, EWK_HIT_TEST_RESULT_CONTEXT_DOCUMENT on error. + */ +Ewk_Hit_Test_Result_Context +els_webview_editor_hit_test_context_get(Elm_WebView_Editor* editor) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(editor, EWK_HIT_TEST_RESULT_CONTEXT_DOCUMENT); + EINA_SAFETY_ON_NULL_RETURN_VAL(editor->contextmenu_data, EWK_HIT_TEST_RESULT_CONTEXT_DOCUMENT); + + return editor->contextmenu_data->hit_test_result_context; +} + +Eina_Bool +els_webview_editor_show_magnifier_get(Elm_WebView_Editor* editor) +{ + EINA_SAFETY_ON_NULL_RETURN(editor); + ELM_WEBVIEW_SLOGD("\n"); + + return editor->magnifier.enable; +} + +void +els_webview_editor_show_magnifier_set(Elm_WebView_Editor* editor, Eina_Bool enable) +{ + EINA_SAFETY_ON_NULL_RETURN(editor); + ELM_WEBVIEW_SLOGD("\n"); + + editor->magnifier.enable = enable; +} + +/* --------------------============================== INTERNAL ==============================-------------------- */ + +/* mouse gesture callbacks */ + +/** + * @fn static void _smart_cb_mouse_long_move_start(void *data, Evas_Object *webview, void *ev) + * @brief long,move,start callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_mouse_long_move_start(void *data, Evas_Object *webview, void *ev) +{ + ELM_WEBVIEW_SLOGD("\n"); + Elm_WebView_Editor* editor = (Elm_WebView_Editor *)data; + if (!editor) return; + + if (editor->text_selection_mode == TEXT_SELECTION_MODE_LARGE_HANDLE_POPUP) + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_LARGE_HANDLE_MAGNIFIER); +} + +/** + * @fn static void _smart_cb_mouse_long_move(void *data, Evas_Object *webview, void *ev) + * @brief long,move callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_mouse_long_move(void *data, Evas_Object *webview, void *ev) +{ + ELM_WEBVIEW_SLOGD("\n"); + Elm_WebView_Editor* editor = (Elm_WebView_Editor *)data; + if (!editor) return; + + Evas_Point* point = (Evas_Point*)ev; + int x, y; + _coords_evas_to_ewk(webview, point->x, point->y, &x, &y); + + if (editor->text_selection_mode == TEXT_SELECTION_MAGNIFIER) + { + Eina_Rectangle left_handle, right_handle; + Eina_Bool ret = ewk_frame_select_closest_word(ewk_view_frame_focused_get(editor->webview), x, y, &left_handle, &right_handle); + if (ret && !editor->magnifier.set_zoom) + { + editor->magnifier.zoom = (float)TEXT_SELECTION_MAGNIFIER_LINE_SIZE / (float)left_handle.h; + if (editor->magnifier.zoom < 1.0) + editor->magnifier.zoom = 1.0; + editor->magnifier.set_zoom = EINA_TRUE; + } + _magnifier_move(editor, point->x, point->y); + } + else if (editor->text_selection_mode == TEXT_SELECTION_MODE_LARGE_HANDLE_MAGNIFIER) + { + if (ewk_frame_caret_position_set(ewk_view_frame_focused_get(editor->webview), x, y)) + _text_selection_large_handle_update_position(editor); + + _magnifier_move(editor, point->x, point->y); + } +} + +/** + * @fn static void _smart_cb_mouse_long_move_end(void *data, Evas_Object *webview, void *ev) + * @brief long,move,end callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_mouse_long_move_end(void *data, Evas_Object *webview, void *ev) +{ + ELM_WEBVIEW_SLOGD("\n"); + Elm_WebView_Editor* editor = (Elm_WebView_Editor *)data; + if (!editor) return; + + Evas_Point* point = (Evas_Point*)ev; + editor->mouse_down.canvas.x = point->x; + editor->mouse_down.canvas.y = point->y; + + if (editor->text_selection_mode == TEXT_SELECTION_MODE_LARGE_HANDLE_MAGNIFIER) + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_LARGE_HANDLE_POPUP); + else if (editor->text_selection_mode == TEXT_SELECTION_MAGNIFIER) + { + int ewk_x, ewk_y; + _coords_evas_to_ewk(webview, point->x, point->y, &ewk_x, &ewk_y); + Ewk_Hit_Test *hit_test = ewk_frame_hit_test_new(ewk_view_frame_focused_get(webview), ewk_x, ewk_y); + /* if during magnifier drag we stumble upon editable field we decide to do selection there but we have set proper selection mode */ + if (hit_test->context & EWK_HIT_TEST_RESULT_CONTEXT_EDITABLE) + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_INPUT_HANDLES_POPUP); + else + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_HANDLES_POPUP); + ewk_frame_hit_test_free(hit_test); + } + else + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_OFF); +} + +/* context menu and text selection caller callbacks */ + +/** + * @fn static void _smart_cb_context_menu(void *data, Evas_Object *webview, void *ev) + * @brief context,menu callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_context_menu(void *data, Evas_Object *webview, void *ev) +{ + ELM_WEBVIEW_SLOGD("\n"); + Elm_WebView_Editor* editor = (Elm_WebView_Editor *)data; + if (!editor) return; + + editor->contextmenu_data->mouse_down_event = editor->mouse_down; + ewk_view_context_menu_forward_event(webview, &editor->mouse_down); +} + +/** + * @fn static void _smart_cb_text_selection(void *data, Evas_Object *webview, void *ev) + * @brief text,selection callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_text_selection(void *data, Evas_Object *webview, void *ev) +{ + ELM_WEBVIEW_SLOGD("\n"); + Elm_WebView_Editor* editor = (Elm_WebView_Editor *)data; + if (!editor) return; + Evas_Point* point = (Evas_Point*)ev; + + int ewk_x, ewk_y; + _coords_evas_to_ewk(webview, point->x, point->y, &ewk_x, &ewk_y); + + Ewk_Hit_Test_Result_Context hit_test_context = editor->contextmenu_data->hit_test_result_context; + if (!((hit_test_context & EWK_HIT_TEST_RESULT_CONTEXT_LINK) + || (hit_test_context & EWK_HIT_TEST_RESULT_CONTEXT_MEDIA))) + { + if (hit_test_context & EWK_HIT_TEST_RESULT_CONTEXT_EDITABLE) + { + if (hit_test_context & EWK_HIT_TEST_RESULT_CONTEXT_IMAGE) + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_INPUT_POPUP); + else + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_LARGE_HANDLE_POPUP); + } + else if (hit_test_context & EWK_HIT_TEST_RESULT_CONTEXT_TEXT) + _text_selection_mode_change(editor, TEXT_SELECTION_MAGNIFIER); + } +} + +/* webkit editor client callbacks */ + +/** + * @fn static void _smart_cb_editorclient_selection_changed(void *data, Evas_Object *webview, void *arg) + * @brief editorclientselection,changed callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_editorclient_selection_changed(void *data, Evas_Object *webview, void *arg) +{ + ELM_WEBVIEW_SLOGD("\n"); + + Elm_WebView_Editor* editor = (Elm_WebView_Editor *)data; + if (!editor) return; + + switch (ewk_frame_text_selection_type_get(ewk_view_frame_focused_get(webview))) + { + case EWK_TEXT_SELECTION_NONE: + ELM_WEBVIEW_SLOGD("no selection - text_selection_mode %d\n", editor->text_selection_mode); + /* besides we receive 'no selection' we do not clear selection when magnifier is active */ + if (!(editor->text_selection_mode & TEXT_SELECTION_MAGNIFIER)) + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_OFF); + break; + + case EWK_TEXT_SELECTION_CARET: + ELM_WEBVIEW_SLOGD("caret selection - text_selection_mode %d\n", editor->text_selection_mode); + if (!(editor->text_selection_mode & TEXT_SELECTION_MAGNIFIER)) //if we are in magnifier mode then ignore this event + { + if (!(editor->text_selection_mode & TEXT_SELECTION_INPUT)) + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_OFF); //if we receive this event outside text input field then clear selection + if ((editor->text_selection_mode & TEXT_SELECTION_INPUT) && (editor->text_selection_mode & TEXT_SELECTION_MOUSE_DOWN)) + _text_selection_mode_change(editor, TEXT_SELECTION_INPUT); //if during a text selection input selection was changed due click event remove MOUSE_DOWN + } + break; + + case EWK_TEXT_SELECTION_RANGE: + ELM_WEBVIEW_SLOGD("range selection - text_selection_mode %d\n", editor->text_selection_mode); + break; + } +} + +/** + * @fn static void _smart_cb_editorclient_contents_changed(void *data, Evas_Object *webview, void *arg) + * @brief editorclientcontents,changed callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_editorclient_contents_changed(void *data, Evas_Object *webview, void *arg) +{ + ELM_WEBVIEW_SLOGD("\n"); + + Elm_WebView_Editor* editor = (Elm_WebView_Editor *)data; + if (!editor) return; + + _text_selection_mode_change(editor, TEXT_SELECTION_INPUT); +} + +/* webkit context menus callbacks */ + +/** + * @fn static void _smart_cb_contextmenu_new(void *data, Evas_Object *webview, void *arg) + * @brief contextmenu,new callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_contextmenu_new(void *data, Evas_Object *webview, void *arg) +{ + ELM_WEBVIEW_SLOGD("\n"); + Elm_WebView_Editor* editor = (Elm_WebView_Editor *)data; + if (!editor) return; + + editor->contextmenu_data->is_text_selection = !!editor->text_selection_mode; + evas_object_smart_callback_call(webview, "webview,contextmenu,new", (void *)editor->contextmenu_data); +} + +/** + * @fn static void _smart_cb_contextmenu_item_appended(void *data, Evas_Object *webview, void *arg) + * @brief contextmenu,item,appended callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_contextmenu_item_appended(void *data, Evas_Object *webview, void *arg) +{ + ELM_WEBVIEW_SLOGD("\n"); + Elm_WebView_Editor *editor = (Elm_WebView_Editor *)data; + if (!editor) return; + + Ewk_Context_Menu *menu = (Ewk_Context_Menu *)arg; + if (!menu) return; + + /* remove 'Select' and 'Select all' options from context menu when range selection is active (TWO_HANDLES mode) */ + const Eina_List *item_list = ewk_context_menu_item_list_get(menu); + Ewk_Context_Menu_Item *last_item = (Ewk_Context_Menu_Item*) eina_list_data_get(eina_list_last(item_list)); + if (((editor->text_selection_mode & TEXT_SELECTION_TWO_HANDLES) + && (ewk_context_menu_item_action_get(last_item) == EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL + || ewk_context_menu_item_action_get(last_item) == EWK_CONTEXT_MENU_ITEM_TAG_SELECT_WORD))) + ewk_context_menu_item_enabled_set(last_item, EINA_FALSE); + + /* remove 'Go back', 'Go forward', 'stop', 'reload' options from context menu when text selection mode is deactivate(TEXT_SELECTION_MODE_OFF) */ + if ((editor->text_selection_mode == TEXT_SELECTION_MODE_OFF) + && (ewk_context_menu_item_action_get(last_item) == EWK_CONTEXT_MENU_ITEM_TAG_GO_BACK + || ewk_context_menu_item_action_get(last_item) == EWK_CONTEXT_MENU_ITEM_TAG_GO_FORWARD + || ewk_context_menu_item_action_get(last_item) == EWK_CONTEXT_MENU_ITEM_TAG_STOP + || ewk_context_menu_item_action_get(last_item) == EWK_CONTEXT_MENU_ITEM_TAG_RELOAD)) + ewk_context_menu_item_enabled_set(last_item, EINA_FALSE); +} + +/** + * @fn static void _smart_cb_contextmenu_customize(void *data, Evas_Object *webview, void *arg) + * @brief contextmenu,customize callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_contextmenu_customize(void *data, Evas_Object *webview, void *arg) +{ + ELM_WEBVIEW_SLOGD("\n"); +} + +/** + * @fn static void _smart_cb_contextmenu_show(void *data, Evas_Object *webview, void *arg) + * @brief contextmenu,show callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_contextmenu_show(void *data, Evas_Object *webview, void *arg) +{ + ELM_WEBVIEW_SLOGD("\n"); + Elm_WebView_Editor *editor = (Elm_WebView_Editor *)data; + if (!editor) return; + + Ewk_Context_Menu *menu = (Ewk_Context_Menu *)arg; + if (!menu) return; + + editor->contextmenu_data->webkit_context_menu = menu; + _webview_contextmenu_show(editor); +} + +/** + * @fn static void _smart_cb_contextmenu_free(void *data, Evas_Object *webview, void *arg) + * @brief contextmenu,free callback + * + * @param[in] data user data + * @param[in] webview webview + * @param[in] ev event info + */ +static void +_smart_cb_contextmenu_free(void *data, Evas_Object *webview, void *arg) +{ + ELM_WEBVIEW_SLOGD("\n"); + Elm_WebView_Editor* editor = (Elm_WebView_Editor *)data; + if (!editor) return; + _webview_contextmenu_del(editor); +} + +/* context menus handling functions */ + +/** + * @fn static void _webview_contextmenu_show(Elm_Webview_Editor *editor) + * @brief Prepares context menus to be shown by application. + * + * @param[in] editor an editor object. + */ +static void +_webview_contextmenu_show(Elm_WebView_Editor *editor) +{ + ELM_WEBVIEW_SLOGD("\n"); + Evas_Object *webview = editor->webview; + if (!webview) return; + + // set mouse_down_event as a position of front handle, large handle or a caret respectively + editor->contextmenu_data->mouse_down_event = editor->mouse_down; + if (editor->text_selection_mode & TEXT_SELECTION_TWO_HANDLES) + { + editor->contextmenu_data->mouse_down_event.canvas.x = editor->front_handle->handle_pos.x; + editor->contextmenu_data->mouse_down_event.canvas.y = editor->front_handle->handle_pos.y; + } + else if (editor->text_selection_mode & TEXT_SELECTION_LARGE_HANDLE) + { + editor->contextmenu_data->mouse_down_event.canvas.x = editor->large_handle->handle_pos.x; + editor->contextmenu_data->mouse_down_event.canvas.y = editor->large_handle->handle_pos.y; + } + else if ((editor->text_selection_mode & TEXT_SELECTION_INPUT) + && !(editor->contextmenu_data->hit_test_result_context & EWK_HIT_TEST_RESULT_CONTEXT_IMAGE)) + { + int x, y, w, h; + if (ewk_frame_caret_position_get(ewk_view_frame_main_get(webview), &x, &y, &w, &h)) + { + _coords_ewk_to_evas(webview, x, y, &x, &y); + editor->contextmenu_data->mouse_down_event.canvas.x = x; + editor->contextmenu_data->mouse_down_event.canvas.y = y + h; + } + } + ELM_WEBVIEW_SLOGD("pos: x: %d y: %d\n", editor->contextmenu_data->mouse_down_event.canvas.x, editor->contextmenu_data->mouse_down_event.canvas.y); + evas_object_smart_callback_call(webview, "webview,contextmenu,show", (void *) editor->contextmenu_data); +} + +/** + * @fn static void _webview_contextmenu_move(Elm_Webview_Editor *editor) + * @brief Informs application that context menu should be moved. + * + * @param[in] editor an editor object. + */ +static void +_webview_contextmenu_move(Elm_WebView_Editor *editor) +{ + ELM_WEBVIEW_SLOGD("\n"); + Evas_Object *webview = editor->webview; + if (!webview) return; + + Evas_Point new_pos; + // set mouse_down_event as a position of front handle, large handle or a caret respectively otherwise last clicked position + new_pos.x = editor->contextmenu_data->mouse_down_event.canvas.x; + new_pos.y = editor->contextmenu_data->mouse_down_event.canvas.y; + if (editor->text_selection_mode & TEXT_SELECTION_TWO_HANDLES) + { + new_pos.x = editor->front_handle->handle_pos.x; + new_pos.y = editor->front_handle->handle_pos.y; + } + else if ((editor->text_selection_mode & TEXT_SELECTION_INPUT) + &&!(editor->contextmenu_data->hit_test_result_context & EWK_HIT_TEST_RESULT_CONTEXT_IMAGE)) + { + int x, y, w, h; + if (ewk_frame_caret_position_get(ewk_view_frame_main_get(webview), &x, &y, &w, &h)) + { + Eina_Rectangle view; + evas_object_geometry_get(webview, &view.x, &view.y, &view.w, &view.h); + _coords_ewk_to_evas(webview, x, y, &x, &y); + if (x < view.x || x > (view.x + view.w) || y < (view.y - h) || y > (view.y + view.h)) + { + /* if caret position is outside a viewport hide popup and large handle */ + _text_selection_mode_change(editor, TEXT_SELECTION_INPUT); + return; + } + new_pos.x = x; + new_pos.y = y + h; + } + else + { + ELM_WEBVIEW_SLOGD("No two handles, no large handle, no caret, clearing text selection"); + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_OFF); + } + } + ELM_WEBVIEW_SLOGD("pos: x: %d y: %d\n", new_pos.x, new_pos.y); + evas_object_smart_callback_call(webview, "webview,contextmenu,move", (void *) &new_pos); +} + +/** + * @fn static void _webview_contextmenu_hide(Elm_Webview_Editor *editor) + * @brief Informs application that context menu should be hidden. + * + * @param[in] editor an editor object. + */ +static void +_webview_contextmenu_hide(Elm_WebView_Editor *editor) +{ + ELM_WEBVIEW_SLOGD("\n"); + Evas_Object *webview = editor->webview; + if (!webview) return; + evas_object_smart_callback_call(webview, "webview,contextmenu,hide", NULL); +} + +/** + * @fn static void _webview_contextmenu_del(Elm_Webview_Editor *editor) + * @brief Informs application that context menu should be deleted. + * + * @param[in] editor an editor object. + */ +static void +_webview_contextmenu_del(Elm_WebView_Editor *editor) +{ + ELM_WEBVIEW_SLOGD("\n"); + Evas_Object *webview = editor->webview; + if (!webview) return; + evas_object_smart_callback_call(webview, "webview,contextmenu,del", NULL); +} + +/* general text selection handles functions */ + +/** + * @fn static Eina_Bool _text_selection_handle_init(Elm_Webview_Editor *editor, Text_Selection_Handle *handle, const char *edj_file_path, const char *handle_icon_edj_path) + * @brief init text_selection + * + * @param[in] editor an editor object. + * @param[in] handle handle + * @param[in] edj_file_path edj_file_path + * @param[in] handle_icon_edj_path handle_icon_edj_path + */ +static Eina_Bool +_text_selection_handle_init(Elm_WebView_Editor *editor, Text_Selection_Handle *handle, const char *edj_file_path, const char *handle_icon_edj_path) +{ + ELM_WEBVIEW_SLOGD("\n"); + + Evas_Object *webview = editor->webview; + if (!webview) return EINA_FALSE; + if (!handle) return EINA_FALSE; + + handle->handle_icon = edje_object_add(evas_object_evas_get(webview)); + if (!handle->handle_icon) return EINA_FALSE; + if (!edje_object_file_set(handle->handle_icon, edj_file_path, handle_icon_edj_path)) return EINA_FALSE; + edje_object_signal_emit(handle->handle_icon, "elm,action,focus", "elm"); + edje_object_signal_emit(handle->handle_icon, "elm,state,bottom", "elm"); + evas_object_data_set(handle->handle_icon, "editor", editor); + + evas_object_event_callback_add(handle->handle_icon, EVAS_CALLBACK_MOUSE_DOWN, _text_selection_handle_mouse_down, handle); + evas_object_event_callback_add(handle->handle_icon, EVAS_CALLBACK_MOUSE_MOVE, _text_selection_handle_mouse_move, handle); + evas_object_event_callback_add(handle->handle_icon, EVAS_CALLBACK_MOUSE_UP, _text_selection_handle_mouse_up, handle); + + evas_object_smart_member_add(handle->handle_icon, webview); + evas_object_propagate_events_set(handle->handle_icon, EINA_FALSE); + + handle->is_handle_moving = EINA_FALSE; + handle->handle_pos.x = -1; + handle->handle_pos.y = -1; + handle->handle_pos_clicked_diff.x = 0; + handle->handle_pos_clicked_diff.y = 0; + + return EINA_TRUE; +} + +/** + * @fn static void _text_selection_handle_mouse_up(void *data, Evas *e, Evas_Object *o, void *event_info) + * @brief callback of mouse down text selection handle + * + * @param[in] data Text_Selection_Handle object. + * @param[in] e Evas + * @param[in] o handle_icon object + * @param[in] event_info event + */ +static void +_text_selection_handle_mouse_down(void *data, Evas *e, Evas_Object *o, void *event_info) +{ + ELM_WEBVIEW_SLOGD("\n"); + Evas_Event_Mouse_Down* ev = (Evas_Event_Mouse_Down*)event_info; + Text_Selection_Handle* handle = (Text_Selection_Handle*)data; + if (!handle) return; + + int x, y, w, h; + evas_object_geometry_get(o, &x, &y, &w, &h); + handle->is_handle_moving = EINA_TRUE; + handle->handle_pos_clicked_diff.x = ev->canvas.x - x; + handle->handle_pos_clicked_diff.y = ev->canvas.y - y; + + Elm_WebView_Editor* editor = (Elm_WebView_Editor *) evas_object_data_get(o, "editor"); + if (!editor) return; + editor->mouse_down = *ev; + + if (editor->text_selection_mode & TEXT_SELECTION_TWO_HANDLES) + { + if (!editor->magnifier.set_zoom) + { + Eina_Rectangle left_handle; + ewk_frame_selection_handlers_get(ewk_view_frame_focused_get(editor->webview), &left_handle, NULL); + editor->magnifier.zoom = (float)TEXT_SELECTION_MAGNIFIER_LINE_SIZE / (float)left_handle.h; + if (editor->magnifier.zoom < 1.0) + editor->magnifier.zoom = 1.0; + editor->magnifier.set_zoom = EINA_TRUE; + } + if (editor->text_selection_mode & TEXT_SELECTION_INPUT) + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_INPUT_HANDLES_MAGNIFIER); + else + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_HANDLES_MAGNIFIER); + } + else if (editor->text_selection_mode & TEXT_SELECTION_LARGE_HANDLE) + { + _text_selection_large_handle_update_position(editor); + _text_selection_mode_change(editor, TEXT_SELECTION_MOUSE_DOWN); + } +} + +/** + * @fn static void _text_selection_handle_mouse_up(void *data, Evas *e, Evas_Object *o, void *event_info) + * @brief callback of mouse up text selection handle + * + * @param[in] data Text_Selection_Handle object. + * @param[in] e Evas + * @param[in] o handle_icon object + * @param[in] event_info event + */ +static void +_text_selection_handle_mouse_up(void *data, Evas *e, Evas_Object *o, void *event_info) +{ + ELM_WEBVIEW_SLOGD("\n"); + Text_Selection_Handle* handle = (Text_Selection_Handle*)data; + if (!handle) return; + + handle->is_handle_moving = EINA_FALSE; + + Elm_WebView_Editor* editor = (Elm_WebView_Editor *) evas_object_data_get(o, "editor"); + if (!editor) return; + + if (editor->text_selection_mode == TEXT_SELECTION_MODE_HANDLES_MAGNIFIER) + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_HANDLES_POPUP); + else if (editor->text_selection_mode == TEXT_SELECTION_MODE_INPUT_HANDLES_MAGNIFIER) + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_INPUT_HANDLES_POPUP); + else if (editor->text_selection_mode == TEXT_SELECTION_MODE_LARGE_HANDLE_MAGNIFIER) + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_LARGE_HANDLE_POPUP); + else if (editor->text_selection_mode & (TEXT_SELECTION_LARGE_HANDLE | TEXT_SELECTION_MOUSE_DOWN)) + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_INPUT_HANDLES_POPUP); + else + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_OFF); +} + +/** + * @fn static void _text_selection_handle_mouse_move(void *data, Evas *e, Evas_Object *o, void *event_info) + * @brief callback of move text selection handle + * + * @param[in] data Text_Selection_Handle object. + * @param[in] e Evas + * @param[in] o handle_icon object + * @param[in] event_info event + */ +static void +_text_selection_handle_mouse_move(void *data, Evas *e, Evas_Object *o, void *event_info) +{ + ELM_WEBVIEW_SLOGD("\n"); + Text_Selection_Handle* handle = (Text_Selection_Handle*)data; + if (!handle) return; + + Evas_Event_Mouse_Move* ev = (Evas_Event_Mouse_Move*)event_info; + if (!o) return; + + Elm_WebView_Editor* editor = (Elm_WebView_Editor *) evas_object_data_get(o, "editor"); + if (!editor) return; + + Evas_Object *webview = editor->webview; + if (!webview) return; + if (!(editor->text_selection_mode & TEXT_SELECTION_MAGNIFIER) + && !(editor->text_selection_mode & TEXT_SELECTION_MOUSE_DOWN)) return; + + int x, y; + x = ev->cur.canvas.x - handle->handle_pos_clicked_diff.x; + y = ev->cur.canvas.y - handle->handle_pos_clicked_diff.y; + + int diff_x = abs(ev->cur.canvas.x - editor->mouse_down.canvas.x); + int diff_y = abs(ev->cur.canvas.y - editor->mouse_down.canvas.y); + + if (diff_x < TEXT_SELECTION_DRAG_THRESHOLD_X && diff_y < TEXT_SELECTION_DRAG_THRESHOLD_Y) + { + if (diff_y > TEXT_SELECTION_DRAG_THRESHOLD_X) + _magnifier_move(editor, x, y); + return; + } + /* if current text selection mode has _BOTH_ bits LARGE_HANDLE and MOUSE_DOWN set to true (a mouse down was started + * on large handle) then we change the mode to LARGE_HANDLE_MAGNIFIER */ + else if ((editor->text_selection_mode & TEXT_SELECTION_LARGE_HANDLE) && (editor->text_selection_mode & TEXT_SELECTION_MOUSE_DOWN)) + _text_selection_mode_change(editor, TEXT_SELECTION_MODE_LARGE_HANDLE_MAGNIFIER); + + editor->mouse_down.canvas.x = ev->cur.canvas.x; + editor->mouse_down.canvas.y = ev->cur.canvas.y; + + editor->magnifier.pos_x = x; + editor->magnifier.pos_y = y; + if (!editor->webkit_text_selection_job) + editor->webkit_text_selection_job = ecore_job_add(_webkit_text_selection_job, editor); + _magnifier_move(editor, x, y); +} + +/** + * @fn static void _text_selection_large_handle_move(Elm_Webview_Editor *editor) + * @brief move large text selection handle + * + * @param[in] handle Text_Selection_Handle object. + */ +static void +_text_selection_handle_move(Text_Selection_Handle *handle, int x, int y) +{ + ELM_WEBVIEW_SLOGD("\n"); + handle->handle_pos.x = x; + handle->handle_pos.y = y; + evas_object_move(handle->handle_icon, x, y); +} + +/** + * @fn static void _webkit_text_selection_job(void *data) + * @brief job function for setting webkit selection and update coresponding handlers + * + * @param[in] data an editor object. + */ +static void +_webkit_text_selection_job(void *data) +{ + Elm_WebView_Editor* editor = (Elm_WebView_Editor*)data; + Evas_Object* webview = editor->webview; + + int x = editor->magnifier.pos_x; + int y = editor->magnifier.pos_y; + int ewkX, ewkY; + Eina_Rectangle rect; + Eina_Bool will_move = EINA_FALSE; + Text_Selection_Handle* handle = NULL; + + _coords_evas_to_ewk(webview, x, y, &ewkX, &ewkY); + + if (editor->front_handle->is_handle_moving) + { + will_move = ewk_frame_selection_left_set(ewk_view_frame_focused_get(webview), ewkX, ewkY); + if (will_move) + { + ewk_frame_selection_handlers_get(ewk_view_frame_focused_get(editor->webview), &rect, NULL); + rect.y += rect.h; + handle = editor->front_handle; + } + } + else if (editor->back_handle->is_handle_moving) + { + will_move = ewk_frame_selection_right_set(ewk_view_frame_focused_get(webview), ewkX, ewkY); + if (will_move) + { + ewk_frame_selection_handlers_get(ewk_view_frame_focused_get(editor->webview), NULL, &rect); + rect.x += rect.w; + rect.y += rect.h; + handle = editor->back_handle; + } + } + else if (editor->large_handle->is_handle_moving) + { + if (ewk_frame_caret_position_set(ewk_view_frame_focused_get(webview), ewkX, ewkY)) + { + if (_text_selection_large_handle_update_position(editor)) + _magnifier_move(editor, x, y); + } + } + if (will_move) + { + int new_x, new_y; + _coords_ewk_to_evas(webview, rect.x, rect.y, &new_x, &new_y); + if (handle) + _text_selection_handle_move(handle, new_x, new_y); + } + + editor->webkit_text_selection_job = NULL; +} + +/* two handles related functions */ + +/** + * @fn static void _text_selection_handles_show(Elm_Webview_Editor *editor) + * @brief show text selection handle + * + * @param[in] editor an editor object. + */ +static void +_text_selection_handles_show(Elm_WebView_Editor *editor) +{ + ELM_WEBVIEW_SLOGD("\n"); + evas_object_show(editor->front_handle->handle_icon); + evas_object_show(editor->back_handle->handle_icon); +} + +/** + * @fn static void _text_selection_handles_hide(Elm_Webview_Editor *editor) + * @brief hide text selection handle + * + * @param[in] editor an editor object. + */ +static void +_text_selection_handles_hide(Elm_WebView_Editor *editor) +{ + ELM_WEBVIEW_SLOGD("\n"); + evas_object_hide(editor->front_handle->handle_icon); + evas_object_hide(editor->back_handle->handle_icon); +} + +/** + * @fn static void _text_selection_handles_update_position(Elm_Webview_Editor *editor) + * @brief update position of text selection handle + * + * @param[in] editor an editor object. + */ +static Eina_Bool +_text_selection_handles_update_position(Elm_WebView_Editor *editor) +{ + ELM_WEBVIEW_SLOGD("\n"); + if (editor->text_selection_mode != TEXT_SELECTION_MODE_OFF) + { + Eina_Rectangle left_handle, right_handle; + Eina_Bool is_selection = ewk_frame_selection_handlers_get(ewk_view_frame_focused_get(editor->webview), &left_handle, &right_handle); + if (is_selection) + { + left_handle.y += left_handle.h; + right_handle.x += right_handle.w; + right_handle.y += right_handle.h; + _coords_ewk_to_evas(editor->webview, left_handle.x, left_handle.y, &left_handle.x, &left_handle.y); + _coords_ewk_to_evas(editor->webview, right_handle.x, right_handle.y, &right_handle.x, &right_handle.y); + _text_selection_handle_move(editor->front_handle, left_handle.x, left_handle.y); + _text_selection_handle_move(editor->back_handle, right_handle.x, right_handle.y); + _text_selection_handles_show(editor); + editor->mouse_down.canvas.x = left_handle.x + 2; /* FIXME I know it is ugly, but it works - got to think about something better */ + editor->mouse_down.canvas.y = left_handle.y - left_handle.h / 2; + + /* if mouse position is outside a viewport we move it to viewport boundaries */ + Eina_Rectangle view; + evas_object_geometry_get(editor->webview, &view.x, &view.y, &view.w, &view.h); + if (editor->mouse_down.canvas.x < view.x) + editor->mouse_down.canvas.x = view.x; + else if (editor->mouse_down.canvas.x > (view.x + view.w)) + editor->mouse_down.canvas.x = view.x + view.w; + if (editor->mouse_down.canvas.y < view.y) + editor->mouse_down.canvas.y = view.y; + else if (editor->mouse_down.canvas.y > (view.y + view.h)) + editor->mouse_down.canvas.y = view.y + view.h - 1; + return EINA_TRUE; + } + } + return EINA_FALSE; +} + +/* large handle related functions */ + +/** + * @fn static void _text_selection_large_handle_show(Elm_Webview_Editor *editor) + * @brief show large text selection handle + * + * @param[in] editor an editor object. + */ +static void +_text_selection_large_handle_show(Elm_WebView_Editor *editor) +{ + ELM_WEBVIEW_SLOGD("\n"); + evas_object_show(editor->large_handle->handle_icon); +} + +/** + * @fn static void _text_selection_large_handle_update_position(Elm_Webview_Editor *editor) + * @brief update large text selection handle + * + * @param[in] editor an editor object. + */ +static Eina_Bool +_text_selection_large_handle_update_position(Elm_WebView_Editor *editor) +{ + ELM_WEBVIEW_SLOGD("\n"); + Evas_Object *webview = editor->webview; + if (!webview) return EINA_FALSE; + + int x, y, w, h; + Eina_Bool is_caret = ewk_frame_caret_position_get(ewk_view_frame_focused_get(webview), &x, &y, &w, &h); + if (is_caret) + { + _coords_ewk_to_evas(webview, x, y, &x, &y); + editor->mouse_down.canvas.x = x + w / 2; + editor->mouse_down.canvas.y = y + h / 2; + _text_selection_handle_move(editor->large_handle, x + w / 2, y + h); + _text_selection_large_handle_show(editor); + editor->magnifier.zoom = (float)TEXT_SELECTION_MAGNIFIER_LINE_SIZE / (float)h; + if (editor->magnifier.zoom < 1.0) + editor->magnifier.zoom = 1.0; + return EINA_TRUE; + } + return EINA_FALSE; +} + +/** + * @fn static void _text_selection_large_handle_hide(Elm_Webview_Editor *editor) + * @brief hide large text selection handle + * + * @param[in] editor an editor object. + */ +static void +_text_selection_large_handle_hide(Elm_WebView_Editor *editor) +{ + ELM_WEBVIEW_SLOGD("\n"); + evas_object_hide(editor->large_handle->handle_icon); +} + +/* magnifier related functions */ + +/** + * @fn static void _magnifier_content_set(Elm_Webview_Editor *editor, int x, int y) + * @brief set text selection magnifier content + * + * @param[in] editor an editor object. + * @param[in] x x coordinate + * @param[in] y y coordinate + */ +static void +_magnifier_content_set(Elm_WebView_Editor *editor, int x, int y) +{ + ELM_WEBVIEW_SLOGD("\n"); + if (!editor) return; + + Evas_Object *webview = editor->webview; + if (!webview) return; + + Eina_Rectangle rect; + rect.x = x - editor->magnifier.width / 2; + rect.y = y - editor->magnifier.height / 2; + rect.w = editor->magnifier.width; + rect.h = editor->magnifier.height; + + float zoomLevel = 1.0f; + + zoomLevel = ewk_view_zoom_get(webview); + + // get image + cairo_surface_t *cairo_surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, rect.w, rect.h); + cairo_t *cairo_context = cairo_create(cairo_surface); + + _coords_evas_to_ewk(webview, rect.x, rect.y, &rect.x, &rect.y); + + // paint with white color + cairo_set_source_rgba(cairo_context, 1.0f, 1.0f, 1.0f, 1.0f); + cairo_rectangle(cairo_context, 0, 0, rect.w, rect.h); + cairo_fill(cairo_context); + + // paint contents + rect.x = ceil(rect.x / zoomLevel); + rect.y = ceil(rect.y / zoomLevel); + rect.w = ceil(rect.w / zoomLevel); + rect.h = ceil(rect.h / zoomLevel); + + cairo_scale(cairo_context, zoomLevel, zoomLevel); + cairo_scale(cairo_context, editor->magnifier.zoom, editor->magnifier.zoom); + + float offset_modifier = 1.0; + if (editor->magnifier.zoom != 0.0) + { + offset_modifier = 0.5 * (1 - 1 / editor->magnifier.zoom); + } + + cairo_translate(cairo_context, (-1) * rect.x - rect.w * offset_modifier, (-1) * rect.y - rect.h * offset_modifier); + ewk_view_screenshot_contents(webview, cairo_context, &rect); + + cairo_destroy(cairo_context); + + if (editor->magnifier.cairo_content) + cairo_surface_destroy(editor->magnifier.cairo_content); + editor->magnifier.cairo_content = cairo_surface; +} + +/** + * @fn static void _magnifier_show(Elm_Webview_Editor* editor) + * @brief show text selection magnifier + * + * @param[in] editor an editor object. + */ +static void +_magnifier_show(Elm_WebView_Editor* editor) +{ + ELM_WEBVIEW_SLOGD("\n"); + if (!editor) return; + + if (!editor->magnifier.enable) return; + + Evas_Object *webview = editor->webview; + if (!webview) return; + + if (editor->magnifier.evas_image) + { + evas_object_del (editor->magnifier.evas_image); + editor->magnifier.evas_image = NULL; + } + editor->magnifier.evas_image = evas_object_image_add(evas_object_evas_get(webview)); + + evas_object_size_hint_min_set(editor->magnifier.evas_image, editor->magnifier.width, editor->magnifier.height); + evas_object_resize(editor->magnifier.evas_image, editor->magnifier.width, editor->magnifier.height); + + evas_object_image_fill_set(editor->magnifier.evas_image, 0, 0, editor->magnifier.width, editor->magnifier.height); + evas_object_image_filled_set(editor->magnifier.evas_image, EINA_TRUE); + + evas_object_show(editor->magnifier.evas_image); + + //create new context popup for magnifier + if (editor->magnifier.popup) + { + evas_object_del(editor->magnifier.popup); + editor->magnifier.popup = NULL; + } + + editor->magnifier.popup = elm_ctxpopup_add(editor->parent); + elm_object_style_set(editor->magnifier.popup, "pass_event"); + elm_ctxpopup_direction_priority_set(editor->magnifier.popup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UP, + ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UP); + elm_object_content_set(editor->magnifier.popup, editor->magnifier.evas_image); + + if (editor->magnifier_popup_show_job) + ecore_job_del(editor->magnifier_popup_show_job); + editor->magnifier_popup_show_job = ecore_job_add(_magnifier_popup_show_job, editor); +} + +/** + * @fn static void _magnifier_move(Elm_Webview_Editor* editor, int x, int y) + * @brief move text selection magnifier + * + * @param[in] editor an editor object. + * @param[in] x x coordinate + * @param[in] y y coordinate + */ +static void +_magnifier_move(Elm_WebView_Editor* editor, int x, int y) +{ + ELM_WEBVIEW_SLOGD("\n"); + if (!editor) return; + + if (editor->magnifier.cairo_content) + { + cairo_surface_destroy(editor->magnifier.cairo_content); + editor->magnifier.cairo_content = NULL; + } + + // Check the position of magnifier not to move out of webview + if (editor->webview) + { + int view_x, view_y, view_w, view_h; + evas_object_geometry_get(editor->webview, &view_x, &view_y, &view_w, &view_h); + + if (x < view_x) + x = view_x; + else if (x > (view_x + view_w)) + x = view_x + view_w; + + if (y < view_y) + y = view_y; + else if (y > (view_y + view_h)) + y = view_y + view_h; + } + + _magnifier_content_set(editor, x, y); + if (!editor->magnifier.cairo_content) return; + + int width = cairo_image_surface_get_width(editor->magnifier.cairo_content); + int height = cairo_image_surface_get_height(editor->magnifier.cairo_content); + + evas_object_image_size_set(editor->magnifier.evas_image, width, height); + evas_object_image_colorspace_set(editor->magnifier.evas_image, EVAS_COLORSPACE_ARGB8888); + + // copy surface + uint8_t *pixels = (uint8_t *)evas_object_image_data_get(editor->magnifier.evas_image, EINA_TRUE); + cairo_surface_t *surface = cairo_image_surface_create_for_data( + pixels, CAIRO_FORMAT_RGB24, width, height, cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, width)); + cairo_t *cairo = cairo_create(surface); + + // paint with screenshot + cairo_set_source_surface(cairo, editor->magnifier.cairo_content, 0, 0); + cairo_rectangle(cairo, 0, 0, width, height); + cairo_fill(cairo); + cairo_destroy(cairo); + cairo_surface_destroy(surface); + + y = y - TEXT_SELECTION_MAGNIFIER_OFFSET_Y; + + editor->magnifier.pos_x = x; + editor->magnifier.pos_y = y; + if (editor->magnifier_popup_move_job) + ecore_job_del(editor->magnifier_popup_move_job); + editor->magnifier_popup_move_job = ecore_job_add(_magnifier_popup_move_job, editor); +} + +/** + * @fn static void _magnifier_hide(Elm_Webview_Editor* editor) + * @brief hide text selection magnifier + * + * @param[in] editor an editor object. + */ +static void +_magnifier_hide(Elm_WebView_Editor* editor) +{ + if (!editor) return; + if (!editor->magnifier.enable) return; + if (!editor->magnifier.evas_image) return; + if (!editor->magnifier.popup) return; + + if (editor->magnifier_popup_move_job) + ecore_job_del(editor->magnifier_popup_move_job); + if (editor->magnifier_popup_show_job) + ecore_job_del(editor->magnifier_popup_show_job); + + editor->magnifier_popup_move_job = NULL; + editor->magnifier_popup_show_job = NULL; + + if (editor->magnifier.cairo_content) + { + cairo_surface_destroy(editor->magnifier.cairo_content); + editor->magnifier.cairo_content = NULL; + } + + evas_object_del(editor->magnifier.evas_image); + editor->magnifier.evas_image = NULL; + + evas_object_hide(editor->magnifier.popup); + evas_object_smart_callback_call(editor->webview, "magnifier,hidden", NULL); +} + +/** + * @fn static void _magnifier_popup_move_job(void *data) + * @brief job function for moving magnifier popup + * + * @param[in] data an editor object. + */ +static void +_magnifier_popup_move_job(void *data) +{ + Elm_WebView_Editor* editor = (Elm_WebView_Editor*)data; + evas_object_move(editor->magnifier.popup, editor->magnifier.pos_x, editor->magnifier.pos_y); + editor->magnifier_popup_move_job = NULL; +} + +/** + * @fn static void _magnifier_popup_show_job(void *data) + * @brief job function for showing magnifier popup + * + * @param[in] data an editor object. + */ +static void +_magnifier_popup_show_job(void *data) +{ + Elm_WebView_Editor* editor = (Elm_WebView_Editor*)data; + evas_object_show(editor->magnifier.popup); + evas_object_smart_callback_call(editor->webview, "magnifier,shown", NULL); + editor->magnifier_popup_show_job = NULL; +} + +/* copy and paste callbacks */ + +/** + * @fn static void _smart_cb_write_selection(void *data, Evas_Object *webview, void *arg) + * @brief Copies data into a clipboard. + * + * @param[in] data an editor object. + * @param[in] webview a webview object. + * @param[in] arg copied data. + */ +static void +_smart_cb_write_selection(void *data, Evas_Object *webview, void *arg) +{ + Elm_WebView_Editor *editor = (Elm_WebView_Editor *)data; + if (!editor) return; + ELM_WEBVIEW_SLOGD("copied item: %s\n", (const char *) arg); + + elm_cnp_selection_set(ELM_SEL_TYPE_CLIPBOARD, editor->widget, ELM_SEL_FORMAT_HTML, (const char *) arg, strlen((const char *) arg)); +} + +/** + * @fn static void _smart_cb_write_image(void *data, Evas_Object *webview, void *arg) + * @brief Copies an image into a clipboard. + * + * @param[in] data an editor object. + * @param[in] webview a webview object. + * @param[in] arg copied image path. + */ +static void +_smart_cb_write_image(void *data, Evas_Object *webview, void *arg) +{ + Elm_WebView_Editor *editor = (Elm_WebView_Editor *)data; + if (!editor) return; + + elm_cnp_selection_set(ELM_SEL_TYPE_CLIPBOARD, editor->widget, ELM_SEL_FORMAT_MARKUP, (const char *) arg, strlen((const char *) arg)); +} + +/** + * @fn static Eina_Bool _paste_data_cb(void *d, Evas_Object *o, Elm_Selection_Data *data) + * @brief paste data from clipboard + * + * @param[in] d an editor object. + * @param[in] o unused + * @param[in] data paste data + * @return @c EINA_TRUE on success @c EINA_FALSE otherwise. + */ +static Eina_Bool +_paste_data_cb(void *d, Evas_Object *o, Elm_Selection_Data *data) +{ + Eina_Bool result; + + result = _common_paste_data(d, o, data, PASTE_DATA_CB_STR); + + if (!result) + { + ELM_WEBVIEW_SLOGD("_common_paste_data fail\n"); + return EINA_FALSE; + } + else + return EINA_TRUE; +} + +/** + * @fn static Eina_Bool _cbhm_paste_data_cb(void *d, Evas_Object *o, Elm_Selection_Data *data) + * @brief paste data from clipboard helper + * + * @param[in] d an editor object. + * @param[in] o unused + * @param[in] data paste data + * @return @c EINA_TRUE on success @c EINA_FALSE otherwise. + */ +static Eina_Bool +_cbhm_paste_data_cb(void *d, Evas_Object *o, Elm_Selection_Data *data) +{ + Eina_Bool result; + + result = _common_paste_data(d, o, data, CBHM_PASTE_DATA_CB_STR); + + if (!result) + { + ELM_WEBVIEW_SLOGD("_common_paste_data fail\n"); + return EINA_FALSE; + } + else + return EINA_TRUE; +} + +/** + * @fn static Eina_Bool _common_paste_data(void *d, Evas_Object *o, Elm_Selection_Data *data, char *cb_type) + * @brief common paste logic from clipboard and clipboard helper + * + * @param[in] d an editor object. + * @param[in] o unused + * @param[in] data paste data + * @param[in] cb_type callee info + * @return @c EINA_TRUE on success @c EINA_FALSE otherwise. + */ +static Eina_Bool +_common_paste_data(void *d, Evas_Object *o, Elm_Selection_Data *data, char *cb_type) +{ + int original_img_width = 0, original_img_height = 0, resized_img_width = 0, resized_img_height = 0; + float img_resizing_ratio = 0.0; + + int viewport_width = 0, viewport_height = 0, new_viewport_width = 0; + + Evas_Object *image = NULL; + Evas *evas = NULL; + char html_img_tag[HTML_IMG_TAG_LEN] = {0}; + + ELM_WEBVIEW_SLOGD("\n"); + + if (cb_type == NULL) + return EINA_FALSE; + + if (!data || data->len <= 0) + return EINA_FALSE; + + Elm_WebView_Editor* editor = (Elm_WebView_Editor *)d; + if (!editor) + return EINA_FALSE; + + /* FIXME pasting images from clipboard does not work from elementary side */ + /* Elementary returns ELM_SEL_FORMAT_MARKUP same in both text and image */ + + if (data->len >= FILE_PROTOCOL_STR_LEN && !strncmp((const char *)data->data, "file:///", FILE_PROTOCOL_STR_LEN)) + { + /* In case of image */ + /* perceives 'file:///' in page uri as a local html file. Email application is a well known case */ + if (!strncmp(ewk_view_uri_get(editor->webview), "file:///", FILE_PROTOCOL_STR_LEN)) + { + char *local_path = (char*)data->data; + + if (!strncmp(cb_type, PASTE_DATA_CB_STR, PASTE_DATA_CB_LEN)) + local_path += FILE_PROTOCOL_STR_LEN - 1; + else if (!strncmp(cb_type, CBHM_PASTE_DATA_CB_STR, CBHM_PASTE_DATA_CB_LEN)) + local_path += FILE_PROTOCOL_STR_LEN; + + ELM_WEBVIEW_SLOGD("local html [%s]\n", local_path); + + evas = evas_object_evas_get(editor->webview); + if (!evas) + { + ELM_WEBVIEW_SLOGD("evas_object_evas_get fail\n"); + return EINA_FALSE; + } + + image = evas_object_image_add(evas); + if (!image) + { + ELM_WEBVIEW_SLOGD("evas_object_image_add fail\n"); + return EINA_FALSE; + } + + evas_object_image_file_set(image, local_path, NULL); + evas_object_image_size_get(image, &original_img_width, &original_img_height); + if (image) + { + evas_object_del(image); + image = NULL; + } + + if (!ewk_frame_contents_size_get(ewk_view_frame_main_get(editor->webview), &viewport_width, &viewport_height)) + { + ELM_WEBVIEW_SLOGD("ewk_frame_contents_size_get fail\n"); + return EINA_FALSE; + } + + ELM_WEBVIEW_SLOGD("viewport_width[%d] viewport_height[%d]\n", viewport_width, viewport_height); + new_viewport_width = viewport_width * IMAGE_RESIZE_RATIO; + + if (original_img_width > new_viewport_width) + { + img_resizing_ratio = (float)new_viewport_width / (float)original_img_width; + resized_img_width = original_img_width * img_resizing_ratio; + resized_img_height = original_img_height * img_resizing_ratio; + ELM_WEBVIEW_SLOGD("original_img_width[%d] original_img_height[%d] resized_img_width[%d] resized_img_height[%d]\n", original_img_width, original_img_height, resized_img_width, resized_img_height); + snprintf(html_img_tag, HTML_IMG_TAG_LEN, "", local_path, resized_img_width, resized_img_height ); + ELM_WEBVIEW_SLOGD("html_img_tag[%s]\n", html_img_tag); + ewk_view_execute_editor_command(editor->webview, EWK_EDITOR_COMMAND_INSERT_HTML, html_img_tag); + } + else + ewk_view_execute_editor_command(editor->webview, EWK_EDITOR_COMMAND_INSERT_IMAGE, local_path); + } + else + ewk_view_paste_image(editor->webview, (const char *)data->data); + } + else + { + /* In case of text */ + ELM_WEBVIEW_SLOGD("insert html [%s]\n", (const char *)data->data); + ewk_view_execute_editor_command(editor->webview, EWK_EDITOR_COMMAND_INSERT_HTML, (const char *)data->data); + } + + if (!strncmp(cb_type, PASTE_DATA_CB_STR, PASTE_DATA_CB_LEN)) + _text_selection_mode_change(editor, TEXT_SELECTION_INPUT); + else if (!strncmp(cb_type, CBHM_PASTE_DATA_CB_STR, CBHM_PASTE_DATA_CB_LEN)) + ecore_x_selection_secondary_set(elm_win_xwindow_get(editor->widget), "",1); +} + +/** + * @fn static Eina_Bool _elm_webview_selection_clear_cb(void *data, int type, void *event) + * @brief paste data from clipboard helper + * + * @param[in] data an editor object. + * @param[in] type unused + * @param[in] event ecore + * @return @c ECORE_CALLBACK_PASS_ON + */ +static Eina_Bool +_elm_webview_selection_clear_cb(void *data, int type, void *event) +{ + ELM_WEBVIEW_SLOGD("\n"); + Elm_WebView_Editor* editor = (Elm_WebView_Editor *)data; + if (!editor) return ECORE_CALLBACK_PASS_ON; + + Ecore_X_Event_Selection_Clear *ev = event; + if (ev->selection != ECORE_X_SELECTION_SECONDARY) + return ECORE_CALLBACK_PASS_ON; + + if (cnpwidgetdata == editor->widget) + elm_cnp_selection_get(ELM_SEL_TYPE_SECONDARY, (ELM_SEL_FORMAT_HTML | ELM_SEL_FORMAT_IMAGE), editor->widget, editor->cbhm_paste_function, (void*)editor); + + return ECORE_CALLBACK_PASS_ON; +} + +/* general text selection functions */ + +/** + * @fn static Eina_Bool _text_selection_mode_change(Elm_Webview_Editor *editor, Text_Selection_Mode mode) + * @brief change mode of text_selection + * + * @param[in] editor an editor object. + * @param[in] mode a new mode to be set. + */ +static void +_text_selection_mode_change(Elm_WebView_Editor *editor, Text_Selection_Mode mode) +{ + if (!editor) return; + ELM_WEBVIEW_SLOGD("<< mode current: %d, request: %d >>\n", editor->text_selection_mode, mode); + + Evas_Object *webview = editor->webview; + if (!webview) return; + + switch (mode) + { + case TEXT_SELECTION_MODE_OFF: + if (editor->text_selection_mode == TEXT_SELECTION_MODE_OFF) return; + _text_selection_update(editor, TEXT_SELECTION_MODE_OFF); + break; + + case TEXT_SELECTION_MAGNIFIER: + if (!editor->text_selection_mode == TEXT_SELECTION_MODE_OFF) + _text_selection_off(editor); + editor->magnifier.set_zoom = _text_selection_start(editor); + + _text_selection_update(editor, TEXT_SELECTION_MAGNIFIER); + break; + + case TEXT_SELECTION_MODE_HANDLES_MAGNIFIER: + if (editor->text_selection_mode == TEXT_SELECTION_MODE_HANDLES_POPUP) + _text_selection_update(editor, TEXT_SELECTION_MODE_HANDLES_MAGNIFIER); + break; + + case TEXT_SELECTION_MODE_HANDLES_POPUP: + if (editor->text_selection_mode & TEXT_SELECTION_MAGNIFIER) + _text_selection_update(editor, + _text_selection_handles_update_position(editor) ? TEXT_SELECTION_MODE_HANDLES_POPUP : TEXT_SELECTION_MODE_OFF); + break; + + case TEXT_SELECTION_ZOOM_START: + if (editor->text_selection_mode & TEXT_SELECTION_POPUP) + _webview_contextmenu_hide(editor); + + if (editor->text_selection_mode & TEXT_SELECTION_LARGE_HANDLE) + _text_selection_large_handle_hide(editor); + + if (editor->text_selection_mode & TEXT_SELECTION_TWO_HANDLES) + _text_selection_handles_hide(editor); + + editor->magnifier.set_zoom = EINA_FALSE; + editor->text_selection_mode |= TEXT_SELECTION_ZOOM_START; + break; + + case TEXT_SELECTION_ZOOM_END: + if (editor->text_selection_mode & TEXT_SELECTION_ZOOM_START) + { + if (editor->text_selection_mode & TEXT_SELECTION_LARGE_HANDLE) + _text_selection_large_handle_update_position(editor); + + if (editor->text_selection_mode & TEXT_SELECTION_TWO_HANDLES) + _text_selection_handles_update_position(editor); + + if (editor->text_selection_mode & TEXT_SELECTION_POPUP) + _webview_contextmenu_move(editor); + + editor->text_selection_mode &= TEXT_SELECTION_ZOOM_END; + } + break; + + case TEXT_SELECTION_INPUT: + /* if previous mode was pure input field do nothing */ + if (editor->text_selection_mode != TEXT_SELECTION_INPUT) + ewk_frame_selection_range_clear(ewk_view_frame_main_get(webview)); + _text_selection_update(editor, TEXT_SELECTION_INPUT); + break; + + case TEXT_SELECTION_MODE_LARGE_HANDLE_POPUP: + if (editor->text_selection_mode & TEXT_SELECTION_INPUT) + _text_selection_update(editor, + _text_selection_large_handle_update_position(editor) ? TEXT_SELECTION_MODE_LARGE_HANDLE_POPUP : TEXT_SELECTION_MODE_OFF); + break; + + case TEXT_SELECTION_MOUSE_DOWN: + if (editor->text_selection_mode & TEXT_SELECTION_LARGE_HANDLE) + _webview_contextmenu_del(editor); + editor->text_selection_mode |= TEXT_SELECTION_MOUSE_DOWN; + break; + + case TEXT_SELECTION_MODE_LARGE_HANDLE_MAGNIFIER: + /* the condition below means that current text_selection_mode has to have all bits from LARGE_HANDLE_POPUP set to true + while we do not care about the others */ + if ((editor->text_selection_mode & TEXT_SELECTION_MODE_LARGE_HANDLE_POPUP) == TEXT_SELECTION_MODE_LARGE_HANDLE_POPUP + && _text_selection_large_handle_update_position(editor)) + _text_selection_update(editor, TEXT_SELECTION_MODE_LARGE_HANDLE_MAGNIFIER); + break; + + case TEXT_SELECTION_MODE_INPUT_POPUP: + if (editor->text_selection_mode & TEXT_SELECTION_INPUT) + _text_selection_update(editor, TEXT_SELECTION_MODE_INPUT_POPUP); + else + _text_selection_update(editor,TEXT_SELECTION_MODE_OFF); + break; + + case TEXT_SELECTION_MODE_INPUT_HANDLES_POPUP: + /* if we have a large handle and it is clicked we start a text selection similar as during long press on a text, + * otherwise we are just trying to update text selection handles' position*/ + if ((editor->text_selection_mode & TEXT_SELECTION_LARGE_HANDLE) && (editor->text_selection_mode & TEXT_SELECTION_MOUSE_DOWN)) + _text_selection_update(editor, + _text_selection_start(editor) ? TEXT_SELECTION_MODE_INPUT_HANDLES_POPUP : TEXT_SELECTION_INPUT); + else + _text_selection_update(editor, + _text_selection_handles_update_position(editor) ? TEXT_SELECTION_MODE_INPUT_HANDLES_POPUP : TEXT_SELECTION_INPUT); + break; + + case TEXT_SELECTION_MODE_INPUT_HANDLES_MAGNIFIER: + if (editor->text_selection_mode == TEXT_SELECTION_MODE_INPUT_HANDLES_POPUP) + _text_selection_update(editor, TEXT_SELECTION_MODE_INPUT_HANDLES_MAGNIFIER); + break; + + case TEXT_SELECTION_PAN_START: + if (editor->text_selection_mode & TEXT_SELECTION_POPUP) + _webview_contextmenu_hide(editor); + editor->text_selection_mode |= TEXT_SELECTION_PAN_START; + break; + + case TEXT_SELECTION_PAN_END: + if (editor->text_selection_mode & TEXT_SELECTION_PAN_START) + { + if (editor->text_selection_mode & TEXT_SELECTION_POPUP) + _webview_contextmenu_move(editor); + editor->text_selection_mode &= TEXT_SELECTION_PAN_END; + } + break; + + default: + ELM_WEBVIEW_SLOGW("Unknown Text_Selection_Mode: %d\n", mode); + break; + } + + // Clear Context menu and Hide Magnifier and Selection handles + if (editor->text_selection_mode == TEXT_SELECTION_MODE_OFF) + _text_selection_off(editor); + + ELM_WEBVIEW_SLOGD("<< mode set: %d >>\n", editor->text_selection_mode); +} + +/** + * @fn static Eina_Bool _text_selection_mode_change(Elm_Webview_Editor *editor, Text_Selection_Mode mode) + * @brief update text selection apperance due mode changes + * + * @param[in] editor an editor object. + */ +static void +_text_selection_update(Elm_WebView_Editor *editor, Text_Selection_Mode new_mode) +{ + ELM_WEBVIEW_SLOGD("new text selection mode %d\n", new_mode); + if (!editor) return; + + Text_Selection_Mode old_mode = editor->text_selection_mode; + editor->text_selection_mode = new_mode; + + if ((old_mode & TEXT_SELECTION_MAGNIFIER) != (new_mode & TEXT_SELECTION_MAGNIFIER)) + { + if (new_mode & TEXT_SELECTION_MAGNIFIER) + { + _magnifier_show(editor); + _magnifier_move(editor, editor->mouse_down.canvas.x, editor->mouse_down.canvas.y); + } + else + _magnifier_hide(editor); + } + /* in case of popup we send forward event always if new mode is TEXT_SELECTION_POPUP as sometimes popup values may change */ + if (new_mode & TEXT_SELECTION_POPUP) + { + editor->contextmenu_data->is_text_selection = !!editor->text_selection_mode; + ewk_view_context_menu_forward_event(editor->webview, &editor->mouse_down); + } + /* we hide context popup if new mode is not TEXT_SELECTION_POPUP and popup was present in an old one */ + else if (old_mode & TEXT_SELECTION_POPUP) + _webview_contextmenu_del(editor); + if ((old_mode & TEXT_SELECTION_TWO_HANDLES) != (new_mode & TEXT_SELECTION_TWO_HANDLES)) + { + if (new_mode & TEXT_SELECTION_TWO_HANDLES) + _text_selection_handles_show(editor); + else + _text_selection_handles_hide(editor); + } + if ((old_mode & TEXT_SELECTION_LARGE_HANDLE) != (new_mode & TEXT_SELECTION_LARGE_HANDLE)) + { + if (new_mode & TEXT_SELECTION_LARGE_HANDLE) + _text_selection_large_handle_show(editor); + else + _text_selection_large_handle_hide(editor); + } + + if (new_mode == TEXT_SELECTION_MODE_OFF) + ewk_view_execute_editor_command(editor->webview, EWK_EDITOR_COMMAND_SELECT_NONE, NULL); +} +/** + * @fn static Eina_Bool _text_selection_start(Elm_Webview_Editor *editor) + * @brief tries to closest word and starts text selection + * + * @param[in] editor an editor object. + */ +static Eina_Bool +_text_selection_start(Elm_WebView_Editor *editor) +{ + ELM_WEBVIEW_SLOGD("\n"); + if (!editor) return EINA_FALSE; + + Evas_Object *webview = editor->webview; + Evas_Coord_Point point = editor->mouse_down.canvas; + + Eina_Bool is_caret = EINA_FALSE; + int caret_x, caret_y, caret_w, caret_h; + int x, y; + _coords_evas_to_ewk(webview, point.x, point.y, &x, &y); + + Eina_Rectangle left_handle, right_handle; + + /* remember caret postion because if ewk_frame_select_closest clears selection, + * so if it fails we loose caret, maybe select_closest word should be improved */ + if (editor->text_selection_mode & TEXT_SELECTION_INPUT) + is_caret = ewk_frame_caret_position_get(ewk_view_frame_main_get(webview), &caret_x, &caret_y, &caret_w, &caret_h); + + Eina_Bool ret = ewk_frame_select_closest_word(ewk_view_frame_focused_get(webview), x, y, &left_handle, &right_handle); + if (ret) + { + editor->magnifier.zoom = (float)TEXT_SELECTION_MAGNIFIER_LINE_SIZE / (float)left_handle.h; + if (editor->magnifier.zoom < 1.0) + editor->magnifier.zoom = 1.0; + editor->magnifier.set_zoom = EINA_TRUE; + + left_handle.y += left_handle.h; + right_handle.x += right_handle.w; + right_handle.y += right_handle.h; + _coords_ewk_to_evas(editor->webview, left_handle.x, left_handle.y, &left_handle.x, &left_handle.y); + _coords_ewk_to_evas(editor->webview, right_handle.x, right_handle.y, &right_handle.x, &right_handle.y); + _text_selection_handle_move(editor->front_handle, left_handle.x, left_handle.y); + _text_selection_handle_move(editor->back_handle, right_handle.x, right_handle.y); + return EINA_TRUE; + } + else + { + if (is_caret) + ewk_frame_caret_position_set(ewk_view_frame_main_get(webview), caret_x, caret_y); + return EINA_FALSE; + } +} + +/** + * @fn static void _text_selection_off(Elm_Webview_Editor* editor) + * @brief turns off text selection + * + * @param[in] editor an editor object. + */ +static void +_text_selection_off(Elm_WebView_Editor* editor) +{ + ELM_WEBVIEW_SLOGD("\n"); + if (!editor) return; + + _webview_contextmenu_del(editor); + + if (editor->magnifier.popup) + { + evas_object_del(editor->magnifier.popup); + editor->magnifier.popup = NULL; + } + + _text_selection_handles_hide(editor); + _text_selection_large_handle_hide(editor); + ewk_view_execute_editor_command(editor->webview, EWK_EDITOR_COMMAND_SELECT_NONE, NULL); + + _magnifier_hide(editor); +} + + +/* coord related functions */ +/** + * @fn static void _coords_evas_to_ewk(Evas_Object *obj, int x, int y, int *ux, int *uy) + * @brief change coordination from evas coordination to ewk coordination + * + * @param[in] obj els-webview + * @param[in] x x of ewk coordination + * @param[in] y y of ewk coordination + * @param[in] ux x of evas coordination + * @param[in] uy y of evas coordination + */ +static void +_coords_evas_to_ewk(Evas_Object *obj, int x, int y, int *ux, int *uy) +{ + int scrollX, scrollY, viewX, viewY; + ewk_frame_scroll_pos_get(ewk_view_frame_main_get(obj), &scrollX, &scrollY); + evas_object_geometry_get(obj, &viewX, &viewY, NULL, NULL); + *ux = x + scrollX - viewX; + *uy = y + scrollY - viewY; +} + +/** + * @fn static void _coords_ewk_to_evas(Evas_Object *obj, int x, int y, int *ux, int *uy) + * @brief change coordination from ewk coordination to evas coordination + * + * @param[in] obj els-webview + * @param[in] x x of ewk coordination + * @param[in] y y of ewk coordination + * @param[in] ux x of evas coordination + * @param[in] uy y of evas coordination + */ +static void +_coords_ewk_to_evas(Evas_Object *obj, int x, int y, int *ux, int *uy) +{ + int scrollX, scrollY, viewX, viewY; + ewk_frame_scroll_pos_get(ewk_view_frame_main_get(obj), &scrollX, &scrollY); + evas_object_geometry_get(obj, &viewX, &viewY, NULL, NULL); + *ux = x - scrollX + viewX; + *uy = y - scrollY + viewY; +} diff --git a/els_webview_editor.h b/els_webview_editor.h new file mode 100755 index 0000000..f45cdfa --- /dev/null +++ b/els_webview_editor.h @@ -0,0 +1,71 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Michał Pakuła vel Rutka , Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef els_webview_editor_h +#define els_webview_editor_h + +#include +#include + +typedef enum _Text_Selection_Mode +{ + TEXT_SELECTION_MODE_OFF = 0, + TEXT_SELECTION_INPUT = 1 << 1, // 2 + TEXT_SELECTION_MAGNIFIER = 1 << 2, // 4 + TEXT_SELECTION_POPUP = 1 << 3, // 8 + TEXT_SELECTION_TWO_HANDLES = 1 << 4, // 16 + TEXT_SELECTION_LARGE_HANDLE = 1 << 5, // 32 + TEXT_SELECTION_MOUSE_DOWN = 1 << 6, // 64 + TEXT_SELECTION_ZOOM_START = 1 << 7, // 128 + TEXT_SELECTION_ZOOM_END = ~TEXT_SELECTION_ZOOM_START, //-129 + TEXT_SELECTION_PAN_START = 1 << 8, // 256 + TEXT_SELECTION_PAN_END = ~TEXT_SELECTION_PAN_START, //-257 + TEXT_SELECTION_MODE_HANDLES_MAGNIFIER = TEXT_SELECTION_MAGNIFIER | TEXT_SELECTION_TWO_HANDLES, // 20 + TEXT_SELECTION_MODE_HANDLES_POPUP = TEXT_SELECTION_TWO_HANDLES | TEXT_SELECTION_POPUP, // 24 + TEXT_SELECTION_MODE_INPUT_POPUP = TEXT_SELECTION_INPUT | TEXT_SELECTION_POPUP, // 10 + TEXT_SELECTION_MODE_INPUT_HANDLES_MAGNIFIER = TEXT_SELECTION_INPUT | TEXT_SELECTION_MAGNIFIER | TEXT_SELECTION_TWO_HANDLES, // 22 + TEXT_SELECTION_MODE_INPUT_HANDLES_POPUP = TEXT_SELECTION_INPUT | TEXT_SELECTION_POPUP | TEXT_SELECTION_TWO_HANDLES, // 26 + TEXT_SELECTION_MODE_LARGE_HANDLE_MAGNIFIER = TEXT_SELECTION_INPUT | TEXT_SELECTION_MAGNIFIER | TEXT_SELECTION_LARGE_HANDLE, // 38 + TEXT_SELECTION_MODE_LARGE_HANDLE_POPUP = TEXT_SELECTION_INPUT | TEXT_SELECTION_POPUP | TEXT_SELECTION_LARGE_HANDLE, // 42 + +} Text_Selection_Mode; + +typedef struct _Elm_WebView_Editor Elm_WebView_Editor; + +Elm_WebView_Editor* els_webview_editor_init(Evas_Object* webview); +void els_webview_editor_destroy(Elm_WebView_Editor* editor); +void els_webview_editor_selection_update_position(Elm_WebView_Editor* editor, Evas_Point* diff); +void els_webview_editor_selection_mode_change(Elm_WebView_Editor* editor, Text_Selection_Mode mode); +Text_Selection_Mode els_webview_editor_selection_mode_get(Elm_WebView_Editor* editor); +void els_webview_editor_enable_default_context_menu_set(Elm_WebView_Editor* editor, Eina_Bool enable); +Eina_Bool els_webview_editor_enable_default_context_menu_get(Elm_WebView_Editor* editor); +void els_webview_editor_context_menu_item_selected(Elm_WebView_Editor* editor, Ewk_Context_Menu_Item* webkit_context_menu_item); +void els_webview_editor_cbhm_run(Elm_WebView_Editor* editor); +void els_webview_editor_view_geometry_changed(Elm_WebView_Editor* editor, int x, int y, int w, int h); +void els_webview_editor_webview_parent_set(Elm_WebView_Editor* editor, Evas_Object* parent); +void els_webview_editor_webview_widget_set(Elm_WebView_Editor* editor, Evas_Object* widget); +void els_webview_editor_mouse_down_set(Elm_WebView_Editor* editor, Evas_Event_Mouse_Down ev); +void els_webview_editor_hit_test_context_set(Elm_WebView_Editor* editor, Ewk_Hit_Test_Result_Context context); +Ewk_Hit_Test_Result_Context els_webview_editor_hit_test_context_get(Elm_WebView_Editor* editor); +Eina_Bool els_webview_editor_show_magnifier_get(Elm_WebView_Editor* editor); +void els_webview_editor_show_magnifier_set(Elm_WebView_Editor* editor, Eina_Bool enable); + +#endif /*#ifndef els_webview_editor_h */ diff --git a/image/ElementaryWebView_image01.png b/image/ElementaryWebView_image01.png new file mode 100644 index 0000000000000000000000000000000000000000..2efbbde4fc61e7436b9b53c825db9bc8a65c8eae GIT binary patch literal 14843 zcmZ{L1y~%xvhD&25(pY>vEUBD-QC?SL4&({0>RzgZE<%C4hin=?h+i{F$~7>h7w)>aPh=l$Ut_4*U)T0=<`#6jcU+pmKmu7d$j@Ccse80{DS)RF)71 zRgB^v00jg)Ni9bZ2odA&2MUy$jsu*8bCQx1gIh#|hG(U1rRVShPT@Lr&Ir?&81({LBdA+)e zHA^~P?QCspTSneVKe-)ws0r)0E?%>{y*>5Wy)dIvrmhNpH5;St^ekv?T%!1An^Yg> zPkZCOg`Hl+&r{QiJ{soNjE0m zJdyt%vDWv>7yY2E)zDc+Qhp3Wqll||PW;=$m%~SNTkI^#_>a|QXj+%13xnnZ2j{Hg zsmX+pC4S@}fm6$-?Z+&}|jCyR$vfK(7UiRDwf^ z%>}mV7AQdi@3d-QMGSPa3CyOluD}NzbSUUI_3FzPApN66*VH8ef*RJlt3jSx2X`SxY<&XfWt3c+UrUiK4- zIoC9uY}-+0ED7gu{Jb*=L0y52!l3h=^S7WtN5qZNPS-%Vii)V7ji{b(ImGu<*Jm`b zCJdK{6m(ZTOQGN~nV_<-C6&IiL*-_H)fn5hUS<3;ZKP|Ktxq7VmpaASn*BqTiYdD1 znE+%pPB5>9oVDe9r7gN5?@Y{?m83O;dCV71{1neI z8~-`fx%YZENfE~R>rn_Q>cf5&k==8dHhQbrRaijGxu{MLfuE#f3=h>)aGuRh?_g0-bqY#Qz>hvXRSs(XSXILeZ>@=FbvF?2D*63x|BP83 z6JD`RZ0W%T!;t55O}$N$!5#z~db&wAicWMR$dpg8+;S70B3r&1v^?9>R#$wwd&_#Dz<`hfxa89KR+!2-8wGwK5Q;!r9_fcq@cf+#s=PkiaU|cCP9HiNo}uQru#-rZBH6 zrz9sDY{qngv70Pz7`q#pV2KU2$N09B*Zz)ISD>`wB?a-^;Nj<-`x`eeIW~}Lqtu_# zP)Q?|>Mdo+%GBu3<_UFK1Mdlj&QDmzJPfp8_e8nQ-Rp))xe4Wf}jAk{i*9&N&_w@~SybM=cHj$xZsj5G> z5@6Kvp+Iv}OtRNJV14w_V;W)~yUWwU&!d=jOQgf;MsZHy-dJ2iJ`` z#C`m?xv_Ohsq)2CASC5#{tMl3?%FrwJa_Om^%k(gmXpal!PYa=w_+T9x&6`1N;cGw z)2Egay5$$Mz9ppfp;0BjV1sjTyY2^vg$4E8tG=E{_kEA!1xo;eaa5@~3lWYno!c5R z{rFh?RpoSaX0d~vmgP)~c=i-WE$gD+suY~Jdvf?t&Ni@xqeJ~z8eQ#CbLgXGQ1@S& za+*^Zp6%aSWkh)LLsnvr4MI-8oD}~t&Pf!ip?3r#!6HN8ccrWvX-t)1H9TBnHlClW z=)w^!8NC^I8UpJMwhpN@#--NZ%Yc(I)SFCa19Pmw17b6SmY+h^@Gwp0K5Nurm*I+r zg~nRoY|l~+S{N&fUj#(3^v~_18X81gwNFurWyfdw3wV(X>&^5+0(~`N)R{MrnH@qg z#HHle2d%^1e)i+WWg<`p%qwhpWk~pmonq5`6o5Ii^`aC;-BxT-hL@$*w$0U>fX%ay zSMB-O2rHz1Bh?p5iJ!tmZ8#SAWwamNP$B}uRzCXs{_yFSBK_j&fAr#lbzRm|>J5(N zPWjkqzlk7WEQ?d*rG`V?FwIFVYVu*~uEmcI$w3C5jX@^*+pu({XzYu&o)SY5^8!uK zNy27p-x_A1QoQQg_P6E!FiKhYoPLBacfgJxE=4!)9Z|VP+<9sZW$nnvPvDrSkPOew z$Ld3N0Hiqck$TJR=U>Ye?`qKEgLUDOlzSg@#_rk@<00u=sJ_cHEkFNz=cXsZ8W^xb>-pH>Qmr=rd4W=uoFwv4ciTQVkroYR{_EU{<3a-V8o#EXkgfou7+~%XCy9xVy`fX^{Ic*GgYP$)nti zcS?E3q@JbJ>KSYFMir&0X@58_ht2Y5uKBj6vK6G`@xf-7|IPgW9bd>8JsmXt>mS=! zmxpWfoufzsp5CCx(^lJq$pSi}v=2%3Y5prhJGoxAC(0ynb7%@tOsJye6fET{^Ji03H0H!Xv)eq3WOgT3(L* z4i~k%vy(#Zi0kEBKek6pegD$^{goUa_VsQ+!1C$di;DXGG)KfX=(kY+aZ?gyF2r!@%h@O0YTY+P?&bGy(C)lziY?pjw?u$fQm zOilHjxB83NZ3*-K)|ig=p02!Jj2Q4IUZfifZaq9c!oju9l|Ob`!3Ah0?~KHxc{bP9 zPPu?xkCR<*4qty`2?pv*x?w~@)Y~HaI?WRXY-7iJb^MKmuCX)a5fn9 z9yUIvUxr*ZS|F?K6?iduBw~J0^y0*444LH@`l;+? z@Hxl`huM;?Wxe|?$ImZsRzQA;{Y9#kP#^_L&>c5aQL4}Wna&}TX4P2MJhXnxkV{I8VD^3(*N3_`9FV;lMuV8mstghgPUO9N(s ztL8u{eAVE3`L3wX@IlXZmd;XvfbMUY=+J}Of_;0GJKsY7ET zr%XU}iP0h#91|fC-`+=lT7y>BE#1SpeSv#WU%tbLBfRvtiz`%r2jZB>sS=ji%`q-X zmG@G{A-+#r>EFqB@%;|jGq9Rk#uK$|%TW;nGt0zs`fI*p&?3eSe{V$`{srMFeuy=6 z8$Am;BL5)2KN~xUPHY@%{87BHXCt`96vyt|@pvr2xV)D$dLgObYk;oLuj;xd^K#E4 z=wV?)QZ5zuMHYU@fd|HH5>ZupB{D}Jt9sID=ulj!*whp17WKvgZL?gJYe6{8tf6+WGg zK?;fG=0N)m*5YE72ix$7l78f}?onMrCLt11*HK?y)aFi-7P1Q?T-Xe@kue3W-9Y5V zy3nt5^BwW4%`hCIfzuT_xWwRsomo3w4ps8rCh2rIQIBDrT{lPUhm8ct zIEg4D-I+VlCpUduK|@Iy^h@tXx?OezBWgP;rT^Q8{mTLDjl4VDu-kvp7NNrgBsW`7 z9n35dLE5X`)RGUE(4q?(zXOK>@(ji-(a-a#z^*7o!9?by`DoRuSlVBmz%lGo>EBbz z*OAM{d=dQp=zv*e3to!0d zZ1H#3%L)&z6zwB4bi8M`-$kPWl5na=>1!wD)g0&+_~zxox_w~2FbQQrVtsU4nb3T6 zn`;>PI*#I2UfOLvY$SH+D->eYX&HnDT1UhmcnEBf`GnP=+|0LM1fA1-`lmv&kC()c z4-Z9%6;}%J&K#X{%C+~RvDkhdh#QC;N07bik76-MkkwdbHQ-ZsV-?7kLbDK4B3&15 zqSqPm&+qKO5r|9<88j&-Ru$!}y~LWyy6oCelt_Zlsg(Y8=poK1!sp-dG2O3IDYdPX z@f(pHTm*I)8ej$s**2j zh@!XV22{FTt5cZ9$v9a}Y5g<{Qb+=;Ji;)z-A7I9V0fql0o4+hMzIqbw0!c_4NAVN zRyfs{Djl)w_zJSP-mZIypYvlD<#+td*mjsZUlEJADlBMG0`Z=%Md?5+Nuifnb?3si zNQYZct8KABfWKZW1L9!EL%QVk?h5xF-zV1h$Jn-lZK7zklbH7|%e|@bhHzIDMrtIL z6SNPduDr|4MX?P_CKBdSU)KB*mN;iwMLwg|c*GR-K$<-XNkEU!itQ>=&a7}x%2*G1 zXHK7`kjmUUFo*B^^sWtz!$gdr4c)N&>H+Hbu?Yt2ryj5Ia=#l~cae!0?Rx5QjbV64 zL^Xf)I?f>qG$tAnemw5o>fAeV&e0!;MMh#s6?2VsgB$Dyvc4+KXd(jFZ#h6^#e#t_ z5k8zNRmZB$Z@tu9QEkk&Aq?hu{Y(>!=do7>9M>(eT)*C~v}kDj8V^~VCSmxnrUAV* zP%xko!SIJHEnq|0tQ?zBIhbGe;&e+i8{>csseQpDeor!OI^^>*9>M_5SO`vFayp}e z0b6^SZfQ&DPbIw+QBB5IVLcO+0kDf+DXz%H`Zt}aHU`P(^4U%d0f@Z8bl`U3@j<>G zn>XvVlz=Bw47#sjZ?;sh^F(N4Y0MA!qItLbx(QUF?Vkt1GJ|qdLQVOohhXQ}ZT)1c zCFJ^_N^d$bx<4(;-{FyuFu5UscCjZk*oXpY)m+s$Aw!}JPMsg+`?V=Sy6^g3$rsPMT_BqA-Cd=7-Yeqk&qRCn~5 zKrEQB>Vo5Nc|JZZMRyB~(&rnW#M(M5J1^#kJ~~(IQ_pX8eR**AzHk+r!|>CmwGt_p z*4@n?-2s&L63D-GP4Da{TUdPus-3+2xIrzmt1mO%?KdtKH zgDfQ^e=zB8g>I`C^z({$c1+t{SoFH-J_VLltIwz68?<|T@9;1ewR)c?Goe8~wG|dp zoq#D0`GPv#$hKf4T%P&`oL!CFBlXqa26Z@! z@Qsssc|AaI1Hfh(X34r}%yTBorOxJo)U!-X&_=yeP5UaWI=bSQ17?fG_V`hx7+r1= zmbuv-Lxdvm16z`?!L|KtDQYFvktw|olVn&m+R1m8IV?@esbBm{>=zWu*eZs~q$8YV z!*2>Ma$oxO1}(I4q*K8XzvPzxRTX~mFnQ>9rW#QjJ+sZ3p~NH{o;f6=%}Lp$%zfw< zE6ut0c}a7R4vuZT6+c*!qm?8mR^GI^Qb>~{iCSG1lojpuiv0X7hLC)-6?CKx3<&3JN50Yt&eddRfPR zRJ&AfqX))D;>L22WN^|J#Buqg_CN#1zZ&I2L}~zGsFd_n`T&4vyH#DY{lr*1@<-$Z zkqCNI8(npKOnGYPTRvLIf9T+3rZp&N!(9N()mZK11Zhx$Xc)+P8u#V6L_Ya-8-sBek_;=Gii&lwNHoVafKHxdFZ^r%fSNgPbJuOXD594QWul=N-nRMw8f6i~eQ zf29vORC#h~mUJ+`v{}IFr>JOaqr%JX_6fkDXg3HYB^nMOC&G+$TiiH5bDNGnh5Z7; z2rw?o7z$;&?JcDZiS&TCFtrvHfhRMX-kjdeYy6ql=H`$xiXg4~kh1p@pC_@^yJ^`CCv(fYRBf)!Nx?eM;#TBE7Zz{G;olbO3chyh`d0W2poNR4b!3Jn18oW5{ zzB~sxu(We>vVb*|m6cVlN+a-IX_ugg6SrqH9A#vPDj|?zH+kj;ew&fRB(qU3kBiL| zFNPpgS|;w$!^0F(QcIUJpDCn!dt;XaXm}b#pJ$JGS>yRgQkTy|vE)k) z)}^^Q^2|_M18Dyry5a9E|0{?l`>ndVI>nwO2_shChDnG}++XN3D$d)NH|OmRvr|po zDJ&eIX1aGrv2Y(?ngzK&;U&vOzHBPuo0#Jji@$Rh@w!eno*S+kt|pwS z(t5CPasAH?J5CyH5vi=rQddrVkkuyj!DpuEe(1>kDjcBsWWimV}dG?d7XP+h)vqQNOcBoM!qF3fc##e&=I;X?NS zniVhyJRPhDYr~SwI&)WJX{<4oZu2YxXtbUdQ7#4d%VNQ*aUIf*Acx%ts+dOIw~3&P z+3_aA&()?)_K0?Gzvgdw`l=ytFx`aCH3wrCg1Y(G7A2#v`<`p!b<^)Kl<8cc$IFn(0Su$xrqIzVnv8#&Q3{~6;TSx8j$7-*rl zHO>|lFmT6B9%z|#SXZ?{u2H89d6WVh%QN`}*o2z~_P6I~Q8-WqGFVJ_Q37mHb{nyq z)E}YgMEVB$be z7Uh=Lr4+gW*vF-=l199ln5?_-DPZz0pNPPCtSGiX@NKA-^)8f-a=M(L$$hT|Lo0;V6#YLGF7>m7e}ep+bOcto3Ek z%d|q(50$PIAUgHw=f=VYD+xGm>OeG~l*Zc0*}So2tw*SFYNnvVbh0uewj2 zrvAQqFi!X!PD|O0wH`ymU^1OS$J6#uoIUd0`garv1fr=(mb)=Xg#X@ue-zj(2W6Z!436>ypaC9t%Kyp`R{Qdpg zfPgDYXAYVZDZ!SO>He*G(+)1gnawTQqR1;wH44w})vV33ezr97=9m_J%)Vxdb zy-%`ITNr$Ke#BTq##divAYX>DO)IAqM@`*M}VsMqr0UEq%(K&_qgoVCTZ zFsYYX0&VBNqwwF&`99C->VJlUg@t|DF?iVl0^=VHUSG~$Uj_tTm?+ig`etx`7WAUVz zY|4{};y>?#v0_rsEi3!AcNH>B&&X)zubFUpc}Xe}sknuH9whLTQx)BPP2cx?yT-_R z`nUgz>y^2{h_a@p+sl)?g)TJz^R4o-u%uF|e?%L=sB( z(%9tbS@jYU$}(E1O;vJeknZv$V)?I|V?|fOwcNQ9Mw38K``nk^de=2B!jmGxHFTz9 zaRBwad|g4n=>*`65mM0;Ejs zFc4*Me_58?`T;g>-t8&R^{VotVaJzl$Ih^HX3j^YpQXzeSA3O`bPEnoo2v%LEu`jJ z%zsq2y1C$lc_KwWQfPRt9w?`9xf+)R;&W_iA!f;A@*^^+MN!$LBa4N1l$puR_&0 zZ>N8i_Ft+vyGuGaUy4RiPIDR($6##cW}!!$>fYcH%}+lcLNp^czU}E_*1`sB66dy0 zj~T?n?)sov{~G$SYW%D!jBb>B>%fH{d3tK2K6I_9rZzJ*WmGsO;O_HfVl@n3e?&cz zPK()u$-i%HM66I^G5-}gXow$MjBim;^4)qHWCh7pLX8tCD6gosb=Ww|yeG~{kY`l? z+Q}7Bh-t%2cyhAb5#ZdIojC~s()3yl;lBg&OmY2~n3&!deb@l!T@xwrdOrqmnA1&f z02B8^n3x?KIH^eGG^ghZ_;=^$Jt)2p2Srv40mcMbfQAC}m~4bh7t0v$)r^LLUW-!* z{f}rmLno)}zsiEPvJIfoe*xOC)@+P0au_X^{%OzmWv@c76&as1IxWp|6hC#J3r+}d za|E7x1b6}C6^2EhD&Wh%gi5?i_Timghu8glwbARf!Yi2}ZT`1ufjz%-)f56`Qv6I0 zZkoSt44KA9YHWq_!lh5-5kT4abB6WDv>jb#5z5VCzYX89!|F68`Uk>?y zPr&*wzxV%N%S1+cCer40f4TPbd+li*PT=!>9K22INrMET`}VICmZ8pwxxFjvrG}Fj z3Bu-+h9yluTw+Sfy__Jz#Tt{59Fd?GfP`Fpeulunz*x>zSX)`q(bGS#-gXT95vp5m zvfqkR;9qF8T?531-r?Qe*}1mk;C+-$iH2QxGJksm-91J4KW zw+|eh_rEh-SBKD9)EH-$m!C9zZ#1l}t(%*hU8b8-Sj;j3j`x{9M8V$PKD}Sdz~Ib| z)93lfpf>xLl!U~<0Fm$0s^^)B?iP>~c3vd#90Dy-D6F6`R+Qx(PBR6SlPd~)III!EUwgG5jVnPWBc3@=J*4F0d8_$+$(Y=dfG3pNw zBJ#N_Z(PmoH%VVD?*oqd6H>ZRy6n!**NWCtLoVaDz}n$<+(lxu30+ietJhdzoz%yx zr^iI6D8ftNOtE3{T_bRklHmmti z@{_XRH+^z?Z$#Z(#VxepZ-3$x7&fc6l&#(0X~3}Q;0#eBN+AqWVC(jxc0nyUIb789 zoABZ##o9XN#e?vg{^^Vwp2bH~89{hm#{vrhcGu}0JdbLN(3;(^4G z*W>icMWsBz%Hamz5i0(1A>v&E=&XpZ^z79Wo-G>eCy+~%W|3@@ zlyl5LxdPg^WmQACOq!AYAJ02N!R53~o z1Kr`>;n!dKfu*8{KjL(#whCxP(_va}dM;~^Z-VV4-(ff@)#F%0VS@={P9ikJF_Vr% znpXV}G4zc$K@OQeqQZa0?l$KbooJ0cuV9>g2!jkt`Q*>jHD@RMo|H!0DcdxxP8Pk9 zbABbY+qKIW)Sa5XP`Zs40Fpb9i?U z)1D2^*tfPuD>Fy(CuW4Fv#_N0px_f{P!AI;Yi};)MF^%qI*{OB*)0E^ z!u0>9g8oNr<{#M;(Z9ar;-qlcu3FjtJzjUyY&Dr&J_DI0QG9>quf_xf{%Qr->W==C zh1$Kvddq=Gg2%sFCA1m_$UXULYwHVW{oB)(k;#v}G&+-vkWmY3Va7MxGxJaG{GllTlN07g79sNYfU}rP9x|8f zg_LKvH)u|$eq30UEvRw-`t@sZ9)qtmpWLCRghl%Odpf-_8fW`Oi@AIF76wH=np~}t zqHCK3op{%FrJho+mJ+1%ipuhGdi_~+L9MB&gb;`4e{IKIxNP$$dls!F{@hdS`;Y`F zYi28-=PWEMRZBIPo6t3P!+j?ASh92m62Amb z%;O2FAE&8rBP~n~o&Bdd(LwQ&`D1o+ZHP{xlIg~7t5^@ zJ&#ji0Ac=4P(uDylL!c)Bu7Qg1ip?gu54%wT5utqQ(vkqBZLJP{uf_16WNc-a2ylm z{5%D5(kCej2NTV>nWvWBULSRJr+{Kza4RV*xBkI!+fhWiWIGYw*M+j#L|X%yk1jTK zd~$|+u7~Y;6f765f)?p1{gPy?H{>Y}t5faVA#p!Or(NjMys{!>A1>2$pldD?4d#ds zmUqi_Zr$Jeej3V8`4m^fL5COJzkq!J$k;qgf{(pf^b&Db-eQ{?kz2TZ&|Ev@;zH0z zFK8RnW9}$uM3hDGS)#n1_LjUq&+bxxVdFaUG-9o&u+a6mctm0Rt@4)aRsbEa{37E` z-9+m?pB?B=xWxg=BE4U1lp}aesOu<#gCR+v2no!?QeNC6@ojfFsvWSP3G&pt7o;ck)%~UUHc}}~xaMoA#v0j9Q4R`Nt!A?JXUUMi&vfdK zWwO||+cj#j^(PxIM-7fA-bWTpr6i%_mkL8LHX31{L$$_gc*vg#h57|iG?NNtp?B1{ zrXWXGq*Y7+H_3`5R6H~#0a- zhK>de5to^JA-9{GhCThbrO#w4J7~|}G+&{!ce_fs9kE4N zCMIyvbmGUxd>UlQATo+^aNl=JM}l8a<=E?_#LXy}GpJwW4QGrX*8tPCU5PVGQ(e<< zf~Ibni96S%b9`+%`Nud;r$Y#Si23-wjiy~y`1o7-ann;vWDfT%7cpQ2B!3iJ5rQpD znZ`B9$JTpPV7fBmKgxp)T_wMOb|?Jvy35ZkPtnDxLkw9ngNE4z=5UdGe=h86W#;l zVxi7_s?zuQD9OMlrPJ%tZZE^N{UgE$J-8a}L|nr0B*xqacKqwD?!0mAaWp!GJC;05^EN zOx`58=-%3pM5M7LD5{<6}R&rn56}`Ru zY~(u3Uh7Q|JjP_e<($!5AjDCxQ)nHkD z0AElTopj*Kchd*rPDqO^;ZE#kwGY z2pFwdCrC5;@W+)0Lq0SUi+^X?#bEl@JQrR`sZ0Y;l??gr-W4)~o?Du}T-}}JX+AWCGEB-&y zzy9HcrI(}GqNk{SGH26d@7X|&#lmqlhL$L@AKtcLe&WUxf2GDgTDFp~xhAcdhf zf~5jpcIR!~2O+bsUxQ3oxqew%A8f75E6bzd4Q^!0OmcwnVGEKUvYH zb1zuE`I&qK{MXz8faKH-&Xdwmw(m}t(FV4j<#l?vZ>BpP<@tOq8EHdMEtZXAa&?k^ z4=HSq$qQPlQmc;6%Bc0y9)a%IY0cc`Y*!$->tP;hguqUWMLqNQLXJRR;?8b?Q(mLx zzBX7=$Q(TQa@i_RX3*G-p71-im9~G2`|uKTA>KfXB%?!t;0h4{);N>zSKlgnOJAgK z+#qvgD36A}nqmSDC>aAVo#7-pmg&C{B6lQ-aSZV4 z3e0?L0B3p0x{=)bPLun%sl+lpx5+?(DF=uLw*h(t!}_B4M~!5}2o@|H95%gn{7HvJ z$kPUyWxOnmiHV69g@8^I;Kc)hsJQEmvk{_G_Jsa~kz7wq9OHsmr&`nBsU02s@(Lzz zDHSry%FE?W=j|gh>Xuc(MZXo{XcO|&7HZ9G=c~F;TxzLgM}hF{GZ2ag;?I<>ZYZBB zIMQVE?b(zHDTvLDxB4TxKLeo@0b`})1sQK3df{@qoN|pju#FN`$WBQ;(M03^Ti=)Y z6q1Z>MEcQQl9TB6&yuYtZ{|v?>y$Ygv3}(((dz}#n&(;j@-msmRU}Nt@YetYHU^EY zijL&-eR`dScks#!m zxjEmP84aLq8nCq|i#muEAfvF-D(U5R7W>FS#IJAB3EOSgI?~he8xYXL<_vuKh7w%? zN&vVK@AbHdl@jjW%j21Avo3#@?YF~=0Xt3&^{AB%RhFAuE-GFMoisH;j-xcxSbRJv zrtk4^x>6@S5Xn9sOH~of!`45Mh07%r0h%#N*@Br$a$z?4pBj{@v*`jBKHW&P!V{~T z;k(IVHBGYOic{BZ1(1!!5pmPL9nD`pCJWFEreqDXX!VCU>5|sl`(62o)Kt6&DO4dN z5Hq={k=nIRk=aR#lwIv~+1xu)R>iPM!H49E)Q(yaj3;-{7R+j>DN;y-rlH{u>d=La zm%&Fx`1|su{P|K_AXUrED*CrxCEl)G3D+3BJ0QX+ z=gBV#h7nz+EfoRtJzU-}Zeo?7)+z3xPtRbudoC?C=hr=d&zchVz2_J&@A2KjnVKGMm7)qy?nL~deBiQ$1+$oR$aeNquUb;BM=&436VGP9(S#|39cD?3 zk~L5NNi~juG-SwuYO)E$1i#UMx~$f1KFe9G!DP(*)#T>eJao|iz3cx+Dt|ToE79+G Xv6<-4e@uWEGeJ^f@}d>OpTGSd_3*rX literal 0 HcmV?d00001 diff --git a/log.h b/log.h new file mode 100644 index 0000000..f49f895 --- /dev/null +++ b/log.h @@ -0,0 +1,28 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +#define ELM_WEBVIEW_SLOGD(fmt, args...) SLOGD("[%s: %s: %d] "fmt, (rindex(__FILE__, '/') ? rindex(__FILE__, '/') + 1 : __FILE__), __FUNCTION__, __LINE__, ##args) +#define ELM_WEBVIEW_SLOGI(fmt, args...) SLOGI("[%s: %s: %d] "fmt, (rindex(__FILE__, '/') ? rindex(__FILE__, '/') + 1 : __FILE__), __FUNCTION__, __LINE__, ##args) +#define ELM_WEBVIEW_SLOGW(fmt, args...) SLOGW("[%s: %s: %d] "fmt, (rindex(__FILE__, '/') ? rindex(__FILE__, '/') + 1 : __FILE__), __FUNCTION__, __LINE__, ##args) +#define ELM_WEBVIEW_SLOGE(fmt, args...) SLOGE("[%s: %s: %d] "fmt, (rindex(__FILE__, '/') ? rindex(__FILE__, '/') + 1 : __FILE__), __FUNCTION__, __LINE__, ##args) +#define ELM_WEBVIEW_SLOGE_IF(cond, fmt, args...) LOGE_IF(cond, "[%s: %s: %d] "fmt, (rindex(__FILE__, '/') ? rindex(__FILE__, '/') + 1 : __FILE__), __FUNCTION__, __LINE__, ##args) diff --git a/modal_utility/modal_launcher/CMakeLists.txt b/modal_utility/modal_launcher/CMakeLists.txt new file mode 100644 index 0000000..ec0379a --- /dev/null +++ b/modal_utility/modal_launcher/CMakeLists.txt @@ -0,0 +1,22 @@ +SET(MODAL_LAUNCHER modal_launcher) + +#---------------------------------------------------- +# set source files +#---------------------------------------------------- +SET(MODAL_LAUNCHER_SRCS modal_launcher.c popup.c) + +#---------------------------------------------------- +# set include directories +#---------------------------------------------------- +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/modal_utility/modal_launcher) + +#---------------------------------------------------- +# make +#---------------------------------------------------- +ADD_EXECUTABLE(${MODAL_LAUNCHER} ${MODAL_LAUNCHER_SRCS}) +TARGET_LINK_LIBRARIES(${MODAL_LAUNCHER} ${pkgs_LDFLAGS} ${LIB_GNUTLS}) + +#---------------------------------------------------- +# install +#---------------------------------------------------- +INSTALL(PROGRAMS ${MODAL_LAUNCHER} DESTINATION bin) diff --git a/modal_utility/modal_launcher/Makefile.am b/modal_utility/modal_launcher/Makefile.am new file mode 100644 index 0000000..1acdd20 --- /dev/null +++ b/modal_utility/modal_launcher/Makefile.am @@ -0,0 +1,10 @@ +bin_PROGRAMS = modal_launcher + +modal_launcher_dir = $(srcdir)/modal_utility/modal_launcher + +modal_launcher_SOURCES = \ + $(modal_launcher_dir)/modal_launcher.c \ + $(modal_launcher_dir)/popup.c + +modal_launcher_CFLAGS = @APPCORE_EFL_CFLAGS@ @UIGADGET_CFLAGS@ +modal_launcher_LDADD = @ELEMENTARY_LIBS@ @APPCORE_EFL_LIBS@ @UIGADGET_LIBS@ diff --git a/modal_utility/modal_launcher/modal_launcher.c b/modal_utility/modal_launcher/modal_launcher.c new file mode 100755 index 0000000..3a10d09 --- /dev/null +++ b/modal_utility/modal_launcher/modal_launcher.c @@ -0,0 +1,184 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "modal_launcher.h" + +#include +#include +#include + +#include "popup.h" +#include "log.h" + +static Eina_Bool keydown_event(void *data, int type, void *event) +{ + Ecore_Event_Key *ev = (Ecore_Event_Key *)event; + if (!strcmp(ev->keyname, KEY_END)) { + printf("KEYEND"); + elm_exit(); + } + return EXIT_FAILURE; +} + +/** + * @fn static void win_del(void *data, Evas_Object *obj, void *event) + * @brief close this process. + */ +static void win_del(void *data, Evas_Object *obj, void *event) +{ + elm_exit(); +} + +/** + * @fn static Evas_Object* create_win(const char *name) + * @brief create elm_win to show ui-gadget + */ +static Evas_Object* create_win(const char *name) +{ + Evas_Object *eo; + int w, h; + + eo = elm_win_add(NULL, name, ELM_WIN_BASIC); + if (eo) { + elm_win_alpha_set(eo, EINA_TRUE); + elm_win_title_set(eo, name); + elm_win_borderless_set(eo, EINA_TRUE); + evas_object_smart_callback_add(eo, "delete,request", + win_del, NULL); + ecore_x_window_size_get(ecore_x_window_root_first_get(), + &w, &h); + evas_object_resize(eo, w, h); + + /* Turn Off the effect */ + Ecore_X_Window winid = elm_win_xwindow_get(eo); + Ecore_X_Display *dpy; + dpy = ecore_x_display_get(); + + if(!dpy) + return NULL; + utilx_set_window_effect_state(dpy, winid, 0); + } + + return eo; +} + +static int app_create(void *data) +{ + struct appdata *ad = data; + + ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, keydown_event, NULL); + + ad->win = create_win(PACKAGE); + if (ad->win == NULL) { + elm_exit(); + return 0; + } + + evas_object_show(ad->win); + + return 0; +} + +static int app_terminate(void *data) +{ + struct appdata *ad = data; + + if (ad->ly_main) + evas_object_del(ad->ly_main); + + if (ad->win) + evas_object_del(ad->win); + + printf("\n"); + + return 0; +} + +static int app_pause(void *data) +{ + /* struct appdata *ad = data; */ + ELM_WEBVIEW_SLOGD("app_pause"); + elm_exit(); + + return 0; +} + +static int app_resume(void *data) +{ + /* struct appdata *ad = data; */ + return 0; +} + +static int app_reset(bundle *b, void *data) +{ + struct appdata *ad = data; + + const char* type = 0; + + type = bundle_get_val(b, "type"); + + if (!strncmp(type, "confirm", strlen("confirm"))) { + const char* msg = bundle_get_val(b, "message"); + _confirm(ad, msg); + } else if (!strncmp(type, "alert", strlen("alert"))) { + const char* msg = bundle_get_val(b, "message"); + _alert(ad, msg); + } else if (!strncmp(type, "prompt", strlen("prompt"))) { + const char* msg = bundle_get_val(b, "message"); + const char* value = bundle_get_val(b, "value"); + _prompt(ad, msg, value); + } else if (!strncmp(type, "file", strlen("file"))) { + const char* multiple = bundle_get_val(b, "multiple"); + const char* accpet = bundle_get_val(b, "accept"); + _file(ad, multiple, accpet); + } else if (!strncmp(type, "authentication", strlen("authentication"))) { + const char* realm = bundle_get_val(b, "realm"); + const char* host = bundle_get_val(b, "host"); + _authentication(ad, realm, host); + } else { + elm_exit(); + return 0; + } + + if (ad->win) + elm_win_activate(ad->win); + + return 0; +} + +int main(int argc, char *argv[]) +{ + struct appdata ad; + struct appcore_ops ops = { + .create = app_create, + .terminate = app_terminate, + .pause = app_pause, + .resume = app_resume, + .reset = app_reset, + }; + + setenv("ELM_ENGINE", "x11", 1); + memset(&ad, 0x0, sizeof(struct appdata)); + ops.data = &ad; + + if (argc < 2) return 0; + return appcore_efl_main(PACKAGE, &argc, &argv, &ops); +} diff --git a/modal_utility/modal_launcher/modal_launcher.h b/modal_utility/modal_launcher/modal_launcher.h new file mode 100644 index 0000000..469b340 --- /dev/null +++ b/modal_utility/modal_launcher/modal_launcher.h @@ -0,0 +1,41 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef __APP_COMMON_H__ +#define __APP_COMMON_H__ + +#include + +#if !defined(PACKAGE) +# define PACKAGE "modal_launcher" +#endif + +struct appdata +{ + Evas_Object *win; + Evas_Object *ly_main; + + Evas_Object *ug; + /* add more variables here */ +}; + +#endif /* __APP_COMMON_H__ */ + diff --git a/modal_utility/modal_launcher/popup.c b/modal_utility/modal_launcher/popup.c new file mode 100755 index 0000000..d31bfc7 --- /dev/null +++ b/modal_utility/modal_launcher/popup.c @@ -0,0 +1,346 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "modal_launcher.h" + +#include +#include +#include + +#define RESULT_KEYWORD "MODAL_RESULT" +#define MAX_BUFFER 1024 + +/** + * @fn static void response_alert_cb( void *data, Evas_Object *obj, void *event_info) + * @brief receive events when user clicked button of alert dialog. + */ +static void response_alert_cb( void *data, Evas_Object *obj, void *event_info) +{ + /* Pipe will read below message and decide what user did. */ + printf(RESULT_KEYWORD "\n"); + if ((int)event_info != 5) + evas_object_del(obj); + elm_exit(); +} + +/** + * @fn void _alert(struct appdata *ad, const char *message) + * @brief open alert dialog + * @param [in] ad appdata + * @param [in] message message to show in alert dialog + */ +void _alert(struct appdata *ad, const char *message) +{ + Evas_Object *popup; + + popup = elm_popup_add(ad->win); + elm_popup_desc_set(popup, message); + elm_popup_buttons_add(popup, 1, "Ok", ELM_POPUP_RESPONSE_OK, NULL); + + evas_object_smart_callback_add(popup, "response", response_alert_cb, NULL); + evas_object_show(popup); +} + +/** + * @fn static void response_confirm_cb( void *data, Evas_Object *obj, void *event_info) + * @brief receive events when user clicked button of confirm dialog. + */ +static void response_confirm_cb( void *data, Evas_Object *obj, void *event_info) +{ + /* Pipe will read below message and decide what user did. */ + if ((int)event_info == ELM_POPUP_RESPONSE_OK) + printf(RESULT_KEYWORD "\n"); + if ((int)event_info != 5) + evas_object_del(obj); + elm_exit(); +} + +/** + * @fn void _confirm(struct appdata *ad, const char *message) + * @brief open confirm dialog + * @param [in] ad appdata + * @param [in] message message to show in confirm dialog + */ +void _confirm(struct appdata *ad, const char *message) +{ + Evas_Object *popup; + + popup = elm_popup_add(ad->win); + elm_popup_desc_set(popup, message); + elm_popup_buttons_add(popup, 2, "Ok", ELM_POPUP_RESPONSE_OK, "Cancel", ELM_POPUP_RESPONSE_CANCEL, NULL); + + evas_object_smart_callback_add(popup, "response", response_confirm_cb, NULL); + evas_object_show(popup); +} + +/** + * @fn static void response_prompt_cb( void *data, Evas_Object *obj, void *event_info) + * @brief receive events when user clicked button of promptdialog. + */ +static void response_prompt_cb(void *data, Evas_Object *obj, void *event_info) +{ + /* Pipe will read below message and decide what user did. */ + Evas_Object *entry = (Evas_Object*)data; + if ((int)event_info == ELM_POPUP_RESPONSE_OK) + printf(RESULT_KEYWORD "%s\n", elm_entry_entry_get(entry)); + + elm_exit(); +} + +static void input_panel_state_changed(void *data, Ecore_IMF_Context *ctx, int value) +{ + if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) { + Evas_Object *o = (Evas_Object *)data; + elm_object_unfocus(o); + } +} + +/** + * @fn void _prompt(struct appdata *ad, const char *message) + * @brief open prompt dialog + * @param [in] ad appdata + * @param [in] message message to show in prompt dialog + */ +void _prompt(struct appdata *ad, const char *message, const char *defaultValue) +{ + Evas_Object *popup; + + popup = elm_popup_add(ad->win); + + elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER); + elm_popup_buttons_add(popup, 2, "Ok", ELM_POPUP_RESPONSE_OK, "Cancel", ELM_POPUP_RESPONSE_CANCEL, NULL); + + Evas_Object* content = elm_box_add(popup); + evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(content, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(content); + + Evas_Object* label1 = elm_label_add(popup); + elm_object_text_set(label1, message); + evas_object_show(label1); + elm_box_pack_end(content, label1); + + Evas_Object* entry = elm_entry_add(content); + elm_entry_single_line_set(entry, EINA_TRUE); + elm_entry_entry_set(entry, defaultValue); + elm_entry_cursor_end_set(entry); + elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_NORMAL); + ecore_imf_context_input_panel_event_callback_add(elm_entry_imf_context_get(entry), ECORE_IMF_INPUT_PANEL_STATE_EVENT, input_panel_state_changed, entry); + elm_box_pack_end(content, entry); + evas_object_show(entry); + + elm_popup_content_set(popup, content); + evas_object_smart_callback_add(popup, "response", response_prompt_cb, entry); + evas_object_show(popup); +} + +static void layout_cb(struct ui_gadget *ug, enum ug_mode mode, void *priv) +{ + Evas_Object *base, *win; + + if (!ug || !priv) + return; + + base = ug_get_layout(ug); + if (!base) + return; + + win = ug_get_window(); + + switch (mode) + { + case UG_MODE_FULLVIEW: + evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, base); + evas_object_show(base); + break; + default: + break; + } +} + +/** + * @fn static void result_cb(struct ui_gadget *ug, bundle *result, void *priv) + * @brief receive events when user finished choosing files. + */ +static void result_cb(struct ui_gadget *ug, bundle *result, void *priv) +{ + if (ug == NULL || priv == NULL) + return; + + if (result) { + const char *filename = bundle_get_val(result, "result"); + if (filename && strlen(filename)) { + char* filelist = strdup(filename); + char* file = strtok(filelist, "?"); + do { + printf(RESULT_KEYWORD "%s\n", file); + }while((file = strtok(NULL, "?"))); + free(filelist); + } + } + + ug_destroy(ug); + elm_exit(); +} + +static void destroy_cb(struct ui_gadget *ug, void *priv) +{ + ug_destroy(ug); + elm_exit(); +} + +/** + * @fn void _file(struct appdata *ad, const char* multiple, const char* accpet) + * @brief open file chooser UG + * @param [in] ad appdata + */ +void _file(struct appdata *ad, const char* multiple, const char* accpet) +{ + struct ug_cbs cbs = {0, }; + bundle *b; + + UG_INIT_EFL(ad->win, 0); + b = bundle_create(); + if (b == NULL) + return; + + bundle_add(b, "path", "/opt/media"); + bundle_add(b, "file_type", accpet); + if(!strncmp(multiple, "multiple", strlen("multiple"))) + bundle_add(b, "select_type", "MULTI_FILE"); + else// if(!strncmp(message, "single", strlen("single")) + bundle_add(b, "select_type", "SINGLE_FILE"); + + cbs.layout_cb = layout_cb; + cbs.result_cb = result_cb; + cbs.destroy_cb = destroy_cb; + cbs.priv = ad; + + ad->ug = (Evas_Object *)ug_create(NULL, "myfile-efl", UG_MODE_FULLVIEW, b, &cbs); + bundle_free(b); +} + +static void response_cert_cb( void *data, Evas_Object *obj, void *event_info) +{ + //Pipe will read below message and decide what user did. + if ((int)event_info == ELM_POPUP_RESPONSE_OK) + printf(RESULT_KEYWORD "\n"); + if ((int)event_info != 5) + evas_object_del(obj); + elm_exit(); +} + +/** + * @fn void _ceret(struct appdata *ad) + * @brief open certification warning dialog + * @param [in] ad appdata + */ + +void _cert(struct appdata *ad, const char *message) +{ + Evas_Object* popup = elm_popup_add(ad->win); + + if (message && (strlen(message) > 0)) + elm_popup_desc_set(popup, message); + else + elm_popup_desc_set(popup, "Certificate warning"); + + elm_popup_buttons_add(popup, 2, "Continue", ELM_POPUP_RESPONSE_OK, "Cancel", ELM_POPUP_RESPONSE_CANCEL, NULL); + + evas_object_smart_callback_add(popup, "response", response_cert_cb, NULL); + evas_object_show(popup); +} + +static void response_authentication_cb(void *data, Evas_Object *obj, void *event_info) +{ + if ((int)event_info == ELM_POPUP_RESPONSE_OK) { + Evas_Object *content = (Evas_Object*)data; + Eina_List *childrenList = NULL; + Eina_List *l = NULL; + Evas_Object_Box_Option *opt = NULL; + + childrenList = (Eina_List *)elm_box_children_get(content); + + EINA_LIST_FOREACH(childrenList, l, opt) { + if (opt->obj && strncmp(elm_object_widget_type_get(opt->obj), "editfield", strlen("editfield")) == 0) { + Evas_Object *editfield = opt->obj; + printf(RESULT_KEYWORD"%s%s\n", elm_editfield_guide_text_get(editfield), elm_entry_entry_get(elm_editfield_entry_get(editfield))); + } + } + } + + elm_exit(); +} + +/** + * @fn void _authentication(struct appdata *ad, const char *realm, const char *host) + * @brief open authentication dialog + * @param [in] ad appdata + * @param [in] realm realm to show in authentication dialog + * @param [in] host host to show in authentication dialog + */ +void _authentication(struct appdata *ad, const char *realm, const char *host) +{ + Evas_Object *popup; + char message[MAX_BUFFER] = {0, }; + + popup = elm_popup_add(ad->win); + + elm_popup_orient_set(popup, ELM_POPUP_ORIENT_TOP); + elm_popup_title_label_set(popup, "Authentication Required"); + elm_popup_buttons_add(popup, 2, "Ok", ELM_POPUP_RESPONSE_OK, "Cancel", ELM_POPUP_RESPONSE_CANCEL, NULL); + + Evas_Object* content = elm_box_add(popup); + evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(content, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(content); + + Evas_Object* label = elm_label_add(popup); + elm_label_line_wrap_set(label, ELM_WRAP_CHAR); + snprintf(message, MAX_BUFFER, "The server %s requires a username and password. The server says: %s.", host, realm); + elm_object_text_set(label, message); + evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(label); + elm_box_pack_end(content, label); + + Evas_Object* editFieldUsername = elm_editfield_add(content); + elm_editfield_guide_text_set(editFieldUsername, "user name"); + evas_object_size_hint_weight_set(editFieldUsername, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(editFieldUsername, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_editfield_entry_single_line_set(editFieldUsername, EINA_TRUE); + evas_object_show(editFieldUsername); + elm_box_pack_end(content, editFieldUsername); + + Evas_Object* editFieldPassword = elm_editfield_add(content); + elm_editfield_guide_text_set(editFieldPassword, "password"); + evas_object_size_hint_weight_set(editFieldPassword, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(editFieldPassword, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_editfield_entry_single_line_set(editFieldPassword, EINA_TRUE); + elm_entry_password_set(elm_editfield_entry_get(editFieldPassword), EINA_TRUE); + evas_object_show(editFieldPassword); + elm_box_pack_end(content, editFieldPassword); + + elm_popup_content_set(popup, content); + evas_object_smart_callback_add(popup, "response", response_authentication_cb, content); + evas_object_show(popup); +} diff --git a/modal_utility/modal_launcher/popup.h b/modal_utility/modal_launcher/popup.h new file mode 100755 index 0000000..0ac4721 --- /dev/null +++ b/modal_utility/modal_launcher/popup.h @@ -0,0 +1,32 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef popup_h +#define popup_h + +void _alert(struct appdata *ad, const char *message); +void _authentication(struct appdata *ad, const char *realm, const char *host); +void _cert(struct appdata *ad, const char *message); +void _confirm(struct appdata *ad, const char *message); +void _file(struct appdata *ad, const char* multiple, const char* accpet); +void _prompt(struct appdata *ad, const char *message, const char *defaultValue); + +#endif diff --git a/modal_utility/modal_util.c b/modal_utility/modal_util.c new file mode 100755 index 0000000..b4e6514 --- /dev/null +++ b/modal_utility/modal_util.c @@ -0,0 +1,346 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "modal_util.h" + +#include +#include +#include + +/* FIXME: FILE_PATH should be flexible */ +#define FILE_PATH "/usr/bin/modal_launcher" +#define BUNDLE_TYPE "type" +#define BUNDLE_MULTIPLE "multiple" +#define BUNDLE_MESSAGE "message" +#define BUNDLE_VALUE "value" +#define BUNDLE_ACCEPT "accept" +#define BUNDLE_REALM "realm" +#define BUNDLE_HOST "host" +#define RESULT_KEYWORD "MODAL_RESULT" +#define MAX_BUFFER 1024 + +static void _event_free_cb(void *data, void *event) +{ + free(event); +} + +static void _generate_key_end() +{ + Ecore_Event_Key* ev; + ev = malloc(sizeof(Ecore_Event_Key)); + if (!ev) return; + ev->keyname = KEY_END; + ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, _event_free_cb, NULL); +} + +static const char* _replaceChToStr(const char* src, const char fromCh, const char* toStr, int maxLength) +{ + static char buffer[MAX_BUFFER] = "\""; + int bufferOffset = 1; + int toStrLength = strlen(toStr); + if (src == NULL) + return NULL; + + while (*src != '\0' && bufferOffset < maxLength - toStrLength - 2) { // -2 is for "" + if (*src == fromCh) { + strncpy(buffer + bufferOffset, toStr, toStrLength); + bufferOffset += toStrLength; + } else { + buffer[bufferOffset++] = *src; + } + src++; + } + buffer[bufferOffset++] = '\"'; + buffer[bufferOffset] = '\0'; + return buffer; +} + +/** + * @fn Eina_Bool modal_util_confirm(const char* message) + * @brief create modal_launcher and open confirm dialog. + * @param [in] message message which show in dialog. + * @return EINA_TRUE if user clicked ok, EINA_FALSE if else. + */ +Eina_Bool modal_util_confirm(const char* message) +{ + Eina_Bool ret = EINA_FALSE; + FILE *fpipe; + char readbuf[MAX_BUFFER] = FILE_PATH " " BUNDLE_TYPE " confirm "; + int len = strlen(readbuf); + + const char* replacedMsg = _replaceChToStr(message, '\n', "
", MAX_BUFFER - len); + if (!replacedMsg) return EINA_FALSE; + snprintf(readbuf + len, MAX_BUFFER - len, BUNDLE_MESSAGE " %s", replacedMsg); + + if ((fpipe = popen(readbuf, "r")) == NULL) + return EINA_FALSE; + + while(fgets(readbuf, MAX_BUFFER, fpipe)) { + if (!strncmp(readbuf, "\n", 1)) + break; + if (!strncmp(readbuf, "KEYEND", 6)) { + _generate_key_end(); + break; + } + if (!strncmp(readbuf, RESULT_KEYWORD, strlen(RESULT_KEYWORD))) { + ret = EINA_TRUE; + break; + } + } + + pclose(fpipe); + return ret; +} + +/** + * @fn void modal_util_alert(const char* message) + * @brief create modal_launcher and open alert dialog. + * @param [in] message message which show in dialog. + */ +void modal_util_alert(const char* message) +{ + FILE *fpipe; + char readbuf[MAX_BUFFER] = FILE_PATH " " BUNDLE_TYPE " alert "; + int len = strlen(readbuf); + + const char* replacedMsg = _replaceChToStr(message, '\n', "
", MAX_BUFFER - len); + if (!replacedMsg) return; + snprintf(readbuf + len, MAX_BUFFER - len, BUNDLE_MESSAGE " %s", replacedMsg); + + if ((fpipe = popen(readbuf, "r")) == NULL) + return; + + while(fgets(readbuf, MAX_BUFFER, fpipe)) { + if (!strncmp(readbuf, "\n", 1) + || !strncmp(readbuf, RESULT_KEYWORD, strlen(RESULT_KEYWORD))) + break; + if (!strncmp(readbuf, "KEYEND", 6)) { + _generate_key_end(); + break; + } + } + + pclose(fpipe); +} + +/** + * @fn Eina_Bool modal_util_prompt(const char* message, const char* defaultValue, char** value) + * @brief create modal_launcher and open alert dialog. + * @param [in] message message which show in dialog. + * @param [in] defaultValue default string already inserted. + * @return string which user insert. + */ +Eina_Bool modal_util_prompt(const char* message, const char* defaultValue, char** value) +{ + Eina_Bool ret = EINA_FALSE; + FILE *fpipe; + char readbuf[MAX_BUFFER] = FILE_PATH " " BUNDLE_TYPE " prompt "; + int len = strlen(readbuf); + + const char* replacedMsg = _replaceChToStr(message, '\n', "
", MAX_BUFFER - len); + if (!replacedMsg) + return EINA_FALSE; + snprintf(readbuf + len, MAX_BUFFER - len, BUNDLE_MESSAGE " %s ", replacedMsg); + len = strlen(readbuf); + + replacedMsg = _replaceChToStr(defaultValue, '\n', "
", MAX_BUFFER - len); + if (defaultValue && strlen(defaultValue)) + snprintf(readbuf + len, MAX_BUFFER - len, BUNDLE_VALUE " %s", replacedMsg); + + if ((fpipe = popen(readbuf, "r")) == NULL) + return EINA_FALSE; + + while(fgets(readbuf, MAX_BUFFER, fpipe)) { + if (!strncmp(readbuf, "\n", 1)) + break; + if (!strncmp(readbuf, "KEYEND", 6)) { + _generate_key_end(); + break; + } + if (!strncmp(readbuf, RESULT_KEYWORD, strlen(RESULT_KEYWORD))) { + char* data = readbuf + strlen(RESULT_KEYWORD); + if (data && strlen(data) && strncmp(data, "\n", 1)) { + *value = strdup(strtok(data, "\n")); + } + ret = EINA_TRUE; + break; + } + } + + pclose(fpipe); + return ret; +} + +/** + * @fn Eina_Bool modal_util_run_open_panel(Eina_Bool multiple_files, const char* accept_types, Eina_List** selected_filenames) + * @brief create modal_launcher and open file dialog. + * @param [in] multiple_files whethere multiple file can be selected. + * @param [in] accept_types mime type which can be accepted to select + * @param [in] selected_filenames filenames which use select. + * @return EINA_TRUE if user select, EINA_FALSE if else. + */ +Eina_Bool modal_util_run_open_panel(Eina_Bool multiple_files, Eina_List* accept_types, Eina_List** selected_filenames) +{ + unsigned int i, n; + + Eina_Bool is_audio_extension_type = EINA_FALSE; + Eina_Bool is_video_extension_type = EINA_FALSE; + Eina_Bool is_image_extension_type = EINA_FALSE; + Eina_Bool is_audio_all_type = EINA_FALSE; + Eina_Bool is_video_all_type = EINA_FALSE; + Eina_Bool is_image_all_type = EINA_FALSE; + + n = eina_list_count(accept_types); + + FILE *fpipe; + char readbuf[MAX_BUFFER] = FILE_PATH " " BUNDLE_TYPE " file "; + Eina_Bool ret = EINA_FALSE; + int len = strlen(readbuf); + char *accept_type; + char extensions[MAX_BUFFER] = {0, }; + + /* Set file select mode : multiple/single */ + if (multiple_files == TRUE){ + snprintf(readbuf + len, MAX_BUFFER - len, BUNDLE_MULTIPLE " %s ", "multiple"); + } else { + snprintf(readbuf + len, MAX_BUFFER - len, BUNDLE_MULTIPLE " %s ", "single"); + } + + /* set accept type */ + len = strlen(readbuf); + + for (i = 0; i < n; i++) { + accept_type = eina_list_nth(accept_types, i); + fprintf(stderr, "accept_type[%d]: %s, ", i, accept_type); + if (strncmp(accept_type, "audio/*", strlen("audio/*")) == 0) { + is_audio_all_type = EINA_TRUE; + } else if (strncmp(accept_type, "video/*", strlen("video/*")) == 0) { + is_video_all_type = EINA_TRUE; + } else if (strncmp(accept_type, "image/*", strlen("image/*")) == 0) { + is_image_all_type = EINA_TRUE; + } else if (strncmp(accept_type, "audio/", strlen("audio/")) == 0) { + is_audio_extension_type = EINA_TRUE; + accept_type = strchr(accept_type, '/') + 1; + strncat(extensions, accept_type, strlen(accept_type)); + strncat(extensions, ",", 1); + } else if (strncmp(accept_type, "video/", strlen("video/")) == 0) { + is_video_extension_type = EINA_TRUE; + accept_type = strchr(accept_type, '/') + 1; + strncat(extensions, accept_type, strlen(accept_type)); + strncat(extensions, ",", 1); + } else if (strncmp(accept_type, "image/", strlen("image/")) == 0) { + is_image_extension_type = EINA_TRUE; + accept_type = strchr(accept_type, '/') + 1; + strncat(extensions, accept_type, strlen(accept_type)); + strncat(extensions, ",", 1); + } else { + fprintf(stderr, "...unknown type...\n"); + } + } + + fprintf(stderr, ", ext appended: %s\n\n", extensions); + + if (is_audio_all_type && !is_video_all_type && !is_image_all_type && !is_video_extension_type && !is_image_extension_type) { + snprintf(readbuf+len, MAX_BUFFER-len, BUNDLE_ACCEPT " %s", "SOUND"); + } else if (is_video_all_type && !is_image_all_type && !is_audio_all_type && !is_image_extension_type && !is_audio_extension_type) { + snprintf(readbuf+len, MAX_BUFFER-len, BUNDLE_ACCEPT " %s", "VIDEO"); + } else if (is_image_all_type && !is_audio_all_type && !is_video_all_type && !is_audio_extension_type && !is_video_extension_type) { + snprintf(readbuf+len, MAX_BUFFER-len, BUNDLE_ACCEPT " %s", "IMAGE"); + } else if (is_audio_all_type && is_video_all_type && !is_image_all_type && !is_image_extension_type) { + snprintf(readbuf+len, MAX_BUFFER-len, BUNDLE_ACCEPT " %s", "VS"); + } else if (is_video_all_type && is_image_all_type && !is_audio_all_type && !is_audio_extension_type) { + snprintf(readbuf+len, MAX_BUFFER-len, BUNDLE_ACCEPT " %s", "IV"); + } else if (is_image_all_type && is_audio_all_type && !is_video_all_type && !is_video_extension_type) { + snprintf(readbuf+len, MAX_BUFFER-len, BUNDLE_ACCEPT " %s", "IS"); + } else if (!is_audio_all_type && !is_video_all_type && !is_image_all_type && + (is_video_extension_type || is_image_extension_type || is_audio_extension_type)) { + snprintf(readbuf+len, MAX_BUFFER-len, BUNDLE_ACCEPT " %s", extensions); + } else { + snprintf(readbuf+len, MAX_BUFFER-len, BUNDLE_ACCEPT " %s", "ALL"); + } + + if ((fpipe = popen(readbuf, "r")) == NULL) + return EINA_FALSE; + + while(fgets(readbuf, MAX_BUFFER, fpipe)) { + if (!strncmp(readbuf, "\n", 1)) + break; + if (!strncmp(readbuf, "KEYEND", 6)) { + _generate_key_end(); + break; + } + if (!strncmp(readbuf, RESULT_KEYWORD, strlen(RESULT_KEYWORD))) { + char* file = readbuf + strlen(RESULT_KEYWORD); + if (file && strlen(file) && strncmp(file, "\n", 1)) + *selected_filenames = eina_list_append(*selected_filenames, strndup(file, strlen(file) - 1)); + ret = EINA_TRUE; + } + } + pclose(fpipe); + return ret; +} + +/** + * @fn void modal_util_authentication(const char* realm, const char* host, char** username, char** password) + * @brief create modal_launcher and open authentication dialog. + * @param [in] realm realm received from server which show in dialog. + * @param [in] host server address received from server which show in dialog. + * @param [out] username username which is inputted by user + * @param [out] password password which is inputted by user + * @return EINA_TRUE if user clicked ok, EINA_FALSE if else. + */ +Eina_Bool modal_util_authentication(const char* realm, const char* host, char** username, char** password) +{ + Eina_Bool ret = EINA_FALSE; + FILE *fpipe; + char readbuf[MAX_BUFFER] = FILE_PATH " " BUNDLE_TYPE " authentication "; + int len = strlen(readbuf); + + const char* replacedRealm = _replaceChToStr(realm, '\n', "
", MAX_BUFFER - len); + if (!replacedRealm) + return EINA_FALSE; + snprintf(readbuf + len, MAX_BUFFER - len, BUNDLE_REALM " %s " BUNDLE_HOST " \"%s\"", replacedRealm, host); + + if ((fpipe = popen(readbuf, "r")) == NULL) + return EINA_FALSE; + + while (fgets(readbuf, MAX_BUFFER, fpipe)) { + if (!strncmp(readbuf, "\n", 1)) + break; + if (!strncmp(readbuf, "KEYEND", 6)) { + _generate_key_end(); + break; + } + if (!strncmp(readbuf, RESULT_KEYWORD, strlen(RESULT_KEYWORD))) { + char* data = readbuf + strlen(RESULT_KEYWORD); + if (data && strlen(data) && strncmp(data, "\n", 1)) { + if (!strncmp(data, "user name", strlen("user name"))) + *username = strndup(data + strlen("user name"), strlen(data) - strlen("user name") - 1); + if (!strncmp(data, "password", strlen("password"))) + *password = strndup(data + strlen("password"), strlen(data) - strlen("password") - 1); + } + ret = EINA_TRUE; + } + } + pclose(fpipe); + return ret; +} + diff --git a/modal_utility/modal_util.h b/modal_utility/modal_util.h new file mode 100755 index 0000000..b068ce0 --- /dev/null +++ b/modal_utility/modal_util.h @@ -0,0 +1,41 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef MODAL_UTILITY_H +#define MODAL_UTILITY_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void modal_util_alert(const char* message); +Eina_Bool modal_util_confirm(const char* message); +Eina_Bool modal_util_prompt(const char* message, const char* defaultValue, char** value); +Eina_Bool modal_util_run_open_panel(Eina_Bool multiple_files, Eina_List* accept_types, Eina_List** selected_filenames); +Eina_Bool modal_util_authentication(const char* realm, const char* host, char** username, char** password); + +#ifdef __cplusplus +} +#endif + +#endif /*#ifndef MODAL_UTILITY_H*/ diff --git a/packaging/elm-webview.spec b/packaging/elm-webview.spec new file mode 100644 index 0000000..10a5747 --- /dev/null +++ b/packaging/elm-webview.spec @@ -0,0 +1,59 @@ +Name: elm-webview +Summary: Elementary webkit widget +Version: 1.0.126 +Release: 1 +Group: libdevel +License: TO_BE_FILLED +URL: N/A +Source0: %{name}-%{version}.tar.gz +BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(appcore-efl) +BuildRequires: pkgconfig(ewebkit) +BuildRequires: pkgconfig(ui-gadget) +BuildRequires: pkgconfig(bundle) +BuildRequires: pkgconfig(utilX) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(gnutls) +BuildRequires: cmake + + +%description +Elementary webkit widget. + + +%package devel +Summary: Elementary webkit widget development headers +Group: web +Requires: %{name} = %{version}-%{release} + +%description devel +webkit widget development headers + +%prep +%setup -q + + +%build +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} + +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install + +%post devel -p /sbin/ldconfig + +%postun devel -p /sbin/ldconfig + +%files +%defattr(-,root,root,-) +%{_libdir}/*.so.* +%{_bindir}/* + +%files devel +%defattr(-,root,root,-) +%{_libdir}/*.so +%{_includedir}/* +%{_libdir}/pkgconfig/*.pc + diff --git a/samples/elm_webview_sample/CMakeLists.txt b/samples/elm_webview_sample/CMakeLists.txt new file mode 100644 index 0000000..78a371c --- /dev/null +++ b/samples/elm_webview_sample/CMakeLists.txt @@ -0,0 +1,72 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(elm_webview_sample C) + +SET(SRCS elm_webview_sample.c) + +SET(VENDOR "tizen") +SET(PACKAGE ${PROJECT_NAME}) +SET(PKGNAME "deb.com.${VENDOR}.${PACKAGE}") +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(BINDIR "${PREFIX}/bin") +SET(DATADIR "${PREFIX}/share") +SET(LOCALEDIR "${DATADIR}/locale") +SET(ICONDIR "${DATADIR}/icons") +SET(EDJDIR "${DATADIR}/edje") + +IF("${CMAKE_BUILD_TYPE}" STREQUAL "") + SET(CMAKE_BUILD_TYPE "Release") +ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") +MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) + +INCLUDE(FindPkgConfig) +pkg_check_modules(pkgs REQUIRED evas edje ecore-x dlog appcore-efl elm-webview ewebkit) + +FOREACH(flag ${pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") +SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") +SET(CMAKE_C_FLAGS_RELEASE "-O2") + +FIND_PROGRAM(UNAME NAMES uname) +EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") +IF("${ARCH}" STREQUAL "arm") + ADD_DEFINITIONS("-DTARGET") + MESSAGE("add -DTARGET") +ENDIF("${ARCH}" STREQUAL "arm") + +ADD_DEFINITIONS("-DVENDOR=\"${VENDOR}\"") +ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"") +ADD_DEFINITIONS("-DPACKAGE_NAME=\"${PKGNAME}\"") +ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") +ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"") +ADD_DEFINITIONS("-DEDJDIR=\"${EDJDIR}\"") +ADD_DEFINITIONS("-DLOG_TAG=\"${PKGNAME}\"") + +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") + +ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS}) + +#ADD_CUSTOM_COMMAND(OUTPUT elm_webview_sample.edj +# COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/images +# ${CMAKE_SOURCE_DIR}/elm_webview_sample.edc ${CMAKE_BINARY_DIR}/elm_webview_sample.edj +# DEPENDS ${CMAKE_SOURCE_DIR}/elm_webview_sample.edc +#) +#ADD_CUSTOM_TARGET(edj_build DEPENDS elm_webview_sample.edj) +#ADD_DEPENDENCIES(${PROJECT_NAME} edj_build) + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR}) +#INSTALL(FILES ${CMAKE_BINARY_DIR}/elm_webview_sample.edj DESTINATION ${EDJDIR}) + +# install desktop file & icon +CONFIGURE_FILE(${PROJECT_NAME}.desktop.in ${PROJECT_NAME}.desktop) +INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.desktop DESTINATION opt/share/install-info/application) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/icon_${PROJECT_NAME}.png DESTINATION ${ICONDIR}) + +# i18n +#ADD_SUBDIRECTORY(po) + diff --git a/samples/elm_webview_sample/build.sh b/samples/elm_webview_sample/build.sh new file mode 100755 index 0000000..4b66d77 --- /dev/null +++ b/samples/elm_webview_sample/build.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +if [ $# -eq 0 ]; then + mkdir -p tmp_build;cd tmp_build + cmake .. -DCMAKE_INSTALL_PREFIX=../install_dir + make --jobs=4 install +elif [ "x$1" = "xdebug" ]; then + mkdir -p tmp_build;cd tmp_build + cmake .. -DCMAKE_INSTALL_PREFIX=../install_dir -DCMAKE_BUILD_TYPE=Debug + make --jobs=4 install +elif [ "x$1" = "xclean" ]; then + rm -rf tmp_build + rm -rf install_dir +# rm -rf CMakeFiles +# rm CMakeCache.txt +fi diff --git a/samples/elm_webview_sample/elm_webview_sample.c b/samples/elm_webview_sample/elm_webview_sample.c new file mode 100755 index 0000000..fb6436d --- /dev/null +++ b/samples/elm_webview_sample/elm_webview_sample.c @@ -0,0 +1,504 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "elm_webview_sample.h" + +static Evas_Object* create_bg(Evas_Object *parent); +static Evas_Object* create_layout_main(Evas_Object *parent); +static Evas_Object *create_navigation_main(Evas_Object *parent); +static Evas_Object *create_webview(Evas_Object *parent); + +static void contextmenu_new_callback(void *data, Evas_Object *obj, void *event_info); +static void contextmenu_show_callback(void *data, Evas_Object *obj, void *event_info); +static void contextmenu_move_callback(void *data, Evas_Object *obj, void *event_info); +static void contextmenu_hide_callback(void *data, Evas_Object *obj, void *event_info); +static void contextmenu_del_callback(void *data, Evas_Object *obj, void *event_info); +static void contextmenu_customize_callback(void *data, Evas_Object *obj, void *event_info); + +static void contextmenu_webkit_item_callback(void *data, Evas_Object *obj, void *event_info); +static void contextmenu_custom_item_callback(void *data, Evas_Object *obj, void *event_info); + +struct text_part { + char *part; + char *msgid; +}; + +static void win_del(void *data, Evas_Object *obj, void *event) +{ + elm_exit(); +} + +static void main_quit_cb(void *data, Evas_Object *obj, + const char *emission, const char *source) +{ + ewk_shutdown(); + elm_exit(); +} + +static void update_ts(Evas_Object *eo, struct text_part *tp, int size) +{ + int i; + + if (eo == NULL || tp == NULL || size < 0) + return; + + for (i = 0; i < size; i++) { + if (tp[i].part && tp[i].msgid) + edje_object_part_text_set(eo, + tp[i].part, _(tp[i].msgid)); + } +} + +static int lang_changed(void *data) +{ + struct appdata *ad = data; + + if (ad->ly_main == NULL) + return 0; + +// update_ts(elm_layout_edje_get(ad->ly_main), main_txt, +// sizeof(main_txt)/sizeof(main_txt[0])); + + return 0; +} + +static Evas_Object* create_win(const char *name) +{ + Evas_Object *eo; + int w, h; + + eo = elm_win_add(NULL, name, ELM_WIN_BASIC); + if (eo) { + elm_win_title_set(eo, name); + elm_win_borderless_set(eo, EINA_TRUE); + evas_object_smart_callback_add(eo, "delete,request", + win_del, NULL); + ecore_x_window_size_get(ecore_x_window_root_first_get(), + &w, &h); + evas_object_resize(eo, w, h); + } + + return eo; +} + +static Evas_Object* load_edj(Evas_Object *parent, const char *file, + const char *group) +{ + Evas_Object *eo; + int r; + + eo = elm_layout_add(parent); + if (eo) { + r = elm_layout_file_set(eo, file, group); + if (!r) { + evas_object_del(eo); + return NULL; + } + + evas_object_size_hint_weight_set(eo, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + } + + return eo; +} + +static int app_create(void *data) +{ + struct appdata *ad = data; + Evas_Object *win; + //Evas_Object *ly; + Evas_Object *bg; //* added + Evas_Object *layout; + Evas_Object *navigation; + int r; + + /* create window */ + win = create_win(PACKAGE); + if (win == NULL) + return -1; + ad->win = win; + + /* create background */ + bg = create_bg(ad->win); + if (bg == NULL) + { + LOGD("Failed create_bg.\n"); + return -1; + } + ad->bg = bg; + + /* create main layout */ + layout = create_layout_main(ad->win); + if (layout == NULL) + { + LOGD("Failed create_layout_main.\n"); + return -1; + } + ad->ly_main = layout; + + /* create navigation main */ + navigation = create_navigation_main(ad->ly_main); + if (navigation == NULL) + { + LOGD("Failed create_navigation_main.\n"); + return -1; + } + ad->navigation_main = navigation; + + ad->webview = create_webview(navigation); + evas_object_size_hint_weight_set(ad->webview, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + Elm_Object_Item *navi_it = elm_naviframe_item_push(navigation, "", NULL, NULL, ad->webview, NULL); + elm_naviframe_item_title_visible_set(navi_it, EINA_TRUE); + evas_object_show(layout); + + /* init internationalization */ + r = appcore_set_i18n(PACKAGE, LOCALEDIR); + if (r) + return -1; + lang_changed(ad); + + evas_object_show(win); + + /* add system event callback */ + appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, + lang_changed, ad); + + Evas_Object *webkit = elm_webview_webkit_get(ad->webview); + elm_webview_enable_default_context_menu_set(ad->webview, EINA_TRUE); + evas_object_smart_callback_add(webkit, "webview,contextmenu,new", contextmenu_new_callback, ad); + evas_object_smart_callback_add(webkit, "webview,contextmenu,show", contextmenu_show_callback, ad); + evas_object_smart_callback_add(webkit, "webview,contextmenu,move", contextmenu_move_callback, ad); + evas_object_smart_callback_add(webkit, "webview,contextmenu,hide", contextmenu_hide_callback, ad); + evas_object_smart_callback_add(webkit, "webview,contextmenu,del", contextmenu_del_callback, ad); + evas_object_smart_callback_add(webkit, "contextmenu,customize", contextmenu_customize_callback, ad); + + /* appcore measure time example */ + printf("from AUL to %s(): %d msec\n", __func__, + appcore_measure_time_from("APP_START_TIME")); + + appcore_measure_start(); + return 0; +} + +static int app_terminate(void *data) +{ + struct appdata *ad = data; + + Evas_Object *webkit = elm_webview_webkit_get(ad->webview); + evas_object_smart_callback_del(webkit, "webview,contextmenu,new", contextmenu_new_callback); + evas_object_smart_callback_del(webkit, "webview,contextmenu,show", contextmenu_show_callback); + evas_object_smart_callback_del(webkit, "webview,contextmenu,move", contextmenu_move_callback); + evas_object_smart_callback_del(webkit, "webview,contextmenu,hide", contextmenu_hide_callback); + evas_object_smart_callback_del(webkit, "webview,contextmenu,del", contextmenu_del_callback); + evas_object_smart_callback_del(webkit, "contextmenu,customize", contextmenu_customize_callback); + + if (ad->ly_main) + evas_object_del(ad->ly_main); + + if (ad->win) + evas_object_del(ad->win); + + return 0; +} + +static int app_pause(void *data) +{ + struct appdata *ad = data; + + return 0; +} + +static int app_resume(void *data) +{ + struct appdata *ad = data; + + return 0; +} + +static int app_reset(bundle *b, void *data) +{ + struct appdata *ad = data; + + /* appcore measure time example */ + printf("from AUL to %s(): %d msec\n", __func__, + appcore_measure_time_from("APP_START_TIME")); + printf("from create to %s(): %d msec\n", __func__, + appcore_measure_time()); + + if (ad->win) + elm_win_activate(ad->win); + + return 0; +} + +const char * szBuffer = NULL; +int main(int argc, char *argv[]) +{ + struct appdata ad; + struct appcore_ops ops = { + .create = app_create, + .terminate = app_terminate, + .pause = app_pause, + .resume = app_resume, + .reset = app_reset, + }; + + /* appcore measure time example */ + printf("from AUL to %s(): %d msec\n", __func__, + appcore_measure_time_from("APP_START_TIME")); + + if (argc > 1) + szBuffer = strdup(argv[1]); + memset(&ad, 0x0, sizeof(struct appdata)); + ops.data = &ad; + + return appcore_efl_main(PACKAGE, &argc, &argv, &ops); +} + +/***********************************************************/ +static Evas_Object* create_bg(Evas_Object *parent) +{ + Evas_Object *bg; + + if (parent == NULL) + return NULL; + + bg = evas_object_rectangle_add(evas_object_evas_get(parent)); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(parent, bg); + evas_object_color_set(bg, 0, 0, 0, 255); + evas_object_show(bg); + + return bg; +} + +static Evas_Object* create_layout_main(Evas_Object *parent) +{ + Evas_Object *layout; + + if (parent == NULL) + return NULL; + + layout = elm_layout_add(parent); + if (layout == NULL) + { + LOGD("Failed elm_layout_add.\n"); + return NULL; + } + + if(!elm_layout_theme_set(layout, "layout", "application", "default" )) + LOGE("elm_layout_theme_set is failed.\n"); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(parent, layout); + + edje_object_signal_emit(elm_layout_edje_get(layout), "elm,state,show,indicator", "elm"); + + evas_object_show(layout); + + return layout; +} + +static Evas_Object *create_navigation_main(Evas_Object *parent) +{ + Evas_Object *navigation; + + if (parent == NULL) + return NULL; + + navigation = elm_naviframe_add(parent); + if (navigation == NULL) + { + LOGD("Failed to create navigation.\n"); + return NULL; + } + elm_layout_content_set(parent, "elm.swallow.content", navigation); + evas_object_show(navigation); + + return navigation; +} + +static Evas_Object *webview; +static Evas_Object *webkit; + +static Evas_Object *create_webview(Evas_Object *parent) +{ + ewk_init(); + webview = elm_webview_add(parent, EINA_TRUE); + webkit = elm_webview_webkit_get(webview); + Evas_Object *main_frame = ewk_view_frame_main_get(webkit); + ewk_view_setting_enable_frame_flattening_set(webkit, EINA_TRUE); + if (szBuffer) + ewk_view_uri_set(webkit, szBuffer); + else + ewk_view_uri_set(webkit, "http://www.google.com"); + return webview; +} + +static void contextmenu_new_callback(void *data, Evas_Object *obj, void *event_info) +{ + struct appdata *ad = data; + if (ad->popup) + { + evas_object_del(ad->popup); + ad->popup = NULL; + } + + ad->popup = elm_ctxpopup_add(ad->win); + Elm_WebView_Context_Menu_Data* context_menu_data = (Elm_WebView_Context_Menu_Data*) event_info; + ad->context_menu_data = context_menu_data; + + evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); +} + +static void contextmenu_show_callback(void *data, Evas_Object *obj, void *event_info) +{ + struct appdata *ad = data; + if (!ad->popup) + return; + + Elm_WebView_Context_Menu_Data* context_menu_data = (Elm_WebView_Context_Menu_Data*) event_info; + evas_object_move(ad->popup, context_menu_data->mouse_down_event.canvas.x, context_menu_data->mouse_down_event.canvas.y - 60 * elm_scale_get()); + evas_object_show(ad->popup); +} + +static void contextmenu_move_callback(void *data, Evas_Object *obj, void *event_info) +{ + struct appdata *ad = data; + if (!ad->popup) + return; + + Evas_Point* position = (Evas_Point *)event_info; + evas_object_move(ad->popup, position->x, position->y - 60 * elm_scale_get()); + evas_object_show(ad->popup); +} + +static void contextmenu_hide_callback(void *data, Evas_Object *obj, void *event_info) +{ + struct appdata *ad = data; + if (!ad->popup) + return; + + evas_object_hide(ad->popup); +} + +static void contextmenu_del_callback(void *data, Evas_Object *obj, void *event_info) +{ + struct appdata *ad = data; + if (!ad->popup) + return; + + evas_object_del(ad->popup); + ad->popup = NULL; +} + +static void contextmenu_customize_callback(void *data, Evas_Object *obj, void *event_info) +{ + struct appdata *ad = data; + Eina_List *menu_items = (Eina_List*) event_info; + + Eina_List *l; + Ewk_Context_Menu_Item *item; + void *m_data; + + if (!ad->context_menu_data->is_text_selection) + { + // add all items + EINA_LIST_FOREACH(menu_items, l, m_data) + { + item = (Ewk_Context_Menu_Item *)m_data; + if (ewk_context_menu_item_enabled_get(item) && ewk_context_menu_item_type_get(item) == EWK_ACTION_TYPE) + { + Ewk_Context_Menu_Action action = ewk_context_menu_item_action_get(item); + if (action == EWK_CONTEXT_MENU_ITEM_TAG_COPY + || action == EWK_CONTEXT_MENU_ITEM_TAG_RELOAD + || action == EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB + || action == EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK) + continue; + elm_ctxpopup_item_append(ad->popup, ewk_context_menu_item_title_get(item), + NULL, contextmenu_webkit_item_callback, item); + } + } + evas_object_smart_callback_add(ad->popup, "dismissed", contextmenu_del_callback, ad); + } + else + { + elm_object_style_set(ad->popup, "extended/entry/pass_event"); + // change the ctxpopup style for text-selection context menu + elm_ctxpopup_horizontal_set(ad->popup, EINA_TRUE); + elm_ctxpopup_direction_priority_set(ad->popup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UP, + ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UP); + EINA_LIST_FOREACH(menu_items, l, m_data) + { + item = (Ewk_Context_Menu_Item *)m_data; + if (ewk_context_menu_item_enabled_get(item) && ewk_context_menu_item_type_get(item) == EWK_ACTION_TYPE) + { + Ewk_Context_Menu_Action action = ewk_context_menu_item_action_get(item); + if (action != EWK_CONTEXT_MENU_ITEM_TAG_COPY + && action != EWK_CONTEXT_MENU_ITEM_TAG_CUT + && action != EWK_CONTEXT_MENU_ITEM_TAG_PASTE + && action != EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL + && action != EWK_CONTEXT_MENU_ITEM_TAG_SELECT_WORD) + continue; + elm_ctxpopup_item_append(ad->popup, ewk_context_menu_item_title_get(item), + NULL, contextmenu_webkit_item_callback, item); + if (action == EWK_CONTEXT_MENU_ITEM_TAG_PASTE) + elm_ctxpopup_item_append(ad->popup, "More", NULL, contextmenu_custom_item_callback, ad); + } + } + } + elm_object_tree_unfocusable_set(ad->popup, EINA_TRUE); +} + +static void contextmenu_webkit_item_callback(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *item = (Elm_Object_Item *)event_info; + if (!item) + return; + + Ewk_Context_Menu_Item *webkit_item = (Ewk_Context_Menu_Item *)data; + + elm_webview_context_menu_item_selected(webview, webkit_item); +} + +static void contextmenu_custom_item_callback(void *data, Evas_Object *obj, void *event_info) +{ + struct appdata *ad = data; + Elm_Object_Item *item = (Elm_Object_Item *)event_info; + if (!item) + { + contextmenu_del_callback(ad, obj, event_info); + return; + } + + if (!strcmp(elm_ctxpopup_item_label_get(item), "More")) + elm_webview_cbhm_run(webview); + + if (webview) + elm_webview_context_menu_item_selected(webview, NULL); +} diff --git a/samples/elm_webview_sample/elm_webview_sample.desktop.in b/samples/elm_webview_sample/elm_webview_sample.desktop.in new file mode 100644 index 0000000..0994053 --- /dev/null +++ b/samples/elm_webview_sample/elm_webview_sample.desktop.in @@ -0,0 +1,4 @@ +Name=@PROJECT_NAME@ +Exec=@BINDIR@/@PROJECT_NAME@ +Icon=@ICONDIR@/icon_@PROJECT_NAME@.png +Type=Application diff --git a/samples/elm_webview_sample/elm_webview_sample.edc b/samples/elm_webview_sample/elm_webview_sample.edc new file mode 100644 index 0000000..40abbd4 --- /dev/null +++ b/samples/elm_webview_sample/elm_webview_sample.edc @@ -0,0 +1,50 @@ +#define FONT_NAME "GP45_ArabCJK_TouchWiz" + +collections { + group { + name, "main"; + + parts { + part { name, "background"; + type, RECT; + description { + state, "default" 0.0; + color, 0 0 0 255; + } + } + + part { name, "txt_title"; + type, TEXT; + mouse_events, 0; + description { + state, "default" 0.0; + rel1 { relative, 0.0 0.0; to, background; } + rel2 { relative, 1.0 0.5; to, background; } + text { font, FONT_NAME; size, 30; align, 0.5 0.5; } + color, 255 255 255 255; + } + } + + part { name, "txt_mesg"; + type, TEXT; + mouse_events, 0; + description { + state, "default" 0.0; + rel1 { relative, 0.0 0.5; to, background; } + rel2 { relative, 1.0 1.0; to, background; } + text { font, FONT_NAME; size, 30; align, 0.5 0.5; } + color, 255 255 255 255; + } + } + } + + programs { + program { + name, "click_exit"; + source, "background"; + signal, "mouse,clicked,1"; + action, SIGNAL_EMIT "EXIT" "EDJ"; + } + } + } +} diff --git a/samples/elm_webview_sample/elm_webview_sample.h b/samples/elm_webview_sample/elm_webview_sample.h new file mode 100644 index 0000000..8c4665b --- /dev/null +++ b/samples/elm_webview_sample/elm_webview_sample.h @@ -0,0 +1,48 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef __APP_COMMON_H__ +#define __APP_COMMON_H__ + +#include + +#if !defined(PACKAGE) +# define PACKAGE "elm_webview_sample" +#endif + +#define EDJ_FILE EDJDIR "/" PACKAGE ".edj" +#define GRP_MAIN "main" + +struct appdata +{ + Evas_Object *win; + Evas_Object *bg; + Evas_Object *ly_main; + Evas_Object *navigation_main; + + Evas_Object *popup; + Elm_WebView_Context_Menu_Data *context_menu_data; + Evas_Object *webview; + /* add more variables here */ +}; + +#endif /* __APP_COMMON_H__ */ + diff --git a/samples/elm_webview_sample/icon_elm_webview_sample.png b/samples/elm_webview_sample/icon_elm_webview_sample.png new file mode 100644 index 0000000000000000000000000000000000000000..ef74fd1f771bfaa00f098b1014b903cd3f8f1797 GIT binary patch literal 5759 zcmV-_7J%uAP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=00004XF*Lt006O$eEU(80000WV@Og>004R=004l4008;_004mL004C` z008P>0026e000+nl3&F}000Y`NklSbz{hs9hBVDiRxnXz2n36bQ7a5498mF-b`Y zG-(?*ac1m!-p4uTV=;GF?~$w|V`nt}-T(Q2kNM7AVrHak^_NHyq@YvK z=}JM5>{82pv)OFU0{9kyTL4gs>-?p)wv9&P*Z1Cg@7?#`fB(^A$Bq$zv)M&=qCv}L z9nEI**8o1)`A?jtDCfYn7jn5A4jw%Cz-_nP_UZZg`7jZ$xe)ZSie~2b0DyDOMp5*# zF{Z-IsoeljN=^8_zX^b_*6sjs6@a4vbfRk8vvmMqB0?C3^VMqguhv@2%&L2PtlQuw zgf13~d&b7brjv)p0OXUnX92iwPAe&znVI7_UW%f~GP4gr5D^p6x`u7qs{&v;ftyP} zI{;B)A3cKx5dnZ;W{;Vr5Q3$YP6)BCVKXxean?mCVW|_)3P5-<*3k)q9UEb#l+jun zrIcIe?!iRVVZh0kNTAb&Sz1quCL#zSKtxt+ZMD`$Yi-v%Xdy(0fn#Q~T<0`V0 zl2hwoz5s0J-*nNHVaGNS>*)67bsr3q*wvjY^Xsk*J5Q3f%GQ+zRC2plqVGYn%B zM1}y!VF6!LSqC#aW|(5ZmtMv%v|90||GZe+bmaNdV+)H-|8%+GNg?3C7|;9h%=B2W z^NpJpXEqj2mva96QmxrA#z`TB9L3CIBtSDWODV;~cz)xla`O#OJpSwzzj^Gr@uv=* z(B*0qK@_7E#1KSaFg#BopYg^wZ5Z2h!_F;NfAr=Z3pelCdMpUS7aPqemU3{g`v!Wo zVKalZmR2b}^NZgfe#iX}{dMB+|2|2zMgZp+o|ceOAmgiUdqJhz!l`l{hn}1Fe)Y(a zna_M=&&IEO;`;yOvg)6$z(j*mc3%~}y094;t+)}ojX!wcsmb3xb_7$U0`gf8LJ*8` zFt+^#08$XNlF%6mA`N34&MY?YouB;4Td34$@BZR@ou}lX*g8W*Vi1tm2xx%8WSu4F z96V1!D~TwwU@)dj1zb5j!G)X$=NL=%fR4Rz2F+Fk-&c@QAfNSMjKz;1dRlJTJhA;t zx4*s2u{lms4ouN&BkN!W7-StIiYz1vT)$(pyJi3OVAnMpmo^l2EuT@bb4<<1`Tspx zpZwYH=Efg==9q*O5JXT)BI7ac`^A&qP1kL`dUi|Ulyfc=LX1QvvSJ=RsAZjVzOS)& z*H-@W9eb-cyme|mr{a^w#Pu+0#$l70NN~ZEbkmOU%$~Qrcl$SfsIUIjqt7belOO<| zmN-*s;*n>bFTHu|u1RCeNg=#d1#PYEeiM6?6-@{tL)Mz|S3kM$^p+{VGMVKU%H?up ziKSIq!_VZQlwu(StaYeVgK(;(4u9&lU1NXw`|-`SdJCSG5Tc!x%pE)BgJ{ec^OBSr zqaf;`do&R!HY~Kn!c9A;pD33r!D6-LGPxpUG8xudvk(HZ?YGR#BA?HR*u?c6*GyGQ z#q8$FQUksx0T7IJIJr=h0QuHfV$TsEc{TmHQyuojI##pj5`xHDiffG^6v|hVlUb5d zvQo-*-i7aakIqRcp`_r@3IKdw1BM95dJ63hjayZbbRhRd(SxdLrIh6RzDzEvyYS+6 z17l{J&t)?Q54}{V)B-3a+VPYfln~f5J#OMS4hAtNxMm8L^OY?+U9n|fmR5pD%5A?q zaCoY`*g!7ZZi6@mgcNw&>~s)^L8CMAx!RC>QT5tu{1ePrAy<0fz>zmTbYM>VTAsZ$ zVPtU4l^d{c=S;a3gjJ~&My1arR`TdUt9rRo9Y9>nWhM_i{rq*`{?VUHK^Q|y0RmvH zLl_&}`Jvrm(YOC&Ad*sIHRn%y4TNh((F}kDOtFxecuaMVB&*ckHO1ZAF+ErV9v5ryjXeEX9eXsQ39}jQ;<)7v# zmpNDIg^|Vn>#lNlfBvQu$n9X(N= zI&^d%V>$2aFJ>I$b06E&oZXWBU$qg`CMQcGm(8%0l1K5a!=5~Ph%cN;kbe10WBkQa zRb(?7l&E=j+eW-|*XC38YW-B9P(&`5byBKfHCn>Xye5&2&FZaAP9nl)!I{@r=^r~Xj`w>I%Cv>Arld0 zGnonPjg7Hm=bR%Dh@G=x7%!3#5i^hS*xkh`dJuhsR|B2(J^x?NSN8t=_lGv*vz{d| zg3w}i+Z28H-EVq^T>KmZ5K@viW}%%T$rSBeuo9lC$*`fPo>Mn`ykOYfX>sghqqgnc>wmIlNA1i~~Jj!H00 z72Ur)I#u+jC^}VjZ~czGfKFjwI-j2AqmxfSPjl!C*mc_A{g~@u0A#HtW)1*&MC6hK zmv$YqCm}@37}N8yf|WoEW~Qa3r7MW&Og^6vnAtk#Vq**s;xNvru4=VfT3A@PN-1^e zidIUMopbp(j!TtF<(;)!ElB#m+)I6bIoop-MY%8xb+K3k5gBH-Xbd!AH`(m+}z2lBMZfE9q zC4o~USIppo8@jAV)=DXq%jLO;AAb1BTCGL^VgQQ(mH;#pm9Gq%h;#zf2T%myC7?rG zaG#O&2s*KfaR3__-Ck_g(YZ@b zE!h@+auw5c{;~<5unRO_Y#tpae;NQStce3g17EHSwtc;zZP!&xtHb44bu5)H);hYc x7, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-10-12 09:53+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: elm_webview_sample.c:24 +msgid "Application template" +msgstr "" + +#: elm_webview_sample.c:25 +msgid "Click to exit" +msgstr "" diff --git a/samples/elm_webview_sample/po/en_GB.po b/samples/elm_webview_sample/po/en_GB.po new file mode 100644 index 0000000..16f210b --- /dev/null +++ b/samples/elm_webview_sample/po/en_GB.po @@ -0,0 +1,25 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-10-12 09:53+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: elm_webview_sample.c:24 +msgid "Application template" +msgstr "" + +#: elm_webview_sample.c:25 +msgid "Click to exit" +msgstr "" diff --git a/samples/elm_webview_sample/po/en_US.po b/samples/elm_webview_sample/po/en_US.po new file mode 100644 index 0000000..16f210b --- /dev/null +++ b/samples/elm_webview_sample/po/en_US.po @@ -0,0 +1,25 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-10-12 09:53+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: elm_webview_sample.c:24 +msgid "Application template" +msgstr "" + +#: elm_webview_sample.c:25 +msgid "Click to exit" +msgstr "" diff --git a/samples/elm_webview_sample/po/ja.po b/samples/elm_webview_sample/po/ja.po new file mode 100644 index 0000000..16f210b --- /dev/null +++ b/samples/elm_webview_sample/po/ja.po @@ -0,0 +1,25 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-10-12 09:53+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: elm_webview_sample.c:24 +msgid "Application template" +msgstr "" + +#: elm_webview_sample.c:25 +msgid "Click to exit" +msgstr "" diff --git a/samples/elm_webview_sample/po/ko.po b/samples/elm_webview_sample/po/ko.po new file mode 100644 index 0000000..16f210b --- /dev/null +++ b/samples/elm_webview_sample/po/ko.po @@ -0,0 +1,25 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-10-12 09:53+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: elm_webview_sample.c:24 +msgid "Application template" +msgstr "" + +#: elm_webview_sample.c:25 +msgid "Click to exit" +msgstr "" diff --git a/samples/elm_webview_sample/po/update-po.sh b/samples/elm_webview_sample/po/update-po.sh new file mode 100755 index 0000000..6457c5a --- /dev/null +++ b/samples/elm_webview_sample/po/update-po.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +PACKAGE=elm_webview_sample +SRCROOT=.. +POTFILES=POTFILES.in + +#ALL_LINGUAS= am az be ca cs da de el en_CA en_GB es et fi fr hr hu it ja ko lv mk ml ms nb ne nl pa pl pt pt_BR ru rw sk sl sr sr@Latn sv ta tr uk vi zh_CN zh_TW +ALL_LINGUAS="en_US en_GB ja ko zh_CN" + +XGETTEXT=/usr/bin/xgettext +MSGMERGE=/usr/bin/msgmerge + +echo -n "Make ${PACKAGE}.pot " +if [ ! -e $POTFILES ] ; then + echo "$POTFILES not found" + exit 1 +fi + +$XGETTEXT --default-domain=${PACKAGE} --directory=${SRCROOT} \ + --add-comments --keyword=_ --keyword=N_ --files-from=$POTFILES +if [ $? -ne 0 ]; then + echo "xgettext error" + exit 1 +fi + +if [ ! -f ${PACKAGE}.po ]; then + echo "No such file: ${PACKAGE}.po" + exit 1 +fi + +rm -f ${PACKAGE}.pot && mv ${PACKAGE}.po ${PACKAGE}.pot +echo "done" + +for LANG in $ALL_LINGUAS; do + echo "$LANG : " + + if [ ! -e $LANG.po ] ; then + sed 's/CHARSET/UTF-8/g' ${PACKAGE}.pot > ${LANG}.po + echo "${LANG}.po created" + else + if $MSGMERGE ${LANG}.po ${PACKAGE}.pot -o ${LANG}.new.po ; then + if cmp ${LANG}.po ${LANG}.new.po > /dev/null 2>&1; then + rm -f ${LANG}.new.po + else + if mv -f ${LANG}.new.po ${LANG}.po; then + echo "" + else + echo "msgmerge for $LANG.po failed: cannot move $LANG.new.po to $LANG.po" 1>&2 + rm -f ${LANG}.new.po + exit 1 + fi + fi + else + echo "msgmerge for $LANG failed!" + rm -f ${LANG}.new.po + fi + fi + echo "" +done + diff --git a/samples/elm_webview_sample/po/zh_CN.po b/samples/elm_webview_sample/po/zh_CN.po new file mode 100644 index 0000000..16f210b --- /dev/null +++ b/samples/elm_webview_sample/po/zh_CN.po @@ -0,0 +1,25 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-10-12 09:53+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: elm_webview_sample.c:24 +msgid "Application template" +msgstr "" + +#: elm_webview_sample.c:25 +msgid "Click to exit" +msgstr "" diff --git a/touch_processor/els_touch.c b/touch_processor/els_touch.c new file mode 100755 index 0000000..6eda216 --- /dev/null +++ b/touch_processor/els_touch.c @@ -0,0 +1,2116 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include "els_touch.h" +#include "../log.h" + +static const char SMART_NAME[] = "els_touch"; +#define API_ENTRY Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (EINA_UNLIKELY((!sd) || strncmp(evas_object_type_get(obj), SMART_NAME, strlen(SMART_NAME)))) +#define INTERNAL_ENTRY Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd) return; + +// TAP and PRESS threshold time (ms) +#define TAP_TIME 250 // ms + +// default frame rate for animator +#define DEFAULT_FRAMERATE 60 + +// number of max touch fingers +#define N_FINGER 3 + +///////////////////////////////// +// for one finger +///////////////////////////////// +// double tap distance. double tap distance should be smaller than this +#define DOUBLE_TAP_DISTANCE 30 // pixel + +///////////////////////////////// +// for two finger +///////////////////////////////// +#define TWO_MOVE_THRESHOLD 15 +#define FINGER_DISTANCE 10 + +#define MOUSEEVENT_FINGER_INDEX 0 +#define MULTIEVENT_FINGER_INDEX 1 + +// touch state +typedef enum _Touch_State +{ + TOUCH_STATE_NONE, + TOUCH_STATE_DOWN, + TOUCH_STATE_DOWN_DURING_DRAG, + TOUCH_STATE_DOWN_UP, + TOUCH_STATE_DOWN_UP_DOWN, + TOUCH_STATE_LONG_PRESS, + TOUCH_STATE_LONG_PRESS_DRAG, + TOUCH_STATE_DRAG, + TOUCH_STATE_TWO_DOWN, + TOUCH_STATE_TWO_DOWN_DURING_DRAG, + TOUCH_STATE_TWO_DOWN_UP, + TOUCH_STATE_TWO_DOWN_UP_DOWN, + TOUCH_STATE_TWO_DRAG, + TOUCH_STATE_TWO_DRAG_ONE_UP, + TOUCH_STATE_THREE_DOWN +} Touch_State; + +// one drag mode to fix the drag direction +typedef enum _One_Drag_Mode +{ + ONE_DRAG_NONE, + ONE_DRAG_VERTICAL, + ONE_DRAG_HORIZONTAL +} One_Drag_Mode; + +typedef struct _Smart_Data Smart_Data; +struct _Smart_Data +{ + // objects + Evas_Object *smart_obj; + Evas_Object *child_obj; + + Eina_Bool is_running; + + Touch_State state; + One_Drag_Mode one_drag_mode; + Eina_Bool is_one_drag_mode; + int numOfTouch; + + // touch points + Touch_Point first_down[N_FINGER]; + Touch_Point last_down[N_FINGER]; + Touch_Point last_drag[N_FINGER]; + int released_finger_index; + + // animators + Ecore_Animator *animator_move; + Ecore_Animator *animator_two_move; + Ecore_Animator *animator_long_press_move; + + // finger timers + Ecore_Timer *tap_timer; + Ecore_Timer *long_press_timer; + Ecore_Timer *two_tap_timer; +}; + +/* local subsystem functions */ +// mouse callbacks +static void _smart_mouse_down(void *data, Evas *e, Evas_Object *obj, void *ev); +static void _smart_mouse_up(void *data, Evas *e, Evas_Object *obj, void *ev); +static void _smart_mouse_move(void *data, Evas *e, Evas_Object *obj, void *ev); +static void _smart_multi_down(void *data, Evas *e, Evas_Object *obj, void *ev); +static void _smart_multi_up(void *data, Evas *e, Evas_Object *obj, void *ev); +static void _smart_multi_move(void *data, Evas *e, Evas_Object *obj, void *ev); +// animator callbacks +static Eina_Bool _smart_animation_move(void *data); +static Eina_Bool _smart_animation_two_move(void *data); +static Eina_Bool _smart_animation_long_press_move(void *data); +// enter mode functions +static void _smart_enter_none(Smart_Data *sd); +static void _smart_enter_down(Smart_Data *sd); +static void _smart_enter_down_during_drag(Smart_Data *sd); +static void _smart_enter_down_up(Smart_Data *sd, int downTime, int time); +static void _smart_enter_down_up_down(Smart_Data *sd); +static void _smart_enter_long_press(Smart_Data *sd); +static void _smart_enter_long_press_drag(Smart_Data *sd); +static void _smart_enter_drag(Smart_Data *sd); +static void _smart_enter_two_down(Smart_Data *sd); +static void _smart_enter_two_down_during_drag(Smart_Data *sd); +static void _smart_enter_two_down_up(Smart_Data *sd, int downTime, int time); +static void _smart_enter_two_down_up_down(Smart_Data *sd); +static void _smart_enter_two_drag(Smart_Data *sd); +static void _smart_enter_two_drag_one_up(Smart_Data *sd); +static void _smart_enter_three_down(Smart_Data *sd); +// emit functions +static void _smart_emit_press(Smart_Data *sd); +static void _smart_emit_donw_up_down(Smart_Data *sd); +static void _smart_emit_tap(Smart_Data *sd); +static void _smart_emit_double_tap(Smart_Data *sd); +static void _smart_emit_long_press(Smart_Data *sd); +static void _smart_emit_long_press_move_start(Smart_Data *sd); +static void _smart_emit_long_press_move(Smart_Data *sd); +static void _smart_emit_long_press_move_end(Smart_Data *sd); +static void _smart_emit_release(Smart_Data *sd); +static void _smart_emit_two_press(Smart_Data *sd); +static void _smart_emit_two_release(Smart_Data *sd); +static void _smart_emit_two_tap(Smart_Data *sd); +static void _smart_emit_two_double_tap(Smart_Data *sd); +static void _smart_emit_two_move_start(Smart_Data *sd); +static void _smart_emit_two_move(Smart_Data *sd); +static void _smart_emit_two_move_end(Smart_Data *sd); +static void _smart_emit_three_press(Smart_Data *sd); +static void _smart_emit_three_tap(Smart_Data *sd); +// timer handlers +static Eina_Bool _smart_tap_timer_handler(void *data); +static Eina_Bool _smart_long_press_timer_handler(void *data); +static Eina_Bool _smart_two_tap_timer_handler(void *data); +static void _smart_stop_animator_move(Smart_Data *sd); +static void _smart_stop_animator_two_move(Smart_Data *sd); +static void _smart_stop_animator_long_press_move(Smart_Data *sd); +static void _smart_set_first_down(Smart_Data *sd, int index, Touch_Point *data); +static void _smart_set_last_down(Smart_Data *sd, int index, Touch_Point *data); +static void _smart_set_last_drag(Smart_Data *sd, int index, Touch_Point *data); +static void _smart_stop_all_timers(Smart_Data *sd); +static void _smart_stop_all_animator(Smart_Data *sd); +static void _smart_init(void); +static void _smart_del(Evas_Object *obj); +static void _smart_add(Evas_Object *obj); + +/* local subsystem globals */ +static Evas_Smart *_smart = NULL; + +/* externally accessible functions */ +/** + * @fn Evas_Object *_elm_smart_touch_add(Evas *evas) + * @brief create els_touch + * + * @param[in] evas evas to add new Evas_Object + * @return created Evas_Object * + */ +Evas_Object * +_elm_smart_touch_add(Evas *evas) +{ + _smart_init(); + return evas_object_smart_add(evas, _smart); +} + +/** + * @fn void _elm_smart_touch_child_set(Evas_Object *obj, Evas_Object *child) + * @brief set the child Evas_Object to get the mouse event + * + * @param[in] obj touch Evas_Object + * @param[in] child child Evas_Object to get the mouse event + */ +void +_elm_smart_touch_child_set(Evas_Object *obj, Evas_Object *child) +{ + API_ENTRY return; + if (child == sd->child_obj) return; + + if (sd->child_obj) // delete callbacks of old object + { + evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_MOUSE_DOWN, _smart_mouse_down); + evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_MOUSE_UP, _smart_mouse_up); + evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_MOUSE_MOVE, _smart_mouse_move); + evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_MULTI_DOWN, _smart_multi_down); + evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_MULTI_UP, _smart_multi_up); + evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_MULTI_MOVE, _smart_multi_move); + _smart_stop_all_timers(sd); + _smart_stop_animator_move(sd); + _smart_stop_animator_two_move(sd); + _smart_stop_animator_long_press_move(sd); + + sd->child_obj = NULL; + } + + if (child) + { + sd->child_obj = child; + + // add callbacks + evas_object_event_callback_add(child, EVAS_CALLBACK_MOUSE_DOWN, _smart_mouse_down, sd); + evas_object_event_callback_add(child, EVAS_CALLBACK_MOUSE_UP, _smart_mouse_up, sd); + evas_object_event_callback_add(child, EVAS_CALLBACK_MOUSE_MOVE, _smart_mouse_move, sd); + evas_object_event_callback_add(child, EVAS_CALLBACK_MULTI_DOWN, _smart_multi_down, sd); + evas_object_event_callback_add(child, EVAS_CALLBACK_MULTI_UP, _smart_multi_up, sd); + evas_object_event_callback_add(child, EVAS_CALLBACK_MULTI_MOVE, _smart_multi_move, sd); + + _smart_enter_none(sd); + + sd->is_one_drag_mode = EINA_FALSE; + } + + evas_object_smart_callback_call(sd->smart_obj, "changed", NULL); +} + +/** + * @fn void _elm_smart_touch_start(Evas_Object *obj) + * @brief start touch processor + * + * @param[in] obj touch Evas_Object + */ +void +_elm_smart_touch_start(Evas_Object *obj) +{ + API_ENTRY return; + if (sd->is_running) return; + + sd->is_running = EINA_TRUE; + _smart_enter_none(sd); +} + +/** + * @fn void _elm_smart_touch_stop(Evas_Object *obj) + * @brief stop touch processor + * + * @param[in] obj touch Evas_Object + */ +void +_elm_smart_touch_stop(Evas_Object *obj) +{ + API_ENTRY return; + sd->is_running = EINA_FALSE; + _smart_stop_all_timers(sd); + _smart_stop_animator_move(sd); + _smart_stop_animator_two_move(sd); + _smart_stop_animator_long_press_move(sd); + _smart_enter_none(sd); +} + +/** + * @fn void _elm_smart_touch_reset(Evas_Object *obj) + * @brief reset touch processor + * + * @param[in] obj touch Evas_Object + */ +void +_elm_smart_touch_reset(Evas_Object *obj) +{ + API_ENTRY return; + _smart_stop_all_timers(sd); + _smart_stop_animator_move(sd); + _smart_stop_animator_two_move(sd); + _smart_stop_animator_long_press_move(sd); + _smart_enter_none(sd); +} + +/** + * @fn void _elm_smart_touch_is_one_drag_mode_enable(Evas_Object *obj, Eina_Bool is_one_drag_mode) + * @brief enable one drag mode touch processor + * + * @param[in] obj touch Evas_Object + * @param[in] is_one_drag_mode EINA_TRUE to enable one drag mode, EINA_FALSE otherwise + */ +void +_elm_smart_touch_is_one_drag_mode_enable(Evas_Object *obj, Eina_Bool is_one_drag_mode) +{ + API_ENTRY return; + sd->is_one_drag_mode = is_one_drag_mode; +} + +/* mouse callbacks */ +/** + * @fn static void _smart_mouse_down(void *data, Evas *e, Evas_Object *obj, void *ev) + * @brief MOUSE_DOWN callback + * + * @param[in] data data which is set by user + * @param[in] evas evas of event object + * @param[in] obj Evas_Object which occur the event + * @param[in] ev event info + */ +static void +_smart_mouse_down(void *data, Evas *e, Evas_Object *obj, void *ev) +{ + Smart_Data * sd = data; + Evas_Event_Mouse_Down *event; + Touch_Point touch_point; + + if (!sd || sd->is_running == EINA_FALSE) return; + + event = (Evas_Event_Mouse_Down *)ev; + ELM_WEBVIEW_SLOGD("[%d]\n", event->flags); + + touch_point.device = 0; + touch_point.x = event->canvas.x; + touch_point.y = event->canvas.y; + touch_point.time = event->timestamp; + touch_point.state = TOUCH_POINT_PRESSED; + + switch (sd->state) + { + case TOUCH_STATE_NONE: + _smart_set_first_down(sd, 0, &touch_point); + _smart_set_last_down(sd, 0, &touch_point); + _smart_set_last_drag(sd, 0, &touch_point); + _smart_enter_down(sd); + break; + + case TOUCH_STATE_DRAG: + _smart_set_first_down(sd, 0, &touch_point); + _smart_set_last_down(sd, 0, &touch_point); + _smart_set_last_drag(sd, 0, &touch_point); + if (sd->animator_move) + { + ecore_animator_del(sd->animator_move); + sd->animator_move = NULL; + } + _smart_enter_down_during_drag(sd); + break; + + case TOUCH_STATE_DOWN_UP: + // process the double down + _smart_set_last_down(sd, 0, &touch_point); + _smart_set_last_drag(sd, 0, &touch_point); + _smart_enter_down_up_down(sd); + break; + + case TOUCH_STATE_TWO_DRAG_ONE_UP: + _smart_set_last_drag(sd, 0, &touch_point); + _smart_enter_two_drag(sd); + break; + + default: + break; + } +} + +/** + * @fn static void _smart_mouse_up(void *data, Evas *e, Evas_Object *obj, void *ev) + * @brief MOUSE_UP callback + * + * @param[in] data data which is set by user + * @param[in] evas evas of event object + * @param[in] obj Evas_Object which occur the event + * @param[in] ev event info + */ +static void +_smart_mouse_up(void *data, Evas *e, Evas_Object *obj, void *ev) +{ + Smart_Data *sd = data; + Evas_Event_Mouse_Up *event; + + if (!sd || sd->is_running == EINA_FALSE) return; + + event = (Evas_Event_Mouse_Up*)ev; + ELM_WEBVIEW_SLOGD("[%d]\n", event->flags); + + sd->first_down[0].state = TOUCH_POINT_RELEASED; + sd->last_down[0].state = TOUCH_POINT_RELEASED; + sd->last_drag[0].state = TOUCH_POINT_RELEASED; + + switch (sd->state) + { + case TOUCH_STATE_DOWN: + _smart_stop_animator_move(sd); + _smart_enter_down_up(sd, (event->timestamp - sd->last_down[0].time), event->timestamp); + break; + + case TOUCH_STATE_DOWN_DURING_DRAG: + { + Evas_Point point; + point.x = sd->last_drag[0].x; + point.y = sd->last_drag[0].y; + evas_object_smart_callback_call(sd->child_obj, "one,move,end", &point); + // we have to send 'one,flick,end' because we will not run the flick animator + evas_object_smart_callback_call(sd->child_obj, "one,flick,end", &point); + _smart_enter_down_up(sd, (event->timestamp - sd->last_down[0].time), event->timestamp); + } break; + + case TOUCH_STATE_DOWN_UP_DOWN: + { + int dx = sd->last_down[0].x - sd->first_down[0].x; + int dy = sd->last_down[0].y - sd->first_down[0].y; + if ((dx * dx + dy * dy) <= (DOUBLE_TAP_DISTANCE * DOUBLE_TAP_DISTANCE)) + _smart_emit_double_tap(sd); + _smart_stop_all_timers(sd); + _smart_enter_none(sd); + } break; + + case TOUCH_STATE_LONG_PRESS: + _smart_emit_release(sd); + _smart_stop_all_timers(sd); + _smart_enter_none(sd); + break; + + case TOUCH_STATE_LONG_PRESS_DRAG: + _smart_stop_animator_long_press_move(sd); + _smart_stop_all_timers(sd); + _smart_enter_none(sd); + break; + + case TOUCH_STATE_DRAG: + { + Evas_Point point; + point.x = sd->last_drag[0].x; + point.y = sd->last_drag[0].y; + evas_object_smart_callback_call(sd->child_obj, "one,move,end", &point); + evas_object_smart_callback_call(sd->child_obj, "pan,end", &point); + _smart_stop_all_animator(sd); + _smart_stop_all_timers(sd); + _smart_enter_none(sd); + } + break; + + case TOUCH_STATE_TWO_DOWN: + sd->numOfTouch = 0; + _smart_enter_two_down_up(sd, (event->timestamp - sd->last_down[1].time), event->timestamp); + break; + + case TOUCH_STATE_TWO_DOWN_UP: + break; + + case TOUCH_STATE_TWO_DOWN_UP_DOWN: + { + int dx = sd->last_down[0].x - sd->first_down[0].x; + int dy = sd->last_down[0].y - sd->first_down[0].y; + if ((dx * dx + dy * dy) <= (DOUBLE_TAP_DISTANCE * DOUBLE_TAP_DISTANCE)) + _smart_emit_two_double_tap(sd); + _smart_stop_all_timers(sd); + _smart_enter_none(sd); + } break; + + case TOUCH_STATE_TWO_DRAG: + sd->released_finger_index = MOUSEEVENT_FINGER_INDEX; + _smart_stop_animator_two_move(sd); + _smart_stop_all_timers(sd); + _smart_enter_two_drag_one_up(sd); + break; + + case TOUCH_STATE_TWO_DRAG_ONE_UP: + sd->released_finger_index = MOUSEEVENT_FINGER_INDEX; + _smart_stop_animator_two_move(sd); + _smart_stop_all_timers(sd); + _smart_emit_two_release(sd); + _smart_enter_none(sd); + break; + + case TOUCH_STATE_THREE_DOWN: + _smart_emit_three_tap(sd); + _smart_stop_all_timers(sd); + _smart_enter_none(sd); + break; + + default: + _smart_emit_release(sd); + _smart_stop_all_animator(sd); + _smart_stop_all_timers(sd); + _smart_enter_none(sd); + ELM_WEBVIEW_SLOGD("\nERROR: wrong state in mouse_up\n\n"); + break; + } + +} + +/** + * @fn static void _smart_mouse_move(void *data, Evas *e, Evas_Object *obj, void *ev) + * @brief MOUSE_MOVE callback + * + * @param[in] data data which is set by user + * @param[in] evas evas of event object + * @param[in] obj Evas_Object which occur the event + * @param[in] ev event info + */ +static void +_smart_mouse_move(void *data, Evas *e, Evas_Object *obj, void *ev) +{ + Smart_Data *sd = data; + if (!sd || sd->is_running == EINA_FALSE) return; + + ELM_WEBVIEW_SLOGD("\n"); + + Evas_Event_Mouse_Move *event = (Evas_Event_Mouse_Move*)ev; + int dx = 0; + int dy = 0; + int thumbscroll_threshold = 0; + + Touch_Point touch_point; + touch_point.x = event->cur.canvas.x; + touch_point.y = event->cur.canvas.y; + touch_point.time = event->timestamp; + touch_point.device = 0; + touch_point.state = TOUCH_POINT_MOVED; + + switch (sd->state) + { + case TOUCH_STATE_DOWN: + case TOUCH_STATE_DOWN_DURING_DRAG: + dx = touch_point.x - sd->last_drag[0].x; + dy = touch_point.y - sd->last_drag[0].y; + + _smart_set_last_down(sd, 0, &touch_point); + + thumbscroll_threshold = (int) elm_scroll_thumbscroll_threshold_get(); + if (((dx * dx) + (dy * dy)) > + (thumbscroll_threshold * thumbscroll_threshold)) + { + if (sd->animator_move) + { + ecore_animator_del(sd->animator_move); + sd->animator_move = NULL; + } + sd->first_down[0].state = TOUCH_POINT_MOVED; + sd->last_down[0].state = TOUCH_POINT_MOVED; + sd->last_drag[0].state = TOUCH_POINT_MOVED; + + _smart_set_last_drag(sd, 0, &touch_point); + // Note: + // last_down - location where the drag starts + // (which is different than fisrtDown) + _smart_enter_drag(sd); + } + break; + + case TOUCH_STATE_DRAG: + dx = touch_point.x - sd->last_drag[0].x; + dy = touch_point.y - sd->last_drag[0].y; + _smart_set_last_drag(sd, 0, &touch_point); + break; + + case TOUCH_STATE_TWO_DOWN: + dx = touch_point.x - sd->last_drag[0].x; + dy = touch_point.y - sd->last_drag[0].y; + + thumbscroll_threshold = (int) elm_scroll_thumbscroll_threshold_get(); + if (((dx * dx) + (dy * dy)) > + (thumbscroll_threshold * thumbscroll_threshold)) + { + _smart_set_last_drag(sd, 0, &touch_point); + + // TODO: check moved only + Two_Drag_Mode mode = two_drag_mode_get(sd->first_down, sd->last_drag); + if (mode != TWO_DRAG_NONE) + { + ELM_WEBVIEW_SLOGD("<< mode [%d] >>\n", mode); + sd->first_down[0].state = TOUCH_POINT_MOVED; + sd->last_down[0].state = TOUCH_POINT_MOVED; + sd->last_drag[0].state = TOUCH_POINT_MOVED; + + _smart_enter_two_drag(sd); + } + } + break; + + case TOUCH_STATE_TWO_DRAG: + _smart_set_last_drag(sd, 0, &touch_point); + break; + + case TOUCH_STATE_THREE_DOWN: + _smart_set_last_drag(sd, 0, &touch_point); + break; + + case TOUCH_STATE_LONG_PRESS: + dx = touch_point.x - sd->last_drag[0].x; + dy = touch_point.y - sd->last_drag[0].y; + + thumbscroll_threshold = (int) elm_scroll_thumbscroll_threshold_get(); + if (((dx * dx) + (dy * dy)) > + (thumbscroll_threshold * thumbscroll_threshold)) + { + _smart_set_last_drag(sd, 0, &touch_point); + // Note: + // last_down - location where the drag starts + // (which is different than fisrtDown) + _smart_set_last_down(sd, 0, &touch_point); + sd->first_down[0].state = TOUCH_POINT_MOVED; + sd->last_down[0].state = TOUCH_POINT_MOVED; + sd->last_drag[0].state = TOUCH_POINT_MOVED; + + _smart_enter_long_press_drag(sd); + } + break; + + case TOUCH_STATE_LONG_PRESS_DRAG: + _smart_set_last_drag(sd, 0, &touch_point); + break; + + default: + break; + } +} + +/** + * @fn static void _smart_multi_down(void *data, Evas *e, Evas_Object *obj, void *ev) + * @brief MULTI_MOVE callback + * + * @param[in] data data which is set by user + * @param[in] evas evas of event object + * @param[in] obj Evas_Object which occur the event + * @param[in] ev event info + */ +static void +_smart_multi_down(void *data, Evas *e, Evas_Object *obj, void *ev) +{ + Smart_Data *sd; + + sd = data; + if (!sd || !sd->is_running) return; + + ELM_WEBVIEW_SLOGD("\n"); + + Evas_Event_Multi_Down *event = (Evas_Event_Multi_Down*)ev; + Touch_Point touch_point; + + switch (sd->state) + { + case TOUCH_STATE_DOWN: + sd->numOfTouch++; + if (sd->numOfTouch == 1) + { + touch_point.x = event->output.x; + touch_point.y = event->output.y; + touch_point.time = event->timestamp; + touch_point.device = event->device; + touch_point.state = TOUCH_POINT_PRESSED; + _smart_set_first_down(sd, 1, &touch_point); + _smart_set_last_down(sd, 1, &touch_point); + _smart_set_last_drag(sd, 1, &touch_point); + _smart_stop_animator_move(sd); + _smart_stop_animator_two_move(sd); + _smart_stop_animator_long_press_move(sd); + _smart_enter_two_down(sd); + } + break; + + case TOUCH_STATE_TWO_DOWN_UP: + sd->numOfTouch++; + if (sd->numOfTouch == 1) + { + touch_point.x = event->output.x; + touch_point.y = event->output.y; + touch_point.time = event->timestamp; + touch_point.device = event->device; + touch_point.state = TOUCH_POINT_PRESSED; + _smart_set_last_down(sd, 1, &touch_point); + _smart_set_last_drag(sd, 1, &touch_point); + _smart_stop_animator_move(sd); + _smart_stop_animator_two_move(sd); + _smart_stop_animator_long_press_move(sd); + _smart_enter_two_down_up_down(sd); + } + break; + + case TOUCH_STATE_DOWN_DURING_DRAG: + case TOUCH_STATE_DRAG: + sd->numOfTouch++; + if (sd->numOfTouch == 1) + { + touch_point.x = event->output.x; + touch_point.y = event->output.y; + touch_point.time = event->timestamp; + touch_point.device = event->device; + touch_point.state = TOUCH_POINT_PRESSED; + _smart_set_first_down(sd, 1, &touch_point); + _smart_set_last_down(sd, 1, &touch_point); + _smart_set_last_drag(sd, 1, &touch_point); + if (sd->animator_move) + { + ecore_animator_del(sd->animator_move); + sd->animator_move = NULL; + } + if (sd->animator_two_move) + { + ecore_animator_del(sd->animator_two_move); + sd->animator_two_move = NULL; + } + _smart_enter_two_down_during_drag(sd); + } + break; + + case TOUCH_STATE_TWO_DOWN: + case TOUCH_STATE_TWO_DRAG: + sd->numOfTouch++; + if (sd->numOfTouch == 2) + { + touch_point.x = event->output.x; + touch_point.y = event->output.y; + touch_point.time = event->timestamp; + touch_point.device = event->device; + touch_point.state = TOUCH_POINT_PRESSED; + _smart_set_first_down(sd, 2, &touch_point); + _smart_set_last_down(sd, 2, &touch_point); + _smart_set_last_drag(sd, 2, &touch_point); + _smart_stop_animator_move(sd); + _smart_stop_animator_two_move(sd); + _smart_stop_animator_long_press_move(sd); + _smart_enter_three_down(sd); + } + break; + + case TOUCH_STATE_TWO_DRAG_ONE_UP: + sd->numOfTouch++; + if (sd->numOfTouch == 1) + { + touch_point.x = event->output.x; + touch_point.y = event->output.y; + touch_point.time = event->timestamp; + touch_point.device = event->device; + touch_point.state = TOUCH_POINT_PRESSED; + _smart_set_last_drag(sd, 1, &touch_point); + _smart_enter_two_drag(sd); + } + break; + + default: + break; + } +} + +/** + * @fn static void _smart_multi_up(void *data, Evas *e, Evas_Object *obj, void *ev) + * @brief MULTI_UP callback + * + * @param[in] data data which is set by user + * @param[in] evas evas of event object + * @param[in] obj Evas_Object which occur the event + * @param[in] ev event info + */ +static void +_smart_multi_up(void *data, Evas *e, Evas_Object *obj, void *ev) +{ + Smart_Data *sd = data; + Evas_Event_Multi_Up *event; + int point_idx; + + if (!sd || !sd->is_running) return; + + ELM_WEBVIEW_SLOGD("\n"); + + event = (Evas_Event_Multi_Up*)ev; + + for (point_idx = 1; point_idx < N_FINGER; ++point_idx) + { + if (event->device == sd->first_down[1].device) + { + sd->first_down[point_idx].state = TOUCH_POINT_RELEASED; + sd->last_down[point_idx].state = TOUCH_POINT_RELEASED; + sd->last_drag[point_idx].state = TOUCH_POINT_RELEASED; + break; + } + } + + switch (sd->state) + { + case TOUCH_STATE_TWO_DOWN: + sd->numOfTouch = 0; + _smart_enter_two_down_up(sd, (event->timestamp - sd->last_down[1].time), event->timestamp); + break; + + case TOUCH_STATE_TWO_DOWN_UP: + case TOUCH_STATE_TWO_DOWN_UP_DOWN: + break; + + case TOUCH_STATE_TWO_DOWN_DURING_DRAG: + { + Evas_Point point; + point.x = sd->last_drag[0].x; + point.y = sd->last_drag[0].y; + evas_object_smart_callback_call(sd->child_obj, "one,move,end", &point); + _smart_emit_two_tap(sd); + _smart_stop_all_timers(sd); + _smart_enter_none(sd); + } break; + + case TOUCH_STATE_TWO_DRAG: + sd->numOfTouch--; + if (sd->numOfTouch == 0) + { + sd->released_finger_index = MULTIEVENT_FINGER_INDEX; + _smart_stop_animator_two_move(sd); + _smart_stop_all_timers(sd); + _smart_enter_two_drag_one_up(sd); + } + break; + + case TOUCH_STATE_TWO_DRAG_ONE_UP: + sd->released_finger_index = MULTIEVENT_FINGER_INDEX; + _smart_stop_animator_two_move(sd); + _smart_stop_all_timers(sd); + _smart_emit_two_release(sd); + _smart_enter_none(sd); + break; + + case TOUCH_STATE_THREE_DOWN: + _smart_emit_three_tap(sd); + _smart_stop_all_timers(sd); + _smart_enter_none(sd); + break; + + default: + _smart_stop_all_animator(sd); + _smart_stop_all_timers(sd); + _smart_enter_none(sd); + break; + } +} + +/** + * @fn static void _smart_multi_move(void *data, Evas *e, Evas_Object *obj, void *ev) + * @brief MULTI_MOVE callback + * + * @param[in] data data which is set by user + * @param[in] evas evas of event object + * @param[in] obj Evas_Object which occur the event + * @param[in] ev event info + */ +static void +_smart_multi_move(void *data, Evas *e, Evas_Object *obj, void *ev) +{ + Smart_Data *sd = data; + Evas_Event_Multi_Move *event; + Touch_Point touch_point; + + if (!sd || !sd->is_running) return; + + ELM_WEBVIEW_SLOGD("\n"); + + event = (Evas_Event_Multi_Move*)ev; + touch_point.x = event->cur.output.x; + touch_point.y = event->cur.output.y; + touch_point.time = event->timestamp; + touch_point.device = event->device; + touch_point.state = TOUCH_POINT_MOVED; + + switch (sd->state) + { + case TOUCH_STATE_TWO_DOWN: + case TOUCH_STATE_TWO_DOWN_DURING_DRAG: + if (sd->first_down[1].device == event->device) + { + int dx = touch_point.x - sd->last_drag[0].x; + int dy = touch_point.y - sd->last_drag[0].y; + int thumbscroll_threshold = (int) elm_scroll_thumbscroll_threshold_get(); + + if (((dx * dx) + (dy * dy)) > + (thumbscroll_threshold * thumbscroll_threshold)) + { + _smart_set_last_drag(sd, 1, &touch_point); + // TODO: check moved only + Two_Drag_Mode mode = two_drag_mode_get(sd->first_down, sd->last_drag); + if (mode != TWO_DRAG_NONE) + { + ELM_WEBVIEW_SLOGD("<< mode [%d] >>\n", mode); + _smart_enter_two_drag(sd); + } + } + } + break; + + case TOUCH_STATE_TWO_DRAG: + if (sd->first_down[1].device == event->device) + { + _smart_set_last_drag(sd, 1, &touch_point); + } + break; + + case TOUCH_STATE_THREE_DOWN: + if (sd->first_down[1].device == event->device) + { + _smart_set_last_drag(sd, 1, &touch_point); + } + else if (sd->first_down[2].device == event->device) + { + _smart_set_last_drag(sd, 2, &touch_point); + } + break; + + default: + break; + } +} + +/* animators */ +/** + * @fn static Eina_Bool _smart_animation_move(void *data) + * @brief move animation callback + * + * @param[in] data data which is set by user + * return EINA_TRUE if you want to continue to animation, EINA_FALSE otherwise + */ +static Eina_Bool +_smart_animation_move(void *data) +{ + Smart_Data *sd; + + sd = data; + if (sd->child_obj) + { + Evas *evas = evas_object_evas_get(sd->child_obj); + Evas_Point point; + evas_pointer_canvas_xy_get(evas, &point.x, &point.y); + + if (sd->is_one_drag_mode) + { + if (sd->one_drag_mode == ONE_DRAG_VERTICAL) + { + // Note: + // first_down - location of mouse down + // last_down - location where the drag started + point.x = sd->last_down[0].x; + } + else if (sd->one_drag_mode == ONE_DRAG_HORIZONTAL) + { + point.y = sd->last_down[0].y; + } + } + evas_object_smart_callback_call(sd->child_obj, "one,move", &point); + return ECORE_CALLBACK_RENEW; + } + else + { + _smart_stop_animator_move(sd); + _smart_enter_none(sd); + return ECORE_CALLBACK_CANCEL; + } +} + +/** + * @fn static Eina_Bool _smart_animation_two_move(void *data) + * @brief two move animation callback + * + * @param[in] data data which is set by user + * return EINA_TRUE if you want to continue to animation, EINA_FALSE otherwise + */ +static Eina_Bool +_smart_animation_two_move(void *data) +{ + Smart_Data *sd; + + sd = data; + + if (sd->child_obj) + { + _smart_emit_two_move(sd); + return ECORE_CALLBACK_RENEW; + } + else + { + _smart_stop_animator_two_move(sd); + _smart_enter_none(sd); + return ECORE_CALLBACK_CANCEL; + } + +} + +/** + * @fn static Eina_Bool _smart_animation_long_press_move(void *data) + * @brief long press move animation callback + * + * @param[in] data data which is set by user + * return EINA_TRUE if you want to continue to animation, EINA_FALSE otherwise + */ +static Eina_Bool +_smart_animation_long_press_move(void *data) +{ + Smart_Data *sd; + + sd = data; + + if (sd->child_obj) + { + _smart_emit_long_press_move(sd); + return ECORE_CALLBACK_RENEW; + } + else + { + _smart_stop_animator_long_press_move(sd); + _smart_enter_none(sd); + return ECORE_CALLBACK_CANCEL; + } + +} + +/* state switching */ +/** + * @fn static void _smart_enter_none(Smart_Data *sd) + * @brief enter to the TOUCH_STATE_NONE state + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_enter_none(Smart_Data *sd) +{ + sd->numOfTouch = 0; + sd->state = TOUCH_STATE_NONE; + + // initialize released finger index as 0 + sd->released_finger_index = MOUSEEVENT_FINGER_INDEX; + + ELM_WEBVIEW_SLOGD("\nTOUCH_STATE_NONE\n"); +} + +/** + * @fn static void _smart_enter_down(Smart_Data *sd) + * @brief enter to the TOUCH_STATE_DOWN state + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_enter_down(Smart_Data *sd) +{ + _smart_emit_press(sd); + + // add long press timer + if (sd->long_press_timer) + ecore_timer_del(sd->long_press_timer); + sd->long_press_timer = ecore_timer_add(elm_longpress_timeout_get(), _smart_long_press_timer_handler, sd); + + // set state + sd->state = TOUCH_STATE_DOWN; + ELM_WEBVIEW_SLOGD("\nTOUCH_STATE_DOWN\n"); +} + +/** + * @fn static void _smart_enter_down_during_drag(Smart_Data *sd) + * @brief enter to the TOUCH_STATE_DOWN state + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_enter_down_during_drag(Smart_Data *sd) +{ + _smart_emit_press(sd); + sd->state = TOUCH_STATE_DOWN_DURING_DRAG; + ELM_WEBVIEW_SLOGD("\nTOUCH_STATE_DOWN_DURING_DRAG\n"); +} + +/** + * @fn static void _smart_enter_down_up(Smart_Data *sd, int downTime, int time) + * @brief enter to the TOUCH_STATE_DOWN_UP state + * + * @param[in] sd els_touch's Smart_Data + * @param[in] downTime duration of mouse down (mouse up time - mouse down time) + * @param[in] time mouse up's timestamp + */ +static void +_smart_enter_down_up(Smart_Data *sd, int downTime, int time) +{ + // delete long press timer + if (sd->long_press_timer) + { + ecore_timer_del(sd->long_press_timer); + sd->long_press_timer = NULL; + } + + int timerTime = TAP_TIME - downTime; + // if we have to wait for double tap, + // we set the timer and change the state to DOWN_UP + if (timerTime > 0) + { + if (sd->state == TOUCH_STATE_DOWN) + sd->tap_timer = ecore_timer_add(((double)timerTime)/1000.0, _smart_tap_timer_handler, sd); + sd->state = TOUCH_STATE_DOWN_UP; + ELM_WEBVIEW_SLOGD("\nTOUCH_STATE_DOWN_UP\n"); + } + // if we do not have to wait for double tap (because too much time is passed) + // just emit the tap and enter NONE state + else + { + if (sd->state == TOUCH_STATE_DOWN) + _smart_emit_tap(sd); + _smart_stop_all_timers(sd); + _smart_enter_none(sd); + sd->tap_timer = NULL; + } +} + +/** + * @fn static void _smart_enter_down_up_down(Smart_Data *sd) + * @brief enter to the TOUCH_STATE_DOWN_UP_DOWN state + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_enter_down_up_down(Smart_Data *sd) +{ + if (sd->tap_timer) // remove tap timer + { + ecore_timer_del(sd->tap_timer); + sd->tap_timer = NULL; + } + + sd->state = TOUCH_STATE_DOWN_UP_DOWN; + _smart_emit_donw_up_down(sd); + ELM_WEBVIEW_SLOGD("\nTOUCH_STATE_DOWN_UP_DOWN\n"); +} + +/** + * @fn static void _smart_enter_long_press(Smart_Data *sd) + * @brief enter to the TOUCH_STATE_LONG_PRESS state + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_enter_long_press(Smart_Data *sd) +{ + if (sd->tap_timer) + { + ecore_timer_del(sd->tap_timer); + sd->tap_timer = NULL; + } + sd->state = TOUCH_STATE_LONG_PRESS; + ELM_WEBVIEW_SLOGD("\nTOUCH_STATE_LONG_PRESS\n"); +} + +/** + * @fn static void _smart_enter_long_press_drag(Smart_Data *sd) + * @brief enter to the TOUCH_STATE_LONG_PRESS_DRAG state + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_enter_long_press_drag(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< sd->animator_long_press_move >>\n"); + sd->state = TOUCH_STATE_LONG_PRESS_DRAG; + _smart_emit_long_press_move_start(sd); + sd->animator_long_press_move = ecore_animator_add(_smart_animation_long_press_move, sd); + } + else + { + sd->state = TOUCH_STATE_NONE; + } +} + +/** + * @fn static void _smart_enter_drag(Smart_Data *sd) + * @brief enter to the TOUCH_STATE_DRAG state + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_enter_drag(Smart_Data *sd) +{ + // delete tap timer + if (sd->tap_timer) // remove tap_timer + { + ecore_timer_del(sd->tap_timer); + sd->tap_timer = NULL; + } + + // delete long press timer + if (sd->long_press_timer) + { + ecore_timer_del(sd->long_press_timer); + sd->long_press_timer = NULL; + } + + if (sd->child_obj) + { + if (sd->is_one_drag_mode) + { + sd->one_drag_mode = ONE_DRAG_NONE; + int abs_dx = abs(sd->first_down[0].x - sd->last_drag[0].x); + int abs_dy = abs(sd->first_down[0].y - sd->last_drag[0].y); + abs_dx = (abs_dx == 0) ? 1 : abs_dx; + ELM_WEBVIEW_SLOGD("<< abs_dx[%d], abs_dy[%d] >>\n\n", abs_dx, abs_dy); + float degree = (float)abs_dy / (float)abs_dx; + // more than 70 degree + if (degree > tan(70 * M_PI / 180)) + { + sd->one_drag_mode = ONE_DRAG_VERTICAL; + } + // less than 20 degree + else if (degree < tan(20 * M_PI / 180)) + { + sd->one_drag_mode = ONE_DRAG_HORIZONTAL; + } + } + Evas_Point point; + point.x = sd->last_down[0].x; + point.y = sd->last_down[0].y; + evas_object_smart_callback_call(sd->child_obj, "one,move,start", &point); + + sd->animator_move = ecore_animator_add(_smart_animation_move, sd); + ELM_WEBVIEW_SLOGD("<< sd->animator_move >>\n"); + sd->state = TOUCH_STATE_DRAG; + ELM_WEBVIEW_SLOGD("\nTOUCH_STATE_DRAG\n"); + } + else + { + sd->state = TOUCH_STATE_NONE; + } +} + +/** + * @fn static void _smart_enter_two_down(Smart_Data *sd) + * @brief enter to the TOUCH_STATE_TWO_DOWN state + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_enter_two_down(Smart_Data *sd) +{ + _smart_stop_all_timers(sd); + _smart_emit_two_press(sd); + sd->state = TOUCH_STATE_TWO_DOWN; + ELM_WEBVIEW_SLOGD("\nTOUCH_STATE_TWO_DOWN\n"); +} + +/** + * @fn static void _smart_enter_two_down_during_drag(Smart_Data *sd) + * @brief enter to the TOUCH_STATE_TWO_DOWN_DURING_DRAG state + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_enter_two_down_during_drag(Smart_Data *sd) +{ + _smart_stop_all_timers(sd); + + Evas_Point point; + point.x = sd->last_down[0].x; + point.y = sd->last_down[0].y; + evas_object_smart_callback_call(sd->child_obj, "pan,end", &point); + + sd->state = TOUCH_STATE_TWO_DOWN_DURING_DRAG; + ELM_WEBVIEW_SLOGD("<< enter two down >>\n"); +} + +/** + * @fn static void _smart_enter_two_down_up(Smart_Data *sd, int downTime, int time) + * @brief enter to the TOUCH_STATE_TWO_DOWN_UP state + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_enter_two_down_up(Smart_Data *sd, int downTime, int time) +{ + int timerTime = TAP_TIME - downTime; + // if we have to wait for two double tap, + // we set the timer and change the state to TWO_DOWN_UP + if (timerTime > 0) + { + sd->two_tap_timer = ecore_timer_add(((double)timerTime)/1000.0, _smart_two_tap_timer_handler, sd); + sd->state = TOUCH_STATE_TWO_DOWN_UP; + ELM_WEBVIEW_SLOGD("\nTOUCH_STATE_TWO_DOWN_UP\n"); + } + // if we do not have to wait for two double tap (because too much time is passed) + // just emit the two tap and enter NONE state + else + { + _smart_emit_two_tap(sd); + _smart_stop_all_timers(sd); + _smart_enter_none(sd); + sd->tap_timer = NULL; + } +} + +/** + * @fn static void _smart_enter_two_down_up_down(Smart_Data *sd) + * @brief enter to the TOUCH_STATE_TWO_DOWN_UP_DOWN state + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_enter_two_down_up_down(Smart_Data *sd) +{ + if (sd->two_tap_timer) // remove two_tap_timer + { + ecore_timer_del(sd->two_tap_timer); + sd->two_tap_timer = NULL; + } + + sd->state = TOUCH_STATE_TWO_DOWN_UP_DOWN; + ELM_WEBVIEW_SLOGD("\nTOUCH_STATE_TWO_DOWN_UP_DOWN\n"); +} + +/** + * @fn static void _smart_enter_two_drag(Smart_Data *sd) + * @brief enter to the TOUCH_STATE_TWO_DRAG state + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_enter_two_drag(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< sd->animator_two_move >>\n"); + sd->state = TOUCH_STATE_TWO_DRAG; + _smart_emit_two_move_start(sd); + if (sd->animator_two_move) + { + ecore_animator_del(sd->animator_two_move); + sd->animator_two_move = NULL; + } + sd->animator_two_move = ecore_animator_add(_smart_animation_two_move, sd); + } + else + { + sd->state = TOUCH_STATE_NONE; + } +} + +/** + * @fn static void _smart_enter_two_drag_one_up(Smart_Data *sd) + * @brief enter to the TOUCH_STATE_TWO_DRAG_ONE_UP state + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_enter_two_drag_one_up(Smart_Data *sd) +{ + ELM_WEBVIEW_SLOGD("\n"); + if (sd->child_obj) + { + sd->state = TOUCH_STATE_TWO_DRAG_ONE_UP; + } + else + { + sd->state = TOUCH_STATE_NONE; + } +} + +/** + * @fn static void _smart_enter_three_down(Smart_Data *sd) + * @brief enter to the TOUCH_STATE_THREE_DOWN state + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_enter_three_down(Smart_Data *sd) +{ + if (sd->child_obj) + { + sd->state = TOUCH_STATE_THREE_DOWN; + _smart_emit_three_press(sd); + } +} + +/* producing output events */ +/** + * @fn static void _smart_emit_press(Smart_Data *sd) + * @brief emit one,press event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_press(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< emit_press >>\n"); + Evas_Point point; + point.x = sd->last_down[0].x; + point.y = sd->last_down[0].y; + evas_object_smart_callback_call(sd->child_obj, "one,press", &point); + } +} + +/** + * @fn static void _smart_emit_donw_up_down(Smart_Data *sd) + * @brief emit one,down,up,down event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_donw_up_down(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< emit_donw_up_down>>\n"); + Evas_Point point; + point.x = sd->last_down[0].x; + point.y = sd->last_down[0].y; + evas_object_smart_callback_call(sd->child_obj, "one,down,up,down", &point); + } +} + +/** + * @fn static void _smart_emit_tap(Smart_Data *sd) + * @brief emit one,single,tap event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_tap(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< emit_tap >>\n"); + Evas_Point point; + point.x = sd->last_down[0].x; + point.y = sd->last_down[0].y; + evas_object_smart_callback_call(sd->child_obj, "one,single,tap", &point); + } +} + +/** + * @fn static void _smart_emit_double_tap(Smart_Data *sd) + * @brief emit one,double,tap event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_double_tap(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< emit_double_tap >>\n"); + Evas_Point point; + point.x = sd->last_down[0].x; + point.y = sd->last_down[0].y; + evas_object_smart_callback_call(sd->child_obj, "one,double,tap", &point); + } +} + +/** + * @fn static void _smart_emit_long_press(Smart_Data *sd) + * @brief emit one,long,press event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_long_press(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< emit_long_press >>\n"); + Evas_Point point; + point.x = sd->last_down[0].x; + point.y = sd->last_down[0].y; + evas_object_smart_callback_call(sd->child_obj, "one,long,press", &point); + } +} + +/** + * @fn static void _smart_emit_long_press_move_start(Smart_Data *sd) + * @brief emit one,long,move,start event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_long_press_move_start(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< emit_long_press_start >>\n"); + Evas_Point point; + point.x = sd->last_down[0].x; + point.y = sd->last_down[0].y; + evas_object_smart_callback_call(sd->child_obj, "one,long,move,start", &point); + } +} + +/** + * @fn static void _smart_emit_long_press_move(Smart_Data *sd) + * @brief emit one,long,move event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_long_press_move(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< emit_long_press move >>\n"); + Evas_Point point; + point.x = sd->last_drag[0].x; + point.y = sd->last_drag[0].y; + evas_object_smart_callback_call(sd->child_obj, "one,long,move", &point); + } +} + +/** + * @fn static void _smart_emit_long_press_move_end(Smart_Data *sd) + * @brief emit one,long,move,end event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_long_press_move_end(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< emit_long_press_move end >>\n"); + Evas_Point point; + point.x = sd->last_drag[0].x; + point.y = sd->last_drag[0].y; + evas_object_smart_callback_call(sd->child_obj, "one,long,move,end", &point); + } +} + +/** + * @fn static void _smart_emit_release(Smart_Data *sd) + * @brief emit one,release event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_release(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< emit_release >>\n"); + Evas_Point point; + point.x = sd->last_down[0].x; + point.y = sd->last_down[0].y; + evas_object_smart_callback_call(sd->child_obj, "one,release", &point); + } +} + +/** + * @fn static void _smart_emit_two_press(Smart_Data *sd) + * @brief emit two,press event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_two_press(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< emit_two_press >>\n"); + Touch_Point two_point_data[2]; + two_point_data[0] = sd->last_down[0]; + two_point_data[1] = sd->last_down[1]; + evas_object_smart_callback_call(sd->child_obj, "two,press", two_point_data); + } +} + +/** + * @fn static void _smart_emit_two_release(Smart_Data *sd) + * @brief emit two,release event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_two_release(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< _smart_emit_two_release >>\n"); + Touch_Point two_point_data[2]; + two_point_data[0] = sd->last_down[0]; + two_point_data[1] = sd->last_down[1]; + evas_object_smart_callback_call(sd->child_obj, "two,release", two_point_data); + } +} +/** + * @fn static void _smart_emit_two_tap(Smart_Data *sd) + * @brief emit two,tap event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_two_tap(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< emit_two_tap >>\n"); + Touch_Point two_point_data[2]; + two_point_data[0] = sd->last_down[0]; + two_point_data[1] = sd->last_down[1]; + evas_object_smart_callback_call(sd->child_obj, "two,tap", two_point_data); + } +} + +/** + * @fn static void _smart_emit_two_double_tap(Smart_Data *sd) + * @brief emit two,double,tap event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_two_double_tap(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< emit_two_double_tap >>\n"); + Touch_Point two_point_data[2]; + two_point_data[0] = sd->last_down[0]; + two_point_data[1] = sd->last_down[1]; + evas_object_smart_callback_call(sd->child_obj, "two,double,tap", two_point_data); + } +} + +/** + * @fn static void _smart_emit_two_move_start(Smart_Data *sd) + * @brief emit two,move,start event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_two_move_start(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< emit_two_move_start >>\n"); + Touch_Point two_point_data[2]; + two_point_data[0] = sd->last_drag[0]; + two_point_data[1] = sd->last_drag[1]; + two_point_data[0].state = TOUCH_POINT_PRESSED; + two_point_data[1].state = TOUCH_POINT_PRESSED; + evas_object_smart_callback_call(sd->child_obj, "two,move,start", two_point_data); + } +} + +/** + * @fn static void _smart_emit_two_move(Smart_Data *sd) + * @brief emit two,move event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_two_move(Smart_Data *sd) +{ + if (sd->child_obj) + { + Touch_Point two_point_data[2]; + two_point_data[0] = sd->last_drag[0]; + two_point_data[1] = sd->last_drag[1]; + evas_object_smart_callback_call(sd->child_obj, "two,move", two_point_data); + } +} + +/** + * @fn static void _smart_emit_two_move_end(Smart_Data *sd) + * @brief emit two,move,end event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_two_move_end(Smart_Data *sd) +{ + if (sd->child_obj) + { + Touch_Point point_data; + point_data = sd->last_drag[sd->released_finger_index]; + ELM_WEBVIEW_SLOGD("<< emit_two_move_end >> point_data(%d, %d) last_drag[0] (%d, %d) last_drag[1] (%d, %d)\n", + point_data.x, point_data.y, sd->last_drag[0].x, sd->last_drag[0].y, sd->last_drag[1].x, sd->last_drag[1].y); + evas_object_smart_callback_call(sd->child_obj, "two,move,end", &point_data); + } +} + +/** + * @fn static void _smart_emit_three_press(Smart_Data *sd) + * @brief emit three,press event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_three_press(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< emit_three_press >>\n"); + Touch_Point three_point_data[3]; + three_point_data[0] = sd->last_drag[0]; + three_point_data[1] = sd->last_drag[1]; + three_point_data[2] = sd->last_drag[2]; + evas_object_smart_callback_call(sd->child_obj, "three,press", three_point_data); + } +} + +/** + * @fn static void _smart_emit_three_tap(Smart_Data *sd) + * @brief emit three,tap event + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_emit_three_tap(Smart_Data *sd) +{ + if (sd->child_obj) + { + ELM_WEBVIEW_SLOGD("<< emit_three_tap >>\n"); + Touch_Point three_point_data[3]; + three_point_data[0] = sd->last_drag[0]; + three_point_data[1] = sd->last_drag[1]; + three_point_data[2] = sd->last_drag[2]; + evas_object_smart_callback_call(sd->child_obj, "three,tap", three_point_data); + } +} + +/* timer event handling */ +/** + * @fn static Eina_Bool _smart_tap_timer_handler(void *data) + * @brief tap timer handler + * + * @param[in] data data which is set by user + */ +static Eina_Bool +_smart_tap_timer_handler(void *data) +{ + ELM_WEBVIEW_SLOGD("\n"); + + Smart_Data *sd; + sd = data; + + _smart_emit_tap(sd); + _smart_stop_all_timers(sd); + _smart_enter_none(sd); + sd->tap_timer = NULL; + + return ECORE_CALLBACK_CANCEL; +} + +/** + * @fn static Eina_Bool _smart_long_press_timer_handler(void *data) + * @brief long press timer handler + * + * @param[in] data data which is set by user + */ +static Eina_Bool +_smart_long_press_timer_handler(void *data) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data *sd; + sd = data; + + _smart_emit_long_press(sd); + _smart_enter_long_press(sd); + sd->long_press_timer = NULL; + + return ECORE_CALLBACK_CANCEL; +} + +/** + * @fn static Eina_Bool _smart_two_tap_timer_handler(void *data) + * @brief two tap timer handler + * + * @param[in] data data which is set by user + */ +static Eina_Bool +_smart_two_tap_timer_handler(void *data) +{ + ELM_WEBVIEW_SLOGD("\n"); + Smart_Data *sd; + + sd = data; + _smart_emit_two_tap(sd); + _smart_stop_all_timers(sd); + _smart_enter_none(sd); + sd->two_tap_timer = NULL; + return ECORE_CALLBACK_CANCEL; +} + +/* other functions */ +/** + * @fn static void _smart_stop_animator_move(Smart_Data *sd) + * @brief stop move animator + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_stop_animator_move(Smart_Data *sd) +{ + if (sd->animator_move) + { + ecore_animator_del(sd->animator_move); + ELM_WEBVIEW_SLOGD("<< stop_animator_move >>\n"); + sd->animator_move = NULL; + Evas_Point point; + point.x = sd->last_drag[0].x; + point.y = sd->last_drag[0].y; + evas_object_smart_callback_call(sd->child_obj, "one,move,end", &point); + } +} + +/** + * @fn static void _smart_stop_animator_two_move(Smart_Data *sd) + * @brief stop two move animator + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_stop_animator_two_move(Smart_Data *sd) +{ + if (sd->animator_two_move) + { + ecore_animator_del(sd->animator_two_move); + ELM_WEBVIEW_SLOGD("<< stop_animator_two_move >>\n"); + sd->animator_two_move = NULL; + _smart_emit_two_move_end(sd); + } +} + +/** + * @fn static void _smart_stop_animator_long_press_move(Smart_Data *sd) + * @brief stop long press move animator + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_stop_animator_long_press_move(Smart_Data *sd) +{ + if (sd->animator_long_press_move) + { + ecore_animator_del(sd->animator_long_press_move); + ELM_WEBVIEW_SLOGD("<< stop_animator_long_press_move >>\n"); + sd->animator_long_press_move = NULL; + _smart_emit_long_press_move_end(sd); + } +} + +static void +_smart_stop_all_animator(Smart_Data *sd) +{ + _smart_stop_animator_move(sd); + _smart_stop_animator_two_move(sd); + _smart_stop_animator_long_press_move(sd); +} + +/** + * @fn static Two_Drag_Mode two_drag_mode_get(Touch_Point *first_down_points, Touch_Point *last_drag_points) + * @brief return two drag mode + * + * @param[in] first_points array of first_down point + * @param[in] second_points array of last_drag point + */ +Two_Drag_Mode +two_drag_mode_get(Touch_Point *first_down_points, Touch_Point *last_drag_points) +{ + // get distance from press to current position + int dx0 = last_drag_points[0].x - first_down_points[0].x; + int dy0 = last_drag_points[0].y - first_down_points[0].y; + int dx1 = last_drag_points[1].x - first_down_points[1].x; + int dy1 = last_drag_points[1].y - first_down_points[1].y; + int dx = 0; + int dy = 0; + + // select dx and dy + if ((abs(dx1) >= TWO_MOVE_THRESHOLD) || (abs(dy1) >= TWO_MOVE_THRESHOLD)) + { + dx = dx1; + dy = dy1; + } + else if ((abs(dx0) >= TWO_MOVE_THRESHOLD) || (abs(dy0) >= TWO_MOVE_THRESHOLD)) + { + dx = dx0; + dy = dy0; + } + else + { + return TWO_DRAG_NONE; + } + + // same x direction + if ((abs(dx) > abs(dy)) && ((dx0 > 0 && dx1 > 0) || (dx0 < 0 && dx1 < 0))) + { + dy = (dy == 0) ? 1 : dy; + // less than 30 degree (1024/root(3) = 591) + if (((abs(dy) << 10) / abs(dx)) < 591) + { + return TWO_DRAG_HORIZONTAL; + } + } + + // same y direction + if ((abs(dy) > abs(dx)) && ((dy0 > 0 && dy1 > 0) || (dy0 < 0 && dy1 < 0))) + { + dx = (dx == 0) ? 1 : dx; + // more than 60 degree (1024 * root(3)/1 = 1773) + if (((abs(dy) << 10) / abs(dx)) > 1773) + { + return TWO_DRAG_VERTICAL; + } + } + + // pinch direction + int distanceX = abs(abs(first_down_points[0].x - first_down_points[1].x) + - abs(last_drag_points[0].x - last_drag_points[1].x)); + int distanceY = abs(abs(first_down_points[0].y - first_down_points[1].y) + - abs(last_drag_points[0].y - last_drag_points[1].y)); + if ((distanceX > FINGER_DISTANCE) || (distanceY > FINGER_DISTANCE)) + { + return TWO_DRAG_PINCH; + } + + return TWO_DRAG_NONE; +} + +/** + * @fn static void _smart_set_first_down(Smart_Data *sd, int index, Touch_Point *data) + * @brief set first down data + * + * @param[in] sd els_touch's Smart_Data + * @param[in] index finger index + * @param[in] data touch point + */ +static void +_smart_set_first_down(Smart_Data *sd, int index, Touch_Point *data) +{ + if (index >= N_FINGER) return; + + sd->first_down[index].x = data->x; + sd->first_down[index].y = data->y; + sd->first_down[index].time = data->time; + sd->first_down[index].device = data->device; +} + +/** + * @fn static void _smart_set_last_down(Smart_Data *sd, int index, Touch_Point *data) + * @brief set last down data + * + * @param[in] sd els_touch's Smart_Data + * @param[in] index finger index + * @param[in] data touch point + */ +static void +_smart_set_last_down(Smart_Data *sd, int index, Touch_Point *data) +{ + if (index >= N_FINGER) return; + + sd->last_down[index].x = data->x; + sd->last_down[index].y = data->y; + sd->last_down[index].time = data->time; + sd->last_down[index].device = data->device; + sd->last_down[index].state = data->state; +} + +/** + * @fn static void _smart_set_last_drag(Smart_Data *sd, int index, Touch_Point *data) + * @brief set last drag data + * + * @param[in] sd els_touch's Smart_Data + * @param[in] index finger index + * @param[in] data touch point + */ +static void +_smart_set_last_drag(Smart_Data *sd, int index, Touch_Point *data) +{ + if (index >= N_FINGER) return; + + sd->last_drag[index].x = data->x; + sd->last_drag[index].y = data->y; + sd->last_drag[index].time = data->time; + sd->last_drag[index].device = data->device; + sd->last_drag[index].state = data->state; +} + +/** + * @fn static void _smart_stop_all_timers(Smart_Data *sd) + * @brief stop all timers + * + * @param[in] sd els_touch's Smart_Data + */ +static void +_smart_stop_all_timers(Smart_Data *sd) +{ + // delete tap timer + if (sd->tap_timer) + { + ecore_timer_del(sd->tap_timer); + sd->tap_timer = NULL; + } + + // delete long press timer + if (sd->long_press_timer) + { + ecore_timer_del(sd->long_press_timer); + sd->long_press_timer = NULL; + } + + // delete two tap timer + if (sd->two_tap_timer) + { + ecore_timer_del(sd->two_tap_timer); + sd->two_tap_timer = NULL; + } +} + +/** + * @fn static void _smart_add(Evas_Object *obj) + * @brief smart add function + * + * @param[in] obj els_touch Evas_Object + */ +static void +_smart_add(Evas_Object *obj) +{ + Smart_Data *sd; + + sd = calloc(1, sizeof(Smart_Data)); + if (!sd) return; + memset((void *)sd, 0x00, sizeof(Smart_Data)); + + sd->smart_obj = obj; + + // set default framerate + ecore_animator_frametime_set(1.0 / DEFAULT_FRAMERATE); + + evas_object_smart_data_set(obj, sd); +} + +/** + * @fn static void _smart_del(Evas_Object *obj) + * @brief smart del function + * + * @param[in] obj els_touch Evas_Object + */ +static void +_smart_del(Evas_Object *obj) +{ + INTERNAL_ENTRY; + if (sd) + { + _smart_stop_all_timers(sd); + + if (sd->animator_move) + { + ecore_animator_del(sd->animator_move); + sd->animator_move = NULL; + } + + if (sd->animator_two_move) + { + ecore_animator_del(sd->animator_two_move); + sd->animator_two_move = NULL; + } + + if (sd->animator_long_press_move) + { + ecore_animator_del(sd->animator_long_press_move); + sd->animator_long_press_move = NULL; + } + + if (sd->child_obj) + { + evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_MOUSE_DOWN, _smart_mouse_down); + evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_MOUSE_UP, _smart_mouse_up); + evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_MOUSE_MOVE, _smart_mouse_move); + evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_MULTI_DOWN, _smart_multi_down); + evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_MULTI_UP, _smart_multi_up); + evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_MULTI_MOVE, _smart_multi_move); + } + + free(sd); + } +} + +/** + * @fn static void _smart_init(void) + * @brief smart init function + * + */ +static void +_smart_init(void) +{ + if (_smart) return; + const char* name = eina_stringshare_add("els_touch"); + static Evas_Smart_Class sc = + { + NULL, + EVAS_SMART_CLASS_VERSION, + _smart_add, + _smart_del, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }; + sc.name = name; + _smart = evas_smart_class_new(&sc); +} diff --git a/touch_processor/els_touch.h b/touch_processor/els_touch.h new file mode 100644 index 0000000..55df2f0 --- /dev/null +++ b/touch_processor/els_touch.h @@ -0,0 +1,60 @@ +/* + * Elementary WebView + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ryuan Choi , Eunmi Lee , Kangil Han + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef els_touch_h +#define els_touch_h + +typedef enum { + TOUCH_POINT_PRESSED, + TOUCH_POINT_RELEASED, + TOUCH_POINT_MOVED, + TOUCH_POINT_CANCELLED +} Touch_Point_Type; + +typedef struct _Touch_Point Touch_Point; +struct _Touch_Point +{ + unsigned int device; + Evas_Coord x; + Evas_Coord y; + int time; + Touch_Point_Type state; +}; + +// two drag mode +typedef enum _Two_Drag_Mode +{ + TWO_DRAG_NONE, + TWO_DRAG_PINCH, + TWO_DRAG_VERTICAL, + TWO_DRAG_HORIZONTAL, +} Two_Drag_Mode; + +Evas_Object *_elm_smart_touch_add (Evas *evas); +void _elm_smart_touch_child_set (Evas_Object *obj, Evas_Object *child); +void _elm_smart_touch_start (Evas_Object *obj); +void _elm_smart_touch_stop (Evas_Object *obj); +void _elm_smart_touch_reset (Evas_Object *obj); +void _elm_smart_touch_is_one_drag_mode_enable (Evas_Object *obj, Eina_Bool is_one_drag_mode); +void _elm_smart_touch_support_multi_event_set (Evas_Object *obj, Eina_Bool support_multi_event); +Two_Drag_Mode two_drag_mode_get(Touch_Point *first_points, Touch_Point *last_points); + +#endif -- 2.7.4