[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 11:12:47 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 9678112d224b03f22798f2bbcdd2dd08482e1200
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jul 15 03:00:45 2010 +0000

    2010-07-14  Scott Violet  <sky at chromium.org>
    
            Reviewed by David Levin.
    
            [chromium] Autofill menu shows seperator at the wrong place when an entry is deleted
            https://bugs.webkit.org/show_bug.cgi?id=42210
    
            * src/AutoFillPopupMenuClient.cpp:
            (WebKit::AutoFillPopupMenuClient::removeSuggestionAtIndex): Updates internal data appropriately.
            (WebKit::AutoFillPopupMenuClient::canRemoveSuggestionAtIndex): Now called before removal to see if can remove.
            * src/AutoFillPopupMenuClient.h: Fixed whitespace and added method.
            * src/WebViewImpl.cpp:
            (WebKit::WebViewImpl::autocompleteHandleKeyEvent): Added call to canRemoveSuggestionAtIndex.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63395 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index b5e5b19..2a19299 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,17 @@
+2010-07-14  Scott Violet  <sky at chromium.org>
+
+        Reviewed by David Levin.
+
+        [chromium] Autofill menu shows seperator at the wrong place when an entry is deleted
+        https://bugs.webkit.org/show_bug.cgi?id=42210
+
+        * src/AutoFillPopupMenuClient.cpp:
+        (WebKit::AutoFillPopupMenuClient::removeSuggestionAtIndex): Updates internal data appropriately.
+        (WebKit::AutoFillPopupMenuClient::canRemoveSuggestionAtIndex): Now called before removal to see if can remove.
+        * src/AutoFillPopupMenuClient.h: Fixed whitespace and added method.
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::autocompleteHandleKeyEvent): Added call to canRemoveSuggestionAtIndex.
+
 2010-07-14  James Robinson  <jamesr at chromium.org>
 
         Unreviewed. Compile fix, initialization/declaration order mismatch.
diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.cpp b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp
index 4e4b829..db214c7 100644
--- a/WebKit/chromium/src/AutoFillPopupMenuClient.cpp
+++ b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp
@@ -86,10 +86,27 @@ WebString AutoFillPopupMenuClient::getLabel(unsigned listIndex) const
 
 void AutoFillPopupMenuClient::removeSuggestionAtIndex(unsigned listIndex)
 {
-    // FIXME: Do we want to remove AutoFill suggestions?
-    ASSERT(listIndex < m_names.size());
-    m_names.remove(listIndex);
-    m_labels.remove(listIndex);
+    if (!canRemoveSuggestionAtIndex(listIndex))
+        return;
+
+    int index = convertListIndexToInternalIndex(listIndex);
+
+    ASSERT(index < m_names.size());
+
+    m_names.remove(index);
+    m_labels.remove(index);
+
+    // Shift the separator index if necessary.
+    if (m_separatorIndex != -1)
+        m_separatorIndex--;
+}
+
+bool AutoFillPopupMenuClient::canRemoveSuggestionAtIndex(unsigned listIndex)
+{
+    // Only allow deletion of items before the separator and those that don't
+    // have a label (autocomplete).
+    int index = convertListIndexToInternalIndex(listIndex);
+    return m_labels[index].isEmpty() && (m_separatorIndex == -1 || listIndex < m_separatorIndex);
 }
 
 void AutoFillPopupMenuClient::valueChanged(unsigned listIndex, bool fireEvents)
diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.h b/WebKit/chromium/src/AutoFillPopupMenuClient.h
index 2be7dc4..289c8d0 100644
--- a/WebKit/chromium/src/AutoFillPopupMenuClient.h
+++ b/WebKit/chromium/src/AutoFillPopupMenuClient.h
@@ -59,10 +59,13 @@ public:
 
     // Returns the label at |listIndex|.
     virtual WebString getLabel(unsigned listIndex) const;
-    
+
     // Removes the suggestion at |listIndex| from the list of suggestions.
     virtual void removeSuggestionAtIndex(unsigned listIndex);
 
+    // Returns true if the suggestion at |listIndex| can be removed.
+    bool canRemoveSuggestionAtIndex(unsigned listIndex);
+
     // WebCore::PopupMenuClient methods:
     virtual void valueChanged(unsigned listIndex, bool fireEvents = true);
     virtual void selectionChanged(unsigned, bool);
diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp
index a04fd1a..8fd34d1 100644
--- a/WebKit/chromium/src/WebViewImpl.cpp
+++ b/WebKit/chromium/src/WebViewImpl.cpp
@@ -592,6 +592,10 @@ bool WebViewImpl::autocompleteHandleKeyEvent(const WebKeyboardEvent& event)
         }
 
         int selectedIndex = m_autoFillPopup->selectedIndex();
+
+        if (!m_autoFillPopupClient->canRemoveSuggestionAtIndex(selectedIndex))
+            return false;
+
         HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(element);
         WebString name = inputElement->name();
         WebString value = m_autoFillPopupClient->itemText(selectedIndex);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list