Title: [213244] branches/safari-603.1.30.4-branch/Source/WebCore
Revision
213244
Author
matthew_han...@apple.com
Date
2017-03-01 14:36:32 -0800 (Wed, 01 Mar 2017)

Log Message

Merge r213211. rdar://problem/30742143

Modified Paths

Diff

Modified: branches/safari-603.1.30.4-branch/Source/WebCore/ChangeLog (213243 => 213244)


--- branches/safari-603.1.30.4-branch/Source/WebCore/ChangeLog	2017-03-01 22:36:29 UTC (rev 213243)
+++ branches/safari-603.1.30.4-branch/Source/WebCore/ChangeLog	2017-03-01 22:36:32 UTC (rev 213244)
@@ -1,3 +1,22 @@
+2017-03-01  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r213211. rdar://problem/30742143
+
+    2017-03-01  Per Arne Vollan  <pvol...@apple.com>
+
+            [Win] Popup menus are too small in HiDPI mode.
+            https://bugs.webkit.org/show_bug.cgi?id=168965
+
+            Reviewed by Brent Fulgham.
+
+            Scale font with device scale factor.
+
+            * platform/win/PopupMenuWin.cpp:
+            (WebCore::PopupMenuWin::show):
+            (WebCore::PopupMenuWin::calculatePositionAndSize):
+            (WebCore::PopupMenuWin::paint):
+            * platform/win/PopupMenuWin.h:
+
 2017-02-24  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r212822. rdar://problem/30682429

Modified: branches/safari-603.1.30.4-branch/Source/WebCore/platform/win/PopupMenuWin.cpp (213243 => 213244)


--- branches/safari-603.1.30.4-branch/Source/WebCore/platform/win/PopupMenuWin.cpp	2017-03-01 22:36:29 UTC (rev 213243)
+++ branches/safari-603.1.30.4-branch/Source/WebCore/platform/win/PopupMenuWin.cpp	2017-03-01 22:36:32 UTC (rev 213244)
@@ -128,13 +128,13 @@
 
 void PopupMenuWin::show(const IntRect& r, FrameView* view, int index)
 {
+    if (view && view->frame().page())
+        m_scaleFactor = view->frame().page()->deviceScaleFactor();
+
     calculatePositionAndSize(r, view);
     if (clientRect().isEmpty())
         return;
 
-    if (view && view->frame().page())
-        m_scaleFactor = view->frame().page()->deviceScaleFactor();
-
     HWND hostWindow = view->hostWindow()->platformPageClient();
 
     if (!m_scrollbar && visibleItems() < client()->listSize()) {
@@ -319,9 +319,16 @@
 
     rScreenCoords.setLocation(location);
 
+    m_font = client()->menuStyle().font();
+    auto d = m_font.fontDescription();
+    d.setComputedSize(d.computedSize() * m_scaleFactor);
+    m_font = FontCascade(d, m_font.letterSpacing(), m_font.wordSpacing());
+    m_font.update(m_popupClient->fontSelector());
+
     // First, determine the popup's height
     int itemCount = client()->listSize();
-    m_itemHeight = client()->menuStyle().font().fontMetrics().height() + optionSpacingMiddle;
+    m_itemHeight = m_font.fontMetrics().height() + optionSpacingMiddle;
+
     int naturalHeight = m_itemHeight * itemCount;
     int popupHeight = std::min(maxPopupHeight, naturalHeight);
     // The popup should show an integral number of items (i.e. no partial items should be visible)
@@ -334,7 +341,7 @@
         if (text.isEmpty())
             continue;
 
-        FontCascade itemFont = client()->menuStyle().font();
+        FontCascade itemFont = m_font;
         if (client()->itemIsLabel(i)) {
             auto d = itemFont.fontDescription();
             d.setWeight(d.bolderWeight());
@@ -639,8 +646,8 @@
 
         TextRun textRun(itemText, 0, 0, AllowTrailingExpansion, itemStyle.textDirection(), itemStyle.hasTextDirectionOverride());
         context.setFillColor(optionTextColor);
-        
-        FontCascade itemFont = client()->menuStyle().font();
+
+        FontCascade itemFont = m_font;
         if (client()->itemIsLabel(index)) {
             auto d = itemFont.fontDescription();
             d.setWeight(d.bolderWeight());

Modified: branches/safari-603.1.30.4-branch/Source/WebCore/platform/win/PopupMenuWin.h (213243 => 213244)


--- branches/safari-603.1.30.4-branch/Source/WebCore/platform/win/PopupMenuWin.h	2017-03-01 22:36:29 UTC (rev 213243)
+++ branches/safari-603.1.30.4-branch/Source/WebCore/platform/win/PopupMenuWin.h	2017-03-01 22:36:32 UTC (rev 213244)
@@ -135,6 +135,7 @@
     bool m_scrollbarCapturingMouse { false };
     bool m_showPopup { false };
     float m_scaleFactor { 1 };
+    FontCascade m_font;
 
     friend class AccessiblePopupMenu;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to