| 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/i18n/char_iterator.h" | 10 #include "base/i18n/char_iterator.h" |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 | 469 |
| 470 RenderTextWin::RenderTextWin() : RenderText(), needs_layout_(false) { | 470 RenderTextWin::RenderTextWin() : RenderText(), needs_layout_(false) { |
| 471 set_truncate_length(kMaxUniscribeTextLength); | 471 set_truncate_length(kMaxUniscribeTextLength); |
| 472 memset(&script_control_, 0, sizeof(script_control_)); | 472 memset(&script_control_, 0, sizeof(script_control_)); |
| 473 memset(&script_state_, 0, sizeof(script_state_)); | 473 memset(&script_state_, 0, sizeof(script_state_)); |
| 474 MoveCursorTo(EdgeSelectionModel(CURSOR_LEFT)); | 474 MoveCursorTo(EdgeSelectionModel(CURSOR_LEFT)); |
| 475 } | 475 } |
| 476 | 476 |
| 477 RenderTextWin::~RenderTextWin() {} | 477 RenderTextWin::~RenderTextWin() {} |
| 478 | 478 |
| 479 scoped_ptr<RenderText> RenderTextWin::NewInstance() const { |
| 480 return scoped_ptr<RenderTextWin>(new RenderTextWin); |
| 481 } |
| 482 |
| 479 Size RenderTextWin::GetStringSize() { | 483 Size RenderTextWin::GetStringSize() { |
| 480 EnsureLayout(); | 484 EnsureLayout(); |
| 481 return multiline_string_size_; | 485 return multiline_string_size_; |
| 482 } | 486 } |
| 483 | 487 |
| 484 SelectionModel RenderTextWin::FindCursorPosition(const Point& point) { | 488 SelectionModel RenderTextWin::FindCursorPosition(const Point& point) { |
| 485 if (text().empty()) | 489 if (text().empty()) |
| 486 return SelectionModel(); | 490 return SelectionModel(); |
| 487 | 491 |
| 488 EnsureLayout(); | 492 EnsureLayout(); |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 size_t position = LayoutIndexToTextIndex(run->range.end()); | 1252 size_t position = LayoutIndexToTextIndex(run->range.end()); |
| 1249 position = IndexOfAdjacentGrapheme(position, CURSOR_BACKWARD); | 1253 position = IndexOfAdjacentGrapheme(position, CURSOR_BACKWARD); |
| 1250 return SelectionModel(position, CURSOR_FORWARD); | 1254 return SelectionModel(position, CURSOR_FORWARD); |
| 1251 } | 1255 } |
| 1252 | 1256 |
| 1253 RenderText* RenderText::CreateNativeInstance() { | 1257 RenderText* RenderText::CreateNativeInstance() { |
| 1254 return new RenderTextWin; | 1258 return new RenderTextWin; |
| 1255 } | 1259 } |
| 1256 | 1260 |
| 1257 } // namespace gfx | 1261 } // namespace gfx |
| OLD | NEW |