OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return height() + marginTop(); | 53 return height() + marginTop(); |
54 } | 54 } |
55 | 55 |
56 void RenderSlider::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, La
youtUnit& maxLogicalWidth) const | 56 void RenderSlider::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, La
youtUnit& maxLogicalWidth) const |
57 { | 57 { |
58 maxLogicalWidth = defaultTrackLength * style()->effectiveZoom(); | 58 maxLogicalWidth = defaultTrackLength * style()->effectiveZoom(); |
59 if (!style()->width().isPercent()) | 59 if (!style()->width().isPercent()) |
60 minLogicalWidth = maxLogicalWidth; | 60 minLogicalWidth = maxLogicalWidth; |
61 } | 61 } |
62 | 62 |
63 void RenderSlider::computePreferredLogicalWidths() | |
64 { | |
65 m_minPreferredLogicalWidth = 0; | |
66 m_maxPreferredLogicalWidth = 0; | |
67 RenderStyle* styleToUse = style(); | |
68 | |
69 if (styleToUse->width().isFixed() && styleToUse->width().value() > 0) | |
70 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB
oxLogicalWidthForBoxSizing(styleToUse->width().value()); | |
71 else | |
72 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred
LogicalWidth); | |
73 | |
74 if (styleToUse->minWidth().isFixed() && styleToUse->minWidth().value() > 0)
{ | |
75 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value())); | |
76 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value())); | |
77 } | |
78 | |
79 if (styleToUse->maxWidth().isFixed()) { | |
80 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value())); | |
81 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value())); | |
82 } | |
83 | |
84 LayoutUnit toAdd = borderAndPaddingWidth(); | |
85 m_minPreferredLogicalWidth += toAdd; | |
86 m_maxPreferredLogicalWidth += toAdd; | |
87 | |
88 clearPreferredLogicalWidthsDirty(); | |
89 } | |
90 | |
91 inline SliderThumbElement* RenderSlider::sliderThumbElement() const | 63 inline SliderThumbElement* RenderSlider::sliderThumbElement() const |
92 { | 64 { |
93 return toSliderThumbElement(toElement(node())->userAgentShadowRoot()->getEle
mentById(ShadowElementNames::sliderThumb())); | 65 return toSliderThumbElement(toElement(node())->userAgentShadowRoot()->getEle
mentById(ShadowElementNames::sliderThumb())); |
94 } | 66 } |
95 | 67 |
96 void RenderSlider::layout() | 68 void RenderSlider::layout() |
97 { | 69 { |
98 // FIXME: Find a way to cascade appearance. | 70 // FIXME: Find a way to cascade appearance. |
99 // http://webkit.org/b/62535 | 71 // http://webkit.org/b/62535 |
100 RenderBox* thumbBox = sliderThumbElement()->renderBox(); | 72 RenderBox* thumbBox = sliderThumbElement()->renderBox(); |
101 if (thumbBox && thumbBox->isSliderThumb()) | 73 if (thumbBox && thumbBox->isSliderThumb()) |
102 static_cast<RenderSliderThumb*>(thumbBox)->updateAppearance(style()); | 74 static_cast<RenderSliderThumb*>(thumbBox)->updateAppearance(style()); |
103 | 75 |
104 RenderFlexibleBox::layout(); | 76 RenderFlexibleBox::layout(); |
105 } | 77 } |
106 | 78 |
107 bool RenderSlider::inDragMode() const | 79 bool RenderSlider::inDragMode() const |
108 { | 80 { |
109 return sliderThumbElement()->active(); | 81 return sliderThumbElement()->active(); |
110 } | 82 } |
111 | 83 |
112 } // namespace blink | 84 } // namespace blink |
OLD | NEW |