Changeset 41923 in webkit
- Timestamp:
- Mar 23, 2009 4:46:27 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r41922 r41923 1 2009-03-23 Ada Chan <adachan@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=24762 4 Support text-indent in <option> elements on windows platform. 5 6 Reviewed by Adele Peterson. 7 8 * css/themeWin.css: 9 * platform/PopupMenuStyle.h: We don't honor font specified on <option> elements right now. Make this 10 explicit via windows themed default stylesheet. 11 (WebCore::PopupMenuStyle::PopupMenuStyle): Also store text-indent and text-direction. 12 (WebCore::PopupMenuStyle::textIndent): 13 (WebCore::PopupMenuStyle::textDirection): 14 * platform/win/PopupMenuWin.cpp: 15 (WebCore::PopupMenu::paint): Adjust the text's x-coordinate if text-indent is supported for options and 16 text-indent is specified with LTR direction. 17 * rendering/RenderMenuList.cpp: 18 (WebCore::RenderMenuList::updateOptionsWidth): Take text-indent into account if theme supports text-indent for options. 19 (WebCore::RenderMenuList::itemStyle): Use new PopupMenuStyle constructor on windows. 20 (WebCore::RenderMenuList::menuStyle): Ditto. 21 * rendering/RenderTextControlSingleLine.cpp: 22 (WebCore::RenderTextControlSingleLine::menuStyle): Ditto. 23 * rendering/RenderTheme.h: 24 (WebCore::RenderTheme::popupOptionSupportsTextIndent): Added. Default is false since we are only supporting it in windows for now. 25 * rendering/RenderThemeWin.h: 26 (WebCore::RenderThemeWin::popupOptionSupportsTextIndent): Returns true for windows. 27 1 28 2009-03-23 Sam Weinig <sam@webkit.org> 2 29 -
trunk/WebCore/css/themeWin.css
r41652 r41923 94 94 margin: 0; 95 95 } 96 /* Options always use the selects' fonts */ 97 option { 98 font: inherit !important; 99 } 96 100 97 101 textarea { -
trunk/WebCore/platform/PopupMenuStyle.h
r37295 r41923 29 29 #include "Color.h" 30 30 #include "Font.h" 31 #include "Length.h" 32 #include "TextDirection.h" 31 33 32 34 namespace WebCore { … … 34 36 class PopupMenuStyle { 35 37 public: 36 PopupMenuStyle(const Color& foreground, const Color& background, const Font& font, bool visible )38 PopupMenuStyle(const Color& foreground, const Color& background, const Font& font, bool visible, Length textIndent, TextDirection textDirection) 37 39 : m_foregroundColor(foreground) 38 40 , m_backgroundColor(background) 39 41 , m_font(font) 40 42 , m_visible(visible) 43 , m_textIndent(textIndent) 44 , m_textDirection(textDirection) 41 45 { 42 46 } … … 46 50 const Font& font() const { return m_font; } 47 51 bool isVisible() const { return m_visible; } 52 Length textIndent() const { return m_textIndent; } 53 TextDirection textDirection() const { return m_textDirection; } 48 54 49 55 private: … … 52 58 Font m_font; 53 59 bool m_visible; 60 Length m_textIndent; 61 TextDirection m_textDirection; 54 62 }; 55 63 -
trunk/WebCore/platform/win/PopupMenuWin.cpp
r40020 r41923 528 528 if (itemStyle.isVisible()) { 529 529 int textX = max(0, client()->clientPaddingLeft() - client()->clientInsetLeft()); 530 if (theme()->popupOptionSupportsTextIndent() && itemStyle.textDirection() == LTR) 531 textX += itemStyle.textIndent().calcMinValue(itemRect.width()); 530 532 int textY = itemRect.y() + itemFont.ascent() + (itemRect.height() - itemFont.height()) / 2; 531 533 context.drawBidiText(itemFont, textRun, IntPoint(textX, textY)); -
trunk/WebCore/rendering/RenderMenuList.cpp
r40628 r41923 144 144 145 145 String text = optionElement->textIndentedToRespectGroupLabel(); 146 if (!text.isEmpty()) 146 if (theme()->popupOptionSupportsTextIndent()) { 147 // Add in the option's text indent. We can't calculate percentage values for now. 148 float optionWidth = 0; 149 if (RenderStyle* optionStyle = element->renderStyle()) 150 optionWidth += optionStyle->textIndent().calcMinValue(0); 151 if (!text.isEmpty()) 152 optionWidth += style()->font().floatWidth(text); 153 maxOptionWidth = max(maxOptionWidth, optionWidth); 154 } else if (!text.isEmpty()) 147 155 maxOptionWidth = max(maxOptionWidth, style()->font().floatWidth(text)); 148 156 } … … 333 341 334 342 RenderStyle* style = element->renderStyle() ? element->renderStyle() : element->computedStyle(); 335 return style ? PopupMenuStyle(style->color(), itemBackgroundColor(listIndex), style->font(), style->visibility() == VISIBLE ) : menuStyle();343 return style ? PopupMenuStyle(style->color(), itemBackgroundColor(listIndex), style->font(), style->visibility() == VISIBLE, style->textIndent(), style->direction()) : menuStyle(); 336 344 } 337 345 … … 361 369 362 370 RenderStyle* s = m_innerBlock ? m_innerBlock->style() : style(); 363 return PopupMenuStyle(s->color(), s->backgroundColor(), s->font(), s->visibility() == VISIBLE );371 return PopupMenuStyle(s->color(), s->backgroundColor(), s->font(), s->visibility() == VISIBLE, s->textIndent(), s->direction()); 364 372 } 365 373 -
trunk/WebCore/rendering/RenderTextControlSingleLine.cpp
r41899 r41923 693 693 PopupMenuStyle RenderTextControlSingleLine::menuStyle() const 694 694 { 695 return PopupMenuStyle(style()->color(), style()->backgroundColor(), style()->font(), style()->visibility() == VISIBLE );695 return PopupMenuStyle(style()->color(), style()->backgroundColor(), style()->font(), style()->visibility() == VISIBLE, style()->textIndent(), style()->direction()); 696 696 } 697 697 -
trunk/WebCore/rendering/RenderTheme.h
r41362 r41923 136 136 virtual int popupInternalPaddingTop(RenderStyle*) const { return 0; } 137 137 virtual int popupInternalPaddingBottom(RenderStyle*) const { return 0; } 138 virtual bool popupOptionSupportsTextIndent() const { return false; } 138 139 139 140 virtual int buttonInternalPaddingLeft() const { return 0; } -
trunk/WebCore/rendering/RenderThemeWin.h
r41362 r41923 93 93 virtual void adjustSliderThumbSize(RenderObject*) const; 94 94 95 virtual bool popupOptionSupportsTextIndent() const { return true; } 96 95 97 virtual int buttonInternalPaddingLeft() const; 96 98 virtual int buttonInternalPaddingRight() const;
Note: See TracChangeset
for help on using the changeset viewer.