[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
Tue Aug 21 07:24:11 PDT 2018


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

--- Comment #13 from Justin Michaud <justin at justinmichaud.com> ---
https://imgur.com/a/LVrSMGj <- Before & After

This seems to me to be consistent with other gnome applications (ex: maps) and chromium on linux. The "before" behaviour is consistent with Firefox on Linux, but the "after" behaviour is consistent with Firefox and Edge on 
Windows last I checked.

Michael raises a great point about iOS not having a message for scaling. On second thought, it is not needed. I made the new message because I originally had a call to convert the scale centre from view coordinates to page coordinates, but later I realised that wasn't necessary.

To verify, it seems this is what iOS does:

``` WKWebView.mm:4111
void WebViewImpl::setMagnification(double magnification, CGPoint centerPoint)
{
    if (magnification <= 0 || isnan(magnification) || isinf(magnification))
        [NSException raise:NSInvalidArgumentException format:@"Magnification should be a positive number"];

    dismissContentRelativeChildWindowsWithAnimation(false);

    m_page->scalePageInViewCoordinates(magnification, WebCore::roundedIntPoint(centerPoint));
}
```

``` ViewGestureControllerMac.mm:141
void ViewGestureController::handleMagnificationGestureEvent(NSEvent *event, FloatPoint origin)
{
    ASSERT(m_activeGestureType == ViewGestureType::None || m_activeGestureType == ViewGestureType::Magnification);

    if (m_activeGestureType == ViewGestureType::None) {
        if (event.phase != NSEventPhaseBegan)
            return;

        // FIXME: We drop the first frame of the gesture on the floor, because we don't have the visible content bounds yet.
        m_magnification = m_webPageProxy.pageScaleFactor();
        m_webPageProxy.process().send(Messages::ViewGestureGeometryCollector::CollectGeometryForMagnificationGesture(), m_webPageProxy.pageID());
        m_lastMagnificationGestureWasSmartMagnification = false;

        return;
    }

    // We're still waiting for the DidCollectGeometry callback.
    if (!m_visibleContentRectIsValid)
        return;

    willBeginGesture(ViewGestureType::Magnification);

    double scale = event.magnification;
    double scaleWithResistance = resistanceForDelta(scale, m_magnification) * scale;

    m_magnification += m_magnification * scaleWithResistance;
    m_magnification = std::min(std::max(m_magnification, minElasticMagnification), maxElasticMagnification);

    m_magnificationOrigin = origin;

    if (m_frameHandlesMagnificationGesture)
        m_webPageProxy.scalePage(m_magnification, roundedIntPoint(origin));
    else
        m_webPageProxy.drawingArea()->adjustTransientZoom(m_magnification, scaledMagnificationOrigin(origin, m_magnification));

    if (event.phase == NSEventPhaseEnded || event.phase == NSEventPhaseCancelled)
        endMagnificationGesture();
}
```

I will have a new patch shortly. Thanks!

-- 
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/20180821/735bafa2/attachment.html>


More information about the webkit-unassigned mailing list