Changeset 239277 in webkit
- Timestamp:
- Dec 17, 2018 11:19:25 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r239268 r239277 1 2018-12-17 Daniel Bates <dabates@apple.com> 2 3 Implement UIScriptController::toggleCapsLock() for iOS 4 https://bugs.webkit.org/show_bug.cgi?id=191815 5 6 Reviewed by Andy Estes. 7 8 Add iOS-specific results for some of the tests. We need to continue to skip the caps 9 lock tests on iOS until we have the fix for <rdar://problem/44930119>. 10 11 * fast/forms/password-scrolled-after-caps-lock-toggled.html: Replace input.focus() with 12 UIHelper.activateElement(input) to make it work on iOS and update logic accordingly. 13 Compensate for the fact that one less character than the size of the input is visible in 14 a password field on iOS. 15 * fast/repaint/placeholder-after-caps-lock-hidden.html: Replace input.focus() with 16 UIHelper.activateElement(input) to make it work on iOS and update logic accordingly. 17 * platform/ios-wk2/TestExpectations: 18 * platform/ios-wk2/fast/forms/password-scrolled-after-caps-lock-toggled-expected.txt: Added. 19 * platform/ios-wk2/fast/repaint/placeholder-after-caps-lock-hidden-expected.txt: Added. 20 1 21 2018-12-17 Simon Fraser <simon.fraser@apple.com> 2 22 -
trunk/LayoutTests/fast/forms/password-scrolled-after-caps-lock-toggled.html
r238522 r239277 53 53 { 54 54 debug("Case 1: Empty field:"); 55 input.focus(); 56 shouldBeZero("document.getElementById('input').scrollLeft"); 57 runNextTest(); 55 function handleFocus() { 56 shouldBeZero("document.getElementById('input').scrollLeft"); 57 runNextTest(); 58 } 59 input.addEventListener("focus", handleFocus, { once: true }); 60 if (window.testRunner) 61 UIHelper.activateElement(input); 62 else 63 input.focus(); 58 64 } 59 65 … … 91 97 } 92 98 93 let oldValue = document.getElementById( 'input').scrollLeft;99 let oldValue = document.getElementById("input").scrollLeft; 94 100 function handleCapsLockChange(event) { 95 101 console.assert(event.key === "CapsLock"); 96 callback(oldValue, document.getElementById( 'input').scrollLeft);102 callback(oldValue, document.getElementById("input").scrollLeft); 97 103 runNextTest(); 98 104 } … … 167 173 console.assert(input.hasAttribute("size")); 168 174 numberOfCharactersToOverflowFieldWhenCapsLockShown = input.size; 175 176 // FIXME: Find a way to compute the maximum number of visible characters the field can hold 177 // in a way that allows for running this test by hand. 178 let mayBeIOS = window.TouchEvent != undefined; 179 if (mayBeIOS) { 180 // The look of the password field on iOS gives less space to the value than on Mac. 181 --numberOfCharactersToOverflowFieldWhenCapsLockShown; 182 } 169 183 console.assert(numberOfCharactersToOverflowFieldWhenCapsLockShown >= 3); 170 184 -
trunk/LayoutTests/fast/repaint/placeholder-after-caps-lock-hidden.html
r238520 r239277 39 39 40 40 let input = document.getElementById("input"); 41 input.focus(); 42 43 function handleCapsLockEnabled(event) { 44 console.assert(event.key === "CapsLock"); 45 input.addEventListener("keyup", handleKeyUp, false); 46 UIHelper.keyDown("a"); 41 function handleFocus() { 42 function handleCapsLockEnabled(event) { 43 console.assert(event.key === "CapsLock"); 44 input.addEventListener("keyup", handleKeyUp, false); 45 UIHelper.keyDown("a"); 46 } 47 input.addEventListener("keydown", handleCapsLockEnabled, { once: true }); 48 UIHelper.toggleCapsLock(); 47 49 } 48 input.addEventListener(" keydown", handleCapsLockEnabled, { once: true });49 UIHelper. toggleCapsLock();50 input.addEventListener("focus", handleFocus, { once: true }); 51 UIHelper.activateElement(input); 50 52 } 51 53 </script> -
trunk/LayoutTests/platform/ios-wk2/TestExpectations
r238939 r239277 1325 1325 http/wpt/webauthn/public-key-credential-get-failure-hid.https.html [ Skip ] 1326 1326 http/wpt/webauthn/public-key-credential-get-success-hid.https.html [ Skip ] 1327 1328 # FIXME: Unskip these tests once we have the fix for <rdar://problem/44930119>. 1329 fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-after-hiding-auto-fill-strong-password-button.html [ Skip ] 1330 fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html [ Skip ] 1331 fast/forms/password-scrolled-after-caps-lock-toggled.html [ Skip ] 1332 fast/repaint/placeholder-after-caps-lock-hidden.html [ Skip ] -
trunk/Source/WebCore/PAL/ChangeLog
r239273 r239277 1 2018-12-17 Daniel Bates <dabates@apple.com> 2 3 Implement UIScriptController::toggleCapsLock() for iOS 4 https://bugs.webkit.org/show_bug.cgi?id=191815 5 6 Reviewed by Andy Estes. 7 8 Add HID usage enumerator for the Caps Lock key. 9 10 * pal/spi/cocoa/IOKitSPI.h: 11 1 12 2018-12-17 Matt Lewis <jlewis3@apple.com> 2 13 -
trunk/Source/WebCore/PAL/pal/spi/cocoa/IOKitSPI.h
r236678 r239277 184 184 kHIDUsage_KeyboardPeriod = 0x37, 185 185 kHIDUsage_KeyboardSlash = 0x38, 186 kHIDUsage_KeyboardCapsLock = 0x39, 186 187 kHIDUsage_KeyboardF1 = 0x3A, 187 188 kHIDUsage_KeyboardPrintScreen = 0x46, -
trunk/Source/WebKit/ChangeLog
r239276 r239277 1 2018-12-17 Daniel Bates <dabates@apple.com> 2 3 Implement UIScriptController::toggleCapsLock() for iOS 4 https://bugs.webkit.org/show_bug.cgi?id=191815 5 6 Reviewed by Andy Estes. 7 8 Add test infrastructure to clear the current modifier state. We will use this to ensure that 9 the caps lock state does not persist between tests. 10 11 * UIProcess/API/C/WKContext.cpp: 12 (WKContextClearCurrentModifierStateForTesting): Added. 13 * UIProcess/API/C/WKContextPrivate.h: 14 * UIProcess/WebProcessPool.cpp: 15 (WebKit::WebProcessPool::clearCurrentModifierStateForTesting): Added. 16 * UIProcess/WebProcessPool.h: 17 * WebProcess/WebProcess.cpp: 18 (WebKit::WebProcess::clearCurrentModifierStateForTesting): Added. 19 * WebProcess/WebProcess.h: 20 * WebProcess/WebProcess.messages.in: 21 1 22 2018-12-17 David Kilzer <ddkilzer@apple.com> 2 23 -
trunk/Source/WebKit/UIProcess/API/C/WKContext.cpp
r239258 r239277 650 650 WebKit::toImpl(contextRef)->setIDBPerOriginQuota(quota); 651 651 } 652 653 void WKContextClearCurrentModifierStateForTesting(WKContextRef contextRef) 654 { 655 toImpl(contextRef)->clearCurrentModifierStateForTesting(); 656 } -
trunk/Source/WebKit/UIProcess/API/C/WKContextPrivate.h
r237700 r239277 119 119 WK_EXPORT void WKContextSetIDBPerOriginQuota(WKContextRef context, uint64_t quota); 120 120 121 WK_EXPORT void WKContextClearCurrentModifierStateForTesting(WKContextRef context); 122 121 123 #ifdef __cplusplus 122 124 } -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r239273 r239277 2359 2359 } 2360 2360 2361 void WebProcessPool::clearCurrentModifierStateForTesting() 2362 { 2363 sendToAllProcesses(Messages::WebProcess::ClearCurrentModifierStateForTesting()); 2364 } 2365 2361 2366 } // namespace WebKit -
trunk/Source/WebKit/UIProcess/WebProcessPool.h
r239080 r239277 468 468 469 469 void sendDisplayConfigurationChangedMessageForTesting(); 470 void clearCurrentModifierStateForTesting(); 470 471 471 472 #if PLATFORM(GTK) || PLATFORM(WPE) -
trunk/Source/WebKit/WebProcess/WebProcess.cpp
r238867 r239277 105 105 #include <WebCore/PageCache.h> 106 106 #include <WebCore/PageGroup.h> 107 #include <WebCore/PlatformKeyboardEvent.h> 107 108 #include <WebCore/PlatformMediaSessionManager.h> 108 109 #include <WebCore/ProcessWarming.h> … … 1762 1763 #endif 1763 1764 1765 void WebProcess::clearCurrentModifierStateForTesting() 1766 { 1767 PlatformKeyboardEvent::setCurrentModifierState({ }); 1768 } 1769 1764 1770 } // namespace WebKit -
trunk/Source/WebKit/WebProcess/WebProcess.h
r238867 r239277 400 400 #endif 401 401 402 void clearCurrentModifierStateForTesting(); 403 402 404 RefPtr<WebConnectionToUIProcess> m_webConnection; 403 405 -
trunk/Source/WebKit/WebProcess/WebProcess.messages.in
r238593 r239277 154 154 ResetMockMediaDevices(); 155 155 #endif 156 157 ClearCurrentModifierStateForTesting() 156 158 } -
trunk/Tools/ChangeLog
r239275 r239277 1 2018-12-17 Daniel Bates <dabates@apple.com> 2 3 Implement UIScriptController::toggleCapsLock() for iOS 4 https://bugs.webkit.org/show_bug.cgi?id=191815 5 6 Reviewed by Andy Estes. 7 8 Add support for toggling the caps lock state in WebKitTestRunner on iOS. 9 10 * TestRunnerShared/UIScriptContext/UIScriptController.h: 11 * WebKitTestRunner/TestController.cpp: 12 (WTR::TestController::resetStateToConsistentValues): Clear the current modifier state 13 before running a test. This ensures that the caps lock state does not persist between 14 tests should a test enable caps lock and not disable it. 15 * WebKitTestRunner/ios/HIDEventGenerator.mm: 16 (hidUsageCodeForCharacter): Map "capsLock" to the Caps Lock key usage code. 17 * WebKitTestRunner/ios/UIScriptControllerIOS.mm: 18 (WTR::createUIPhysicalKeyboardEvent): Modified to take the keyboard input flags to use to 19 create the event. Also substituted NSString* for const String& as the data type for the first 20 two parameters to avoid conversions in the implementation of UIScriptController::toggleCapsLock() 21 below. 22 (WTR::UIScriptController::keyDown): Update as needed due to changes to prototype of createUIPhysicalKeyboardEvent(). 23 (WTR::UIScriptController::toggleCapsLock): Dispatch a UIEvent to toggle caps lock. 24 1 25 2018-12-17 Daniel Bates <dabates@apple.com> 2 26 -
trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
r238939 r239277 229 229 UIScriptContext* m_context; 230 230 231 #if PLATFORM( MAC)231 #if PLATFORM(COCOA) 232 232 bool m_capsLockOn { false }; 233 233 #endif -
trunk/Tools/WebKitTestRunner/TestController.cpp
r239273 r239277 873 873 WKContextSetAllowsAnySSLCertificateForServiceWorkerTesting(platformContext(), true); 874 874 875 WKContextClearCurrentModifierStateForTesting(TestController::singleton().context()); 876 875 877 // FIXME: This function should also ensure that there is only one page open. 876 878 -
trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm
r238526 r239277 926 926 return *keyCode; 927 927 928 if ([key isEqualToString:@"capsLock"]) 929 return kHIDUsage_KeyboardCapsLock; 928 930 if ([key isEqualToString:@"pageUp"]) 929 931 return kHIDUsage_KeyboardPageUp; -
trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
r238939 r239277 401 401 } 402 402 403 static UIPhysicalKeyboardEvent *createUIPhysicalKeyboardEvent( const String& hidInputString, const String& uiEventInputString, UIKeyModifierFlags modifierFlags, bool isKeyDown)404 { 405 auto* keyboardEvent = [getUIPhysicalKeyboardEventClass() _eventWithInput:uiEventInputString inputFlags: (UIKeyboardInputFlags)0];403 static UIPhysicalKeyboardEvent *createUIPhysicalKeyboardEvent(NSString *hidInputString, NSString *uiEventInputString, UIKeyModifierFlags modifierFlags, UIKeyboardInputFlags inputFlags, bool isKeyDown) 404 { 405 auto* keyboardEvent = [getUIPhysicalKeyboardEventClass() _eventWithInput:uiEventInputString inputFlags:inputFlags]; 406 406 keyboardEvent._modifierFlags = modifierFlags; 407 407 auto hidEvent = createHIDKeyEvent(hidInputString, keyboardEvent.timestamp, isKeyDown); … … 423 423 String uiEventInputString = inputString.length() > 1 ? emptyString() : inputString; 424 424 auto modifierFlags = parseModifierArray(m_context->jsContext(), modifierArray); 425 UIKeyboardInputFlags inputFlags = static_cast<UIKeyboardInputFlags>(0); 425 426 426 427 // Note that UIKit will call -release on the passed UIPhysicalKeyboardEvent. 427 428 428 429 // Key down 429 auto* keyboardEvent = createUIPhysicalKeyboardEvent(inputString, uiEventInputString, modifierFlags, true /* isKeyDown */);430 auto* keyboardEvent = createUIPhysicalKeyboardEvent(inputString, uiEventInputString, modifierFlags, inputFlags, true /* isKeyDown */); 430 431 [[UIApplication sharedApplication] handleKeyUIEvent:keyboardEvent]; 431 432 432 433 // Key up 433 keyboardEvent = createUIPhysicalKeyboardEvent(inputString, uiEventInputString, modifierFlags, false /* isKeyDown */);434 keyboardEvent = createUIPhysicalKeyboardEvent(inputString, uiEventInputString, modifierFlags, inputFlags, false /* isKeyDown */); 434 435 [[UIApplication sharedApplication] handleKeyUIEvent:keyboardEvent]; 435 436 } … … 933 934 void UIScriptController::toggleCapsLock(JSValueRef callback) 934 935 { 935 // FIXME: Implement for iOS. See <https://bugs.webkit.org/show_bug.cgi?id=191815>. 936 m_capsLockOn = !m_capsLockOn; 937 auto *keyboardEvent = createUIPhysicalKeyboardEvent(@"capsLock", [NSString string], m_capsLockOn ? UIKeyModifierAlphaShift : 0, 938 kUIKeyboardInputModifierFlagsChanged, m_capsLockOn); 939 [[UIApplication sharedApplication] handleKeyUIEvent:keyboardEvent]; 936 940 doAsyncTask(callback); 937 941 }
Note: See TracChangeset
for help on using the changeset viewer.