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

Unified Diff: ui/gfx/render_text_linux.cc

Issue 25039002: Always aligns text at vertically center (Textfield, Label). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced. Created 7 years, 2 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 | « ui/gfx/render_text_linux.h ('k') | ui/gfx/render_text_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text_linux.cc
diff --git a/ui/gfx/render_text_linux.cc b/ui/gfx/render_text_linux.cc
index 4b7b93474aeb6e6e4e4816818d1920af46ff36e4..3166875758b65568c7a83d99c403e85097c34f3c 100644
--- a/ui/gfx/render_text_linux.cc
+++ b/ui/gfx/render_text_linux.cc
@@ -91,15 +91,6 @@ Size RenderTextLinux::GetStringSize() {
return Size(width, std::max(height, font_list().GetHeight()));
}
-int RenderTextLinux::GetBaseline() {
- EnsureLayout();
- // Keep a consistent baseline between this particular string's PangoLayout and
- // potentially larger text supported by the FontList.
- // See the example in GetStringSize().
- return std::max(PANGO_PIXELS(pango_layout_get_baseline(layout_)),
- font_list().GetBaseline());
-}
-
SelectionModel RenderTextLinux::FindCursorPosition(const Point& point) {
EnsureLayout();
@@ -146,6 +137,11 @@ std::vector<RenderText::FontSpan> RenderTextLinux::GetFontSpansForTesting() {
return spans;
}
+int RenderTextLinux::GetLayoutTextBaseline() {
+ EnsureLayout();
+ return PANGO_PIXELS(pango_layout_get_baseline(layout_));
+}
+
SelectionModel RenderTextLinux::AdjacentCharSelectionModel(
const SelectionModel& selection,
VisualCursorDirection direction) {
@@ -381,7 +377,7 @@ void RenderTextLinux::DrawVisualText(Canvas* canvas) {
DCHECK(layout_);
// Skia will draw glyphs with respect to the baseline.
- Vector2d offset(GetLineOffset(0) + Vector2d(0, GetBaseline()));
+ Vector2d offset(GetLineOffset(0) + Vector2d(0, GetLayoutTextBaseline()));
SkScalar x = SkIntToScalar(offset.x());
SkScalar y = SkIntToScalar(offset.y());
« no previous file with comments | « ui/gfx/render_text_linux.h ('k') | ui/gfx/render_text_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698