[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:24:57 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 840e7fa7b091cda63f51485cec8837e32a796d0e
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 3 00:25:02 2010 +0000

    2010-11-02  Ilya Sherman  <isherman at chromium.org>
    
            Reviewed by Kent Tamura.
    
            Avoid overlapping label text in autofill popup with icon.
            Updates the menu width computation to take the icon width into account.
            https://bugs.webkit.org/show_bug.cgi?id=48497
    
            * platform/chromium/PopupMenuChromium.cpp:
            (WebCore::PopupListBox::paintRow):
            (WebCore::PopupListBox::layout):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71191 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d1e8bb8..99eaaaf 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2010-11-02  Ilya Sherman  <isherman at chromium.org>
+
+        Reviewed by Kent Tamura.
+
+        Avoid overlapping label text in autofill popup with icon.
+        Updates the menu width computation to take the icon width into account.
+        https://bugs.webkit.org/show_bug.cgi?id=48497
+
+        * platform/chromium/PopupMenuChromium.cpp:
+        (WebCore::PopupListBox::paintRow):
+        (WebCore::PopupListBox::layout):
+
 2010-10-28  Zhenyao Mo  <zmo at google.com>
 
         Reviewed by Kenneth Russell.
diff --git a/WebCore/platform/chromium/PopupMenuChromium.cpp b/WebCore/platform/chromium/PopupMenuChromium.cpp
index 3c807ba..3ff4ff0 100644
--- a/WebCore/platform/chromium/PopupMenuChromium.cpp
+++ b/WebCore/platform/chromium/PopupMenuChromium.cpp
@@ -927,15 +927,16 @@ void PopupListBox::paintRow(GraphicsContext* gc, const IntRect& rect, int rowInd
     // Prepare text to be drawn.
     String itemText = m_popupClient->itemText(rowIndex);
     String itemLabel = m_popupClient->itemLabel(rowIndex);
+    String itemIcon = m_popupClient->itemIcon(rowIndex);
     if (m_settings.restrictWidthOfListBox) { // Truncate strings to fit in.
         // FIXME: We should leftTruncate for the rtl case.
         // StringTruncator::leftTruncate would have to be implemented.
         String str = StringTruncator::rightTruncate(itemText, maxWidth, itemFont);
         if (str != itemText) {
             itemText = str;
-            // Don't display the label, we already don't have enough room for the
-            // item text.
+            // Don't display the label or icon, we already don't have enough room for the item text.
             itemLabel = "";
+            itemIcon = "";
         } else if (!itemLabel.isEmpty()) {
             int availableWidth = maxWidth - kTextToLabelPadding -
                 StringTruncator::width(itemText, itemFont);
@@ -966,7 +967,6 @@ void PopupListBox::paintRow(GraphicsContext* gc, const IntRect& rect, int rowInd
     int remainingWidth = rowRect.width() - rightPadding;
 
     // Draw the icon if applicable.
-    String itemIcon = m_popupClient->itemIcon(rowIndex);
     RefPtr<Image> image(Image::loadPlatformResource(itemIcon.utf8().data()));
     if (image && !image->isNull()) {
         IntRect imageRect = image->rect();
@@ -1089,7 +1089,13 @@ int PopupListBox::getRowHeight(int index)
     if (index < 0)
         return 0;
 
-    return getRowFont(index).height();
+    String icon = m_popupClient->itemIcon(index);
+    RefPtr<Image> image(Image::loadPlatformResource(icon.utf8().data()));
+
+    int fontHeight = getRowFont(index).height();
+    int iconHeight = (image && !image->isNull()) ? image->rect().height() : 0;
+
+    return max(fontHeight, iconHeight);
 }
 
 IntRect PopupListBox::getRowBounds(int index)
@@ -1257,6 +1263,8 @@ void PopupListBox::layout()
         // Ensure the popup is wide enough to fit this item.
         String text = m_popupClient->itemText(i);
         String label = m_popupClient->itemLabel(i);
+        String icon = m_popupClient->itemIcon(i);
+        RefPtr<Image> iconImage(Image::loadPlatformResource(icon.utf8().data()));
         int width = 0;
         if (!text.isEmpty())
             width = itemFont.width(TextRun(text));
@@ -1265,6 +1273,12 @@ void PopupListBox::layout()
                 width += kTextToLabelPadding;
             width += itemFont.width(TextRun(label));
         }
+        if (iconImage && !iconImage->isNull()) {
+            if (width > 0)
+                width += kLabelToIconPadding;
+            width += iconImage->rect().width();
+        }
+
         baseWidth = max(baseWidth, width);
         // FIXME: http://b/1210481 We should get the padding of individual option elements.
         paddingWidth = max(paddingWidth,

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list