Commit 7317c501 authored by Avi Drissman's avatar Avi Drissman Committed by Commit Bot

Mac Task Manager: Fix colors for selected rows.

"alternateSelectedControlTextColor" is a name with non-obvious
meaning, but it is (as per Apple header):

> Foreground color inside emphasized and selected content:
> table views rows, collection views, etc.

Tested by checking non-selected and selected rows from 10.10
through 10.15 in both light and dark mode.

Bug: 1018333
Change-Id: I38881d0e625ecce761f7e079d1346e5225bcc32a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1890475
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Reviewed-by: default avatarLeonard Grey <lgrey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710941}
parent 75ff23aa
......@@ -553,12 +553,20 @@ bool ShouldUseViewsTaskManager() {
if ([[tableColumn identifier] intValue] == IDS_TASK_MANAGER_TASK_COLUMN) {
DCHECK([cell isKindOfClass:[NSButtonCell class]]);
NSButtonCell* buttonCell = static_cast<NSButtonCell*>(cell);
NSString* title = [self modelTextForRow:rowIndex
column:[[tableColumn identifier] intValue]];
buttonCell.attributedTitle = [[[NSAttributedString alloc]
NSColor* textColor = [tableView isRowSelected:rowIndex]
? [NSColor alternateSelectedControlTextColor]
: [NSColor labelColor];
NSAttributedString* attributedTitle = [[[NSAttributedString alloc]
initWithString:title
attributes:@{NSForegroundColorAttributeName : [NSColor labelColor]}]
autorelease];
attributes:@{
NSForegroundColorAttributeName : textColor,
NSFontAttributeName : cell.font
}] autorelease];
buttonCell.attributedTitle = attributedTitle;
buttonCell.image =
taskManagerMac_->GetImageForRow(viewToModelMap_[rowIndex]);
buttonCell.refusesFirstResponder = YES; // Don't push in like a button.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment