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

Side by Side Diff: ui/views/controls/label.cc

Issue 8764005: views::Label should paint borders in the overridden OnPaint() method. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « no previous file | no next file » | 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/views/controls/label.h" 5 #include "ui/views/controls/label.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <vector> 10 #include <vector>
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 } 306 }
307 307
308 void Label::OnPaint(gfx::Canvas* canvas) { 308 void Label::OnPaint(gfx::Canvas* canvas) {
309 OnPaintBackground(canvas); 309 OnPaintBackground(canvas);
310 310
311 string16 paint_text; 311 string16 paint_text;
312 gfx::Rect text_bounds; 312 gfx::Rect text_bounds;
313 int flags = 0; 313 int flags = 0;
314 CalculateDrawStringParams(&paint_text, &text_bounds, &flags); 314 CalculateDrawStringParams(&paint_text, &text_bounds, &flags);
315 PaintText(canvas, paint_text, text_bounds, flags); 315 PaintText(canvas, paint_text, text_bounds, flags);
316 OnPaintFocusBorder(canvas);
sky 2011/12/01 01:02:42 Do these really need to be after painting the text
varunjain 2011/12/01 05:12:03 You are correct that we can just do View::OnPaint(
317 OnPaintBorder(canvas);
316 } 318 }
317 319
318 void Label::OnPaintBackground(gfx::Canvas* canvas) { 320 void Label::OnPaintBackground(gfx::Canvas* canvas) {
319 const Background* bg = contains_mouse_ ? GetMouseOverBackground() : NULL; 321 const Background* bg = contains_mouse_ ? GetMouseOverBackground() : NULL;
320 if (!bg) 322 if (!bg)
321 bg = background(); 323 bg = background();
322 if (bg) 324 if (bg)
323 bg->Paint(canvas, this); 325 bg->Paint(canvas, this);
324 } 326 }
325 327
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 // it is right aligned. Otherwise, its directionality is forced to be LTR. 496 // it is right aligned. Otherwise, its directionality is forced to be LTR.
495 if (rtl_alignment_mode_ == AUTO_DETECT_ALIGNMENT) { 497 if (rtl_alignment_mode_ == AUTO_DETECT_ALIGNMENT) {
496 if (horiz_alignment_ == ALIGN_RIGHT) 498 if (horiz_alignment_ == ALIGN_RIGHT)
497 *flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY; 499 *flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY;
498 else 500 else
499 *flags |= gfx::Canvas::FORCE_LTR_DIRECTIONALITY; 501 *flags |= gfx::Canvas::FORCE_LTR_DIRECTIONALITY;
500 } 502 }
501 } 503 }
502 504
503 } // namespace views 505 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698