Changeset 227984 in webkit
- Timestamp:
- Feb 1, 2018 3:17:22 PM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r227966 r227984 1 2018-02-01 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [Extra zoom mode] Implement basic support for interacting with text form controls 4 https://bugs.webkit.org/show_bug.cgi?id=182401 5 <rdar://problem/35143035> 6 7 Reviewed by Tim Horton. 8 9 Add UI support for interacting with and editing text form controls when extra zoom mode is enabled. See below 10 for more details. 11 12 * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: 13 (-[WKWebViewConfiguration init]): 14 (-[WKWebViewConfiguration encodeWithCoder:]): 15 (-[WKWebViewConfiguration initWithCoder:]): 16 (-[WKWebViewConfiguration copyWithZone:]): 17 (-[WKWebViewConfiguration _textInteractionGesturesEnabled]): 18 (-[WKWebViewConfiguration _setTextInteractionGesturesEnabled:]): 19 (-[WKWebViewConfiguration _longPressActionsEnabled]): 20 (-[WKWebViewConfiguration _setLongPressActionsEnabled:]): 21 22 Introduce two new web view configuration flags: `textInteractionGesturesEnabled` and `longPressActionsEnabled`. 23 The former determines whether text interaction gestures (i.e. text selection, moving the caret, showing UI for 24 IME, etc.) are enabled. The latter determines whether or not long press actions (i.e. touch callout, share 25 sheet, etc.) are enabled. These are disabled by default only in extra zoom mode. 26 27 * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: 28 * UIProcess/WebPageProxy.cpp: 29 (WebKit::WebPageProxy::setTextAsync): 30 31 Add a way to set the text value of a currently edited text form control. This will either set the text value of 32 an input, a. la. autofill, or overwrite the contents of a contenteditable area by selecting everything and 33 inserting the given text. 34 35 * UIProcess/WebPageProxy.h: 36 (WebKit::WebPageProxy::focusNextAssistedNode): 37 38 Add a default argument for the completion callback. 39 40 * UIProcess/ios/WKContentViewInteraction.h: 41 * UIProcess/ios/WKContentViewInteraction.mm: 42 (-[WKContentView setupInteraction]): 43 (-[WKContentView _displayFormNodeInputView]): 44 (-[WKContentView _actionForLongPressFromPositionInformation:]): 45 (-[WKContentView hasSelectablePositionAtPoint:]): 46 (-[WKContentView pointIsNearMarkedText:]): 47 (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): 48 (-[WKContentView insertionPointColor]): 49 50 Respect the web view configuration flags above by bailing early from text interaction and long press action 51 sheet methods. 52 53 (-[WKContentView _startAssistingKeyboard]): 54 (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): 55 56 Add a flag indicating whether we are in the process of changing focus from one node to another. We use this to 57 decide whether or not we want to present the text input view controller right away, or just reload the focused 58 form control overlay. When we stop "assisting" a node, we also keep the focused form control overlay up if we're 59 only changing focus to another form control. 60 61 (-[WKContentView _stopAssistingNode]): 62 (-[WKContentView presentFocusedFormControlViewController:]): 63 (-[WKContentView dismissFocusedFormControlViewController:]): 64 (-[WKContentView shouldPresentTextInputViewController:]): 65 (-[WKContentView presentTextInputViewController:]): 66 (-[WKContentView dismissTextInputViewController:]): 67 68 Introduce helpers for managing presentation of the focused form control overlay and text input view controller. 69 All -present and -dismiss helpers here are idempotent. These view controllers are presented from the content 70 view's view controller for fullscreen presentation. 71 72 (-[WKContentView textInputController:didCommitText:]): 73 (-[WKContentView textInputController:didRequestDismissalWithAction:]): 74 (-[WKContentView focusedFormControlControllerDidSubmit:]): 75 (-[WKContentView focusedFormControlControllerDidCancel:]): 76 (-[WKContentView focusedFormControlControllerDidBeginEditing:]): 77 (-[WKContentView highlightedRectForFocusedFormControlController:inCoordinateSpace:]): 78 (-[WKContentView actionNameForFocusedFormControlController:]): 79 (-[WKContentView focusedFormControlControllerDidRequestNextNode:]): 80 (-[WKContentView focusedFormControlControllerDidRequestPreviousNode:]): 81 (-[WKContentView hasNextNodeForFocusedFormControlController:]): 82 (-[WKContentView hasPreviousNodeForFocusedFormControlController:]): 83 84 Implement delegate methods for the focused form control and text input view controllers. This mainly involves 85 straightforward plumbing of pieces of AssistedNodeInformation on the content view. 86 87 (-[WKContentView pointIsInAssistedNode:]): Deleted. 88 89 Remove a method that was still implemented only for binary compatibility with iOS 10. 90 91 * WebProcess/WebPage/WebPage.cpp: 92 (WebKit::WebPage::setTextAsync): 93 * WebProcess/WebPage/WebPage.h: 94 * WebProcess/WebPage/WebPage.messages.in: 95 1 96 2018-02-01 Carlos Garcia Campos <cgarcia@igalia.com> 2 97 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
r226353 r227984 131 131 BOOL _allowsInlineMediaPlaybackAfterFullscreen; 132 132 _WKDragLiftDelay _dragLiftDelay; 133 BOOL _textInteractionGesturesEnabled; 134 BOOL _longPressActionsEnabled; 133 135 #endif 134 136 … … 226 228 _selectionGranularity = WKSelectionGranularityDynamic; 227 229 _dragLiftDelay = toDragLiftDelay([[NSUserDefaults standardUserDefaults] integerForKey:@"WebKitDebugDragLiftDelay"]); 228 #endif 230 #if ENABLE(EXTRA_ZOOM_MODE) 231 _textInteractionGesturesEnabled = NO; 232 _longPressActionsEnabled = NO; 233 #else 234 _textInteractionGesturesEnabled = YES; 235 _longPressActionsEnabled = YES; 236 #endif 237 #endif // PLATFORM(IOS) 229 238 230 239 _mediaContentTypesRequiringHardwareSupport = Settings::defaultMediaContentTypesRequiringHardwareSupport(); … … 266 275 [coder encodeBool:self.ignoresViewportScaleLimits forKey:@"ignoresViewportScaleLimits"]; 267 276 [coder encodeInteger:self._dragLiftDelay forKey:@"dragLiftDelay"]; 277 [coder encodeBool:self._textInteractionGesturesEnabled forKey:@"textInteractionGesturesEnabled"]; 278 [coder encodeBool:self._longPressActionsEnabled forKey:@"longPressActionsEnabled"]; 268 279 #else 269 280 [coder encodeInteger:self.userInterfaceDirectionPolicy forKey:@"userInterfaceDirectionPolicy"]; … … 294 305 self.ignoresViewportScaleLimits = [coder decodeBoolForKey:@"ignoresViewportScaleLimits"]; 295 306 self._dragLiftDelay = toDragLiftDelay([coder decodeIntegerForKey:@"dragLiftDelay"]); 307 self._textInteractionGesturesEnabled = [coder decodeBoolForKey:@"textInteractionGesturesEnabled"]; 308 self._longPressActionsEnabled = [coder decodeBoolForKey:@"longPressActionsEnabled"]; 296 309 #else 297 310 auto userInterfaceDirectionPolicyCandidate = static_cast<WKUserInterfaceDirectionPolicy>([coder decodeIntegerForKey:@"userInterfaceDirectionPolicy"]); … … 348 361 configuration->_ignoresViewportScaleLimits = self->_ignoresViewportScaleLimits; 349 362 configuration->_dragLiftDelay = self->_dragLiftDelay; 363 configuration->_textInteractionGesturesEnabled = self->_textInteractionGesturesEnabled; 364 configuration->_longPressActionsEnabled = self->_longPressActionsEnabled; 350 365 #endif 351 366 #if PLATFORM(MAC) … … 665 680 _dragLiftDelay = dragLiftDelay; 666 681 } 682 683 - (BOOL)_textInteractionGesturesEnabled 684 { 685 return _textInteractionGesturesEnabled; 686 } 687 688 - (void)_setTextInteractionGesturesEnabled:(BOOL)enabled 689 { 690 _textInteractionGesturesEnabled = enabled; 691 } 692 693 - (BOOL)_longPressActionsEnabled 694 { 695 return _longPressActionsEnabled; 696 } 697 698 - (void)_setLongPressActionsEnabled:(BOOL)enabled 699 { 700 _longPressActionsEnabled = enabled; 701 } 702 703 667 704 #endif // PLATFORM(IOS) 668 705 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h
r225765 r227984 77 77 @property (nonatomic, setter=_setAllowsInlineMediaPlaybackAfterFullscreen:) BOOL _allowsInlineMediaPlaybackAfterFullscreen WK_API_AVAILABLE(ios(10.0)); 78 78 @property (nonatomic, setter=_setDragLiftDelay:) _WKDragLiftDelay _dragLiftDelay WK_API_AVAILABLE(ios(11.0)); 79 @property (nonatomic, setter=_setTextInteractionGesturesEnabled:) BOOL _textInteractionGesturesEnabled WK_API_AVAILABLE(ios(WK_IOS_TBA)); 80 @property (nonatomic, setter=_setLongPressActionsEnabled:) BOOL _longPressActionsEnabled WK_API_AVAILABLE(ios(WK_IOS_TBA)); 79 81 #else 80 82 @property (nonatomic, setter=_setShowsURLsInToolTips:) BOOL _showsURLsInToolTips WK_API_AVAILABLE(macosx(10.12)); -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r227927 r227984 6561 6561 #if PLATFORM(COCOA) 6562 6562 6563 void WebPageProxy::setTextAsync(const String& text) 6564 { 6565 if (isValid()) 6566 process().send(Messages::WebPage::SetTextAsync(text), m_pageID); 6567 } 6568 6563 6569 void WebPageProxy::insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup, EditingRangeIsRelativeTo editingRangeIsRelativeTo, bool suppressSelectionUpdate) 6564 6570 { -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r227614 r227984 573 573 void didUpdateBlockSelectionWithTouch(uint32_t touch, uint32_t flags, float growThreshold, float shrinkThreshold); 574 574 #endif 575 void focusNextAssistedNode(bool isForward, WTF::Function<void (CallbackBase::Error)>&& );575 void focusNextAssistedNode(bool isForward, WTF::Function<void (CallbackBase::Error)>&& = [] (auto) { }); 576 576 void setAssistedNodeValue(const String&); 577 577 void setAssistedNodeValueAsNumber(double); … … 639 639 LayerOrView* acceleratedCompositingRootLayer() const; 640 640 641 void setTextAsync(const String&); 641 642 void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false, EditingRangeIsRelativeTo = EditingRangeIsRelativeTo::EditableRoot, bool suppressSelectionUpdate = false); 642 643 void getMarkedRangeAsync(WTF::Function<void (EditingRange, CallbackBase::Error)>&&); -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
r227855 r227984 84 84 @class _UIWebHighlightLongPressGestureRecognizer; 85 85 86 #if ENABLE(DATA_INTERACTION) 87 @class _UITextDragCaretView; 86 #if ENABLE(EXTRA_ZOOM_MODE) 87 @class WKFocusedFormControlViewController; 88 @class WKTextInputViewController; 88 89 #endif 89 90 … … 230 231 BOOL _resigningFirstResponder; 231 232 BOOL _needsDeferredEndScrollingSelectionUpdate; 233 BOOL _isChangingFocus; 232 234 233 235 #if ENABLE(DATA_INTERACTION) … … 239 241 RetainPtr<UIView> _visibleContentViewSnapshot; 240 242 RetainPtr<_UITextDragCaretView> _editDropCaretView; 243 #endif 244 245 #if ENABLE(EXTRA_ZOOM_MODE) 246 RetainPtr<WKTextInputViewController> _textInputViewController; 247 RetainPtr<WKFocusedFormControlViewController> _focusedFormControlViewController; 241 248 #endif 242 249 } -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r227855 r227984 42 42 #import "WKActionSheetAssistant.h" 43 43 #import "WKError.h" 44 #import "WKFocusedFormControlViewController.h" 44 45 #import "WKFormInputControl.h" 45 46 #import "WKFormSelectControl.h" … … 50 51 #import "WKPreviewActionItemInternal.h" 51 52 #import "WKPreviewElementInfoInternal.h" 53 #import "WKTextInputViewController.h" 52 54 #import "WKUIDelegatePrivate.h" 53 55 #import "WKWebViewConfiguration.h" … … 71 73 #import <WebCore/DataDetection.h> 72 74 #import <WebCore/FloatQuad.h> 75 #import <WebCore/LocalizedStrings.h> 73 76 #import <WebCore/NotImplemented.h> 74 77 #import <WebCore/Pasteboard.h> … … 116 119 117 120 @end 121 122 #if ENABLE(EXTRA_ZOOM_MODE) 123 124 @interface WKContentView (ExtraZoomMode) <WKTextFormControlViewControllerDelegate, WKFocusedFormControlViewControllerDelegate> 125 @end 126 127 #endif 118 128 119 129 using namespace WebCore; … … 627 637 _showDebugTapHighlightsForFastClicking = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitShowFastClickDebugTapHighlights"]; 628 638 _needsDeferredEndScrollingSelectionUpdate = NO; 639 _isChangingFocus = NO; 629 640 } 630 641 … … 1206 1217 // Zooming above the page's default scale factor should only happen when the user performs it. 1207 1218 [self _zoomToFocusRect:_assistedNodeInformation.elementRect 1208 1209 1210 1211 1212 1213 allowScaling:(_assistedNodeInformation.allowsUserScalingIgnoringAlwaysScalable && !currentUserInterfaceIdiomIsPad())1214 1219 selectionRect:_didAccessoryTabInitiateFocus ? IntRect() : _assistedNodeInformation.selectionRect 1220 insideFixed:_assistedNodeInformation.insideFixedPosition 1221 fontSize:_assistedNodeInformation.nodeFontSize 1222 minimumScale:_assistedNodeInformation.minimumScaleFactor 1223 maximumScale:_assistedNodeInformation.maximumScaleFactorIgnoringAlwaysScalable 1224 allowScaling:_assistedNodeInformation.allowsUserScalingIgnoringAlwaysScalable && [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone 1225 forceScroll:[self requiresAccessoryView]]; 1215 1226 1216 1227 _didAccessoryTabInitiateFocus = NO; … … 1324 1335 - (SEL)_actionForLongPressFromPositionInformation:(const InteractionInformationAtPosition&)positionInformation 1325 1336 { 1337 if (!_webView.configuration._longPressActionsEnabled) 1338 return nil; 1339 1326 1340 if (!positionInformation.touchCalloutEnabled) 1327 1341 return nil; … … 1550 1564 - (BOOL)hasSelectablePositionAtPoint:(CGPoint)point 1551 1565 { 1566 if (!_webView.configuration._textInteractionGesturesEnabled) 1567 return NO; 1568 1552 1569 if (_inspectorNodeSearchEnabled) 1553 1570 return NO; … … 1570 1587 - (BOOL)pointIsNearMarkedText:(CGPoint)point 1571 1588 { 1589 if (!_webView.configuration._textInteractionGesturesEnabled) 1590 return NO; 1591 1572 1592 InteractionInformationRequest request(roundedIntPoint(point)); 1573 1593 if (![self ensurePositionInformationIsUpToDate:request]) … … 1575 1595 return _positionInformation.isNearMarkedText; 1576 1596 } 1577 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 1100001578 - (BOOL)pointIsInAssistedNode:(CGPoint)point1579 {1580 // This method is still implemented for backwards compatibility with older UIKit versions.1581 return [self textInteractionGesture:UIWKGestureLoupe shouldBeginAtPoint:point];1582 }1583 #endif1584 1597 1585 1598 - (BOOL)textInteractionGesture:(UIWKGestureType)gesture shouldBeginAtPoint:(CGPoint)point 1586 1599 { 1600 if (!_webView.configuration._textInteractionGesturesEnabled) 1601 return NO; 1602 1587 1603 InteractionInformationRequest request(roundedIntPoint(point)); 1588 1604 if (![self ensurePositionInformationIsUpToDate:request]) … … 2104 2120 - (UIColor *)insertionPointColor 2105 2121 { 2122 if (!_webView.configuration._textInteractionGesturesEnabled) 2123 return [UIColor clearColor]; 2124 2106 2125 if (!_page->editorState().isMissingPostLayoutData) { 2107 2126 WebCore::Color caretColor = _page->editorState().postLayoutData().caretColor; … … 3904 3923 { 3905 3924 [self useSelectionAssistantWithGranularity:WKSelectionGranularityCharacter]; 3925 3926 #if ENABLE(EXTRA_ZOOM_MODE) 3927 if (!_isChangingFocus && [self shouldPresentTextInputViewController:_assistedNodeInformation]) 3928 [self presentTextInputViewController:YES]; 3929 #else 3906 3930 [self reloadInputViews]; 3931 #endif 3907 3932 } 3908 3933 … … 3960 3985 - (void)_startAssistingNode:(const AssistedNodeInformation&)information userIsInteracting:(BOOL)userIsInteracting blurPreviousNode:(BOOL)blurPreviousNode changingActivityState:(BOOL)changingActivityState userObject:(NSObject <NSSecureCoding> *)userObject 3961 3986 { 3987 SetForScope<BOOL> isChangingFocusForScope { _isChangingFocus, _assistedNodeInformation.elementType != InputType::None }; 3962 3988 _inputViewUpdateDeferrer = nullptr; 3963 3989 … … 3993 4019 _inputPeripheral = nil; 3994 4020 _traits = nil; 4021 4022 #if ENABLE(EXTRA_ZOOM_MODE) 4023 [self presentFocusedFormControlViewController:NO]; 4024 #endif 4025 3995 4026 if (![self isFirstResponder]) 3996 4027 [self becomeFirstResponder]; … … 4016 4047 [self _displayFormNodeInputView]; 4017 4048 4049 #if ENABLE(EXTRA_ZOOM_MODE) 4050 if (_isChangingFocus) 4051 [_focusedFormControlViewController reloadData:YES]; 4052 #endif 4053 4018 4054 // _inputPeripheral has been initialized in inputView called by reloadInputViews. 4019 4055 [_inputPeripheral beginEditing]; … … 4044 4080 [_webSelectionAssistant resignedFirstResponder]; 4045 4081 4082 #if ENABLE(EXTRA_ZOOM_MODE) 4083 [self dismissTextInputViewController:YES]; 4084 if (!_isChangingFocus) 4085 [self dismissFocusedFormControlViewController:[_focusedFormControlViewController isVisible]]; 4086 #endif 4087 4046 4088 // The custom fixed position rect behavior is affected by -isAssistingNode, so if that changes we need to recompute rects. 4047 4089 if (editableChanged) … … 4050 4092 [_webView didEndFormControlInteraction]; 4051 4093 } 4094 4095 #if ENABLE(EXTRA_ZOOM_MODE) 4096 4097 - (void)presentFocusedFormControlViewController:(BOOL)animated 4098 { 4099 if (_focusedFormControlViewController) 4100 return; 4101 4102 _focusedFormControlViewController = adoptNS([[WKFocusedFormControlViewController alloc] init]); 4103 [_focusedFormControlViewController setDelegate:self]; 4104 [[UIViewController _viewControllerForFullScreenPresentationFromView:self] presentViewController:_focusedFormControlViewController.get() animated:animated completion:nil]; 4105 } 4106 4107 - (void)dismissFocusedFormControlViewController:(BOOL)animated 4108 { 4109 if (!_focusedFormControlViewController) 4110 return; 4111 4112 [_focusedFormControlViewController dismissViewControllerAnimated:animated completion:nil]; 4113 _focusedFormControlViewController = nil; 4114 } 4115 4116 - (BOOL)shouldPresentTextInputViewController:(const AssistedNodeInformation&)info 4117 { 4118 switch (info.elementType) { 4119 case InputType::ContentEditable: 4120 case InputType::Text: 4121 case InputType::Password: 4122 case InputType::TextArea: 4123 case InputType::Search: 4124 case InputType::Email: 4125 case InputType::URL: 4126 return true; 4127 default: 4128 return false; 4129 } 4130 } 4131 4132 - (void)presentTextInputViewController:(BOOL)animated 4133 { 4134 if (_textInputViewController) 4135 return; 4136 4137 _textInputViewController = adoptNS([[WKTextInputViewController alloc] initWithText:_assistedNodeInformation.value textSuggestions:@[ ]]); 4138 [_textInputViewController setDelegate:self]; 4139 [_focusedFormControlViewController presentViewController:_textInputViewController.get() animated:animated completion:nil]; 4140 } 4141 4142 - (void)dismissTextInputViewController:(BOOL)animated 4143 { 4144 if (!_textInputViewController) 4145 return; 4146 4147 auto textInputViewController = WTFMove(_textInputViewController); 4148 [textInputViewController dismissViewControllerAnimated:animated completion:nil]; 4149 } 4150 4151 - (void)textInputController:(WKTextFormControlViewController *)controller didCommitText:(NSString *)text 4152 { 4153 // FIXME: Update cached AssistedNodeInformation state in the UI process. 4154 _page->setTextAsync(text); 4155 } 4156 4157 - (void)textInputController:(WKTextFormControlViewController *)controller didRequestDismissalWithAction:(WKFormControlAction)action 4158 { 4159 if (action == WKFormControlActionCancel) { 4160 _page->blurAssistedNode(); 4161 return; 4162 } 4163 4164 if (_assistedNodeInformation.formAction.isEmpty() && !_assistedNodeInformation.hasNextNode && !_assistedNodeInformation.hasPreviousNode) { 4165 // 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 4166 // besides dismiss the UI, so we just automatically dismiss the focused form control UI. 4167 _page->blurAssistedNode(); 4168 return; 4169 } 4170 4171 [_focusedFormControlViewController show:NO]; 4172 [self dismissTextInputViewController:YES]; 4173 } 4174 4175 - (void)focusedFormControlControllerDidSubmit:(WKFocusedFormControlViewController *)controller 4176 { 4177 [self insertText:@"\n"]; 4178 _page->blurAssistedNode(); 4179 } 4180 4181 - (void)focusedFormControlControllerDidCancel:(WKFocusedFormControlViewController *)controller 4182 { 4183 _page->blurAssistedNode(); 4184 } 4185 4186 - (void)focusedFormControlControllerDidBeginEditing:(WKFocusedFormControlViewController *)controller 4187 { 4188 if ([self shouldPresentTextInputViewController:_assistedNodeInformation]) 4189 [self presentTextInputViewController:YES]; 4190 } 4191 4192 - (CGRect)highlightedRectForFocusedFormControlController:(WKFocusedFormControlViewController *)controller inCoordinateSpace:(id <UICoordinateSpace>)coordinateSpace 4193 { 4194 return [self convertRect:_assistedNodeInformation.elementRect toCoordinateSpace:coordinateSpace]; 4195 } 4196 4197 - (NSString *)actionNameForFocusedFormControlController:(WKFocusedFormControlViewController *)controller 4198 { 4199 if (_assistedNodeInformation.formAction.isEmpty()) 4200 return nil; 4201 4202 return _assistedNodeInformation.elementType == InputType::Search ? formControlSearchButtonTitle() : formControlGoButtonTitle(); 4203 } 4204 4205 - (void)focusedFormControlControllerDidRequestNextNode:(WKFocusedFormControlViewController *)controller 4206 { 4207 if (_assistedNodeInformation.hasNextNode) 4208 _page->focusNextAssistedNode(true); 4209 } 4210 4211 - (void)focusedFormControlControllerDidRequestPreviousNode:(WKFocusedFormControlViewController *)controller 4212 { 4213 if (_assistedNodeInformation.hasPreviousNode) 4214 _page->focusNextAssistedNode(false); 4215 } 4216 4217 - (BOOL)hasNextNodeForFocusedFormControlController:(WKFocusedFormControlViewController *)controller 4218 { 4219 return _assistedNodeInformation.hasNextNode; 4220 } 4221 4222 - (BOOL)hasPreviousNodeForFocusedFormControlController:(WKFocusedFormControlViewController *)controller 4223 { 4224 return _assistedNodeInformation.hasPreviousNode; 4225 } 4226 4227 #endif // ENABLE(EXTRA_ZOOM_MODE) 4052 4228 4053 4229 - (void)_selectionChanged -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r227759 r227984 4591 4591 #if PLATFORM(COCOA) 4592 4592 4593 void WebPage::setTextAsync(const String& text) 4594 { 4595 if (is<HTMLInputElement>(m_assistedNode.get())) { 4596 downcast<HTMLInputElement>(*m_assistedNode).setValueForUser(text); 4597 return; 4598 } 4599 4600 auto frame = makeRef(m_page->focusController().focusedOrMainFrame()); 4601 if (!frame->selection().selection().isContentEditable()) 4602 return; 4603 4604 frame->selection().selectAll(); 4605 frame->editor().insertText(text, nullptr, TextEventInputKeyboard); 4606 } 4607 4593 4608 void WebPage::insertTextAsync(const String& text, const EditingRange& replacementEditingRange, bool registerUndoGroup, uint32_t editingRangeIsRelativeTo, bool suppressSelectionUpdate) 4594 4609 { -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r227759 r227984 709 709 void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput); 710 710 711 void setTextAsync(const String&); 711 712 void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false, uint32_t editingRangeIsRelativeTo = (uint32_t)EditingRangeIsRelativeTo::EditableRoot, bool suppressSelectionUpdate = false); 712 713 void getMarkedRangeAsync(CallbackID); -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in
r227377 r227984 391 391 AcceptsFirstMouse(int eventNumber, WebKit::WebMouseEvent event) -> (bool result) 392 392 393 SetTextAsync(String text) 393 394 InsertTextAsync(String text, struct WebKit::EditingRange replacementRange, bool registerUndoGroup, uint32_t editingRangeIsRelativeTo, bool suppressSelectionUpdate) 394 395 GetMarkedRangeAsync(WebKit::CallbackID callbackID)
Note: See TracChangeset
for help on using the changeset viewer.