Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/autofill/autofill_popup_view_views.h" | 5 #include "chrome/browser/ui/views/autofill/autofill_popup_view_views.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" | 7 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" |
| 8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" |
| 10 #include "ui/base/keycodes/keyboard_codes.h" | 10 #include "ui/base/keycodes/keyboard_codes.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 int top_of_popup = 0; | 230 int top_of_popup = 0; |
| 231 if (GetScreenSize().height() < bottom_of_field + popup_height) { | 231 if (GetScreenSize().height() < bottom_of_field + popup_height) { |
| 232 // The popup must appear above the field. | 232 // The popup must appear above the field. |
| 233 top_of_popup = controller_->element_bounds().y() - popup_height; | 233 top_of_popup = controller_->element_bounds().y() - popup_height; |
| 234 } else { | 234 } else { |
| 235 // The popup can appear below the field. | 235 // The popup can appear below the field. |
| 236 top_of_popup = bottom_of_field; | 236 top_of_popup = bottom_of_field; |
| 237 } | 237 } |
| 238 | 238 |
| 239 controller_->SetPopupBounds(gfx::Rect( | 239 controller_->SetPopupBounds(gfx::Rect( |
| 240 controller_->element_bounds().x(), | 240 controller_->popup_bounds().x(), |
| 241 top_of_popup, | 241 top_of_popup, |
| 242 controller_->GetPopupRequiredWidth(), | 242 controller_->GetPopupRequiredWidth(), |
| 243 popup_height)); | 243 popup_height)); |
| 244 } | 244 } |
|
Ilya Sherman
2013/01/11 23:05:35
WDYT -- should all of this logic be moved into the
csharp
2013/01/14 20:32:33
Done. This was just created because I didn't know
| |
| 245 | 245 |
| 246 gfx::Size AutofillPopupViewViews::GetScreenSize() { | 246 gfx::Size AutofillPopupViewViews::GetScreenSize() { |
| 247 gfx::Screen* screen = | 247 gfx::Screen* screen = |
| 248 gfx::Screen::GetScreenFor(controller_->container_view()); | 248 gfx::Screen::GetScreenFor(controller_->container_view()); |
| 249 gfx::Display display = | 249 gfx::Display display = |
| 250 screen->GetDisplayNearestPoint(controller_->element_bounds().origin()); | 250 screen->GetDisplayNearestPoint(controller_->element_bounds().origin()); |
| 251 | 251 |
| 252 return display.GetSizeInPixel(); | 252 return display.GetSizeInPixel(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 AutofillPopupView* AutofillPopupView::Create( | 255 AutofillPopupView* AutofillPopupView::Create( |
| 256 AutofillPopupController* controller) { | 256 AutofillPopupController* controller) { |
| 257 return new AutofillPopupViewViews(controller); | 257 return new AutofillPopupViewViews(controller); |
| 258 } | 258 } |
| OLD | NEW |