Changeset 226826 in webkit


Ignore:
Timestamp:
Jan 11, 2018, 5:43:06 PM (8 years ago)
Author:
Megan Gardner
Message:

Implement MultiDocument protocol for restoring focus to a WKWebView
https://bugs.webkit.org/show_bug.cgi?id=181510

Reviewed by Dan Bernstein.

Support the UIKit protocol for restoring focus to a what previously had focus.
WebKit already has a method to silently remove and replace focus, without telling the
web process about the unfocus and refocusing, so we're just using that.

  • Platform/spi/ios/UIKitSPI.h:
  • UIProcess/ios/WKContentViewInteraction.h:
  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView _restoreFocusWithToken:]):
(-[WKContentView _preserveFocusWithToken:destructively:]):

Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r226824 r226826  
     12018-01-11  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Implement MultiDocument protocol for restoring focus to a WKWebView
     4        https://bugs.webkit.org/show_bug.cgi?id=181510
     5
     6        Reviewed by Dan Bernstein.
     7
     8        Support the UIKit protocol for restoring focus to a what previously had focus.
     9        WebKit already has a method to silently remove and replace focus, without telling the
     10        web process about the unfocus and refocusing, so we're just using that.
     11
     12        * Platform/spi/ios/UIKitSPI.h:
     13        * UIProcess/ios/WKContentViewInteraction.h:
     14        * UIProcess/ios/WKContentViewInteraction.mm:
     15        (-[WKContentView _restoreFocusWithToken:]):
     16        (-[WKContentView _preserveFocusWithToken:destructively:]):
     17
     18
    1192018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
    220
  • trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h

    r226750 r226826  
    379379@end
    380380
     381@protocol UITextInputMultiDocument <NSObject>
     382@optional
     383- (void)_restoreFocusWithToken:(id <NSCopying, NSSecureCoding>)token completion:(void (^)(BOOL didRestore))completion;
     384- (void)_preserveFocusWithToken:(id <NSCopying, NSSecureCoding>)token destructively:(BOOL)destructively;
     385@end
     386
    381387@interface UITextInteractionAssistant : NSObject
    382388@end
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r226808 r226826  
    243243@end
    244244
    245 @interface WKContentView (WKInteraction) <UIGestureRecognizerDelegate, UIWebTouchEventsGestureRecognizerDelegate, UITextInputPrivate, UIWebFormAccessoryDelegate, UIWKInteractionViewProtocol, WKFileUploadPanelDelegate, WKActionSheetAssistantDelegate, UITextAutoscrolling
     245@interface WKContentView (WKInteraction) <UIGestureRecognizerDelegate, UITextAutoscrolling, UITextInputMultiDocument, UITextInputPrivate, UIWebFormAccessoryDelegate, UIWebTouchEventsGestureRecognizerDelegate, UIWKInteractionViewProtocol, WKActionSheetAssistantDelegate, WKFileUploadPanelDelegate
    246246#if ENABLE(DATA_INTERACTION)
    247247    , UIDragInteractionDelegate, UIDropInteractionDelegate
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r226808 r226826  
    41284128}
    41294129
     4130#pragma mark - UITextInputMultiDocument
     4131
     4132- (void)_restoreFocusWithToken:(id <NSCopying, NSSecureCoding>)token
     4133{
     4134    --_webView->_activeFocusedStateRetainCount;
     4135}
     4136
     4137- (void)_preserveFocusWithToken:(id <NSCopying, NSSecureCoding>)token destructively:(BOOL)destructively
     4138{
     4139    ++_webView->_activeFocusedStateRetainCount;
     4140}
     4141
    41304142#pragma mark - Implementation of UIWebTouchEventsGestureRecognizerDelegate.
    41314143
Note: See TracChangeset for help on using the changeset viewer.