Changeset 259818 in webkit
- Timestamp:
- Apr 9, 2020, 1:11:24 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h (modified) (1 diff)
-
Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/ViewGestureController.cpp (modified) (5 diffs)
-
Source/WebKit/UIProcess/ViewGestureController.h (modified) (2 diffs)
-
Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm (modified) (2 diffs)
-
Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r259817 r259818 1 2020-04-09 Simon Fraser <simon.fraser@apple.com> 2 3 Reset view navigation gesture state between tests 4 https://bugs.webkit.org/show_bug.cgi?id=210283 5 6 Reviewed by Tim Horton. 7 8 State in ViewGestureController could leak between tests if a test did not wait for the gesture to complete. 9 Specifically m_activeGestureType could be left as non-None. 10 11 Fix by plumbing a 'reset' through from TestController::resetStateToConsistentValues(). 12 13 The implementations leverage code from removeSwipeSnapshot(), but avoid the fact that removeSwipeSnapshot() 14 early returns in various cases by just always calling reset code, which is factored into a new resetState function. 15 16 * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: 17 * UIProcess/API/Cocoa/WKWebViewTesting.mm: 18 (-[WKWebView _resetNavigationGestureStateForTesting]): 19 * UIProcess/ViewGestureController.cpp: 20 (WebKit::ViewGestureController::willBeginGesture): 21 (WebKit::ViewGestureController::didEndGesture): 22 (WebKit::ViewGestureController::PendingSwipeTracker::handleEvent): 23 (WebKit::ViewGestureController::PendingSwipeTracker::eventWasNotHandledByWebCore): 24 * UIProcess/ViewGestureController.h: 25 * UIProcess/ios/ViewGestureControllerIOS.mm: 26 (WebKit::ViewGestureController::removeSwipeSnapshot): 27 (WebKit::ViewGestureController::resetState): 28 (WebKit::ViewGestureController::reset): 29 * UIProcess/mac/ViewGestureControllerMac.mm: 30 (WebKit::ViewGestureController::removeSwipeSnapshot): 31 (WebKit::ViewGestureController::resetState): 32 (WebKit::ViewGestureController::reset): 33 1 34 2020-04-09 Ryan Haddad <ryanhaddad@apple.com> 2 35 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h
r259540 r259818 46 46 - (BOOL)_beginBackSwipeForTesting; 47 47 - (BOOL)_completeBackSwipeForTesting; 48 - (void)_resetNavigationGestureStateForTesting; 48 49 - (void)_setDefersLoadingForTesting:(BOOL)defersLoading; 49 50 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm
r259540 r259818 144 144 } 145 145 146 - (void)_resetNavigationGestureStateForTesting 147 { 148 #if PLATFORM(MAC) 149 if (auto gestureController = _impl->gestureController()) 150 gestureController->reset(); 151 #else 152 if (_gestureController) 153 _gestureController->reset(); 154 #endif 155 } 156 146 157 - (void)_setDefersLoadingForTesting:(BOOL)defersLoading 147 158 { -
trunk/Source/WebKit/UIProcess/ViewGestureController.cpp
r254552 r259818 130 130 void ViewGestureController::willBeginGesture(ViewGestureType type) 131 131 { 132 LOG(ViewGestures, "ViewGestureController::willBeginGesture %d", (int)type); 133 132 134 m_activeGestureType = type; 133 135 m_currentGestureID = takeNextGestureID(); … … 136 138 void ViewGestureController::didEndGesture() 137 139 { 140 LOG(ViewGestures, "ViewGestureController::didEndGesture"); 141 138 142 m_activeGestureType = ViewGestureType::None; 139 143 m_currentGestureID = 0; … … 431 435 bool ViewGestureController::PendingSwipeTracker::handleEvent(PlatformScrollEvent event) 432 436 { 437 LOG(ViewGestures, "PendingSwipeTracker::handleEvent - state %d", (int)m_state); 438 433 439 if (scrollEventCanEndSwipe(event)) { 434 440 reset("gesture ended"); … … 437 443 438 444 if (m_state == State::None) { 445 LOG(ViewGestures, "PendingSwipeTracker::handleEvent - scroll can become swipe %d shouldIgnorePinnedState %d, page will handle scrolls %d", scrollEventCanBecomeSwipe(event, m_direction), m_shouldIgnorePinnedState, m_webPageProxy.willHandleHorizontalScrollEvents()); 446 439 447 if (!scrollEventCanBecomeSwipe(event, m_direction)) 440 448 return false; … … 454 462 void ViewGestureController::PendingSwipeTracker::eventWasNotHandledByWebCore(PlatformScrollEvent event) 455 463 { 464 LOG(ViewGestures, "Swipe Start Hysteresis - WebCore didn't handle event, state %d", (int)m_state); 465 456 466 if (m_state != State::WaitingForWebCore) 457 467 return; 458 468 459 LOG(ViewGestures, "Swipe Start Hysteresis - WebCore didn't handle event");460 469 m_state = State::None; 461 470 m_cumulativeDelta = FloatSize(); -
trunk/Source/WebKit/UIProcess/ViewGestureController.h
r254552 r259818 163 163 164 164 void removeSwipeSnapshot(); 165 void reset(); 165 166 166 167 void setSwipeGestureEnabled(bool enabled) { m_swipeGestureEnabled = enabled; } … … 185 186 void willBeginGesture(ViewGestureType); 186 187 void didEndGesture(); 188 void resetState(); 187 189 188 190 void didStartProvisionalOrSameDocumentLoadForMainFrame(); -
trunk/Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm
r256933 r259818 419 419 } 420 420 421 resetState(); 422 } 423 424 void ViewGestureController::resetState() 425 { 421 426 [m_snapshotView removeFromSuperview]; 422 427 m_snapshotView = nullptr; … … 434 439 } 435 440 441 void ViewGestureController::reset() 442 { 443 removeSwipeSnapshot(); 444 resetState(); 445 } 446 436 447 bool ViewGestureController::beginSimulatedSwipeInDirectionForTesting(SwipeDirection direction) 437 448 { -
trunk/Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm
r259085 r259818 610 610 } 611 611 612 resetState(); 613 } 614 615 void ViewGestureController::resetState() 616 { 612 617 if (m_currentSwipeSnapshot) 613 618 m_currentSwipeSnapshot->setVolatile(true); … … 638 643 } 639 644 645 void ViewGestureController::reset() 646 { 647 removeSwipeSnapshot(); 648 resetState(); 649 m_swipeCancellationTracker = nil; // FIXME: Move to reset state()? 650 } 651 640 652 double ViewGestureController::magnification() const 641 653 { -
trunk/Tools/ChangeLog
r259815 r259818 1 2020-04-09 Simon Fraser <simon.fraser@apple.com> 2 3 Reset view navigation gesture state between tests 4 https://bugs.webkit.org/show_bug.cgi?id=210283 5 6 Reviewed by Tim Horton. 7 8 State in ViewGestureController could leak between tests if a test did not wait for the gesture to complete. 9 Specifically m_activeGestureType could be left as non-None. 10 11 Fix by plumbing a 'reset' through from TestController::resetStateToConsistentValues(). 12 13 The implementations leverage code from removeSwipeSnapshot(), but avoid the fact that removeSwipeSnapshot() 14 early returns in various cases by just always calling reset code, which is factored into a new resetState function. 15 16 * WebKitTestRunner/TestController.cpp: 17 (WTR::TestController::resetStateToConsistentValues): 18 1 19 2020-04-09 Aakash Jain <aakash_jain@apple.com> 2 20 -
trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
r259516 r259818 278 278 [platformView _setContinuousSpellCheckingEnabledForTesting:options.shouldShowSpellCheckingDots]; 279 279 [platformView resetInteractionCallbacks]; 280 [platformView _resetNavigationGestureStateForTesting]; 280 281 } 281 282
Note:
See TracChangeset
for help on using the changeset viewer.