Changeset 173094 in webkit


Ignore:
Timestamp:
Aug 28, 2014, 5:09:46 PM (11 years ago)
Author:
Lucas Forschler
Message:

Merged r173040. rdar://problem/18105827

Location:
branches/safari-600.1-branch/Source/WebKit2
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-600.1-branch/Source/WebKit2/ChangeLog

    r173089 r173094  
     12014-08-28  Lucas Forschler  <lforschler@apple.com>
     2
     3        Merge r173040
     4
     5    2014-08-27  Tim Horton  <timothy_horton@apple.com>
     6
     7            WebKit2 swipe gesture should report the position of the snapshot to the client
     8            https://bugs.webkit.org/show_bug.cgi?id=136308
     9            rdar://problem/18105827
     10
     11            Reviewed by Simon Fraser.
     12
     13            * UIProcess/API/Cocoa/WKViewPrivate.h:
     14            * UIProcess/API/mac/WKView.mm:
     15            (-[WKView _setDidMoveSwipeSnapshotCallback:]):
     16            Add _setDidMoveSwipeSnapshotCallback, and plumb it to ViewGestureController.
     17            Callers provide a block which is called whenever ViewGestureController moves the
     18            swipe *snapshot* layer around.
     19
     20            * UIProcess/PageClient.h:
     21            * UIProcess/WebPageProxy.h:
     22            * UIProcess/mac/PageClientImpl.h:
     23            * UIProcess/mac/PageClientImpl.mm:
     24            (WebKit::PageClientImpl::boundsOfLayerInLayerBackedWindowCoordinates):
     25            * UIProcess/mac/WebPageProxyMac.mm:
     26            (WebKit::WebPageProxy::boundsOfLayerInLayerBackedWindowCoordinates):
     27            Expose a Mac-only way to get the bounds of a given CALayer in window coordinates,
     28            respecting transforms. This only works for layer-backed windows because
     29            it uses CA in order to do the mapping respecting transforms.
     30
     31            * UIProcess/mac/ViewGestureController.h:
     32            * UIProcess/mac/ViewGestureControllerMac.mm:
     33            (WebKit::ViewGestureController::ViewGestureController):
     34            (WebKit::ViewGestureController::~ViewGestureController):
     35            (WebKit::ViewGestureController::setDidMoveSwipeSnapshotCallback):
     36            Do the Block_copy and Block_release dance to keep our copy of the callback block.
     37
     38            (WebKit::ViewGestureController::beginSwipeGesture):
     39            (WebKit::ViewGestureController::handleSwipeGesture):
     40            (WebKit::ViewGestureController::didMoveSwipeSnapshotLayer):
     41            When the swipe snapshot layer moves around, call the block.
     42
    1432014-08-28  Lucas Forschler  <lforschler@apple.com>
    244
  • branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h

    r170667 r173094  
    114114- (void)_setCustomSwipeViewsTopContentInset:(float)topContentInset;
    115115- (BOOL)_tryToSwipeWithEvent:(NSEvent *)event ignoringPinnedState:(BOOL)ignoringPinnedState;
     116// The rect returned is always that of the snapshot, not necessarily the swiping layer. This only works for layer-backed windows.
     117- (void)_setDidMoveSwipeSnapshotCallback:(void(^)(CGRect swipeSnapshotRectInWindowCoordinates))callback;
    116118
    117119#endif
  • branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r172983 r173094  
    40814081}
    40824082
     4083- (void)_setDidMoveSwipeSnapshotCallback:(void(^)(CGRect))callback
     4084{
     4085    if (!_data->_allowsBackForwardNavigationGestures)
     4086        return;
     4087
     4088    [self _ensureGestureController];
     4089    _data->_gestureController->setDidMoveSwipeSnapshotCallback(callback);
     4090}
     4091
    40834092#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
    40844093
  • branches/safari-600.1-branch/Source/WebKit2/UIProcess/PageClient.h

    r172983 r173094  
    232232    virtual void removeNavigationGestureSnapshot() = 0;
    233233
     234    virtual CGRect boundsOfLayerInLayerBackedWindowCoordinates(CALayer *) const = 0;
     235
    234236    virtual ColorSpaceData colorSpace() = 0;
    235237
  • branches/safari-600.1-branch/Source/WebKit2/UIProcess/WebPageProxy.h

    r172770 r173094  
    510510    WKView* wkView() const;
    511511    void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize);
     512    CGRect boundsOfLayerInLayerBackedWindowCoordinates(CALayer *) const;
    512513#endif
    513514#endif // PLATFORM(COCOA)
  • branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h

    r172983 r173094  
    109109    virtual WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&) = 0;
    110110#endif
    111        
     111
     112    CGRect boundsOfLayerInLayerBackedWindowCoordinates(CALayer *layer) const;
     113
    112114    virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled);
    113115
  • branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm

    r172983 r173094  
    743743}
    744744
     745CGRect PageClientImpl::boundsOfLayerInLayerBackedWindowCoordinates(CALayer *layer) const
     746{
     747    CALayer *windowContentLayer = static_cast<NSView *>(m_wkView.window.contentView).layer;
     748    ASSERT(windowContentLayer);
     749
     750    return [windowContentLayer convertRect:layer.bounds fromLayer:layer];
     751}
     752
    745753} // namespace WebKit
    746754
  • branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ViewGestureController.h

    r172983 r173094  
    101101    void setCustomSwipeViewsTopContentInset(float topContentInset) { m_customSwipeViewsTopContentInset = topContentInset; }
    102102    WebCore::FloatRect windowRelativeBoundsForCustomSwipeViews() const;
     103    void setDidMoveSwipeSnapshotCallback(void(^)(CGRect));
    103104
    104105    void endActiveGesture();
     
    149150    CALayer *determineLayerAdjacentToSnapshotForParent(SwipeDirection, CALayer *snapshotLayerParent) const;
    150151    void applyDebuggingPropertiesToSwipeViews();
     152    void didMoveSwipeSnapshotLayer();
    151153#endif
    152154
     
    189191    SwipeDirection m_pendingSwipeDirection;
    190192    WebCore::FloatSize m_cumulativeDeltaForPendingSwipe;
     193
     194    void (^m_didMoveSwipeSnapshotCallback)(CGRect);
    191195
    192196    bool m_shouldIgnorePinnedState;
  • branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm

    r172990 r173094  
    107107    , m_customSwipeViewsTopContentInset(0)
    108108    , m_pendingSwipeReason(PendingSwipeReason::None)
     109    , m_didMoveSwipeSnapshotCallback(nullptr)
    109110    , m_shouldIgnorePinnedState(false)
    110111    , m_swipeWaitingForVisuallyNonEmptyLayout(false)
     
    124125        removeSwipeSnapshot();
    125126
     127    if (m_didMoveSwipeSnapshotCallback) {
     128        Block_release(m_didMoveSwipeSnapshotCallback);
     129        m_didMoveSwipeSnapshotCallback = nullptr;
     130    }
     131
    126132    m_webPageProxy.process().removeMessageReceiver(Messages::ViewGestureController::messageReceiverName(), m_webPageProxy.pageID());
    127133}
     
    314320
    315321    return true;
     322}
     323
     324void ViewGestureController::setDidMoveSwipeSnapshotCallback(void(^callback)(CGRect))
     325{
     326    if (m_didMoveSwipeSnapshotCallback)
     327        Block_release(m_didMoveSwipeSnapshotCallback);
     328    m_didMoveSwipeSnapshotCallback = Block_copy(callback);
    316329}
    317330
     
    596609    else
    597610        [snapshotLayerParent insertSublayer:m_swipeLayer.get() above:layerAdjacentToSnapshot];
     611
     612    didMoveSwipeSnapshotLayer();
    598613}
    599614
     
    614629
    615630    if (m_swipeTransitionStyle == SwipeTransitionStyle::Overlap) {
    616         if (direction == SwipeDirection::Right)
     631        if (direction == SwipeDirection::Right) {
    617632            [m_swipeLayer setTransform:CATransform3DMakeTranslation(width + swipingLayerOffset, 0, 0)];
     633            didMoveSwipeSnapshotLayer();
     634        }
    618635    } else if (m_swipeTransitionStyle == SwipeTransitionStyle::Push)
    619636        [m_swipeLayer setTransform:CATransform3DMakeTranslation((direction == SwipeDirection::Left ? -width : width) + swipingLayerOffset, 0, 0)];
     
    628645}
    629646
     647void ViewGestureController::didMoveSwipeSnapshotLayer()
     648{
     649    if (!m_didMoveSwipeSnapshotCallback)
     650        return;
     651
     652    m_didMoveSwipeSnapshotCallback(m_webPageProxy.boundsOfLayerInLayerBackedWindowCoordinates(m_swipeLayer.get()));
     653}
     654
    630655void ViewGestureController::endSwipeGesture(WebBackForwardListItem* targetItem, bool cancelled)
    631656{
  • branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm

    r170782 r173094  
    664664#endif
    665665
     666CGRect WebPageProxy::boundsOfLayerInLayerBackedWindowCoordinates(CALayer *layer) const
     667{
     668    return m_pageClient.boundsOfLayerInLayerBackedWindowCoordinates(layer);
     669}
     670
    666671} // namespace WebKit
    667672
Note: See TracChangeset for help on using the changeset viewer.