| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 IntRect ScrollView::visibleContentRect(VisibleContentRectIncludesScrollbars scol
lbarInclusion) const | 206 IntRect ScrollView::visibleContentRect(VisibleContentRectIncludesScrollbars scol
lbarInclusion) const |
| 207 { | 207 { |
| 208 FloatSize visibleContentSize = unscaledVisibleContentSize(scollbarInclusion)
; | 208 FloatSize visibleContentSize = unscaledVisibleContentSize(scollbarInclusion)
; |
| 209 visibleContentSize.scale(1 / visibleContentScaleFactor()); | 209 visibleContentSize.scale(1 / visibleContentScaleFactor()); |
| 210 return IntRect(IntPoint(m_scrollOffset), expandedIntSize(visibleContentSize)
); | 210 return IntRect(IntPoint(m_scrollOffset), expandedIntSize(visibleContentSize)
); |
| 211 } | 211 } |
| 212 | 212 |
| 213 IntSize ScrollView::layoutSize(VisibleContentRectIncludesScrollbars scrollbarInc
lusion) const | 213 IntSize ScrollView::layoutSize(VisibleContentRectIncludesScrollbars scrollbarInc
lusion) const |
| 214 { | 214 { |
| 215 return m_fixedLayoutSize.isEmpty() || !m_useFixedLayout ? unscaledVisibleCon
tentSize(scrollbarInclusion) : m_fixedLayoutSize; | 215 return unscaledVisibleContentSize(scrollbarInclusion); |
| 216 } | |
| 217 | |
| 218 IntSize ScrollView::fixedLayoutSize() const | |
| 219 { | |
| 220 return m_fixedLayoutSize; | |
| 221 } | |
| 222 | |
| 223 void ScrollView::setFixedLayoutSize(const IntSize& newSize) | |
| 224 { | |
| 225 if (fixedLayoutSize() == newSize) | |
| 226 return; | |
| 227 m_fixedLayoutSize = newSize; | |
| 228 updateScrollbars(scrollOffset()); | |
| 229 if (m_useFixedLayout) | |
| 230 contentsResized(); | |
| 231 } | |
| 232 | |
| 233 bool ScrollView::useFixedLayout() const | |
| 234 { | |
| 235 return m_useFixedLayout; | |
| 236 } | |
| 237 | |
| 238 void ScrollView::setUseFixedLayout(bool enable) | |
| 239 { | |
| 240 if (useFixedLayout() == enable) | |
| 241 return; | |
| 242 m_useFixedLayout = enable; | |
| 243 updateScrollbars(scrollOffset()); | |
| 244 contentsResized(); | |
| 245 } | 216 } |
| 246 | 217 |
| 247 IntSize ScrollView::contentsSize() const | 218 IntSize ScrollView::contentsSize() const |
| 248 { | 219 { |
| 249 return m_contentsSize; | 220 return m_contentsSize; |
| 250 } | 221 } |
| 251 | 222 |
| 252 void ScrollView::setContentsSize(const IntSize& newSize) | 223 void ScrollView::setContentsSize(const IntSize& newSize) |
| 253 { | 224 { |
| 254 if (contentsSize() == newSize) | 225 if (contentsSize() == newSize) |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 return; | 1140 return; |
| 1170 | 1141 |
| 1171 ScrollableArea::setScrollOrigin(origin); | 1142 ScrollableArea::setScrollOrigin(origin); |
| 1172 | 1143 |
| 1173 // Update if the scroll origin changes, since our position will be different
if the content size did not change. | 1144 // Update if the scroll origin changes, since our position will be different
if the content size did not change. |
| 1174 if (updatePositionAtAll && updatePositionSynchronously) | 1145 if (updatePositionAtAll && updatePositionSynchronously) |
| 1175 updateScrollbars(scrollOffset()); | 1146 updateScrollbars(scrollOffset()); |
| 1176 } | 1147 } |
| 1177 | 1148 |
| 1178 } | 1149 } |
| OLD | NEW |