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/bubble/tray_bubble_view.h" | 5 #include "ui/views/bubble/tray_bubble_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 rtl_factor * kOffsetLeftRightForTopBottomOrientation); | 79 rtl_factor * kOffsetLeftRightForTopBottomOrientation); |
80 } else if (arrow() == BubbleBorder::LEFT_BOTTOM) { | 80 } else if (arrow() == BubbleBorder::LEFT_BOTTOM) { |
81 rect.set_x(rect.x() + kArrowOffsetLeft); | 81 rect.set_x(rect.x() + kArrowOffsetLeft); |
82 } else if (arrow() == BubbleBorder::RIGHT_BOTTOM) { | 82 } else if (arrow() == BubbleBorder::RIGHT_BOTTOM) { |
83 rect.set_x(rect.x() + kArrowOffsetRight); | 83 rect.set_x(rect.x() + kArrowOffsetRight); |
84 } | 84 } |
85 } | 85 } |
86 return rect; | 86 return rect; |
87 } | 87 } |
88 | 88 |
89 // TODO(skuhne): With shelf LR alignment, arrow-less messages get | |
90 // automatically offsetted from an open status menu which needs addressing. | |
91 gfx::Size border_size(contents_size); | 89 gfx::Size border_size(contents_size); |
92 gfx::Insets insets = GetInsets(); | 90 gfx::Insets insets = GetInsets(); |
93 border_size.Enlarge(insets.width(), insets.height()); | 91 border_size.Enlarge(insets.width(), insets.height()); |
94 const int x = position_relative_to.x() + | 92 const int x = position_relative_to.x() + |
95 position_relative_to.width() / 2 - border_size.width() / 2; | 93 position_relative_to.width() / 2 - border_size.width() / 2; |
96 // Position the bubble on top of the anchor. | 94 // Position the bubble on top of the anchor. |
97 const int y = position_relative_to.y() - border_size.height() | 95 const int y = position_relative_to.y() - border_size.height() |
98 + insets.height() - kBubbleSpacing; | 96 + insets.height() - kBubbleSpacing; |
99 return gfx::Rect(x, y, border_size.width(), border_size.height()); | 97 return gfx::Rect(x, y, border_size.width(), border_size.height()); |
100 } | 98 } |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 const ViewHierarchyChangedDetails& details) { | 438 const ViewHierarchyChangedDetails& details) { |
441 if (get_use_acceleration_when_possible() && details.is_add && | 439 if (get_use_acceleration_when_possible() && details.is_add && |
442 details.child == this) { | 440 details.child == this) { |
443 details.parent->SetPaintToLayer(true); | 441 details.parent->SetPaintToLayer(true); |
444 details.parent->SetFillsBoundsOpaquely(true); | 442 details.parent->SetFillsBoundsOpaquely(true); |
445 details.parent->layer()->SetMasksToBounds(true); | 443 details.parent->layer()->SetMasksToBounds(true); |
446 } | 444 } |
447 } | 445 } |
448 | 446 |
449 } // namespace views | 447 } // namespace views |
OLD | NEW |