OLD | NEW |
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_win.h" | 5 #include "ui/gfx/render_text_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/break_iterator.h" | 9 #include "base/i18n/break_iterator.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 if (base::i18n::IsRTL()) | 296 if (base::i18n::IsRTL()) |
297 return base::i18n::RIGHT_TO_LEFT; | 297 return base::i18n::RIGHT_TO_LEFT; |
298 return base::i18n::LEFT_TO_RIGHT; | 298 return base::i18n::LEFT_TO_RIGHT; |
299 } | 299 } |
300 | 300 |
301 Size RenderTextWin::GetStringSize() { | 301 Size RenderTextWin::GetStringSize() { |
302 EnsureLayout(); | 302 EnsureLayout(); |
303 return string_size_; | 303 return string_size_; |
304 } | 304 } |
305 | 305 |
| 306 int RenderTextWin::GetBaseline() { |
| 307 EnsureLayout(); |
| 308 return common_baseline_; |
| 309 } |
| 310 |
306 SelectionModel RenderTextWin::FindCursorPosition(const Point& point) { | 311 SelectionModel RenderTextWin::FindCursorPosition(const Point& point) { |
307 if (text().empty()) | 312 if (text().empty()) |
308 return SelectionModel(); | 313 return SelectionModel(); |
309 | 314 |
310 EnsureLayout(); | 315 EnsureLayout(); |
311 // Find the run that contains the point and adjust the argument location. | 316 // Find the run that contains the point and adjust the argument location. |
312 Point p(ToTextPoint(point)); | 317 Point p(ToTextPoint(point)); |
313 size_t run_index = GetRunContainingPoint(p); | 318 size_t run_index = GetRunContainingPoint(p); |
314 if (run_index == runs_.size()) | 319 if (run_index == runs_.size()) |
315 return EdgeSelectionModel((p.x() < 0) ? CURSOR_LEFT : CURSOR_RIGHT); | 320 return EdgeSelectionModel((p.x() < 0) ? CURSOR_LEFT : CURSOR_RIGHT); |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 const internal::TextRun* run) { | 897 const internal::TextRun* run) { |
893 size_t caret = IndexOfAdjacentGrapheme(run->range.end(), CURSOR_BACKWARD); | 898 size_t caret = IndexOfAdjacentGrapheme(run->range.end(), CURSOR_BACKWARD); |
894 return SelectionModel(caret, CURSOR_FORWARD); | 899 return SelectionModel(caret, CURSOR_FORWARD); |
895 } | 900 } |
896 | 901 |
897 RenderText* RenderText::CreateRenderText() { | 902 RenderText* RenderText::CreateRenderText() { |
898 return new RenderTextWin; | 903 return new RenderTextWin; |
899 } | 904 } |
900 | 905 |
901 } // namespace gfx | 906 } // namespace gfx |
OLD | NEW |