[Webkit-unassigned] [Bug 27443] [Gtk] Combobox should support "find-as-you-type" search

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 15 02:08:06 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=27443





--- Comment #13 from Philippe Normand <pnormand at igalia.com>  2010-07-15 02:08:06 PST ---
(From update of attachment 60537)

>+// Test keypresses to see if they are to be passed to the event handler
>+bool PopupMenu::isKeyPressToZap(GdkEventKey* event, PopupMenu* that)
>+{
>+    guint keyval = gdk_unicode_to_keyval(event->keyval);
>+
>+    if (keyval == (event->keyval | 0x01000000)) {
>+        if (event->keyval == GDK_Delete)
>+            resetWord(that);
>+        return true;
>+    }
>+
>+    return false;
>+}

I'm not sure to understand the purpose of the first test, maybe adding a comment about it would be good?


> 
>+// Search the word typed on the keyboard in the PopupMenu and select the
>+// correspnding menuItem if found
>+bool PopupMenu::menuSearchItem(GtkWidget* widget, GdkEventKey* event, PopupMenu* that)
>+{
>+    ASSERT(that->m_popup);
>+
>+    GList* searchDomain = 0, *searchDomainNext = 0;
>+
>+    if (!isKeyPressToZap(event, that)) {
>+        if (that->searchedWord.empty()) {
>+            searchDomain = gtk_container_get_children(GTK_CONTAINER(that->m_popup.get()));
>+            that->searchDomainList.push_front(searchDomain);
>+        }
>+
>+        that->searchedWord += event->keyval;
>+        std::list<GList*>::iterator it = that->searchDomainList.begin();
>+
>+        if (search(*it, that->searchedWord, searchDomain)) {
>+            GList* p = searchDomain;
>+            gtk_menu_shell_select_item(GTK_MENU_SHELL(that->m_popup.get()), GTK_WIDGET(p->data));
>+            if (buildDomain(searchDomain, that->searchedWord, *it, searchDomainNext))
>+                that->searchDomainList.push_front(searchDomainNext);
>+            return true;
>+        }
>+    }
>+
>+    return false;
>+}

what about an early check here? Something like

if (isKeyPressToZap(event, that))
    return false;

I'm no reviewer, this is just some feedback on your patch :)

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list