Index: ui/views/bubble/bubble_delegate.cc |
diff --git a/ui/views/bubble/bubble_delegate.cc b/ui/views/bubble/bubble_delegate.cc |
index 72f20b87af519a9cfe43fba2c3a0dd8fb8eaffc7..2592270b1fdd4c1d39789085760130af6052e148 100644 |
--- a/ui/views/bubble/bubble_delegate.cc |
+++ b/ui/views/bubble/bubble_delegate.cc |
@@ -154,12 +154,12 @@ void BubbleDelegateView::OnWidgetActivationChanged(Widget* widget, |
} |
} |
-gfx::Point BubbleDelegateView::GetAnchorPoint() { |
+gfx::Rect BubbleDelegateView::GetAnchorRect() { |
if (!anchor_view()) |
- return gfx::Point(); |
+ return gfx::Rect(); |
BubbleBorder::ArrowLocation location = GetArrowLocation(); |
- gfx::Point anchor(anchor_view()->bounds().CenterPoint()); |
+ gfx::Point anchor; |
// By default, pick the middle of |anchor_view_|'s edge opposite the arrow. |
if (BubbleBorder::is_arrow_on_horizontal(location)) { |
anchor.SetPoint(anchor_view()->width() / 2, |
@@ -168,9 +168,11 @@ gfx::Point BubbleDelegateView::GetAnchorPoint() { |
anchor.SetPoint( |
BubbleBorder::is_arrow_on_left(location) ? anchor_view()->width() : 0, |
anchor_view_->height() / 2); |
+ } else { |
+ anchor = anchor_view()->bounds().CenterPoint(); |
} |
View::ConvertPointToScreen(anchor_view(), &anchor); |
- return anchor; |
+ return gfx::Rect(anchor, gfx::Size()); |
} |
BubbleBorder::ArrowLocation BubbleDelegateView::GetArrowLocation() const { |
@@ -211,6 +213,11 @@ void BubbleDelegateView::ResetFade() { |
GetWidget()->SetOpacity(original_opacity_); |
} |
+void BubbleDelegateView::SetAlignment(BubbleBorder::BubbleAlignment alignment) { |
+ GetBubbleFrameView()->bubble_border()->set_alignment(alignment); |
+ SizeToContents(); |
+} |
+ |
bool BubbleDelegateView::AcceleratorPressed( |
const ui::Accelerator& accelerator) { |
if (!close_on_esc() || accelerator.key_code() != ui::VKEY_ESCAPE) |
@@ -272,8 +279,8 @@ BubbleFrameView* BubbleDelegateView::GetBubbleFrameView() const { |
gfx::Rect BubbleDelegateView::GetBubbleBounds() { |
// The argument rect has its origin at the bubble's arrow anchor point; |
// its size is the preferred size of the bubble's client view (this view). |
- return GetBubbleFrameView()->GetWindowBoundsForClientBounds( |
- gfx::Rect(GetAnchorPoint(), GetPreferredSize())); |
+ return GetBubbleFrameView()->GetWindowBoundsForAnchorAndClientSize( |
+ GetAnchorRect(), GetPreferredSize()); |
} |
#if defined(OS_WIN) && !defined(USE_AURA) |