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

Unified Diff: views/controls/textfield/text_style.cc

Issue 7265011: RenderText API Outline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix permissions, export RenderText and StyleRange via UI_API. Created 9 years, 5 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: views/controls/textfield/text_style.cc
diff --git a/views/controls/textfield/text_style.cc b/views/controls/textfield/text_style.cc
deleted file mode 100644
index 18400c6d720db68c191b1732da7ca5a685a9feec..0000000000000000000000000000000000000000
--- a/views/controls/textfield/text_style.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2011 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 "views/controls/textfield/text_style.h"
-
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/canvas_skia.h"
-#include "ui/gfx/font.h"
-
-namespace {
-// Text color for read only.
-const SkColor kReadonlyTextColor = SK_ColorDKGRAY;
-
-// Strike line width.
-const int kStrikeWidth = 2;
-}
-
-namespace views {
-
-TextStyle::TextStyle()
- : foreground_(SK_ColorBLACK),
- strike_(false),
- underline_(false) {
-}
-
-TextStyle::~TextStyle() {
-}
-
-void TextStyle::DrawString(gfx::Canvas* canvas,
- string16& text,
- gfx::Font& base_font,
- bool readonly,
- int x, int y, int width, int height) const {
- SkColor text_color = readonly ? kReadonlyTextColor : foreground_;
-
- gfx::Font font = underline_ ?
- base_font.DeriveFont(0, base_font.GetStyle() | gfx::Font::UNDERLINED) :
- base_font;
- canvas->DrawStringInt(text, font, text_color, x, y, width, height);
- if (strike_) {
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setStyle(SkPaint::kFill_Style);
- paint.setColor(text_color);
- paint.setStrokeWidth(kStrikeWidth);
- canvas->AsCanvasSkia()->drawLine(
- SkIntToScalar(x), SkIntToScalar(y + height),
- SkIntToScalar(x + width), SkIntToScalar(y),
- paint);
- }
-}
-
-} // namespace views

Powered by Google App Engine
This is Rietveld 408576698