Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/views/style/typography.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "ui/views/style/typography_provider.h" | |
| 9 #include "ui/views/views_delegate.h" | |
| 10 | |
| 11 namespace views { | |
| 12 namespace typography { | |
| 13 namespace { | |
| 14 | |
| 15 void ValidateContextAndStyle(int text_context, int text_style) { | |
| 16 DCHECK(ViewsDelegate::GetInstance()); | |
|
Peter Kasting
2017/03/17 02:26:00
Nit: I kinda don't think we should have this, or a
tapted
2017/03/17 10:33:11
removed. I didn't originally have it - the test cr
| |
| 17 DCHECK(text_context > VIEWS_TEXT_CONTEXT_START && | |
|
Peter Kasting
2017/03/17 02:26:00
Nit: Split to two DCHECKs, then change all three D
tapted
2017/03/17 10:33:11
Done.
| |
| 18 text_context < TEXT_CONTEXT_MAX); | |
| 19 DCHECK(text_style > VIEWS_TEXT_STYLE_START); | |
| 20 } | |
| 21 | |
| 22 } // namespace | |
| 23 | |
| 24 const gfx::FontList& GetFont(int text_context, int text_style) { | |
| 25 ValidateContextAndStyle(text_context, text_style); | |
| 26 return ViewsDelegate::GetInstance()->GetTypographyProvider().GetFont( | |
| 27 text_context, text_style); | |
| 28 } | |
| 29 | |
| 30 SkColor GetColor(int text_context, int text_style) { | |
| 31 ValidateContextAndStyle(text_context, text_style); | |
| 32 return ViewsDelegate::GetInstance()->GetTypographyProvider().GetColor( | |
| 33 text_context, text_style); | |
| 34 } | |
| 35 | |
| 36 int GetLineHeight(int text_context, int text_style) { | |
| 37 ValidateContextAndStyle(text_context, text_style); | |
| 38 return ViewsDelegate::GetInstance()->GetTypographyProvider().GetLineHeight( | |
| 39 text_context, text_style); | |
| 40 } | |
| 41 | |
| 42 } // namespace typography | |
| 43 } // namespace views | |
| OLD | NEW |