Changeset 84342 in webkit


Ignore:
Timestamp:
Apr 19, 2011 10:16:35 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-19 Naoki Takano <takano.naoki@gmail.com>

Reviewed by Kent Tamura.

[Chromium]UI polishes and tweaks to Autofill dropdown menu.
https://bugs.webkit.org/show_bug.cgi?id=58505
http://code.google.com/p/chromium/issues/detail?id=51077

No new tests. Because this is autofill looking problem in Chromium.
Add m_menuType as PopupMenuStyle to change popup style change.
Put kLinePaddingHeight at the top and bottom of each line if m_menuType is AutofillPopup.
Change separator color to #dcdcdc and remove sparatorPadding at the edge if m_menuType is AutofillPopup.
Change the line height of separator as only the piece if m_menuType is AutofillPopup.
Change the label font size 0.9 time smaller than regular font size if m_menuType is AutofillPopup.

  • platform/PopupMenuStyle.h: Add enum PopupMenuType; (WebCore::PopupMenuStyle::PopupMenuStyle): Add m_menuType. (WebCore::PopupMenuStyle::menuType): Add to change the style according to the return value.
  • platform/chromium/PopupMenuChromium.cpp: (WebCore::PopupListBox::paintRow):Change the separator color to #dcdcdc. Change the edge padding according to menuStyle(). (WebCore::PopupListBox::getRowHeight): Add kLineHeightMargin*2 for each line height.

2011-04-19 Naoki Takano <takano.naoki@gmail.com>

Reviewed by Kent Tamura.

[Chromium]UI polishes and tweaks to Autofill dropdown menu.
https://bugs.webkit.org/show_bug.cgi?id=58505

  • src/AutoFillPopupMenuClient.cpp: (WebKit::AutoFillPopupMenuClient::initialize): Set AutofillPopup for menuStyle.
Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r84341 r84342  
     12011-04-19  Naoki Takano  <takano.naoki@gmail.com>
     2
     3        Reviewed by Kent Tamura.
     4
     5        [Chromium]UI polishes and tweaks to Autofill dropdown menu.
     6        https://bugs.webkit.org/show_bug.cgi?id=58505
     7        http://code.google.com/p/chromium/issues/detail?id=51077
     8
     9        No new tests. Because this is autofill looking problem in Chromium.
     10        Add m_menuType as PopupMenuStyle to change popup style change.
     11        Put kLinePaddingHeight at the top and bottom of each line if m_menuType is AutofillPopup.
     12        Change separator color to #dcdcdc and remove sparatorPadding at the edge if m_menuType is AutofillPopup.
     13        Change the line height of separator as only the piece if m_menuType is AutofillPopup.
     14        Change the label font size 0.9 time smaller than regular font size if m_menuType is AutofillPopup.
     15
     16        * platform/PopupMenuStyle.h: Add enum PopupMenuType;
     17        (WebCore::PopupMenuStyle::PopupMenuStyle): Add m_menuType.
     18        (WebCore::PopupMenuStyle::menuType): Add to change the style according to the return value.
     19        * platform/chromium/PopupMenuChromium.cpp:
     20        (WebCore::PopupListBox::paintRow):Change the separator color to #dcdcdc.
     21        Change the edge padding according to menuStyle().
     22        (WebCore::PopupListBox::getRowHeight): Add kLineHeightMargin*2 for each line height.
     23
    1242011-04-19  Simon Fraser  <simon.fraser@apple.com>
    225
  • trunk/Source/WebCore/platform/PopupMenuStyle.h

    r76983 r84342  
    3636class PopupMenuStyle {
    3737public:
    38     PopupMenuStyle(const Color& foreground, const Color& background, const Font& font, bool visible, bool isDisplayNone, Length textIndent, TextDirection textDirection, bool hasTextDirectionOverride)
     38    enum PopupMenuType { SelectPopup, AutofillPopup };
     39    PopupMenuStyle(const Color& foreground, const Color& background, const Font& font, bool visible, bool isDisplayNone, Length textIndent, TextDirection textDirection, bool hasTextDirectionOverride, PopupMenuType menuType = SelectPopup)
    3940        : m_foregroundColor(foreground)
    4041        , m_backgroundColor(background)
     
    4546        , m_textDirection(textDirection)
    4647        , m_hasTextDirectionOverride(hasTextDirectionOverride)
     48        , m_menuType(menuType)
    4749    {
    4850    }
    49    
     51
    5052    const Color& foregroundColor() const { return m_foregroundColor; }
    5153    const Color& backgroundColor() const { return m_backgroundColor; }
     
    5658    TextDirection textDirection() const { return m_textDirection; }
    5759    bool hasTextDirectionOverride() const { return m_hasTextDirectionOverride; }
    58 
     60    PopupMenuType menuType() const { return m_menuType; }
    5961private:
    6062    Color m_foregroundColor;
     
    6668    TextDirection m_textDirection;
    6769    bool m_hasTextDirectionOverride;
     70    PopupMenuType m_menuType;
    6871};
    6972
  • trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp

    r83237 r84342  
    7676static const int kMinEndOfLinePadding = 2;
    7777static const TimeStamp kTypeAheadTimeoutMs = 1000;
     78static const int kLinePaddingHeight = 3; // Padding height put at the top and bottom of each line.
    7879
    7980// The settings used for the drop down menu.
     
    913914    gc->fillRect(rowRect, backColor, ColorSpaceDeviceRGB);
    914915
     916    // It doesn't look good but Autofill requires special style for separator.
     917    // Autofill doesn't have padding and #dcdcdc color.
    915918    if (m_popupClient->itemIsSeparator(rowIndex)) {
     919        int padding = style.menuType() == PopupMenuStyle::AutofillPopup ? 0 : separatorPadding;
    916920        IntRect separatorRect(
    917             rowRect.x() + separatorPadding,
     921            rowRect.x() + padding,
    918922            rowRect.y() + (rowRect.height() - separatorHeight) / 2,
    919             rowRect.width() - 2 * separatorPadding, separatorHeight);
    920         gc->fillRect(separatorRect, textColor, ColorSpaceDeviceRGB);
     923            rowRect.width() - 2 * padding, separatorHeight);
     924        gc->fillRect(separatorRect, style.menuType() == PopupMenuStyle::AutofillPopup ? Color(0xdc, 0xdc, 0xdc) : textColor, ColorSpaceDeviceRGB);
    921925        return;
    922926    }
     
    989993    if (itemLabel.isEmpty())
    990994        return;
     995
     996    // Autofill label is 0.9 smaller than regular font size.
     997    if (style.menuType() == PopupMenuStyle::AutofillPopup) {
     998        itemFont = m_popupClient->itemStyle(rowIndex).font();
     999        FontDescription d = itemFont.fontDescription();
     1000        d.setComputedSize(d.computedSize() * 0.9);
     1001        itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing());
     1002        itemFont.update(0);
     1003    }
     1004
    9911005    TextRun labelTextRun(itemLabel.characters(), itemLabel.length(), false, 0, 0, TextRun::AllowTrailingExpansion, rtl, style.hasTextDirectionOverride());
    9921006    if (rightAligned)
     
    11051119        return 0;
    11061120
     1121    // Separator row height is the same size as itself.
     1122    if (m_popupClient->itemIsSeparator(index))
     1123        return separatorHeight;
     1124
    11071125    String icon = m_popupClient->itemIcon(index);
    11081126    RefPtr<Image> image(Image::loadPlatformResource(icon.utf8().data()));
     
    11111129    int iconHeight = (image && !image->isNull()) ? image->rect().height() : 0;
    11121130
    1113     return max(fontHeight, iconHeight);
     1131    int linePaddingHeight = m_popupClient->menuStyle().menuType() == PopupMenuStyle::AutofillPopup ? kLinePaddingHeight : 0;
     1132    return max(fontHeight, iconHeight) + linePaddingHeight * 2;
    11141133}
    11151134
  • trunk/Source/WebKit/chromium/ChangeLog

    r84330 r84342  
     12011-04-19  Naoki Takano  <takano.naoki@gmail.com>
     2
     3        Reviewed by Kent Tamura.
     4
     5        [Chromium]UI polishes and tweaks to Autofill dropdown menu.
     6        https://bugs.webkit.org/show_bug.cgi?id=58505
     7
     8        * src/AutoFillPopupMenuClient.cpp:
     9        (WebKit::AutoFillPopupMenuClient::initialize): Set AutofillPopup for menuStyle.
     10
    1112011-04-19  Dirk Pranke  <dpranke@chromium.org>
    212
  • trunk/Source/WebKit/chromium/src/AutoFillPopupMenuClient.cpp

    r76983 r84342  
    292292    // The direction of text in popup menu is set the same as the direction of
    293293    // the input element: textField.
    294     m_regularStyle.set(new PopupMenuStyle(Color::black, Color::white, regularFont,
    295                                           true, false, Length(WebCore::Fixed),
    296                                           textField->renderer()->style()->direction(), textField->renderer()->style()->unicodeBidi() == Override));
     294    m_regularStyle.set(new PopupMenuStyle(Color::black,
     295                                          Color::white,
     296                                          regularFont,
     297                                          true,
     298                                          false,
     299                                          Length(WebCore::Fixed),
     300                                          textField->renderer()->style()->direction(),
     301                                          textField->renderer()->style()->unicodeBidi() == Override,
     302                                          PopupMenuStyle::AutofillPopup));
    297303
    298304    FontDescription warningFontDescription = regularFont.fontDescription();
     
    307313                                          m_regularStyle->textIndent(),
    308314                                          m_regularStyle->textDirection(),
    309                                           m_regularStyle->hasTextDirectionOverride()));
     315                                          m_regularStyle->hasTextDirectionOverride(),
     316                                          PopupMenuStyle::AutofillPopup));
    310317}
    311318
Note: See TracChangeset for help on using the changeset viewer.