Changeset 243963 in webkit
- Timestamp:
- Apr 6, 2019, 7:25:36 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Platform/spi/ios/UIKitSPI.h (modified) (1 diff)
-
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm (modified) (3 diffs)
-
Tools/TestWebKitAPI/ios/UIKitSPI.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r243962 r243963 1 2019-04-06 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Hide next and previous form control buttons when WKWebView is editable 4 https://bugs.webkit.org/show_bug.cgi?id=196672 5 <rdar://problem/35625321> 6 7 Reviewed by Tim Horton. 8 9 Adopt new UIKit SPI to hide or show next and previous controls in the form accessory view when changing 10 editability. 11 12 Test: KeyboardInputTests.FormNavigationAssistantBarButtonItems 13 14 * Platform/spi/ios/UIKitSPI.h: 15 * UIProcess/API/Cocoa/WKWebView.mm: 16 (-[WKWebView _setEditable:]): 17 * UIProcess/ios/WKContentViewInteraction.h: 18 * UIProcess/ios/WKContentViewInteraction.mm: 19 (-[WKContentView _updateAccessory]): 20 (-[WKContentView _didChangeWebViewEditability]): 21 1 22 2019-04-06 Antti Koivisto <antti@apple.com> 2 23 -
trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h
r243370 r243963 1171 1171 } 1172 1172 1173 @interface UIWebFormAccessory (Staging_49666643) 1174 - (void)setNextPreviousItemsVisible:(BOOL)visible; 1175 @end 1176 1173 1177 WTF_EXTERN_C_BEGIN 1174 1178 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r243961 r243963 4606 4606 - (void)_setEditable:(BOOL)editable 4607 4607 { 4608 bool wasEditable = _page->isEditable(); 4608 4609 _page->setEditable(editable); 4609 4610 #if PLATFORM(MAC) 4610 4611 if (editable) 4611 4612 _impl->didBecomeEditable(); 4613 #endif 4614 4615 if (wasEditable == editable) 4616 return; 4617 4618 #if PLATFORM(IOS_FAMILY) 4619 [_contentView _didChangeWebViewEditability]; 4612 4620 #endif 4613 4621 } -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
r243808 r243963 448 448 - (void)_accessibilityClearSelection; 449 449 - (WKFormInputSession *)_formInputSession; 450 - (void)_didChangeWebViewEditability; 450 451 451 452 - (void)_requestDOMPasteAccessWithElementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r243808 r243963 3812 3812 auto* accessoryView = self.formAccessoryView; // Creates one, if needed. 3813 3813 3814 if ([accessoryView respondsToSelector:@selector(setNextPreviousItemsVisible:)]) 3815 [accessoryView setNextPreviousItemsVisible:!_webView._editable]; 3816 3814 3817 [accessoryView setNextEnabled:_focusedElementInformation.hasNextNode]; 3815 3818 [accessoryView setPreviousEnabled:_focusedElementInformation.hasPreviousNode]; … … 3849 3852 { 3850 3853 [self.inputDelegate selectionDidChange:self]; 3854 } 3855 3856 - (void)_didChangeWebViewEditability 3857 { 3858 if ([_formAccessoryView respondsToSelector:@selector(setNextPreviousItemsVisible:)]) 3859 [_formAccessoryView setNextPreviousItemsVisible:!_webView._editable]; 3851 3860 } 3852 3861 -
trunk/Tools/ChangeLog
r243961 r243963 1 2019-04-06 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Hide next and previous form control buttons when WKWebView is editable 4 https://bugs.webkit.org/show_bug.cgi?id=196672 5 <rdar://problem/35625321> 6 7 Reviewed by Tim Horton. 8 9 Add a new API test. 10 11 * TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm: 12 (-[TestWKWebView lastTrailingBarButtonGroup]): 13 (TestWebKitAPI::TEST): 14 * TestWebKitAPI/ios/UIKitSPI.h: 15 1 16 2019-04-05 Yongjun Zhang <yongjun_zhang@apple.com> 2 17 -
trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm
r243912 r243963 28 28 #if PLATFORM(IOS_FAMILY) 29 29 30 #import "IPadUserInterfaceSwizzler.h" 30 31 #import "PlatformUtilities.h" 31 32 #import "TestInputDelegate.h" … … 141 142 } 142 143 144 - (UIBarButtonItemGroup *)lastTrailingBarButtonGroup 145 { 146 return self.firstResponder.inputAssistantItem.trailingBarButtonGroups.lastObject; 147 } 148 143 149 @end 144 150 … … 167 173 168 174 namespace TestWebKitAPI { 175 176 TEST(KeyboardInputTests, FormNavigationAssistantBarButtonItems) 177 { 178 IPadUserInterfaceSwizzler iPadUserInterface; 179 180 auto inputDelegate = adoptNS([TestInputDelegate new]); 181 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); 182 [webView _setInputDelegate:inputDelegate.get()]; 183 [inputDelegate setFocusStartsInputSessionPolicyHandler:[&] (WKWebView *, id <_WKFocusedElementInfo>) -> _WKFocusStartsInputSessionPolicy { 184 return _WKFocusStartsInputSessionPolicyAllow; 185 }]; 186 [webView synchronouslyLoadHTMLString:@"<body contenteditable>"]; 187 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"document.body.focus()"]; 188 189 EXPECT_EQ(2U, [webView lastTrailingBarButtonGroup].barButtonItems.count); 190 EXPECT_FALSE([webView lastTrailingBarButtonGroup].hidden); 191 192 if (![UIWebFormAccessory instancesRespondToSelector:@selector(setNextPreviousItemsVisible:)]) { 193 // The rest of this test requires UIWebFormAccessory to be able to show or hide its next and previous items. 194 return; 195 } 196 197 [webView _setEditable:YES]; 198 EXPECT_TRUE([webView lastTrailingBarButtonGroup].hidden); 199 200 [webView _setEditable:NO]; 201 EXPECT_FALSE([webView lastTrailingBarButtonGroup].hidden); 202 } 169 203 170 204 TEST(KeyboardInputTests, ModifyInputAssistantItemBarButtonGroups) -
trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h
r243519 r243963 31 31 32 32 #import <UIKit/UIApplication_Private.h> 33 #import <UIKit/UIBarButtonItemGroup_Private.h> 33 34 #import <UIKit/UICalloutBar.h> 34 35 #import <UIKit/UIKeyboard_Private.h> … … 39 40 #import <UIKit/UIViewController_Private.h> 40 41 #import <UIKit/UIWKTextInteractionAssistant.h> 42 #import <UIKit/UIWebFormAccessory.h> 41 43 42 44 #if PLATFORM(IOS) … … 82 84 - (BOOL)_shouldSuppressSelectionCommands; 83 85 - (NSDictionary *)_autofillContext; 86 @end 87 88 @interface UIWebFormAccessory : UIInputView 89 @end 90 91 @interface UIBarButtonItemGroup () 92 @property (nonatomic, readwrite, assign, getter=_isHidden, setter=_setHidden:) BOOL hidden; 84 93 @end 85 94 … … 171 180 @end 172 181 182 @interface UIWebFormAccessory (Staging_49666643) 183 - (void)setNextPreviousItemsVisible:(BOOL)visible; 184 @end 185 173 186 #endif // PLATFORM(IOS_FAMILY)
Note:
See TracChangeset
for help on using the changeset viewer.