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

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: reland - WHAT HERE could have broken media_unittests???? Created 9 years 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
« no previous file with comments | « ui/gfx/canvas_skia_win.cc ('k') | ui/gfx/render_text_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
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());
395 if (cursor_visible() && focused()) 394 if (cursor_visible() && focused())
396 canvas->DrawRectInt(kCursorColor, cursor.x(), cursor.y(), 395 canvas->DrawRect(GetUpdatedCursorBounds(), kCursorColor);
397 cursor.width(), cursor.height());
398 } 396 }
399 397
400 SelectionModel RenderText::FindCursorPosition(const Point& point) { 398 SelectionModel RenderText::FindCursorPosition(const Point& point) {
401 const Font& font = default_style_.font; 399 const Font& font = default_style_.font;
402 int left = 0; 400 int left = 0;
403 int left_pos = 0; 401 int left_pos = 0;
404 int right = font.GetStringWidth(text()); 402 int right = font.GetStringWidth(text());
405 int right_pos = text().length(); 403 int right_pos = text().length();
406 404
407 int x = point.x() - (display_rect_.x() + GetUpdatedDisplayOffset().x()); 405 int x = point.x() - (display_rect_.x() + GetUpdatedDisplayOffset().x());
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 // LTR character. 656 // LTR character.
659 // 657 //
660 // Pan to show the cursor when it overflows to the left. 658 // Pan to show the cursor when it overflows to the left.
661 delta_offset = display_rect_.x() - cursor_bounds_.x(); 659 delta_offset = display_rect_.x() - cursor_bounds_.x();
662 } 660 }
663 display_offset_.Offset(delta_offset, 0); 661 display_offset_.Offset(delta_offset, 0);
664 cursor_bounds_.Offset(delta_offset, 0); 662 cursor_bounds_.Offset(delta_offset, 0);
665 } 663 }
666 664
667 } // namespace gfx 665 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/canvas_skia_win.cc ('k') | ui/gfx/render_text_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698