Index: ui/gfx/render_text_win.cc |
diff --git a/ui/gfx/render_text_win.cc b/ui/gfx/render_text_win.cc |
index 80fdffc04ac6e63999558b8260fdd8db9d5a7781..8ff322a85fc0f023d130cfc8e37f643e80330d78 100644 |
--- a/ui/gfx/render_text_win.cc |
+++ b/ui/gfx/render_text_win.cc |
@@ -317,54 +317,6 @@ SelectionModel RenderTextWin::AdjacentCharSelectionModel( |
LastSelectionModelInsideRun(run); |
} |
-// TODO(msw): Implement word breaking for Windows. |
-SelectionModel RenderTextWin::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; |
- |
- size_t pos; |
- if (direction == CURSOR_RIGHT) { |
- pos = std::min(selection.caret_pos() + 1, text().length()); |
- while (iter.Advance()) { |
- pos = iter.pos(); |
- if (iter.IsWord() && pos > selection.caret_pos()) |
- break; |
- } |
- } else { // direction == CURSOR_LEFT |
- // Notes: We always iterate words from the beginning. |
- // This is probably fast enough for our usage, but we may |
- // want to modify WordIterator so that it can start from the |
- // middle of string and advance backwards. |
- pos = std::max<int>(selection.caret_pos() - 1, 0); |
- while (iter.Advance()) { |
- if (iter.IsWord()) { |
- size_t begin = iter.pos() - iter.GetString().length(); |
- if (begin == selection.caret_pos()) { |
- // The cursor is at the beginning of a word. |
- // Move to previous word. |
- break; |
- } else if (iter.pos() >= selection.caret_pos()) { |
- // The cursor is in the middle or at the end of a word. |
- // Move to the top of current word. |
- pos = begin; |
- break; |
- } else { |
- pos = iter.pos() - iter.GetString().length(); |
- } |
- } |
- } |
- } |
- return SelectionModel(pos, CURSOR_FORWARD); |
-} |
- |
ui::Range RenderTextWin::GetGlyphBounds(size_t index) { |
const size_t run_index = |
GetRunContainingCaret(SelectionModel(index, CURSOR_FORWARD)); |