Changeset 226911 in webkit


Ignore:
Timestamp:
Jan 12, 2018, 1:32:17 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 knows what node was previously being focused by the DOM, we merely
need to be asked to turn the focus on again.
Resubmitting https://trac.webkit.org/changeset/226826 as it broke internal builds

  • 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

    r226904 r226911  
     12018-01-12  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 knows what node was previously being focused by the DOM, we merely
     10        need to be asked to turn the focus on again.
     11        Resubmitting https://trac.webkit.org/changeset/226826 as it broke internal builds
     12
     13        * Platform/spi/ios/UIKitSPI.h:
     14        * UIProcess/ios/WKContentViewInteraction.h:
     15        * UIProcess/ios/WKContentViewInteraction.mm:
     16        (-[WKContentView _restoreFocusWithToken:]):
     17        (-[WKContentView _preserveFocusWithToken:destructively:]):
     18
    1192018-01-12  Youenn Fablet  <youenn@apple.com>
    220
  • trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h

    r226903 r226911  
    968968@end
    969969
     970#if __has_include(<UIKit/UITextInputMultiDocument.h>)
     971#import <UIKit/UITextAutofillSuggestion.h>
     972#else
     973@protocol UITextAutofillSuggestion <NSObject>
     974@optional
     975- (void)_restoreFocusWithToken:(id <NSCopying, NSSecureCoding>)token completion:(void (^)(BOOL didRestore))completion;
     976- (void)_preserveFocusWithToken:(id <NSCopying, NSSecureCoding>)token destructively:(BOOL)destructively;
     977@end
     978#endif
     979
    970980@interface UIResponder ()
    971981- (UIResponder *)firstResponder;
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r226903 r226911  
    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

    r226903 r226911  
    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.