| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 133 } |
| 134 | 134 |
| 135 void LayoutScrollbarPart::computeScrollbarWidth() { | 135 void LayoutScrollbarPart::computeScrollbarWidth() { |
| 136 if (!m_scrollbar->owningLayoutObject()) | 136 if (!m_scrollbar->owningLayoutObject()) |
| 137 return; | 137 return; |
| 138 // FIXME: We are querying layout information but nothing guarantees that it's | 138 // FIXME: We are querying layout information but nothing guarantees that it's |
| 139 // up to date, especially since we are called at style change. | 139 // up to date, especially since we are called at style change. |
| 140 // FIXME: Querying the style's border information doesn't work on table cells | 140 // FIXME: Querying the style's border information doesn't work on table cells |
| 141 // with collapsing borders. | 141 // with collapsing borders. |
| 142 int visibleSize = | 142 int visibleSize = |
| 143 (m_scrollbar->owningLayoutObject()->size().width() - | 143 m_scrollbar->owningLayoutObject()->size().width() - |
| 144 m_scrollbar->owningLayoutObject()->style()->borderLeftWidth() - | 144 m_scrollbar->owningLayoutObject()->style()->borderLeftWidth() - |
| 145 m_scrollbar->owningLayoutObject()->style()->borderRightWidth()) | 145 m_scrollbar->owningLayoutObject()->style()->borderRightWidth(); |
| 146 .toInt(); | |
| 147 int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->width(), | 146 int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->width(), |
| 148 visibleSize); | 147 visibleSize); |
| 149 int minWidth = | 148 int minWidth = |
| 150 calcScrollbarThicknessUsing(MinSize, style()->minWidth(), visibleSize); | 149 calcScrollbarThicknessUsing(MinSize, style()->minWidth(), visibleSize); |
| 151 int maxWidth = style()->maxWidth().isMaxSizeNone() | 150 int maxWidth = style()->maxWidth().isMaxSizeNone() |
| 152 ? w | 151 ? w |
| 153 : calcScrollbarThicknessUsing(MaxSize, style()->maxWidth(), | 152 : calcScrollbarThicknessUsing(MaxSize, style()->maxWidth(), |
| 154 visibleSize); | 153 visibleSize); |
| 155 setWidth(LayoutUnit(std::max(minWidth, std::min(maxWidth, w)))); | 154 setWidth(LayoutUnit(std::max(minWidth, std::min(maxWidth, w)))); |
| 156 | 155 |
| 157 // Buttons and track pieces can all have margins along the axis of the | 156 // Buttons and track pieces can all have margins along the axis of the |
| 158 // scrollbar. | 157 // scrollbar. |
| 159 setMarginLeft( | 158 setMarginLeft( |
| 160 minimumValueForLength(style()->marginLeft(), LayoutUnit(visibleSize))); | 159 minimumValueForLength(style()->marginLeft(), LayoutUnit(visibleSize))); |
| 161 setMarginRight( | 160 setMarginRight( |
| 162 minimumValueForLength(style()->marginRight(), LayoutUnit(visibleSize))); | 161 minimumValueForLength(style()->marginRight(), LayoutUnit(visibleSize))); |
| 163 } | 162 } |
| 164 | 163 |
| 165 void LayoutScrollbarPart::computeScrollbarHeight() { | 164 void LayoutScrollbarPart::computeScrollbarHeight() { |
| 166 if (!m_scrollbar->owningLayoutObject()) | 165 if (!m_scrollbar->owningLayoutObject()) |
| 167 return; | 166 return; |
| 168 // FIXME: We are querying layout information but nothing guarantees that it's | 167 // FIXME: We are querying layout information but nothing guarantees that it's |
| 169 // up to date, especially since we are called at style change. | 168 // up to date, especially since we are called at style change. |
| 170 // FIXME: Querying the style's border information doesn't work on table cells | 169 // FIXME: Querying the style's border information doesn't work on table cells |
| 171 // with collapsing borders. | 170 // with collapsing borders. |
| 172 int visibleSize = | 171 int visibleSize = |
| 173 (m_scrollbar->owningLayoutObject()->size().height() - | 172 m_scrollbar->owningLayoutObject()->size().height() - |
| 174 m_scrollbar->owningLayoutObject()->style()->borderTopWidth() - | 173 m_scrollbar->owningLayoutObject()->style()->borderTopWidth() - |
| 175 m_scrollbar->owningLayoutObject()->style()->borderBottomWidth()) | 174 m_scrollbar->owningLayoutObject()->style()->borderBottomWidth(); |
| 176 .toInt(); | |
| 177 int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->height(), | 175 int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->height(), |
| 178 visibleSize); | 176 visibleSize); |
| 179 int minHeight = | 177 int minHeight = |
| 180 calcScrollbarThicknessUsing(MinSize, style()->minHeight(), visibleSize); | 178 calcScrollbarThicknessUsing(MinSize, style()->minHeight(), visibleSize); |
| 181 int maxHeight = style()->maxHeight().isMaxSizeNone() | 179 int maxHeight = style()->maxHeight().isMaxSizeNone() |
| 182 ? h | 180 ? h |
| 183 : calcScrollbarThicknessUsing( | 181 : calcScrollbarThicknessUsing( |
| 184 MaxSize, style()->maxHeight(), visibleSize); | 182 MaxSize, style()->maxHeight(), visibleSize); |
| 185 setHeight(LayoutUnit(std::max(minHeight, std::min(maxHeight, h)))); | 183 setHeight(LayoutUnit(std::max(minHeight, std::min(maxHeight, h)))); |
| 186 | 184 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 m_scrollableArea->setScrollCornerNeedsPaintInvalidation(); | 245 m_scrollableArea->setScrollCornerNeedsPaintInvalidation(); |
| 248 } | 246 } |
| 249 | 247 |
| 250 LayoutRect LayoutScrollbarPart::visualRect() const { | 248 LayoutRect LayoutScrollbarPart::visualRect() const { |
| 251 // This returns the combined bounds of all scrollbar parts, which is | 249 // This returns the combined bounds of all scrollbar parts, which is |
| 252 // sufficient for correctness but not as tight as it could be. | 250 // sufficient for correctness but not as tight as it could be. |
| 253 return m_scrollableArea->visualRectForScrollbarParts(); | 251 return m_scrollableArea->visualRectForScrollbarParts(); |
| 254 } | 252 } |
| 255 | 253 |
| 256 } // namespace blink | 254 } // namespace blink |
| OLD | NEW |