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

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: Suppress Autofill popup if it would be outside the viewport. 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..94be3118640adbf26ec7c7341d92d36fb004844f 100644
--- a/chrome/browser/ui/autofill/chrome_autofill_client.cc
+++ b/chrome/browser/ui/autofill/chrome_autofill_client.cc
@@ -256,6 +256,15 @@ void ChromeAutofillClient::ShowAutofillPopup(
gfx::RectF element_bounds_in_screen_space =
element_bounds + client_area.OffsetFromOrigin();
+ if (element_bounds.IsEmpty() ||
+ !gfx::RectF(client_area).Contains(element_bounds_in_screen_space)) {
+ // The field associated with the popup:
+ // - takes up zero space (and is possibly not in the DOM), or
+ // - is partially or fully outside the viewport,
+ // so we suppress the popup to avoid crbug.com/678713
+ return;
+ }
+
// Will delete or reuse the old |popup_controller_|.
popup_controller_ =
AutofillPopupControllerImpl::GetOrCreate(popup_controller_,
« 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