Diff
Modified: trunk/Source/WebCore/ChangeLog (169133 => 169134)
--- trunk/Source/WebCore/ChangeLog 2014-05-20 20:59:58 UTC (rev 169133)
+++ trunk/Source/WebCore/ChangeLog 2014-05-20 21:03:54 UTC (rev 169134)
@@ -1,3 +1,29 @@
+2014-05-20 Dean Jackson <[email protected]>
+
+ [Mac] Allow popup menus to override default appearance
+ https://bugs.webkit.org/show_bug.cgi?id=133129
+
+ Reviewed by Tim Horton.
+
+ WebKitSystemInterface's WKPopupMenu has a flag to hide
+ the arrows at the end of a popup-menu (e.g. <select>).
+ Expose that via adding a hasDefaultAppearance flag to
+ PopupMenuStyle, which then passes it on to WKSI.
+
+ * platform/PopupMenuStyle.h:
+ (WebCore::PopupMenuStyle::PopupMenuStyle): New flag in constructor.
+ (WebCore::PopupMenuStyle::hasDefaultAppearance): New flag.
+ * platform/mac/WebCoreSystemInterface.h: wkPopupMenu signature has changed to accept
+ the new flag.
+ * platform/mac/WebCoreSystemInterface.mm: Ditto.
+ * rendering/RenderMenuList.cpp:
+ (RenderMenuList::itemStyle): Pass in true as default appearance when creating
+ the PopupMenuStyle. We don't need it.
+ (RenderMenuList::menuStyle): In this case we pass in the negated value of
+ style().hasAppearance(), which indicates if we are overriding the built-in drawing.
+ * rendering/RenderSearchField.cpp:
+ (WebCore::RenderSearchField::menuStyle): Use true as the default value.
+
2014-05-20 Eric Carlson <[email protected]>
[Mac] do not deactivate an audio session that has running I/O
Modified: trunk/Source/WebCore/platform/PopupMenuStyle.h (169133 => 169134)
--- trunk/Source/WebCore/platform/PopupMenuStyle.h 2014-05-20 20:59:58 UTC (rev 169133)
+++ trunk/Source/WebCore/platform/PopupMenuStyle.h 2014-05-20 21:03:54 UTC (rev 169134)
@@ -43,12 +43,13 @@
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)
+ PopupMenuStyle(const Color& foreground, const Color& background, const Font& font, bool visible, bool isDisplayNone, bool hasDefaultAppearance, Length textIndent, TextDirection textDirection, bool hasTextDirectionOverride, BackgroundColorType backgroundColorType = DefaultBackgroundColor, PopupMenuType menuType = SelectPopup, PopupMenuSize menuSize = PopupMenuSizeNormal)
: m_foregroundColor(foreground)
, m_backgroundColor(background)
, m_font(font)
, m_visible(visible)
, m_isDisplayNone(isDisplayNone)
+ , m_hasDefaultAppearance(hasDefaultAppearance)
, m_textIndent(textIndent)
, m_textDirection(textDirection)
, m_hasTextDirectionOverride(hasTextDirectionOverride)
@@ -63,6 +64,7 @@
const Font& font() const { return m_font; }
bool isVisible() const { return m_visible; }
bool isDisplayNone() const { return m_isDisplayNone; }
+ bool hasDefaultAppearance() const { return m_hasDefaultAppearance; }
Length textIndent() const { return m_textIndent; }
TextDirection textDirection() const { return m_textDirection; }
bool hasTextDirectionOverride() const { return m_hasTextDirectionOverride; }
@@ -76,6 +78,7 @@
Font m_font;
bool m_visible;
bool m_isDisplayNone;
+ bool m_hasDefaultAppearance;
Length m_textIndent;
TextDirection m_textDirection;
bool m_hasTextDirectionOverride;
Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h (169133 => 169134)
--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h 2014-05-20 20:59:58 UTC (rev 169133)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h 2014-05-20 21:03:54 UTC (rev 169134)
@@ -202,8 +202,8 @@
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 (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize, bool hideArrows);
extern void (*wkPopupMenuWithSize)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize);
#endif
Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (169133 => 169134)
--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm 2014-05-20 20:59:58 UTC (rev 169133)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm 2014-05-20 21:03:54 UTC (rev 169134)
@@ -68,7 +68,7 @@
BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
UInt8 (*wkGetNSEventKeyChar)(NSEvent *);
-void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
+void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize, bool hideArrows);
void (*wkPopupMenuWithSize)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize);
unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
int (*wkQTMovieDataRate)(QTMovie*);
Modified: trunk/Source/WebCore/rendering/RenderMenuList.cpp (169133 => 169134)
--- trunk/Source/WebCore/rendering/RenderMenuList.cpp 2014-05-20 20:59:58 UTC (rev 169133)
+++ trunk/Source/WebCore/rendering/RenderMenuList.cpp 2014-05-20 21:03:54 UTC (rev 169134)
@@ -522,7 +522,7 @@
RenderStyle* style = element->renderStyle() ? element->renderStyle() : element->computedStyle();
return style ? PopupMenuStyle(style->visitedDependentColor(CSSPropertyColor), itemBackgroundColor, style->font(), style->visibility() == VISIBLE,
- style->display() == NONE, style->textIndent(), style->direction(), isOverride(style->unicodeBidi()),
+ style->display() == NONE, true, style->textIndent(), style->direction(), isOverride(style->unicodeBidi()),
itemHasCustomBackgroundColor ? PopupMenuStyle::CustomBackgroundColor : PopupMenuStyle::DefaultBackgroundColor) : menuStyle();
}
@@ -562,7 +562,7 @@
const RenderStyle& styleToUse = m_innerBlock ? m_innerBlock->style() : style();
IntRect absBounds = absoluteBoundingBoxRectIgnoringTransforms();
return PopupMenuStyle(styleToUse.visitedDependentColor(CSSPropertyColor), styleToUse.visitedDependentColor(CSSPropertyBackgroundColor),
- styleToUse.font(), styleToUse.visibility() == VISIBLE, styleToUse.display() == NONE, styleToUse.textIndent(),
+ styleToUse.font(), styleToUse.visibility() == VISIBLE, styleToUse.display() == NONE, style().hasAppearance(), styleToUse.textIndent(),
style().direction(), isOverride(style().unicodeBidi()), PopupMenuStyle::DefaultBackgroundColor,
PopupMenuStyle::SelectPopup, theme().popupMenuSize(&styleToUse, absBounds));
}
Modified: trunk/Source/WebCore/rendering/RenderSearchField.cpp (169133 => 169134)
--- trunk/Source/WebCore/rendering/RenderSearchField.cpp 2014-05-20 20:59:58 UTC (rev 169133)
+++ trunk/Source/WebCore/rendering/RenderSearchField.cpp 2014-05-20 21:03:54 UTC (rev 169134)
@@ -261,7 +261,7 @@
PopupMenuStyle RenderSearchField::menuStyle() const
{
return PopupMenuStyle(style().visitedDependentColor(CSSPropertyColor), style().visitedDependentColor(CSSPropertyBackgroundColor), style().font(), style().visibility() == VISIBLE,
- style().display() == NONE, style().textIndent(), style().direction(), isOverride(style().unicodeBidi()), PopupMenuStyle::CustomBackgroundColor);
+ style().display() == NONE, true, style().textIndent(), style().direction(), isOverride(style().unicodeBidi()), PopupMenuStyle::CustomBackgroundColor);
}
int RenderSearchField::clientInsetLeft() const
Modified: trunk/Source/WebKit/mac/ChangeLog (169133 => 169134)
--- trunk/Source/WebKit/mac/ChangeLog 2014-05-20 20:59:58 UTC (rev 169133)
+++ trunk/Source/WebKit/mac/ChangeLog 2014-05-20 21:03:54 UTC (rev 169134)
@@ -1,3 +1,17 @@
+2014-05-20 Dean Jackson <[email protected]>
+
+ [Mac] Allow popup menus to override default appearance
+ https://bugs.webkit.org/show_bug.cgi?id=133129
+
+ Reviewed by Tim Horton.
+
+ Replace the call to wkPopupMenuWithSize with wkPopupMenu, now
+ with extra parameters to indicate the control size and whether
+ or not to draw the arrows at the end.
+
+ * WebCoreSupport/PopupMenuMac.mm:
+ (PopupMenuMac::show):
+
2014-05-20 Eric Carlson <[email protected]>
[Mac] do not deactivate an audio session that has running I/O
Modified: trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm (169133 => 169134)
--- trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm 2014-05-20 20:59:58 UTC (rev 169133)
+++ trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm 2014-05-20 21:03:54 UTC (rev 169134)
@@ -204,7 +204,7 @@
break;
}
- wkPopupMenuWithSize(menu, location, roundf(NSWidth(r)), dummyView.get(), index, font, controlSize);
+ wkPopupMenu(menu, location, roundf(NSWidth(r)), dummyView.get(), index, font, controlSize, !m_client->menuStyle().hasDefaultAppearance());
[m_popup dismissPopUp];
[dummyView removeFromSuperview];
Modified: trunk/Source/WebKit2/ChangeLog (169133 => 169134)
--- trunk/Source/WebKit2/ChangeLog 2014-05-20 20:59:58 UTC (rev 169133)
+++ trunk/Source/WebKit2/ChangeLog 2014-05-20 21:03:54 UTC (rev 169134)
@@ -1,3 +1,23 @@
+2014-05-20 Dean Jackson <[email protected]>
+
+ [Mac] Allow popup menus to override default appearance
+ https://bugs.webkit.org/show_bug.cgi?id=133129
+
+ Reviewed by Tim Horton.
+
+ Add an extra "hideArrows" flag to PlatformPopupMenuData
+ and replace the call to WKPopupMenuWithSize with WKPopupMenu.
+
+ * Shared/PlatformPopupMenuData.cpp: Encode and decode the new data value.
+ (WebKit::PlatformPopupMenuData::encode):
+ (WebKit::PlatformPopupMenuData::decode):
+ * Shared/PlatformPopupMenuData.h: Add hideArrows boolean.
+ * UIProcess/mac/WebPopupMenuProxyMac.mm:
+ (WebKit::WebPopupMenuProxyMac::showPopupMenu):
+ * WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm:
+ (WebKit::WebPopupMenu::setUpPlatformData): The hideArrows flag is
+ true if we don't have the default appearance.
+
2014-05-20 Eric Carlson <[email protected]>
[Mac] do not deactivate an audio session that has running I/O
Modified: trunk/Source/WebKit2/Shared/PlatformPopupMenuData.cpp (169133 => 169134)
--- trunk/Source/WebKit2/Shared/PlatformPopupMenuData.cpp 2014-05-20 20:59:58 UTC (rev 169133)
+++ trunk/Source/WebKit2/Shared/PlatformPopupMenuData.cpp 2014-05-20 21:03:54 UTC (rev 169134)
@@ -39,6 +39,7 @@
#if PLATFORM(COCOA)
encoder << fontInfo;
encoder << shouldPopOver;
+ encoder << hideArrows;
encoder.encodeEnum(menuSize);
#else
UNUSED_PARAM(encoder);
@@ -52,6 +53,8 @@
return false;
if (!decoder.decode(data.shouldPopOver))
return false;
+ if (!decoder.decode(data.hideArrows))
+ return false;
if (!decoder.decodeEnum(data.menuSize))
return false;
#else
Modified: trunk/Source/WebKit2/Shared/PlatformPopupMenuData.h (169133 => 169134)
--- trunk/Source/WebKit2/Shared/PlatformPopupMenuData.h 2014-05-20 20:59:58 UTC (rev 169133)
+++ trunk/Source/WebKit2/Shared/PlatformPopupMenuData.h 2014-05-20 21:03:54 UTC (rev 169134)
@@ -47,6 +47,7 @@
#if PLATFORM(COCOA)
FontInfo fontInfo;
bool shouldPopOver;
+ bool hideArrows;
WebCore::PopupMenuStyle::PopupMenuSize menuSize;
#endif
};
Modified: trunk/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm (169133 => 169134)
--- trunk/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm 2014-05-20 20:59:58 UTC (rev 169133)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm 2014-05-20 21:03:54 UTC (rev 169134)
@@ -147,7 +147,7 @@
break;
}
- WKPopupMenuWithSize(menu, location, roundf(NSWidth(rect)), dummyView.get(), selectedIndex, font, controlSize);
+ WKPopupMenu(menu, location, roundf(NSWidth(rect)), dummyView.get(), selectedIndex, font, controlSize, data.hideArrows);
[m_popup dismissPopUp];
[dummyView removeFromSuperview];
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm (169133 => 169134)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm 2014-05-20 20:59:58 UTC (rev 169133)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm 2014-05-20 21:03:54 UTC (rev 169134)
@@ -49,6 +49,7 @@
data.fontInfo.fontAttributeDictionary = fontDescriptorAttributes;
data.shouldPopOver = m_popupClient->shouldPopOver();
+ data.hideArrows = !m_popupClient->menuStyle().hasDefaultAppearance();
data.menuSize = m_popupClient->menuStyle().menuSize();
#else
UNUSED_PARAM(data);