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

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

Issue 361001: While changing the label class I added a DCHECK to make sure the function... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 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 | 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) 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 #include <limits> 8 #include <limits>
9 9
10 #include "app/gfx/canvas.h" 10 #include "app/gfx/canvas.h"
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 411 }
412 return insets; 412 return insets;
413 } 413 }
414 414
415 // static 415 // static
416 gfx::Font Label::GetDefaultFont() { 416 gfx::Font Label::GetDefaultFont() {
417 return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); 417 return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont);
418 } 418 }
419 419
420 void Label::UpdateContainsMouse(const MouseEvent& event) { 420 void Label::UpdateContainsMouse(const MouseEvent& event) {
421 SetContainsMouse(GetTextBounds().Contains(event.x(), event.y())); 421 if (is_multi_line_) {
422 gfx::Rect rect(width(), GetHeightForWidth(width()));
423 SetContainsMouse(rect.Contains(event.x(), event.y()));
424 } else {
425 SetContainsMouse(GetTextBounds().Contains(event.x(), event.y()));
426 }
422 } 427 }
423 428
424 void Label::SetContainsMouse(bool contains_mouse) { 429 void Label::SetContainsMouse(bool contains_mouse) {
425 if (contains_mouse_ == contains_mouse) 430 if (contains_mouse_ == contains_mouse)
426 return; 431 return;
427 contains_mouse_ = contains_mouse; 432 contains_mouse_ = contains_mouse;
428 if (GetMouseOverBackground()) 433 if (GetMouseOverBackground())
429 SchedulePaint(); 434 SchedulePaint();
430 } 435 }
431 436
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 } 499 }
495 500
496 bool Label::GetAccessibleState(AccessibilityTypes::State* state) { 501 bool Label::GetAccessibleState(AccessibilityTypes::State* state) {
497 DCHECK(state); 502 DCHECK(state);
498 503
499 *state = AccessibilityTypes::STATE_READONLY; 504 *state = AccessibilityTypes::STATE_READONLY;
500 return true; 505 return true;
501 } 506 }
502 507
503 } // namespace views 508 } // 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