Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1045)

Unified Diff: chrome/browser/ui/views/autofill/autofill_popup_view_views.cc

Issue 11817051: Elide text in the new Autofill UI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..ab9b04be411ac7ab86bb3ec5ba9ec4ee0764a5a0 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"
@@ -124,14 +122,9 @@ void AutofillPopupViewViews::Show() {
params.parent = controller_->container_view();
widget->Init(params);
widget->SetContentsView(this);
+ widget->SetBounds(controller_->popup_bounds());
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()));
-
// Setup an observer to check for when the browser moves or changes size,
// since the popup should always be hidden in those cases.
observing_widget_ = views::Widget::GetTopLevelWidgetForNativeView(
@@ -141,7 +134,6 @@ void AutofillPopupViewViews::Show() {
set_border(views::Border::CreateSolidBorder(kBorderThickness, kBorderColor));
- SetInitialBounds();
UpdateBoundsAndRedrawPopup();
}
@@ -221,37 +213,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);

Powered by Google App Engine
This is Rietveld 408576698