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

Issue 2624093002: MacViews: Correctly handle character events when there's an active TextInputClient. (Closed)

Created:
3 years, 11 months ago by karandeepb
Modified:
3 years, 11 months ago
Reviewers:
tapted
CC:
chromium-reviews, tfarina, mac-reviews_chromium.org, chrome-apps-syd-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

MacViews: Correctly handle character events when there's an active TextInputClient. Currently in insertTextInternal:, we do not generate a synthetic character event for the View hierarchy when there's an active TextInputClient. Since a Space key press generates an insertText: (or insertText:replacementRange:) action message, this causes views::Combobox to not receive the space key press. This is because views::Combobox uses the views::PrefixSelector TextInputClient when focused. As a result, a space key press on a combobox does not currently open the combobox dropdown. To solve, generate key events for all character events in insertTextInternal:. The key event is generated before calling TextInputClient::Insert[Char/Text] which is similar to other platforms. However, the key event is not passed to the View hierarchy in case there's active composition text, since it should be consumed by the IME in that case. Also, a new variable hasUnhandledKeyDownEvent_ is introduced on the BridgedContentView so that keyDownEvent_ remains valid for the duration of keyDown:. This is needed because a keyDown: can infact lead to multiple insertText: action messages. Also, combobox unittests are modified to use an EventGenerator to test key event behavior to provide better coverage. (With an EventGenerator, ComboboxTest.NotifyOnClickWithSpaceKey fails on the master). BUG=619545, 607429 TEST=With chrome://flags/#secondary-ui-md on Mac, open the Bookmark bubble. Enable Full Keyboard Access (Ctrl+F7). Focus the Folder combobox. Ensure pressing space opens the combobox dropdown. Review-Url: https://codereview.chromium.org/2624093002 Cr-Commit-Position: refs/heads/master@{#443832} Committed: https://chromium.googlesource.com/chromium/src/+/b412f671d94f869489023137ba2705785883614f

Patch Set 1 #

Total comments: 1

Patch Set 2 : Fix tests #

Total comments: 11

Patch Set 3 : Rebase #

Patch Set 4 : Some corner cases. #

Patch Set 5 : Another corner case! #

Total comments: 2

Patch Set 6 : Flip isKeyDownEventHandled_ -> hasUnhandledKeyDownEvent_ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+111 lines, -95 lines) Patch
M ui/views/cocoa/bridged_content_view.h View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
M ui/views/cocoa/bridged_content_view.mm View 1 2 3 4 5 8 chunks +49 lines, -41 lines 0 comments Download
M ui/views/controls/combobox/combobox_unittest.cc View 1 2 3 15 chunks +59 lines, -54 lines 0 comments Download

Depends on Patchset:

Dependent Patchsets:

Messages

Total messages: 30 (22 generated)
karandeepb
PTAL Trent. https://codereview.chromium.org/2624093002/diff/1/ui/views/cocoa/bridged_content_view.mm File ui/views/cocoa/bridged_content_view.mm (left): https://codereview.chromium.org/2624093002/diff/1/ui/views/cocoa/bridged_content_view.mm#oldcode539 ui/views/cocoa/bridged_content_view.mm:539: // requires two 16 bit characters. Currently ...
3 years, 11 months ago (2017-01-11 06:00:59 UTC) #5
karandeepb
https://codereview.chromium.org/2624093002/diff/20001/ui/views/controls/combobox/combobox_unittest.cc File ui/views/controls/combobox/combobox_unittest.cc (right): https://codereview.chromium.org/2624093002/diff/20001/ui/views/controls/combobox/combobox_unittest.cc#newcode211 ui/views/controls/combobox/combobox_unittest.cc:211: CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); Did not look into it, but tests fail ...
3 years, 11 months ago (2017-01-11 08:16:20 UTC) #12
tapted
lgtm with an updated dcheck and other stuff below unless you see something different https://codereview.chromium.org/2624093002/diff/20001/ui/views/cocoa/bridged_content_view.mm ...
3 years, 11 months ago (2017-01-11 14:54:20 UTC) #13
karandeepb
PTAL Trent. https://codereview.chromium.org/2624093002/diff/20001/ui/views/cocoa/bridged_content_view.mm File ui/views/cocoa/bridged_content_view.mm (right): https://codereview.chromium.org/2624093002/diff/20001/ui/views/cocoa/bridged_content_view.mm#newcode520 ui/views/cocoa/bridged_content_view.mm:520: ui::KeyEvent charEvent = GetCharacterEventFromNSEvent(keyDownEvent_); >>I only discovered ...
3 years, 11 months ago (2017-01-13 03:13:38 UTC) #17
tapted
lgtm with the fix below (hasPendingKeyDownEvent_) - take care flipping the logic :) https://codereview.chromium.org/2624093002/diff/20001/ui/views/cocoa/bridged_content_view.mm File ...
3 years, 11 months ago (2017-01-13 20:02:45 UTC) #22
karandeepb
https://codereview.chromium.org/2624093002/diff/100001/ui/views/cocoa/bridged_content_view.h File ui/views/cocoa/bridged_content_view.h (right): https://codereview.chromium.org/2624093002/diff/100001/ui/views/cocoa/bridged_content_view.h#newcode44 ui/views/cocoa/bridged_content_view.h:44: BOOL isKeyDownEventHandled_; On 2017/01/13 20:02:44, tapted wrote: > This ...
3 years, 11 months ago (2017-01-16 02:02:22 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2624093002/120001
3 years, 11 months ago (2017-01-16 02:03:02 UTC) #27
commit-bot: I haz the power
3 years, 11 months ago (2017-01-16 02:35:20 UTC) #30
Message was sent while issue was closed.
Committed patchset #6 (id:120001) as
https://chromium.googlesource.com/chromium/src/+/b412f671d94f869489023137ba27...

Powered by Google App Engine
This is Rietveld 408576698