Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 return SelectionModel(text().length(), caret, SelectionModel::TRAILING); | 213 return SelectionModel(text().length(), caret, SelectionModel::TRAILING); |
| 214 } else { // RTL. | 214 } else { // RTL. |
| 215 size_t caret = Utf8IndexToUtf16Index(item->offset); | 215 size_t caret = Utf8IndexToUtf16Index(item->offset); |
| 216 return SelectionModel(text().length(), caret, SelectionModel::LEADING); | 216 return SelectionModel(text().length(), caret, SelectionModel::LEADING); |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 return SelectionModel(0, 0, SelectionModel::LEADING); | 220 return SelectionModel(0, 0, SelectionModel::LEADING); |
| 221 } | 221 } |
| 222 | 222 |
| 223 bool RenderTextLinux::IsCursorablePosition(size_t position) { | 223 bool RenderTextLinux::IsCursorablePosition(size_t position, bool is_trailing) { |
|
msw
2011/11/29 20:42:00
|is_trailing| is unused here... does it really hav
| |
| 224 if (position == 0 && text().empty()) | 224 if (position == 0 && text().empty()) |
| 225 return true; | 225 return true; |
| 226 | 226 |
| 227 EnsureLayout(); | 227 EnsureLayout(); |
| 228 return (position < static_cast<size_t>(num_log_attrs_) && | 228 return (position < static_cast<size_t>(num_log_attrs_) && |
| 229 log_attrs_[position].is_cursor_position); | 229 log_attrs_[position].is_cursor_position); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void RenderTextLinux::UpdateLayout() { | 232 void RenderTextLinux::UpdateLayout() { |
| 233 ResetLayout(); | 233 ResetLayout(); |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 651 size_t RenderTextLinux::Utf8IndexToUtf16Index(size_t index) const { | 651 size_t RenderTextLinux::Utf8IndexToUtf16Index(size_t index) const { |
| 652 int32_t utf16_index = 0; | 652 int32_t utf16_index = 0; |
| 653 UErrorCode ec = U_ZERO_ERROR; | 653 UErrorCode ec = U_ZERO_ERROR; |
| 654 u_strFromUTF8(NULL, 0, &utf16_index, layout_text_, index, &ec); | 654 u_strFromUTF8(NULL, 0, &utf16_index, layout_text_, index, &ec); |
| 655 DCHECK(ec == U_BUFFER_OVERFLOW_ERROR || | 655 DCHECK(ec == U_BUFFER_OVERFLOW_ERROR || |
| 656 ec == U_STRING_NOT_TERMINATED_WARNING); | 656 ec == U_STRING_NOT_TERMINATED_WARNING); |
| 657 return utf16_index; | 657 return utf16_index; |
| 658 } | 658 } |
| 659 | 659 |
| 660 } // namespace gfx | 660 } // namespace gfx |
| OLD | NEW |