Skip to content

Commit

Permalink
Correct the screen-space positioning of browser-action popup dialogs.
Browse files Browse the repository at this point in the history
Regression was introduced in CL  http://codereview.chromium.org/6334101  

BUG=73353
TEST=None

Review URL: http://codereview.chromium.org/6544020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75454 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
twiz@chromium.org committed Feb 18, 2011
1 parent 33d6752 commit 6ce1ce3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion chrome/browser/ui/views/extensions/extension_popup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,21 @@ void ExtensionPopup::ResizeToView() {
// know our position to do it.
gfx::Size new_size = view()->size();

// |relative_to_| is in browser-relative coordinates, so convert it to
// screen coordinates for use in placing the popup widgets.
gfx::Rect relative_rect = relative_to_;
gfx::Point relative_origin = relative_rect.origin();
views::View::ConvertPointToScreen(frame_->GetRootView(), &relative_origin);
relative_rect.set_origin(relative_origin);

// The rounded corners cut off more of the view than the border insets claim.
// Since we can't clip the ExtensionView's corners, we need to increase the
// inset by half the corner radius as well as lying about the size of the
// contents size to compensate.
int corner_inset = BubbleBorder::GetCornerRadius() / 2;
gfx::Size adjusted_size = new_size;
adjusted_size.Enlarge(2 * corner_inset, 2 * corner_inset);
gfx::Rect rect = border_->GetBounds(relative_to_, adjusted_size);
gfx::Rect rect = border_->GetBounds(relative_rect, adjusted_size);
border_widget_->SetBounds(rect);

// Now calculate the inner bounds. This is a bit more convoluted than
Expand Down

0 comments on commit 6ce1ce3

Please sign in to comment.