| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 innerStyle.setAlignSelf(ItemPositionFlexStart); | 112 innerStyle.setAlignSelf(ItemPositionFlexStart); |
| 113 } | 113 } |
| 114 | 114 |
| 115 innerStyle.setPaddingLeft(Length(LayoutTheme::theme().popupInternalPaddingLe
ft(styleRef()), Fixed)); | 115 innerStyle.setPaddingLeft(Length(LayoutTheme::theme().popupInternalPaddingLe
ft(styleRef()), Fixed)); |
| 116 innerStyle.setPaddingRight(Length(LayoutTheme::theme().popupInternalPaddingR
ight(styleRef()), Fixed)); | 116 innerStyle.setPaddingRight(Length(LayoutTheme::theme().popupInternalPaddingR
ight(styleRef()), Fixed)); |
| 117 innerStyle.setPaddingTop(Length(LayoutTheme::theme().popupInternalPaddingTop
(styleRef()), Fixed)); | 117 innerStyle.setPaddingTop(Length(LayoutTheme::theme().popupInternalPaddingTop
(styleRef()), Fixed)); |
| 118 innerStyle.setPaddingBottom(Length(LayoutTheme::theme().popupInternalPadding
Bottom(styleRef()), Fixed)); | 118 innerStyle.setPaddingBottom(Length(LayoutTheme::theme().popupInternalPadding
Bottom(styleRef()), Fixed)); |
| 119 | 119 |
| 120 if (m_optionStyle) { | 120 if (m_optionStyle) { |
| 121 if ((m_optionStyle->direction() != innerStyle.direction() || m_optionSty
le->unicodeBidi() != innerStyle.unicodeBidi())) | 121 if ((m_optionStyle->direction() != innerStyle.direction() || m_optionSty
le->unicodeBidi() != innerStyle.unicodeBidi())) |
| 122 m_innerBlock->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidat
ion(); | 122 m_innerBlock->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidat
ion(LayoutInvalidationReason::StyleChange); |
| 123 innerStyle.setTextAlign(style()->isLeftToRightDirection() ? LEFT : RIGHT
); | 123 innerStyle.setTextAlign(style()->isLeftToRightDirection() ? LEFT : RIGHT
); |
| 124 innerStyle.setDirection(m_optionStyle->direction()); | 124 innerStyle.setDirection(m_optionStyle->direction()); |
| 125 innerStyle.setUnicodeBidi(m_optionStyle->unicodeBidi()); | 125 innerStyle.setUnicodeBidi(m_optionStyle->unicodeBidi()); |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 inline HTMLSelectElement* LayoutMenuList::selectElement() const | 129 inline HTMLSelectElement* LayoutMenuList::selectElement() const |
| 130 { | 130 { |
| 131 return toHTMLSelectElement(node()); | 131 return toHTMLSelectElement(node()); |
| 132 } | 132 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 maxOptionWidth = std::max(maxOptionWidth, style()->font().width(text
)); | 190 maxOptionWidth = std::max(maxOptionWidth, style()->font().width(text
)); |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 | 193 |
| 194 int width = static_cast<int>(ceilf(maxOptionWidth)); | 194 int width = static_cast<int>(ceilf(maxOptionWidth)); |
| 195 if (m_optionsWidth == width) | 195 if (m_optionsWidth == width) |
| 196 return; | 196 return; |
| 197 | 197 |
| 198 m_optionsWidth = width; | 198 m_optionsWidth = width; |
| 199 if (parent()) | 199 if (parent()) |
| 200 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 200 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalida
tionReason::MenuWidthChanged); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void LayoutMenuList::updateFromElement() | 203 void LayoutMenuList::updateFromElement() |
| 204 { | 204 { |
| 205 if (m_optionsChanged) { | 205 if (m_optionsChanged) { |
| 206 updateOptionsWidth(); | 206 updateOptionsWidth(); |
| 207 m_optionsChanged = false; | 207 m_optionsChanged = false; |
| 208 } | 208 } |
| 209 | 209 |
| 210 if (m_popupIsVisible) | 210 if (m_popupIsVisible) |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 HTMLElement* element = listItems[listIndex]; | 599 HTMLElement* element = listItems[listIndex]; |
| 600 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select
ed(); | 600 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select
ed(); |
| 601 } | 601 } |
| 602 | 602 |
| 603 void LayoutMenuList::setTextFromItem(unsigned listIndex) | 603 void LayoutMenuList::setTextFromItem(unsigned listIndex) |
| 604 { | 604 { |
| 605 setTextFromOption(selectElement()->listToOptionIndex(listIndex)); | 605 setTextFromOption(selectElement()->listToOptionIndex(listIndex)); |
| 606 } | 606 } |
| 607 | 607 |
| 608 } // namespace blink | 608 } // namespace blink |
| OLD | NEW |