Changeset 163323 in webkit


Ignore:
Timestamp:
Feb 3, 2014 1:46:46 PM (10 years ago)
Author:
timothy_horton@apple.com
Message:

WebKit2 View Gestures: Two smart magnifications in a row without moving the mouse should zoom out
https://bugs.webkit.org/show_bug.cgi?id=128108
<rdar://problem/15914539>

Reviewed by Darin Adler.

  • UIProcess/mac/ViewGestureController.h:
  • UIProcess/mac/ViewGestureController.mm:

(WebKit::ViewGestureController::ViewGestureController):
(WebKit::ViewGestureController::handleMagnificationGesture):
Clear the bit that tells us that we should do "smart" things (because the
last gesture was also a smart magnification gesture) when the user manually pinch-magnifies.

(WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
Zoom out if the mouse hasn't moved since the last pinch-magnification gesture.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r163311 r163323  
     12014-02-03  Tim Horton  <timothy_horton@apple.com>
     2
     3        WebKit2 View Gestures: Two smart magnifications in a row without moving the mouse should zoom out
     4        https://bugs.webkit.org/show_bug.cgi?id=128108
     5        <rdar://problem/15914539>
     6
     7        Reviewed by Darin Adler.
     8
     9        * UIProcess/mac/ViewGestureController.h:
     10        * UIProcess/mac/ViewGestureController.mm:
     11        (WebKit::ViewGestureController::ViewGestureController):
     12        (WebKit::ViewGestureController::handleMagnificationGesture):
     13        Clear the bit that tells us that we should do "smart" things (because the
     14        last gesture was also a smart magnification gesture) when the user manually pinch-magnifies.
     15
     16        (WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
     17        Zoom out if the mouse hasn't moved since the last pinch-magnification gesture.
     18
     19
    1202014-02-03  Darin Adler  <darin@apple.com>
    221
  • trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h

    r163093 r163323  
    101101
    102102    WebCore::FloatRect m_lastSmartMagnificationUnscaledTargetRect;
    103     bool m_lastSmartMagnificationUnscaledTargetRectIsValid;
     103    bool m_lastMagnificationGestureWasSmartMagnification;
     104    WebCore::FloatPoint m_lastSmartMagnificationOrigin;
    104105
    105106    ViewGestureType m_activeGestureType;
  • trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.mm

    r163192 r163323  
    9494ViewGestureController::ViewGestureController(WebPageProxy& webPageProxy)
    9595    : m_webPageProxy(webPageProxy)
    96     , m_lastSmartMagnificationUnscaledTargetRectIsValid(false)
     96    , m_lastMagnificationGestureWasSmartMagnification(false)
    9797    , m_activeGestureType(ViewGestureType::None)
    9898    , m_visibleContentRectIsValid(false)
     
    154154        m_magnification = m_webPageProxy.pageScaleFactor();
    155155        m_webPageProxy.process().send(Messages::ViewGestureGeometryCollector::CollectGeometryForMagnificationGesture(), m_webPageProxy.pageID());
     156        m_lastMagnificationGestureWasSmartMagnification = false;
    156157
    157158        return;
     
    226227
    227228    // Allow panning between elements via double-tap while magnified, unless the target rect is
    228     // similar to the last one, in which case we'll zoom all the way out.
    229     if (currentScaleFactor > 1
    230         && m_lastSmartMagnificationUnscaledTargetRectIsValid
    231         && maximumRectangleComponentDelta(m_lastSmartMagnificationUnscaledTargetRect, unscaledTargetRect) < smartMagnificationPanScrollThreshold)
    232         targetMagnification = 1;
     229    // similar to the last one or the mouse has not moved, in which case we'll zoom all the way out.
     230    if (currentScaleFactor > 1 && m_lastMagnificationGestureWasSmartMagnification) {
     231        if (maximumRectangleComponentDelta(m_lastSmartMagnificationUnscaledTargetRect, unscaledTargetRect) < smartMagnificationPanScrollThreshold)
     232            targetMagnification = 1;
     233
     234        if (m_lastSmartMagnificationOrigin == origin)
     235            targetMagnification = 1;
     236    }
    233237
    234238    FloatRect targetRect(unscaledTargetRect);
     
    241245
    242246    m_lastSmartMagnificationUnscaledTargetRect = unscaledTargetRect;
    243     m_lastSmartMagnificationUnscaledTargetRectIsValid = true;
     247    m_lastSmartMagnificationOrigin = origin;
     248
     249    m_lastMagnificationGestureWasSmartMagnification = true;
    244250}
    245251
Note: See TracChangeset for help on using the changeset viewer.