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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 // to an opaque background. What we don't want to find is an ancestor in the | 460 // to an opaque background. What we don't want to find is an ancestor in the |
461 // hierarchy that paints to a non-opaque layer. | 461 // hierarchy that paints to a non-opaque layer. |
462 if (lines_.empty() || lines_[0]->subpixel_rendering_suppressed()) | 462 if (lines_.empty() || lines_[0]->subpixel_rendering_suppressed()) |
463 return; | 463 return; |
464 | 464 |
465 for (View* view = this; view; view = view->parent()) { | 465 for (View* view = this; view; view = view->parent()) { |
466 if (view->background() && | 466 if (view->background() && |
467 SkColorGetA(view->background()->get_color()) == SK_AlphaOPAQUE) | 467 SkColorGetA(view->background()->get_color()) == SK_AlphaOPAQUE) |
468 break; | 468 break; |
469 | 469 |
470 if (view->layer()) { | 470 if (view->layer() && view->layer()->fills_bounds_opaquely()) { |
471 DCHECK(view->layer()->fills_bounds_opaquely()) | 471 DLOG(WARNING) << "Ancestor view has a non-opaque layer: " |
472 << " Ancestor view has a non-opaque layer: " << view->GetClassName() | 472 << view->GetClassName() << " with ID " << view->id(); |
473 << " with ID " << view->id(); | |
474 break; | 473 break; |
475 } | 474 } |
476 } | 475 } |
477 #endif | 476 #endif |
478 } | 477 } |
479 | 478 |
480 void Label::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 479 void Label::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
481 if (previous_bounds.size() != size()) | 480 if (previous_bounds.size() != size()) |
482 InvalidateLayout(); | 481 InvalidateLayout(); |
483 } | 482 } |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 .WriteText(GetSelectedText()); | 1055 .WriteText(GetSelectedText()); |
1057 } | 1056 } |
1058 | 1057 |
1059 void Label::BuildContextMenuContents() { | 1058 void Label::BuildContextMenuContents() { |
1060 context_menu_contents_.AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY); | 1059 context_menu_contents_.AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY); |
1061 context_menu_contents_.AddItemWithStringId(IDS_APP_SELECT_ALL, | 1060 context_menu_contents_.AddItemWithStringId(IDS_APP_SELECT_ALL, |
1062 IDS_APP_SELECT_ALL); | 1061 IDS_APP_SELECT_ALL); |
1063 } | 1062 } |
1064 | 1063 |
1065 } // namespace views | 1064 } // namespace views |
OLD | NEW |