Changeset 253394 in webkit
- Timestamp:
- Dec 11, 2019, 2:04:16 PM (7 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/ViewGestureController.cpp (modified) (2 diffs)
-
UIProcess/ViewGestureController.h (modified) (2 diffs)
-
UIProcess/ios/ViewGestureControllerIOS.mm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r253393 r253394 1 2019-12-11 Chris Dumez <cdumez@apple.com> 2 3 [iOS] Issue load sooner on swipe back/forward navigation 4 https://bugs.webkit.org/show_bug.cgi?id=205127 5 <rdar://problem/57843862> 6 7 Reviewed by Tim Horton. 8 9 Issue load sooner on swipe back/forward navigation on iOS. We were waiting until the end of 10 the swipe animation to issue the load. We now issue the load as soon as the user lifts the finger 11 off the screen and thus commits to navigating. This results in improved perceived performance 12 when swiping back/forward to navigate. 13 14 * UIProcess/ViewGestureController.cpp: 15 (WebKit::ViewGestureController::didStartProvisionalOrSameDocumentLoadForMainFrame): 16 (WebKit::ViewGestureController::willEndSwipeGesture): 17 * UIProcess/ViewGestureController.h: 18 * UIProcess/ios/ViewGestureControllerIOS.mm: 19 (WebKit::ViewGestureController::beginSwipeGesture): 20 (WebKit::ViewGestureController::willEndSwipeGesture): 21 (WebKit::ViewGestureController::endSwipeGesture): 22 1 23 2019-12-11 Sihui Liu <sihui_liu@apple.com> 2 24 -
trunk/Source/WebKit/UIProcess/ViewGestureController.cpp
r253360 r253394 164 164 void ViewGestureController::didStartProvisionalOrSameDocumentLoadForMainFrame() 165 165 { 166 m_didStartProvisionalLoad = true; 166 167 m_snapshotRemovalTracker.resume(); 167 168 #if !PLATFORM(IOS_FAMILY) … … 566 567 auto renderTreeSizeThreshold = renderTreeSize * swipeSnapshotRemovalRenderTreeSizeTargetFraction; 567 568 569 m_didStartProvisionalLoad = false; 568 570 m_webPageProxy.goToBackForwardItem(targetItem); 569 571 -
trunk/Source/WebKit/UIProcess/ViewGestureController.h
r253360 r253394 138 138 void installSwipeHandler(UIView *gestureRecognizerView, UIView *swipingView); 139 139 void beginSwipeGesture(_UINavigationInteractiveTransitionBase *, SwipeDirection); 140 void willEndSwipeGesture(WebBackForwardListItem& targetItem, bool cancelled); 140 141 void endSwipeGesture(WebBackForwardListItem* targetItem, _UIViewControllerTransitionContext *, bool cancelled); 141 142 void willCommitPostSwipeTransitionLayerTree(bool); … … 431 432 432 433 bool m_isConnectedToProcess { false }; 434 bool m_didStartProvisionalLoad { false }; 433 435 434 436 SnapshotRemovalTracker m_snapshotRemovalTracker; -
trunk/Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm
r253076 r253394 260 260 [m_swipeTransitionContext _setInteractiveUpdateHandler:^(BOOL finish, CGFloat percent, BOOL transitionCompleted, _UIViewControllerTransitionContext *) { 261 261 if (finish) 262 m_webPageProxyForBackForwardListForCurrentSwipe->navigationGestureWillEnd(transitionCompleted, *targetItem);262 willEndSwipeGesture(*targetItem, !transitionCompleted); 263 263 }]; 264 264 auto pageID = m_webPageProxy.identifier(); … … 271 271 [transition setAnimationController:animationController.get()]; 272 272 [transition startInteractiveTransition:m_swipeTransitionContext.get()]; 273 } 274 275 void ViewGestureController::willEndSwipeGesture(WebBackForwardListItem& targetItem, bool cancelled) 276 { 277 m_webPageProxyForBackForwardListForCurrentSwipe->navigationGestureWillEnd(!cancelled, targetItem); 278 279 if (cancelled) 280 return; 281 282 m_snapshotRemovalTargetRenderTreeSize = 0; 283 if (ViewSnapshot* snapshot = targetItem.snapshot()) 284 m_snapshotRemovalTargetRenderTreeSize = snapshot->renderTreeSize() * swipeSnapshotRemovalRenderTreeSizeTargetFraction; 285 286 m_didStartProvisionalLoad = false; 287 m_webPageProxyForBackForwardListForCurrentSwipe->goToBackForwardItem(targetItem); 288 289 auto* currentItem = m_webPageProxyForBackForwardListForCurrentSwipe->backForwardList().currentItem(); 290 // The main frame will not be navigated so hide the snapshot right away. 291 if (currentItem && currentItem->itemIsClone(targetItem)) { 292 removeSwipeSnapshot(); 293 return; 294 } 295 296 // FIXME: Should we wait for VisuallyNonEmptyLayout like we do on Mac? 297 m_snapshotRemovalTracker.start(SnapshotRemovalTracker::RenderTreeSizeThreshold 298 | SnapshotRemovalTracker::RepaintAfterNavigation 299 | SnapshotRemovalTracker::MainFrameLoad 300 | SnapshotRemovalTracker::SubresourceLoads 301 | SnapshotRemovalTracker::ScrollPositionRestoration 302 | SnapshotRemovalTracker::SwipeAnimationEnd, [this] { 303 this->removeSwipeSnapshot(); 304 }); 305 306 if (ViewSnapshot* snapshot = targetItem.snapshot()) { 307 m_backgroundColorForCurrentSnapshot = snapshot->backgroundColor(); 308 m_webPageProxy.didChangeBackgroundColor(); 309 } 273 310 } 274 311 … … 296 333 } 297 334 298 m_snapshotRemovalTargetRenderTreeSize = 0; 299 if (ViewSnapshot* snapshot = targetItem->snapshot()) 300 m_snapshotRemovalTargetRenderTreeSize = snapshot->renderTreeSize() * swipeSnapshotRemovalRenderTreeSizeTargetFraction; 335 m_snapshotRemovalTracker.eventOccurred(SnapshotRemovalTracker::SwipeAnimationEnd); 301 336 302 337 m_webPageProxyForBackForwardListForCurrentSwipe->navigationGestureDidEnd(true, *targetItem); … … 304 339 m_webPageProxy.navigationGestureDidEnd(); 305 340 306 m_webPageProxyForBackForwardListForCurrentSwipe->goToBackForwardItem(*targetItem); 307 308 if (!m_webPageProxy.drawingArea()) { 341 if (!m_webPageProxy.provisionalDrawingArea()) { 309 342 removeSwipeSnapshot(); 310 343 return; 311 }312 313 auto* currentItem = m_webPageProxyForBackForwardListForCurrentSwipe->backForwardList().currentItem();314 // The main frame will not be navigated so hide the snapshot right away.315 if (currentItem && currentItem->itemIsClone(*targetItem)) {316 removeSwipeSnapshot();317 return;318 }319 320 // FIXME: Should we wait for VisuallyNonEmptyLayout like we do on Mac?321 m_snapshotRemovalTracker.start(SnapshotRemovalTracker::RenderTreeSizeThreshold322 | SnapshotRemovalTracker::RepaintAfterNavigation323 | SnapshotRemovalTracker::MainFrameLoad324 | SnapshotRemovalTracker::SubresourceLoads325 | SnapshotRemovalTracker::ScrollPositionRestoration, [this] {326 this->removeSwipeSnapshot();327 });328 329 if (ViewSnapshot* snapshot = targetItem->snapshot()) {330 m_backgroundColorForCurrentSnapshot = snapshot->backgroundColor();331 m_webPageProxy.didChangeBackgroundColor();332 344 } 333 345 334 346 auto pageID = m_webPageProxy.identifier(); 335 347 GestureID gestureID = m_currentGestureID; 336 m_loadCallback = [this, pageID, gestureID] { 337 auto drawingArea = m_webPageProxy.provisionalDrawingArea(); 348 349 auto doAfterLoadStart = [this, pageID, gestureID] { 350 auto* drawingArea = m_webPageProxy.provisionalDrawingArea(); 338 351 if (!drawingArea) { 339 352 removeSwipeSnapshot(); … … 347 360 drawingArea->hideContentUntilPendingUpdate(); 348 361 }; 362 363 if (m_didStartProvisionalLoad) 364 doAfterLoadStart(); 365 else 366 m_loadCallback = WTFMove(doAfterLoadStart); 349 367 } 350 368
Note:
See TracChangeset
for help on using the changeset viewer.