Title: [130513] trunk/Source/WebCore
- Revision
- 130513
- Author
- commit-qu...@webkit.org
- Date
- 2012-10-05 09:15:35 -0700 (Fri, 05 Oct 2012)
Log Message
[chromium] Only inflate the height of rows in a popup menu when a touch device is detected.
https://bugs.webkit.org/show_bug.cgi?id=98515
Patch by Kevin Ellis <kev...@chromium.org> on 2012-10-05
Reviewed by Adam Barth.
Enforces a minimum row height for popup menus when a touch device is
detected. In a previous patch (r127597), the sizing of popup was
consolidated for touch and non-touch. Based on user feedback, reverting
to the old behavior for non-touch and only adding padding for touch
devices seems like a much safer strategy. This patch is not a direct
revert of r127567 since the padding previously used for touch is a bit
excessive.
Covered by existing tests.
* platform/chromium/PopupListBox.cpp:
(WebCore::PopupListBox::getRowHeight):
* platform/chromium/PopupMenuChromium.cpp:
(WebCore):
* platform/chromium/PopupMenuChromium.h:
(WebCore::PopupMenuChromium::optionRowHeightForTouch):
(WebCore::PopupMenuChromium::setOptionRowHeightForTouch):
(PopupMenuChromium):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (130512 => 130513)
--- trunk/Source/WebCore/ChangeLog 2012-10-05 16:13:35 UTC (rev 130512)
+++ trunk/Source/WebCore/ChangeLog 2012-10-05 16:15:35 UTC (rev 130513)
@@ -1,3 +1,29 @@
+2012-10-05 Kevin Ellis <kev...@chromium.org>
+
+ [chromium] Only inflate the height of rows in a popup menu when a touch device is detected.
+ https://bugs.webkit.org/show_bug.cgi?id=98515
+
+ Reviewed by Adam Barth.
+
+ Enforces a minimum row height for popup menus when a touch device is
+ detected. In a previous patch (r127597), the sizing of popup was
+ consolidated for touch and non-touch. Based on user feedback, reverting
+ to the old behavior for non-touch and only adding padding for touch
+ devices seems like a much safer strategy. This patch is not a direct
+ revert of r127567 since the padding previously used for touch is a bit
+ excessive.
+
+ Covered by existing tests.
+
+ * platform/chromium/PopupListBox.cpp:
+ (WebCore::PopupListBox::getRowHeight):
+ * platform/chromium/PopupMenuChromium.cpp:
+ (WebCore):
+ * platform/chromium/PopupMenuChromium.h:
+ (WebCore::PopupMenuChromium::optionRowHeightForTouch):
+ (WebCore::PopupMenuChromium::setOptionRowHeightForTouch):
+ (PopupMenuChromium):
+
2012-10-05 Alexander Pavlov <apav...@chromium.org>
Web Inspector: [Styles] Unable to edit properties in broken stylesheets
Modified: trunk/Source/WebCore/platform/chromium/PopupListBox.cpp (130512 => 130513)
--- trunk/Source/WebCore/platform/chromium/PopupListBox.cpp 2012-10-05 16:13:35 UTC (rev 130512)
+++ trunk/Source/WebCore/platform/chromium/PopupListBox.cpp 2012-10-05 16:15:35 UTC (rev 130513)
@@ -614,12 +614,16 @@
int PopupListBox::getRowHeight(int index)
{
+ int minimumHeight = PopupMenuChromium::minimumRowHeight();
+ if (m_settings.deviceSupportsTouch)
+ minimumHeight = max(minimumHeight, PopupMenuChromium::optionRowHeightForTouch());
+
if (index < 0 || m_popupClient->itemStyle(index).isDisplayNone())
- return PopupMenuChromium::minimumRowHeight();
+ return minimumHeight;
// Separator row height is the same size as itself.
if (m_popupClient->itemIsSeparator(index))
- return max(separatorHeight, (PopupMenuChromium::minimumRowHeight()));
+ return max(separatorHeight, minimumHeight);
String icon = m_popupClient->itemIcon(index);
RefPtr<Image> image(Image::loadPlatformResource(icon.utf8().data()));
@@ -629,7 +633,7 @@
int linePaddingHeight = m_popupClient->menuStyle().menuType() == PopupMenuStyle::AutofillPopup ? kLinePaddingHeight : 0;
int calculatedRowHeight = max(fontHeight, iconHeight) + linePaddingHeight * 2;
- return max(calculatedRowHeight, PopupMenuChromium::minimumRowHeight());
+ return max(calculatedRowHeight, minimumHeight);
}
IntRect PopupListBox::getRowBounds(int index)
Modified: trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp (130512 => 130513)
--- trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp 2012-10-05 16:13:35 UTC (rev 130512)
+++ trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp 2012-10-05 16:15:35 UTC (rev 130513)
@@ -40,7 +40,8 @@
namespace WebCore {
-int PopupMenuChromium::s_minimumRowHeight = 28;
+int PopupMenuChromium::s_minimumRowHeight = 0;
+int PopupMenuChromium::s_optionRowHeightForTouch = 28;
// The settings used for the drop down menu.
// This is the delegate used if none is provided.
Modified: trunk/Source/WebCore/platform/chromium/PopupMenuChromium.h (130512 => 130513)
--- trunk/Source/WebCore/platform/chromium/PopupMenuChromium.h 2012-10-05 16:13:35 UTC (rev 130512)
+++ trunk/Source/WebCore/platform/chromium/PopupMenuChromium.h 2012-10-05 16:15:35 UTC (rev 130513)
@@ -56,6 +56,8 @@
static int minimumRowHeight() { return s_minimumRowHeight; }
static void setMinimumRowHeight(int minimumRowHeight) { s_minimumRowHeight = minimumRowHeight; }
+ static int optionRowHeightForTouch() { return s_optionRowHeightForTouch; }
+ static void setOptionRowHeightForTouch(int optionRowHeightForTouch) { s_optionRowHeightForTouch = optionRowHeightForTouch; }
private:
PopupMenuClient* client() const { return m_popupClient; }
@@ -64,6 +66,7 @@
PopupMenuPrivate p;
static int s_minimumRowHeight;
+ static int s_optionRowHeightForTouch;
};
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes