Changeset 84342 in webkit
- Timestamp:
- Apr 19, 2011 10:16:35 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r84341 r84342 1 2011-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 1 24 2011-04-19 Simon Fraser <simon.fraser@apple.com> 2 25 -
trunk/Source/WebCore/platform/PopupMenuStyle.h
r76983 r84342 36 36 class PopupMenuStyle { 37 37 public: 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) 39 40 : m_foregroundColor(foreground) 40 41 , m_backgroundColor(background) … … 45 46 , m_textDirection(textDirection) 46 47 , m_hasTextDirectionOverride(hasTextDirectionOverride) 48 , m_menuType(menuType) 47 49 { 48 50 } 49 51 50 52 const Color& foregroundColor() const { return m_foregroundColor; } 51 53 const Color& backgroundColor() const { return m_backgroundColor; } … … 56 58 TextDirection textDirection() const { return m_textDirection; } 57 59 bool hasTextDirectionOverride() const { return m_hasTextDirectionOverride; } 58 60 PopupMenuType menuType() const { return m_menuType; } 59 61 private: 60 62 Color m_foregroundColor; … … 66 68 TextDirection m_textDirection; 67 69 bool m_hasTextDirectionOverride; 70 PopupMenuType m_menuType; 68 71 }; 69 72 -
trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp
r83237 r84342 76 76 static const int kMinEndOfLinePadding = 2; 77 77 static const TimeStamp kTypeAheadTimeoutMs = 1000; 78 static const int kLinePaddingHeight = 3; // Padding height put at the top and bottom of each line. 78 79 79 80 // The settings used for the drop down menu. … … 913 914 gc->fillRect(rowRect, backColor, ColorSpaceDeviceRGB); 914 915 916 // It doesn't look good but Autofill requires special style for separator. 917 // Autofill doesn't have padding and #dcdcdc color. 915 918 if (m_popupClient->itemIsSeparator(rowIndex)) { 919 int padding = style.menuType() == PopupMenuStyle::AutofillPopup ? 0 : separatorPadding; 916 920 IntRect separatorRect( 917 rowRect.x() + separatorPadding,921 rowRect.x() + padding, 918 922 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); 921 925 return; 922 926 } … … 989 993 if (itemLabel.isEmpty()) 990 994 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 991 1005 TextRun labelTextRun(itemLabel.characters(), itemLabel.length(), false, 0, 0, TextRun::AllowTrailingExpansion, rtl, style.hasTextDirectionOverride()); 992 1006 if (rightAligned) … … 1105 1119 return 0; 1106 1120 1121 // Separator row height is the same size as itself. 1122 if (m_popupClient->itemIsSeparator(index)) 1123 return separatorHeight; 1124 1107 1125 String icon = m_popupClient->itemIcon(index); 1108 1126 RefPtr<Image> image(Image::loadPlatformResource(icon.utf8().data())); … … 1111 1129 int iconHeight = (image && !image->isNull()) ? image->rect().height() : 0; 1112 1130 1113 return max(fontHeight, iconHeight); 1131 int linePaddingHeight = m_popupClient->menuStyle().menuType() == PopupMenuStyle::AutofillPopup ? kLinePaddingHeight : 0; 1132 return max(fontHeight, iconHeight) + linePaddingHeight * 2; 1114 1133 } 1115 1134 -
trunk/Source/WebKit/chromium/ChangeLog
r84330 r84342 1 2011-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 1 11 2011-04-19 Dirk Pranke <dpranke@chromium.org> 2 12 -
trunk/Source/WebKit/chromium/src/AutoFillPopupMenuClient.cpp
r76983 r84342 292 292 // The direction of text in popup menu is set the same as the direction of 293 293 // 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)); 297 303 298 304 FontDescription warningFontDescription = regularFont.fontDescription(); … … 307 313 m_regularStyle->textIndent(), 308 314 m_regularStyle->textDirection(), 309 m_regularStyle->hasTextDirectionOverride())); 315 m_regularStyle->hasTextDirectionOverride(), 316 PopupMenuStyle::AutofillPopup)); 310 317 } 311 318
Note: See TracChangeset
for help on using the changeset viewer.