Implement Force zoom
authorbunam.jeon <bunam.jeon@samsung.com>
Mon, 17 Jun 2013 08:52:22 +0000 (17:52 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Mon, 21 Oct 2013 05:13:18 +0000 (05:13 +0000)
[Title] Implement Force zoom
[Issue#]
[Problem]
[Cause] Not Implement
[Solution] Implement Force zoom

Change-Id: I5d89c55916b3e7b9f6f0a047426686b10c5fa18a

Source/WebKit2/Shared/WebPreferencesStore.h
Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp
Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp
Source/WebKit2/UIProcess/API/efl/ewk_settings.h

index 5f7d494..0f4145d 100755 (executable)
@@ -214,6 +214,7 @@ namespace WebKit {
     macro(LinkMagnifierEnabled, linkMagnifierEnabled, Bool, bool, false) \
     macro(AutoFittingEnabled, autoFittingEnabled, Bool, bool, true) \
     macro(TextStyleStateEnabled, textStyleStateEnabled, Bool, bool, false) \
+    macro(ForceZoomEnabled, forceZoomEnabled, Bool, bool, false) \
     \
 
 #else
@@ -232,6 +233,7 @@ namespace WebKit {
     macro(LinkMagnifierEnabled, linkMagnifierEnabled, Bool, bool, false) \
     macro(AutoFittingEnabled, autoFittingEnabled, Bool, bool, true) \
     macro(TextStyleStateEnabled, textStyleStateEnabled, Bool, bool, false) \
+    macro(ForceZoomEnabled, forceZoomEnabled, Bool, bool, false) \
     \
 
 #endif
index 40f6c7d..760b834 100755 (executable)
@@ -171,6 +171,12 @@ PageClientImpl::ViewportConstraints PageClientImpl::computeViewportConstraints(c
     constraints.layoutSize = attributes.layoutSize;
     constraints.fixedInitialScale = (ViewportArguments::ValueAuto != attributes.initialScale);
 
+    bool forceZoomEnabled = m_viewImpl->page()->pageGroup()->preferences()->forceZoomEnabled();
+    if (forceZoomEnabled && (fabs(constraints.minimumScale - constraints.maximumScale) < numeric_limits<float>::epsilon())) {
+        constraints.maximumScale = 5.0;
+        constraints.userScalable = true;
+    }
+
     bool autoFittingEnabled = m_viewImpl->page()->pageGroup()->preferences()->autoFittingEnabled();
     if (autoFittingEnabled)
         constraints.initialScale = attributes.minimumScale * attributes.devicePixelRatio;
index 92b4a10..6192f04 100755 (executable)
@@ -201,6 +201,22 @@ Eina_Bool ewk_settings_auto_fitting_get(const Ewk_Settings* settings)
     return settings->preferences()->autoFittingEnabled();
 }
 
+Eina_Bool ewk_settings_force_zoom_set(Ewk_Settings* settings, Eina_Bool enable)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
+
+    settings->preferences()->setForceZoomEnabled(enable);
+
+    return true;
+}
+
+Eina_Bool ewk_settings_force_zoom_get(const Ewk_Settings* settings)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
+
+    return settings->preferences()->forceZoomEnabled();
+}
+
 Eina_Bool ewk_settings_font_default_size_set(Ewk_Settings* settings, int size)
 {
     EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
index 2b516b4..4502942 100755 (executable)
@@ -175,6 +175,25 @@ EAPI Eina_Bool ewk_settings_auto_fitting_set(Ewk_Settings *settings, Eina_Bool e
 EAPI Eina_Bool ewk_settings_auto_fitting_get(const Ewk_Settings *settings);
 
 /**
+ * Requests setting of force zoom.
+ *
+ * @param settings settings object to enable force zoom
+ * @param enable to force zoom
+ *
+ * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_settings_force_zoom_set(Ewk_Settings *settings, Eina_Bool enable);
+
+/**
+ * Returns the force zoom status.
+ *
+ * @param settings settings object to enable force zoom
+ *
+ * @return @c EINA_TRUE if enable force zoom or @c EINA_FALSE.
+ */
+EAPI Eina_Bool ewk_settings_force_zoom_get(const Ewk_Settings *settings);
+
+/**
  * Requests to set the default font size.
  *
  * @param settings settings object to set the default font size