Chromium Code Reviews| Index: chrome/browser/ui/views/autofill/autofill_popup_view_views.cc |
| diff --git a/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc b/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc |
| index 13a208e2b82fd44da507ecf7141bd672ca336d80..fce1a9f6c03afc4dd64075524a5aaf54c906be91 100644 |
| --- a/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc |
| +++ b/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc |
| @@ -10,11 +10,9 @@ |
| #include "ui/base/keycodes/keyboard_codes.h" |
| #include "ui/base/resource/resource_bundle.h" |
| #include "ui/gfx/canvas.h" |
| -#include "ui/gfx/display.h" |
| #include "ui/gfx/image/image.h" |
| #include "ui/gfx/point.h" |
| #include "ui/gfx/rect.h" |
| -#include "ui/gfx/screen.h" |
| #include "ui/views/border.h" |
| #include "ui/views/widget/widget.h" |
| @@ -126,11 +124,7 @@ void AutofillPopupViewViews::Show() { |
| widget->SetContentsView(this); |
| widget->Show(); |
| - // Allow the popup to appear anywhere on the screen, since it may need |
| - // to go beyond the bounds of the window. |
| - // TODO(csharp): allow the popup to still appear on the border of |
| - // two screens. |
| - widget->SetBounds(gfx::Rect(GetScreenSize())); |
| + widget->SetBounds(controller_->popup_bounds()); |
|
Ilya Sherman
2013/01/15 01:34:45
nit: Should the bounds be set before the widget is
csharp
2013/01/15 22:06:39
Done.
|
| // Setup an observer to check for when the browser moves or changes size, |
| // since the popup should always be hidden in those cases. |
| @@ -141,7 +135,6 @@ void AutofillPopupViewViews::Show() { |
| set_border(views::Border::CreateSolidBorder(kBorderThickness, kBorderColor)); |
| - SetInitialBounds(); |
| UpdateBoundsAndRedrawPopup(); |
| } |
| @@ -221,37 +214,6 @@ void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas, |
| gfx::Canvas::TEXT_ALIGN_CENTER); |
| } |
| -void AutofillPopupViewViews::SetInitialBounds() { |
| - int bottom_of_field = controller_->element_bounds().bottom(); |
| - int popup_height = controller_->GetPopupRequiredHeight(); |
| - |
| - // Find the correct top position of the popup so that it doesn't go off |
| - // the screen. |
| - int top_of_popup = 0; |
| - if (GetScreenSize().height() < bottom_of_field + popup_height) { |
| - // The popup must appear above the field. |
| - top_of_popup = controller_->element_bounds().y() - popup_height; |
| - } else { |
| - // The popup can appear below the field. |
| - top_of_popup = bottom_of_field; |
| - } |
| - |
| - controller_->SetPopupBounds(gfx::Rect( |
| - controller_->element_bounds().x(), |
| - top_of_popup, |
| - controller_->GetPopupRequiredWidth(), |
| - popup_height)); |
| -} |
| - |
| -gfx::Size AutofillPopupViewViews::GetScreenSize() { |
| - gfx::Screen* screen = |
| - gfx::Screen::GetScreenFor(controller_->container_view()); |
| - gfx::Display display = |
| - screen->GetDisplayNearestPoint(controller_->element_bounds().origin()); |
| - |
| - return display.GetSizeInPixel(); |
| -} |
| - |
| AutofillPopupView* AutofillPopupView::Create( |
| AutofillPopupController* controller) { |
| return new AutofillPopupViewViews(controller); |