Changeset 171034 in webkit
- Timestamp:
- Jul 12, 2014, 4:32:39 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r171030 r171034 1 2014-07-12 Dan Bernstein <mitz@apple.com> 2 3 <rdar://problem/16020380> [Cocoa] Inform the client when back-forward navigation gestures begin and end 4 https://bugs.webkit.org/show_bug.cgi?id=134853 5 6 Reviewed by Sam Weinig. 7 8 * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Declared new WKNavigationDelegate 9 methods. 10 11 * UIProcess/API/Cocoa/WKWebView.mm: 12 (-[WKWebView _isShowingNavigationGestureSnapshot]): Added this getter. 13 14 * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declared new property 15 _isShowingNavigationGestureSnapshot. 16 17 * UIProcess/Cocoa/NavigationState.h: 18 * UIProcess/Cocoa/NavigationState.mm: 19 (WebKit::NavigationState::setNavigationDelegate): Initialize new flags in 20 m_navigationDelegateMethods. 21 (WebKit::NavigationState::navigationGestureDidBegin): Added. Calls the new 22 WKNavigationDelegate method. 23 (WebKit::NavigationState::navigationGestureWillEnd): Ditto. 24 (WebKit::NavigationState::navigationGestureDidEnd): Ditto. 25 26 * UIProcess/PageClient.h: Declared new client functions. 27 28 * UIProcess/WebPageProxy.cpp: 29 (WebKit::WebPageProxy::WebPageProxy): Initialize new member variable. 30 (WebKit::WebPageProxy::navigationGestureDidBegin): Set m_isShowingNavigationGestureSnapshot 31 and call the new client function. 32 (WebKit::WebPageProxy::navigationGestureWillEnd): Call the new client function. 33 (WebKit::WebPageProxy::navigationGestureDidEnd): Ditto. 34 (WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved): Clear 35 m_isShowingNavigationGestureSnapshot. 36 * UIProcess/WebPageProxy.h: 37 (WebKit::WebPageProxy::isShowingNavigationGestureSnapshot): Added this getter. 38 39 * UIProcess/ios/PageClientImplIOS.h: Declared overrides of new client functions. 40 * UIProcess/ios/PageClientImplIOS.mm: 41 (WebKit::PageClientImpl::navigationGestureDidBegin): Override that calls the new 42 NavigationState function. 43 (WebKit::PageClientImpl::navigationGestureWillEnd): Ditto. 44 (WebKit::PageClientImpl::navigationGestureDidEnd): Ditto. 45 46 * UIProcess/ios/ViewGestureControllerIOS.mm: 47 (WebKit::ViewGestureController::beginSwipeGesture): Added calls to 48 WebPageProxy::navigationGestureDidBegin and WebPageProxy::navigationGestureWillEnd. 49 (WebKit::ViewGestureController::endSwipeGesture): Added calls to 50 WebPageProxy::navigationGestureDidEnd. 51 (WebKit::ViewGestureController::removeSwipeSnapshot): Added call to 52 WebPageProxy::navigationGestureSnapshotWasRemoved. 53 54 * UIProcess/mac/PageClientImpl.h: Declared overrides of new client functions. 55 * UIProcess/mac/PageClientImpl.mm: 56 (WebKit::PageClientImpl::navigationGestureDidBegin): Override that calls the new 57 NavigationState function. 58 (WebKit::PageClientImpl::navigationGestureWillEnd): Ditto. 59 (WebKit::PageClientImpl::navigationGestureDidEnd): Ditto. 60 61 * UIProcess/mac/ViewGestureControllerMac.mm: 62 (WebKit::ViewGestureController::beginSwipeGesture): Added call to 63 WebPageProxy::navigationGestureDidBegin. 64 (WebKit::ViewGestureController::endSwipeGesture): Added calls to 65 WebPageProxy::navigationGestureDidEnd. 66 (WebKit::ViewGestureController::removeSwipeSnapshot): Added call to 67 WebPageProxy::navigationGestureSnapshotWasRemoved. 68 1 69 2014-07-12 Oliver Hunt <oliver@apple.com> 2 70 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h
r171027 r171034 60 60 - (NSData *)_webCryptoMasterKeyForWebView:(WKWebView *)webView; 61 61 62 - (void)_webViewDidBeginNavigationGesture:(WKWebView *)webView; 63 // Item is nil if the gesture ended without navigation. 64 - (void)_webViewDidEndNavigationGesture:(WKWebView *)webView withNavigationToBackForwardListItem:(WKBackForwardListItem *)item; 65 // Only called if how the gesture will end (with or without navigation) is known before it ends. 66 - (void)_webViewWillEndNavigationGesture:(WKWebView *)webView withNavigationToBackForwardListItem:(WKBackForwardListItem *)item; 67 68 62 69 #if TARGET_OS_IPHONE 63 70 - (void)_webView:(WKWebView *)webView didStartLoadForQuickLookDocumentInMainFrameWithFileName:(NSString *)fileName uti:(NSString *)uti; -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r170982 r171034 1981 1981 } 1982 1982 1983 - (BOOL)_isShowingNavigationGestureSnapshot 1984 { 1985 return _page->isShowingNavigationGestureSnapshot(); 1986 } 1987 1983 1988 #pragma mark iOS-specific methods 1984 1989 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
r170856 r171034 102 102 @property (nonatomic, readonly) BOOL _networkRequestsInProgress; 103 103 104 @property (nonatomic, readonly, getter=_isShowingNavigationGestureSnapshot) BOOL _showingNavigationGestureSnapshot; 105 104 106 - (void)_close; 105 107 -
trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h
r171027 r171034 74 74 void didPerformServerRedirect(const WTF::String& sourceURL, const WTF::String& destinationURL); 75 75 void didUpdateHistoryTitle(const WTF::String& title, const WTF::String& url); 76 77 // Called by the page client. 78 void navigationGestureDidBegin(); 79 void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&); 80 void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&); 76 81 77 82 private: … … 159 164 bool webViewWebProcessDidCrash : 1; 160 165 bool webCryptoMasterKeyForWebView : 1; 166 bool webViewDidBeginNavigationGesture : 1; 167 bool webViewWillEndNavigationGestureWithNavigationToBackForwardListItem : 1; 168 bool webViewDidEndNavigationGestureWithNavigationToBackForwardListItem : 1; 161 169 #if USE(QUICK_LOOK) 162 170 bool webViewDidStartLoadForQuickLookDocumentInMainFrame : 1; -
trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm
r171027 r171034 138 138 m_navigationDelegateMethods.webViewWebProcessDidCrash = [delegate respondsToSelector:@selector(_webViewWebProcessDidCrash:)]; 139 139 m_navigationDelegateMethods.webCryptoMasterKeyForWebView = [delegate respondsToSelector:@selector(_webCryptoMasterKeyForWebView:)]; 140 m_navigationDelegateMethods.webViewDidBeginNavigationGesture = [delegate respondsToSelector:@selector(_webViewDidBeginNavigationGesture:)]; 141 m_navigationDelegateMethods.webViewWillEndNavigationGestureWithNavigationToBackForwardListItem = [delegate respondsToSelector:@selector(_webViewWillEndNavigationGesture:withNavigationToBackForwardListItem:)]; 142 m_navigationDelegateMethods.webViewDidEndNavigationGestureWithNavigationToBackForwardListItem = [delegate respondsToSelector:@selector(_webViewDidEndNavigationGesture:withNavigationToBackForwardListItem:)]; 140 143 #if USE(QUICK_LOOK) 141 144 m_navigationDelegateMethods.webViewDidStartLoadForQuickLookDocumentInMainFrame = [delegate respondsToSelector:@selector(_webView:didStartLoadForQuickLookDocumentInMainFrameWithFileName:uti:)]; … … 250 253 251 254 [historyDelegate _webView:m_webView didUpdateHistoryTitle:title forURL:[NSURL _web_URLWithWTFString:url]]; 255 } 256 257 void NavigationState::navigationGestureDidBegin() 258 { 259 if (!m_navigationDelegateMethods.webViewDidBeginNavigationGesture) 260 return; 261 262 auto navigationDelegate = m_navigationDelegate.get(); 263 if (!navigationDelegate) 264 return; 265 266 [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate) _webViewDidBeginNavigationGesture:m_webView]; 267 } 268 269 void NavigationState::navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem& item) 270 { 271 if (!m_navigationDelegateMethods.webViewWillEndNavigationGestureWithNavigationToBackForwardListItem) 272 return; 273 274 auto navigationDelegate = m_navigationDelegate.get(); 275 if (!navigationDelegate) 276 return; 277 278 [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate) _webViewWillEndNavigationGesture:m_webView withNavigationToBackForwardListItem:willNavigate ? wrapper(item) : nil]; 279 } 280 281 void NavigationState::navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem& item) 282 { 283 if (!m_navigationDelegateMethods.webViewDidEndNavigationGestureWithNavigationToBackForwardListItem) 284 return; 285 286 auto navigationDelegate = m_navigationDelegate.get(); 287 if (!navigationDelegate) 288 return; 289 290 [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate) _webViewDidEndNavigationGesture:m_webView withNavigationToBackForwardListItem:willNavigate ? wrapper(item) : nil]; 252 291 } 253 292 -
trunk/Source/WebKit2/UIProcess/PageClient.h
r170981 r171034 295 295 // Custom representations. 296 296 virtual void didFinishLoadingDataForCustomContentProvider(const String& suggestedFilename, const IPC::DataReference&) = 0; 297 298 virtual void navigationGestureDidBegin() = 0; 299 virtual void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&) = 0; 300 virtual void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) = 0; 297 301 }; 298 302 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r171027 r171034 356 356 , m_backgroundExtendsBeyondPage(false) 357 357 , m_shouldRecordNavigationSnapshots(false) 358 , m_isShowingNavigationGestureSnapshot(false) 358 359 , m_pageCount(0) 359 360 , m_renderTreeSize(0) … … 5127 5128 } 5128 5129 5130 void WebPageProxy::navigationGestureDidBegin() 5131 { 5132 m_isShowingNavigationGestureSnapshot = true; 5133 m_pageClient.navigationGestureDidBegin(); 5134 } 5135 5136 void WebPageProxy::navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem& item) 5137 { 5138 m_pageClient.navigationGestureWillEnd(willNavigate, item); 5139 } 5140 5141 void WebPageProxy::navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem& item) 5142 { 5143 m_pageClient.navigationGestureDidEnd(willNavigate, item); 5144 } 5145 5146 void WebPageProxy::navigationGestureSnapshotWasRemoved() 5147 { 5148 m_isShowingNavigationGestureSnapshot = false; 5149 } 5150 5129 5151 } // namespace WebKit -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r171027 r171034 898 898 void takeSnapshot(WebCore::IntRect, WebCore::IntSize bitmapSize, SnapshotOptions, std::function<void (const ShareableBitmap::Handle&, CallbackBase::Error)>); 899 899 900 void navigationGestureDidBegin(); 901 void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&); 902 void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&); 903 void navigationGestureSnapshotWasRemoved(); 904 905 bool isShowingNavigationGestureSnapshot() const { return m_isShowingNavigationGestureSnapshot; } 906 900 907 private: 901 908 WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, const WebPageConfiguration&); … … 1486 1493 1487 1494 bool m_shouldRecordNavigationSnapshots; 1495 bool m_isShowingNavigationGestureSnapshot; 1488 1496 1489 1497 unsigned m_pageCount; -
trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h
r170981 r171034 168 168 virtual Vector<String> mimeTypesWithCustomContentProviders() override; 169 169 170 virtual void navigationGestureDidBegin() override; 171 virtual void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&) override; 172 virtual void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) override; 173 170 174 WKContentView *m_contentView; 171 175 WKWebView *m_webView; -
trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm
r170981 r171034 33 33 #import "DownloadProxy.h" 34 34 #import "FindIndicator.h" 35 #import "InteractionInformationAtPosition.h" 35 36 #import "NativeWebKeyboardEvent.h" 36 #import " InteractionInformationAtPosition.h"37 #import "NavigationState.h" 37 38 #import "ViewSnapshotStore.h" 38 39 #import "WKContentView.h" … … 652 653 } 653 654 655 void PageClientImpl::navigationGestureDidBegin() 656 { 657 NavigationState::fromWebPage(*m_webView->_page).navigationGestureDidBegin(); 658 } 659 660 void PageClientImpl::navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem& item) 661 { 662 NavigationState::fromWebPage(*m_webView->_page).navigationGestureWillEnd(willNavigate, item); 663 } 664 665 void PageClientImpl::navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem& item) 666 { 667 NavigationState::fromWebPage(*m_webView->_page).navigationGestureDidEnd(willNavigate, item); 668 } 669 654 670 } // namespace WebKit 655 671 -
trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm
r170974 r171034 158 158 if (m_activeGestureType != ViewGestureType::None) 159 159 return; 160 160 161 m_webPageProxy.navigationGestureDidBegin(); 162 161 163 ViewSnapshotStore::shared().recordSnapshot(m_webPageProxy); 162 164 … … 210 212 [transitionContext _setInteractor:transition]; 211 213 [transitionContext _setTransitionIsInFlight:YES]; 214 [transitionContext _setInteractiveUpdateHandler:^(BOOL finish, CGFloat percent, BOOL transitionCompleted, _UIViewControllerTransitionContext *) { 215 if (finish) 216 m_webPageProxy.navigationGestureWillEnd(transitionCompleted, *targetItem); 217 }]; 212 218 [transitionContext _setCompletionHandler:^(_UIViewControllerTransitionContext *context, BOOL didComplete) { endSwipeGesture(targetItem, context, !didComplete); }]; 213 219 [transitionContext _setInteractiveUpdateHandler:^(BOOL, CGFloat, BOOL, _UIViewControllerTransitionContext *) { }]; … … 241 247 if (cancelled) { 242 248 removeSwipeSnapshot(); 249 m_webPageProxy.navigationGestureDidEnd(false, *targetItem); 243 250 return; 244 251 } … … 252 259 // displaying the destination item's snapshot. 253 260 ViewSnapshotStore::shared().disableSnapshotting(); 261 262 m_webPageProxy.navigationGestureDidEnd(true, *targetItem); 254 263 m_webPageProxy.goToBackForwardItem(targetItem); 255 264 ViewSnapshotStore::shared().enableSnapshotting(); … … 315 324 m_snapshotRemovalTargetRenderTreeSize = 0; 316 325 m_activeGestureType = ViewGestureType::None; 326 327 m_webPageProxy.navigationGestureSnapshotWasRemoved(); 317 328 } 318 329 -
trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h
r170974 r171034 174 174 #endif 175 175 176 virtual void navigationGestureDidBegin() override; 177 virtual void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&) override; 178 virtual void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) override; 179 176 180 NSView *activeView() const; 177 181 -
trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm
r170974 r171034 29 29 #if PLATFORM(MAC) 30 30 31 #import "_WKDownloadInternal.h"32 31 #import "AttributedString.h" 33 32 #import "ColorSpaceData.h" … … 38 37 #import "NativeWebKeyboardEvent.h" 39 38 #import "NativeWebWheelEvent.h" 39 #import "NavigationState.h" 40 40 #import "StringUtilities.h" 41 41 #import "ViewSnapshotStore.h" … … 44 44 #import "WKStringCF.h" 45 45 #import "WKViewInternal.h" 46 #import "WKWebViewInternal.h" 46 47 #import "WebColorPickerMac.h" 47 48 #import "WebContextMenuProxyMac.h" … … 49 50 #import "WebPopupMenuProxyMac.h" 50 51 #import "WindowServerConnection.h" 52 #import "_WKDownloadInternal.h" 51 53 #import "_WKThumbnailView.h" 52 54 #import <WebCore/AlternativeTextUIController.h> … … 686 688 #endif // ENABLE(FULLSCREEN_API) 687 689 690 void PageClientImpl::navigationGestureDidBegin() 691 { 692 NavigationState::fromWebPage(*m_webView->_page).navigationGestureDidBegin(); 693 } 694 695 void PageClientImpl::navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem& item) 696 { 697 NavigationState::fromWebPage(*m_webView->_page).navigationGestureWillEnd(willNavigate, item); 698 } 699 700 void PageClientImpl::navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem& item) 701 { 702 NavigationState::fromWebPage(*m_webView->_page).navigationGestureDidEnd(willNavigate, item); 703 } 704 688 705 } // namespace WebKit 689 706 -
trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm
r170974 r171034 497 497 ASSERT(m_currentSwipeLiveLayers.isEmpty()); 498 498 499 m_webPageProxy.navigationGestureDidBegin(); 500 499 501 m_activeGestureType = ViewGestureType::Swipe; 500 502 … … 627 629 if (cancelled) { 628 630 removeSwipeSnapshot(); 631 m_webPageProxy.navigationGestureDidEnd(false, *targetItem); 629 632 return; 630 633 } … … 640 643 // displaying the destination item's snapshot. 641 644 ViewSnapshotStore::shared().disableSnapshotting(); 645 m_webPageProxy.navigationGestureDidEnd(true, *targetItem); 642 646 m_webPageProxy.goToBackForwardItem(targetItem); 643 647 ViewSnapshotStore::shared().enableSnapshotting(); … … 686 690 687 691 m_activeGestureType = ViewGestureType::None; 692 693 m_webPageProxy.navigationGestureSnapshotWasRemoved(); 688 694 } 689 695
Note:
See TracChangeset
for help on using the changeset viewer.