Changeset 244220 in webkit
- Timestamp:
- Apr 12, 2019 10:30:00 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r244219 r244220 1 2019-04-12 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Software keyboard is shown too frequently on some websites 4 https://bugs.webkit.org/show_bug.cgi?id=195856 5 <rdar://problem/49191395> 6 7 Reviewed by Darin Adler. 8 9 Fix a failing layout test, which (among other reasons) is currently failing because support for inputmode="none" 10 is disabled. 11 12 * fast/forms/ios/inputmode-none-expected.txt: 13 * fast/forms/ios/inputmode-none.html: 14 * resources/ui-helper.js: 15 16 Add a UIHelper method for attaching or detaching the hardware keyboard. 17 18 (window.UIHelper.setHardwareKeyboardAttached): 19 (window.UIHelper): 20 1 21 2019-04-12 Ryan Haddad <ryanhaddad@apple.com> 2 22 -
trunk/LayoutTests/fast/forms/ios/inputmode-none-expected.txt
r240497 r244220 1 2 1 3 This test verifies that the system keyboard is not visible when tapping on an input field with inputmode=none. 2 4 … … 4 6 5 7 6 7 8 ACTIVATE input with inputmode=text 8 PASS textKeyboardHeight = systemKeyboardRect.height;systemKeyboardRect.height > 0 is true9 PASS inputWithSystemKeyboard.value is "Text"9 PASS systemKeyboardRect.height > 0 is true 10 PASS inputWithSystemKeyboard.value is 'Text' 10 11 11 12 ACTIVATE input with inputmode=none 12 PASS systemKeyboardRect.height is textKeyboardHeight13 PASS Successfully dismissed keyboard 13 14 14 15 TEST enter text in input with inputmode=none 15 PASS inputWithoutSystemKeyboard.value is "None"16 PASS inputWithoutSystemKeyboard.value is 'None' 16 17 17 18 TEST selection in input with inputmode=none 18 19 PASS selectionRects.length is 1 19 PASS selectionRects[0].left is 1 5920 PASS selectionRects[0].top is 26121 PASS selectionRects[0].width is 2 820 PASS selectionRects[0].left is 16 21 PASS selectionRects[0].top is 38 22 PASS selectionRects[0].width is 27 22 23 PASS selectionRects[0].height is 15 23 24 24 PASS successfullyParsed is true 25 25 26 26 TEST COMPLETE 27 27 -
trunk/LayoutTests/fast/forms/ios/inputmode-none.html
r240497 r244220 1 <!DOCTYPE html> 1 <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] --> 2 2 <html> 3 3 <head> 4 <meta name="viewport" content="width=device-width, initial-scale=1 ">4 <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> 5 5 <script src="../../../resources/js-test.js"></script> 6 6 <script src="../../../resources/ui-helper.js"></script> 7 7 </head> 8 8 <body onload="runTest()"> 9 <input id="input-keyboard" inputmode="text"> 10 <input id="input-nokeyboard" inputmode="none"> 9 <div><input id="input-keyboard" inputmode="text"></div> 10 <div><input id="input-nokeyboard" inputmode="none"></div> 11 <pre id="description"></pre> 12 <pre id="console"></pre> 11 13 <script> 12 14 jsTestIsAsync = true; 13 15 14 16 async function runTest() { 17 await UIHelper.setHardwareKeyboardAttached(false); 15 18 inputWithSystemKeyboard = document.getElementById("input-keyboard"); 16 19 inputWithoutSystemKeyboard = document.getElementById("input-nokeyboard"); 17 20 18 description( 'This test verifies that the system keyboard is not visible when tapping on an input field with inputmode=none.');21 description("This test verifies that the system keyboard is not visible when tapping on an input field with inputmode=none."); 19 22 20 debug( '\nACTIVATE input with inputmode=text');21 await UIHelper.activate FormControl(inputWithSystemKeyboard);23 debug("\nACTIVATE input with inputmode=text"); 24 await UIHelper.activateElementAndWaitForInputSession(inputWithSystemKeyboard); 22 25 systemKeyboardRect = await UIHelper.inputViewBounds(); 23 shouldBe( 'textKeyboardHeight = systemKeyboardRect.height; systemKeyboardRect.height > 0', 'true');26 shouldBe("systemKeyboardRect.height > 0", "true"); 24 27 await UIHelper.enterText("Text"); 25 shouldBe( 'inputWithSystemKeyboard.value', '"Text"');28 shouldBe("inputWithSystemKeyboard.value", "'Text'"); 26 29 27 debug( '\nACTIVATE input with inputmode=none');28 await UIHelper.activate FormControl(inputWithoutSystemKeyboard);29 systemKeyboardRect = await UIHelper.inputViewBounds();30 shouldBe('systemKeyboardRect.height', 'textKeyboardHeight');30 debug("\nACTIVATE input with inputmode=none"); 31 await UIHelper.activateElement(inputWithoutSystemKeyboard); 32 await UIHelper.waitForKeyboardToHide(); 33 testPassed("Successfully dismissed keyboard"); 31 34 32 debug( '\nTEST enter text in input with inputmode=none');35 debug("\nTEST enter text in input with inputmode=none"); 33 36 await UIHelper.enterText("None"); 34 shouldBe( 'inputWithoutSystemKeyboard.value', '"None"');37 shouldBe("inputWithoutSystemKeyboard.value", "'None'"); 35 38 36 debug('\nTEST selection in input with inputmode=none'); 37 inputWithoutSystemKeyboard.setSelectionRange(0, inputWithSystemKeyboard.value.length); 38 selectionRects = await UIHelper.getUISelectionRects(); 39 shouldBe('selectionRects.length', '1'); 40 shouldBe('selectionRects[0].left', '159'); 41 shouldBe('selectionRects[0].top', '261'); 42 shouldBe('selectionRects[0].width', '28'); 43 shouldBe('selectionRects[0].height', '15'); 39 debug("\nTEST selection in input with inputmode=none"); 40 inputWithoutSystemKeyboard.select(); 44 41 45 debug(''); 42 selectionRects = []; 43 while (!selectionRects.length) 44 selectionRects = await UIHelper.getUISelectionViewRects(); 45 46 shouldBe("selectionRects.length", "1"); 47 shouldBe("selectionRects[0].left", "16"); 48 shouldBe("selectionRects[0].top", "38"); 49 shouldBe("selectionRects[0].width", "27"); 50 shouldBe("selectionRects[0].height", "15"); 46 51 finishJSTest(); 47 52 } -
trunk/LayoutTests/resources/ui-helper.js
r244096 r244220 834 834 }); 835 835 } 836 837 static setHardwareKeyboardAttached(attached) 838 { 839 return new Promise(resolve => testRunner.runUIScript(`uiController.setHardwareKeyboardAttached(${attached ? "true" : "false"})`, resolve)); 840 } 836 841 } -
trunk/Source/WebCore/PAL/ChangeLog
r244114 r244220 1 2019-04-12 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Software keyboard is shown too frequently on some websites 4 https://bugs.webkit.org/show_bug.cgi?id=195856 5 <rdar://problem/49191395> 6 7 Reviewed by Darin Adler. 8 9 Declare new GraphicsServices SPI. 10 11 * pal/spi/ios/GraphicsServicesSPI.h: 12 1 13 2019-04-10 Antoine Quint <graouts@apple.com> 2 14 -
trunk/Source/WebCore/PAL/pal/spi/ios/GraphicsServicesSPI.h
r238078 r244220 47 47 uint32_t GSKeyboardGetModifierState(GSKeyboardRef); 48 48 Boolean GSEventIsHardwareKeyboardAttached(); 49 void GSEventSetHardwareKeyboardAttached(Boolean attached, uint8_t country); 49 50 50 51 extern const char *kGSEventHardwareKeyboardAvailabilityChangedNotification; -
trunk/Source/WebKit/ChangeLog
r244218 r244220 1 2019-04-12 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Software keyboard is shown too frequently on some websites 4 https://bugs.webkit.org/show_bug.cgi?id=195856 5 <rdar://problem/49191395> 6 7 Reviewed by Darin Adler. 8 9 On some websites, hidden editable elements are very frequently focused upon user interaction. Currently, this 10 causes the software keyboard to pop in and out unexpectedly; luckily, these same sites also apply 11 inputmode="none" to the hidden editable element, which ought to ensure that the software keyboard doesn't appear 12 when the element is focused. 13 14 However, since we disabled support for inputmode="none" in r240497, the software keyboard is no longer 15 suppressed, and becomes a big nuissance. r240497 removed support for this feature because, when using a hardware 16 keyboard, pressing the globe key no longer showed UI for switching languages. However, support for inputmode 17 none makes a much larger impact when a software keyboard is used (since the entire software keyboard animates in 18 and out), whereas a hardware keyboard only displays an input accessory view. For this reason, we can mitigate 19 this bug without reintroducing <rdar://problem/47406553> by re-enabling inputmode="none", but only when a 20 hardware keyboard is not attached. 21 22 * UIProcess/API/Cocoa/WKWebView.mm: 23 (hardwareKeyboardAvailabilityChangedCallback): 24 * UIProcess/ios/WKContentViewInteraction.h: 25 * UIProcess/ios/WKContentViewInteraction.mm: 26 (-[WKContentView shouldShowAutomaticKeyboardUI]): 27 28 Don't show the keyboard if inputmode is none and a hardware keyboard is not attached. 29 30 (-[WKContentView _hardwareKeyboardAvailabilityChanged]): 31 32 Reload input views if the inputmode is none to ensure that if a hardware keyboard is attached while editing an 33 element with inputmode="none", we'll show the input accessory view once again. 34 1 35 2019-04-12 Antoine Quint <graouts@apple.com> 2 36 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r244203 r244220 3336 3336 ASSERT(observer); 3337 3337 WKWebView *webView = (__bridge WKWebView *)observer; 3338 [webView->_contentView _hardwareKeyboardAvailabilityChanged]; 3338 3339 webView._page->hardwareKeyboardAvailabilityChanged(GSEventIsHardwareKeyboardAttached()); 3339 3340 } -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
r244096 r244220 416 416 - (void)_didUpdateInputMode:(WebCore::InputMode)mode; 417 417 - (void)_didReceiveEditorStateUpdateAfterFocus; 418 - (void)_hardwareKeyboardAvailabilityChanged; 418 419 - (void)_selectionChanged; 419 420 - (void)_updateChangedSelection; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r244141 r244220 101 101 #import <pal/spi/cocoa/DataDetectorsCoreSPI.h> 102 102 #import <pal/spi/ios/DataDetectorsUISPI.h> 103 #import <pal/spi/ios/GraphicsServicesSPI.h> 103 104 #import <wtf/Optional.h> 104 105 #import <wtf/RetainPtr.h> … … 119 120 #import <UIKit/UIHoverGestureRecognizer.h> 120 121 #import <UIKit/_UILookupGestureRecognizer.h> 121 #import <pal/spi/ios/GraphicsServicesSPI.h>122 122 #endif 123 123 … … 1596 1596 - (BOOL)shouldShowAutomaticKeyboardUI 1597 1597 { 1598 // FIXME: Make this function knowledgeable about the HTML attribute inputmode. 1598 // FIXME: We should support inputmode="none" when the hardware keyboard is attached. 1599 // We currently refrain from doing so because that would prevent UIKit from showing 1600 // the language picker when pressing the globe key to change the input language. 1601 if (_focusedElementInformation.inputMode == WebCore::InputMode::None && !GSEventIsHardwareKeyboardAttached()) 1602 return NO; 1603 1599 1604 switch (_focusedElementInformation.elementType) { 1600 1605 case WebKit::InputType::None: … … 5134 5139 } 5135 5140 5141 - (void)_hardwareKeyboardAvailabilityChanged 5142 { 5143 if (hasFocusedElement(_focusedElementInformation) && _focusedElementInformation.inputMode == WebCore::InputMode::None) 5144 [self reloadInputViews]; 5145 } 5146 5136 5147 - (void)_didUpdateInputMode:(WebCore::InputMode)mode 5137 5148 { -
trunk/Tools/ChangeLog
r244214 r244220 1 2019-04-12 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Software keyboard is shown too frequently on some websites 4 https://bugs.webkit.org/show_bug.cgi?id=195856 5 <rdar://problem/49191395> 6 7 Reviewed by Darin Adler. 8 9 Add support for attaching or detaching the hardware keyboard on iOS in layout tests. 10 11 * DumpRenderTree/ios/UIScriptControllerIOS.mm: 12 (WTR::UIScriptController::setHardwareKeyboardAttached): 13 * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: 14 * TestRunnerShared/UIScriptContext/UIScriptController.cpp: 15 (WTR::UIScriptController::setHardwareKeyboardAttached): 16 * TestRunnerShared/UIScriptContext/UIScriptController.h: 17 * WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig: 18 19 Additionally link against GraphicsServices in WebKitTestRunner. 20 21 * WebKitTestRunner/ios/UIScriptControllerIOS.mm: 22 (WTR::TestController::platformResetStateToConsistentValues): 23 (WTR::UIScriptController::setHardwareKeyboardAttached): 24 1 25 2019-04-12 Ludovico de Nittis <ludovico.denittis@collabora.com> 2 26 -
trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm
r244096 r244220 536 536 } 537 537 538 void UIScriptController::setHardwareKeyboardAttached(bool) 539 { 540 } 541 538 542 } 539 543 -
trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
r244096 r244220 312 312 readonly attribute boolean isWindowContentViewFirstResponder; 313 313 314 void setHardwareKeyboardAttached(boolean attached); 315 314 316 object attachmentInfo(DOMString attachmentIdentifier); 315 317 -
trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp
r244096 r244220 639 639 } 640 640 641 void UIScriptController::setHardwareKeyboardAttached(bool) 642 { 643 } 644 641 645 #endif 642 646 -
trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
r244096 r244220 241 241 JSObjectRef attachmentInfo(JSStringRef attachmentIdentifier); 242 242 243 void setHardwareKeyboardAttached(bool); 244 243 245 private: 244 246 UIScriptController(UIScriptContext&); -
trunk/Tools/WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig
r235099 r244220 31 31 GCC_ENABLE_OBJC_EXCEPTIONS = YES; 32 32 33 OTHER_LDFLAGS = $(inherited) -lWebKitTestRunner -lWebCoreTestSupport -framework JavaScriptCore -framework CoreGraphics -framework QuartzCore -framework ImageIO -framework IOKit -framework UIKit -framework WebKit -framework Foundation ;33 OTHER_LDFLAGS = $(inherited) -lWebKitTestRunner -lWebCoreTestSupport -framework JavaScriptCore -framework CoreGraphics -framework QuartzCore -framework ImageIO -framework IOKit -framework UIKit -framework WebKit -framework Foundation -framework GraphicsServices; 34 34 35 35 SKIP_INSTALL[sdk=macosx*] = YES; -
trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm
r243657 r244220 44 44 #import <WebKit/WKWebViewPrivate.h> 45 45 #import <objc/runtime.h> 46 #import <pal/spi/ios/GraphicsServicesSPI.h> 46 47 #import <wtf/MainThread.h> 47 48 … … 142 143 [[UIApplication sharedApplication] _cancelAllTouches]; 143 144 [[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait animated:NO]; 145 GSEventSetHardwareKeyboardAttached(true, 0); 144 146 145 147 m_inputModeSwizzlers.clear(); -
trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
r244096 r244220 43 43 #import <WebKit/WKWebViewPrivate.h> 44 44 #import <WebKit/WebKit.h> 45 #import <pal/spi/ios/GraphicsServicesSPI.h> 45 46 #import <wtf/SoftLinking.h> 46 47 #import <wtf/Vector.h> … … 1141 1142 } 1142 1143 1144 void UIScriptController::setHardwareKeyboardAttached(bool attached) 1145 { 1146 GSEventSetHardwareKeyboardAttached(attached, 0); 1147 } 1148 1143 1149 } 1144 1150 -
trunk/WebKitLibraries/ChangeLog
r239568 r244220 1 2019-04-12 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Software keyboard is shown too frequently on some websites 4 https://bugs.webkit.org/show_bug.cgi?id=195856 5 <rdar://problem/49191395> 6 7 Reviewed by Darin Adler. 8 9 Add a symbol for GSEventSetHardwareKeyboardAttached. 10 11 * WebKitPrivateFrameworkStubs/iOS/12/GraphicsServices.framework/GraphicsServices.tbd: 12 1 13 2019-01-01 Jeff Miller <jeffm@apple.com> 2 14 -
trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/12/GraphicsServices.framework/GraphicsServices.tbd
r238078 r244220 17 17 - _GSCurrentEventTimestamp 18 18 - _GSEventIsHardwareKeyboardAttached 19 - _GSEventSetHardwareKeyboardAttached 19 20 - _GSFontInitialize 20 21 - _GSFontPurgeFontCache
Note: See TracChangeset
for help on using the changeset viewer.