uBrowser: Add menu option to toggle EWK auto fitting setting.
authorPiotr Tworek <p.tworek@samsung.com>
Wed, 29 Apr 2015 14:10:38 +0000 (16:10 +0200)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
This was requested by SRPOL QA. Apparently some of the tests they plan
to perform on the uBrowser require this feature. The feature is also known
as overview mode.

Bug: http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=12737
Reviewed by: Hyunhak Kim, arno renevier

Change-Id: I141fbff5395bc0324b3b342efaf257cceeca2763
Signed-off-by: Piotr Tworek <p.tworek@samsung.com>
tizen_src/ewk/ubrowser/window.cc
tizen_src/ewk/ubrowser/window.h
tizen_src/ewk/ubrowser/window_ui.cc
tizen_src/ewk/ubrowser/window_ui.h

index b97dfed..263844b 100644 (file)
@@ -88,6 +88,10 @@ Window::~Window() {
   delete ui_;
 }
 
+Ewk_Settings* Window::GetEwkSettings() const {
+  return ewk_view_settings_get(web_view_);
+}
+
 void Window::LoadURL(std::string url) {
   const static std::string http = "http://";
   const static std::string https = "https://";
index aebad7f..a62f264 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <string>
 #include <Ecore_Evas.h>
+#include <ewk_settings.h>
 
 class Browser;
 class WindowUI;
@@ -19,6 +20,7 @@ class Window {
   ~Window();
 
   Evas_Object* GetEvasObject() const { return window_; };
+  Ewk_Settings* GetEwkSettings() const;
 
   void LoadURL(std::string url);
   const char* GetURL() const;
index ee9d6cd..d118035 100644 (file)
@@ -7,6 +7,7 @@
 #include <assert.h>
 #include <Elementary.h>
 #include <ewk_context.h>
+#include <ewk_settings.h>
 
 #include "browser.h"
 #include "logger.h"
@@ -173,6 +174,15 @@ Evas_Object* WindowUI::CreateExtraActionsMenu(Evas_Object* parent) {
         &WindowUI::OnStopTracing, this);
   }
 
+  Ewk_Settings* settings = window_.GetEwkSettings();
+  if (!ewk_settings_auto_fitting_get(settings)) {
+    elm_ctxpopup_item_append(menu, "Enable auto fitting", NULL,
+        &WindowUI::OnAutoFittingEnabled, this);
+  } else {
+    elm_ctxpopup_item_append(menu, "Disable auto fitting", NULL,
+        &WindowUI::OnAutoFittingDisabled, this);
+  }
+
   elm_ctxpopup_item_append(menu, "Zoom in", NULL, &WindowUI::OnZoomIn, this);
   elm_ctxpopup_item_append(menu, "Zoom out", NULL, &WindowUI::OnZoomOut, this);
 
@@ -359,3 +369,21 @@ void WindowUI::OnStopTracing(void* data, Evas_Object* obj, void*) {
   elm_ctxpopup_dismiss(obj);
   thiz->ShowNotification("Tracing finished");
 }
+
+void WindowUI::OnAutoFittingEnabled(void* data, Evas_Object* obj, void*) {
+  log_trace("%s", __PRETTY_FUNCTION__);
+  WindowUI *thiz = static_cast<WindowUI*>(data);
+  Ewk_Settings* settings = thiz->window_.GetEwkSettings();
+  ewk_settings_auto_fitting_set(settings, true);
+  elm_ctxpopup_dismiss(obj);
+  thiz->ShowNotification("Auto fitting enabled");
+}
+
+void WindowUI::OnAutoFittingDisabled(void* data, Evas_Object* obj, void*) {
+  log_trace("%s", __PRETTY_FUNCTION__);
+  WindowUI *thiz = static_cast<WindowUI*>(data);
+  Ewk_Settings* settings = thiz->window_.GetEwkSettings();
+  ewk_settings_auto_fitting_set(settings, false);
+  elm_ctxpopup_dismiss(obj);
+  thiz->ShowNotification("Auto fitting disabled");
+}
index 4591361..3d21534 100644 (file)
@@ -54,6 +54,8 @@ class WindowUI {
   static void OnZoomOut(void* data, Evas_Object*, void*);
   static void OnStartTracing(void* data, Evas_Object*, void*);
   static void OnStopTracing(void* data, Evas_Object*, void*);
+  static void OnAutoFittingEnabled(void* data, Evas_Object*, void*);
+  static void OnAutoFittingDisabled(void* data, Evas_Object*, void*);
 
   Window& window_;
   Browser& browser_;