[Webkit-unassigned] [Bug 188746] [GTK] Touchscreen pinch to zoom should scale the page like other platforms

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 23 08:39:55 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=188746

--- Comment #42 from Justin Michaud <justin at justinmichaud.com> ---
Fixed the period.

I don't know if there is any other time the page scale would need to be reset. The problem is that we need to reset the scale when the zoom is reset, but not when it is changed. I suppose it is a pretty minor detail.

I am not sure how to add a test, since there is no way to get or set the page scale from the public api. I would appreciate some guidance. I think the unit test is the last remaining part of this, if it is required.

Ephy patch:
```
diff --git a/src/ephy-window.c b/src/ephy-window.c
index a86fd45b2..366c4d50a 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -967,7 +967,7 @@ sync_tab_zoom (WebKitWebView *web_view, GParamSpec *pspec, EphyWindow *window)
 {
   GActionGroup *action_group;
   GAction *action;
-  gboolean can_zoom_in = TRUE, can_zoom_out = TRUE, can_zoom_normal = FALSE;
+  gboolean can_zoom_in = TRUE, can_zoom_out = TRUE;
   double zoom;
   GtkWidget *zoom_level_button;
   gchar *zoom_level;
@@ -991,10 +991,6 @@ sync_tab_zoom (WebKitWebView *web_view, GParamSpec *pspec, EphyWindow *window)
     can_zoom_out = FALSE;
   }

-  if (zoom != 1.0) {
-    can_zoom_normal = TRUE;
-  }
-
   action_group = gtk_widget_get_action_group (GTK_WIDGET (window),
                                               "win");

@@ -1003,7 +999,7 @@ sync_tab_zoom (WebKitWebView *web_view, GParamSpec *pspec, EphyWindow *window)
   action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "zoom-out");
   g_simple_action_set_enabled (G_SIMPLE_ACTION (action), can_zoom_out);
   action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "zoom-normal");
-  g_simple_action_set_enabled (G_SIMPLE_ACTION (action), can_zoom_normal);
+  g_simple_action_set_enabled (G_SIMPLE_ACTION (action), true);
 }

 static void
@@ -3472,6 +3468,27 @@ ephy_window_set_zoom (EphyWindow *window,
     webkit_web_view_set_zoom_level (web_view, zoom);
 }

+/**
+ * ephy_window_reset_scale:
+ * @window: an #EphyWindow
+ *
+ * Resets the page scale on @window's active #EphyEmbed.
+ **/
+void
+ephy_window_reset_scale (EphyWindow *window)
+{
+  EphyEmbed *embed;
+  WebKitWebView *web_view;
+
+  g_assert (EPHY_IS_WINDOW (window));
+
+  embed = window->active_embed;
+  g_assert (embed != NULL);
+
+  web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+  webkit_web_view_reset_page_scale (web_view);
+}
+
 static void
 ephy_window_change_allow_popup_windows_state (GSimpleAction *action,
                                               GVariant      *state,
diff --git a/src/ephy-window.h b/src/ephy-window.h
index 1a6feab4d..ca8d72707 100644
--- a/src/ephy-window.h
+++ b/src/ephy-window.h
@@ -53,6 +53,8 @@ void              ephy_window_load_url            (EphyWindow *window,
 void              ephy_window_set_zoom            (EphyWindow *window,
                                                    double zoom);

+void              ephy_window_reset_scale         (EphyWindow *window);
+
 void              ephy_window_activate_location   (EphyWindow *window);
 const char       *ephy_window_get_location        (EphyWindow *window);

diff --git a/src/window-commands.c b/src/window-commands.c
index 0d483808c..a014500ad 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1783,6 +1783,7 @@ window_cmd_zoom_normal (GSimpleAction *action,
 {
   EphyWindow *window = user_data;
   ephy_window_set_zoom (window, 1.0);
+  ephy_window_reset_scale (window);
 }

 void
```

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180823/0f08d438/attachment.html>


More information about the webkit-unassigned mailing list