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

Side by Side Diff: ui/views/controls/tabbed_pane/tabbed_pane.cc

Issue 1819753003: Allow various font weights in gfx. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a lost comment and modify a render text unittest to not test black because of test env font con… Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/styled_label_unittest.cc ('k') | ui/views/examples/multiline_example.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" 5 #include "ui/views/controls/tabbed_pane/tabbed_pane.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "third_party/skia/include/core/SkPaint.h" 9 #include "third_party/skia/include/core/SkPaint.h"
10 #include "third_party/skia/include/core/SkPath.h" 10 #include "third_party/skia/include/core/SkPath.h"
(...skipping 10 matching lines...) Expand all
21 21
22 namespace { 22 namespace {
23 23
24 // TODO(markusheintz|msw): Use NativeTheme colors. 24 // TODO(markusheintz|msw): Use NativeTheme colors.
25 const SkColor kTabTitleColor_Inactive = SkColorSetRGB(0x64, 0x64, 0x64); 25 const SkColor kTabTitleColor_Inactive = SkColorSetRGB(0x64, 0x64, 0x64);
26 const SkColor kTabTitleColor_Active = SK_ColorBLACK; 26 const SkColor kTabTitleColor_Active = SK_ColorBLACK;
27 const SkColor kTabTitleColor_Hovered = SK_ColorBLACK; 27 const SkColor kTabTitleColor_Hovered = SK_ColorBLACK;
28 const SkColor kTabBorderColor = SkColorSetRGB(0xC8, 0xC8, 0xC8); 28 const SkColor kTabBorderColor = SkColorSetRGB(0xC8, 0xC8, 0xC8);
29 const SkScalar kTabBorderThickness = 1.0f; 29 const SkScalar kTabBorderThickness = 1.0f;
30 30
31 const gfx::Font::FontStyle kHoverStyle = gfx::Font::NORMAL; 31 const gfx::Font::Weight kHoverWeight = gfx::Font::Weight::NORMAL;
32 const gfx::Font::FontStyle kActiveStyle = gfx::Font::BOLD; 32 const gfx::Font::Weight kActiveWeight = gfx::Font::Weight::BOLD;
33 const gfx::Font::FontStyle kInactiveStyle = gfx::Font::NORMAL; 33 const gfx::Font::Weight kInactiveWeight = gfx::Font::Weight::NORMAL;
34 34
35 } // namespace 35 } // namespace
36 36
37 namespace views { 37 namespace views {
38 38
39 // static 39 // static
40 const char TabbedPane::kViewClassName[] = "TabbedPane"; 40 const char TabbedPane::kViewClassName[] = "TabbedPane";
41 41
42 // The tab view shown in the tab strip. 42 // The tab view shown in the tab strip.
43 class Tab : public View { 43 class Tab : public View {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 // static 105 // static
106 const char Tab::kViewClassName[] = "Tab"; 106 const char Tab::kViewClassName[] = "Tab";
107 107
108 Tab::Tab(TabbedPane* tabbed_pane, const base::string16& title, View* contents) 108 Tab::Tab(TabbedPane* tabbed_pane, const base::string16& title, View* contents)
109 : tabbed_pane_(tabbed_pane), 109 : tabbed_pane_(tabbed_pane),
110 title_(new Label( 110 title_(new Label(
111 title, 111 title,
112 ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( 112 ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta(
113 ui::kLabelFontSizeDelta, 113 ui::kLabelFontSizeDelta,
114 kActiveStyle))), 114 gfx::Font::NORMAL,
115 kActiveWeight))),
115 tab_state_(TAB_ACTIVE), 116 tab_state_(TAB_ACTIVE),
116 contents_(contents) { 117 contents_(contents) {
117 // Calculate this now while the font list is guaranteed to be bold. 118 // Calculate this now while the font list is guaranteed to be bold.
118 preferred_title_size_ = title_->GetPreferredSize(); 119 preferred_title_size_ = title_->GetPreferredSize();
119 120
120 SetState(TAB_INACTIVE); 121 SetState(TAB_INACTIVE);
121 AddChildView(title_); 122 AddChildView(title_);
122 } 123 }
123 124
124 Tab::~Tab() {} 125 Tab::~Tab() {}
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 183
183 void Tab::SetState(TabState tab_state) { 184 void Tab::SetState(TabState tab_state) {
184 if (tab_state == tab_state_) 185 if (tab_state == tab_state_)
185 return; 186 return;
186 tab_state_ = tab_state; 187 tab_state_ = tab_state;
187 188
188 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 189 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
189 switch (tab_state) { 190 switch (tab_state) {
190 case TAB_INACTIVE: 191 case TAB_INACTIVE:
191 title_->SetEnabledColor(kTabTitleColor_Inactive); 192 title_->SetEnabledColor(kTabTitleColor_Inactive);
192 title_->SetFontList( 193 title_->SetFontList(rb.GetFontListWithDelta(
193 rb.GetFontListWithDelta(ui::kLabelFontSizeDelta, kInactiveStyle)); 194 ui::kLabelFontSizeDelta, gfx::Font::NORMAL, kInactiveWeight));
194 break; 195 break;
195 case TAB_ACTIVE: 196 case TAB_ACTIVE:
196 title_->SetEnabledColor(kTabTitleColor_Active); 197 title_->SetEnabledColor(kTabTitleColor_Active);
197 title_->SetFontList( 198 title_->SetFontList(rb.GetFontListWithDelta(
198 rb.GetFontListWithDelta(ui::kLabelFontSizeDelta, kActiveStyle)); 199 ui::kLabelFontSizeDelta, gfx::Font::NORMAL, kActiveWeight));
199 break; 200 break;
200 case TAB_HOVERED: 201 case TAB_HOVERED:
201 title_->SetEnabledColor(kTabTitleColor_Hovered); 202 title_->SetEnabledColor(kTabTitleColor_Hovered);
202 title_->SetFontList( 203 title_->SetFontList(rb.GetFontListWithDelta(
203 rb.GetFontListWithDelta(ui::kLabelFontSizeDelta, kHoverStyle)); 204 ui::kLabelFontSizeDelta, gfx::Font::NORMAL, kHoverWeight));
204 break; 205 break;
205 } 206 }
206 SchedulePaint(); 207 SchedulePaint();
207 } 208 }
208 209
209 // static 210 // static
210 const char TabStrip::kViewClassName[] = "TabStrip"; 211 const char TabStrip::kViewClassName[] = "TabStrip";
211 212
212 TabStrip::TabStrip(TabbedPane* tabbed_pane) : tabbed_pane_(tabbed_pane) {} 213 TabStrip::TabStrip(TabbedPane* tabbed_pane) : tabbed_pane_(tabbed_pane) {}
213 214
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 selected_tab->NotifyAccessibilityEvent( 407 selected_tab->NotifyAccessibilityEvent(
407 ui::AX_EVENT_FOCUS, true); 408 ui::AX_EVENT_FOCUS, true);
408 } 409 }
409 } 410 }
410 411
411 void TabbedPane::GetAccessibleState(ui::AXViewState* state) { 412 void TabbedPane::GetAccessibleState(ui::AXViewState* state) {
412 state->role = ui::AX_ROLE_TAB_LIST; 413 state->role = ui::AX_ROLE_TAB_LIST;
413 } 414 }
414 415
415 } // namespace views 416 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/styled_label_unittest.cc ('k') | ui/views/examples/multiline_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698