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

Unified Diff: ui/views/style/typography.cc

Issue 2734113006: "Bootstrap" a toolkit-views Typography spec. (Closed)
Patch Set: Rebase Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/style/typography.cc
diff --git a/ui/views/style/typography.cc b/ui/views/style/typography.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3bc8dc0c487804897bd6f10d7548066625b0da48
--- /dev/null
+++ b/ui/views/style/typography.cc
@@ -0,0 +1,43 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/views/style/typography.h"
+
+#include "base/logging.h"
+#include "ui/views/style/typography_provider.h"
+#include "ui/views/views_delegate.h"
+
+namespace views {
+namespace typography {
+namespace {
+
+void ValidateContextAndStyle(int text_context, int text_style) {
+ 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
+ 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.
+ text_context < TEXT_CONTEXT_MAX);
+ DCHECK(text_style > VIEWS_TEXT_STYLE_START);
+}
+
+} // namespace
+
+const gfx::FontList& GetFont(int text_context, int text_style) {
+ ValidateContextAndStyle(text_context, text_style);
+ return ViewsDelegate::GetInstance()->GetTypographyProvider().GetFont(
+ text_context, text_style);
+}
+
+SkColor GetColor(int text_context, int text_style) {
+ ValidateContextAndStyle(text_context, text_style);
+ return ViewsDelegate::GetInstance()->GetTypographyProvider().GetColor(
+ text_context, text_style);
+}
+
+int GetLineHeight(int text_context, int text_style) {
+ ValidateContextAndStyle(text_context, text_style);
+ return ViewsDelegate::GetInstance()->GetTypographyProvider().GetLineHeight(
+ text_context, text_style);
+}
+
+} // namespace typography
+} // namespace views

Powered by Google App Engine
This is Rietveld 408576698