OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/style/typography.h" | 5 #include "ui/views/style/typography.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/native_theme/native_theme.h" | 8 #include "ui/native_theme/native_theme.h" |
9 #include "ui/views/layout/layout_provider.h" | 9 #include "ui/views/layout/layout_provider.h" |
10 #include "ui/views/style/typography_provider.h" | 10 #include "ui/views/style/typography_provider.h" |
11 | 11 |
12 namespace views { | 12 namespace views { |
13 namespace style { | 13 namespace style { |
14 namespace { | 14 namespace { |
15 | 15 |
16 void ValidateContextAndStyle(int text_context, int text_style) { | 16 void ValidateContextAndStyle(int context, int style) { |
17 DCHECK_GE(text_context, VIEWS_TEXT_CONTEXT_START); | 17 DCHECK_GE(context, VIEWS_TEXT_CONTEXT_START); |
18 DCHECK_LT(text_context, TEXT_CONTEXT_MAX); | 18 DCHECK_LT(context, TEXT_CONTEXT_MAX); |
19 DCHECK_GE(text_style, VIEWS_TEXT_STYLE_START); | 19 DCHECK_GE(style, VIEWS_TEXT_STYLE_START); |
20 } | 20 } |
21 | 21 |
22 } // namespace | 22 } // namespace |
23 | 23 |
24 const gfx::FontList& GetFont(int text_context, int text_style) { | 24 const gfx::FontList& GetFont(int context, int style) { |
25 ValidateContextAndStyle(text_context, text_style); | 25 ValidateContextAndStyle(context, style); |
26 return LayoutProvider::Get()->GetTypographyProvider().GetFont(text_context, | 26 return LayoutProvider::Get()->GetTypographyProvider().GetFont(context, style); |
27 text_style); | |
28 } | 27 } |
29 | 28 |
30 SkColor GetColor(int text_context, | 29 SkColor GetColor(int context, int style, const ui::NativeTheme* theme) { |
31 int text_style, | 30 ValidateContextAndStyle(context, style); |
32 const ui::NativeTheme* theme) { | |
33 ValidateContextAndStyle(text_context, text_style); | |
34 DCHECK(theme); | 31 DCHECK(theme); |
35 return LayoutProvider::Get()->GetTypographyProvider().GetColor( | 32 return LayoutProvider::Get()->GetTypographyProvider().GetColor(context, style, |
36 text_context, text_style, *theme); | 33 *theme); |
37 } | 34 } |
38 | 35 |
39 int GetLineHeight(int text_context, int text_style) { | 36 int GetLineHeight(int context, int style) { |
40 ValidateContextAndStyle(text_context, text_style); | 37 ValidateContextAndStyle(context, style); |
41 return LayoutProvider::Get()->GetTypographyProvider().GetLineHeight( | 38 return LayoutProvider::Get()->GetTypographyProvider().GetLineHeight(context, |
42 text_context, text_style); | 39 style); |
43 } | 40 } |
44 | 41 |
45 } // namespace style | 42 } // namespace style |
46 } // namespace views | 43 } // namespace views |
OLD | NEW |