Title: [167825] trunk/Source
Revision
167825
Author
d...@apple.com
Date
2014-04-25 14:42:48 -0700 (Fri, 25 Apr 2014)

Log Message

Allow a platform-specific size enumeration to be passed into popup-menu display
https://bugs.webkit.org/show_bug.cgi?id=132195

Reviewed by Brent Fulgham. With some in-person review comments from Sam Weinig.

Platforms like OS X use a set of predefined sizes for built-in controls
used for <select>: normal, small and mini. Expose that information to
the PopupMenuClient via the PopupMenuStyle, allowing it to be passed
into the platform code in WebKitSystemInterface.

Source/WebCore:
* platform/PopupMenuStyle.h: Add a menu size enum.
(WebCore::PopupMenuStyle::PopupMenuStyle):
(WebCore::PopupMenuStyle::menuSize):
* platform/mac/WebCoreSystemInterface.h: Pass in NSControlSize as a parameter
to WKPopupMenu.
* platform/mac/WebCoreSystemInterface.mm: Ditto.
* rendering/RenderMenuList.cpp:
(RenderMenuList::menuStyle): Ask the RenderTheme to calculate the size
of the menu button, so that it can be added to the PopupMenuStyle.
* rendering/RenderTheme.h: New method to retrieve the menu size.
(WebCore::RenderTheme::popupMenuSize): Convert an NSControlSize into a PopupMenuSize.
* rendering/RenderThemeMac.h: Override the base function, and add a
controlSizeForCell helper.
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::controlSizeForCell): Used by this new
code and the old setControlSizeForCell to calculate the NSControlSize
that would be used for the button.
(WebCore::RenderThemeMac::setControlSize): Call the new helper.
(WebCore::RenderThemeMac::popupMenuSize): Return the value from the helper.

Source/WebKit/mac:
* WebCoreSupport/PopupMenuMac.mm:
(PopupMenuMac::show): Convert the WebCore menu size type into the
WebCoreSystemInterface type.

Source/WebKit2:
* Shared/PlatformPopupMenuData.cpp: Encode and decode the PopupMenuSize enum.
(WebKit::PlatformPopupMenuData::encode):
(WebKit::PlatformPopupMenuData::decode):
* Shared/PlatformPopupMenuData.h: Add PopupMenuSize member variable.
* UIProcess/mac/WebPopupMenuProxyMac.mm:
(WebKit::WebPopupMenuProxyMac::showPopupMenu): Convert the PopupMenuSize
into a WKControlSize, and pass that into WKPopupMenu.
* WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm:
(WebKit::WebPopupMenu::setUpPlatformData): Add the PopupMenuSize to
the PlatformPopupMenuData.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (167824 => 167825)


--- trunk/Source/WebCore/ChangeLog	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebCore/ChangeLog	2014-04-25 21:42:48 UTC (rev 167825)
@@ -1,3 +1,35 @@
+2014-04-25  Dean Jackson  <d...@apple.com>
+
+        Allow a platform-specific size enumeration to be passed into popup-menu display
+        https://bugs.webkit.org/show_bug.cgi?id=132195
+
+        Reviewed by Brent Fulgham. With some in-person review comments from Sam Weinig.
+
+        Platforms like OS X use a set of predefined sizes for built-in controls
+        used for <select>: normal, small and mini. Expose that information to
+        the PopupMenuClient via the PopupMenuStyle, allowing it to be passed
+        into the platform code in WebKitSystemInterface.
+
+        * platform/PopupMenuStyle.h: Add a menu size enum.
+        (WebCore::PopupMenuStyle::PopupMenuStyle):
+        (WebCore::PopupMenuStyle::menuSize):
+        * platform/mac/WebCoreSystemInterface.h: Pass in NSControlSize as a parameter
+        to WKPopupMenu.
+        * platform/mac/WebCoreSystemInterface.mm: Ditto.
+        * rendering/RenderMenuList.cpp:
+        (RenderMenuList::menuStyle): Ask the RenderTheme to calculate the size
+        of the menu button, so that it can be added to the PopupMenuStyle.
+        * rendering/RenderTheme.h: New method to retrieve the menu size.
+        (WebCore::RenderTheme::popupMenuSize): Convert an NSControlSize into a PopupMenuSize.
+        * rendering/RenderThemeMac.h: Override the base function, and add a
+        controlSizeForCell helper.
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::controlSizeForCell): Used by this new
+        code and the old setControlSizeForCell to calculate the NSControlSize
+        that would be used for the button.
+        (WebCore::RenderThemeMac::setControlSize): Call the new helper.
+        (WebCore::RenderThemeMac::popupMenuSize): Return the value from the helper.
+
 2014-04-25  Javier Fernandez  <jfernan...@igalia.com>
 
         REGRESSION(r167799): ASSERTION in parseGridTemplateShorthand in fast/css-grid-layout/grid-template-shorthand-get-set.html

Modified: trunk/Source/WebCore/WebCore.exp.in (167824 => 167825)


--- trunk/Source/WebCore/WebCore.exp.in	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-04-25 21:42:48 UTC (rev 167825)
@@ -2313,6 +2313,7 @@
 _wkHitTestMediaUIPart
 _wkMeasureMediaUIPart
 _wkPopupMenu
+_wkPopupMenuWithSize
 _wkQTClearMediaDownloadCache
 _wkQTClearMediaDownloadCacheForSite
 _wkQTGetSitesInMediaDownloadCache

Modified: trunk/Source/WebCore/platform/PopupMenuStyle.h (167824 => 167825)


--- trunk/Source/WebCore/platform/PopupMenuStyle.h	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebCore/platform/PopupMenuStyle.h	2014-04-25 21:42:48 UTC (rev 167825)
@@ -37,7 +37,13 @@
 public:
     enum PopupMenuType { SelectPopup, AutofillPopup };
     enum BackgroundColorType { DefaultBackgroundColor, CustomBackgroundColor };
-    PopupMenuStyle(const Color& foreground, const Color& background, const Font& font, bool visible, bool isDisplayNone, Length textIndent, TextDirection textDirection, bool hasTextDirectionOverride, BackgroundColorType backgroundColorType = DefaultBackgroundColor, PopupMenuType menuType = SelectPopup)
+    enum PopupMenuSize {
+        PopupMenuSizeNormal,
+        PopupMenuSizeSmall,
+        PopupMenuSizeMini
+    };
+
+    PopupMenuStyle(const Color& foreground, const Color& background, const Font& font, bool visible, bool isDisplayNone, Length textIndent, TextDirection textDirection, bool hasTextDirectionOverride, BackgroundColorType backgroundColorType = DefaultBackgroundColor, PopupMenuType menuType = SelectPopup, PopupMenuSize menuSize = PopupMenuSizeNormal)
         : m_foregroundColor(foreground)
         , m_backgroundColor(background)
         , m_font(font)
@@ -48,6 +54,7 @@
         , m_hasTextDirectionOverride(hasTextDirectionOverride)
         , m_backgroundColorType(backgroundColorType)
         , m_menuType(menuType)
+        , m_menuSize(menuSize)
     {
     }
 
@@ -61,6 +68,8 @@
     bool hasTextDirectionOverride() const { return m_hasTextDirectionOverride; }
     BackgroundColorType backgroundColorType() const { return m_backgroundColorType; }
     PopupMenuType menuType() const { return m_menuType; }
+    PopupMenuSize menuSize() const { return m_menuSize; }
+
 private:
     Color m_foregroundColor;
     Color m_backgroundColor;
@@ -72,6 +81,7 @@
     bool m_hasTextDirectionOverride;
     BackgroundColorType m_backgroundColorType;
     PopupMenuType m_menuType;
+    PopupMenuSize m_menuSize;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h (167824 => 167825)


--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2014-04-25 21:42:48 UTC (rev 167825)
@@ -196,7 +196,12 @@
 
 extern void (*wkWindowSetAlpha)(NSWindow *, float);
 extern void (*wkWindowSetScaledFrame)(NSWindow *, NSRect, NSRect);
+
 extern void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
+#if defined(__OBJC__)
+extern void (*wkPopupMenuWithSize)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize);
+#endif
+
 extern unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
 extern int (*wkQTMovieDataRate)(QTMovie*);
 extern void (*wkQTMovieDisableComponent)(uint32_t[5]);

Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (167824 => 167825)


--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2014-04-25 21:42:48 UTC (rev 167825)
@@ -67,6 +67,7 @@
 void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
 UInt8 (*wkGetNSEventKeyChar)(NSEvent *);
 void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
+void (*wkPopupMenuWithSize)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize);
 unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
 int (*wkQTMovieDataRate)(QTMovie*);
 void (*wkQTMovieDisableComponent)(uint32_t[5]);

Modified: trunk/Source/WebCore/rendering/RenderMenuList.cpp (167824 => 167825)


--- trunk/Source/WebCore/rendering/RenderMenuList.cpp	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebCore/rendering/RenderMenuList.cpp	2014-04-25 21:42:48 UTC (rev 167825)
@@ -560,8 +560,11 @@
 PopupMenuStyle RenderMenuList::menuStyle() const
 {
     const RenderStyle& styleToUse = m_innerBlock ? m_innerBlock->style() : style();
-    return PopupMenuStyle(styleToUse.visitedDependentColor(CSSPropertyColor), styleToUse.visitedDependentColor(CSSPropertyBackgroundColor), styleToUse.font(), styleToUse.visibility() == VISIBLE,
-        styleToUse.display() == NONE, styleToUse.textIndent(), style().direction(), isOverride(style().unicodeBidi()));
+    IntRect absBounds = absoluteBoundingBoxRectIgnoringTransforms();
+    return PopupMenuStyle(styleToUse.visitedDependentColor(CSSPropertyColor), styleToUse.visitedDependentColor(CSSPropertyBackgroundColor),
+        styleToUse.font(), styleToUse.visibility() == VISIBLE, styleToUse.display() == NONE, styleToUse.textIndent(),
+        style().direction(), isOverride(style().unicodeBidi()), PopupMenuStyle::DefaultBackgroundColor,
+        PopupMenuStyle::SelectPopup, theme().popupMenuSize(&styleToUse, absBounds));
 }
 
 HostWindow* RenderMenuList::hostWindow() const

Modified: trunk/Source/WebCore/rendering/RenderTheme.h (167824 => 167825)


--- trunk/Source/WebCore/rendering/RenderTheme.h	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebCore/rendering/RenderTheme.h	2014-04-25 21:42:48 UTC (rev 167825)
@@ -29,6 +29,7 @@
 #else
 #include "ThemeTypes.h"
 #endif
+#include "PopupMenuStyle.h"
 #include "RenderObject.h"
 #include "ScrollTypes.h"
 #include <wtf/PassRefPtr.h>
@@ -184,6 +185,7 @@
     virtual int popupInternalPaddingTop(RenderStyle*) const { return 0; }
     virtual int popupInternalPaddingBottom(RenderStyle*) const { return 0; }
     virtual bool popupOptionSupportsTextIndent() const { return false; }
+    virtual PopupMenuStyle::PopupMenuSize popupMenuSize(const RenderStyle*, IntRect&) const { return PopupMenuStyle::PopupMenuSizeNormal; }
 
     virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { return RegularScrollbar; }
 

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (167824 => 167825)


--- trunk/Source/WebCore/rendering/RenderThemeMac.h	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h	2014-04-25 21:42:48 UTC (rev 167825)
@@ -81,6 +81,7 @@
     virtual int popupInternalPaddingRight(RenderStyle*) const;
     virtual int popupInternalPaddingTop(RenderStyle*) const;
     virtual int popupInternalPaddingBottom(RenderStyle*) const;
+    virtual PopupMenuStyle::PopupMenuSize popupMenuSize(const RenderStyle*, IntRect&) const;
 
     virtual bool paintCapsLockIndicator(const RenderObject&, const PaintInfo&, const IntRect&) override;
 
@@ -179,6 +180,7 @@
     // Get the control size based off the font. Used by some of the controls (like buttons).
     NSControlSize controlSizeForFont(RenderStyle*) const;
     NSControlSize controlSizeForSystemFont(RenderStyle*) const;
+    NSControlSize controlSizeForCell(NSCell*, const IntSize* sizes, const IntSize& minSize, float zoomLevel = 1.0f) const;
     void setControlSize(NSCell*, const IntSize* sizes, const IntSize& minSize, float zoomLevel = 1.0f);
     void setSizeFromFont(RenderStyle*, const IntSize* sizes) const;
     IntSize sizeForFont(RenderStyle*, const IntSize* sizes) const;

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (167824 => 167825)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2014-04-25 21:42:48 UTC (rev 167825)
@@ -740,17 +740,22 @@
     return NSMiniControlSize;
 }
 
+NSControlSize RenderThemeMac::controlSizeForCell(NSCell*, const IntSize* sizes, const IntSize& minSize, float zoomLevel) const
+{
+    if (minSize.width() >= static_cast<int>(sizes[NSRegularControlSize].width() * zoomLevel)
+        && minSize.height() >= static_cast<int>(sizes[NSRegularControlSize].height() * zoomLevel))
+        return NSRegularControlSize;
+
+    if (minSize.width() >= static_cast<int>(sizes[NSSmallControlSize].width() * zoomLevel)
+        && minSize.height() >= static_cast<int>(sizes[NSSmallControlSize].height() * zoomLevel))
+        return NSSmallControlSize;
+
+    return NSMiniControlSize;
+}
+
 void RenderThemeMac::setControlSize(NSCell* cell, const IntSize* sizes, const IntSize& minSize, float zoomLevel)
 {
-    NSControlSize size;
-    if (minSize.width() >= static_cast<int>(sizes[NSRegularControlSize].width() * zoomLevel) &&
-        minSize.height() >= static_cast<int>(sizes[NSRegularControlSize].height() * zoomLevel))
-        size = NSRegularControlSize;
-    else if (minSize.width() >= static_cast<int>(sizes[NSSmallControlSize].width() * zoomLevel) &&
-             minSize.height() >= static_cast<int>(sizes[NSSmallControlSize].height() * zoomLevel))
-        size = NSSmallControlSize;
-    else
-        size = NSMiniControlSize;
+    NSControlSize size = controlSizeForCell(cell, sizes, minSize, zoomLevel);
     if (size != [cell controlSize]) // Only update if we have to, since AppKit does work even if the size is the same.
         [cell setControlSize:size];
 }
@@ -1383,6 +1388,22 @@
     return 0;
 }
 
+PopupMenuStyle::PopupMenuSize RenderThemeMac::popupMenuSize(const RenderStyle* style, IntRect& rect) const
+{
+    NSPopUpButtonCell* popupButton = this->popupButton();
+    NSControlSize size = controlSizeForCell(popupButton, popupButtonSizes(), rect.size(), style->effectiveZoom());
+    switch (size) {
+    case NSRegularControlSize:
+        return PopupMenuStyle::PopupMenuSizeNormal;
+    case NSSmallControlSize:
+        return PopupMenuStyle::PopupMenuSizeSmall;
+    case NSMiniControlSize:
+        return PopupMenuStyle::PopupMenuSizeMini;
+    default:
+        return PopupMenuStyle::PopupMenuSizeNormal;
+    }
+}
+
 void RenderThemeMac::adjustMenuListButtonStyle(StyleResolver*, RenderStyle* style, Element*) const
 {
     float fontScale = style->fontSize() / baseFontSize;

Modified: trunk/Source/WebKit/mac/ChangeLog (167824 => 167825)


--- trunk/Source/WebKit/mac/ChangeLog	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-04-25 21:42:48 UTC (rev 167825)
@@ -1,3 +1,19 @@
+2014-04-25  Dean Jackson  <d...@apple.com>
+
+        Allow a platform-specific size enumeration to be passed into popup-menu display
+        https://bugs.webkit.org/show_bug.cgi?id=132195
+
+        Reviewed by Brent Fulgham. With some in-person review comments from Sam Weinig.
+
+        Platforms like OS X use a set of predefined sizes for built-in controls
+        used for <select>: normal, small and mini. Expose that information to
+        the PopupMenuClient via the PopupMenuStyle, allowing it to be passed
+        into the platform code in WebKitSystemInterface.
+
+        * WebCoreSupport/PopupMenuMac.mm:
+        (PopupMenuMac::show): Convert the WebCore menu size type into the
+        WebCoreSystemInterface type.
+
 2014-04-24  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r167700.

Modified: trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm (167824 => 167825)


--- trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm	2014-04-25 21:42:48 UTC (rev 167825)
@@ -191,8 +191,21 @@
         END_BLOCK_OBJC_EXCEPTIONS;
     }
 
-    wkPopupMenu(menu, location, roundf(NSWidth(r)), dummyView.get(), index, font);
+    NSControlSize controlSize;
+    switch (m_client->menuStyle().menuSize()) {
+    case PopupMenuStyle::PopupMenuSizeNormal:
+        controlSize = NSRegularControlSize;
+        break;
+    case PopupMenuStyle::PopupMenuSizeSmall:
+        controlSize = NSSmallControlSize;
+        break;
+    case PopupMenuStyle::PopupMenuSizeMini:
+        controlSize = NSMiniControlSize;
+        break;
+    }
 
+    wkPopupMenuWithSize(menu, location, roundf(NSWidth(r)), dummyView.get(), index, font, controlSize);
+
     [m_popup dismissPopUp];
     [dummyView removeFromSuperview];
 

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (167824 => 167825)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm	2014-04-25 21:42:48 UTC (rev 167825)
@@ -93,6 +93,7 @@
     INIT(WindowSetAlpha);
     INIT(WindowSetScaledFrame);
     INIT(PopupMenu);
+    INIT(PopupMenuWithSize);
     INIT(SetCGFontRenderingMode);
 #endif
     INIT(SetBaseCTM);

Modified: trunk/Source/WebKit2/ChangeLog (167824 => 167825)


--- trunk/Source/WebKit2/ChangeLog	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebKit2/ChangeLog	2014-04-25 21:42:48 UTC (rev 167825)
@@ -1,3 +1,26 @@
+2014-04-25  Dean Jackson  <d...@apple.com>
+
+        Allow a platform-specific size enumeration to be passed into popup-menu display
+        https://bugs.webkit.org/show_bug.cgi?id=132195
+
+        Reviewed by Brent Fulgham. With some in-person review comments from Sam Weinig.
+
+        Platforms like OS X use a set of predefined sizes for built-in controls
+        used for <select>: normal, small and mini. Expose that information to
+        the PopupMenuClient via the PopupMenuStyle, allowing it to be passed
+        into the platform code in WebKitSystemInterface.
+
+        * Shared/PlatformPopupMenuData.cpp: Encode and decode the PopupMenuSize enum.
+        (WebKit::PlatformPopupMenuData::encode):
+        (WebKit::PlatformPopupMenuData::decode):
+        * Shared/PlatformPopupMenuData.h: Add PopupMenuSize member variable.
+        * UIProcess/mac/WebPopupMenuProxyMac.mm:
+        (WebKit::WebPopupMenuProxyMac::showPopupMenu): Convert the PopupMenuSize
+        into a WKControlSize, and pass that into WKPopupMenu.
+        * WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm:
+        (WebKit::WebPopupMenu::setUpPlatformData): Add the PopupMenuSize to
+        the PlatformPopupMenuData.
+
 2014-04-25  Tim Horton  <timothy_hor...@apple.com>
 
         REGRESSION (r167775): Safari crashes in ViewSnapshotStore::pruneSnapshots after loading 20 pages

Modified: trunk/Source/WebKit2/Shared/PlatformPopupMenuData.cpp (167824 => 167825)


--- trunk/Source/WebKit2/Shared/PlatformPopupMenuData.cpp	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebKit2/Shared/PlatformPopupMenuData.cpp	2014-04-25 21:42:48 UTC (rev 167825)
@@ -39,6 +39,7 @@
 #if PLATFORM(COCOA)
     encoder << fontInfo;
     encoder << shouldPopOver;
+    encoder.encodeEnum(menuSize);
 #else
     UNUSED_PARAM(encoder);
 #endif
@@ -51,6 +52,8 @@
         return false;
     if (!decoder.decode(data.shouldPopOver))
         return false;
+    if (!decoder.decodeEnum(data.menuSize))
+        return false;
 #else
     UNUSED_PARAM(decoder);
     UNUSED_PARAM(data);

Modified: trunk/Source/WebKit2/Shared/PlatformPopupMenuData.h (167824 => 167825)


--- trunk/Source/WebKit2/Shared/PlatformPopupMenuData.h	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebKit2/Shared/PlatformPopupMenuData.h	2014-04-25 21:42:48 UTC (rev 167825)
@@ -28,6 +28,7 @@
 
 #include "FontInfo.h"
 #include "ShareableBitmap.h"
+#include <WebCore/PopupMenuStyle.h>
 #include <wtf/text/WTFString.h>
 
 namespace IPC {
@@ -46,6 +47,7 @@
 #if PLATFORM(COCOA)
     FontInfo fontInfo;
     bool shouldPopOver;
+    WebCore::PopupMenuStyle::PopupMenuSize menuSize;
 #endif
 };
 

Modified: trunk/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm (167824 => 167825)


--- trunk/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm	2014-04-25 21:42:48 UTC (rev 167825)
@@ -134,8 +134,21 @@
     [m_webView addSubview:dummyView.get()];
     location = [dummyView convertPoint:location fromView:m_webView];
 
-    WKPopupMenu(menu, location, roundf(NSWidth(rect)), dummyView.get(), selectedIndex, font);
+    NSControlSize controlSize;
+    switch (data.menuSize) {
+    case WebCore::PopupMenuStyle::PopupMenuSizeNormal:
+        controlSize = NSRegularControlSize;
+        break;
+    case WebCore::PopupMenuStyle::PopupMenuSizeSmall:
+        controlSize = NSSmallControlSize;
+        break;
+    case WebCore::PopupMenuStyle::PopupMenuSizeMini:
+        controlSize = NSMiniControlSize;
+        break;
+    }
 
+    WKPopupMenuWithSize(menu, location, roundf(NSWidth(rect)), dummyView.get(), selectedIndex, font, controlSize);
+
     [m_popup dismissPopUp];
     [dummyView removeFromSuperview];
     

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm (167824 => 167825)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm	2014-04-25 21:42:48 UTC (rev 167825)
@@ -49,6 +49,7 @@
     
     data.fontInfo.fontAttributeDictionary = fontDescriptorAttributes;
     data.shouldPopOver = m_popupClient->shouldPopOver();
+    data.menuSize = m_popupClient->menuStyle().menuSize();
 #else
     UNUSED_PARAM(data);
 #endif

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (167824 => 167825)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2014-04-25 21:40:06 UTC (rev 167824)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2014-04-25 21:42:48 UTC (rev 167825)
@@ -89,6 +89,7 @@
 #if !PLATFORM(IOS)
         INIT(MeasureMediaUIPart);
         INIT(PopupMenu);
+        INIT(PopupMenuWithSize);
         INIT(QTIncludeOnlyModernMediaFileTypes);
         INIT(QTMovieDataRate);
         INIT(QTMovieDisableComponent);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to