• tapted's avatar
    MacViews: Handle Tab properly · f8a2ca37
    tapted authored
    On Mac, interpreting a tab keypress into an action message calls
    [NSResponder insertTab]. [RenderWidgetHostViewCocoa
    doCommandBySelector:] has for a long time had a check that skips
    converting any action message whose selector starts with "insert" into
    an editing command, and just treats it as a regular keypress instead.
    
    This approach also works well for UI in MacViews, so do the same.
    
    Theoretically a user could remap a different key or key combination to
    the 'insertTab' action message, but that's unlikely.
    
    Updates TextfieldTest.FocusTraversalTest with cross-platform checks to
    test for this case. Also tested manually with views_examples.
    
    For the test to work with the approach in this CL, the event simulator
    needs to provide an answer for -[NSApplication currentEvent], so that's
    done too.
    
    BUG=454353
    
    Review URL: https://codereview.chromium.org/951433002
    
    Cr-Commit-Position: refs/heads/master@{#318172}
    f8a2ca37
textfield_unittest.cc 86.2 KB