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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 { | 121 { |
122 if (!length.isIntrinsicOrAuto() || (sizeType == MinSize && length.isAuto())) | 122 if (!length.isIntrinsicOrAuto() || (sizeType == MinSize && length.isAuto())) |
123 return minimumValueForLength(length, LayoutUnit(containingLength)); | 123 return minimumValueForLength(length, LayoutUnit(containingLength)); |
124 return ScrollbarTheme::theme().scrollbarThickness(); | 124 return ScrollbarTheme::theme().scrollbarThickness(); |
125 } | 125 } |
126 | 126 |
127 void LayoutScrollbarPart::computeScrollbarWidth() | 127 void LayoutScrollbarPart::computeScrollbarWidth() |
128 { | 128 { |
129 if (!m_scrollbar->owningLayoutObject()) | 129 if (!m_scrollbar->owningLayoutObject()) |
130 return; | 130 return; |
131 // FIXME: We are querying layout information but nothing guarantees that it'
s up-to-date, especially since we are called at style change. | 131 // FIXME: We are querying layout information but nothing guarantees that it'
s up to date, especially since we are called at style change. |
132 // FIXME: Querying the style's border information doesn't work on table cell
s with collapsing borders. | 132 // FIXME: Querying the style's border information doesn't work on table cell
s with collapsing borders. |
133 int visibleSize = m_scrollbar->owningLayoutObject()->size().width() - m_scro
llbar->owningLayoutObject()->style()->borderLeftWidth() - m_scrollbar->owningLay
outObject()->style()->borderRightWidth(); | 133 int visibleSize = m_scrollbar->owningLayoutObject()->size().width() - m_scro
llbar->owningLayoutObject()->style()->borderLeftWidth() - m_scrollbar->owningLay
outObject()->style()->borderRightWidth(); |
134 int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->width(), v
isibleSize); | 134 int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->width(), v
isibleSize); |
135 int minWidth = calcScrollbarThicknessUsing(MinSize, style()->minWidth(), vis
ibleSize); | 135 int minWidth = calcScrollbarThicknessUsing(MinSize, style()->minWidth(), vis
ibleSize); |
136 int maxWidth = style()->maxWidth().isMaxSizeNone() ? w : calcScrollbarThickn
essUsing(MaxSize, style()->maxWidth(), visibleSize); | 136 int maxWidth = style()->maxWidth().isMaxSizeNone() ? w : calcScrollbarThickn
essUsing(MaxSize, style()->maxWidth(), visibleSize); |
137 setWidth(LayoutUnit(std::max(minWidth, std::min(maxWidth, w)))); | 137 setWidth(LayoutUnit(std::max(minWidth, std::min(maxWidth, w)))); |
138 | 138 |
139 // Buttons and track pieces can all have margins along the axis of the scrol
lbar. | 139 // Buttons and track pieces can all have margins along the axis of the scrol
lbar. |
140 setMarginLeft(minimumValueForLength(style()->marginLeft(), LayoutUnit(visibl
eSize))); | 140 setMarginLeft(minimumValueForLength(style()->marginLeft(), LayoutUnit(visibl
eSize))); |
141 setMarginRight(minimumValueForLength(style()->marginRight(), LayoutUnit(visi
bleSize))); | 141 setMarginRight(minimumValueForLength(style()->marginRight(), LayoutUnit(visi
bleSize))); |
142 } | 142 } |
143 | 143 |
144 void LayoutScrollbarPart::computeScrollbarHeight() | 144 void LayoutScrollbarPart::computeScrollbarHeight() |
145 { | 145 { |
146 if (!m_scrollbar->owningLayoutObject()) | 146 if (!m_scrollbar->owningLayoutObject()) |
147 return; | 147 return; |
148 // FIXME: We are querying layout information but nothing guarantees that it'
s up-to-date, especially since we are called at style change. | 148 // FIXME: We are querying layout information but nothing guarantees that it'
s up to date, especially since we are called at style change. |
149 // FIXME: Querying the style's border information doesn't work on table cell
s with collapsing borders. | 149 // FIXME: Querying the style's border information doesn't work on table cell
s with collapsing borders. |
150 int visibleSize = m_scrollbar->owningLayoutObject()->size().height() - m_sc
rollbar->owningLayoutObject()->style()->borderTopWidth() - m_scrollbar->owningLa
youtObject()->style()->borderBottomWidth(); | 150 int visibleSize = m_scrollbar->owningLayoutObject()->size().height() - m_sc
rollbar->owningLayoutObject()->style()->borderTopWidth() - m_scrollbar->owningLa
youtObject()->style()->borderBottomWidth(); |
151 int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->height(),
visibleSize); | 151 int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->height(),
visibleSize); |
152 int minHeight = calcScrollbarThicknessUsing(MinSize, style()->minHeight(), v
isibleSize); | 152 int minHeight = calcScrollbarThicknessUsing(MinSize, style()->minHeight(), v
isibleSize); |
153 int maxHeight = style()->maxHeight().isMaxSizeNone() ? h : calcScrollbarThic
knessUsing(MaxSize, style()->maxHeight(), visibleSize); | 153 int maxHeight = style()->maxHeight().isMaxSizeNone() ? h : calcScrollbarThic
knessUsing(MaxSize, style()->maxHeight(), visibleSize); |
154 setHeight(LayoutUnit(std::max(minHeight, std::min(maxHeight, h)))); | 154 setHeight(LayoutUnit(std::max(minHeight, std::min(maxHeight, h)))); |
155 | 155 |
156 // Buttons and track pieces can all have margins along the axis of the scrol
lbar. | 156 // Buttons and track pieces can all have margins along the axis of the scrol
lbar. |
157 setMarginTop(minimumValueForLength(style()->marginTop(), LayoutUnit(visibleS
ize))); | 157 setMarginTop(minimumValueForLength(style()->marginTop(), LayoutUnit(visibleS
ize))); |
158 setMarginBottom(minimumValueForLength(style()->marginBottom(), LayoutUnit(vi
sibleSize))); | 158 setMarginBottom(minimumValueForLength(style()->marginBottom(), LayoutUnit(vi
sibleSize))); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 } | 217 } |
218 | 218 |
219 LayoutRect LayoutScrollbarPart::visualRect() const | 219 LayoutRect LayoutScrollbarPart::visualRect() const |
220 { | 220 { |
221 // This returns the combined bounds of all scrollbar parts, which is suffici
ent for correctness | 221 // This returns the combined bounds of all scrollbar parts, which is suffici
ent for correctness |
222 // but not as tight as it could be. | 222 // but not as tight as it could be. |
223 return m_scrollableArea->visualRectForScrollbarParts(); | 223 return m_scrollableArea->visualRectForScrollbarParts(); |
224 } | 224 } |
225 | 225 |
226 } // namespace blink | 226 } // namespace blink |
OLD | NEW |