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

Unified Diff: ui/gfx/canvas_skia.cc

Issue 585053002: Use RenderText vertical centering on Label and CanvasSkia text. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update LabelTest expectations. Created 6 years, 3 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
« no previous file with comments | « no previous file | ui/views/controls/label.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/canvas_skia.cc
diff --git a/ui/gfx/canvas_skia.cc b/ui/gfx/canvas_skia.cc
index 8d1311faf391614b335471409ca015e07d0c2191..2f9bd605ff804d1e3f7793e8193c89ad156fc76d 100644
--- a/ui/gfx/canvas_skia.cc
+++ b/ui/gfx/canvas_skia.cc
@@ -124,10 +124,7 @@ void UpdateRenderText(const Rect& rect,
render_text->SetFontList(font_list);
render_text->SetText(text);
render_text->SetCursorEnabled(false);
-
- Rect display_rect = rect;
- display_rect.set_height(font_list.GetHeight());
- render_text->SetDisplayRect(display_rect);
+ render_text->SetDisplayRect(rect);
// Set the text alignment explicitly based on the directionality of the UI,
// if not specified.
@@ -303,11 +300,6 @@ void Canvas::DrawStringRectWithShadows(const base::string16& text,
UpdateRenderText(rect, adjusted_text, font_list, flags, color,
render_text.get());
-
- const int text_height = render_text->GetStringSize().height();
- rect += Vector2d(0, (text_bounds.height() - text_height) / 2);
- rect.set_height(text_height);
- render_text->SetDisplayRect(rect);
if (range.IsValid())
render_text->ApplyStyle(UNDERLINE, true, range);
render_text->Draw(this);
@@ -396,11 +388,6 @@ void Canvas::DrawFadedString(const base::string16& text,
UpdateRenderText(rect, text, font_list, flags, color, render_text.get());
render_text->SetElideBehavior(FADE_TAIL);
- const int line_height = render_text->GetStringSize().height();
- rect += Vector2d(0, (display_rect.height() - line_height) / 2);
- rect.set_height(line_height);
- render_text->SetDisplayRect(rect);
-
canvas_->save();
ClipRect(display_rect);
render_text->Draw(this);
« no previous file with comments | « no previous file | ui/views/controls/label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698