Changeset 204728 in webkit
- Timestamp:
- Aug 22, 2016, 11:02:03 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r204724 r204728 1 2016-08-22 Simon Fraser <simon.fraser@apple.com> 2 3 <select> menu on iPad causes shifting of hit-testing areas 4 https://bugs.webkit.org/show_bug.cgi?id=150079 5 6 Reviewed by Tim Horton. 7 8 This test: 9 1. Scrolls in the ui process, so that position:fixed kicks in 10 2. Taps on a <select>, which disabled position:fixed behavior 11 3. Chooses a <select> option, dismissing the <select>, which restores position:fixed behavior 12 4. Tries to tap a button inside position:fixed. 13 14 * fast/forms/ios/ipad/unfocus-inside-fixed-hittest-expected.txt: Added. 15 * fast/forms/ios/ipad/unfocus-inside-fixed-hittest.html: Added. 16 1 17 2016-08-22 Antti Koivisto <antti@apple.com> 2 18 -
trunk/Source/WebKit2/ChangeLog
r204720 r204728 1 2016-08-22 Simon Fraser <simon.fraser@apple.com> 2 3 <select> menu on iPad causes shifting of hit-testing areas 4 https://bugs.webkit.org/show_bug.cgi?id=150079 5 6 Reviewed by Tim Horton. 7 8 -isAssistingNode (aka the poorly named isEditable) is input into WebPageProxy::computeCustomFixedPositionRect(), 9 so when it changes we have to update visible rects. We were doing this on focus, but failing 10 to do it on blur. 11 12 Added the ability to test by: 13 1. Making it possible to initiate an animated scroll in the UI process 14 2. Adding callbacks for starting and ending interaction with a form control. Sadly 15 the "ending interaction" for <select> popovers on iPad isn't late enough, since we 16 have no way currently to know when the dimming view behind the popover animates out, 17 so for now the test keeps trying to tap a button. 18 19 Test: fast/forms/ios/ipad/unfocus-inside-fixed-hittest.html 20 21 * UIProcess/API/Cocoa/WKWebView.mm: 22 (-[WKWebView _zoomToPoint:atScale:animated:]): 23 (-[WKWebView _scrollToRect:origin:minimumScrollDistance:]): 24 (-[WKWebView _scrollByContentOffset:]): 25 (-[WKWebView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): 26 (-[WKWebView didStartFormControlInteraction]): 27 (-[WKWebView didEndFormControlInteraction]): 28 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 29 * UIProcess/ios/WKContentView.mm: 30 (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): 31 * UIProcess/ios/WKContentViewInteraction.mm: 32 (-[WKContentView setIsEditable:]): 33 (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]): 34 (-[WKContentView _stopAssistingNode]): 35 1 36 2016-08-22 Daniel Bates <dabates@apple.com> 2 37 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r204525 r204728 1434 1434 _page->willStartUserTriggeredZooming(); 1435 1435 1436 LOG_WITH_STREAM(VisibleRects, stream << "_zoomToPoint:" << point << " scale: " << scale << " duration:" << duration); 1437 1436 1438 [_scrollView _zoomToCenter:point scale:scale duration:duration]; 1437 1439 } … … 1534 1536 [_contentView willStartZoomOrScroll]; 1535 1537 1538 LOG_WITH_STREAM(VisibleRects, stream << "_scrollToRect: scrolling to " << [_scrollView contentOffset] + scrollViewOffsetDelta); 1539 1536 1540 [_scrollView setContentOffset:([_scrollView contentOffset] + scrollViewOffsetDelta) animated:YES]; 1537 1541 return true; … … 1550 1554 return; 1551 1555 [_contentView willStartZoomOrScroll]; 1556 1557 LOG_WITH_STREAM(VisibleRects, stream << "_scrollByContentOffset: scrolling to " << boundedOffset); 1558 1552 1559 [_scrollView setContentOffset:boundedOffset animated:YES]; 1553 1560 } … … 1674 1681 if (scale != contentZoomScale(self)) 1675 1682 _page->willStartUserTriggeredZooming(); 1683 1684 LOG_WITH_STREAM(VisibleRects, stream << "_zoomToFocusRect: zooming to " << newCenter << " scale:" << scale); 1676 1685 1677 1686 // The newCenter has been computed in the new scale, but _zoomToCenter expected the center to be in the original scale. … … 4528 4537 } 4529 4538 4539 - (void)didStartFormControlInteraction 4540 { 4541 // For subclasses to override. 4542 } 4543 4544 - (void)didEndFormControlInteraction 4545 { 4546 // For subclasses to override. 4547 } 4548 4530 4549 #endif // PLATFORM(IOS) 4531 4550 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
r204525 r204728 265 265 - (void)selectFormAccessoryPickerRow:(int)rowIndex WK_API_AVAILABLE(ios(WK_IOS_TBA)); 266 266 267 - (void)didStartFormControlInteraction WK_API_AVAILABLE(ios(WK_IOS_TBA)); 268 - (void)didEndFormControlInteraction WK_API_AVAILABLE(ios(WK_IOS_TBA)); 269 267 270 #endif 268 271 -
trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm
r203371 r204728 32 32 #import "AccessibilityIOS.h" 33 33 #import "ApplicationStateTracker.h" 34 #import "Logging.h" 34 35 #import "PageClientImplIOS.h" 35 36 #import "PrintInfo.h" … … 59 60 #import <WebCore/PlatformScreen.h> 60 61 #import <WebCore/QuartzCoreSPI.h> 62 #import <WebCore/TextStream.h> 61 63 #import <wtf/CurrentTime.h> 62 64 #import <wtf/RetainPtr.h> … … 377 379 378 380 FloatRect fixedPositionRectForLayout = _page->computeCustomFixedPositionRect(unobscuredRect, zoomScale, WebPageProxy::UnobscuredRectConstraint::ConstrainedToDocumentRect); 381 382 LOG_WITH_STREAM(VisibleRects, stream << "didUpdateVisibleRect: visibleRect:" << visibleRect << " unobscuredRect:" << unobscuredRect << " fixedPositionRectForLayout:" << fixedPositionRectForLayout); 379 383 380 384 VisibleContentRectUpdateInfo visibleContentRectUpdateInfo( -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r204525 r204728 747 747 { 748 748 return _isEditable; 749 } 750 751 - (BOOL)setIsEditable:(BOOL)isEditable 752 { 753 if (isEditable == _isEditable) 754 return NO; 755 756 _isEditable = isEditable; 757 return YES; 749 758 } 750 759 … … 3580 3589 return; 3581 3590 3582 _isEditable = YES;3591 BOOL editableChanged = [self setIsEditable:YES]; 3583 3592 _assistedNodeInformation = information; 3584 3593 _inputPeripheral = nil; … … 3601 3610 } 3602 3611 3603 if (information.insideFixedPosition) 3612 // The custom fixed position rect behavior is affected by -isAssistingNode, so if that changes we need to recompute rects. 3613 if (editableChanged) 3604 3614 [_webView _updateVisibleContentRects]; 3605 3615 … … 3613 3623 [inputDelegate _webView:_webView didStartInputSession:_formInputSession.get()]; 3614 3624 } 3625 3626 [_webView didStartFormControlInteraction]; 3615 3627 } 3616 3628 … … 3619 3631 [_formInputSession invalidate]; 3620 3632 _formInputSession = nil; 3621 _isEditable = NO; 3633 3634 BOOL editableChanged = [self setIsEditable:NO]; 3635 3622 3636 _assistedNodeInformation.elementType = InputType::None; 3623 3637 _inputPeripheral = nil; … … 3629 3643 // The name is misleading, but this actually clears the selection views and removes any selection. 3630 3644 [_webSelectionAssistant resignedFirstResponder]; 3645 3646 // The custom fixed position rect behavior is affected by -isAssistingNode, so if that changes we need to recompute rects. 3647 if (editableChanged) 3648 [_webView _updateVisibleContentRects]; 3649 3650 [_webView didEndFormControlInteraction]; 3631 3651 } 3632 3652 -
trunk/Tools/ChangeLog
r204727 r204728 1 2016-08-22 Simon Fraser <simon.fraser@apple.com> 2 3 <select> menu on iPad causes shifting of hit-testing areas 4 https://bugs.webkit.org/show_bug.cgi?id=150079 5 6 Reviewed by Tim Horton. 7 8 -isAssistingNode (aka the poorly named isEditable) is input into WebPageProxy::computeCustomFixedPositionRect(), 9 so when it changes we have to update visible rects. We were doing this on focus, but failing 10 to do it on blur. 11 12 Added the ability to test by: 13 1. Making it possible to initiate an animated scroll in the UI process 14 2. Adding callbacks for starting and ending interaction with a form control. Sadly 15 the "ending interaction" for <select> popovers on iPad isn't late enough, since we 16 have no way currently to know when the dimming view behind the popover animates out, 17 so for now the test keeps trying to tap a button. 18 19 * WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl: 20 * WebKitTestRunner/UIScriptContext/UIScriptContext.h: 21 * WebKitTestRunner/UIScriptContext/UIScriptController.cpp: 22 (WTR::UIScriptController::setDidStartFormControlInteractionCallback): 23 (WTR::UIScriptController::didStartFormControlInteractionCallback): 24 (WTR::UIScriptController::setDidEndFormControlInteractionCallback): 25 (WTR::UIScriptController::didEndFormControlInteractionCallback): 26 (WTR::UIScriptController::scrollToOffset): 27 (WTR::UIScriptController::platformSetDidStartFormControlInteractionCallback): 28 (WTR::UIScriptController::platformSetDidEndFormControlInteractionCallback): 29 * WebKitTestRunner/UIScriptContext/UIScriptController.h: 30 * WebKitTestRunner/cocoa/TestRunnerWKWebView.h: 31 * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm: 32 (-[TestRunnerWKWebView dealloc]): 33 (-[TestRunnerWKWebView didStartFormControlInteraction]): 34 (-[TestRunnerWKWebView didEndFormControlInteraction]): 35 * WebKitTestRunner/ios/UIScriptControllerIOS.mm: 36 (WTR::contentOffsetBoundedInValidRange): 37 (WTR::UIScriptController::scrollToOffset): 38 (WTR::UIScriptController::platformSetDidStartFormControlInteractionCallback): 39 (WTR::UIScriptController::platformSetDidEndFormControlInteractionCallback): 40 1 41 2016-08-22 Carlos Alberto Lopez Perez <clopez@igalia.com> 2 42 -
trunk/Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl
r204525 r204728 46 46 void dismissFormAccessoryView(); 47 47 48 // Form control handling 49 attribute object didStartFormControlInteractionCallback; 50 attribute object didEndFormControlInteractionCallback; 51 48 52 // <select> picker 49 53 void selectFormAccessoryPickerRow(long rowIndex); … … 59 63 attribute object didEndZoomingCallback; 60 64 65 void scrollToOffset(long x, long y); // Initiate an animated scroll in the UI process. 61 66 attribute object didEndScrollingCallback; 62 67 -
trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.h
r194721 r204728 48 48 CallbackTypeDidHideKeyboard, 49 49 CallbackTypeDidEndScrolling, 50 CallbackTypeDidStartFormControlInteraction, 51 CallbackTypeDidEndFormControlInteraction, 50 52 CallbackTypeNonPersistent = firstNonPersistentCallbackID 51 53 } CallbackType; -
trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp
r204525 r204728 59 59 #endif 60 60 61 void UIScriptController::setDidStartFormControlInteractionCallback(JSValueRef callback) 62 { 63 m_context->registerCallback(callback, CallbackTypeDidStartFormControlInteraction); 64 platformSetDidStartFormControlInteractionCallback(); 65 } 66 67 JSValueRef UIScriptController::didStartFormControlInteractionCallback() const 68 { 69 return m_context->callbackWithID(CallbackTypeDidStartFormControlInteraction); 70 } 71 72 void UIScriptController::setDidEndFormControlInteractionCallback(JSValueRef callback) 73 { 74 m_context->registerCallback(callback, CallbackTypeDidEndFormControlInteraction); 75 platformSetDidEndFormControlInteractionCallback(); 76 } 77 78 JSValueRef UIScriptController::didEndFormControlInteractionCallback() const 79 { 80 return m_context->callbackWithID(CallbackTypeDidEndFormControlInteraction); 81 } 82 61 83 void UIScriptController::setWillBeginZoomingCallback(JSValueRef callback) 62 84 { … … 159 181 } 160 182 183 void UIScriptController::scrollToOffset(long x, long y) 184 { 185 } 186 161 187 void UIScriptController::keyboardAccessoryBarNext() 162 188 { … … 185 211 { 186 212 return nullptr; 213 } 214 215 void UIScriptController::platformSetDidStartFormControlInteractionCallback() 216 { 217 } 218 219 void UIScriptController::platformSetDidEndFormControlInteractionCallback() 220 { 187 221 } 188 222 -
trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h
r204525 r204728 63 63 void dismissFormAccessoryView(); 64 64 void selectFormAccessoryPickerRow(long); 65 66 void scrollToOffset(long x, long y); 67 68 void setDidStartFormControlInteractionCallback(JSValueRef); 69 JSValueRef didStartFormControlInteractionCallback() const; 70 71 void setDidEndFormControlInteractionCallback(JSValueRef); 72 JSValueRef didEndFormControlInteractionCallback() const; 65 73 66 74 void setWillBeginZoomingCallback(JSValueRef); … … 89 97 private: 90 98 UIScriptController(UIScriptContext&); 91 99 100 void platformSetDidStartFormControlInteractionCallback(); 101 void platformSetDidEndFormControlInteractionCallback(); 92 102 void platformSetWillBeginZoomingCallback(); 93 103 void platformSetDidEndZoomingCallback(); -
trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h
r192432 r204728 32 32 #if PLATFORM(IOS) 33 33 34 @property (nonatomic, copy) void (^didStartFormControlInteractionCallback)(void); 35 @property (nonatomic, copy) void (^didEndFormControlInteractionCallback)(void); 34 36 @property (nonatomic, copy) void (^willBeginZoomingCallback)(void); 35 37 @property (nonatomic, copy) void (^didEndZoomingCallback)(void); -
trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm
r192432 r204728 74 74 [[NSNotificationCenter defaultCenter] removeObserver:self]; 75 75 76 self.didStartFormControlInteractionCallback = nil; 77 self.didEndFormControlInteractionCallback = nil; 76 78 self.willBeginZoomingCallback = nil; 77 79 self.didEndZoomingCallback = nil; … … 84 86 85 87 [super dealloc]; 88 } 89 90 - (void)didStartFormControlInteraction 91 { 92 if (self.didStartFormControlInteractionCallback) 93 self.didStartFormControlInteractionCallback(); 94 } 95 96 - (void)didEndFormControlInteraction 97 { 98 if (self.didEndFormControlInteractionCallback) 99 self.didEndFormControlInteractionCallback(); 86 100 } 87 101 -
trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
r204525 r204728 188 188 } 189 189 190 static CGPoint contentOffsetBoundedInValidRange(UIScrollView *scrollView, CGPoint contentOffset) 191 { 192 UIEdgeInsets contentInsets = scrollView.contentInset; 193 CGSize contentSize = scrollView.contentSize; 194 CGSize scrollViewSize = scrollView.bounds.size; 195 196 CGFloat maxHorizontalOffset = contentSize.width + contentInsets.right - scrollViewSize.width; 197 contentOffset.x = std::min(maxHorizontalOffset, contentOffset.x); 198 contentOffset.x = std::max(-contentInsets.left, contentOffset.x); 199 200 CGFloat maxVerticalOffset = contentSize.height + contentInsets.bottom - scrollViewSize.height; 201 contentOffset.y = std::min(maxVerticalOffset, contentOffset.y); 202 contentOffset.y = std::max(-contentInsets.top, contentOffset.y); 203 return contentOffset; 204 } 205 206 void UIScriptController::scrollToOffset(long x, long y) 207 { 208 TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView(); 209 [webView.scrollView setContentOffset:contentOffsetBoundedInValidRange(webView.scrollView, CGPointMake(x, y)) animated:YES]; 210 } 211 190 212 void UIScriptController::keyboardAccessoryBarNext() 191 213 { … … 220 242 WKRect wkRect = WKRectMake(contentVisibleRect.origin.x, contentVisibleRect.origin.y, contentVisibleRect.size.width, contentVisibleRect.size.height); 221 243 return m_context->objectFromRect(wkRect); 244 } 245 246 void UIScriptController::platformSetDidStartFormControlInteractionCallback() 247 { 248 TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView(); 249 webView.didStartFormControlInteractionCallback = ^{ 250 if (!m_context) 251 return; 252 m_context->fireCallback(CallbackTypeDidStartFormControlInteraction); 253 }; 254 } 255 256 void UIScriptController::platformSetDidEndFormControlInteractionCallback() 257 { 258 TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView(); 259 webView.didEndFormControlInteractionCallback = ^{ 260 if (!m_context) 261 return; 262 m_context->fireCallback(CallbackTypeDidEndFormControlInteraction); 263 }; 222 264 } 223 265
Note:
See TracChangeset
for help on using the changeset viewer.