OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/label.h" | 5 #include "views/controls/label.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "app/gfx/canvas.h" | 9 #include "app/gfx/canvas.h" |
10 #include "app/gfx/font.h" | 10 #include "app/gfx/font.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 case ALIGN_CENTER: | 94 case ALIGN_CENTER: |
95 flags |= gfx::Canvas::TEXT_ALIGN_CENTER; | 95 flags |= gfx::Canvas::TEXT_ALIGN_CENTER; |
96 break; | 96 break; |
97 case ALIGN_RIGHT: | 97 case ALIGN_RIGHT: |
98 flags |= gfx::Canvas::TEXT_ALIGN_RIGHT; | 98 flags |= gfx::Canvas::TEXT_ALIGN_RIGHT; |
99 break; | 99 break; |
100 } | 100 } |
101 return flags; | 101 return flags; |
102 } | 102 } |
103 | 103 |
104 void Label::CalculateDrawStringParams( | 104 void Label::CalculateDrawStringParams(std::wstring* paint_text, |
105 std::wstring* paint_text, gfx::Rect* text_bounds, int* flags) { | 105 gfx::Rect* text_bounds, |
| 106 int* flags) { |
106 DCHECK(paint_text && text_bounds && flags); | 107 DCHECK(paint_text && text_bounds && flags); |
107 | 108 |
108 if (url_set_) { | 109 if (url_set_) { |
109 // TODO(jungshik) : Figure out how to get 'intl.accept_languages' | 110 // TODO(jungshik) : Figure out how to get 'intl.accept_languages' |
110 // preference and use it when calling ElideUrl. | 111 // preference and use it when calling ElideUrl. |
111 *paint_text = gfx::ElideUrl(url_, font_, width(), std::wstring()); | 112 *paint_text = gfx::ElideUrl(url_, font_, width(), std::wstring()); |
112 | 113 |
113 // An URLs is always treated as an LTR text and therefore we should | 114 // An URLs is always treated as an LTR text and therefore we should |
114 // explicitly mark it as such if the locale is RTL so that URLs containing | 115 // explicitly mark it as such if the locale is RTL so that URLs containing |
115 // Hebrew or Arabic characters are displayed correctly. | 116 // Hebrew or Arabic characters are displayed correctly. |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 } | 465 } |
465 | 466 |
466 bool Label::GetAccessibleState(AccessibilityTypes::State* state) { | 467 bool Label::GetAccessibleState(AccessibilityTypes::State* state) { |
467 DCHECK(state); | 468 DCHECK(state); |
468 | 469 |
469 *state = AccessibilityTypes::STATE_READONLY; | 470 *state = AccessibilityTypes::STATE_READONLY; |
470 return true; | 471 return true; |
471 } | 472 } |
472 | 473 |
473 } // namespace views | 474 } // namespace views |
OLD | NEW |