Changeset 130513 in webkit


Ignore:
Timestamp:
Oct 5, 2012, 9:15:35 AM (13 years ago)
Author:
commit-queue@webkit.org
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 <kevers@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):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r130511 r130513  
     12012-10-05  Kevin Ellis  <kevers@chromium.org>
     2
     3        [chromium] Only inflate the height of rows in a popup menu when a touch device is detected.
     4        https://bugs.webkit.org/show_bug.cgi?id=98515
     5
     6        Reviewed by Adam Barth.
     7
     8        Enforces a minimum row height for popup menus when a touch device is
     9        detected.  In a previous patch (r127597), the sizing of popup was
     10        consolidated for touch and non-touch.  Based on user feedback, reverting
     11        to the old behavior for non-touch and only adding padding for touch
     12        devices seems like a much safer strategy.  This patch is not a direct
     13        revert of r127567 since the padding previously used for touch is a bit
     14        excessive.
     15
     16        Covered by existing tests.
     17
     18        * platform/chromium/PopupListBox.cpp:
     19        (WebCore::PopupListBox::getRowHeight):
     20        * platform/chromium/PopupMenuChromium.cpp:
     21        (WebCore):
     22        * platform/chromium/PopupMenuChromium.h:
     23        (WebCore::PopupMenuChromium::optionRowHeightForTouch):
     24        (WebCore::PopupMenuChromium::setOptionRowHeightForTouch):
     25        (PopupMenuChromium):
     26
    1272012-10-05  Alexander Pavlov  <apavlov@chromium.org>
    228
  • trunk/Source/WebCore/platform/chromium/PopupListBox.cpp

    r127597 r130513  
    615615int PopupListBox::getRowHeight(int index)
    616616{
     617    int minimumHeight = PopupMenuChromium::minimumRowHeight();
     618    if (m_settings.deviceSupportsTouch)
     619        minimumHeight = max(minimumHeight, PopupMenuChromium::optionRowHeightForTouch());
     620
    617621    if (index < 0 || m_popupClient->itemStyle(index).isDisplayNone())
    618         return PopupMenuChromium::minimumRowHeight();
     622        return minimumHeight;
    619623
    620624    // Separator row height is the same size as itself.
    621625    if (m_popupClient->itemIsSeparator(index))
    622         return max(separatorHeight, (PopupMenuChromium::minimumRowHeight()));
     626        return max(separatorHeight, minimumHeight);
    623627
    624628    String icon = m_popupClient->itemIcon(index);
     
    630634    int linePaddingHeight = m_popupClient->menuStyle().menuType() == PopupMenuStyle::AutofillPopup ? kLinePaddingHeight : 0;
    631635    int calculatedRowHeight = max(fontHeight, iconHeight) + linePaddingHeight * 2;
    632     return max(calculatedRowHeight, PopupMenuChromium::minimumRowHeight());
     636    return max(calculatedRowHeight, minimumHeight);
    633637}
    634638
  • trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp

    r127597 r130513  
    4141namespace WebCore {
    4242
    43 int PopupMenuChromium::s_minimumRowHeight = 28;
     43int PopupMenuChromium::s_minimumRowHeight = 0;
     44int PopupMenuChromium::s_optionRowHeightForTouch = 28;
    4445
    4546// The settings used for the drop down menu.
  • trunk/Source/WebCore/platform/chromium/PopupMenuChromium.h

    r127597 r130513  
    5757    static int minimumRowHeight() { return s_minimumRowHeight; }
    5858    static void setMinimumRowHeight(int minimumRowHeight) { s_minimumRowHeight = minimumRowHeight; }
     59    static int optionRowHeightForTouch() { return s_optionRowHeightForTouch; }
     60    static void setOptionRowHeightForTouch(int optionRowHeightForTouch) { s_optionRowHeightForTouch = optionRowHeightForTouch; }
    5961
    6062private:
     
    6567
    6668    static int s_minimumRowHeight;
     69    static int s_optionRowHeightForTouch;
    6770};
    6871
Note: See TracChangeset for help on using the changeset viewer.