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

Issue 1761183002: color_utils cleanup: (Closed)

Created:
4 years, 9 months ago by Peter Kasting
Modified:
4 years, 9 months ago
CC:
chromium-reviews, tim+watch_chromium.org, extensions-reviews_chromium.org, sadrul, zea+watch_chromium.org, tfarina, asanka, maxbogue+watch_chromium.org, noyau+watch_chromium.org, plaree+watch_chromium.org, chromium-apps-reviews_chromium.org, kalyank, dbeam+watch-downloads_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

color_utils cleanup: * Attempt to define and standardize usage of "luma" vs. "(relative) luminance" vs. "lightness", at least as far as color_utils functions, comments, and direct callers are concerned. Especially the first two terms are often both called "luminance" (universally, not just in Chrome code), so the distinction is confusing. * Misc. cleanups to make caller code shorter or clearer. * Naming consistency: remove "Get" from function names where we're not doing some simple "getter" operation, but rather computing a value. * Modify some caller behaviors to be hopefully-more-correct * Note that GetReadableColor() can accept values with alpha, it will just ignore the alpha. * Add a PickContrastingColor() function, which is basically a subset of GetReadableColor(). This will be useful for an upcoming change where we want to choose between two fixed colors instead of luma-inverting a single input. * Use more precise multipliers in Luma(). BUG=none TEST=none Committed: https://crrev.com/6a3e439037809fd5dccf11c4cd0a91fb6a637702 Cr-Commit-Position: refs/heads/master@{#379643}

Patch Set 1 #

Total comments: 16

Patch Set 2 : Remove accidental change #

Patch Set 3 : Rename functions #

Unified diffs Side-by-side diffs Delta from patch set Stats (+124 lines, -122 lines) Patch
M apps/ui/views/app_window_frame_view.cc View 1 2 1 chunk +2 lines, -4 lines 0 comments Download
M ash/frame/default_header_painter.cc View 2 chunks +2 lines, -5 lines 0 comments Download
M chrome/browser/extensions/bookmark_app_helper.cc View 1 2 2 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/themes/theme_service.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/libgtk2ui/gtk2_ui.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/sync/profile_signin_confirmation_helper.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/download/download_item_view.cc View 2 chunks +22 lines, -27 lines 0 comments Download
M components/favicon_base/fallback_icon_style.cc View 1 2 3 chunks +14 lines, -14 lines 0 comments Download
M mash/wm/frame/default_header_painter.cc View 2 chunks +1 line, -4 lines 0 comments Download
M ui/gfx/color_utils.h View 1 2 4 chunks +31 lines, -19 lines 0 comments Download
M ui/gfx/color_utils.cc View 1 2 4 chunks +40 lines, -37 lines 0 comments Download
M ui/gfx/sys_color_change_listener.cc View 1 2 1 chunk +5 lines, -5 lines 0 comments Download

Messages

Total messages: 20 (7 generated)
Peter Kasting
benwells: apps/ui/views/app_window_frame_view.cc chrome/browser/extensions/bookmark_app_helper.cc danakj: ui/gfx/ erg: chrome/browser/ui/libgtk2ui/gtk2_ui.cc mash/wm/frame/default_header_painter.cc pkotwicz: ash/frame/default_header_painter.cc chrome/browser/themes/ components/favicon_base/fallback_icon_style.cc https://codereview.chromium.org/1761183002/diff/1/ash/frame/default_header_painter.cc File ash/frame/default_header_painter.cc ...
4 years, 9 months ago (2016-03-04 01:39:26 UTC) #3
Peter Kasting
https://codereview.chromium.org/1761183002/diff/1/chrome/browser/themes/theme_properties.h File chrome/browser/themes/theme_properties.h (left): https://codereview.chromium.org/1761183002/diff/1/chrome/browser/themes/theme_properties.h#oldcode128 chrome/browser/themes/theme_properties.h:128: COLOR_STATUS_BAR_TEXT, Ignore this change; this slipped in erroneously and ...
4 years, 9 months ago (2016-03-04 01:40:41 UTC) #4
danakj
LGTM overall https://codereview.chromium.org/1761183002/diff/1/ui/gfx/color_utils.cc File ui/gfx/color_utils.cc (right): https://codereview.chromium.org/1761183002/diff/1/ui/gfx/color_utils.cc#newcode59 ui/gfx/color_utils.cc:59: return HSLToSkColor(hsl, SkColorGetA(color)); This is a behaviour ...
4 years, 9 months ago (2016-03-04 01:54:49 UTC) #5
benwells
apps/ui/views/app_window_frame_view.cc chrome/browser/extensions/bookmark_app_helper.cc lgtm
4 years, 9 months ago (2016-03-04 02:00:33 UTC) #6
Peter Kasting
I'm willing to make these separate changes, but I'd prefer not to unless you feel ...
4 years, 9 months ago (2016-03-04 02:10:52 UTC) #7
Elliot Glaysher
lgtm
4 years, 9 months ago (2016-03-04 18:22:51 UTC) #9
danakj
https://codereview.chromium.org/1761183002/diff/1/ui/gfx/color_utils.cc File ui/gfx/color_utils.cc (right): https://codereview.chromium.org/1761183002/diff/1/ui/gfx/color_utils.cc#newcode59 ui/gfx/color_utils.cc:59: return HSLToSkColor(hsl, SkColorGetA(color)); On 2016/03/04 02:10:52, Peter Kasting wrote: ...
4 years, 9 months ago (2016-03-04 19:05:55 UTC) #10
Peter Kasting
TLDR: I don't think there's a rule or pattern for verb names over noun ones, ...
4 years, 9 months ago (2016-03-04 20:28:58 UTC) #11
danakj
https://codereview.chromium.org/1761183002/diff/1/ui/gfx/color_utils.h File ui/gfx/color_utils.h (right): https://codereview.chromium.org/1761183002/diff/1/ui/gfx/color_utils.h#newcode29 ui/gfx/color_utils.h:29: GFX_EXPORT double ContrastRatio(SkColor color_a, SkColor color_b); On 2016/03/04 20:28:57, ...
4 years, 9 months ago (2016-03-04 21:10:00 UTC) #12
pkotwicz
chrome/browser/themes LGTM
4 years, 9 months ago (2016-03-07 14:29:31 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1761183002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1761183002/40001
4 years, 9 months ago (2016-03-07 19:36:14 UTC) #16
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 9 months ago (2016-03-07 21:13:32 UTC) #18
commit-bot: I haz the power
4 years, 9 months ago (2016-03-07 21:14:46 UTC) #20
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/6a3e439037809fd5dccf11c4cd0a91fb6a637702
Cr-Commit-Position: refs/heads/master@{#379643}

Powered by Google App Engine
This is Rietveld 408576698