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

Issue 2441343003: Allow the default generic font family settings to find the first available font (Closed)

Created:
4 years, 1 month ago by kojii
Modified:
4 years, 1 month ago
Reviewers:
falken, msw, Dan Beam, eae
CC:
ajuma+watch_chromium.org, Alexei Svitkine (slow), blink-reviews, blink-reviews-platform-graphics_chromium.org, Rik, chromium-reviews, danakj+watch_chromium.org, Daniel Erat, dshwang, drott+blinkwatch_chromium.org, krit, f(malita), jbroman, Justin Novosad, pdr+graphicswatchlist_chromium.org, rwlbuis, Stephen Chennney
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Allow the default generic font family settings to find the first available font This patch allows the default generic font family settings to have a list of fonts that resolves to the first available font on the system. Since only small part of the settings are lists, this patch introduces a convention that the font name is a list only when it starts with ",". This avoids scanning the name and checking the font availability when it's not necessary. MaybeGetLocalizedFontName is moved to FontSettingsUtilities to eliminate the duplication in options and extensions. The extension API chrome.fontSettings.getFont[1] is unchanged. It resolves to the first available font on getting the value. Resource changes in grd/xtb files will be in following patches (e.g., crrev.com/2454583002) [1] https://developer.chrome.com/extensions/fontSettings#method-getFont BUG=658646 Committed: https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9 Cr-Commit-Position: refs/heads/master@{#428590}

Patch Set 1 #

Patch Set 2 : WIP #

Patch Set 3 : WIP #

Patch Set 4 : Add tests #

Patch Set 5 : More tests #

Patch Set 6 : Fix and resource changes for ja #

Patch Set 7 : Split resource changes to a separate CL #

Patch Set 8 : Fix font settings (non-advanced) #

Patch Set 9 : Fix non-Windows builds #

Patch Set 10 : Merge dupicated code #

Patch Set 11 : Cleanup #

Patch Set 12 : Add more tests #

Total comments: 19

Patch Set 13 : Un-shared FirstAvailableOrFirst as per msw review #

Total comments: 10

Patch Set 14 : Add font_settings_utils_unittest #

Total comments: 13

Patch Set 15 : msw, dbeam, falken review #

Patch Set 16 : Code shared in ui/gfx #

Total comments: 8

Patch Set 17 : msw review #

Unified diffs Side-by-side diffs Delta from patch set Stats (+229 lines, -52 lines) Patch
M chrome/browser/extensions/api/font_settings/font_settings_api.cc View 1 2 3 4 5 6 7 8 9 5 chunks +4 lines, -21 lines 0 comments Download
M chrome/browser/ui/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/ui/webui/options/font_settings_handler.cc View 1 2 3 4 5 6 7 8 9 2 chunks +14 lines, -28 lines 0 comments Download
M chrome/browser/ui/webui/options/font_settings_utils.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +16 lines, -0 lines 0 comments Download
A chrome/browser/ui/webui/options/font_settings_utils.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +25 lines, -0 lines 0 comments Download
A chrome/browser/ui/webui/options/font_settings_utils_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 15 1 chunk +30 lines, -0 lines 0 comments Download
M chrome/browser/ui/webui/options/font_settings_utils_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +13 lines, -0 lines 0 comments Download
M chrome/test/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/FontCache.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/FontCache.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +10 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +20 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/GenericFontFamilySettings.cpp View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +9 lines, -3 lines 0 comments Download
A third_party/WebKit/Source/platform/fonts/GenericFontFamilySettingsTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +29 lines, -0 lines 0 comments Download
M ui/gfx/font_list.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +6 lines, -0 lines 0 comments Download
M ui/gfx/font_list.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +29 lines, -0 lines 0 comments Download
M ui/gfx/font_list_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +20 lines, -0 lines 0 comments Download

Messages

Total messages: 95 (73 generated)
kojii
PTAL. falken: chrome/browser/extensions/api/font_settings/font_settings_api.cc dbeam: chrome/browser/ui/webui/options/font_settings_* eae: third_party/WebKit/Source/platform/* msw: ui/gfx/font*
4 years, 1 month ago (2016-10-26 14:08:07 UTC) #47
eae
LGTM for Source/platform https://codereview.chromium.org/2441343003/diff/240001/third_party/WebKit/Source/platform/fonts/FontCache.cpp File third_party/WebKit/Source/platform/fonts/FontCache.cpp (right): https://codereview.chromium.org/2441343003/diff/240001/third_party/WebKit/Source/platform/fonts/FontCache.cpp#newcode308 third_party/WebKit/Source/platform/fonts/FontCache.cpp:308: return String::fromUTF8( I don't suppose we ...
4 years, 1 month ago (2016-10-26 16:59:36 UTC) #51
msw
This seems a bit unusual, can you try using similar existing codepaths? https://codereview.chromium.org/2441343003/diff/240001/chrome/browser/ui/webui/options/font_settings_utils.cc File chrome/browser/ui/webui/options/font_settings_utils.cc ...
4 years, 1 month ago (2016-10-26 20:33:50 UTC) #52
kojii
msw@, thank you having a quick review. As per your comments, PS13: * Moves the ...
4 years, 1 month ago (2016-10-26 22:20:03 UTC) #55
msw
Sorry that the best path forward isn't clear to me here... https://codereview.chromium.org/2441343003/diff/240001/chrome/browser/ui/webui/options/font_settings_utils.cc File chrome/browser/ui/webui/options/font_settings_utils.cc (right): ...
4 years, 1 month ago (2016-10-27 00:04:18 UTC) #58
Dan Beam
https://codereview.chromium.org/2441343003/diff/280001/chrome/browser/ui/webui/options/font_settings_utils.cc File chrome/browser/ui/webui/options/font_settings_utils.cc (right): https://codereview.chromium.org/2441343003/diff/280001/chrome/browser/ui/webui/options/font_settings_utils.cc#newcode37 chrome/browser/ui/webui/options/font_settings_utils.cc:37: } ^ why are we duplicating this with the ...
4 years, 1 month ago (2016-10-27 02:07:24 UTC) #61
falken
The change to font_settings_api.cc lgtm. https://codereview.chromium.org/2441343003/diff/280001/chrome/browser/ui/webui/options/font_settings_utils.h File chrome/browser/ui/webui/options/font_settings_utils.h (right): https://codereview.chromium.org/2441343003/diff/280001/chrome/browser/ui/webui/options/font_settings_utils.h#newcode28 chrome/browser/ui/webui/options/font_settings_utils.h:28: // only for the ...
4 years, 1 month ago (2016-10-27 02:21:59 UTC) #62
kojii
Thank you msw, dbeam, falken. All comments reflected/replied inline below: https://codereview.chromium.org/2441343003/diff/260001/chrome/browser/ui/webui/options/font_settings_utils.cc File chrome/browser/ui/webui/options/font_settings_utils.cc (right): https://codereview.chromium.org/2441343003/diff/260001/chrome/browser/ui/webui/options/font_settings_utils.cc#newcode13 ...
4 years, 1 month ago (2016-10-27 04:50:57 UTC) #65
kojii
Just to make sure reviewers understand the purpose of this change. We'd like to pick ...
4 years, 1 month ago (2016-10-27 08:55:07 UTC) #68
msw
Mostly lg, I'm open to consolidating the functions in ui/gfx if folks agree that's an ...
4 years, 1 month ago (2016-10-27 17:18:11 UTC) #69
Dan Beam
https://codereview.chromium.org/2441343003/diff/280001/chrome/browser/ui/webui/options/font_settings_utils.cc File chrome/browser/ui/webui/options/font_settings_utils.cc (right): https://codereview.chromium.org/2441343003/diff/280001/chrome/browser/ui/webui/options/font_settings_utils.cc#newcode37 chrome/browser/ui/webui/options/font_settings_utils.cc:37: } On 2016/10/27 17:18:11, msw wrote: > On 2016/10/27 ...
4 years, 1 month ago (2016-10-27 17:29:41 UTC) #70
msw
https://codereview.chromium.org/2441343003/diff/280001/chrome/browser/ui/webui/options/font_settings_utils.cc File chrome/browser/ui/webui/options/font_settings_utils.cc (right): https://codereview.chromium.org/2441343003/diff/280001/chrome/browser/ui/webui/options/font_settings_utils.cc#newcode37 chrome/browser/ui/webui/options/font_settings_utils.cc:37: } On 2016/10/27 17:29:41, Dan Beam wrote: > On ...
4 years, 1 month ago (2016-10-27 18:24:02 UTC) #71
kojii
PTAL, PS16 shared the code. https://codereview.chromium.org/2441343003/diff/280001/chrome/browser/ui/webui/options/font_settings_utils.cc File chrome/browser/ui/webui/options/font_settings_utils.cc (right): https://codereview.chromium.org/2441343003/diff/280001/chrome/browser/ui/webui/options/font_settings_utils.cc#newcode37 chrome/browser/ui/webui/options/font_settings_utils.cc:37: } On 2016/10/27 at ...
4 years, 1 month ago (2016-10-28 04:59:42 UTC) #77
kojii
Replying to eae@'s earlier comment since we're sharing the code again. https://codereview.chromium.org/2441343003/diff/240001/third_party/WebKit/Source/platform/fonts/FontCache.cpp File third_party/WebKit/Source/platform/fonts/FontCache.cpp (right): ...
4 years, 1 month ago (2016-10-28 05:07:14 UTC) #78
msw
https://codereview.chromium.org/2441343003/diff/340001/chrome/browser/ui/webui/options/font_settings_utils.h File chrome/browser/ui/webui/options/font_settings_utils.h (right): https://codereview.chromium.org/2441343003/diff/340001/chrome/browser/ui/webui/options/font_settings_utils.h#newcode32 chrome/browser/ui/webui/options/font_settings_utils.h:32: static std::string MaybeGetLocalizedFontName(const std::string&); nit: param name https://codereview.chromium.org/2441343003/diff/340001/ui/gfx/font.cc File ...
4 years, 1 month ago (2016-10-28 07:05:06 UTC) #81
kojii
Thank you for your prompt review as always, all done. https://codereview.chromium.org/2441343003/diff/340001/chrome/browser/ui/webui/options/font_settings_utils.h File chrome/browser/ui/webui/options/font_settings_utils.h (right): https://codereview.chromium.org/2441343003/diff/340001/chrome/browser/ui/webui/options/font_settings_utils.h#newcode32 ...
4 years, 1 month ago (2016-10-28 07:57:30 UTC) #84
msw
lgtm
4 years, 1 month ago (2016-10-28 08:42:08 UTC) #85
Dan Beam
lgtm
4 years, 1 month ago (2016-10-29 01:22:00 UTC) #88
kojii
Thank you all, so much appreciated!
4 years, 1 month ago (2016-10-29 02:20:48 UTC) #89
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/2441343003/360001
4 years, 1 month ago (2016-10-29 02:21:13 UTC) #92
commit-bot: I haz the power
Committed patchset #17 (id:360001)
4 years, 1 month ago (2016-10-29 02:26:23 UTC) #93
commit-bot: I haz the power
4 years, 1 month ago (2016-10-29 02:28:48 UTC) #95
Message was sent while issue was closed.
Patchset 17 (id:??) landed as
https://crrev.com/6c0885e2699ef3aac4f3d8186d0520e6386094b9
Cr-Commit-Position: refs/heads/master@{#428590}

Powered by Google App Engine
This is Rietveld 408576698