Changeset 173094 in webkit
- Timestamp:
- Aug 28, 2014, 5:09:46 PM (11 years ago)
- 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 1 2014-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 1 43 2014-08-28 Lucas Forschler <lforschler@apple.com> 2 44 -
branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h
r170667 r173094 114 114 - (void)_setCustomSwipeViewsTopContentInset:(float)topContentInset; 115 115 - (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; 116 118 117 119 #endif -
branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm
r172983 r173094 4081 4081 } 4082 4082 4083 - (void)_setDidMoveSwipeSnapshotCallback:(void(^)(CGRect))callback 4084 { 4085 if (!_data->_allowsBackForwardNavigationGestures) 4086 return; 4087 4088 [self _ensureGestureController]; 4089 _data->_gestureController->setDidMoveSwipeSnapshotCallback(callback); 4090 } 4091 4083 4092 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 4084 4093 -
branches/safari-600.1-branch/Source/WebKit2/UIProcess/PageClient.h
r172983 r173094 232 232 virtual void removeNavigationGestureSnapshot() = 0; 233 233 234 virtual CGRect boundsOfLayerInLayerBackedWindowCoordinates(CALayer *) const = 0; 235 234 236 virtual ColorSpaceData colorSpace() = 0; 235 237 -
branches/safari-600.1-branch/Source/WebKit2/UIProcess/WebPageProxy.h
r172770 r173094 510 510 WKView* wkView() const; 511 511 void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize); 512 CGRect boundsOfLayerInLayerBackedWindowCoordinates(CALayer *) const; 512 513 #endif 513 514 #endif // PLATFORM(COCOA) -
branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h
r172983 r173094 109 109 virtual WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&) = 0; 110 110 #endif 111 111 112 CGRect boundsOfLayerInLayerBackedWindowCoordinates(CALayer *layer) const; 113 112 114 virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled); 113 115 -
branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm
r172983 r173094 743 743 } 744 744 745 CGRect 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 745 753 } // namespace WebKit 746 754 -
branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ViewGestureController.h
r172983 r173094 101 101 void setCustomSwipeViewsTopContentInset(float topContentInset) { m_customSwipeViewsTopContentInset = topContentInset; } 102 102 WebCore::FloatRect windowRelativeBoundsForCustomSwipeViews() const; 103 void setDidMoveSwipeSnapshotCallback(void(^)(CGRect)); 103 104 104 105 void endActiveGesture(); … … 149 150 CALayer *determineLayerAdjacentToSnapshotForParent(SwipeDirection, CALayer *snapshotLayerParent) const; 150 151 void applyDebuggingPropertiesToSwipeViews(); 152 void didMoveSwipeSnapshotLayer(); 151 153 #endif 152 154 … … 189 191 SwipeDirection m_pendingSwipeDirection; 190 192 WebCore::FloatSize m_cumulativeDeltaForPendingSwipe; 193 194 void (^m_didMoveSwipeSnapshotCallback)(CGRect); 191 195 192 196 bool m_shouldIgnorePinnedState; -
branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm
r172990 r173094 107 107 , m_customSwipeViewsTopContentInset(0) 108 108 , m_pendingSwipeReason(PendingSwipeReason::None) 109 , m_didMoveSwipeSnapshotCallback(nullptr) 109 110 , m_shouldIgnorePinnedState(false) 110 111 , m_swipeWaitingForVisuallyNonEmptyLayout(false) … … 124 125 removeSwipeSnapshot(); 125 126 127 if (m_didMoveSwipeSnapshotCallback) { 128 Block_release(m_didMoveSwipeSnapshotCallback); 129 m_didMoveSwipeSnapshotCallback = nullptr; 130 } 131 126 132 m_webPageProxy.process().removeMessageReceiver(Messages::ViewGestureController::messageReceiverName(), m_webPageProxy.pageID()); 127 133 } … … 314 320 315 321 return true; 322 } 323 324 void ViewGestureController::setDidMoveSwipeSnapshotCallback(void(^callback)(CGRect)) 325 { 326 if (m_didMoveSwipeSnapshotCallback) 327 Block_release(m_didMoveSwipeSnapshotCallback); 328 m_didMoveSwipeSnapshotCallback = Block_copy(callback); 316 329 } 317 330 … … 596 609 else 597 610 [snapshotLayerParent insertSublayer:m_swipeLayer.get() above:layerAdjacentToSnapshot]; 611 612 didMoveSwipeSnapshotLayer(); 598 613 } 599 614 … … 614 629 615 630 if (m_swipeTransitionStyle == SwipeTransitionStyle::Overlap) { 616 if (direction == SwipeDirection::Right) 631 if (direction == SwipeDirection::Right) { 617 632 [m_swipeLayer setTransform:CATransform3DMakeTranslation(width + swipingLayerOffset, 0, 0)]; 633 didMoveSwipeSnapshotLayer(); 634 } 618 635 } else if (m_swipeTransitionStyle == SwipeTransitionStyle::Push) 619 636 [m_swipeLayer setTransform:CATransform3DMakeTranslation((direction == SwipeDirection::Left ? -width : width) + swipingLayerOffset, 0, 0)]; … … 628 645 } 629 646 647 void ViewGestureController::didMoveSwipeSnapshotLayer() 648 { 649 if (!m_didMoveSwipeSnapshotCallback) 650 return; 651 652 m_didMoveSwipeSnapshotCallback(m_webPageProxy.boundsOfLayerInLayerBackedWindowCoordinates(m_swipeLayer.get())); 653 } 654 630 655 void ViewGestureController::endSwipeGesture(WebBackForwardListItem* targetItem, bool cancelled) 631 656 { -
branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
r170782 r173094 664 664 #endif 665 665 666 CGRect WebPageProxy::boundsOfLayerInLayerBackedWindowCoordinates(CALayer *layer) const 667 { 668 return m_pageClient.boundsOfLayerInLayerBackedWindowCoordinates(layer); 669 } 670 666 671 } // namespace WebKit 667 672
Note:
See TracChangeset
for help on using the changeset viewer.