OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // implementation should be used. | 282 // implementation should be used. |
283 if (!View::HitTestRect(gfx::Rect(point, gfx::Size(1, 1)))) | 283 if (!View::HitTestRect(gfx::Rect(point, gfx::Size(1, 1)))) |
284 return NULL; | 284 return NULL; |
285 | 285 |
286 if (tooltip_text_.empty() && !ShouldShowDefaultTooltip()) | 286 if (tooltip_text_.empty() && !ShouldShowDefaultTooltip()) |
287 return NULL; | 287 return NULL; |
288 | 288 |
289 return this; | 289 return this; |
290 } | 290 } |
291 | 291 |
292 bool Label::HitTestRect(const gfx::Rect& rect) const { | 292 bool Label::CanProcessEventsWithinSubtree() const { |
| 293 // Send events to the parent view for handling. |
293 return false; | 294 return false; |
294 } | 295 } |
295 | 296 |
296 bool Label::GetTooltipText(const gfx::Point& p, base::string16* tooltip) const { | 297 bool Label::GetTooltipText(const gfx::Point& p, base::string16* tooltip) const { |
297 DCHECK(tooltip); | 298 DCHECK(tooltip); |
298 | 299 |
299 // If a tooltip has been explicitly set, use it. | 300 // If a tooltip has been explicitly set, use it. |
300 if (!tooltip_text_.empty()) { | 301 if (!tooltip_text_.empty()) { |
301 tooltip->assign(tooltip_text_); | 302 tooltip->assign(tooltip_text_); |
302 return true; | 303 return true; |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 cached_heights_[i] = gfx::Size(); | 558 cached_heights_[i] = gfx::Size(); |
558 } | 559 } |
559 | 560 |
560 bool Label::ShouldShowDefaultTooltip() const { | 561 bool Label::ShouldShowDefaultTooltip() const { |
561 return !is_multi_line_ && !is_obscured_ && | 562 return !is_multi_line_ && !is_obscured_ && |
562 gfx::GetStringWidth(layout_text(), font_list_) > | 563 gfx::GetStringWidth(layout_text(), font_list_) > |
563 GetAvailableRect().width(); | 564 GetAvailableRect().width(); |
564 } | 565 } |
565 | 566 |
566 } // namespace views | 567 } // namespace views |
OLD | NEW |