[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 15:51:21 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 13ee65174329c48dd3e2c0ca482fa791537e148c
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 15 11:37:21 2010 +0000

    2010-11-15  Ilya Sherman  <isherman at chromium.org>
    
            Reviewed by Kent Tamura.
    
            Add capability for displaying warnings to autofill popup
            Warnings are displayed in dark gray italic.
            https://bugs.webkit.org/show_bug.cgi?id=49291
            http://code.google.com/p/chromium/issues/detail?id=58509
    
            * platform/chromium/PopupMenuChromium.cpp:
            (WebCore::PopupListBox::getRowFont):
              Use item-specific font, not just the generic menu font.
            (WebCore::PopupListBox::selectIndex):
              Updated to clear the selection when hovering over a non-selectable item.
            * platform/chromium/PopupMenuChromium.h: Minor cleanup
    2010-11-15  Ilya Sherman  <isherman at chromium.org>
    
            Reviewed by Kent Tamura.
    
            Add capability for displaying warnings to autofill popup
            Warnings are displayed in dark gray italic.
            https://bugs.webkit.org/show_bug.cgi?id=49291
            http://code.google.com/p/chromium/issues/detail?id=58509
    
            * src/AutoFillPopupMenuClient.cpp:
            (WebKit::AutoFillPopupMenuClient::canRemoveSuggestionAtIndex):
              Updated logic -- can only remove Autocomplete suggestions, which have unique ID 0.
            (WebKit::AutoFillPopupMenuClient::itemIsEnabled): False for warnings.
            (WebKit::AutoFillPopupMenuClient::itemStyle): Dark gray italic for warnings.
            (WebKit::AutoFillPopupMenuClient::menuStyle): Variable name changed.
            (WebKit::AutoFillPopupMenuClient::itemIsWarning): True for unique ID < 0.
            (WebKit::AutoFillPopupMenuClient::initialize): Updated cached styles (see above).
            * src/AutoFillPopupMenuClient.h: Added itemIsEnabled(), variable to cache warning style.
            * src/WebViewImpl.cpp: Minor cleanup.
            (WebKit::WebViewImpl::applyAutoFillSuggestions):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72001 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9c1edaf..76a4f5b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-11-15  Ilya Sherman  <isherman at chromium.org>
+
+        Reviewed by Kent Tamura.
+
+        Add capability for displaying warnings to autofill popup
+        Warnings are displayed in dark gray italic.
+        https://bugs.webkit.org/show_bug.cgi?id=49291
+        http://code.google.com/p/chromium/issues/detail?id=58509
+
+        * platform/chromium/PopupMenuChromium.cpp:
+        (WebCore::PopupListBox::getRowFont):
+          Use item-specific font, not just the generic menu font.
+        (WebCore::PopupListBox::selectIndex):
+          Updated to clear the selection when hovering over a non-selectable item.
+        * platform/chromium/PopupMenuChromium.h: Minor cleanup
+
 2010-11-14  David Hyatt  <hyatt at apple.com>
 
         Back out the italics portion of the previous patch until I can figure out why it
diff --git a/WebCore/platform/chromium/PopupMenuChromium.cpp b/WebCore/platform/chromium/PopupMenuChromium.cpp
index 80c5bc8..04eeb93 100644
--- a/WebCore/platform/chromium/PopupMenuChromium.cpp
+++ b/WebCore/platform/chromium/PopupMenuChromium.cpp
@@ -49,6 +49,7 @@
 #include "PlatformMouseEvent.h"
 #include "PlatformScreen.h"
 #include "PlatformWheelEvent.h"
+#include "PopupMenuClient.h"
 #include "RenderTheme.h"
 #include "ScrollbarTheme.h"
 #include "StringTruncator.h"
@@ -991,7 +992,7 @@ void PopupListBox::paintRow(GraphicsContext* gc, const IntRect& rect, int rowInd
 
 Font PopupListBox::getRowFont(int rowIndex)
 {
-    Font itemFont = m_popupClient->menuStyle().font();
+    Font itemFont = m_popupClient->itemStyle(rowIndex).font();
     if (m_popupClient->itemIsLabel(rowIndex)) {
         // Bold-ify labels (ie, an <optgroup> heading).
         FontDescription d = itemFont.fontDescription();
@@ -1069,13 +1070,16 @@ void PopupListBox::selectIndex(int index)
     if (index < 0 || index >= numItems())
         return;
 
-    if (index != m_selectedIndex && isSelectableItem(index)) {
+    bool isSelectable = isSelectableItem(index);
+    if (index != m_selectedIndex && isSelectable) {
         invalidateRow(m_selectedIndex);
         m_selectedIndex = index;
         invalidateRow(m_selectedIndex);
 
         scrollToRevealSelection();
         m_popupClient->selectionChanged(m_selectedIndex);
+    } else if (!isSelectable) {
+        clearSelection();
     }
 }
 
diff --git a/WebCore/platform/chromium/PopupMenuChromium.h b/WebCore/platform/chromium/PopupMenuChromium.h
index bd885ba..ca47ccf 100644
--- a/WebCore/platform/chromium/PopupMenuChromium.h
+++ b/WebCore/platform/chromium/PopupMenuChromium.h
@@ -32,18 +32,20 @@
 #define PopupMenuChromium_h
 
 #include "config.h"
-#include "PopupMenuClient.h"
 
 #include "FramelessScrollView.h"
 #include "IntRect.h"
+#include "PlatformString.h"
 #include "PopupMenu.h"
 #include "PopupMenuPrivate.h"
+#include "PopupMenuStyle.h"
 
 namespace WebCore {
 
 class ChromeClientChromium;
 class FrameView;
 class PopupListBox;
+class PopupMenuClient;
 
 // A container for the data for each menu item (e.g. represented by <option>
 // or <optgroup> in a <select> widget) and is used by PopupListBox.
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 242620b..4a9ccca 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,24 @@
+2010-11-15  Ilya Sherman  <isherman at chromium.org>
+
+        Reviewed by Kent Tamura.
+
+        Add capability for displaying warnings to autofill popup
+        Warnings are displayed in dark gray italic.
+        https://bugs.webkit.org/show_bug.cgi?id=49291
+        http://code.google.com/p/chromium/issues/detail?id=58509
+
+        * src/AutoFillPopupMenuClient.cpp:
+        (WebKit::AutoFillPopupMenuClient::canRemoveSuggestionAtIndex):
+          Updated logic -- can only remove Autocomplete suggestions, which have unique ID 0.
+        (WebKit::AutoFillPopupMenuClient::itemIsEnabled): False for warnings.
+        (WebKit::AutoFillPopupMenuClient::itemStyle): Dark gray italic for warnings.
+        (WebKit::AutoFillPopupMenuClient::menuStyle): Variable name changed.
+        (WebKit::AutoFillPopupMenuClient::itemIsWarning): True for unique ID < 0.
+        (WebKit::AutoFillPopupMenuClient::initialize): Updated cached styles (see above).
+        * src/AutoFillPopupMenuClient.h: Added itemIsEnabled(), variable to cache warning style.
+        * src/WebViewImpl.cpp: Minor cleanup.
+        (WebKit::WebViewImpl::applyAutoFillSuggestions): 
+
 2010-11-14  Kent Tamura  <tkent at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebKit/chromium/public/WebView.h b/WebKit/chromium/public/WebView.h
index ce8e512..d9d72c7 100644
--- a/WebKit/chromium/public/WebView.h
+++ b/WebKit/chromium/public/WebView.h
@@ -289,7 +289,11 @@ public:
 
     // Notifies the WebView that AutoFill suggestions are available for a node.
     // |uniqueIDs| is a vector of IDs that represent the unique ID of each
-    // AutoFill profile in the suggestions popup.
+    // AutoFill profile in the suggestions popup.  If a unique ID is 0, then the
+    // corresponding suggestion comes from Autocomplete rather than AutoFill.
+    // If a unique ID is negative, then the corresponding "suggestion" is
+    // actually a user-facing warning, e.g. explaining why AutoFill is
+    // unavailable for the current form.
     virtual void applyAutoFillSuggestions(
         const WebNode&,
         const WebVector<WebString>& names,
diff --git a/WebKit/chromium/public/WebViewClient.h b/WebKit/chromium/public/WebViewClient.h
index 6af7582..7ce1483 100644
--- a/WebKit/chromium/public/WebViewClient.h
+++ b/WebKit/chromium/public/WebViewClient.h
@@ -309,11 +309,13 @@ public:
                                            const WebString& value) { }
 
     // Informs the browser that the user has accepted an AutoFill suggestion for
-    // a WebNode.  |name| and |label| form a key into the set of AutoFill
-    // profiles.  |index| is an index of the selected suggestion in the list of
-    // suggestions provided by the client
+    // a WebNode.  |uniqueID| is used as a key into the set of AutoFill profiles,
+    // and should never be negative.  If it is 0, then the suggestion is an
+    // Autocomplete suggestion; and |value| stores the suggested text.  |index|
+    // is an index of the selected suggestion in the list of suggestions provided
+    // by the client.
     virtual void didAcceptAutoFillSuggestion(const WebNode&,
-                                             const WebString& name,
+                                             const WebString& value,
                                              const WebString& label,
                                              int uniqueID,
                                              unsigned index) { }
diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.cpp b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp
index 731c02c..32abd6f 100644
--- a/WebKit/chromium/src/AutoFillPopupMenuClient.cpp
+++ b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp
@@ -115,10 +115,10 @@ void AutoFillPopupMenuClient::removeSuggestionAtIndex(unsigned listIndex)
 
 bool AutoFillPopupMenuClient::canRemoveSuggestionAtIndex(unsigned listIndex)
 {
-    // Only allow deletion of items before the separator and those that don't
-    // have a label (autocomplete).
+    // Only allow deletion of items before the separator that have unique id 0
+    // (i.e. are autocomplete rather than autofill items).
     int index = convertListIndexToInternalIndex(listIndex);
-    return m_labels[index].isEmpty() && (m_separatorIndex == -1 || listIndex < static_cast<unsigned>(m_separatorIndex));
+    return !m_uniqueIDs[index] && (m_separatorIndex == -1 || listIndex < static_cast<unsigned>(m_separatorIndex));
 }
 
 void AutoFillPopupMenuClient::valueChanged(unsigned listIndex, bool fireEvents)
@@ -194,14 +194,19 @@ String AutoFillPopupMenuClient::itemIcon(unsigned listIndex) const
     return getIcon(listIndex);
 }
 
+bool AutoFillPopupMenuClient::itemIsEnabled(unsigned listIndex) const
+{
+    return !itemIsWarning(listIndex);
+}
+
 PopupMenuStyle AutoFillPopupMenuClient::itemStyle(unsigned listIndex) const
 {
-    return *m_style;
+    return itemIsWarning(listIndex) ? *m_warningStyle : *m_regularStyle;
 }
 
 PopupMenuStyle AutoFillPopupMenuClient::menuStyle() const
 {
-    return *m_style;
+    return *m_regularStyle;
 }
 
 int AutoFillPopupMenuClient::clientPaddingLeft() const
@@ -239,6 +244,16 @@ bool AutoFillPopupMenuClient::itemIsSeparator(unsigned listIndex) const
     return (m_separatorIndex != -1 && static_cast<unsigned>(m_separatorIndex) == listIndex);
 }
 
+bool AutoFillPopupMenuClient::itemIsWarning(unsigned listIndex) const
+{
+    int index = convertListIndexToInternalIndex(listIndex);
+    if (index == -1)
+        return false;
+
+    ASSERT(index >= 0 && static_cast<size_t>(index) < m_uniqueIDs.size());
+    return m_uniqueIDs[index] < 0;
+}
+
 void AutoFillPopupMenuClient::setTextFromItem(unsigned listIndex)
 {
     m_textField->setValue(getSuggestion(listIndex));
@@ -282,19 +297,31 @@ void AutoFillPopupMenuClient::initialize(
     // AutoFillPopupMenuClient.
     setSuggestions(names, labels, icons, uniqueIDs, separatorIndex);
 
-    FontDescription fontDescription;
+    FontDescription regularFontDescription;
     RenderTheme::defaultTheme()->systemFont(CSSValueWebkitControl,
-                                            fontDescription);
+                                            regularFontDescription);
     RenderStyle* style = m_textField->computedStyle();
-    fontDescription.setComputedSize(style->fontDescription().computedSize());
+    regularFontDescription.setComputedSize(style->fontDescription().computedSize());
 
-    Font font(fontDescription, 0, 0);
-    font.update(textField->document()->styleSelector()->fontSelector());
+    Font regularFont(regularFontDescription, 0, 0);
+    regularFont.update(textField->document()->styleSelector()->fontSelector());
     // The direction of text in popup menu is set the same as the direction of
     // the input element: textField.
-    m_style.set(new PopupMenuStyle(Color::black, Color::white, font, true,
-                                   false, Length(WebCore::Fixed),
-                                   textField->renderer()->style()->direction()));
+    m_regularStyle.set(new PopupMenuStyle(Color::black, Color::white, regularFont,
+                                          true, false, Length(WebCore::Fixed),
+                                          textField->renderer()->style()->direction()));
+
+    FontDescription warningFontDescription = regularFont.fontDescription();
+    warningFontDescription.setItalic(true);
+    Font warningFont(warningFontDescription, regularFont.letterSpacing(), regularFont.wordSpacing());
+    warningFont.update(regularFont.fontSelector());
+    m_warningStyle.set(new PopupMenuStyle(Color::darkGray,
+                                          m_regularStyle->backgroundColor(),
+                                          warningFont,
+                                          m_regularStyle->isVisible(),
+                                          m_regularStyle->isDisplayNone(),
+                                          m_regularStyle->textIndent(),
+                                          m_regularStyle->textDirection()));
 }
 
 void AutoFillPopupMenuClient::setSuggestions(const WebVector<WebString>& names,
diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.h b/WebKit/chromium/src/AutoFillPopupMenuClient.h
index a946e34..e3edfd3 100644
--- a/WebKit/chromium/src/AutoFillPopupMenuClient.h
+++ b/WebKit/chromium/src/AutoFillPopupMenuClient.h
@@ -78,7 +78,7 @@ public:
     virtual WTF::String itemIcon(unsigned listIndex) const;
     virtual WTF::String itemToolTip(unsigned lastIndex) const { return WTF::String(); }
     virtual WTF::String itemAccessibilityText(unsigned lastIndex) const { return WTF::String(); }
-    virtual bool itemIsEnabled(unsigned listIndex) const { return true; }
+    virtual bool itemIsEnabled(unsigned listIndex) const;
     virtual WebCore::PopupMenuStyle itemStyle(unsigned listIndex) const;
     virtual WebCore::PopupMenuStyle menuStyle() const;
     virtual int clientInsetLeft() const { return 0; }
@@ -130,6 +130,8 @@ private:
     int getSelectedIndex() const { return m_selectedIndex; }
     void setSelectedIndex(int index) { m_selectedIndex = index; }
 
+    bool itemIsWarning(unsigned listIndex) const;
+
     // The names, labels and icons that make up the contents of the menu items.
     Vector<WTF::String> m_names;
     Vector<WTF::String> m_labels;
@@ -143,7 +145,8 @@ private:
     int m_selectedIndex;
 
     RefPtr<WebCore::HTMLInputElement> m_textField;
-    OwnPtr<WebCore::PopupMenuStyle> m_style;
+    OwnPtr<WebCore::PopupMenuStyle> m_regularStyle;
+    OwnPtr<WebCore::PopupMenuStyle> m_warningStyle;
 
     // DEPRECATED: Will be removed once Autocomplete and AutoFill merge is
     // complete.
diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp
index 95d63e3..51576b3 100644
--- a/WebKit/chromium/src/WebViewImpl.cpp
+++ b/WebKit/chromium/src/WebViewImpl.cpp
@@ -178,7 +178,7 @@ static const PopupContainerSettings autoFillPopupSettings = {
     false, // acceptOnAbandon
     true,  // loopSelectionNavigation
     false, // restrictWidthOfListBox (For security reasons show the entire entry
-           // so the user doesn't enter information it did not intend to.)
+           // so the user doesn't enter information he did not intend to.)
     // For suggestions, we use the direction of the input field as the direction
     // of the popup items. The main reason is to keep the display of items in
     // drop-down the same as the items in the input field.
@@ -1943,12 +1943,9 @@ void WebViewImpl::applyAutoFillSuggestions(
     }
 
     if (m_autoFillPopupShowing) {
-        m_autoFillPopupClient->setSuggestions(
-            names, labels, icons, uniqueIDs, separatorIndex);
         refreshAutoFillPopup();
     } else {
-        m_autoFillPopup->show(focusedNode->getRect(),
-                                 focusedNode->ownerDocument()->view(), 0);
+        m_autoFillPopup->show(focusedNode->getRect(), focusedNode->ownerDocument()->view(), 0);
         m_autoFillPopupShowing = true;
     }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list