| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 { | 286 { |
| 287 maxLogicalWidth = max(m_optionsWidth, RenderTheme::theme().minimumMenuListSi
ze(style())) + m_innerBlock->paddingLeft() + m_innerBlock->paddingRight(); | 287 maxLogicalWidth = max(m_optionsWidth, RenderTheme::theme().minimumMenuListSi
ze(style())) + m_innerBlock->paddingLeft() + m_innerBlock->paddingRight(); |
| 288 if (!style()->width().isPercent()) | 288 if (!style()->width().isPercent()) |
| 289 minLogicalWidth = maxLogicalWidth; | 289 minLogicalWidth = maxLogicalWidth; |
| 290 } | 290 } |
| 291 | 291 |
| 292 void RenderMenuList::computePreferredLogicalWidths() | 292 void RenderMenuList::computePreferredLogicalWidths() |
| 293 { | 293 { |
| 294 m_minPreferredLogicalWidth = 0; | 294 m_minPreferredLogicalWidth = 0; |
| 295 m_maxPreferredLogicalWidth = 0; | 295 m_maxPreferredLogicalWidth = 0; |
| 296 RenderStyle* styleToUse = style(); |
| 296 | 297 |
| 297 if (style()->width().isFixed() && style()->width().value() > 0) | 298 if (styleToUse->width().isFixed() && styleToUse->width().value() > 0) |
| 298 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB
oxLogicalWidthForBoxSizing(style()->width().value()); | 299 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB
oxLogicalWidthForBoxSizing(styleToUse->width().value()); |
| 299 else | 300 else |
| 300 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred
LogicalWidth); | 301 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred
LogicalWidth); |
| 301 | 302 |
| 302 if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) { | 303 if (styleToUse->minWidth().isFixed() && styleToUse->minWidth().value() > 0)
{ |
| 303 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(style()->minWidth().value())); | 304 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value())); |
| 304 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(style()->minWidth().value())); | 305 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value())); |
| 305 } | 306 } |
| 306 | 307 |
| 307 if (style()->maxWidth().isFixed()) { | 308 if (styleToUse->maxWidth().isFixed()) { |
| 308 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(style()->maxWidth().value())); | 309 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value())); |
| 309 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(style()->maxWidth().value())); | 310 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value())); |
| 310 } | 311 } |
| 311 | 312 |
| 312 LayoutUnit toAdd = borderAndPaddingWidth(); | 313 LayoutUnit toAdd = borderAndPaddingWidth(); |
| 313 m_minPreferredLogicalWidth += toAdd; | 314 m_minPreferredLogicalWidth += toAdd; |
| 314 m_maxPreferredLogicalWidth += toAdd; | 315 m_maxPreferredLogicalWidth += toAdd; |
| 315 | 316 |
| 316 clearPreferredLogicalWidthsDirty(); | 317 clearPreferredLogicalWidthsDirty(); |
| 317 } | 318 } |
| 318 | 319 |
| 319 void RenderMenuList::showPopup() | 320 void RenderMenuList::showPopup() |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 HTMLElement* element = listItems[listIndex]; | 565 HTMLElement* element = listItems[listIndex]; |
| 565 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select
ed(); | 566 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select
ed(); |
| 566 } | 567 } |
| 567 | 568 |
| 568 void RenderMenuList::setTextFromItem(unsigned listIndex) | 569 void RenderMenuList::setTextFromItem(unsigned listIndex) |
| 569 { | 570 { |
| 570 setTextFromOption(selectElement()->listToOptionIndex(listIndex)); | 571 setTextFromOption(selectElement()->listToOptionIndex(listIndex)); |
| 571 } | 572 } |
| 572 | 573 |
| 573 } | 574 } |
| OLD | NEW |