<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[167825] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/167825">167825</a></dd>
<dt>Author</dt> <dd>dino@apple.com</dd>
<dt>Date</dt> <dd>2014-04-25 14:42:48 -0700 (Fri, 25 Apr 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>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.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreplatformPopupMenuStyleh">trunk/Source/WebCore/platform/PopupMenuStyle.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacWebCoreSystemInterfaceh">trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacWebCoreSystemInterfacemm">trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderMenuListcpp">trunk/Source/WebCore/rendering/RenderMenuList.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeh">trunk/Source/WebCore/rendering/RenderTheme.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeMach">trunk/Source/WebCore/rendering/RenderThemeMac.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeMacmm">trunk/Source/WebCore/rendering/RenderThemeMac.mm</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportPopupMenuMacmm">trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebSystemInterfacemm">trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedPlatformPopupMenuDatacpp">trunk/Source/WebKit2/Shared/PlatformPopupMenuData.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedPlatformPopupMenuDatah">trunk/Source/WebKit2/Shared/PlatformPopupMenuData.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWebPopupMenuProxyMacmm">trunk/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportmacWebPopupMenuMacmm">trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportmacWebSystemInterfacemm">trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2014-04-25 Dean Jackson <dino@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.
+
</ins><span class="cx"> 2014-04-25 Javier Fernandez <jfernandez@igalia.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION(r167799): ASSERTION in parseGridTemplateShorthand in fast/css-grid-layout/grid-template-shorthand-get-set.html
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -2313,6 +2313,7 @@
</span><span class="cx"> _wkHitTestMediaUIPart
</span><span class="cx"> _wkMeasureMediaUIPart
</span><span class="cx"> _wkPopupMenu
</span><ins>+_wkPopupMenuWithSize
</ins><span class="cx"> _wkQTClearMediaDownloadCache
</span><span class="cx"> _wkQTClearMediaDownloadCacheForSite
</span><span class="cx"> _wkQTGetSitesInMediaDownloadCache
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformPopupMenuStyleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/PopupMenuStyle.h (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -37,7 +37,13 @@
</span><span class="cx"> public:
</span><span class="cx"> enum PopupMenuType { SelectPopup, AutofillPopup };
</span><span class="cx"> enum BackgroundColorType { DefaultBackgroundColor, CustomBackgroundColor };
</span><del>- 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)
</del><ins>+ 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)
</ins><span class="cx"> : m_foregroundColor(foreground)
</span><span class="cx"> , m_backgroundColor(background)
</span><span class="cx"> , m_font(font)
</span><span class="lines">@@ -48,6 +54,7 @@
</span><span class="cx"> , m_hasTextDirectionOverride(hasTextDirectionOverride)
</span><span class="cx"> , m_backgroundColorType(backgroundColorType)
</span><span class="cx"> , m_menuType(menuType)
</span><ins>+ , m_menuSize(menuSize)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -61,6 +68,8 @@
</span><span class="cx"> bool hasTextDirectionOverride() const { return m_hasTextDirectionOverride; }
</span><span class="cx"> BackgroundColorType backgroundColorType() const { return m_backgroundColorType; }
</span><span class="cx"> PopupMenuType menuType() const { return m_menuType; }
</span><ins>+ PopupMenuSize menuSize() const { return m_menuSize; }
+
</ins><span class="cx"> private:
</span><span class="cx"> Color m_foregroundColor;
</span><span class="cx"> Color m_backgroundColor;
</span><span class="lines">@@ -72,6 +81,7 @@
</span><span class="cx"> bool m_hasTextDirectionOverride;
</span><span class="cx"> BackgroundColorType m_backgroundColorType;
</span><span class="cx"> PopupMenuType m_menuType;
</span><ins>+ PopupMenuSize m_menuSize;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacWebCoreSystemInterfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -196,7 +196,12 @@
</span><span class="cx">
</span><span class="cx"> extern void (*wkWindowSetAlpha)(NSWindow *, float);
</span><span class="cx"> extern void (*wkWindowSetScaledFrame)(NSWindow *, NSRect, NSRect);
</span><ins>+
</ins><span class="cx"> extern void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
</span><ins>+#if defined(__OBJC__)
+extern void (*wkPopupMenuWithSize)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize);
+#endif
+
</ins><span class="cx"> extern unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
</span><span class="cx"> extern int (*wkQTMovieDataRate)(QTMovie*);
</span><span class="cx"> extern void (*wkQTMovieDisableComponent)(uint32_t[5]);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacWebCoreSystemInterfacemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -67,6 +67,7 @@
</span><span class="cx"> void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
</span><span class="cx"> UInt8 (*wkGetNSEventKeyChar)(NSEvent *);
</span><span class="cx"> void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
</span><ins>+void (*wkPopupMenuWithSize)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize);
</ins><span class="cx"> unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
</span><span class="cx"> int (*wkQTMovieDataRate)(QTMovie*);
</span><span class="cx"> void (*wkQTMovieDisableComponent)(uint32_t[5]);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderMenuListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderMenuList.cpp (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -560,8 +560,11 @@
</span><span class="cx"> PopupMenuStyle RenderMenuList::menuStyle() const
</span><span class="cx"> {
</span><span class="cx"> const RenderStyle& styleToUse = m_innerBlock ? m_innerBlock->style() : style();
</span><del>- return PopupMenuStyle(styleToUse.visitedDependentColor(CSSPropertyColor), styleToUse.visitedDependentColor(CSSPropertyBackgroundColor), styleToUse.font(), styleToUse.visibility() == VISIBLE,
- styleToUse.display() == NONE, styleToUse.textIndent(), style().direction(), isOverride(style().unicodeBidi()));
</del><ins>+ 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));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> HostWindow* RenderMenuList::hostWindow() const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTheme.h (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #else
</span><span class="cx"> #include "ThemeTypes.h"
</span><span class="cx"> #endif
</span><ins>+#include "PopupMenuStyle.h"
</ins><span class="cx"> #include "RenderObject.h"
</span><span class="cx"> #include "ScrollTypes.h"
</span><span class="cx"> #include <wtf/PassRefPtr.h>
</span><span class="lines">@@ -184,6 +185,7 @@
</span><span class="cx"> virtual int popupInternalPaddingTop(RenderStyle*) const { return 0; }
</span><span class="cx"> virtual int popupInternalPaddingBottom(RenderStyle*) const { return 0; }
</span><span class="cx"> virtual bool popupOptionSupportsTextIndent() const { return false; }
</span><ins>+ virtual PopupMenuStyle::PopupMenuSize popupMenuSize(const RenderStyle*, IntRect&) const { return PopupMenuStyle::PopupMenuSizeNormal; }
</ins><span class="cx">
</span><span class="cx"> virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { return RegularScrollbar; }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -81,6 +81,7 @@
</span><span class="cx"> virtual int popupInternalPaddingRight(RenderStyle*) const;
</span><span class="cx"> virtual int popupInternalPaddingTop(RenderStyle*) const;
</span><span class="cx"> virtual int popupInternalPaddingBottom(RenderStyle*) const;
</span><ins>+ virtual PopupMenuStyle::PopupMenuSize popupMenuSize(const RenderStyle*, IntRect&) const;
</ins><span class="cx">
</span><span class="cx"> virtual bool paintCapsLockIndicator(const RenderObject&, const PaintInfo&, const IntRect&) override;
</span><span class="cx">
</span><span class="lines">@@ -179,6 +180,7 @@
</span><span class="cx"> // Get the control size based off the font. Used by some of the controls (like buttons).
</span><span class="cx"> NSControlSize controlSizeForFont(RenderStyle*) const;
</span><span class="cx"> NSControlSize controlSizeForSystemFont(RenderStyle*) const;
</span><ins>+ NSControlSize controlSizeForCell(NSCell*, const IntSize* sizes, const IntSize& minSize, float zoomLevel = 1.0f) const;
</ins><span class="cx"> void setControlSize(NSCell*, const IntSize* sizes, const IntSize& minSize, float zoomLevel = 1.0f);
</span><span class="cx"> void setSizeFromFont(RenderStyle*, const IntSize* sizes) const;
</span><span class="cx"> IntSize sizeForFont(RenderStyle*, const IntSize* sizes) const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -740,17 +740,22 @@
</span><span class="cx"> return NSMiniControlSize;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+}
+
</ins><span class="cx"> void RenderThemeMac::setControlSize(NSCell* cell, const IntSize* sizes, const IntSize& minSize, float zoomLevel)
</span><span class="cx"> {
</span><del>- 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;
</del><ins>+ NSControlSize size = controlSizeForCell(cell, sizes, minSize, zoomLevel);
</ins><span class="cx"> if (size != [cell controlSize]) // Only update if we have to, since AppKit does work even if the size is the same.
</span><span class="cx"> [cell setControlSize:size];
</span><span class="cx"> }
</span><span class="lines">@@ -1383,6 +1388,22 @@
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+ }
+}
+
</ins><span class="cx"> void RenderThemeMac::adjustMenuListButtonStyle(StyleResolver*, RenderStyle* style, Element*) const
</span><span class="cx"> {
</span><span class="cx"> float fontScale = style->fontSize() / baseFontSize;
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2014-04-25 Dean Jackson <dino@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.
+
</ins><span class="cx"> 2014-04-24 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r167700.
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportPopupMenuMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -191,8 +191,21 @@
</span><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- wkPopupMenu(menu, location, roundf(NSWidth(r)), dummyView.get(), index, font);
</del><ins>+ 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;
+ }
</ins><span class="cx">
</span><ins>+ wkPopupMenuWithSize(menu, location, roundf(NSWidth(r)), dummyView.get(), index, font, controlSize);
+
</ins><span class="cx"> [m_popup dismissPopUp];
</span><span class="cx"> [dummyView removeFromSuperview];
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebSystemInterfacemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -93,6 +93,7 @@
</span><span class="cx"> INIT(WindowSetAlpha);
</span><span class="cx"> INIT(WindowSetScaledFrame);
</span><span class="cx"> INIT(PopupMenu);
</span><ins>+ INIT(PopupMenuWithSize);
</ins><span class="cx"> INIT(SetCGFontRenderingMode);
</span><span class="cx"> #endif
</span><span class="cx"> INIT(SetBaseCTM);
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-04-25 Dean Jackson <dino@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.
+
</ins><span class="cx"> 2014-04-25 Tim Horton <timothy_horton@apple.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION (r167775): Safari crashes in ViewSnapshotStore::pruneSnapshots after loading 20 pages
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedPlatformPopupMenuDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/PlatformPopupMenuData.cpp (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> encoder << fontInfo;
</span><span class="cx"> encoder << shouldPopOver;
</span><ins>+ encoder.encodeEnum(menuSize);
</ins><span class="cx"> #else
</span><span class="cx"> UNUSED_PARAM(encoder);
</span><span class="cx"> #endif
</span><span class="lines">@@ -51,6 +52,8 @@
</span><span class="cx"> return false;
</span><span class="cx"> if (!decoder.decode(data.shouldPopOver))
</span><span class="cx"> return false;
</span><ins>+ if (!decoder.decodeEnum(data.menuSize))
+ return false;
</ins><span class="cx"> #else
</span><span class="cx"> UNUSED_PARAM(decoder);
</span><span class="cx"> UNUSED_PARAM(data);
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedPlatformPopupMenuDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/PlatformPopupMenuData.h (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #include "FontInfo.h"
</span><span class="cx"> #include "ShareableBitmap.h"
</span><ins>+#include <WebCore/PopupMenuStyle.h>
</ins><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><span class="cx"> namespace IPC {
</span><span class="lines">@@ -46,6 +47,7 @@
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> FontInfo fontInfo;
</span><span class="cx"> bool shouldPopOver;
</span><ins>+ WebCore::PopupMenuStyle::PopupMenuSize menuSize;
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebPopupMenuProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -134,8 +134,21 @@
</span><span class="cx"> [m_webView addSubview:dummyView.get()];
</span><span class="cx"> location = [dummyView convertPoint:location fromView:m_webView];
</span><span class="cx">
</span><del>- WKPopupMenu(menu, location, roundf(NSWidth(rect)), dummyView.get(), selectedIndex, font);
</del><ins>+ 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;
+ }
</ins><span class="cx">
</span><ins>+ WKPopupMenuWithSize(menu, location, roundf(NSWidth(rect)), dummyView.get(), selectedIndex, font, controlSize);
+
</ins><span class="cx"> [m_popup dismissPopUp];
</span><span class="cx"> [dummyView removeFromSuperview];
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportmacWebPopupMenuMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx">
</span><span class="cx"> data.fontInfo.fontAttributeDictionary = fontDescriptorAttributes;
</span><span class="cx"> data.shouldPopOver = m_popupClient->shouldPopOver();
</span><ins>+ data.menuSize = m_popupClient->menuStyle().menuSize();
</ins><span class="cx"> #else
</span><span class="cx"> UNUSED_PARAM(data);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportmacWebSystemInterfacemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (167824 => 167825)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -89,6 +89,7 @@
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> INIT(MeasureMediaUIPart);
</span><span class="cx"> INIT(PopupMenu);
</span><ins>+ INIT(PopupMenuWithSize);
</ins><span class="cx"> INIT(QTIncludeOnlyModernMediaFileTypes);
</span><span class="cx"> INIT(QTMovieDataRate);
</span><span class="cx"> INIT(QTMovieDisableComponent);
</span></span></pre>
</div>
</div>
</body>
</html>