The Dummy Button removal 00/89200/3
authorm.kawonczyk <m.kawonczyk@samsung.com>
Thu, 22 Sep 2016 13:44:00 +0000 (15:44 +0200)
committerHye Kyoung Hwang <cookie@samsung.com>
Fri, 23 Sep 2016 04:42:59 +0000 (21:42 -0700)
[Issue]        N/A
[Problem]      WebView team managed to extract Evas_Object from
               ewk_view smart object. This object can be focused
               and unfocused, so The Dummy Button - proxy widget is
               not needed anymore
[Solution]     Delete The Dummy Button, add support for extracted
               Evas_Object.
[Verify]       Open any website, check if focus is working as
               intended.

Change-Id: Idf388056f1c6be494f76b5d36fef0be6bcef4556

core/AbstractWebEngine/AbstractWebEngine.h
services/SimpleUI/SimpleUI.cpp
services/WebEngineService/WebEngineService.cpp
services/WebEngineService/WebEngineService.h
services/WebEngineService/WebView.cpp
services/WebEngineService/WebView.h
services/WebPageUI/WebPageUI.cpp
services/WebPageUI/WebPageUI.h
services/WebPageUI/edc/WebPageUI_mob.edc

index 693e2f0..710f84b 100755 (executable)
@@ -56,6 +56,12 @@ public:
     virtual T * getLayout() = 0;
 
     /**
+     * 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;
+
+    /**
      * Initialize WebEngine.
      * @param guiParent GUI parent object (now should pass Evas_Object)
      * \todo make guiParent nonEFL object
index 217a7b9..1e80ace 100755 (executable)
@@ -135,7 +135,6 @@ void SimpleUI::suspend()
 void SimpleUI::resume()
 {
     m_webEngine->preinitializeWebViewCache();
-    m_webPageUI->createDummyButton();
     m_webEngine->resume();
 #if PROFILE_MOBILE
     if (m_findOnPageUI && m_findOnPageUI->isVisible())
index 5d918b6..ffe9aa1 100755 (executable)
@@ -83,6 +83,17 @@ Evas_Object * WebEngineService::getLayout()
     return m_currentWebView->getLayout();
 }
 
+Evas_Object * WebEngineService::getWidget()
+{
+    BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+    M_ASSERT(m_currentWebView);
+    if (!m_currentWebView) {
+        BROWSER_LOGD("[%s:%d:%s] ", __PRETTY_FUNCTION__, __LINE__, "m_currentWebView is null");
+        return nullptr;
+    }
+    return m_currentWebView->getWidget();
+}
+
 void WebEngineService::init(void * guiParent)
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
index def644e..925cb84 100755 (executable)
@@ -50,6 +50,7 @@ public:
     virtual std::string getName();
 
     Evas_Object * getLayout();
+    Evas_Object * getWidget();
     void init(void * guiParent);
     void preinitializeWebViewCache();
 
index 4360c48..f70f3e9 100755 (executable)
@@ -644,6 +644,11 @@ Evas_Object * WebView::getLayout()
     return m_ewkView;
 }
 
+Evas_Object * WebView::getWidget()
+{
+    return ewk_view_widget_get(m_ewkView);
+}
+
 void WebView::setURI(const std::string & uri)
 {
     BROWSER_LOGD("[%s:%d] uri=%s", __PRETTY_FUNCTION__, __LINE__, uri.c_str());
index f960157..aaa99a7 100755 (executable)
@@ -109,6 +109,7 @@ public:
     std::map<std::string, std::vector<std::string> > parse_uri(const char *uriToParse);
 
     Evas_Object * getLayout();
+    Evas_Object * getWidget();
 
     void confirmationResult(WebConfirmationPtr);
 
index 0c6227f..efb210c 100755 (executable)
@@ -37,7 +37,6 @@ EXPORT_SERVICE(WebPageUI, "org.tizen.browser.webpageui")
 WebPageUI::WebPageUI()
     : m_parent(nullptr)
     , m_mainLayout(nullptr)
-    , m_dummy_button(nullptr)
     , m_errorLayout(nullptr)
     , m_privateLayout(nullptr)
     , m_bookmarkManagerButton(nullptr)
@@ -60,8 +59,6 @@ WebPageUI::WebPageUI()
 WebPageUI::~WebPageUI()
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
-    evas_object_smart_callback_del(m_dummy_button, "focused", _dummy_button_focused);
-    evas_object_smart_callback_del(m_dummy_button, "unfocused", _dummy_button_unfocused);
 }
 
 void WebPageUI::init(Evas_Object* parent)
@@ -486,43 +483,6 @@ void WebPageUI::createLayout()
 #endif
 }
 
-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();
-    }
-}
-
 void WebPageUI::createErrorLayout()
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
index 850dfab..9080fba 100755 (executable)
@@ -53,7 +53,6 @@ public:
     UrlHistoryPtr getUrlHistoryList();
     virtual void showUI();
     virtual void hideUI();
-    void createDummyButton();
 #if PROFILE_MOBILE
     virtual void orientationChanged() override;
     void fullscreenModeSet(bool state);
@@ -121,8 +120,6 @@ 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 *);
-    static void _dummy_button_focused(void *data, Evas_Object *, void *);
-    static void _dummy_button_unfocused(void *data, Evas_Object *, void *);
 #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 *);
@@ -163,7 +160,6 @@ private:
 
     Evas_Object* m_parent;
     Evas_Object* m_mainLayout;
-    Evas_Object* m_dummy_button;
     Evas_Object* m_errorLayout;
     Evas_Object* m_privateLayout;
     Evas_Object* m_bookmarkManagerButton;
index 74b5807..116caa0 100755 (executable)
@@ -286,23 +286,8 @@ collections { base_scale: 2.6;
                 name: "web_view";
                 type: SWALLOW;
                 scale: 1;
-                description {
-                    state: "default" 0.0;
-                    visible: 1;
-                    align: 0.0 0.0;
-                    fixed: 0 0;
-                    min: 0 0;
-                    max: -1 -1;
-                    rel1 { relative: 0.0 1.0; to: "uri_bar_bg"; }
-                    rel2 { relative: 1.0 1.0; to: "bg"; }
-                }
-            }
-            part {
-                name: "web_view_dummy_button";
-                type: SWALLOW;
                 mouse_events: 1;
                 repeat_events: 1;
-                scale: 1;
                 description {
                     state: "default" 0.0;
                     visible: 1;
@@ -310,8 +295,8 @@ collections { base_scale: 2.6;
                     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"; }
+                    rel1 { relative: 0.0 1.0; to: "uri_bar_bg"; }
+                    rel2 { relative: 1.0 1.0; to: "bg"; }
                 }
             }
             part { name: "progressbar_bg";