[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
Mon Aug 20 12:04:47 PDT 2018


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

--- Comment #9 from Michael Catanzaro <mcatanzaro at igalia.com> ---
Comment on attachment 347503
  --> https://bugs.webkit.org/attachment.cgi?id=347503
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=347503&action=review

> Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp:3121
> + * webkit_web_view_scale_page:
> + * @web_view: a #WebKitWebView
> + * @zoom_level: the zoom level
> + * @scaleCenterX: X coordinate of scale center in page coordinates
> + * @scaleCenterY: y coordinate of scale center in page coordinates
> + * @viewX: X coordinate where scale center should appear, in view coordinates
> + * @viewY: y coordinate where scale center should appear, in view coordinates

Looking at the parameters, I don't understand how this API could plausibly be used by a client application. Where would the coordinates come from? Could you show some example usage, e.g. by updating MiniBrowser to use this API somehow? I suspect it can only sanely be called from PageClientImpl::scale, and if so, it should be declared in WebKitWebViewPrivate.h instead of being public.

Don't we also need a companion API to get the current zoom, scale center, and view coordinates?

> Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp:3125
> + * the web view.

If this remains public, then you'll need to add:

Since: 2.24

> Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp:3155
> +

Avoid the stray whitespace change.

> Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp:497
> +void PageClientImpl::scale(double scale, const IntPoint& scaleCenterInPageCoordinates, const IntPoint& newScaleCenterInViewCoordinates)
> +{
> +    if (WEBKIT_IS_WEB_VIEW(m_viewWidget)) {
> +        webkit_web_view_scale_page(WEBKIT_WEB_VIEW(m_viewWidget), scale,
> +            scaleCenterInPageCoordinates.x(), scaleCenterInPageCoordinates.y(),
> +            newScaleCenterInViewCoordinates.x(), newScaleCenterInViewCoordinates.y());
> +        return;
> +    }
> +
> +    webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_viewWidget))->scaleAndPanPage(scale, scaleCenterInPageCoordinates, newScaleCenterInViewCoordinates);
> +}

Why doesn't iOS need to implement this function?

> Source/WebKit/UIProcess/API/gtk/WebKitWebView.h:413
> +WEBKIT_API void
> +webkit_web_view_scale_page                           (WebKitWebView             *web_view,
> +                                                      gdouble                    zoom_level,
> +                                                      int                        scaleCenterX,
> +                                                      int                        scaleCenterY,
> +                                                      int                        viewX,
> +                                                      int                        viewY);

gint

> Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp:1125
> +    void zoom(double scale, const IntPoint& initialPoint, const IntPoint& centre) final

"center" would be more familiar to most.

> Source/WebKit/UIProcess/WebPageProxy.h:775
> +    void scaleAndPanPage(double scale, WebCore::IntPoint scaleCenterInPageCoordinates, WebCore::IntPoint newScaleCenterInViewCoordinates);

I think this is acceptable, but it is a bit unfortunate to need to add a new message here that is used only by GTK. That's why I'm curious why iOS doesn't need to implement PageClientImpl::scale.

-- 
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/20180820/1f4ab788/attachment.html>


More information about the webkit-unassigned mailing list