OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 if (!length.isIntrinsicOrAuto() || (sizeType == MinSize && length.isAuto())) | 84 if (!length.isIntrinsicOrAuto() || (sizeType == MinSize && length.isAuto())) |
85 return minimumValueForLength(length, containingLength, renderView); | 85 return minimumValueForLength(length, containingLength, renderView); |
86 return ScrollbarTheme::theme()->scrollbarThickness(); | 86 return ScrollbarTheme::theme()->scrollbarThickness(); |
87 } | 87 } |
88 | 88 |
89 void RenderScrollbarPart::computeScrollbarWidth() | 89 void RenderScrollbarPart::computeScrollbarWidth() |
90 { | 90 { |
91 if (!m_scrollbar->owningRenderer()) | 91 if (!m_scrollbar->owningRenderer()) |
92 return; | 92 return; |
93 RenderView* renderView = view(); | 93 RenderView* renderView = view(); |
94 int visibleSize = m_scrollbar->owningRenderer()->width() - m_scrollbar->owni
ngRenderer()->borderLeft() - m_scrollbar->owningRenderer()->borderRight(); | 94 // FIXME: We are querying layout information but nothing guarantees that it'
s up-to-date, especially since we are called at style change. |
| 95 // FIXME: Querying the style's border information doesn't work on table cell
s with collapsing borders. |
| 96 int visibleSize = m_scrollbar->owningRenderer()->width() - m_scrollbar->owni
ngRenderer()->style()->borderLeftWidth() - m_scrollbar->owningRenderer()->style(
)->borderRightWidth(); |
95 int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->width(), v
isibleSize, renderView); | 97 int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->width(), v
isibleSize, renderView); |
96 int minWidth = calcScrollbarThicknessUsing(MinSize, style()->minWidth(), vis
ibleSize, renderView); | 98 int minWidth = calcScrollbarThicknessUsing(MinSize, style()->minWidth(), vis
ibleSize, renderView); |
97 int maxWidth = style()->maxWidth().isUndefined() ? w : calcScrollbarThicknes
sUsing(MaxSize, style()->maxWidth(), visibleSize, renderView); | 99 int maxWidth = style()->maxWidth().isUndefined() ? w : calcScrollbarThicknes
sUsing(MaxSize, style()->maxWidth(), visibleSize, renderView); |
98 setWidth(max(minWidth, min(maxWidth, w))); | 100 setWidth(max(minWidth, min(maxWidth, w))); |
99 | 101 |
100 // Buttons and track pieces can all have margins along the axis of the scrol
lbar. | 102 // Buttons and track pieces can all have margins along the axis of the scrol
lbar. |
101 m_marginBox.setLeft(minimumValueForLength(style()->marginLeft(), visibleSize
, renderView)); | 103 m_marginBox.setLeft(minimumValueForLength(style()->marginLeft(), visibleSize
, renderView)); |
102 m_marginBox.setRight(minimumValueForLength(style()->marginRight(), visibleSi
ze, renderView)); | 104 m_marginBox.setRight(minimumValueForLength(style()->marginRight(), visibleSi
ze, renderView)); |
103 } | 105 } |
104 | 106 |
105 void RenderScrollbarPart::computeScrollbarHeight() | 107 void RenderScrollbarPart::computeScrollbarHeight() |
106 { | 108 { |
107 if (!m_scrollbar->owningRenderer()) | 109 if (!m_scrollbar->owningRenderer()) |
108 return; | 110 return; |
109 RenderView* renderView = view(); | 111 RenderView* renderView = view(); |
110 int visibleSize = m_scrollbar->owningRenderer()->height() - m_scrollbar->ow
ningRenderer()->borderTop() - m_scrollbar->owningRenderer()->borderBottom(); | 112 // FIXME: We are querying layout information but nothing guarantees that it'
s up-to-date, especially since we are called at style change. |
| 113 // FIXME: Querying the style's border information doesn't work on table cell
s with collapsing borders. |
| 114 int visibleSize = m_scrollbar->owningRenderer()->height() - m_scrollbar->ow
ningRenderer()->style()->borderTopWidth() - m_scrollbar->owningRenderer()->style
()->borderBottomWidth(); |
111 int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->height(),
visibleSize, renderView); | 115 int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->height(),
visibleSize, renderView); |
112 int minHeight = calcScrollbarThicknessUsing(MinSize, style()->minHeight(), v
isibleSize, renderView); | 116 int minHeight = calcScrollbarThicknessUsing(MinSize, style()->minHeight(), v
isibleSize, renderView); |
113 int maxHeight = style()->maxHeight().isUndefined() ? h : calcScrollbarThickn
essUsing(MaxSize, style()->maxHeight(), visibleSize, renderView); | 117 int maxHeight = style()->maxHeight().isUndefined() ? h : calcScrollbarThickn
essUsing(MaxSize, style()->maxHeight(), visibleSize, renderView); |
114 setHeight(max(minHeight, min(maxHeight, h))); | 118 setHeight(max(minHeight, min(maxHeight, h))); |
115 | 119 |
116 // Buttons and track pieces can all have margins along the axis of the scrol
lbar. | 120 // Buttons and track pieces can all have margins along the axis of the scrol
lbar. |
117 m_marginBox.setTop(minimumValueForLength(style()->marginTop(), visibleSize,
renderView)); | 121 m_marginBox.setTop(minimumValueForLength(style()->marginTop(), visibleSize,
renderView)); |
118 m_marginBox.setBottom(minimumValueForLength(style()->marginBottom(), visible
Size, renderView)); | 122 m_marginBox.setBottom(minimumValueForLength(style()->marginBottom(), visible
Size, renderView)); |
119 } | 123 } |
120 | 124 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 } | 189 } |
186 | 190 |
187 RenderObject* RenderScrollbarPart::rendererOwningScrollbar() const | 191 RenderObject* RenderScrollbarPart::rendererOwningScrollbar() const |
188 { | 192 { |
189 if (!m_scrollbar) | 193 if (!m_scrollbar) |
190 return 0; | 194 return 0; |
191 return m_scrollbar->owningRenderer(); | 195 return m_scrollbar->owningRenderer(); |
192 } | 196 } |
193 | 197 |
194 } | 198 } |
OLD | NEW |