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

Side by Side Diff: chrome/views/label.cc

Issue 18863: Review request: fix issue 6099 -- bad display of multi-line English message in pop ups (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months 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 | « chrome/views/label.h ('k') | chrome/views/label_unittest.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) 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 "chrome/views/label.h" 5 #include "chrome/views/label.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 27 matching lines...) Expand all
38 void Label::Init(const std::wstring& text, const ChromeFont& font) { 38 void Label::Init(const std::wstring& text, const ChromeFont& font) {
39 contains_mouse_ = false; 39 contains_mouse_ = false;
40 font_ = font; 40 font_ = font;
41 text_size_valid_ = false; 41 text_size_valid_ = false;
42 SetText(text); 42 SetText(text);
43 url_set_ = false; 43 url_set_ = false;
44 color_ = kEnabledColor; 44 color_ = kEnabledColor;
45 horiz_alignment_ = ALIGN_CENTER; 45 horiz_alignment_ = ALIGN_CENTER;
46 is_multi_line_ = false; 46 is_multi_line_ = false;
47 collapse_when_hidden_ = false; 47 collapse_when_hidden_ = false;
48 rtl_alignment_mode_ = USE_UI_ALIGNMENT;
48 } 49 }
49 50
50 Label::~Label() { 51 Label::~Label() {
51 } 52 }
52 53
53 gfx::Size Label::GetPreferredSize() { 54 gfx::Size Label::GetPreferredSize() {
54 gfx::Size prefsize; 55 gfx::Size prefsize;
55 56
56 // Return a size of (0, 0) if the label is not visible and if the 57 // Return a size of (0, 0) if the label is not visible and if the
57 // collapse_when_hidden_ flag is set. 58 // collapse_when_hidden_ flag is set.
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 232
232 void Label::SetColor(const SkColor& color) { 233 void Label::SetColor(const SkColor& color) {
233 color_ = color; 234 color_ = color;
234 } 235 }
235 236
236 const SkColor Label::GetColor() const { 237 const SkColor Label::GetColor() const {
237 return color_; 238 return color_;
238 } 239 }
239 240
240 void Label::SetHorizontalAlignment(Alignment a) { 241 void Label::SetHorizontalAlignment(Alignment a) {
242 // If the View's UI layout is right-to-left and rtl_alignment_mode_ is
243 // USE_UI_ALIGNMENT, we need to flip the alignment so that the alignment
244 // settings take into account the text directionality.
245 if (UILayoutIsRightToLeft() && rtl_alignment_mode_ == USE_UI_ALIGNMENT) {
246 if (a == ALIGN_LEFT)
247 a = ALIGN_RIGHT;
248 else if (a == ALIGN_RIGHT)
249 a = ALIGN_LEFT;
250 }
241 if (horiz_alignment_ != a) { 251 if (horiz_alignment_ != a) {
242
243 // If the View's UI layout is right-to-left, we need to flip the alignment
244 // so that the alignment settings take into account the text
245 // directionality.
246 if (UILayoutIsRightToLeft()) {
247 if (a == ALIGN_LEFT)
248 a = ALIGN_RIGHT;
249 else if (a == ALIGN_RIGHT)
250 a = ALIGN_LEFT;
251 }
252 horiz_alignment_ = a; 252 horiz_alignment_ = a;
253 SchedulePaint(); 253 SchedulePaint();
254 } 254 }
255 } 255 }
256 256
257 Label::Alignment Label::GetHorizontalAlignment() const { 257 Label::Alignment Label::GetHorizontalAlignment() const {
258 return horiz_alignment_; 258 return horiz_alignment_;
259 } 259 }
260 260
261 void Label::SetRTLAlignmentMode(RTLAlignmentMode mode) {
262 rtl_alignment_mode_ = mode;
263 }
264
265 Label::RTLAlignmentMode Label::GetRTLAlignmentMode() const {
266 return rtl_alignment_mode_;
267 }
268
261 void Label::SetMultiLine(bool f) { 269 void Label::SetMultiLine(bool f) {
262 if (f != is_multi_line_) { 270 if (f != is_multi_line_) {
263 is_multi_line_ = f; 271 is_multi_line_ = f;
264 SchedulePaint(); 272 SchedulePaint();
265 } 273 }
266 } 274 }
267 275
268 bool Label::IsMultiLine() { 276 bool Label::IsMultiLine() {
269 return is_multi_line_; 277 return is_multi_line_;
270 } 278 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 410
403 bool Label::GetAccessibleState(VARIANT* state) { 411 bool Label::GetAccessibleState(VARIANT* state) {
404 DCHECK(state); 412 DCHECK(state);
405 413
406 state->lVal |= STATE_SYSTEM_READONLY; 414 state->lVal |= STATE_SYSTEM_READONLY;
407 return true; 415 return true;
408 } 416 }
409 #endif // defined(OS_WIN) 417 #endif // defined(OS_WIN)
410 418
411 } // namespace views 419 } // namespace views
OLDNEW
« no previous file with comments | « chrome/views/label.h ('k') | chrome/views/label_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698