diff options
author | m.kawonczyk <m.kawonczyk@samsung.com> | 2016-10-03 08:53:08 +0200 |
---|---|---|
committer | HyeKyoung Hwang <cookie@samsung.com> | 2016-10-28 11:12:45 +0900 |
commit | 678d7622832731ec19458738d4bb9a5ee5130f9a (patch) | |
tree | d8a29b3512a6bfd2f4236521b27e54b6f5bb43a7 | |
parent | ce41a8ba10b0ccfddd1e6fd53bf1168977ab5308 (diff) | |
download | browser-678d7622832731ec19458738d4bb9a5ee5130f9a.tar.gz browser-678d7622832731ec19458738d4bb9a5ee5130f9a.tar.bz2 browser-678d7622832731ec19458738d4bb9a5ee5130f9a.zip |
The dummy button
[Issue] http://suprem.sec.samsung.net/jira/browse/TWF-2222
[Problem] The dummy button is needed by webview for focus
managment.
[Solution] Add #ifdefed the dummy button feature.
[Verify] Open any webpage, dlogutil browser. Check if the
dummy button is properly focused/unfocused and if
webview focus is ok.
Change-Id: I66f9bcc00e8eaf0b4c708ca1fae3c367a9ea06ff
-rwxr-xr-x | CMakeLists.txt | 1 | ||||
-rw-r--r-- | cmake/EDCCompile.cmake | 1 | ||||
-rw-r--r-- | core/AbstractWebEngine/AbstractWebEngine.h | 3 | ||||
-rw-r--r-- | services/SimpleUI/SimpleUI.cpp | 3 | ||||
-rwxr-xr-x | services/WebEngineService/WebEngineService.cpp | 3 | ||||
-rw-r--r-- | services/WebEngineService/WebEngineService.h | 2 | ||||
-rwxr-xr-x | services/WebEngineService/WebView.cpp | 3 | ||||
-rw-r--r-- | services/WebEngineService/WebView.h | 3 | ||||
-rwxr-xr-x | services/WebPageUI/WebPageUI.cpp | 50 | ||||
-rw-r--r-- | services/WebPageUI/WebPageUI.h | 10 | ||||
-rw-r--r-- | services/WebPageUI/edc/WebPageUI_mob.edc | 15 |
11 files changed, 89 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a56ceb13..bc701276 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,6 +116,7 @@ if(TIZEN_BUILD) if (${PROFILE} MATCHES "mobile") ADD_DEFINITIONS(-DPROFILE_MOBILE=1) + ADD_DEFINITIONS(-DDUMMY_BUTTON=1) endif (${PROFILE} MATCHES "mobile") endif(TIZEN_BUILD) diff --git a/cmake/EDCCompile.cmake b/cmake/EDCCompile.cmake index 5dfb6e86..6f9a3409 100644 --- a/cmake/EDCCompile.cmake +++ b/cmake/EDCCompile.cmake @@ -34,6 +34,7 @@ IF(EDJE_CC_EXECUTABLE) ARGS -id ${CMAKE_CURRENT_SOURCE_DIR}/${IMAGES_URL}/ -DBROWSER_RESOLUTION_${resolution}=1 -DPROFILE_MOBILE=${IF_PROFILE_MOBILE} + -DDUMMY_BUTTON=${IF_DUMMY_BUTTON} ${Edc_Input} ${tmp_output} MAIN_DEPENDENCY ${Edc_Input} DEPENDS ${EDJE_TARGET_depends} diff --git a/core/AbstractWebEngine/AbstractWebEngine.h b/core/AbstractWebEngine/AbstractWebEngine.h index e33c85b7..f5b86dc5 100644 --- a/core/AbstractWebEngine/AbstractWebEngine.h +++ b/core/AbstractWebEngine/AbstractWebEngine.h @@ -55,12 +55,13 @@ public: */ virtual T * getLayout() = 0; +#if !DUMMY_BUTTON /** * Remember that there must be at least 1 tab created to return layout * @return pointer to Evas_Object widget connected with a current WebView. */ virtual Evas_Object* getWidget() = 0; - +#endif /** * Initialize WebEngine. * @param guiParent GUI parent object (now should pass Evas_Object) diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index 4e457d53..2a2bb648 100644 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -137,6 +137,9 @@ void SimpleUI::suspend() void SimpleUI::resume() { m_webEngine->preinitializeWebViewCache(); +#if DUMMY_BUTTON + m_webPageUI->createDummyButton(); +#endif m_webEngine->resume(); #if PROFILE_MOBILE if (m_findOnPageUI && m_findOnPageUI->isVisible()) diff --git a/services/WebEngineService/WebEngineService.cpp b/services/WebEngineService/WebEngineService.cpp index 9eeb1b66..3b0a0043 100755 --- a/services/WebEngineService/WebEngineService.cpp +++ b/services/WebEngineService/WebEngineService.cpp @@ -83,6 +83,7 @@ Evas_Object * WebEngineService::getLayout() return m_currentWebView->getLayout(); } +#if !DUMMY_BUTTON Evas_Object * WebEngineService::getWidget() { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); @@ -93,7 +94,7 @@ Evas_Object * WebEngineService::getWidget() } return m_currentWebView->getWidget(); } - +#endif void WebEngineService::init(void * guiParent) { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); diff --git a/services/WebEngineService/WebEngineService.h b/services/WebEngineService/WebEngineService.h index 925cb846..2d21c5b7 100644 --- a/services/WebEngineService/WebEngineService.h +++ b/services/WebEngineService/WebEngineService.h @@ -50,7 +50,9 @@ public: virtual std::string getName(); Evas_Object * getLayout(); +#if !DUMMY_BUTTON Evas_Object * getWidget(); +#endif void init(void * guiParent); void preinitializeWebViewCache(); diff --git a/services/WebEngineService/WebView.cpp b/services/WebEngineService/WebView.cpp index 5e07c4db..be41f620 100755 --- a/services/WebEngineService/WebView.cpp +++ b/services/WebEngineService/WebView.cpp @@ -648,11 +648,12 @@ Evas_Object * WebView::getLayout() return m_ewkView; } +#if !DUMMY_BUTTON Evas_Object * WebView::getWidget() { return ewk_view_widget_get(m_ewkView); } - +#endif void WebView::setURI(const std::string & uri) { BROWSER_LOGD("[%s:%d] uri=%s", __PRETTY_FUNCTION__, __LINE__, uri.c_str()); diff --git a/services/WebEngineService/WebView.h b/services/WebEngineService/WebView.h index 97e07506..85ed5922 100644 --- a/services/WebEngineService/WebView.h +++ b/services/WebEngineService/WebView.h @@ -109,8 +109,9 @@ public: std::map<std::string, std::vector<std::string> > parse_uri(const char *uriToParse); Evas_Object * getLayout(); +#if !DUMMY_BUTTON Evas_Object * getWidget(); - +#endif void confirmationResult(WebConfirmationPtr); /** diff --git a/services/WebPageUI/WebPageUI.cpp b/services/WebPageUI/WebPageUI.cpp index 953dc6f3..c2b4f982 100755 --- a/services/WebPageUI/WebPageUI.cpp +++ b/services/WebPageUI/WebPageUI.cpp @@ -37,6 +37,9 @@ EXPORT_SERVICE(WebPageUI, "org.tizen.browser.webpageui") WebPageUI::WebPageUI() : m_parent(nullptr) , m_mainLayout(nullptr) +#if DUMMY_BUTTON + , m_dummy_button(nullptr) +#endif , m_errorLayout(nullptr) , m_privateLayout(nullptr) , m_bookmarkManagerButton(nullptr) @@ -59,6 +62,10 @@ WebPageUI::WebPageUI() WebPageUI::~WebPageUI() { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); +#if DUMMY_BUTTON + evas_object_smart_callback_del(m_dummy_button, "focused", _dummy_button_focused); + evas_object_smart_callback_del(m_dummy_button, "unfocused", _dummy_button_unfocused); +#endif } void WebPageUI::init(Evas_Object* parent) @@ -207,8 +214,10 @@ void WebPageUI::setMainContent(Evas_Object* content) #if PROFILE_MOBILE && GESTURE elm_gesture_layer_attach(m_gestureLayer, content); #endif -#if PROFILE_MOBILE +#if PROFILE_MOBILE && !DUMMY_BUTTON evas_object_smart_callback_add(content, "mouse,down", _content_clicked, this); +#endif +#if PROFILE_MOBILE updateManualRotation(); #endif evas_object_show(content); @@ -484,6 +493,45 @@ void WebPageUI::createLayout() #endif } +#if DUMMY_BUTTON +void WebPageUI::createDummyButton() +{ + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + if (!m_dummy_button) { + M_ASSERT(m_mainLayout); + m_dummy_button = elm_button_add(m_mainLayout); + elm_object_style_set(m_dummy_button, "invisible_button"); + evas_object_size_hint_align_set(m_dummy_button, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(m_dummy_button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_focus_allow_set(m_dummy_button, EINA_TRUE); + elm_object_focus_set(m_dummy_button, EINA_TRUE); + evas_object_show(m_dummy_button); + elm_object_part_content_set(m_mainLayout, "web_view_dummy_button", m_dummy_button); + + evas_object_smart_callback_add(m_dummy_button, "focused", _dummy_button_focused, this); + evas_object_smart_callback_add(m_dummy_button, "unfocused", _dummy_button_unfocused, this); + } +} + +void WebPageUI::_dummy_button_focused(void *data, Evas_Object *, void *) +{ + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + if (data != nullptr) { + WebPageUI* webPageUI = static_cast<WebPageUI*>(data); + webPageUI->focusWebView(); + } +} + +void WebPageUI::_dummy_button_unfocused(void *data, Evas_Object *, void *) +{ + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + if (data != nullptr) { + WebPageUI* webPageUI = static_cast<WebPageUI*>(data); + webPageUI->unfocusWebView(); + } +} + +#endif void WebPageUI::createErrorLayout() { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); diff --git a/services/WebPageUI/WebPageUI.h b/services/WebPageUI/WebPageUI.h index d11e9180..459879db 100644 --- a/services/WebPageUI/WebPageUI.h +++ b/services/WebPageUI/WebPageUI.h @@ -53,6 +53,9 @@ public: UrlHistoryPtr getUrlHistoryList(); virtual void showUI(); virtual void hideUI(); +#if DUMMY_BUTTON + void createDummyButton(); +#endif #if PROFILE_MOBILE virtual void orientationChanged() override; void fullscreenModeSet(bool state); @@ -121,6 +124,10 @@ private: static void faviconClicked(void* data, Evas_Object* obj, const char* emission, const char* source); static Eina_Bool _cb_down_pressed_on_urlbar(void *data, Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info); static void _bookmark_manager_clicked(void * data, Evas_Object *, void *); +#if DUMMY_BUTTON + static void _dummy_button_focused(void *data, Evas_Object *, void *); + static void _dummy_button_unfocused(void *data, Evas_Object *, void *); +#endif #if PROFILE_MOBILE static void _more_menu_background_clicked(void* data, Evas_Object*, const char*, const char*); static void _content_clicked(void * data, Evas_Object *, void *); @@ -161,6 +168,9 @@ private: Evas_Object* m_parent; Evas_Object* m_mainLayout; +#if DUMMY_BUTTON + Evas_Object* m_dummy_button; +#endif Evas_Object* m_errorLayout; Evas_Object* m_privateLayout; Evas_Object* m_bookmarkManagerButton; diff --git a/services/WebPageUI/edc/WebPageUI_mob.edc b/services/WebPageUI/edc/WebPageUI_mob.edc index 116caa02..1e7efa05 100644 --- a/services/WebPageUI/edc/WebPageUI_mob.edc +++ b/services/WebPageUI/edc/WebPageUI_mob.edc @@ -299,6 +299,21 @@ collections { base_scale: 2.6; rel2 { relative: 1.0 1.0; to: "bg"; } } } +#if DUMMY_BUTTON + swallow { "web_view_dummy_button"; scale; + mouse_events: 1; + repeat_events: 1; + description { "default"; + visible: 1; + align: 0.0 0.0; + fixed: 0 0; + min: 0 0; + max: -1 -1; + rel1 { relative: 0.0 0.0; to: "web_view"; } + rel2 { relative: 1.0 1.0; to: "web_view"; } + } + } +#endif part { name: "progressbar_bg"; type: IMAGE; scale: 1; |