Changeset 238526 in webkit
- Timestamp:
- Nov 26, 2018 2:57:44 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r238524 r238526 1 2018-11-26 Daniel Bates <dabates@apple.com> 2 3 REGRESSION (r237738): Command Down Arrow doesn't scroll to the end of a page anymore 4 https://bugs.webkit.org/show_bug.cgi?id=191967 5 <rdar://problem/45976390> 6 7 Reviewed by Tim Horton. 8 9 Add tests to ensure that Command + Down Arrow and Command + Up Arrow scroll to the end of 10 the page and the top of the page, respectively. 11 12 * fast/scrolling/ios/key-command-scroll-to-bottom-expected.html: Added. 13 * fast/scrolling/ios/key-command-scroll-to-bottom.html: Added. 14 * fast/scrolling/ios/key-command-scroll-to-top-expected.html: Added. 15 * fast/scrolling/ios/key-command-scroll-to-top.html: Added. 16 * resources/ui-helper.js: 17 (window.UIHelper.keyDown): Pass the modifiers array to EventSender.keyDown() to make 18 this function work on Mac. 19 1 20 2018-11-24 Ryosuke Niwa <rniwa@webkit.org> 2 21 -
trunk/LayoutTests/resources/ui-helper.js
r238512 r238526 58 58 { 59 59 if (!this.isWebKit2() || !this.isIOS()) { 60 eventSender.keyDown(key );60 eventSender.keyDown(key, modifiers); 61 61 return Promise.resolve(); 62 62 } -
trunk/Source/WebKit/ChangeLog
r238525 r238526 1 2018-11-26 Daniel Bates <dabates@apple.com> 2 3 REGRESSION (r237738): Command Down Arrow doesn't scroll to the end of a page anymore 4 https://bugs.webkit.org/show_bug.cgi?id=191967 5 <rdar://problem/45976390> 6 7 Reviewed by Tim Horton. 8 9 Fixes an issue where pressing Command + Down Arrow does not scroll the view to the end of the page. 10 11 Following r237738 the value of the enumerations used to identify modifier keys (e.g. Shift) changed 12 to match the values of the corresponding enumerations in GraphicsServices, which are the 13 enumerations UIKit uses to computes the modifier flags bitmask when instantiating a WebEvent to 14 pass to WebKit. Before r237738 WebKit was using enumerations whose values matched the values 15 of the corresponding UIKit public API UIKeyModifier* enumerations. For non-content editable elements, 16 WebKit intercepts UIKit events in -_handleKeyUIEvent, synthesizes and dispatches its own WebEvent. 17 However it was creating WebEvents with a modifier flags bitmask built from the UIKeyModifier* enumerations, 18 -_modifierFlags, as opposed to a bitmask from the GraphicsServices enumerations, -_gsModifierFlags. 19 Instead WebKit should call -_gsModifierFlags to compute the GraphicsServices-compatible modifier 20 flags bitmask when instantiating a WebEvent. 21 22 * Platform/spi/ios/UIKitSPI.h: Expose -_gsModifierFlags and remove -_modifierFlags. 23 * UIProcess/ios/WKContentViewInteraction.mm: 24 (-[WKContentView _handleKeyUIEvent:]): Remove unnecessary code to update the current modifier state. 25 This will be done by the WebProcess when it receives the keyboard event. 26 (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): Do not pass modifier flags changed events 27 to the scrolling animator as it does not know how to handle these kinds of events and triggers an 28 assertion failure when it tries to read the input string from the event (calls -charactersIgnoringModifiers). 29 FlagsChanged WebEvents events do not have an input string just like a FlagsChanged NSEvent that 30 they model on Mac. 31 * UIProcess/ios/WKWebEvent.mm: 32 (-[WKWebEvent initWithEvent:]): Pass the value of -_gsModifierFlags for the modifier flags bitmask 33 instead of the value of -_modifierFlags. 34 1 35 2018-11-26 Chris Dumez <cdumez@apple.com> 2 36 -
trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h
r238360 r238526 200 200 - (NSString *)_unmodifiedInput; 201 201 - (NSString *)_modifiedInput; 202 - (NSInteger)_modifierFlags;203 202 - (BOOL)_isKeyDown; 204 203 @end … … 1027 1026 @property (nonatomic, readonly) UIKeyboardInputFlags _inputFlags; 1028 1027 @property (nonatomic, readonly) CFIndex _keyCode; 1028 @property (nonatomic, readonly) NSInteger _gsModifierFlags; 1029 1029 @end 1030 1030 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r238475 r238526 3843 3843 { 3844 3844 bool isHardwareKeyboardEvent = !!event._hidEvent; 3845 if (isHardwareKeyboardEvent && ((UIPhysicalKeyboardEvent *)event)._inputFlags & kUIKeyboardInputModifierFlagsChanged)3846 _page->updateCurrentModifierState();3847 3845 3848 3846 // We only want to handle key event from the hardware keyboard when we are … … 3880 3878 - (void)_didHandleKeyEvent:(::WebEvent *)event eventWasHandled:(BOOL)eventWasHandled 3881 3879 { 3882 [_keyboardScrollingAnimator handleKeyEvent:event]; 3880 if (!(event.keyboardFlags & WebEventKeyboardInputModifierFlagsChanged)) 3881 [_keyboardScrollingAnimator handleKeyEvent:event]; 3883 3882 3884 3883 if (auto handler = WTFMove(_keyWebEventHandler)) { -
trunk/Source/WebKit/UIProcess/ios/WKWebEvent.mm
r237266 r238526 40 40 uint16_t keyCode; 41 41 UIKeyboardInputFlags inputFlags; 42 NSInteger modifierFlags; 42 43 BOOL isHardwareKeyboardEvent = !!event._hidEvent; 43 44 if (!isHardwareKeyboardEvent) { 44 45 keyCode = 0; 45 46 inputFlags = (UIKeyboardInputFlags)0; 47 modifierFlags = 0; 46 48 } else { 47 49 UIPhysicalKeyboardEvent *keyEvent = (UIPhysicalKeyboardEvent *)event; 48 50 keyCode = keyEvent._keyCode; 49 51 inputFlags = keyEvent._inputFlags; 52 modifierFlags = keyEvent._gsModifierFlags; 50 53 event = [[keyEvent _cloneEvent] autorelease]; // UIKit uses a singleton for hardware keyboard events. 51 54 } 52 55 53 self = [super initWithKeyEventType:(event._isKeyDown ? WebEventKeyDown : WebEventKeyUp) timeStamp:event.timestamp characters:event._modifiedInput charactersIgnoringModifiers:event._unmodifiedInput modifiers: event._modifierFlags isRepeating:(inputFlags & kUIKeyboardInputRepeat) withFlags:inputFlags keyCode:keyCode isTabKey:[event._modifiedInput isEqualToString:@"\t"] characterSet:WebEventCharacterSetUnicode];56 self = [super initWithKeyEventType:(event._isKeyDown ? WebEventKeyDown : WebEventKeyUp) timeStamp:event.timestamp characters:event._modifiedInput charactersIgnoringModifiers:event._unmodifiedInput modifiers:modifierFlags isRepeating:(inputFlags & kUIKeyboardInputRepeat) withFlags:inputFlags keyCode:keyCode isTabKey:[event._modifiedInput isEqualToString:@"\t"] characterSet:WebEventCharacterSetUnicode]; 54 57 if (!self) 55 58 return nil; -
trunk/Tools/ChangeLog
r238518 r238526 1 2018-11-26 Daniel Bates <dabates@apple.com> 2 3 REGRESSION (r237738): Command Down Arrow doesn't scroll to the end of a page anymore 4 https://bugs.webkit.org/show_bug.cgi?id=191967 5 <rdar://problem/45976390> 6 7 Reviewed by Tim Horton. 8 9 Add more test infrastructure to dispatch key up events. 10 11 * WebKitTestRunner/ios/HIDEventGenerator.h: 12 * WebKitTestRunner/ios/HIDEventGenerator.mm: 13 (createHIDKeyEvent): Renamed from createHIDKeyDownEvent() and modified to take a boolean as 14 to whether to create an event for a key down or key up. 15 (createHIDKeyDownEvent): Deleted; renamed to createHIDKeyEvent(). 16 * WebKitTestRunner/ios/UIScriptControllerIOS.mm: 17 (WTR::createUIPhysicalKeyboardEvent): Added. Convenience function to create a UIPhysicalKeyboardEvent. 18 (WTR::UIScriptController::keyDown): Modified to dispatch a key up event in addition to dispatching 19 a key down event. 20 1 21 2018-11-26 Aakash Jain <aakash_jain@apple.com> 2 22 -
trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.h
r238235 r238526 70 70 extern NSUInteger const HIDMaxTouchCount; 71 71 72 RetainPtr<IOHIDEventRef> createHIDKey DownEvent(NSString *, uint64_t timestamp);72 RetainPtr<IOHIDEventRef> createHIDKeyEvent(NSString *, uint64_t timestamp, bool isKeyDown); 73 73 74 74 @interface HIDEventGenerator : NSObject -
trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm
r238235 r238526 974 974 } 975 975 976 RetainPtr<IOHIDEventRef> createHIDKey DownEvent(NSString *character, uint64_t timestamp)977 { 978 return adoptCF(IOHIDEventCreateKeyboardEvent(kCFAllocatorDefault, timestamp, kHIDPage_KeyboardOrKeypad, hidUsageCodeForCharacter(character), true /* key down */, kIOHIDEventOptionNone));976 RetainPtr<IOHIDEventRef> createHIDKeyEvent(NSString *character, uint64_t timestamp, bool isKeyDown) 977 { 978 return adoptCF(IOHIDEventCreateKeyboardEvent(kCFAllocatorDefault, timestamp, kHIDPage_KeyboardOrKeypad, hidUsageCodeForCharacter(character), isKeyDown, kIOHIDEventOptionNone)); 979 979 } 980 980 -
trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
r238512 r238526 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]; 406 keyboardEvent._modifierFlags = modifierFlags; 407 auto hidEvent = createHIDKeyEvent(hidInputString, keyboardEvent.timestamp, isKeyDown); 408 [keyboardEvent _setHIDEvent:hidEvent.get() keyboard:nullptr]; 409 return keyboardEvent; 410 } 411 403 412 void UIScriptController::keyDown(JSStringRef character, JSValueRef modifierArray) 404 413 { … … 413 422 String inputString = toWTFString(toWK(character)); 414 423 String uiEventInputString = inputString.length() > 1 ? emptyString() : inputString; 415 auto *keyboardEvent = [getUIPhysicalKeyboardEventClass() _eventWithInput:uiEventInputString inputFlags:(UIKeyboardInputFlags)0]; 416 keyboardEvent._modifierFlags = parseModifierArray(m_context->jsContext(), modifierArray); 417 auto hidEvent = createHIDKeyDownEvent(inputString, keyboardEvent.timestamp); 418 [keyboardEvent _setHIDEvent:hidEvent.get() keyboard:nullptr]; 424 auto modifierFlags = parseModifierArray(m_context->jsContext(), modifierArray); 425 426 // Note that UIKit will call -release on the passed UIPhysicalKeyboardEvent. 427 428 // Key down 429 auto* keyboardEvent = createUIPhysicalKeyboardEvent(inputString, uiEventInputString, modifierFlags, true /* isKeyDown */); 430 [[UIApplication sharedApplication] handleKeyUIEvent:keyboardEvent]; 431 432 // Key up 433 keyboardEvent = createUIPhysicalKeyboardEvent(inputString, uiEventInputString, modifierFlags, false /* isKeyDown */); 419 434 [[UIApplication sharedApplication] handleKeyUIEvent:keyboardEvent]; 420 435 }
Note: See TracChangeset
for help on using the changeset viewer.