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

Side by Side Diff: views/controls/combobox/native_combobox_views.cc

Issue 8383028: ui/gfx: Convert Canvas::ClipRectInt() 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 "views/controls/combobox/native_combobox_views.h" 5 #include "views/controls/combobox/native_combobox_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 path.lineTo(SkIntToScalar(tip_x - shift_x), SkIntToScalar(tip_y + shift_y)); 295 path.lineTo(SkIntToScalar(tip_x - shift_x), SkIntToScalar(tip_y + shift_y));
296 path.close(); 296 path.close();
297 canvas->GetSkCanvas()->drawPath(path, paint); 297 canvas->GetSkCanvas()->drawPath(path, paint);
298 } 298 }
299 299
300 300
301 void NativeComboboxViews::PaintText(gfx::Canvas* canvas) { 301 void NativeComboboxViews::PaintText(gfx::Canvas* canvas) {
302 gfx::Insets insets = GetInsets(); 302 gfx::Insets insets = GetInsets();
303 303
304 canvas->Save(); 304 canvas->Save();
305 canvas->ClipRectInt(insets.left(), insets.top(), 305 canvas->ClipRectInt(gfx::Rect(insets.left(),
Peter Kasting 2011/10/25 20:24:47 Nit: I think you can just pass GetContentsBounds()
tfarina 2011/10/25 23:52:41 Done.
306 width() - insets.width(), height() - insets.height()); 306 insets.top(),
307 width() - insets.width(),
308 height() - insets.height()));
307 309
308 int x = insets.left(); 310 int x = insets.left();
309 int y = insets.top(); 311 int y = insets.top();
310 int text_height = height() - insets.height(); 312 int text_height = height() - insets.height();
311 SkColor text_color = kTextColor; 313 SkColor text_color = kTextColor;
312 314
313 int index = GetSelectedItem(); 315 int index = GetSelectedItem();
314 if (index < 0 || index > combobox_->model()->GetItemCount()) 316 if (index < 0 || index > combobox_->model()->GetItemCount())
315 index = 0; 317 index = 0;
316 string16 text = combobox_->model()->GetItemAt(index); 318 string16 text = combobox_->model()->GetItemAt(index);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 380
379 #if defined(USE_AURA) 381 #if defined(USE_AURA)
380 // static 382 // static
381 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( 383 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper(
382 Combobox* combobox) { 384 Combobox* combobox) {
383 return new NativeComboboxViews(combobox); 385 return new NativeComboboxViews(combobox);
384 } 386 }
385 #endif 387 #endif
386 388
387 } // namespace views 389 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698