| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 void ScrollView::scrollTo(const IntSize& newOffset) | 267 void ScrollView::scrollTo(const IntSize& newOffset) |
| 268 { | 268 { |
| 269 IntSize scrollDelta = newOffset - m_scrollOffset; | 269 IntSize scrollDelta = newOffset - m_scrollOffset; |
| 270 if (scrollDelta == IntSize()) | 270 if (scrollDelta == IntSize()) |
| 271 return; | 271 return; |
| 272 m_scrollOffset = newOffset; | 272 m_scrollOffset = newOffset; |
| 273 | 273 |
| 274 if (scrollbarsSuppressed()) | 274 if (scrollbarsSuppressed()) |
| 275 return; | 275 return; |
| 276 | 276 |
| 277 repaintFixedElementsAfterScrolling(); | 277 m_pendingScrollDelta += scrollDelta; |
| 278 scrollContents(scrollDelta); | |
| 279 updateFixedElementsAfterScrolling(); | |
| 280 } | 278 } |
| 281 | 279 |
| 282 void ScrollView::setScrollPosition(const IntPoint& scrollPoint) | 280 void ScrollView::setScrollPosition(const IntPoint& scrollPoint) |
| 283 { | 281 { |
| 284 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); | 282 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); |
| 285 | 283 |
| 286 if (newScrollPosition == scrollPosition()) | 284 if (newScrollPosition == scrollPosition()) |
| 287 return; | 285 return; |
| 288 | 286 |
| 289 updateScrollbars(IntSize(newScrollPosition.x(), newScrollPosition.y())); | 287 updateScrollbars(IntSize(newScrollPosition.x(), newScrollPosition.y())); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 if (hasOverlayScrollbars()) { | 506 if (hasOverlayScrollbars()) { |
| 509 int verticalScrollbarWidth = (verticalScrollbar() && !hasLayerForVertica
lScrollbar()) ? verticalScrollbar()->width() : 0; | 507 int verticalScrollbarWidth = (verticalScrollbar() && !hasLayerForVertica
lScrollbar()) ? verticalScrollbar()->width() : 0; |
| 510 int horizontalScrollbarHeight = (horizontalScrollbar() && !hasLayerForHo
rizontalScrollbar()) ? horizontalScrollbar()->height() : 0; | 508 int horizontalScrollbarHeight = (horizontalScrollbar() && !hasLayerForHo
rizontalScrollbar()) ? horizontalScrollbar()->height() : 0; |
| 511 | 509 |
| 512 scrollViewRect.setWidth(scrollViewRect.width() - verticalScrollbarWidth)
; | 510 scrollViewRect.setWidth(scrollViewRect.width() - verticalScrollbarWidth)
; |
| 513 scrollViewRect.setHeight(scrollViewRect.height() - horizontalScrollbarHe
ight); | 511 scrollViewRect.setHeight(scrollViewRect.height() - horizontalScrollbarHe
ight); |
| 514 } | 512 } |
| 515 return scrollViewRect; | 513 return scrollViewRect; |
| 516 } | 514 } |
| 517 | 515 |
| 516 void ScrollView::scrollContentsIfNeeded() |
| 517 { |
| 518 if (m_pendingScrollDelta.isZero()) |
| 519 return; |
| 520 IntSize scrollDelta = m_pendingScrollDelta; |
| 521 m_pendingScrollDelta = IntSize(); |
| 522 scrollContents(scrollDelta); |
| 523 } |
| 524 |
| 518 void ScrollView::scrollContents(const IntSize& scrollDelta) | 525 void ScrollView::scrollContents(const IntSize& scrollDelta) |
| 519 { | 526 { |
| 520 HostWindow* window = hostWindow(); | 527 HostWindow* window = hostWindow(); |
| 521 if (!window) | 528 if (!window) |
| 522 return; | 529 return; |
| 523 | 530 |
| 524 // Since scrolling is double buffered, we will be blitting the scroll view's
intersection | 531 // Since scrolling is double buffered, we will be blitting the scroll view's
intersection |
| 525 // with the clip rect every time to keep it smooth. | 532 // with the clip rect every time to keep it smooth. |
| 526 IntRect clipRect = windowClipRect(); | 533 IntRect clipRect = windowClipRect(); |
| 527 IntRect scrollViewRect = rectToCopyOnScroll(); | 534 IntRect scrollViewRect = rectToCopyOnScroll(); |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 int ScrollView::pageStep(ScrollbarOrientation orientation) const | 1122 int ScrollView::pageStep(ScrollbarOrientation orientation) const |
| 1116 { | 1123 { |
| 1117 int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visible
Height(); | 1124 int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visible
Height(); |
| 1118 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging()
; | 1125 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging()
; |
| 1119 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages()); | 1126 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages()); |
| 1120 | 1127 |
| 1121 return std::max(pageStep, 1); | 1128 return std::max(pageStep, 1); |
| 1122 } | 1129 } |
| 1123 | 1130 |
| 1124 } // namespace WebCore | 1131 } // namespace WebCore |
| OLD | NEW |