diff options
author | calamity@chromium.org <calamity@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-03 05:03:52 +0000 |
---|---|---|
committer | calamity@chromium.org <calamity@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-03 05:03:52 +0000 |
commit | a986d32fafa9771b9b9220d0981b55c35ad8ad8c (patch) | |
tree | a74e46b80ec0660300e0836d3e53070e54904738 /ui | |
parent | 29ece2e3956bafccd4b9a72937677b03cf7ed637 (diff) | |
download | chromium_src-a986d32fafa9771b9b9220d0981b55c35ad8ad8c.zip chromium_src-a986d32fafa9771b9b9220d0981b55c35ad8ad8c.tar.gz chromium_src-a986d32fafa9771b9b9220d0981b55c35ad8ad8c.tar.bz2 |
Fix app list position in windows
BubbleDelegate::GetAnchorRect() should not inset an anchor point. This was
causing the app list to appear behind the taskbar.
BUG=222912
Review URL: https://chromiumcodereview.appspot.com/13142003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191990 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app_list/views/app_list_view.cc | 8 | ||||
-rw-r--r-- | ui/views/bubble/bubble_delegate.cc | 7 | ||||
-rw-r--r-- | ui/views/bubble/bubble_delegate.h | 27 | ||||
-rw-r--r-- | ui/views/touchui/touch_editing_menu.cc | 6 | ||||
-rw-r--r-- | ui/views/touchui/touch_selection_controller_impl.cc | 2 |
5 files changed, 23 insertions, 27 deletions
diff --git a/ui/app_list/views/app_list_view.cc b/ui/app_list/views/app_list_view.cc index 7105cf1..3b6b694 100644 --- a/ui/app_list/views/app_list_view.cc +++ b/ui/app_list/views/app_list_view.cc @@ -84,15 +84,15 @@ void AppListView::InitAsBubble( OnSigninStatusChanged(); set_anchor_view(anchor); - set_anchor_point(anchor_point); + set_anchor_rect(gfx::Rect(anchor_point, gfx::Size())); set_color(kContentsBackgroundColor); set_margins(gfx::Insets()); set_move_with_anchor(true); set_parent_window(parent); set_close_on_deactivate(false); set_close_on_esc(false); - set_anchor_insets(gfx::Insets(kArrowOffset, kArrowOffset, - kArrowOffset, kArrowOffset)); + set_anchor_view_insets(gfx::Insets(kArrowOffset, kArrowOffset, + kArrowOffset, kArrowOffset)); set_border_accepts_events(border_accepts_events); set_shadow(views::BubbleBorder::BIG_SHADOW); views::BubbleDelegateView::CreateBubble(this); @@ -119,7 +119,7 @@ void AppListView::SetBubbleArrowLocation( } void AppListView::SetAnchorPoint(const gfx::Point& anchor_point) { - set_anchor_point(anchor_point); + set_anchor_rect(gfx::Rect(anchor_point, gfx::Size())); SizeToContents(); // Repositions view relative to the anchor. } diff --git a/ui/views/bubble/bubble_delegate.cc b/ui/views/bubble/bubble_delegate.cc index 4f372c4..abfa8a5 100644 --- a/ui/views/bubble/bubble_delegate.cc +++ b/ui/views/bubble/bubble_delegate.cc @@ -231,9 +231,10 @@ void BubbleDelegateView::OnWidgetBoundsChanged(Widget* widget, } gfx::Rect BubbleDelegateView::GetAnchorRect() { - gfx::Rect anchor_bounds = anchor_view() ? anchor_view()->GetBoundsInScreen() : - gfx::Rect(anchor_point_, gfx::Size()); - anchor_bounds.Inset(anchor_insets_); + if (!anchor_view()) + return anchor_rect_; + gfx::Rect anchor_bounds = anchor_view()->GetBoundsInScreen(); + anchor_bounds.Inset(anchor_view_insets_); return anchor_bounds; } diff --git a/ui/views/bubble/bubble_delegate.h b/ui/views/bubble/bubble_delegate.h index de69c5c..7c110e8 100644 --- a/ui/views/bubble/bubble_delegate.h +++ b/ui/views/bubble/bubble_delegate.h @@ -63,8 +63,8 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, View* anchor_view() const { return anchor_view_; } Widget* anchor_widget() const { return anchor_widget_; } - // The anchor point is used in the absence of an anchor view. - const gfx::Point& anchor_point() const { return anchor_point_; } + // The anchor rect is used in the absence of an anchor view. + const gfx::Rect& anchor_rect() const { return anchor_rect_; } BubbleBorder::ArrowLocation arrow_location() const { return arrow_location_; } void set_arrow_location(BubbleBorder::ArrowLocation arrow_location) { @@ -83,8 +83,10 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, const gfx::Insets& margins() const { return margins_; } void set_margins(const gfx::Insets& margins) { margins_ = margins; } - void set_anchor_insets(const gfx::Insets& insets) { anchor_insets_ = insets; } - const gfx::Insets& anchor_insets() const { return anchor_insets_; } + const gfx::Insets& anchor_view_insets() const { return anchor_view_insets_; } + void set_anchor_view_insets(const gfx::Insets& insets) { + anchor_view_insets_ = insets; + } gfx::NativeView parent_window() const { return parent_window_; } void set_parent_window(gfx::NativeView window) { parent_window_ = window; } @@ -121,7 +123,7 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, void SetAlignment(BubbleBorder::BubbleAlignment alignment); protected: - // Get bubble bounds from the anchor point and client view's preferred size. + // Get bubble bounds from the anchor rect and client view's preferred size. virtual gfx::Rect GetBubbleBounds(); // View overrides: @@ -135,14 +137,11 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, // Perform view initialization on the contents for bubble sizing. virtual void Init(); - // Set the anchor view, this (or set_anchor_point) must be done before + // Set the anchor view, this (or set_anchor_rect) must be done before // calling CreateBubble or Show. void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; } - - // The anchor point or anchor view must be set before calling CreateBubble or - // Show. - void set_anchor_point(gfx::Point anchor_point) { - anchor_point_ = anchor_point; + void set_anchor_rect(gfx::Rect anchor_rect) { + anchor_rect_ = anchor_rect; } bool move_with_anchor() const { return move_with_anchor_; } @@ -179,8 +178,8 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, View* anchor_view_; Widget* anchor_widget_; - // The anchor point used in the absence of an anchor view. - gfx::Point anchor_point_; + // The anchor rect used in the absence of an anchor view. + gfx::Rect anchor_rect_; // If true, the bubble will re-anchor (and may resize) with |anchor_widget_|. bool move_with_anchor_; @@ -199,7 +198,7 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, gfx::Insets margins_; // Insets applied to the |anchor_view_| bounds. - gfx::Insets anchor_insets_; + gfx::Insets anchor_view_insets_; // Original opacity of the bubble. int original_opacity_; diff --git a/ui/views/touchui/touch_editing_menu.cc b/ui/views/touchui/touch_editing_menu.cc index aa332b7..0d618db 100644 --- a/ui/views/touchui/touch_editing_menu.cc +++ b/ui/views/touchui/touch_editing_menu.cc @@ -61,11 +61,7 @@ TouchEditingMenuView::TouchEditingMenuView( gfx::NativeView context) : BubbleDelegateView(NULL, views::BubbleBorder::BOTTOM_CENTER), controller_(controller) { - set_anchor_point(anchor_rect.CenterPoint()); - set_anchor_insets(gfx::Insets(-anchor_rect.height() / 2, - -anchor_rect.width() / 2, - -anchor_rect.height() / 2, - -anchor_rect.width() / 2)); + set_anchor_rect(anchor_rect); set_shadow(views::BubbleBorder::SMALL_SHADOW); set_parent_window(context); set_margins(gfx::Insets()); diff --git a/ui/views/touchui/touch_selection_controller_impl.cc b/ui/views/touchui/touch_selection_controller_impl.cc index 39d3695..6f78c96 100644 --- a/ui/views/touchui/touch_selection_controller_impl.cc +++ b/ui/views/touchui/touch_selection_controller_impl.cc @@ -303,7 +303,7 @@ void TouchSelectionControllerImpl::ExecuteCommand(int command_id, } void TouchSelectionControllerImpl::OpenContextMenu() { - gfx::Point anchor = context_menu_->anchor_point(); + gfx::Point anchor = context_menu_->anchor_rect().origin(); anchor.Offset(0, -kSelectionHandleRadius); HideContextMenu(); client_view_->OpenContextMenu(anchor); |