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

Unified Diff: chrome/browser/ui/autofill/chrome_autofill_client.cc

Issue 2641643002: Suppress Autofill popup if it would be outside the viewport. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/autofill/chrome_autofill_client.cc
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.cc b/chrome/browser/ui/autofill/chrome_autofill_client.cc
index 6b85038c7ef3f6ec306378270330550825c2d9fc..01583c02de0ee00cb0466c8dfcb7cfd12079e669 100644
--- a/chrome/browser/ui/autofill/chrome_autofill_client.cc
+++ b/chrome/browser/ui/autofill/chrome_autofill_client.cc
@@ -253,6 +253,16 @@ void ChromeAutofillClient::ShowAutofillPopup(
base::WeakPtr<AutofillPopupDelegate> delegate) {
// Convert element_bounds to be in screen space.
gfx::Rect client_area = web_contents()->GetContainerBounds();
+
+ // Element bounds are relative to the viewport (client_area).
+ if ((element_bounds.y() + element_bounds.height()) < 0 ||
Evan Stade 2017/01/18 00:05:46 nit: element_bounds.bottom()
lgarron 2017/04/05 00:59:42 Ooh, good to know.
+ (element_bounds.y() + element_bounds.height()) >= client_area.height()) {
Evan Stade 2017/01/18 00:05:46 what about the x direction? Seems like this should
lgarron 2017/04/05 00:59:43 Oh, right. I explicitly discussed this with estark
+ // The top of the popup would be outside the viewport (and would disappear
+ // before the relevant field can scroll into the viewport), so we supress
Evan Stade 2017/01/18 00:05:46 nit: suppress
lgarron 2017/04/05 00:59:41 Done.
+ // it to avoid crbug.com/678713
+ return;
+ }
+
gfx::RectF element_bounds_in_screen_space =
element_bounds + client_area.OffsetFromOrigin();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698