OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the select element renderer in WebCore. | 2 * This file is part of the select element renderer in WebCore. |
3 * | 3 * |
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
5 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
6 * 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 6 * 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 innerStyle->setAlignSelf(ItemPositionFlexStart); | 107 innerStyle->setAlignSelf(ItemPositionFlexStart); |
108 } | 108 } |
109 | 109 |
110 innerStyle->setPaddingLeft(Length(RenderTheme::theme().popupInternalPaddingL
eft(style()), Fixed)); | 110 innerStyle->setPaddingLeft(Length(RenderTheme::theme().popupInternalPaddingL
eft(style()), Fixed)); |
111 innerStyle->setPaddingRight(Length(RenderTheme::theme().popupInternalPadding
Right(style()), Fixed)); | 111 innerStyle->setPaddingRight(Length(RenderTheme::theme().popupInternalPadding
Right(style()), Fixed)); |
112 innerStyle->setPaddingTop(Length(RenderTheme::theme().popupInternalPaddingTo
p(style()), Fixed)); | 112 innerStyle->setPaddingTop(Length(RenderTheme::theme().popupInternalPaddingTo
p(style()), Fixed)); |
113 innerStyle->setPaddingBottom(Length(RenderTheme::theme().popupInternalPaddin
gBottom(style()), Fixed)); | 113 innerStyle->setPaddingBottom(Length(RenderTheme::theme().popupInternalPaddin
gBottom(style()), Fixed)); |
114 | 114 |
115 if (m_optionStyle) { | 115 if (m_optionStyle) { |
116 if ((m_optionStyle->direction() != innerStyle->direction() || m_optionSt
yle->unicodeBidi() != innerStyle->unicodeBidi())) | 116 if ((m_optionStyle->direction() != innerStyle->direction() || m_optionSt
yle->unicodeBidi() != innerStyle->unicodeBidi())) |
117 m_innerBlock->setNeedsLayoutAndPrefWidthsRecalc(); | 117 m_innerBlock->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
118 innerStyle->setTextAlign(style()->isLeftToRightDirection() ? LEFT : RIGH
T); | 118 innerStyle->setTextAlign(style()->isLeftToRightDirection() ? LEFT : RIGH
T); |
119 innerStyle->setDirection(m_optionStyle->direction()); | 119 innerStyle->setDirection(m_optionStyle->direction()); |
120 innerStyle->setUnicodeBidi(m_optionStyle->unicodeBidi()); | 120 innerStyle->setUnicodeBidi(m_optionStyle->unicodeBidi()); |
121 } | 121 } |
122 } | 122 } |
123 | 123 |
124 inline HTMLSelectElement* RenderMenuList::selectElement() const | 124 inline HTMLSelectElement* RenderMenuList::selectElement() const |
125 { | 125 { |
126 return toHTMLSelectElement(node()); | 126 return toHTMLSelectElement(node()); |
127 } | 127 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 } else if (!text.isEmpty()) | 184 } else if (!text.isEmpty()) |
185 maxOptionWidth = max(maxOptionWidth, style()->font().width(text)); | 185 maxOptionWidth = max(maxOptionWidth, style()->font().width(text)); |
186 } | 186 } |
187 | 187 |
188 int width = static_cast<int>(ceilf(maxOptionWidth)); | 188 int width = static_cast<int>(ceilf(maxOptionWidth)); |
189 if (m_optionsWidth == width) | 189 if (m_optionsWidth == width) |
190 return; | 190 return; |
191 | 191 |
192 m_optionsWidth = width; | 192 m_optionsWidth = width; |
193 if (parent()) | 193 if (parent()) |
194 setNeedsLayoutAndPrefWidthsRecalc(); | 194 setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
195 } | 195 } |
196 | 196 |
197 void RenderMenuList::updateFromElement() | 197 void RenderMenuList::updateFromElement() |
198 { | 198 { |
199 if (m_optionsChanged) { | 199 if (m_optionsChanged) { |
200 updateOptionsWidth(); | 200 updateOptionsWidth(); |
201 m_optionsChanged = false; | 201 m_optionsChanged = false; |
202 } | 202 } |
203 | 203 |
204 if (m_popupIsVisible) { | 204 if (m_popupIsVisible) { |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 HTMLElement* element = listItems[listIndex]; | 571 HTMLElement* element = listItems[listIndex]; |
572 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select
ed(); | 572 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select
ed(); |
573 } | 573 } |
574 | 574 |
575 void RenderMenuList::setTextFromItem(unsigned listIndex) | 575 void RenderMenuList::setTextFromItem(unsigned listIndex) |
576 { | 576 { |
577 setTextFromOption(selectElement()->listToOptionIndex(listIndex)); | 577 setTextFromOption(selectElement()->listToOptionIndex(listIndex)); |
578 } | 578 } |
579 | 579 |
580 } | 580 } |
OLD | NEW |