Changeset 206828 in webkit


Ignore:
Timestamp:
Oct 5, 2016 2:12:51 PM (7 years ago)
Author:
Chris Dumez
Message:

KeyboardEvent.getModifierState() should support "CapsLock" modifier
https://bugs.webkit.org/show_bug.cgi?id=162861

Reviewed by Darin Adler.

Source/WebCore:

Add support for "CapsLock" modifier on Mac / iOS for KeyboardEvent's
getModifierState() API, as per:

No new tests, updated existing test.

  • dom/KeyboardEvent.cpp:

(WebCore::KeyboardEvent::KeyboardEvent):
(WebCore::KeyboardEvent::getModifierState):

  • dom/KeyboardEvent.h:
  • platform/PlatformEvent.h:
  • platform/ios/PlatformEventFactoryIOS.mm:

(WebCore::modifiersForEvent):

  • platform/mac/PlatformEventFactoryMac.mm:

(WebCore::keyIdentifierForKeyEvent):

Source/WebKit2:

Add support for CapsLock modifier on events.

  • Shared/API/c/WKEvent.h:
  • Shared/API/c/WKSharedAPICast.h:

(WebKit::toAPI):

  • Shared/WebEventConversion.cpp:

(WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
(WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
(WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
(WebKit::WebKit2PlatformTouchEvent::WebKit2PlatformTouchEvent):
(WebKit::WebKit2PlatformGestureEvent::WebKit2PlatformGestureEvent):

  • Shared/efl/WebEventFactory.cpp:

(WebKit::toWebEventModifiers):

  • Shared/ios/WebIOSEventFactory.mm:

(modifiersForEvent):

  • Shared/mac/WebEventFactory.mm:

(WebKit::modifiersForEvent):

  • UIProcess/API/Cocoa/WKNavigationAction.mm:

(toNSEventModifierFlags):

  • UIProcess/Cocoa/WebAutomationSessionCocoa.mm:

(WebKit::WebAutomationSession::platformSimulateMouseInteraction):

Tools:

Add support for 'capsLockKey' modifier for EventSender.keyDown() so
that we can test this new modifier support for layout tests.

  • TestWebKitAPI/mac/PlatformWebViewMac.mm:

(TestWebKitAPI::modifierFlagsForWKModifiers):

  • WebKitTestRunner/InjectedBundle/EventSendingController.cpp:

(WTR::parseModifier):

  • WebKitTestRunner/mac/EventSenderProxy.mm:

(WTR::buildModifierFlags):

LayoutTests:

Extend layout test coverage to cover 'Caps Lock' modifier.

  • fast/events/special-key-events-in-input-text-expected.txt:
  • fast/events/special-key-events-in-input-text.html:
Location:
trunk
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r206821 r206828  
     12016-10-05  Chris Dumez  <cdumez@apple.com>
     2
     3        KeyboardEvent.getModifierState() should support "CapsLock" modifier
     4        https://bugs.webkit.org/show_bug.cgi?id=162861
     5
     6        Reviewed by Darin Adler.
     7
     8        Extend layout test coverage to cover 'Caps Lock' modifier.
     9
     10        * fast/events/special-key-events-in-input-text-expected.txt:
     11        * fast/events/special-key-events-in-input-text.html:
     12
    1132016-10-05  Zalan Bujtas  <zalan@apple.com>
    214
  • trunk/LayoutTests/fast/events/special-key-events-in-input-text-expected.txt

    r206803 r206828  
    22
    33
    4 target - type - ctrlKey,altKey,shiftKey,metaKey - key - code - keyIdentifier - keyCode - charCode
     4target - type - ctrlKey,altKey,shiftKey,metaKey,capsLockKey - key - code - keyIdentifier - keyCode - charCode
    55
    66Ampersand:
    7 INPUT - keydown - false,false,true,false - 7 - Digit7 - U+0037 - 55 - 0. Value: "".
    8 INPUT - keypress - false,false,true,false - 7 - Digit7 - - 55 - 55. Value: "".
     7INPUT - keydown - false,false,true,false,false - 7 - Digit7 - U+0037 - 55 - 0. Value: "".
     8INPUT - keypress - false,false,true,false,false - 7 - Digit7 - - 55 - 55. Value: "".
    99INPUT - textInput - 7. Value: "".
    10 INPUT - keyup - false,false,true,false - 7 - Digit7 - U+0037 - 55 - 0. Value: "7".
     10INPUT - keyup - false,false,true,false,false - 7 - Digit7 - U+0037 - 55 - 0. Value: "7".
    1111
    1212Backspace:
    13 INPUT - keydown - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: "7".
    14 INPUT - keyup - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: "".
     13INPUT - keydown - false,false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: "7".
     14INPUT - keyup - false,false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: "".
    1515
    1616Percent:
    17 INPUT - keydown - false,false,true,false - 5 - Digit5 - U+0035 - 53 - 0. Value: "".
    18 INPUT - keypress - false,false,true,false - 5 - Digit5 - - 53 - 53. Value: "".
     17INPUT - keydown - false,false,true,false,false - 5 - Digit5 - U+0035 - 53 - 0. Value: "".
     18INPUT - keypress - false,false,true,false,false - 5 - Digit5 - - 53 - 53. Value: "".
    1919INPUT - textInput - 5. Value: "".
    20 INPUT - keyup - false,false,true,false - 5 - Digit5 - U+0035 - 53 - 0. Value: "5".
     20INPUT - keyup - false,false,true,false,false - 5 - Digit5 - U+0035 - 53 - 0. Value: "5".
    2121
    2222Backspace:
    23 INPUT - keydown - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: "5".
    24 INPUT - keyup - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: "".
     23INPUT - keydown - false,false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: "5".
     24INPUT - keyup - false,false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: "".
    2525
    2626Left parenthesis:
    27 INPUT - keydown - false,false,true,false - 9 - Digit9 - U+0039 - 57 - 0. Value: "".
    28 INPUT - keypress - false,false,true,false - 9 - Digit9 - - 57 - 57. Value: "".
     27INPUT - keydown - false,false,true,false,false - 9 - Digit9 - U+0039 - 57 - 0. Value: "".
     28INPUT - keypress - false,false,true,false,false - 9 - Digit9 - - 57 - 57. Value: "".
    2929INPUT - textInput - 9. Value: "".
    30 INPUT - keyup - false,false,true,false - 9 - Digit9 - U+0039 - 57 - 0. Value: "9".
     30INPUT - keyup - false,false,true,false,false - 9 - Digit9 - U+0039 - 57 - 0. Value: "9".
    3131
    3232Backspace:
    33 INPUT - keydown - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: "9".
    34 INPUT - keyup - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: "".
     33INPUT - keydown - false,false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: "9".
     34INPUT - keyup - false,false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: "".
    3535
    3636Right parenthesis:
    37 INPUT - keydown - false,false,true,false - 0 - Digit0 - U+0030 - 48 - 0. Value: "".
    38 INPUT - keypress - false,false,true,false - 0 - Digit0 - - 48 - 48. Value: "".
     37INPUT - keydown - false,false,true,false,false - 0 - Digit0 - U+0030 - 48 - 0. Value: "".
     38INPUT - keypress - false,false,true,false,false - 0 - Digit0 - - 48 - 48. Value: "".
    3939INPUT - textInput - 0. Value: "".
    40 INPUT - keyup - false,false,true,false - 0 - Digit0 - U+0030 - 48 - 0. Value: "0".
     40INPUT - keyup - false,false,true,false,false - 0 - Digit0 - U+0030 - 48 - 0. Value: "0".
    4141
    4242Backspace:
    43 INPUT - keydown - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: "0".
    44 INPUT - keyup - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: "".
     43INPUT - keydown - false,false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: "0".
     44INPUT - keyup - false,false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: "".
    4545
    4646Print screen:
    47 INPUT - keydown - false,false,false,false - PrintScreen - KeyA - PrintScreen - 44 - 0. Value: "".
    48 INPUT - keyup - false,false,false,false - PrintScreen - KeyA - PrintScreen - 44 - 0. Value: "".
     47INPUT - keydown - false,false,false,false,false - PrintScreen - KeyA - PrintScreen - 44 - 0. Value: "".
     48INPUT - keyup - false,false,false,false,false - PrintScreen - KeyA - PrintScreen - 44 - 0. Value: "".
    4949
     50'a' key with Caps Lock:
     51INPUT - keydown - false,false,false,false,true - a - KeyA - U+0041 - 65 - 0. Value: "".
     52INPUT - keypress - false,false,false,false,true - a - KeyA - - 97 - 97. Value: "".
     53INPUT - textInput - a. Value: "".
     54INPUT - keyup - false,false,false,false,true - a - KeyA - U+0041 - 65 - 0. Value: "a".
     55
  • trunk/LayoutTests/fast/events/special-key-events-in-input-text.html

    r206803 r206828  
    1818     info += e.data;
    1919   } else if (type == "keydown" || type == "keypress" || type == "keyup") {
    20      info += [e.ctrlKey, e.altKey, e.shiftKey, e.metaKey] +
     20     info += [e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.getModifierState('CapsLock')] +
    2121         ' - ' + e.key +
    2222         ' - ' + e.code +
     
    2929}
    3030
    31 log("target - type - " + ["ctrlKey", "altKey", "shiftKey", "metaKey"]
     31log("target - type - " + ["ctrlKey", "altKey", "shiftKey", "metaKey", "capsLockKey"]
    3232       + ' - ' + "key"
    3333       + ' - ' + "code"
     
    6363   log("<br>Print screen:");
    6464   eventSender.keyDown("printScreen", []);
     65   log("<br>'a' key with Caps Lock:");
     66   eventSender.keyDown("a", ["capsLockKey"]);
    6567  }
    6668</script>
  • trunk/Source/WebCore/ChangeLog

    r206826 r206828  
     12016-10-05  Chris Dumez  <cdumez@apple.com>
     2
     3        KeyboardEvent.getModifierState() should support "CapsLock" modifier
     4        https://bugs.webkit.org/show_bug.cgi?id=162861
     5
     6        Reviewed by Darin Adler.
     7
     8        Add support for "CapsLock" modifier on Mac / iOS for KeyboardEvent's
     9        getModifierState() API, as per:
     10        - https://w3c.github.io/uievents/#dom-keyboardevent-getmodifierstate
     11
     12        No new tests, updated existing test.
     13
     14        * dom/KeyboardEvent.cpp:
     15        (WebCore::KeyboardEvent::KeyboardEvent):
     16        (WebCore::KeyboardEvent::getModifierState):
     17        * dom/KeyboardEvent.h:
     18        * platform/PlatformEvent.h:
     19        * platform/ios/PlatformEventFactoryIOS.mm:
     20        (WebCore::modifiersForEvent):
     21        * platform/mac/PlatformEventFactoryMac.mm:
     22        (WebCore::keyIdentifierForKeyEvent):
     23
    1242016-10-05  Michael Catanzaro  <mcatanzaro@igalia.com>
    225
  • trunk/Source/WebCore/dom/KeyboardEvent.cpp

    r206803 r206828  
    109109    , m_repeat(key.isAutoRepeat())
    110110    , m_altGraphKey(false)
     111    , m_capsLockKey(key.modifiers().contains(PlatformEvent::Modifier::CapsLockKey))
    111112    , m_isComposing(view && view->frame() && view->frame()->editor().hasComposition())
    112113#if PLATFORM(COCOA)
     
    138139    , m_location(initializer.location)
    139140    , m_repeat(initializer.repeat)
    140     , m_altGraphKey(false)
     141    , m_altGraphKey(false) // FIXME: should be initialized from initializer.modifierAltGraph.
     142    , m_capsLockKey(false) // FIXME: should be initialized from initializer.modifierCapsLock.
    141143    , m_isComposing(initializer.isComposing)
    142144#if PLATFORM(COCOA)
     
    180182    if (keyIdentifier == "AltGraph")
    181183        return altGraphKey();
    182     // FIXME: We should support CapsLock, Fn, FnLock, Hyper, NumLock, Super, ScrollLock, Symbol, SymbolLock.
     184    if (keyIdentifier == "CapsLock")
     185        return m_capsLockKey;
     186    // FIXME: The specification also has Fn, FnLock, Hyper, NumLock, Super, ScrollLock, Symbol, SymbolLock.
    183187    return false;
    184188}
  • trunk/Source/WebCore/dom/KeyboardEvent.h

    r206803 r206828  
    137137    bool m_repeat { false };
    138138    bool m_altGraphKey { false };
     139    bool m_capsLockKey { false };
    139140    bool m_isComposing { false };
    140141
  • trunk/Source/WebCore/platform/PlatformEvent.h

    r206450 r206828  
    7575        MetaKey     = 1 << 2,
    7676        ShiftKey    = 1 << 3,
     77        CapsLockKey = 1 << 4,
    7778    };
    7879
  • trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm

    r206750 r206828  
    4848    if (event.modifierFlags & WebEventFlagMaskCommand)
    4949        modifiers |= PlatformEvent::Modifier::MetaKey;
     50    if (event.modifierFlags & WebEventFlagMaskAlphaShift)
     51        modifiers |= PlatformEvent::Modifier::CapsLockKey;
    5052
    5153    return modifiers;
  • trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm

    r206803 r206828  
    691691static inline OptionSet<PlatformEvent::Modifier> modifiersForEvent(NSEvent *event)
    692692{
    693 #pragma clang diagnostic push
    694 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
    695693    OptionSet<PlatformEvent::Modifier> modifiers;
     694
     695#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
     696    if (event.modifierFlags & NSEventModifierFlagShift)
     697        modifiers |= PlatformEvent::Modifier::ShiftKey;
     698    if (event.modifierFlags & NSEventModifierFlagControl)
     699        modifiers |= PlatformEvent::Modifier::CtrlKey;
     700    if (event.modifierFlags & NSEventModifierFlagOption)
     701        modifiers |= PlatformEvent::Modifier::AltKey;
     702    if (event.modifierFlags & NSEventModifierFlagCommand)
     703        modifiers |= PlatformEvent::Modifier::MetaKey;
     704    if (event.modifierFlags & NSEventModifierFlagCapsLock)
     705        modifiers |= PlatformEvent::Modifier::CapsLockKey;
     706#else
    696707    if (event.modifierFlags & NSShiftKeyMask)
    697708        modifiers |= PlatformEvent::Modifier::ShiftKey;
     
    702713    if (event.modifierFlags & NSCommandKeyMask)
    703714        modifiers |= PlatformEvent::Modifier::MetaKey;
    704 #pragma clang diagnostic pop
     715    if (event.modifierFlags & NSAlphaShiftKeyMask)
     716        modifiers |= PlatformEvent::Modifier::CapsLockKey;
     717#endif
     718
    705719    return modifiers;
    706720}
  • trunk/Source/WebKit2/ChangeLog

    r206811 r206828  
     12016-10-05  Chris Dumez  <cdumez@apple.com>
     2
     3        KeyboardEvent.getModifierState() should support "CapsLock" modifier
     4        https://bugs.webkit.org/show_bug.cgi?id=162861
     5
     6        Reviewed by Darin Adler.
     7
     8        Add support for CapsLock modifier on events.
     9
     10        * Shared/API/c/WKEvent.h:
     11        * Shared/API/c/WKSharedAPICast.h:
     12        (WebKit::toAPI):
     13        * Shared/WebEventConversion.cpp:
     14        (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
     15        (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
     16        (WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
     17        (WebKit::WebKit2PlatformTouchEvent::WebKit2PlatformTouchEvent):
     18        (WebKit::WebKit2PlatformGestureEvent::WebKit2PlatformGestureEvent):
     19        * Shared/efl/WebEventFactory.cpp:
     20        (WebKit::toWebEventModifiers):
     21        * Shared/ios/WebIOSEventFactory.mm:
     22        (modifiersForEvent):
     23        * Shared/mac/WebEventFactory.mm:
     24        (WebKit::modifiersForEvent):
     25        * UIProcess/API/Cocoa/WKNavigationAction.mm:
     26        (toNSEventModifierFlags):
     27        * UIProcess/Cocoa/WebAutomationSessionCocoa.mm:
     28        (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
     29
    1302016-10-05  Zan Dobersek  <zdobersek@igalia.com>
    231
  • trunk/Source/WebKit2/Shared/API/c/WKEvent.h

    r168541 r206828  
    3737    kWKEventModifiersControlKey = 1 << 1,
    3838    kWKEventModifiersAltKey = 1 << 2,
    39     kWKEventModifiersMetaKey = 1 << 3
     39    kWKEventModifiersMetaKey = 1 << 3,
     40    kWKEventModifiersCapsLockKey = 1 << 4
    4041};
    4142typedef uint32_t WKEventModifiers;
  • trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h

    r206540 r206828  
    295295    if (modifiers & WebEvent::MetaKey)
    296296        wkModifiers |= kWKEventModifiersMetaKey;
     297    if (modifiers & WebEvent::CapsLockKey)
     298        wkModifiers |= kWKEventModifiersCapsLockKey;
    297299    return wkModifiers;
    298300}
  • trunk/Source/WebKit2/Shared/WebEventConversion.cpp

    r206803 r206828  
    7777        if (webEvent.metaKey())
    7878            m_modifiers |= Modifier::MetaKey;
     79        if (webEvent.capsLockKey())
     80            m_modifiers |= Modifier::CapsLockKey;
    7981
    8082        m_timestamp = webEvent.timestamp();
     
    128130        if (webEvent.metaKey())
    129131            m_modifiers |= Modifier::MetaKey;
     132        if (webEvent.capsLockKey())
     133            m_modifiers |= Modifier::CapsLockKey;
    130134
    131135        m_timestamp = webEvent.timestamp();
     
    186190        if (webEvent.metaKey())
    187191            m_modifiers |= Modifier::MetaKey;
     192        if (webEvent.capsLockKey())
     193            m_modifiers |= Modifier::CapsLockKey;
    188194
    189195        m_timestamp = webEvent.timestamp();
     
    325331        if (webEvent.metaKey())
    326332            m_modifiers |= Modifier::MetaKey;
     333        if (webEvent.capsLockKey())
     334            m_modifiers |= Modifier::CapsLockKey;
    327335
    328336        m_timestamp = webEvent.timestamp();
     
    382390        if (webEvent.metaKey())
    383391            m_modifiers |= Modifier::MetaKey;
     392        if (webEvent.capsLockKey())
     393            m_modifiers |= Modifier::CapsLockKey;
    384394
    385395        m_timestamp = webEvent.timestamp();
  • trunk/Source/WebKit2/Shared/efl/WebEventFactory.cpp

    r194496 r206828  
    259259    if (modifiers & kWKEventModifiersMetaKey)
    260260        result |= WebEvent::MetaKey;
     261    if (modifiers & kWKEventModifiersCapsLockKey)
     262        result |= WebEvent::CapsLockKey;
    261263
    262264    return static_cast<WebEvent::Modifiers>(result);
  • trunk/Source/WebKit2/Shared/ios/WebIOSEventFactory.mm

    r164776 r206828  
    4545    if (eventModifierFlags & WebEventFlagMaskCommand)
    4646        modifiers |= WebKit::WebEvent::MetaKey;
     47    if (eventModifierFlags & WebEventFlagMaskAlphaShift)
     48        modifiers |= WebKit::WebEvent::CapsLockKey;
    4749
    4850    return static_cast<WebKit::WebEvent::Modifiers>(modifiers);
  • trunk/Source/WebKit2/Shared/mac/WebEventFactory.mm

    r206803 r206828  
    339339{
    340340    unsigned modifiers = 0;
    341 #pragma clang diagnostic push
    342 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
     341
     342#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
     343    if ([event modifierFlags] & NSEventModifierFlagCapsLock)
     344        modifiers |= WebEvent::CapsLockKey;
     345    if ([event modifierFlags] & NSEventModifierFlagShift)
     346        modifiers |= WebEvent::ShiftKey;
     347    if ([event modifierFlags] & NSEventModifierFlagControl)
     348        modifiers |= WebEvent::ControlKey;
     349    if ([event modifierFlags] & NSEventModifierFlagOption)
     350        modifiers |= WebEvent::AltKey;
     351    if ([event modifierFlags] & NSEventModifierFlagCommand)
     352        modifiers |= WebEvent::MetaKey;
     353#else
    343354    if ([event modifierFlags] & NSAlphaShiftKeyMask)
    344355        modifiers |= WebEvent::CapsLockKey;
     
    351362    if ([event modifierFlags] & NSCommandKeyMask)
    352363        modifiers |= WebEvent::MetaKey;
    353 #pragma clang diagnostic pop
     364#endif
     365
    354366    return (WebEvent::Modifiers)modifiers;
    355367}
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm

    r203338 r206828  
    8080    NSEventModifierFlags modifierFlags = 0;
    8181
    82 #pragma clang diagnostic push
    83 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
     82#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
     83    if (modifiers & WebKit::WebEvent::CapsLockKey)
     84        modifierFlags |= NSEventModifierFlagCapsLock;
     85    if (modifiers & WebKit::WebEvent::ShiftKey)
     86        modifierFlags |= NSEventModifierFlagShift;
     87    if (modifiers & WebKit::WebEvent::ControlKey)
     88        modifierFlags |= NSEventModifierFlagControl;
     89    if (modifiers & WebKit::WebEvent::AltKey)
     90        modifierFlags |= NSEventModifierFlagOption;
     91    if (modifiers & WebKit::WebEvent::MetaKey)
     92        modifierFlags |= NSEventModifierFlagCommand;
     93#else
    8494    if (modifiers & WebKit::WebEvent::CapsLockKey)
    8595        modifierFlags |= NSAlphaShiftKeyMask;
     
    92102    if (modifiers & WebKit::WebEvent::MetaKey)
    93103        modifierFlags |= NSCommandKeyMask;
    94 #pragma clang diagnostic pop
     104#endif
     105
    95106    return modifierFlags;
    96107}
  • trunk/Source/WebKit2/UIProcess/Cocoa/WebAutomationSessionCocoa.mm

    r200961 r206828  
    108108    if (keyModifiers & WebEvent::ShiftKey)
    109109        modifiers |= NSEventModifierFlagShift;
     110    if (keyModifiers & WebEvent::CapsLockKey)
     111        modifiers |= NSEventModifierFlagCapsLock;
    110112
    111113    NSTimeInterval timestamp = [NSDate timeIntervalSinceReferenceDate];
  • trunk/Tools/ChangeLog

    r206827 r206828  
     12016-10-05  Chris Dumez  <cdumez@apple.com>
     2
     3        KeyboardEvent.getModifierState() should support "CapsLock" modifier
     4        https://bugs.webkit.org/show_bug.cgi?id=162861
     5
     6        Reviewed by Darin Adler.
     7
     8        Add support for 'capsLockKey' modifier for EventSender.keyDown() so
     9        that we can test this new modifier support for layout tests.
     10
     11        * TestWebKitAPI/mac/PlatformWebViewMac.mm:
     12        (TestWebKitAPI::modifierFlagsForWKModifiers):
     13        * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
     14        (WTR::parseModifier):
     15        * WebKitTestRunner/mac/EventSenderProxy.mm:
     16        (WTR::buildModifierFlags):
     17
    1182016-10-05  Jeremy Jones  <jeremyj@apple.com>
    219
  • trunk/Tools/DumpRenderTree/mac/EventSendingController.mm

    r200979 r206828  
    438438    const int alternateKeyMask = NSAlternateKeyMask;
    439439    const int commandKeyMask = NSCommandKeyMask;
     440    const int capsLockKeyMask = NSAlphaShiftKeyMask;
    440441#else
    441442    const int controlKeyMask = WebEventFlagMaskControl;
     
    443444    const int alternateKeyMask = WebEventFlagMaskAlternate;
    444445    const int commandKeyMask = WebEventFlagMaskCommand;
     446    const int capsLockKeyMask = WebEventFlagMaskAlphaShift;
    445447#endif
    446448
     
    454456    else if ([modifierName isEqual:@"metaKey"] || [modifierName isEqual:@"addSelectionKey"])
    455457        flags |= commandKeyMask;
     458    else if ([modifierName isEqual:@"capsLockKey"])
     459        flags |= capsLockKeyMask;
    456460
    457461    return flags;
  • trunk/Tools/TestWebKitAPI/mac/PlatformWebViewMac.mm

    r182581 r206828  
    221221    if (modifiers & kWKEventModifiersMetaKey)
    222222        returnVal |= NSCommandKeyMask;
     223    if (modifiers & kWKEventModifiersCapsLockKey)
     224        returnVal |= NSAlphaShiftKeyMask;
    223225
    224226    return returnVal;
  • trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp

    r196110 r206828  
    117117    if (JSStringIsEqualToUTF8CString(modifier, "metaKey"))
    118118        return kWKEventModifiersMetaKey;
     119    if (JSStringIsEqualToUTF8CString(modifier, "capsLockKey"))
     120        return kWKEventModifiersCapsLockKey;
    119121    if (JSStringIsEqualToUTF8CString(modifier, "addSelectionKey")) {
    120122#if OS(MAC_OS_X)
  • trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm

    r194318 r206828  
    251251    if (modifiers & kWKEventModifiersMetaKey)
    252252        flags |= NSCommandKeyMask;
     253    if (modifiers & kWKEventModifiersCapsLockKey)
     254        flags |= NSAlphaShiftKeyMask;
    253255    return flags;
    254256}
Note: See TracChangeset for help on using the changeset viewer.