| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 canvas->ClipRect(display_rect_); | 344 canvas->ClipRect(display_rect_); |
| 345 | 345 |
| 346 // Draw the selection. | 346 // Draw the selection. |
| 347 std::vector<Rect> selection(GetSubstringBounds(GetSelectionStart(), | 347 std::vector<Rect> selection(GetSubstringBounds(GetSelectionStart(), |
| 348 GetCursorPosition())); | 348 GetCursorPosition())); |
| 349 SkColor selection_color = | 349 SkColor selection_color = |
| 350 focused() ? kFocusedSelectionColor : kUnfocusedSelectionColor; | 350 focused() ? kFocusedSelectionColor : kUnfocusedSelectionColor; |
| 351 for (std::vector<Rect>::const_iterator i = selection.begin(); | 351 for (std::vector<Rect>::const_iterator i = selection.begin(); |
| 352 i < selection.end(); ++i) { | 352 i < selection.end(); ++i) { |
| 353 Rect r(*i); | 353 Rect r(*i); |
| 354 canvas->FillRectInt(selection_color, r.x(), r.y(), r.width(), r.height()); | 354 canvas->FillRect(selection_color, r); |
| 355 } | 355 } |
| 356 | 356 |
| 357 // Create a temporary copy of the style ranges for composition and selection. | 357 // Create a temporary copy of the style ranges for composition and selection. |
| 358 StyleRanges style_ranges(style_ranges_); | 358 StyleRanges style_ranges(style_ranges_); |
| 359 ApplyCompositionAndSelectionStyles(&style_ranges); | 359 ApplyCompositionAndSelectionStyles(&style_ranges); |
| 360 | 360 |
| 361 // Draw the text. | 361 // Draw the text. |
| 362 Rect bounds(display_rect_); | 362 Rect bounds(display_rect_); |
| 363 bounds.Offset(GetUpdatedDisplayOffset()); | 363 bounds.Offset(GetUpdatedDisplayOffset()); |
| 364 for (StyleRanges::const_iterator i = style_ranges.begin(); | 364 for (StyleRanges::const_iterator i = style_ranges.begin(); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 // LTR character. | 653 // LTR character. |
| 654 // | 654 // |
| 655 // Pan to show the cursor when it overflows to the left. | 655 // Pan to show the cursor when it overflows to the left. |
| 656 delta_offset = display_rect_.x() - cursor_bounds_.x(); | 656 delta_offset = display_rect_.x() - cursor_bounds_.x(); |
| 657 } | 657 } |
| 658 display_offset_.Offset(delta_offset, 0); | 658 display_offset_.Offset(delta_offset, 0); |
| 659 cursor_bounds_.Offset(delta_offset, 0); | 659 cursor_bounds_.Offset(delta_offset, 0); |
| 660 } | 660 } |
| 661 | 661 |
| 662 } // namespace gfx | 662 } // namespace gfx |
| OLD | NEW |