Index: ui/app_list/app_list_view.cc |
diff --git a/ui/app_list/app_list_view.cc b/ui/app_list/app_list_view.cc |
index 4280f5dd6e9d808fc127a655c50ab68765ae5a3d..fbf836351e09ee88a722d1ed5d65ef612bf59b82 100644 |
--- a/ui/app_list/app_list_view.cc |
+++ b/ui/app_list/app_list_view.cc |
@@ -13,7 +13,6 @@ |
#include "ui/app_list/search_box_model.h" |
#include "ui/app_list/search_box_view.h" |
#include "ui/gfx/insets.h" |
-#include "ui/gfx/screen.h" |
#include "ui/views/bubble/bubble_frame_view.h" |
#include "ui/views/controls/textfield/textfield.h" |
#include "ui/views/layout/box_layout.h" |
@@ -152,36 +151,15 @@ gfx::Rect AppListView::GetBubbleBounds() { |
if (!bubble_border_) |
return views::BubbleDelegateView::GetBubbleBounds(); |
- const gfx::Point old_offset = bubble_border_->offset(); |
const gfx::Rect anchor_rect = GetAnchorRect(); |
- |
- bubble_border_->set_offset(gfx::Point()); |
gfx::Rect bubble_rect = GetBubbleFrameView()->GetUpdatedWindowBounds( |
anchor_rect, |
GetPreferredSize(), |
false /* try_mirroring_arrow */); |
- gfx::Rect monitor_rect = gfx::Screen::GetDisplayNearestPoint( |
- anchor_rect.CenterPoint()).work_area(); |
- if (monitor_rect.IsEmpty() || monitor_rect.Contains(bubble_rect)) |
- return bubble_rect; |
- |
- gfx::Point offset; |
- |
- if (bubble_border_->ArrowAtTopOrBottom()) { |
- if (bubble_rect.x() < monitor_rect.x()) |
- offset.set_x(monitor_rect.x() - bubble_rect.x()); |
- else if (bubble_rect.right() > monitor_rect.right()) |
- offset.set_x(monitor_rect.right() - bubble_rect.right()); |
- } else if (bubble_border_->ArrowOnLeftOrRight()) { |
- if (bubble_rect.y() < monitor_rect.y()) |
- offset.set_y(monitor_rect.y() - bubble_rect.y()); |
- else if (bubble_rect.bottom() > monitor_rect.bottom()) |
- offset.set_y(monitor_rect.bottom() - bubble_rect.bottom()); |
- } |
- |
- bubble_rect.Offset(offset); |
- bubble_border_->set_offset(offset); |
+ const gfx::Point old_offset = bubble_border_->offset(); |
+ bubble_rect = bubble_border_->ComputeOffsetAndUpdateBubbleRect(bubble_rect, |
+ anchor_rect); |
// Repaints border if arrow offset is changed. |
if (bubble_border_->offset() != old_offset) |