Changeset 191535 in webkit
- Timestamp:
- Oct 24, 2015 8:57:25 AM (9 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r191534 r191535 1 2015-10-24 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] _WKFormInputSession should provide access to the focused element info 4 https://bugs.webkit.org/show_bug.cgi?id=150512 5 6 Reviewed by Tim Horton. 7 8 * UIProcess/API/Cocoa/_WKFormInputSession.h: Added focusedElementInfo property to the 9 protocol. 10 11 * UIProcess/ios/WKContentViewInteraction.mm: 12 (-[WKFormInputSession initWithContentView:focusedElementInfo:userObject:]): Added the 13 focusedElementInfo argument, used to initialize a new ivar. 14 (-[WKFormInputSession focusedElementInfo]): Added this getter for the new 15 _WKFormInputSession property. 16 (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]): 17 Create the WKFocusedElementInfo unconditionally and pass it to the new WKFormInputSession 18 initializer. 19 1 20 2015-10-24 Dan Bernstein <mitz@apple.com> 2 21 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKFormInputSession.h
r191534 r191535 29 29 30 30 #import <Foundation/Foundation.h> 31 #import <WebKit/_WKFocusedElementInfo.h> 31 32 32 33 @protocol _WKFormInputSession <NSObject> … … 34 35 @property (nonatomic, readonly, getter=isValid) BOOL valid; 35 36 @property (nonatomic, readonly) NSObject <NSSecureCoding> *userObject; 37 @property (nonatomic, readonly) id <_WKFocusedElementInfo> focusedElementInfo WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA); 36 38 37 39 #if TARGET_OS_IPHONE -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r191534 r191535 224 224 #endif 225 225 226 @interface WKFocusedElementInfo : NSObject <_WKFocusedElementInfo> 227 - (instancetype)initWithAssistedNodeInformation:(const AssistedNodeInformation&)information isUserInitiated:(BOOL)isUserInitiated; 228 @end 229 226 230 @interface WKFormInputSession : NSObject <_WKFormInputSession> 227 231 228 - (instancetype)initWithContentView:(WKContentView *)view userObject:(NSObject <NSSecureCoding> *)userObject;232 - (instancetype)initWithContentView:(WKContentView *)view focusedElementInfo:(WKFocusedElementInfo *)elementInfo userObject:(NSObject <NSSecureCoding> *)userObject; 229 233 - (void)invalidate; 230 234 … … 234 238 WKContentView *_contentView; 235 239 RetainPtr<NSObject <NSSecureCoding>> _userObject; 240 RetainPtr<WKFocusedElementInfo> _focusedElementInfo; 236 241 RetainPtr<UIView> _customInputView; 237 242 } 238 243 239 - (instancetype)initWithContentView:(WKContentView *)view userObject:(NSObject <NSSecureCoding> *)userObject244 - (instancetype)initWithContentView:(WKContentView *)view focusedElementInfo:(WKFocusedElementInfo *)elementInfo userObject:(NSObject <NSSecureCoding> *)userObject 240 245 { 241 246 if (!(self = [super init])) … … 243 248 244 249 _contentView = view; 250 _focusedElementInfo = elementInfo; 245 251 _userObject = userObject; 246 252 247 253 return self; 254 } 255 256 - (id <_WKFocusedElementInfo>)focusedElementInfo 257 { 258 return _focusedElementInfo.get(); 248 259 } 249 260 … … 292 303 } 293 304 294 @end295 296 @interface WKFocusedElementInfo : NSObject <_WKFocusedElementInfo>297 - (instancetype)initWithAssistedNodeInformation:(const AssistedNodeInformation&)information isUserInitiated:(BOOL)isUserInitiated;298 305 @end 299 306 … … 3193 3200 { 3194 3201 id <_WKInputDelegate> inputDelegate = [_webView _inputDelegate]; 3202 RetainPtr<WKFocusedElementInfo> focusedElementInfo = adoptNS([[WKFocusedElementInfo alloc] initWithAssistedNodeInformation:information isUserInitiated:userIsInteracting]); 3195 3203 BOOL shouldShowKeyboard; 3196 if ([inputDelegate respondsToSelector:@selector(_webView:focusShouldStartInputSession:)]) { 3197 RetainPtr<WKFocusedElementInfo> focusedElementInfo = adoptNS([[WKFocusedElementInfo alloc] initWithAssistedNodeInformation:information isUserInitiated:userIsInteracting]);3204 3205 if ([inputDelegate respondsToSelector:@selector(_webView:focusShouldStartInputSession:)]) 3198 3206 shouldShowKeyboard = [inputDelegate _webView:_webView focusShouldStartInputSession:focusedElementInfo.get()]; 3199 }else {3207 else { 3200 3208 // The default behavior is to allow node assistance if the user is interacting or the keyboard is already active. 3201 3209 shouldShowKeyboard = userIsInteracting || _textSelectionAssistant; … … 3245 3253 3246 3254 if ([inputDelegate respondsToSelector:@selector(_webView:didStartInputSession:)]) { 3247 _formInputSession = adoptNS([[WKFormInputSession alloc] initWithContentView:self userObject:userObject]);3255 _formInputSession = adoptNS([[WKFormInputSession alloc] initWithContentView:self focusedElementInfo:focusedElementInfo.get() userObject:userObject]); 3248 3256 [inputDelegate _webView:_webView didStartInputSession:_formInputSession.get()]; 3249 3257 }
Note: See TracChangeset
for help on using the changeset viewer.