Chromium Code Reviews

Issue 19666006: Supports FontList in Textfield. (Closed)

Created:
7 years, 5 months ago by Yuki
Modified:
7 years, 4 months ago
Reviewers:
msw, Alexei Svitkine (slow), sky, tony, Peter Kasting
CC:
chromium-reviews, nona+watch_chromium.org, tfarina, James Su, penghuang+watch_chromium.org, yusukes+watch_chromium.org
Visibility:
Public.

Description

Supports FontList in Textfield. The current interface of Textfield does not support FontList while RenderText supports FontList. This CL supports FontList in Textfield. The direct cause of crbug.com/263169 was that RenderText always uses the IDS_UI_FONT_FAMILY_CROS font set ignoring what font is specified for Textfield on ChromeOS. (See https://code.google.com/p/chromium/codesearch#chromium/src/ui/views/controls/textfield/native_textfield_views.cc&q=IDS_UI_FONT_FAMILY_CROS&sq=package:chromium&type=cs&l=88 ) The Omnibox font size is carefully calculated, but the font is ignored right now. This CL changes the following: - Supports FontList in Textfield so Omnibox layer can specify the font set, such as IDS_UI_FONT_FAMILY_CROS, for the underlying Textfield. - Makes NativeTextfieldViews follow the specified font set via Textfield on ChromeOS. BUG=263169, 263196 TEST=Test manually. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=215055

Patch Set 1 #

Total comments: 9

Patch Set 2 : Fixed based on review comments. #

Patch Set 3 : Lets CrOS use multiple fonts in IDS_UI_FONT_FAMILY_CROS. #

Total comments: 2

Patch Set 4 : Fixes selection-highlighting and unwanted inlining of a method. #

Patch Set 5 : Supports Windows build. #

Patch Set 6 : Fixes unittests. #

Patch Set 7 : Supports Mac OS X. #

Patch Set 8 : Fixes examples and unittests. #

Total comments: 24

Patch Set 9 : Synced. #

Patch Set 10 : New ResourceBundle::GetFontList(style) and review fixes. #

Patch Set 11 : Fixes ResourceBundleTest. #

Patch Set 12 : Synced. #

Patch Set 13 : Updates ui_unittests_disabled for Android. #

Total comments: 6

Patch Set 14 : Fixes nits based on review comments. #

Patch Set 15 : Synced. #

Total comments: 3

Patch Set 16 : Keeps ResourceBundle::Delegate::GetFont for backward compatibility with CEF. #

Patch Set 17 : Synced. #

Patch Set 18 : Removes ResourceBundle::Delegate::GetFontList. #

Total comments: 2
Unified diffs Side-by-side diffs Stats (+287 lines, -217 lines)
M build/android/pylib/gtest/filter/ui_unittests_disabled View 1 chunk +1 line, -1 line 0 comments
M chrome/browser/ui/views/location_bar/location_bar_view.cc View 4 chunks +23 lines, -18 lines 0 comments
M chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h View 5 chunks +6 lines, -6 lines 0 comments
M chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc View 5 chunks +9 lines, -8 lines 0 comments
M chrome/browser/ui/views/omnibox/omnibox_result_view.h View 3 chunks +3 lines, -3 lines 0 comments
M chrome/browser/ui/views/omnibox/omnibox_result_view.cc View 4 chunks +10 lines, -8 lines 0 comments
M chrome/browser/ui/views/omnibox/omnibox_view_views.h View 1 chunk +1 line, -1 line 0 comments
M chrome/browser/ui/views/omnibox/omnibox_view_views.cc View 4 chunks +4 lines, -4 lines 0 comments
M chrome/browser/ui/views/omnibox/omnibox_view_win.h View 3 chunks +4 lines, -5 lines 0 comments
M chrome/browser/ui/views/omnibox/omnibox_view_win.cc View 9 chunks +16 lines, -15 lines 0 comments
M chrome/browser/ui/views/omnibox/omnibox_views.h View 2 chunks +2 lines, -2 lines 0 comments
M chrome/browser/ui/views/omnibox/omnibox_views.cc View 1 chunk +3 lines, -3 lines 0 comments
M chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h View 3 chunks +6 lines, -5 lines 0 comments
M chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.cc View 4 chunks +7 lines, -7 lines 0 comments
M ui/base/resource/resource_bundle.h View 5 chunks +22 lines, -14 lines 0 comments
M ui/base/resource/resource_bundle.cc View 3 chunks +70 lines, -48 lines 2 comments
M ui/base/resource/resource_bundle_unittest.cc View 3 chunks +7 lines, -2 lines 0 comments
M ui/gfx/font_list.h View 1 chunk +6 lines, -0 lines 0 comments
M ui/gfx/font_list.cc View 2 chunks +16 lines, -0 lines 0 comments
M ui/gfx/render_text.h View 1 chunk +1 line, -1 line 0 comments
M ui/gfx/render_text.cc View 2 chunks +6 lines, -5 lines 0 comments
M ui/gfx/render_text_linux.cc View 1 chunk +1 line, -2 lines 0 comments
M ui/gfx/render_text_mac.cc View 1 chunk +1 line, -1 line 0 comments
M ui/gfx/render_text_unittest.cc View 2 chunks +3 lines, -3 lines 0 comments
M ui/gfx/render_text_win.cc View 1 chunk +1 line, -1 line 0 comments
M ui/views/controls/textfield/native_textfield_views.cc View 5 chunks +5 lines, -19 lines 0 comments
M ui/views/controls/textfield/native_textfield_win.cc View 2 chunks +4 lines, -3 lines 0 comments
M ui/views/controls/textfield/textfield.h View 3 chunks +7 lines, -5 lines 0 comments
M ui/views/controls/textfield/textfield.cc View 6 chunks +24 lines, -11 lines 0 comments
M ui/views/examples/multiline_example.cc View 1 chunk +1 line, -1 line 0 comments
M ui/views/touchui/touch_selection_controller_impl_unittest.cc View 8 chunks +17 lines, -15 lines 0 comments

Messages

Total messages: 35 (0 generated)
Yuki
This CL is incomplete. I need to fix unit tests to follow the interface change. ...
7 years, 5 months ago (2013-07-23 15:26:03 UTC) #1
Alexei Svitkine (slow)
https://codereview.chromium.org/19666006/diff/1/ui/gfx/render_text.h File ui/gfx/render_text.h (right): https://codereview.chromium.org/19666006/diff/1/ui/gfx/render_text.h#newcode148 ui/gfx/render_text.h:148: const Font& GetPrimaryFont() const; I think RenderTextWin uses GetFont(), ...
7 years, 5 months ago (2013-07-23 15:29:26 UTC) #2
msw
Can you explain why FontList support is needed to solve the defect for Issue 263169? ...
7 years, 5 months ago (2013-07-23 19:51:54 UTC) #3
Peter Kasting
I'll wait to review pending the answer to Mike's larger question of whether this is ...
7 years, 5 months ago (2013-07-23 22:28:43 UTC) #4
Yuki
CalculateFontAndOffsetForHeight() in location_bar_view.cc determines font size so the text fits in the Omnibox. As we've ...
7 years, 5 months ago (2013-07-24 09:17:05 UTC) #5
Alexei Svitkine (slow)
On 2013/07/24 09:17:05, Yuki wrote: > CalculateFontAndOffsetForHeight() in location_bar_view.cc determines font size > so the ...
7 years, 5 months ago (2013-07-24 15:31:59 UTC) #6
Yuki
On 2013/07/24 15:31:59, Alexei Svitkine wrote: > On 2013/07/24 09:17:05, Yuki wrote: > > CalculateFontAndOffsetForHeight() ...
7 years, 5 months ago (2013-07-24 16:35:10 UTC) #7
Yuki
By the way, this CL doesn't fix http://crbug.com/263196 . I thought the root cause would ...
7 years, 5 months ago (2013-07-24 16:51:37 UTC) #8
msw
On 2013/07/24 09:17:05, Yuki wrote: > CalculateFontAndOffsetForHeight() in location_bar_view.cc determines font size > so the ...
7 years, 5 months ago (2013-07-25 06:39:23 UTC) #9
Yuki
On 2013/07/25 06:39:23, msw wrote: > On 2013/07/24 09:17:05, Yuki wrote: > > CalculateFontAndOffsetForHeight() in ...
7 years, 5 months ago (2013-07-25 07:13:05 UTC) #10
msw
On 2013/07/25 07:13:05, Yuki wrote: > On 2013/07/25 06:39:23, msw wrote: > > On 2013/07/24 ...
7 years, 5 months ago (2013-07-25 07:40:15 UTC) #11
Alexei Svitkine (slow)
7 years, 5 months ago (2013-07-25 14:54:34 UTC) #12
Alexei Svitkine (slow)
https://codereview.chromium.org/19666006/diff/22001/ui/gfx/font_list.h File ui/gfx/font_list.h (right): https://codereview.chromium.org/19666006/diff/22001/ui/gfx/font_list.h#newcode80 ui/gfx/font_list.h:80: const Font& GetPrimaryFont() const { return GetFonts()[0]; } This ...
7 years, 5 months ago (2013-07-25 14:55:12 UTC) #13
Yuki
Thanks for the review. Now this CL fixes both of http://crbug.com/263169 and http://crbug.com/263196 . Known ...
7 years, 5 months ago (2013-07-25 15:07:42 UTC) #14
Yuki
I think I've fixed Windows and Mac OS X related code, and unit tests. Could ...
7 years, 5 months ago (2013-07-26 18:44:10 UTC) #15
Peter Kasting
c/b/ui/views LGTM assuming msw OKs the general idea of this CL. One major question below. ...
7 years, 5 months ago (2013-07-26 20:54:26 UTC) #16
msw
Can you file an issue to track work to make Views UI elements support FontList ...
7 years, 5 months ago (2013-07-26 21:19:57 UTC) #17
Peter Kasting
https://codereview.chromium.org/19666006/diff/55001/chrome/browser/ui/views/location_bar/location_bar_view.cc File chrome/browser/ui/views/location_bar/location_bar_view.cc (right): https://codereview.chromium.org/19666006/diff/55001/chrome/browser/ui/views/location_bar/location_bar_view.cc#newcode246 chrome/browser/ui/views/location_bar/location_bar_view.cc:246: gfx::FontList font_list(ui::ResourceBundle::GetSharedInstance().GetFont( On 2013/07/26 21:19:57, msw wrote: > It ...
7 years, 5 months ago (2013-07-26 22:17:43 UTC) #18
Yuki
I've updated the code and filed a bug as http://crbug.com/265485 https://codereview.chromium.org/19666006/diff/55001/chrome/browser/ui/views/location_bar/location_bar_view.cc File chrome/browser/ui/views/location_bar/location_bar_view.cc (right): https://codereview.chromium.org/19666006/diff/55001/chrome/browser/ui/views/location_bar/location_bar_view.cc#newcode122 ...
7 years, 4 months ago (2013-07-29 15:27:20 UTC) #19
Yuki
I've updated ResourceBundleTest, and I think everything has been done. Could you take another look? ...
7 years, 4 months ago (2013-07-30 13:22:12 UTC) #20
msw
LGTM with nits and one minor comment. https://codereview.chromium.org/19666006/diff/94001/ui/base/resource/resource_bundle.h File ui/base/resource/resource_bundle.h (right): https://codereview.chromium.org/19666006/diff/94001/ui/base/resource/resource_bundle.h#newcode236 ui/base/resource/resource_bundle.h:236: // Returns ...
7 years, 4 months ago (2013-07-30 21:32:27 UTC) #21
Alexei Svitkine (slow)
lgtm
7 years, 4 months ago (2013-07-31 00:22:22 UTC) #22
Yuki
sky@: Could you review this CL as an owner of the following files? ui/base/resource/resource_bundle.cc ui/base/resource/resource_bundle.h ...
7 years, 4 months ago (2013-07-31 05:38:42 UTC) #23
sky
views LGTM +tony for ui/base/resources
7 years, 4 months ago (2013-07-31 15:28:26 UTC) #24
tony
ui/base LGTM https://codereview.chromium.org/19666006/diff/131001/ui/base/resource/resource_bundle.h File ui/base/resource/resource_bundle.h (right): https://codereview.chromium.org/19666006/diff/131001/ui/base/resource/resource_bundle.h#newcode112 ui/base/resource/resource_bundle.h:112: virtual scoped_ptr<gfx::FontList> GetFontList(FontStyle style) = 0; I ...
7 years, 4 months ago (2013-07-31 17:23:47 UTC) #25
Yuki
Thank guys for reviewing this CL. I'm going to commit this CL. If you have ...
7 years, 4 months ago (2013-08-01 07:49:29 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yukishiino@chromium.org/19666006/139001
7 years, 4 months ago (2013-08-01 07:50:58 UTC) #27
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 4 months ago (2013-08-01 08:18:55 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yukishiino@chromium.org/19666006/141002
7 years, 4 months ago (2013-08-01 08:54:03 UTC) #29
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 4 months ago (2013-08-01 09:54:07 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yukishiino@chromium.org/19666006/187001
7 years, 4 months ago (2013-08-01 13:47:46 UTC) #31
Yuki
https://codereview.chromium.org/19666006/diff/131001/ui/base/resource/resource_bundle.h File ui/base/resource/resource_bundle.h (right): https://codereview.chromium.org/19666006/diff/131001/ui/base/resource/resource_bundle.h#newcode112 ui/base/resource/resource_bundle.h:112: virtual scoped_ptr<gfx::FontList> GetFontList(FontStyle style) = 0; On 2013/08/01 07:49:30, ...
7 years, 4 months ago (2013-08-01 13:50:00 UTC) #32
tony
ui/base/resource LGTM https://codereview.chromium.org/19666006/diff/187001/ui/base/resource/resource_bundle.cc File ui/base/resource/resource_bundle.cc (right): https://codereview.chromium.org/19666006/diff/187001/ui/base/resource/resource_bundle.cc#newcode618 ui/base/resource/resource_bundle.cc:618: else Nit: else not needed.
7 years, 4 months ago (2013-08-01 16:48:07 UTC) #33
commit-bot: I haz the power
Change committed as 215055
7 years, 4 months ago (2013-08-01 17:01:56 UTC) #34
Yuki
7 years, 4 months ago (2013-08-02 06:00:28 UTC) #35
Message was sent while issue was closed.
https://codereview.chromium.org/19666006/diff/187001/ui/base/resource/resourc...
File ui/base/resource/resource_bundle.cc (right):

https://codereview.chromium.org/19666006/diff/187001/ui/base/resource/resourc...
ui/base/resource/resource_bundle.cc:618: else
On 2013/08/01 16:48:07, tony wrote:
> Nit: else not needed.

Sent out a CL http://crrev.com/21734002
Thanks.

Powered by Google App Engine