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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 return intersection(outerBox, innerBox); | 335 return intersection(outerBox, innerBox); |
336 } | 336 } |
337 | 337 |
338 void RenderMenuList::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const | 338 void RenderMenuList::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const |
339 { | 339 { |
340 maxLogicalWidth = std::max(m_optionsWidth, RenderTheme::theme().minimumMenuL istSize(style())) + m_innerBlock->paddingLeft() + m_innerBlock->paddingRight(); | 340 maxLogicalWidth = std::max(m_optionsWidth, RenderTheme::theme().minimumMenuL istSize(style())) + m_innerBlock->paddingLeft() + m_innerBlock->paddingRight(); |
341 if (!style()->width().isPercent()) | 341 if (!style()->width().isPercent()) |
342 minLogicalWidth = maxLogicalWidth; | 342 minLogicalWidth = maxLogicalWidth; |
343 } | 343 } |
344 | 344 |
345 void RenderMenuList::computePreferredLogicalWidths() | |
346 { | |
347 m_minPreferredLogicalWidth = 0; | |
348 m_maxPreferredLogicalWidth = 0; | |
349 RenderStyle* styleToUse = style(); | |
350 | |
351 if (styleToUse->width().isFixed() && styleToUse->width().value() > 0) | |
352 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB oxLogicalWidthForBoxSizing(styleToUse->width().value()); | |
353 else | |
354 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth); | |
355 | |
356 if (styleToUse->minWidth().isFixed() && styleToUse->minWidth().value() > 0) { | |
357 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value())); | |
358 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value())); | |
359 } | |
360 | |
361 if (styleToUse->maxWidth().isFixed()) { | |
362 m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value())); | |
363 m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value())); | |
364 } | |
365 | |
366 LayoutUnit toAdd = borderAndPaddingWidth(); | |
pdr.
2014/10/02 04:21:47
This is actually different but, as far as I can te
| |
367 m_minPreferredLogicalWidth += toAdd; | |
368 m_maxPreferredLogicalWidth += toAdd; | |
369 | |
370 clearPreferredLogicalWidthsDirty(); | |
371 } | |
372 | |
373 void RenderMenuList::showPopup() | 345 void RenderMenuList::showPopup() |
374 { | 346 { |
375 if (m_popupIsVisible) | 347 if (m_popupIsVisible) |
376 return; | 348 return; |
377 | 349 |
378 if (document().frameHost()->chrome().hasOpenedPopup()) | 350 if (document().frameHost()->chrome().hasOpenedPopup()) |
379 return; | 351 return; |
380 | 352 |
381 // Create m_innerBlock here so it ends up as the first child. | 353 // Create m_innerBlock here so it ends up as the first child. |
382 // This is important because otherwise we might try to create m_innerBlock | 354 // This is important because otherwise we might try to create m_innerBlock |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
619 HTMLElement* element = listItems[listIndex]; | 591 HTMLElement* element = listItems[listIndex]; |
620 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select ed(); | 592 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select ed(); |
621 } | 593 } |
622 | 594 |
623 void RenderMenuList::setTextFromItem(unsigned listIndex) | 595 void RenderMenuList::setTextFromItem(unsigned listIndex) |
624 { | 596 { |
625 setTextFromOption(selectElement()->listToOptionIndex(listIndex)); | 597 setTextFromOption(selectElement()->listToOptionIndex(listIndex)); |
626 } | 598 } |
627 | 599 |
628 } // namespace blink | 600 } // namespace blink |
OLD | NEW |