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/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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 | 300 |
301 return text_size_; | 301 return text_size_; |
302 } | 302 } |
303 | 303 |
304 void Label::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 304 void Label::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
305 text_size_valid_ &= !is_multi_line_; | 305 text_size_valid_ &= !is_multi_line_; |
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 // We skip painting the focus border because it is being handled seperately by |
| 311 // some subclasses of Label. We do not want View's focus border painting to |
| 312 // interfere with that. |
| 313 OnPaintBorder(canvas); |
310 | 314 |
311 string16 paint_text; | 315 string16 paint_text; |
312 gfx::Rect text_bounds; | 316 gfx::Rect text_bounds; |
313 int flags = 0; | 317 int flags = 0; |
314 CalculateDrawStringParams(&paint_text, &text_bounds, &flags); | 318 CalculateDrawStringParams(&paint_text, &text_bounds, &flags); |
315 PaintText(canvas, paint_text, text_bounds, flags); | 319 PaintText(canvas, paint_text, text_bounds, flags); |
316 } | 320 } |
317 | 321 |
318 void Label::OnPaintBackground(gfx::Canvas* canvas) { | 322 void Label::OnPaintBackground(gfx::Canvas* canvas) { |
319 const Background* bg = contains_mouse_ ? GetMouseOverBackground() : NULL; | 323 const Background* bg = contains_mouse_ ? GetMouseOverBackground() : NULL; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 // it is right aligned. Otherwise, its directionality is forced to be LTR. | 498 // it is right aligned. Otherwise, its directionality is forced to be LTR. |
495 if (rtl_alignment_mode_ == AUTO_DETECT_ALIGNMENT) { | 499 if (rtl_alignment_mode_ == AUTO_DETECT_ALIGNMENT) { |
496 if (horiz_alignment_ == ALIGN_RIGHT) | 500 if (horiz_alignment_ == ALIGN_RIGHT) |
497 *flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY; | 501 *flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY; |
498 else | 502 else |
499 *flags |= gfx::Canvas::FORCE_LTR_DIRECTIONALITY; | 503 *flags |= gfx::Canvas::FORCE_LTR_DIRECTIONALITY; |
500 } | 504 } |
501 } | 505 } |
502 | 506 |
503 } // namespace views | 507 } // namespace views |
OLD | NEW |