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

Unified Diff: ui/gfx/render_text.cc

Issue 7511029: Implement Pango RenderText for Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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/gfx/render_text.cc
===================================================================
--- ui/gfx/render_text.cc (revision 97029)
+++ ui/gfx/render_text.cc (working copy)
@@ -199,8 +199,7 @@
// Cancelling a selection moves to the edge of the selection.
if (break_type != LINE_BREAK && !EmptySelection() && !select) {
// Use the selection start if it is left of the selection end.
- SelectionModel selection_start(GetSelectionStart(), GetSelectionStart(),
- SelectionModel::LEADING);
+ SelectionModel selection_start = GetSelectionModelForSelectionStart();
if (GetCursorBounds(selection_start, false).x() <
GetCursorBounds(position, false).x())
position = selection_start;
@@ -221,8 +220,7 @@
// Cancelling a selection moves to the edge of the selection.
if (break_type != LINE_BREAK && !EmptySelection() && !select) {
// Use the selection start if it is right of the selection end.
- SelectionModel selection_start(GetSelectionStart(), GetSelectionStart(),
- SelectionModel::LEADING);
+ SelectionModel selection_start = GetSelectionModelForSelectionStart();
if (GetCursorBounds(selection_start, false).x() >
GetCursorBounds(position, false).x())
position = selection_start;
@@ -608,4 +606,16 @@
cursor_bounds_.Offset(delta_offset, 0);
}
+SelectionModel RenderText::GetSelectionModelForSelectionStart() {
+ if (GetSelectionStart() < GetCursorPosition()) {
+ return SelectionModel(GetSelectionStart(),
+ GetSelectionStart(),
+ SelectionModel::LEADING);
+ } else {
oshima 2011/08/19 18:44:07 no need for else. (It's chromium style) Alternativ
xji 2011/08/20 00:53:05 removed else.
+ return SelectionModel(GetSelectionStart(),
+ GetIndexOfPreviousGrapheme(GetSelectionStart()),
+ SelectionModel::TRAILING);
+ }
+}
+
} // namespace gfx

Powered by Google App Engine
This is Rietveld 408576698