Changeset 228393 in webkit
- Timestamp:
- Feb 12, 2018 2:07:10 PM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r228373 r228393 1 2018-02-12 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [Extra zoom mode] Add support for <input type='time'> using time picker UI 4 https://bugs.webkit.org/show_bug.cgi?id=182683 5 <rdar://problem/35143162> 6 7 Reviewed by Tim Horton. 8 9 Adds support for showing a time picker when an input of type time is focused in extra zoomed mode. 10 11 * UIProcess/ios/WKContentViewInteraction.h: 12 * UIProcess/ios/WKContentViewInteraction.mm: 13 (-[WKContentView _stopAssistingNode]): 14 (-[WKContentView presentTimePickerViewController:]): 15 (-[WKContentView dismissTimePickerViewController:]): 16 17 Add helpers to dismiss and present the time picker view controller. 18 19 (-[WKContentView presentViewControllerForAssistedNode:]): 20 21 When focusing InputType::Time, present a time picker. Additionally, tweak the logic here to use the generic text 22 input view controller as a fallback when the other input view controllers (number pads, select menus and time 23 pickers thus far) are not relevant. This prevents us from completely being unable to edit form controls that are 24 currently unsupported. 25 26 (-[WKContentView textInputController:didCommitText:]): 27 (-[WKContentView textInputControllerDidRequestDismissal:]): 28 29 Tweak WKContentView for changes to WKTextFormControlViewControllerDelegate. 30 31 (-[WKContentView actionNameForFocusedFormControlController:]): 32 33 Adjust this implementation to hide the focused form control "Go" button for selects and time inputs. This 34 currently doesn't work for these form controls because it relies on implicit form submission; this should be 35 fixed by future changes, after which we should revert this adjustment. 36 37 (-[WKContentView _wheelChangedWithEvent:]): 38 39 Delegate wheel events to the time picker if needed. 40 41 (-[WKContentView textInputController:didRequestDismissalWithAction:]): Deleted. 42 43 Renamed to -textInputControllerDidRequestDismissal:. 44 45 * UIProcess/ios/forms/WKTimePickerViewController.h: Added. 46 * UIProcess/ios/forms/WKTimePickerViewController.mm: Added. 47 * WebKit.xcodeproj/project.pbxproj: 48 1 49 2018-02-11 Michael Catanzaro <mcatanzaro@igalia.com> 2 50 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
r228245 r228393 89 89 @class WKSelectMenuViewController; 90 90 @class WKTextInputViewController; 91 @class WKTimePickerViewController; 91 92 #endif 92 93 … … 250 251 RetainPtr<WKNumberPadViewController> _numberPadViewController; 251 252 RetainPtr<WKSelectMenuViewController> _selectMenuViewController; 253 RetainPtr<WKTimePickerViewController> _timePickerViewController; 252 254 #endif 253 255 } -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r228246 r228393 54 54 #import "WKSelectMenuViewController.h" 55 55 #import "WKTextInputViewController.h" 56 #import "WKTimePickerViewController.h" 56 57 #import "WKUIDelegatePrivate.h" 57 58 #import "WKWebViewConfiguration.h" … … 4092 4093 [self dismissNumberPadViewController:YES]; 4093 4094 [self dismissSelectMenuViewController:YES]; 4095 [self dismissTimePickerViewController:YES]; 4094 4096 if (!_isChangingFocus) 4095 4097 [self dismissFocusedFormControlViewController:[_focusedFormControlViewController isVisible]]; … … 4105 4107 #if ENABLE(EXTRA_ZOOM_MODE) 4106 4108 4109 - (void)presentTimePickerViewController:(BOOL)animated 4110 { 4111 if (_timePickerViewController) 4112 return; 4113 4114 _timePickerViewController = adoptNS([[WKTimePickerViewController alloc] initWithText:_assistedNodeInformation.value textSuggestions:@[ ]]); 4115 [_timePickerViewController setDelegate:self]; 4116 [_focusedFormControlViewController presentViewController:_timePickerViewController.get() animated:animated completion:nil]; 4117 } 4118 4119 - (void)dismissTimePickerViewController:(BOOL)animated 4120 { 4121 if (!_timePickerViewController) 4122 return; 4123 4124 auto timePickerViewController = WTFMove(_timePickerViewController); 4125 [timePickerViewController dismissViewControllerAnimated:animated completion:nil]; 4126 } 4127 4107 4128 - (void)presentSelectMenuViewController:(BOOL)animated 4108 4129 { … … 4165 4186 { 4166 4187 switch (info.elementType) { 4167 case InputType::ContentEditable:4168 case InputType::Text:4169 case InputType::Password:4170 case InputType::TextArea:4171 case InputType::Search:4172 case InputType::Email:4173 case InputType::URL:4174 [self presentTextInputViewController:YES];4175 break;4176 4188 case InputType::Number: 4177 4189 case InputType::NumberPad: … … 4182 4194 [self presentSelectMenuViewController:YES]; 4183 4195 break; 4196 case InputType::Time: 4197 [self presentTimePickerViewController:YES]; 4198 break; 4199 case InputType::None: 4200 break; 4184 4201 default: 4202 [self presentTextInputViewController:YES]; 4185 4203 break; 4186 4204 } … … 4210 4228 // FIXME: Update cached AssistedNodeInformation state in the UI process. 4211 4229 _page->setTextAsync(text); 4212 } 4213 4214 - (void)textInputController:(WKTextFormControlViewController *)controller didRequestDismissalWithAction:(WKFormControlAction)action 4215 { 4216 if (action == WKFormControlActionCancel) { 4217 _page->blurAssistedNode(); 4218 return; 4219 } 4220 4221 if (_assistedNodeInformation.formAction.isEmpty() && !_assistedNodeInformation.hasNextNode && !_assistedNodeInformation.hasPreviousNode) { 4230 4231 if (![self actionNameForFocusedFormControlController:_focusedFormControlViewController.get()] && !_assistedNodeInformation.hasNextNode && !_assistedNodeInformation.hasPreviousNode) { 4222 4232 // In this case, there's no point in collapsing down to the form control focus UI because there's nothing the user could potentially do 4223 4233 // besides dismiss the UI, so we just automatically dismiss the focused form control UI. … … 4229 4239 [self dismissTextInputViewController:YES]; 4230 4240 [self dismissNumberPadViewController:YES]; 4241 [self dismissTimePickerViewController:YES]; 4242 } 4243 4244 - (void)textInputControllerDidRequestDismissal:(WKTextFormControlViewController *)controller 4245 { 4246 _page->blurAssistedNode(); 4231 4247 } 4232 4248 … … 4257 4273 return nil; 4258 4274 4259 return _assistedNodeInformation.elementType == InputType::Search ? formControlSearchButtonTitle() : formControlGoButtonTitle(); 4275 switch (_assistedNodeInformation.elementType) { 4276 case InputType::Select: 4277 case InputType::Time: 4278 case InputType::Date: 4279 return nil; 4280 case InputType::Search: 4281 return formControlSearchButtonTitle(); 4282 default: 4283 return formControlGoButtonTitle(); 4284 } 4260 4285 } 4261 4286 … … 4370 4395 4371 4396 if ([_selectMenuViewController handleWheelEvent:event]) 4397 return; 4398 4399 if ([_timePickerViewController handleWheelEvent:event]) 4372 4400 return; 4373 4401 -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r228287 r228393 741 741 2EA7B3D52026CF23009CE5AC /* WKNumberPadView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EA7B3D32026CF23009CE5AC /* WKNumberPadView.h */; }; 742 742 2EA7B3D62026CF23009CE5AC /* WKNumberPadView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EA7B3D42026CF23009CE5AC /* WKNumberPadView.mm */; }; 743 2EB6FC01203021960017E619 /* WKTimePickerViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EB6FBFF203021960017E619 /* WKTimePickerViewController.h */; }; 744 2EB6FC02203021960017E619 /* WKTimePickerViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EB6FC00203021960017E619 /* WKTimePickerViewController.mm */; }; 743 745 2EE4529F20292D2A00D81777 /* WKSelectMenuViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EE4529C20292BD900D81777 /* WKSelectMenuViewController.h */; }; 744 746 2EE452A020292D2E00D81777 /* WKSelectMenuViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EE4529B20292BD800D81777 /* WKSelectMenuViewController.mm */; }; … … 3101 3103 2EA7B3D32026CF23009CE5AC /* WKNumberPadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKNumberPadView.h; path = ios/forms/WKNumberPadView.h; sourceTree = "<group>"; }; 3102 3104 2EA7B3D42026CF23009CE5AC /* WKNumberPadView.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKNumberPadView.mm; path = ios/forms/WKNumberPadView.mm; sourceTree = "<group>"; }; 3105 2EB6FBFF203021960017E619 /* WKTimePickerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKTimePickerViewController.h; path = ios/forms/WKTimePickerViewController.h; sourceTree = "<group>"; }; 3106 2EB6FC00203021960017E619 /* WKTimePickerViewController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKTimePickerViewController.mm; path = ios/forms/WKTimePickerViewController.mm; sourceTree = "<group>"; }; 3103 3107 2EE4529B20292BD800D81777 /* WKSelectMenuViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKSelectMenuViewController.mm; path = ios/forms/WKSelectMenuViewController.mm; sourceTree = "<group>"; }; 3104 3108 2EE4529C20292BD900D81777 /* WKSelectMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKSelectMenuViewController.h; path = ios/forms/WKSelectMenuViewController.h; sourceTree = "<group>"; }; … … 8367 8371 2E16B6D22017BA37008996D6 /* WKTextSuggestionButton.h */, 8368 8372 2E16B6D32017BA37008996D6 /* WKTextSuggestionButton.mm */, 8373 2EB6FBFF203021960017E619 /* WKTimePickerViewController.h */, 8374 2EB6FC00203021960017E619 /* WKTimePickerViewController.mm */, 8369 8375 ); 8370 8376 name = forms; … … 9551 9557 0FCB4E6818BBE3D9000FCFC9 /* WKTextInputWindowController.h in Headers */, 9552 9558 2E16B6D42017BA37008996D6 /* WKTextSuggestionButton.h in Headers */, 9559 2EB6FC01203021960017E619 /* WKTimePickerViewController.h in Headers */, 9553 9560 BC407608124FF0270068F20A /* WKType.h in Headers */, 9554 9561 7CD5EBBF1746B04C000C1C45 /* WKTypeRefWrapper.h in Headers */, … … 11181 11188 0FCB4E6918BBE3D9000FCFC9 /* WKTextInputWindowController.mm in Sources */, 11182 11189 2E16B6D52017BA37008996D6 /* WKTextSuggestionButton.mm in Sources */, 11190 2EB6FC02203021960017E619 /* WKTimePickerViewController.mm in Sources */, 11183 11191 BC407607124FF0270068F20A /* WKType.cpp in Sources */, 11184 11192 7CD5EBBE1746B04C000C1C45 /* WKTypeRefWrapper.mm in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.