Skip to content

Commit

Permalink
Fix background colour for Cocoa app list on hover
Browse files Browse the repository at this point in the history
This color changed recently for the toolkit-views app list, but the
Cocoa app list isn't ready for it yet.

The Cocoa-specific kHighlightedColor was only used in
apps_search_results_controller.mm, so move it there. kSelectedColor is
used there but also in apps_grid_view_item.mm. However, the latter users
a composited draw, so it's fine with the transparent background views
uses.

BUG=469051

Review URL: https://codereview.chromium.org/1023983002

Cr-Commit-Position: refs/heads/master@{#321573}
  • Loading branch information
tapted authored and Commit bot committed Mar 20, 2015
1 parent 95e10a8 commit b98970f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
8 changes: 0 additions & 8 deletions ui/app_list/app_list_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,10 @@ const SkColor kBottomSeparatorColor = SkColorSetRGB(0xC0, 0xC0, 0xC0);
// The color of the separator used inside dialogs in the app list.
const SkColor kDialogSeparatorColor = SkColorSetRGB(0xD1, 0xD1, 0xD1);

// Non-views Mac requires opaque colors to paint correctly.
#if defined(OS_MACOSX) && !defined(TOOLKIT_VIEWS)
// The mouse hover colour (3% black over kContentsBackgroundColor).
const SkColor kHighlightedColor = SkColorSetRGB(0xEE, 0xEE, 0xEE);
// The keyboard select colour (6% black over kContentsBackgroundColor).
const SkColor kSelectedColor = SkColorSetRGB(0xE6, 0xE6, 0xE6);
#else
// The mouse hover colour (3% black).
const SkColor kHighlightedColor = SkColorSetARGB(8, 0, 0, 0);
// The keyboard select colour (6% black).
const SkColor kSelectedColor = SkColorSetARGB(15, 0, 0, 0);
#endif

const SkColor kPagerHoverColor = SkColorSetRGB(0xB4, 0xB4, 0xB4);
const SkColor kPagerNormalColor = SkColorSetRGB(0xE2, 0xE2, 0xE2);
Expand Down
9 changes: 7 additions & 2 deletions ui/app_list/cocoa/apps_search_results_controller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
const NSBackgroundStyle kBackgroundSelected = NSBackgroundStyleDark;
const NSBackgroundStyle kBackgroundHovered = NSBackgroundStyleRaised;

// The mouse hover colour (3% black over kContentsBackgroundColor).
const SkColor kHighlightedRowColor = SkColorSetRGB(0xEE, 0xEE, 0xEE);
// The keyboard select colour (6% black over kContentsBackgroundColor).
const SkColor kSelectedRowColor = SkColorSetRGB(0xE6, 0xE6, 0xE6);

} // namespace

@interface AppsSearchResultsController ()
Expand Down Expand Up @@ -421,9 +426,9 @@ - (void)drawWithFrame:(NSRect)cellFrame
inView:(NSView*)controlView {
if ([self backgroundStyle] != kBackgroundNormal) {
if ([self backgroundStyle] == kBackgroundSelected)
[gfx::SkColorToSRGBNSColor(app_list::kSelectedColor) set];
[gfx::SkColorToSRGBNSColor(kSelectedRowColor) set];
else
[gfx::SkColorToSRGBNSColor(app_list::kHighlightedColor) set];
[gfx::SkColorToSRGBNSColor(kHighlightedRowColor) set];

// Extend up by one pixel to draw over cell border.
NSRect backgroundRect = cellFrame;
Expand Down

0 comments on commit b98970f

Please sign in to comment.