| 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.h" | 5 #include "ui/gfx/render_text.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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 SkIntToScalar(bounds.bottom()), | 384 SkIntToScalar(bounds.bottom()), |
| 385 SkIntToScalar(bounds.right()), | 385 SkIntToScalar(bounds.right()), |
| 386 SkIntToScalar(bounds.y()), | 386 SkIntToScalar(bounds.y()), |
| 387 paint); | 387 paint); |
| 388 } | 388 } |
| 389 | 389 |
| 390 bounds.set_x(bounds.x() + bounds.width()); | 390 bounds.set_x(bounds.x() + bounds.width()); |
| 391 } | 391 } |
| 392 | 392 |
| 393 // Paint cursor. Replace cursor is drawn as rectangle for now. | 393 // Paint cursor. Replace cursor is drawn as rectangle for now. |
| 394 Rect cursor(GetUpdatedCursorBounds()); |
| 394 if (cursor_visible() && focused()) | 395 if (cursor_visible() && focused()) |
| 395 canvas->DrawRect(GetUpdatedCursorBounds(), kCursorColor); | 396 canvas->DrawRectInt(kCursorColor, cursor.x(), cursor.y(), |
| 397 cursor.width(), cursor.height()); |
| 396 } | 398 } |
| 397 | 399 |
| 398 SelectionModel RenderText::FindCursorPosition(const Point& point) { | 400 SelectionModel RenderText::FindCursorPosition(const Point& point) { |
| 399 const Font& font = default_style_.font; | 401 const Font& font = default_style_.font; |
| 400 int left = 0; | 402 int left = 0; |
| 401 int left_pos = 0; | 403 int left_pos = 0; |
| 402 int right = font.GetStringWidth(text()); | 404 int right = font.GetStringWidth(text()); |
| 403 int right_pos = text().length(); | 405 int right_pos = text().length(); |
| 404 | 406 |
| 405 int x = point.x() - (display_rect_.x() + GetUpdatedDisplayOffset().x()); | 407 int x = point.x() - (display_rect_.x() + GetUpdatedDisplayOffset().x()); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 // LTR character. | 658 // LTR character. |
| 657 // | 659 // |
| 658 // Pan to show the cursor when it overflows to the left. | 660 // Pan to show the cursor when it overflows to the left. |
| 659 delta_offset = display_rect_.x() - cursor_bounds_.x(); | 661 delta_offset = display_rect_.x() - cursor_bounds_.x(); |
| 660 } | 662 } |
| 661 display_offset_.Offset(delta_offset, 0); | 663 display_offset_.Offset(delta_offset, 0); |
| 662 cursor_bounds_.Offset(delta_offset, 0); | 664 cursor_bounds_.Offset(delta_offset, 0); |
| 663 } | 665 } |
| 664 | 666 |
| 665 } // namespace gfx | 667 } // namespace gfx |
| OLD | NEW |