Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: ui/gfx/render_text.cc

Issue 8476019: ui/gfx: Convert Canvas::DrawRectInt() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 SkIntToScalar(bounds.bottom()), 380 SkIntToScalar(bounds.bottom()),
381 SkIntToScalar(bounds.right()), 381 SkIntToScalar(bounds.right()),
382 SkIntToScalar(bounds.y()), 382 SkIntToScalar(bounds.y()),
383 paint); 383 paint);
384 } 384 }
385 385
386 bounds.set_x(bounds.x() + bounds.width()); 386 bounds.set_x(bounds.x() + bounds.width());
387 } 387 }
388 388
389 // Paint cursor. Replace cursor is drawn as rectangle for now. 389 // Paint cursor. Replace cursor is drawn as rectangle for now.
390 Rect cursor(GetUpdatedCursorBounds());
391 if (cursor_visible() && focused()) 390 if (cursor_visible() && focused())
392 canvas->DrawRectInt(kCursorColor, cursor.x(), cursor.y(), 391 canvas->DrawRect(kCursorColor, GetUpdatedCursorBounds());
393 cursor.width(), cursor.height());
394 } 392 }
395 393
396 SelectionModel RenderText::FindCursorPosition(const Point& point) { 394 SelectionModel RenderText::FindCursorPosition(const Point& point) {
397 const Font& font = default_style_.font; 395 const Font& font = default_style_.font;
398 int left = 0; 396 int left = 0;
399 int left_pos = 0; 397 int left_pos = 0;
400 int right = font.GetStringWidth(text()); 398 int right = font.GetStringWidth(text());
401 int right_pos = text().length(); 399 int right_pos = text().length();
402 400
403 int x = point.x() - (display_rect_.x() + GetUpdatedDisplayOffset().x()); 401 int x = point.x() - (display_rect_.x() + GetUpdatedDisplayOffset().x());
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 // LTR character. 651 // LTR character.
654 // 652 //
655 // Pan to show the cursor when it overflows to the left. 653 // Pan to show the cursor when it overflows to the left.
656 delta_offset = display_rect_.x() - cursor_bounds_.x(); 654 delta_offset = display_rect_.x() - cursor_bounds_.x();
657 } 655 }
658 display_offset_.Offset(delta_offset, 0); 656 display_offset_.Offset(delta_offset, 0);
659 cursor_bounds_.Offset(delta_offset, 0); 657 cursor_bounds_.Offset(delta_offset, 0);
660 } 658 }
661 659
662 } // namespace gfx 660 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698