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

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

Issue 338001: Get the About panel to align its links correctly, (Closed)
Patch Set: Found some leftover cruft in files. Created 11 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/color_utils.h" 10 #include "app/gfx/color_utils.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 const GURL Label::GetURL() const { 258 const GURL Label::GetURL() const {
259 if (url_set_) 259 if (url_set_)
260 return url_; 260 return url_;
261 else 261 else
262 return GURL(WideToUTF8(text_)); 262 return GURL(WideToUTF8(text_));
263 } 263 }
264 264
265 gfx::Size Label::GetTextSize() { 265 gfx::Size Label::GetTextSize() {
266 if (!text_size_valid_) { 266 if (!text_size_valid_) {
267 text_size_.SetSize(font_.GetStringWidth(text_), font_.height()); 267 int w = 0, h = 0;
Evan Stade 2009/10/23 18:06:29 nit: move declaration to where it's used
DaveMoore 2009/10/23 18:11:10 To me...this is where it's used. All three declara
268 gfx::Canvas cc(0, 0, true);
269 int flags = is_multi_line_ ? ComputeMultiLineFlags() : 0;
270
271 cc.SizeStringInt(text_, font_, &w, &h, flags);
272 text_size_.SetSize(w, h);
268 if (highlighted_) 273 if (highlighted_)
269 text_size_.Enlarge(1, 1); 274 text_size_.Enlarge(1, 1);
270 text_size_valid_ = true; 275 text_size_valid_ = true;
271 } 276 }
272 277
273 return text_size_; 278 return text_size_;
274 } 279 }
275 280
276 int Label::GetHeightForWidth(int w) { 281 int Label::GetHeightForWidth(int w) {
277 if (is_multi_line_) { 282 if (is_multi_line_) {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 493 }
489 494
490 bool Label::GetAccessibleState(AccessibilityTypes::State* state) { 495 bool Label::GetAccessibleState(AccessibilityTypes::State* state) {
491 DCHECK(state); 496 DCHECK(state);
492 497
493 *state = AccessibilityTypes::STATE_READONLY; 498 *state = AccessibilityTypes::STATE_READONLY;
494 return true; 499 return true;
495 } 500 }
496 501
497 } // namespace views 502 } // namespace views
OLDNEW
« chrome/browser/views/about_chrome_view.cc ('K') | « chrome/browser/views/about_chrome_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698