Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Issue 879253002: MacViews: Convert Cocoa action messages into editing commands for text fields (Closed)

Created:
5 years, 10 months ago by tapted
Modified:
5 years, 10 months ago
Reviewers:
Andre, oshima, sadrul
CC:
chromium-reviews, yusukes+watch_chromium.org, yukishiino+watch_chromium.org, tfarina, penghuang+watch_chromium.org, nona+watch_chromium.org, James Su, chrome-apps-syd-reviews_chromium.org, mac-views-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@20150127-MacViews-SendTextfieldToWindow-BORING-FILE-MOVES
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

MacViews: Convert Cocoa action messages into editing commands for text fields On Mac, events need to be mapped to "Action" messages by an NSResponder to obey platform behaviour and user customizations (e.g. a "Home" keypress should be interpreted as beginning of document, not beginning of line). Action messages are also the manner by which a user on Mac can add custom keybindings, by making entries in ~/Library/KeyBindings/DefaultKeyBinding.dict ActionMessages map well to editing commands for text fields, but not as well for other controls. For example, MenuController needs to catch the action message "cancel:" to handle the escape key. The approach in this CL is for BridgedContentView, an NSResponder, to map Action Messages to the editing command as well as the KeyCode that toolkit-views expects for that action. To test, textfield_unittests are updated to allow two kinds of event dispatch. Before this CL, all the TextfieldTest views_unittests were already passing on a toolkit-views Mac build. This is because the tests send KeyCodes directly to the InputMethod rather than to the window. However, this meant that action messages didn't come into play. To test "real" keystrokes on Mac and get good coverage of the action message overloads, the ui::test::EventGenerator is now used in textfield_unittest.cc to generate platform-specific events that are dispatched to the Window. Previously, all keyboard events were redirected to the InputMethod. BUG=378134 Committed: https://crrev.com/4a95d096d7832d7f10c174311723d529cfc35928 Cr-Commit-Position: refs/heads/master@{#314268}

Patch Set 1 #

Total comments: 5

Patch Set 2 : Just dispatch to window #

Patch Set 3 : Fix failing tests on all platforms sending bogus keycode for \n #

Patch Set 4 : Fix unicode character events #

Patch Set 5 : diverge less #

Total comments: 2

Patch Set 6 : Use VKEY_DELETE #

Unified diffs Side-by-side diffs Delta from patch set Stats (+305 lines, -50 lines) Patch
M ui/views/cocoa/bridged_content_view.mm View 5 chunks +187 lines, -19 lines 0 comments Download
M ui/views/controls/textfield/textfield_unittest.cc View 1 2 3 4 5 16 chunks +105 lines, -31 lines 0 comments Download
M ui/views/test/event_generator_delegate_mac.mm View 3 4 3 chunks +13 lines, -0 lines 0 comments Download

Messages

Total messages: 28 (14 generated)
tapted
oshima: please take a look at textfield_unittest.cc - there are some structural changes. See what ...
5 years, 10 months ago (2015-01-28 11:38:25 UTC) #3
Andre
LGTM. One question, don't we need to forward key up events to the Widget as ...
5 years, 10 months ago (2015-01-28 21:49:09 UTC) #4
tapted
+sadrul, since I will need a ui/ owner and there's some crazy event stuff here ...
5 years, 10 months ago (2015-01-28 23:54:52 UTC) #6
tapted
oshima, sadrul: ping?
5 years, 10 months ago (2015-01-29 20:42:31 UTC) #7
oshima
hi, sorry for delay. I'll review it later today.
5 years, 10 months ago (2015-01-29 23:07:04 UTC) #8
sadrul
I am not really familiar with cocoa. So there isn't a lot I can actually ...
5 years, 10 months ago (2015-01-30 15:46:40 UTC) #9
oshima
https://codereview.chromium.org/879253002/diff/1/ui/views/controls/textfield/textfield_unittest.cc File ui/views/controls/textfield/textfield_unittest.cc (right): https://codereview.chromium.org/879253002/diff/1/ui/views/controls/textfield/textfield_unittest.cc#newcode418 ui/views/controls/textfield/textfield_unittest.cc:418: scoped_ptr<ui::test::EventGenerator> event_generator_; I believe the test was updated to ...
5 years, 10 months ago (2015-01-30 17:44:17 UTC) #10
tapted
oshima, PTAL. https://codereview.chromium.org/879253002/diff/1/ui/views/controls/textfield/textfield_unittest.cc File ui/views/controls/textfield/textfield_unittest.cc (right): https://codereview.chromium.org/879253002/diff/1/ui/views/controls/textfield/textfield_unittest.cc#newcode418 ui/views/controls/textfield/textfield_unittest.cc:418: scoped_ptr<ui::test::EventGenerator> event_generator_; On 2015/01/30 17:44:17, oshima wrote: ...
5 years, 10 months ago (2015-02-02 12:46:37 UTC) #21
oshima
https://codereview.chromium.org/879253002/diff/1/ui/views/controls/textfield/textfield_unittest.cc File ui/views/controls/textfield/textfield_unittest.cc (right): https://codereview.chromium.org/879253002/diff/1/ui/views/controls/textfield/textfield_unittest.cc#newcode1546 ui/views/controls/textfield/textfield_unittest.cc:1546: SendKeyEvent('\n'); On 2015/02/02 12:46:37, tapted wrote: > These were ...
5 years, 10 months ago (2015-02-02 17:59:13 UTC) #22
tapted
On 2015/01/30 15:46:40, sadrul wrote: > But I feel like there could be code (e.g. ...
5 years, 10 months ago (2015-02-02 22:26:44 UTC) #23
oshima
lgtm
5 years, 10 months ago (2015-02-02 22:35:50 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/879253002/300001
5 years, 10 months ago (2015-02-03 04:47:39 UTC) #26
commit-bot: I haz the power
Committed patchset #6 (id:300001)
5 years, 10 months ago (2015-02-03 04:51:38 UTC) #27
commit-bot: I haz the power
5 years, 10 months ago (2015-02-03 04:52:33 UTC) #28
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/4a95d096d7832d7f10c174311723d529cfc35928
Cr-Commit-Position: refs/heads/master@{#314268}

Powered by Google App Engine
This is Rietveld 408576698