Reviewed by Adam Roben.
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 May 2008 19:04:54 +0000 (19:04 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 May 2008 19:04:54 +0000 (19:04 +0000)
        - fix <rdar://problem/5697957> "No recent searches" label in a narrow search field's history popup is truncated

        * platform/win/PopupMenuWin.cpp:
        (WebCore::PopupMenu::calculatePositionAndSize): Changed to use a bold
        font for measuring labels.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@32985 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/win/PopupMenuWin.cpp

index ac20c67..1a38bb1 100644 (file)
@@ -1,5 +1,15 @@
 2008-05-08  Dan Bernstein  <mitz@apple.com>
 
+        Reviewed by Adam Roben.
+
+        - fix <rdar://problem/5697957> "No recent searches" label in a narrow search field's history popup is truncated
+
+        * platform/win/PopupMenuWin.cpp:
+        (WebCore::PopupMenu::calculatePositionAndSize): Changed to use a bold
+        font for measuring labels.
+
+2008-05-08  Dan Bernstein  <mitz@apple.com>
+
         Reviewed by Geoffrey Garen.
 
         - cross-platform fix for http://bugs.webkit.org/show_bug.cgi?id=17590 
index 9c487c7..ed779ad 100644 (file)
@@ -188,7 +188,15 @@ void PopupMenu::calculatePositionAndSize(const IntRect& r, FrameView* v)
         if (text.isEmpty())
             continue;
 
-        popupWidth = max(popupWidth, client()->clientStyle()->font().width(TextRun(text.characters(), text.length())));
+        Font itemFont = client()->clientStyle()->font();
+        if (client()->itemIsLabel(i)) {
+            FontDescription d = itemFont.fontDescription();
+            d.setWeight(d.bolderWeight());
+            itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing());
+            itemFont.update(m_popupClient->fontSelector());
+        }
+
+        popupWidth = max(popupWidth, itemFont.width(TextRun(text.characters(), text.length())));
     }
 
     if (naturalHeight > maxPopupHeight)