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

Unified Diff: chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc

Issue 10073018: Add Delete Support to New Autofill UI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Adding profile and credit card deleteion Created 8 years, 8 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/gtk/autofill/autofill_popup_view_gtk.cc
diff --git a/chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc b/chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc
index ed1f84a20708654b80bdc23e00aa4d833440537e..894c7bb718c5b2c07706e23e4729dca4edec4965 100644
--- a/chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc
+++ b/chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc
@@ -82,21 +82,16 @@ void AutofillPopupViewGtk::ShowInternal() {
gint origin_x, origin_y;
gdk_window_get_origin(gtk_widget_get_window(parent_), &origin_x, &origin_y);
- int popup_width = GetPopupRequiredWidth();
-
// Move the popup to appear right below the text field it is using.
bounds_.SetRect(
origin_x + element_bounds().x(),
origin_y + element_bounds().y() + element_bounds().height(),
- popup_width,
+ GetPopupRequiredWidth(),
row_height_ * autofill_values().size());
gtk_window_move(GTK_WINDOW(window_), bounds_.x(), bounds_.y());
- gtk_widget_set_size_request(
- window_,
- popup_width,
- row_height_ * autofill_values().size());
+ ResizePopup();
render_view_host_->AddKeyboardListener(this);
@@ -120,6 +115,13 @@ void AutofillPopupViewGtk::InvalidateRow(size_t row) {
gdk_window_invalidate_rect(gdk_window, &row_rect, FALSE);
}
+void AutofillPopupViewGtk::ResizePopup() {
+ gtk_widget_set_size_request(
+ window_,
+ GetPopupRequiredWidth(),
+ row_height_ * autofill_values().size());
+}
+
gboolean AutofillPopupViewGtk::HandleButtonRelease(GtkWidget* widget,
GdkEventButton* event) {
// We only care about the left click.
@@ -220,6 +222,9 @@ gboolean AutofillPopupViewGtk::HandleMotion(GtkWidget* widget,
}
bool AutofillPopupViewGtk::HandleKeyPressEvent(GdkEventKey* event) {
+ // Filter modifier to only include accelerator modifiers.
+ guint modifier = event->state & gtk_accelerator_get_default_mod_mask();
+
switch (event->keyval) {
case GDK_Up:
SelectPreviousLine();
@@ -238,7 +243,7 @@ bool AutofillPopupViewGtk::HandleKeyPressEvent(GdkEventKey* event) {
return true;
case GDK_Delete:
case GDK_KP_Delete:
- return (event->state == GDK_SHIFT_MASK) && RemoveSelectedLine();
+ return (modifier == GDK_SHIFT_MASK) && RemoveSelectedLine();
case GDK_Return:
case GDK_KP_Enter:
return AcceptSelectedLine();

Powered by Google App Engine
This is Rietveld 408576698