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

Issue 2422993002: views::Label: Implement context menu, keyboard shortcuts for copy/select all. (Closed)

Created:
4 years, 2 months ago by karandeepb
Modified:
4 years, 1 month ago
Reviewers:
msw, sky, 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

views::Label: Implement context menu, keyboard shortcuts for copy/select all. This CL is a follow-up to r430461 which implemented text selection for Labels. This CL implements the following for Labels- - Copy selected text on [Ctrl+C] or [Ctrl+Insert]. - Select all text on [Ctrl+A]. - Context Menu with the options Copy and Select All. - Copy selected text using the Browser menu. BridgedContentView's validateUserInterfaceItem method is also modified. Currently it returns YES only when there is an active TextInputClient which can perform the given command. But since views::Label does not implement the TextInputClient interface, the method is modified to return YES in case the focused view is a Label for the Copy and Select All commands. This is necessary for Copy and Select All keyboard shortcuts and browser menu commands to work on MacViews for labels. Some other changes- - The stored selection range is now correctly invalidated in Label::SetText and Label::SetSelectable. - Text selection is disabled for obscured labels. BUG=630365, 437993 Committed: https://crrev.com/fb049755748ea449878a7bef42e6d4fabfc80b5a Cr-Commit-Position: refs/heads/master@{#432720}

Patch Set 1 : -- #

Total comments: 44

Patch Set 2 : Address comments. #

Patch Set 3 : Rebase. #

Patch Set 4 : Tests. Stored selection range invalidation #

Total comments: 33

Patch Set 5 : Address comments by msw@. #

Patch Set 6 : Disable text selection for obscured labels. #

Patch Set 7 : Address comments by Trent. #

Total comments: 12

Patch Set 8 : Address comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+380 lines, -97 lines) Patch
M ui/views/cocoa/bridged_content_view.mm View 1 2 3 4 5 6 7 9 chunks +32 lines, -33 lines 0 comments Download
M ui/views/controls/label.h View 1 2 3 4 5 7 chunks +37 lines, -2 lines 0 comments Download
M ui/views/controls/label.cc View 1 2 3 4 5 6 12 chunks +159 lines, -7 lines 0 comments Download
M ui/views/controls/label_unittest.cc View 1 2 3 4 5 6 7 8 chunks +152 lines, -55 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 64 (47 generated)
karandeepb
PTAL msw@ for ui/views/controls. https://codereview.chromium.org/2422993002/diff/170001/ui/views/controls/label.cc File ui/views/controls/label.cc (right): https://codereview.chromium.org/2422993002/diff/170001/ui/views/controls/label.cc#newcode1020 ui/views/controls/label.cc:1020: context_menu_contents_.reset(new ui::SimpleMenuModel(this)); Do we want ...
4 years, 1 month ago (2016-11-09 10:20:01 UTC) #12
karandeepb
Will add tests in a subsequent patch.
4 years, 1 month ago (2016-11-09 10:20:26 UTC) #13
msw
Cool, I'm looking forward to some tests. https://codereview.chromium.org/2422993002/diff/170001/ui/views/cocoa/bridged_content_view.mm File ui/views/cocoa/bridged_content_view.mm (left): https://codereview.chromium.org/2422993002/diff/170001/ui/views/cocoa/bridged_content_view.mm#oldcode523 ui/views/cocoa/bridged_content_view.mm:523: // This ...
4 years, 1 month ago (2016-11-09 18:32:53 UTC) #14
karandeepb
PTAL msw@. Thanks. https://codereview.chromium.org/2422993002/diff/170001/ui/views/cocoa/bridged_content_view.mm File ui/views/cocoa/bridged_content_view.mm (left): https://codereview.chromium.org/2422993002/diff/170001/ui/views/cocoa/bridged_content_view.mm#oldcode523 ui/views/cocoa/bridged_content_view.mm:523: // This DCHECK is more strict ...
4 years, 1 month ago (2016-11-15 10:54:33 UTC) #29
msw
https://codereview.chromium.org/2422993002/diff/170001/ui/views/controls/label.cc File ui/views/controls/label.cc (right): https://codereview.chromium.org/2422993002/diff/170001/ui/views/controls/label.cc#newcode550 ui/views/controls/label.cc:550: // The only accelerator a Label needs to handle ...
4 years, 1 month ago (2016-11-15 20:06:45 UTC) #32
tapted
I haven't looked over everything yet, but one majorish thing came up in bridged_content_view.mm https://codereview.chromium.org/2422993002/diff/330001/ui/views/cocoa/bridged_content_view.mm ...
4 years, 1 month ago (2016-11-16 00:51:57 UTC) #34
tapted
just nits elsewhere. And a wild idea to make key event processing nicer https://codereview.chromium.org/2422993002/diff/330001/ui/views/controls/label.cc File ...
4 years, 1 month ago (2016-11-16 02:45:19 UTC) #35
karandeepb
PTAL Trent, msw@. Thanks. https://codereview.chromium.org/2422993002/diff/330001/ui/views/cocoa/bridged_content_view.mm File ui/views/cocoa/bridged_content_view.mm (right): https://codereview.chromium.org/2422993002/diff/330001/ui/views/cocoa/bridged_content_view.mm#newcode1396 ui/views/cocoa/bridged_content_view.mm:1396: // Cut/Copy/Paste edit commands in ...
4 years, 1 month ago (2016-11-16 07:48:29 UTC) #43
tapted
https://codereview.chromium.org/2422993002/diff/330001/ui/views/cocoa/bridged_content_view.mm File ui/views/cocoa/bridged_content_view.mm (right): https://codereview.chromium.org/2422993002/diff/330001/ui/views/cocoa/bridged_content_view.mm#newcode1396 ui/views/cocoa/bridged_content_view.mm:1396: // Cut/Copy/Paste edit commands in the Chrome menu using ...
4 years, 1 month ago (2016-11-16 08:39:08 UTC) #46
msw
lgtm with a nit, and modulo Trent's feedback. https://codereview.chromium.org/2422993002/diff/430001/ui/views/controls/label_unittest.cc File ui/views/controls/label_unittest.cc (right): https://codereview.chromium.org/2422993002/diff/430001/ui/views/controls/label_unittest.cc#newcode1028 ui/views/controls/label_unittest.cc:1028: // ...
4 years, 1 month ago (2016-11-16 18:55:16 UTC) #47
karandeepb
PTAL Trent. https://codereview.chromium.org/2422993002/diff/330001/ui/views/controls/label.cc File ui/views/controls/label.cc (right): https://codereview.chromium.org/2422993002/diff/330001/ui/views/controls/label.cc#newcode559 ui/views/controls/label.cc:559: const bool shift = event.IsShiftDown(); On 2016/11/16 ...
4 years, 1 month ago (2016-11-16 23:47:13 UTC) #50
tapted
lgtm thanks!
4 years, 1 month ago (2016-11-16 23:51:18 UTC) #51
karandeepb
PTAL sky@.
4 years, 1 month ago (2016-11-16 23:55:36 UTC) #54
sky
msw already reviewed this, so rubber stamp LGTM from me
4 years, 1 month ago (2016-11-17 00:58:11 UTC) #55
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/2422993002/450001
4 years, 1 month ago (2016-11-17 02:12:08 UTC) #60
commit-bot: I haz the power
Committed patchset #8 (id:450001)
4 years, 1 month ago (2016-11-17 03:16:14 UTC) #62
commit-bot: I haz the power
4 years, 1 month ago (2016-11-17 03:21:03 UTC) #64
Message was sent while issue was closed.
Patchset 8 (id:??) landed as
https://crrev.com/fb049755748ea449878a7bef42e6d4fabfc80b5a
Cr-Commit-Position: refs/heads/master@{#432720}

Powered by Google App Engine
This is Rietveld 408576698