[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 00:52:31 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit feec43af282e538f2938a5fabf06f1d8beedc290
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 30 23:08:58 2009 +0000

    2009-12-30  Zelidrag Hornung  <zelidrag at chromium.org>
    
            Reviewed by Dimitri Glazkov.
    
            Autocomplete in Chromium now offers suggestions within the input element as a user
            a) types text that produces some autocomplete suggestions, and
            b) scrolls through suggested values in the menu
            The suggested value is rendered but not exposed through JS unti the
            user makes the final selection.
    
            No new tests since this new functionality (autocomplete suggestions)
            is intentionally hidden from everything else than renderer.
    
            * src/AutocompletePopupMenuClient.cpp:
            (WebKit::AutocompletePopupMenuClient::initialize):
            (WebKit::AutocompletePopupMenuClient::setInitialAutocompleteValue):
            (WebKit::AutocompletePopupMenuClient::selectionChanged):
            (WebKit::AutocompletePopupMenuClient::popupDidHide):
            (WebKit::AutocompletePopupMenuClient::setTextFromItem):
            (WebKit::AutocompletePopupMenuClient::resetLastFieldValue):
            * src/AutocompletePopupMenuClient.h:
    
    2009-12-30  Zelidrag Hornung  <zelidrag at chromium.org>
    
            Reviewed by Dimitri Glazkov.
    
            Added ability for PopupMenuClient to signal when
            a) selection changed, and
            b) weather suggested value should be accepted when popup menu closes
    
            No new tests since this new functionality (autocomplete suggestions)
            is intentionally hidden from everything else than renderer.
    
            * platform/PopupMenuClient.h:
            * platform/chromium/PopupMenuChromium.cpp:
            (WebCore::PopupContainer::hidePopup):
            (WebCore::PopupListBox::handleKeyEvent):
            (WebCore::PopupListBox::abandon):
            (WebCore::PopupListBox::acceptIndex):
            (WebCore::PopupListBox::selectIndex):
            (WebCore::PopupListBox::clearSelection):
            (WebCore::PopupListBox::hidePopup):
            * platform/gtk/PopupMenuGtk.cpp:
            (WebCore::PopupMenu::menuUnmapped):
            * platform/mac/PopupMenuMac.mm:
            (WebCore::PopupMenu::show):
            * platform/qt/QtFallbackWebPopup.cpp:
            (WebCore::QtFallbackWebPopup::hidePopup):
            * platform/win/PopupMenuWin.cpp:
            (WebCore::PopupMenu::hide):
            * platform/wx/PopupMenuWx.cpp:
            (WebCore::PopupMenu::OnMenuItemSelected):
            * rendering/RenderMenuList.cpp:
            (WebCore::RenderMenuList::popupDidHide):
            * rendering/RenderMenuList.h:
            (WebCore::RenderMenuList::selectionChanged):
            * rendering/RenderTextControlSingleLine.cpp:
            (WebCore::RenderTextControlSingleLine::popupDidHide):
            * rendering/RenderTextControlSingleLine.h:
            (WebCore::RenderTextControlSingleLine::selectionChanged):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52673 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 235d86f..1a17dc9 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,42 @@
+2009-12-30  Zelidrag Hornung  <zelidrag at chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Added ability for PopupMenuClient to signal when
+        a) selection changed, and
+        b) weather suggested value should be accepted when popup menu closes
+
+        No new tests since this new functionality (autocomplete suggestions)
+        is intentionally hidden from everything else than renderer.
+
+        * platform/PopupMenuClient.h:
+        * platform/chromium/PopupMenuChromium.cpp:
+        (WebCore::PopupContainer::hidePopup):
+        (WebCore::PopupListBox::handleKeyEvent):
+        (WebCore::PopupListBox::abandon):
+        (WebCore::PopupListBox::acceptIndex):
+        (WebCore::PopupListBox::selectIndex):
+        (WebCore::PopupListBox::clearSelection):
+        (WebCore::PopupListBox::hidePopup):
+        * platform/gtk/PopupMenuGtk.cpp:
+        (WebCore::PopupMenu::menuUnmapped):
+        * platform/mac/PopupMenuMac.mm:
+        (WebCore::PopupMenu::show):
+        * platform/qt/QtFallbackWebPopup.cpp:
+        (WebCore::QtFallbackWebPopup::hidePopup):
+        * platform/win/PopupMenuWin.cpp:
+        (WebCore::PopupMenu::hide):
+        * platform/wx/PopupMenuWx.cpp:
+        (WebCore::PopupMenu::OnMenuItemSelected):
+        * rendering/RenderMenuList.cpp:
+        (WebCore::RenderMenuList::popupDidHide):
+        * rendering/RenderMenuList.h:
+        (WebCore::RenderMenuList::selectionChanged):
+        * rendering/RenderTextControlSingleLine.cpp:
+        (WebCore::RenderTextControlSingleLine::popupDidHide):
+        * rendering/RenderTextControlSingleLine.h:
+        (WebCore::RenderTextControlSingleLine::selectionChanged):
+
 2009-12-30  Nate Chapin  <japhet at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebCore/platform/PopupMenuClient.h b/WebCore/platform/PopupMenuClient.h
index 2614fe2..3f841d5 100644
--- a/WebCore/platform/PopupMenuClient.h
+++ b/WebCore/platform/PopupMenuClient.h
@@ -37,7 +37,7 @@ class PopupMenuClient {
 public:
     virtual ~PopupMenuClient() {}
     virtual void valueChanged(unsigned listIndex, bool fireEvents = true) = 0;
-
+    virtual void selectionChanged(unsigned listIndex, bool fireEvents = true) = 0;
     virtual String itemText(unsigned listIndex) const = 0;
     virtual String itemToolTip(unsigned listIndex) const = 0;
     virtual bool itemIsEnabled(unsigned listIndex) const = 0;
@@ -49,7 +49,7 @@ public:
     virtual int clientPaddingRight() const = 0;
     virtual int listSize() const = 0;
     virtual int selectedIndex() const = 0;
-    virtual void popupDidHide() = 0;
+    virtual void popupDidHide(bool acceptSuggestions) = 0;
     virtual bool itemIsSeparator(unsigned listIndex) const = 0;
     virtual bool itemIsLabel(unsigned listIndex) const = 0;
     virtual bool itemIsSelected(unsigned listIndex) const = 0;
diff --git a/WebCore/platform/chromium/PopupMenuChromium.cpp b/WebCore/platform/chromium/PopupMenuChromium.cpp
index 668a697..7298b27 100644
--- a/WebCore/platform/chromium/PopupMenuChromium.cpp
+++ b/WebCore/platform/chromium/PopupMenuChromium.cpp
@@ -106,7 +106,7 @@ public:
     // PopupListBox methods
 
     // Hides the popup.
-    void hidePopup();
+    void hidePopup(bool acceptSuggestions);
 
     // Updates our internal list to match the client.
     void updateFromElement();
@@ -381,7 +381,7 @@ void PopupContainer::showExternal(const IntRect& rect, FrameView* v, int index)
 
 void PopupContainer::hidePopup()
 {
-    listBox()->hidePopup();
+    listBox()->hidePopup(true);
 }
 
 void PopupContainer::layout()
@@ -631,7 +631,7 @@ bool PopupListBox::handleKeyEvent(const PlatformKeyboardEvent& event)
         return true;
     case VKEY_RETURN:
         if (m_selectedIndex == -1)  {
-            hidePopup();
+            hidePopup(false);
             // Don't eat the enter if nothing is selected.
             return false;
         }
@@ -884,7 +884,7 @@ void PopupListBox::abandon()
 
     m_selectedIndex = m_originalIndex;
 
-    hidePopup();
+    hidePopup(false);
 
     if (m_acceptedIndexOnAbandon >= 0) {
         m_popupClient->valueChanged(m_acceptedIndexOnAbandon);
@@ -917,7 +917,7 @@ void PopupListBox::acceptIndex(int index)
     if (index < 0) {
         if (m_popupClient) {
             // Enter pressed with no selection, just close the popup.
-            hidePopup();
+            hidePopup(false);
         }
         return;
     }
@@ -926,7 +926,7 @@ void PopupListBox::acceptIndex(int index)
         RefPtr<PopupListBox> keepAlive(this);
 
         // Hide ourselves first since valueChanged may have numerous side-effects.
-        hidePopup();
+        hidePopup(true);
 
         // Tell the <select> PopupMenuClient what index was selected.
         m_popupClient->valueChanged(index);
@@ -944,6 +944,7 @@ void PopupListBox::selectIndex(int index)
         invalidateRow(m_selectedIndex);
 
         scrollToRevealSelection();
+        m_popupClient->selectionChanged(m_selectedIndex);
     }
 }
 
@@ -1005,6 +1006,7 @@ void PopupListBox::clearSelection()
     if (m_selectedIndex != -1) {
         invalidateRow(m_selectedIndex);
         m_selectedIndex = -1;
+        m_popupClient->selectionChanged(m_selectedIndex);
     }
 }
 
@@ -1072,7 +1074,7 @@ void PopupListBox::adjustSelectedIndex(int delta)
     scrollToRevealSelection();
 }
 
-void PopupListBox::hidePopup()
+void PopupListBox::hidePopup(bool acceptSuggestions)
 {
     if (parent()) {
         PopupContainer* container = static_cast<PopupContainer*>(parent());
@@ -1080,7 +1082,7 @@ void PopupListBox::hidePopup()
             container->client()->popupClosed(container);
     }
 
-    m_popupClient->popupDidHide();
+    m_popupClient->popupDidHide(acceptSuggestions);
 }
 
 void PopupListBox::updateFromElement()
diff --git a/WebCore/platform/gtk/PopupMenuGtk.cpp b/WebCore/platform/gtk/PopupMenuGtk.cpp
index 0363ac4..96d9e90 100644
--- a/WebCore/platform/gtk/PopupMenuGtk.cpp
+++ b/WebCore/platform/gtk/PopupMenuGtk.cpp
@@ -133,7 +133,7 @@ void PopupMenu::menuItemActivated(GtkMenuItem* item, PopupMenu* that)
 void PopupMenu::menuUnmapped(GtkWidget*, PopupMenu* that)
 {
     ASSERT(that->client());
-    that->client()->popupDidHide();
+    that->client()->popupDidHide(true);
 }
 
 void PopupMenu::menuPositionFunction(GtkMenu*, gint* x, gint* y, gboolean* pushIn, PopupMenu* that)
diff --git a/WebCore/platform/mac/PopupMenuMac.mm b/WebCore/platform/mac/PopupMenuMac.mm
index c1d6994..73fcfb9 100644
--- a/WebCore/platform/mac/PopupMenuMac.mm
+++ b/WebCore/platform/mac/PopupMenuMac.mm
@@ -108,7 +108,7 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index)
     int numItems = [m_popup.get() numberOfItems];
     if (numItems <= 0) {
         if (client())
-            client()->popupDidHide();
+            client()->popupDidHide(true);
         return;
     }
     ASSERT(numItems > index);
@@ -165,7 +165,7 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index)
 
     if (client()) {
         int newIndex = [m_popup.get() indexOfSelectedItem];
-        client()->popupDidHide();
+        client()->popupDidHide(true);
 
         // Adjust newIndex for hidden first item.
         if (!client()->shouldPopOver())
diff --git a/WebCore/platform/qt/QtFallbackWebPopup.cpp b/WebCore/platform/qt/QtFallbackWebPopup.cpp
index 006d06a..fd14b32 100644
--- a/WebCore/platform/qt/QtFallbackWebPopup.cpp
+++ b/WebCore/platform/qt/QtFallbackWebPopup.cpp
@@ -103,7 +103,7 @@ void QtFallbackWebPopup::hidePopup()
         return;
 
     m_popupVisible = false;
-    client()->popupDidHide();
+    client()->popupDidHide(true);
 }
 
 void QtFallbackWebPopup::activeChanged(int index)
diff --git a/WebCore/platform/win/PopupMenuWin.cpp b/WebCore/platform/win/PopupMenuWin.cpp
index 242389b..f3b0ba8 100644
--- a/WebCore/platform/win/PopupMenuWin.cpp
+++ b/WebCore/platform/win/PopupMenuWin.cpp
@@ -274,7 +274,7 @@ void PopupMenu::hide()
     ::ShowWindow(m_popup, SW_HIDE);
 
     if (client())
-        client()->popupDidHide();
+        client()->popupDidHide(true);
 
     // Post a WM_NULL message to wake up the message pump if necessary.
     ::PostMessage(m_popup, WM_NULL, 0, 0);
diff --git a/WebCore/platform/wx/PopupMenuWx.cpp b/WebCore/platform/wx/PopupMenuWx.cpp
index 9b0deba..a338e6a 100644
--- a/WebCore/platform/wx/PopupMenuWx.cpp
+++ b/WebCore/platform/wx/PopupMenuWx.cpp
@@ -88,7 +88,7 @@ void PopupMenu::OnMenuItemSelected(wxCommandEvent& event)
 {
     if (client()) {
         client()->valueChanged(event.GetId() - s_menuStartId);
-        client()->popupDidHide();
+        client()->popupDidHide(true);
     }
     // TODO: Do we need to call Disconnect here? Do we have a ref to the native window still?
 }
diff --git a/WebCore/rendering/RenderMenuList.cpp b/WebCore/rendering/RenderMenuList.cpp
index cbbc7cb..13fe747 100644
--- a/WebCore/rendering/RenderMenuList.cpp
+++ b/WebCore/rendering/RenderMenuList.cpp
@@ -427,7 +427,7 @@ int RenderMenuList::selectedIndex() const
     return select->optionToListIndex(select->selectedIndex());
 }
 
-void RenderMenuList::popupDidHide()
+void RenderMenuList::popupDidHide(bool)
 {
     m_popupIsVisible = false;
 }
diff --git a/WebCore/rendering/RenderMenuList.h b/WebCore/rendering/RenderMenuList.h
index 2d617c1..7ced2a0 100644
--- a/WebCore/rendering/RenderMenuList.h
+++ b/WebCore/rendering/RenderMenuList.h
@@ -82,7 +82,7 @@ private:
     virtual int clientPaddingRight() const;
     virtual int listSize() const;
     virtual int selectedIndex() const;
-    virtual void popupDidHide();
+    virtual void popupDidHide(bool acceptSuggestions);
     virtual bool itemIsSeparator(unsigned listIndex) const;
     virtual bool itemIsLabel(unsigned listIndex) const;
     virtual bool itemIsSelected(unsigned listIndex) const;
@@ -90,6 +90,7 @@ private:
     virtual bool valueShouldChangeOnHotTrack() const { return true; }
     virtual bool shouldPopOver() const { return !POPUP_MENU_PULLS_DOWN; }
     virtual void valueChanged(unsigned listIndex, bool fireOnChange = true);
+    virtual void selectionChanged(unsigned, bool) {}
     virtual FontSelector* fontSelector() const;
     virtual HostWindow* hostWindow() const;
     virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
diff --git a/WebCore/rendering/RenderTextControlSingleLine.cpp b/WebCore/rendering/RenderTextControlSingleLine.cpp
index 1c83466..e3342dd 100644
--- a/WebCore/rendering/RenderTextControlSingleLine.cpp
+++ b/WebCore/rendering/RenderTextControlSingleLine.cpp
@@ -728,7 +728,7 @@ int RenderTextControlSingleLine::selectedIndex() const
     return -1;
 }
 
-void RenderTextControlSingleLine::popupDidHide()
+void RenderTextControlSingleLine::popupDidHide(bool)
 {
     m_searchPopupIsVisible = false;
 }
diff --git a/WebCore/rendering/RenderTextControlSingleLine.h b/WebCore/rendering/RenderTextControlSingleLine.h
index e30ff0d..e47d87e 100644
--- a/WebCore/rendering/RenderTextControlSingleLine.h
+++ b/WebCore/rendering/RenderTextControlSingleLine.h
@@ -98,6 +98,7 @@ private:
 
     // PopupMenuClient methods
     virtual void valueChanged(unsigned listIndex, bool fireEvents = true);
+    virtual void selectionChanged(unsigned, bool) {}
     virtual String itemText(unsigned listIndex) const;
     virtual String itemToolTip(unsigned) const { return String(); }
     virtual bool itemIsEnabled(unsigned listIndex) const;
@@ -109,7 +110,7 @@ private:
     virtual int clientPaddingRight() const;
     virtual int listSize() const;
     virtual int selectedIndex() const;
-    virtual void popupDidHide();
+    virtual void popupDidHide(bool acceptSuggestion);
     virtual bool itemIsSeparator(unsigned listIndex) const;
     virtual bool itemIsLabel(unsigned listIndex) const;
     virtual bool itemIsSelected(unsigned listIndex) const;
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 7f62309..1d19b54 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,26 @@
+2009-12-30  Zelidrag Hornung  <zelidrag at chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Autocomplete in Chromium now offers suggestions within the input element as a user
+        a) types text that produces some autocomplete suggestions, and
+        b) scrolls through suggested values in the menu
+        The suggested value is rendered but not exposed through JS unti the
+        user makes the final selection.
+
+        No new tests since this new functionality (autocomplete suggestions)
+        is intentionally hidden from everything else than renderer.
+
+        * src/AutocompletePopupMenuClient.cpp:
+        (WebKit::AutocompletePopupMenuClient::initialize):
+        (WebKit::AutocompletePopupMenuClient::setInitialAutocompleteValue):
+        (WebKit::AutocompletePopupMenuClient::selectionChanged):
+        (WebKit::AutocompletePopupMenuClient::popupDidHide):
+        (WebKit::AutocompletePopupMenuClient::setTextFromItem):
+        (WebKit::AutocompletePopupMenuClient::resetLastFieldValue):
+        * src/AutocompletePopupMenuClient.h:
+
+
 2009-12-28  Kinuko Yasuda  <kinuko at chromium.org>
 
         Reviewed by Maciej Stachowiak.
diff --git a/WebKit/chromium/src/AutocompletePopupMenuClient.cpp b/WebKit/chromium/src/AutocompletePopupMenuClient.cpp
index 62d4dff..f9f8b93 100644
--- a/WebKit/chromium/src/AutocompletePopupMenuClient.cpp
+++ b/WebKit/chromium/src/AutocompletePopupMenuClient.cpp
@@ -59,11 +59,16 @@ void AutocompletePopupMenuClient::initialize(
     const WebVector<WebString>& suggestions,
     int defaultSuggestionIndex)
 {
+    if (!m_lastFieldValues)
+        m_lastFieldValues.set(new FieldValuesMap);
     ASSERT(defaultSuggestionIndex < static_cast<int>(suggestions.size()));
     m_textField = textField;
+    m_typedFieldValue = textField->value();
     m_selectedIndex = defaultSuggestionIndex;
     setSuggestions(suggestions);
 
+    setInitialAutocompleteValue();
+
     FontDescription fontDescription;
     m_webView->theme()->systemFont(CSSValueWebkitControl, fontDescription);
     // Use a smaller font size to match IE/Firefox.
@@ -79,6 +84,40 @@ void AutocompletePopupMenuClient::initialize(
                                    textField->renderer()->style()->direction()));
 }
 
+
+void AutocompletePopupMenuClient::setInitialAutocompleteValue()
+{
+    if (!m_suggestions.size() || !m_textField->name().length() || !m_typedFieldValue.length())
+        return;
+    int newIndex = m_selectedIndex >= 0 ? m_selectedIndex : 0;
+    String suggestion = m_suggestions[newIndex];
+    bool hasPreviousValue = m_lastFieldValues->contains(m_textField->name());
+    String prevValue;
+    if (hasPreviousValue)
+        prevValue = m_lastFieldValues->get(m_textField->name());
+    if (!hasPreviousValue || m_typedFieldValue.length() > m_lastFieldValues->get(m_textField->name()).length()) {
+          int start = 0;
+          String newSuggestion = suggestion;
+          if (suggestion.startsWith(m_typedFieldValue))
+              m_selectedIndex = newIndex;
+          if (suggestion.startsWith(m_typedFieldValue, false)) {
+              newSuggestion = m_typedFieldValue;
+              if (suggestion.length() > m_typedFieldValue.length()) {
+                  newSuggestion.append(suggestion.substring(m_typedFieldValue.length(),
+                      suggestion.length() - m_typedFieldValue.length()));
+              }
+              start = m_typedFieldValue.length();
+          }
+          m_textField->setSuggestedValue(newSuggestion);
+          m_textField->setSelectionRange(start, newSuggestion.length());
+    }
+    if (hasPreviousValue)
+        m_lastFieldValues->set(m_textField->name(), m_typedFieldValue);
+    else
+        m_lastFieldValues->add(m_textField->name(), m_typedFieldValue);
+}
+
+
 void AutocompletePopupMenuClient::valueChanged(unsigned listIndex, bool fireEvents)
 {
     m_textField->setValue(m_suggestions[listIndex]);
@@ -89,6 +128,21 @@ void AutocompletePopupMenuClient::valueChanged(unsigned listIndex, bool fireEven
         static_cast<HTMLInputElement*>(m_textField.get()));
 }
 
+void AutocompletePopupMenuClient::selectionChanged(unsigned listIndex, bool fireEvents)
+{
+    if (listIndex != -1) {
+        m_textField->setSuggestedValue(m_suggestions[listIndex]);
+        m_textField->setSelectionRange(m_typedFieldValue.length(),
+                                       m_suggestions[listIndex].length());
+    } else {
+      m_textField->setValue(m_typedFieldValue);
+      if (m_lastFieldValues->contains(m_textField->name()))
+          m_lastFieldValues->set(m_textField->name(), m_typedFieldValue);
+      else
+          m_lastFieldValues->add(m_textField->name(), m_typedFieldValue);
+    }
+}
+
 String AutocompletePopupMenuClient::itemText(unsigned listIndex) const
 {
     return m_suggestions[listIndex];
@@ -118,14 +172,31 @@ int AutocompletePopupMenuClient::clientPaddingRight() const
     return style ? m_webView->theme()->popupInternalPaddingRight(style) : 0;
 }
 
-void AutocompletePopupMenuClient::popupDidHide()
+void AutocompletePopupMenuClient::popupDidHide(bool acceptSuggestions)
 {
+    if (acceptSuggestions) {
+        String suggestedValue = m_textField->suggestedValue();
+        if (!suggestedValue.isNull())
+            m_textField->setValue(suggestedValue);
+    } else
+        m_textField->setValue(m_typedFieldValue);
+
+    resetLastFieldValue();
     m_webView->autoCompletePopupDidHide();
 }
 
 void AutocompletePopupMenuClient::setTextFromItem(unsigned listIndex)
 {
     m_textField->setValue(m_suggestions[listIndex]);
+    resetLastFieldValue();
+}
+
+void AutocompletePopupMenuClient::resetLastFieldValue()
+{
+    if (m_lastFieldValues->contains(m_textField->name()))
+        m_lastFieldValues->set(m_textField->name(), m_textField->value());
+    else
+        m_lastFieldValues->add(m_textField->name(), m_textField->value());
 }
 
 FontSelector* AutocompletePopupMenuClient::fontSelector() const
diff --git a/WebKit/chromium/src/AutocompletePopupMenuClient.h b/WebKit/chromium/src/AutocompletePopupMenuClient.h
index ad24e54..f997d72 100644
--- a/WebKit/chromium/src/AutocompletePopupMenuClient.h
+++ b/WebKit/chromium/src/AutocompletePopupMenuClient.h
@@ -58,6 +58,7 @@ public:
 
     // WebCore::PopupMenuClient methods:
     virtual void valueChanged(unsigned listIndex, bool fireEvents = true);
+    virtual void selectionChanged(unsigned listIndex, bool fireEvents = true);
     virtual WebCore::String itemText(unsigned listIndex) const;
     virtual WebCore::String itemToolTip(unsigned lastIndex) const { return WebCore::String(); }
     virtual bool itemIsEnabled(unsigned listIndex) const { return true; }
@@ -69,7 +70,7 @@ public:
     virtual int clientPaddingRight() const;
     virtual int listSize() const { return m_suggestions.size(); }
     virtual int selectedIndex() const { return m_selectedIndex; }
-    virtual void popupDidHide();
+    virtual void popupDidHide(bool acceptSuggestion);
     virtual bool itemIsSeparator(unsigned listIndex) const { return false; }
     virtual bool itemIsLabel(unsigned listIndex) const { return false; }
     virtual bool itemIsSelected(unsigned listIndex) const { return false; }
@@ -85,12 +86,17 @@ public:
 
 private:
     WebCore::RenderStyle* textFieldStyle() const;
+    void setInitialAutocompleteValue();
+    void resetLastFieldValue();
 
     RefPtr<WebCore::HTMLInputElement> m_textField;
     Vector<WebCore::String> m_suggestions;
     int m_selectedIndex;
     WebViewImpl* m_webView;
+    WebCore::String m_typedFieldValue;
     OwnPtr<WebCore::PopupMenuStyle> m_style;
+    typedef HashMap<WebCore::String, WebCore::String> FieldValuesMap;
+    OwnPtr<FieldValuesMap> m_lastFieldValues;
 };
 
 } // namespace WebKit

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list