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

Side by Side Diff: ui/gfx/render_text_linux.cc

Issue 10591003: Expose GetBaseline() method on RenderText. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/render_text_linux.h" 5 #include "ui/gfx/render_text_linux.h"
6 6
7 #include <pango/pangocairo.h> 7 #include <pango/pangocairo.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 return base::i18n::LEFT_TO_RIGHT; 93 return base::i18n::LEFT_TO_RIGHT;
94 } 94 }
95 95
96 Size RenderTextLinux::GetStringSize() { 96 Size RenderTextLinux::GetStringSize() {
97 EnsureLayout(); 97 EnsureLayout();
98 int width = 0, height = 0; 98 int width = 0, height = 0;
99 pango_layout_get_pixel_size(layout_, &width, &height); 99 pango_layout_get_pixel_size(layout_, &width, &height);
100 return Size(width, height); 100 return Size(width, height);
101 } 101 }
102 102
103 int RenderTextLinux::GetBaseline() {
104 EnsureLayout();
105 return PANGO_PIXELS(pango_layout_get_baseline(layout_));
msw 2012/06/22 17:35:38 Does this need that DIP/Hi-DPI function instead?
Alexei Svitkine (slow) 2012/06/22 17:54:07 It doesn't. There's no plan to do subpixel positio
106 }
107
103 SelectionModel RenderTextLinux::FindCursorPosition(const Point& point) { 108 SelectionModel RenderTextLinux::FindCursorPosition(const Point& point) {
104 EnsureLayout(); 109 EnsureLayout();
105 110
106 if (text().empty()) 111 if (text().empty())
107 return SelectionModel(0, CURSOR_FORWARD); 112 return SelectionModel(0, CURSOR_FORWARD);
108 113
109 Point p(ToTextPoint(point)); 114 Point p(ToTextPoint(point));
110 115
111 // When the point is outside of text, return HOME/END position. 116 // When the point is outside of text, return HOME/END position.
112 if (p.x() < 0) 117 if (p.x() < 0)
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 return bounds; 549 return bounds;
545 } 550 }
546 551
547 std::vector<Rect> RenderTextLinux::GetSelectionBounds() { 552 std::vector<Rect> RenderTextLinux::GetSelectionBounds() {
548 if (selection_visual_bounds_.empty()) 553 if (selection_visual_bounds_.empty())
549 selection_visual_bounds_ = CalculateSubstringBounds(selection()); 554 selection_visual_bounds_ = CalculateSubstringBounds(selection());
550 return selection_visual_bounds_; 555 return selection_visual_bounds_;
551 } 556 }
552 557
553 } // namespace gfx 558 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698