Changeset 239361 in webkit


Ignore:
Timestamp:
Dec 18, 2018 4:23:21 PM (5 years ago)
Author:
dbates@webkit.org
Message:

Wrong value for key property in keydown and keyup events generated holding Control key
https://bugs.webkit.org/show_bug.cgi?id=192788
<rdar://problem/46795214>

Reviewed by Wenson Hsieh.

Similar to what we do on Mac, compute the DOM key property from the characters ignoring
modifier keys input string when the Control key is held down.

  • platform/ios/PlatformEventFactoryIOS.mm:

(WebCore::keyForKeyEvent):

  • platform/mac/PlatformEventFactoryMac.mm:

(WebCore::keyForKeyEvent):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r239358 r239361  
     12018-12-18  Daniel Bates  <dabates@apple.com>
     2
     3        Wrong value for key property in keydown and keyup events generated holding Control key
     4        https://bugs.webkit.org/show_bug.cgi?id=192788
     5        <rdar://problem/46795214>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        Similar to what we do on Mac, compute the DOM key property from the characters ignoring
     10        modifier keys input string when the Control key is held down.
     11
     12        * platform/ios/PlatformEventFactoryIOS.mm:
     13        (WebCore::keyForKeyEvent):
     14        * platform/mac/PlatformEventFactoryMac.mm:
     15        (WebCore::keyForKeyEvent):
     16
    1172018-12-18  Sihui Liu  <sihui_liu@apple.com>
    218
  • trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm

    r237738 r239361  
    191191    }
    192192
    193     NSString *characters = event.characters;
     193    // If more than one key is being pressed and the key combination includes one or more modifier keys
     194    // that result in the key no longer producing a printable character (e.g., Control + a), then the
     195    // key value should be the printable key value that would have been produced if the key had been
     196    // typed with the default keyboard layout with no modifier keys except for Shift and AltGr applied.
     197    // See <https://www.w3.org/TR/2015/WD-uievents-20151215/#keys-guidelines>.
     198    bool isControlDown = event.modifierFlags & WebEventFlagMaskControlKey;
     199    NSString *characters = isControlDown ? event.charactersIgnoringModifiers : event.characters;
    194200    auto length = [characters length];
    195201    // characters return an empty string for dead keys.
  • trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm

    r237990 r239361  
    261261    // key value should be the printable key value that would have been produced if the key had been
    262262    // typed with the default keyboard layout with no modifier keys except for Shift and AltGr applied.
    263     // https://w3c.github.io/uievents/#keys-guidelines
     263    // See <https://www.w3.org/TR/2015/WD-uievents-20151215/#keys-guidelines>.
    264264    bool isControlDown = ([event modifierFlags] & NSEventModifierFlagControl);
    265265    NSString *s = isControlDown ? [event charactersIgnoringModifiers] : [event characters];
Note: See TracChangeset for help on using the changeset viewer.