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

Unified Diff: ui/gfx/render_text_linux.cc

Issue 21140002: Consolidate RenderText adjacent word selection model code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup comments and add a unit test.~ Created 7 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
« 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 8700d5d0631bfbbf8cc1395cc1acc7535503ab75..b36ed1db5475beceb5ba8b86f319fa0fe51f1f2a 100644
--- a/ui/gfx/render_text_linux.cc
+++ b/ui/gfx/render_text_linux.cc
@@ -182,34 +182,6 @@ SelectionModel RenderTextLinux::AdjacentCharSelectionModel(
FirstSelectionModelInsideRun(item) : LastSelectionModelInsideRun(item);
}
-SelectionModel RenderTextLinux::AdjacentWordSelectionModel(
- const SelectionModel& selection,
- VisualCursorDirection direction) {
- if (obscured())
- return EdgeSelectionModel(direction);
-
- base::i18n::BreakIterator iter(text(), base::i18n::BreakIterator::BREAK_WORD);
- bool success = iter.Init();
- DCHECK(success);
- if (!success)
- return selection;
-
- SelectionModel cur(selection);
- for (;;) {
- cur = AdjacentCharSelectionModel(cur, direction);
- GSList* run = GetRunContainingCaret(cur);
- if (!run)
- break;
- PangoItem* item = reinterpret_cast<PangoLayoutRun*>(run->data)->item;
- size_t cursor = cur.caret_pos();
- if (IsForwardMotion(direction, item) ?
- iter.IsEndOfWord(cursor) : iter.IsStartOfWord(cursor))
- break;
- }
-
- return cur;
-}
-
ui::Range RenderTextLinux::GetGlyphBounds(size_t index) {
PangoRectangle pos;
pango_layout_index_to_pos(layout_, TextIndexToLayoutIndex(index), &pos);
« 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