Changeset 236669 in webkit
- Timestamp:
- Oct 1, 2018 10:41:25 AM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r236665 r236669 1 2018-10-01 Daniel Bates <dabates@apple.com> 2 3 [iOS] Wrong key event may be sent to UIKit 4 https://bugs.webkit.org/show_bug.cgi?id=189992 5 6 Reviewed by Simon Fraser. 7 8 Retain a clone of a received UIEvent if it is for a hardware key event so as to ensure that we 9 notify the UIKit keyboard code of the correct keyboard event. 10 11 Currently the UIProcess retains the UIEvent associated with a keyboard event so as to defer 12 notifying the UIKit keyboard code (via -_handleKeyUIEvent) about a received keyboard event until 13 after the WebProcess has processed the raw key event. If this UIEvent is for a hardware keyboard 14 event then it is not sufficient to retain it to preserve its value because UIKit uses a singleton 15 UIEvent for all hardware keyboard events ;=> its value will be clobbered as each hardware keyboard 16 event is received. Instead we need to explicitly clone a UIEvent for a hardware key event before 17 retaining it. 18 19 * Platform/spi/ios/UIKitSPI.h: Forward declare SPI. 20 * UIProcess/ios/WKContentViewInteraction.mm: 21 (-[WKContentView handleKeyEvent:]): Clone the UIEvent if it is for a hardware key event. 22 1 23 2018-10-01 Alex Christensen <achristensen@webkit.org> 2 24 -
trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h
r236619 r236669 1004 1004 1005 1005 @interface UIPhysicalKeyboardEvent () 1006 - (UIPhysicalKeyboardEvent *)_cloneEvent NS_RETURNS_RETAINED; 1006 1007 @property (nonatomic, readonly) CFIndex _keyCode; 1007 1008 @end -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r236619 r236669 3746 3746 return; 3747 3747 3748 uint16_t keyCode; 3749 BOOL isHardwareKeyboardEvent = !!event._hidEvent; 3750 if (!isHardwareKeyboardEvent) 3751 keyCode = 0; 3752 else { 3753 UIPhysicalKeyboardEvent *keyEvent = (UIPhysicalKeyboardEvent *)event; 3754 keyCode = keyEvent._keyCode; 3755 event = [[keyEvent _cloneEvent] autorelease]; // UIKit uses a singleton for hardware keyboard events. 3756 } 3748 3757 WKWebEvent *webEvent = [[[WKWebEvent alloc] initWithKeyEventType:(event._isKeyDown) ? WebEventKeyDown : WebEventKeyUp 3749 3758 timeStamp:event.timestamp … … 3753 3762 isRepeating:(event._inputFlags & kUIKeyboardInputRepeat) 3754 3763 withFlags:event._inputFlags 3755 keyCode: event._hidEvent ? ((UIPhysicalKeyboardEvent *)event)._keyCode : 03764 keyCode:keyCode 3756 3765 isTabKey:[event._modifiedInput isEqualToString:@"\t"] 3757 3766 characterSet:WebEventCharacterSetUnicode] autorelease];
Note: See TracChangeset
for help on using the changeset viewer.