Chromium Code Reviews| 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 m_scrollDelta += scrollDelta; | |
| 278 | |
| 279 // invalidateFixedElementsBeforeScrolling(scrollDelta, rectToCopyOnScroll()) ; | |
|
abarth-chromium
2014/03/08 06:54:52
I couldn't find where we actually call this functi
ykyyip
2014/03/11 01:59:39
Yes, I actually don't need this function with the
| |
| 277 repaintFixedElementsAfterScrolling(); | 280 repaintFixedElementsAfterScrolling(); |
| 278 scrollContents(scrollDelta); | |
| 279 updateFixedElementsAfterScrolling(); | 281 updateFixedElementsAfterScrolling(); |
| 280 } | 282 } |
| 281 | 283 |
| 282 void ScrollView::setScrollPosition(const IntPoint& scrollPoint) | 284 void ScrollView::setScrollPosition(const IntPoint& scrollPoint) |
| 283 { | 285 { |
| 284 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); | 286 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); |
| 285 | 287 |
| 286 if (newScrollPosition == scrollPosition()) | 288 if (newScrollPosition == scrollPosition()) |
| 287 return; | 289 return; |
| 288 | 290 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 if (hasOverlayScrollbars()) { | 510 if (hasOverlayScrollbars()) { |
| 509 int verticalScrollbarWidth = (verticalScrollbar() && !hasLayerForVertica lScrollbar()) ? verticalScrollbar()->width() : 0; | 511 int verticalScrollbarWidth = (verticalScrollbar() && !hasLayerForVertica lScrollbar()) ? verticalScrollbar()->width() : 0; |
| 510 int horizontalScrollbarHeight = (horizontalScrollbar() && !hasLayerForHo rizontalScrollbar()) ? horizontalScrollbar()->height() : 0; | 512 int horizontalScrollbarHeight = (horizontalScrollbar() && !hasLayerForHo rizontalScrollbar()) ? horizontalScrollbar()->height() : 0; |
| 511 | 513 |
| 512 scrollViewRect.setWidth(scrollViewRect.width() - verticalScrollbarWidth) ; | 514 scrollViewRect.setWidth(scrollViewRect.width() - verticalScrollbarWidth) ; |
| 513 scrollViewRect.setHeight(scrollViewRect.height() - horizontalScrollbarHe ight); | 515 scrollViewRect.setHeight(scrollViewRect.height() - horizontalScrollbarHe ight); |
| 514 } | 516 } |
| 515 return scrollViewRect; | 517 return scrollViewRect; |
| 516 } | 518 } |
| 517 | 519 |
| 520 void ScrollView::scrollContentsIfNeeded() | |
| 521 { | |
| 522 if (m_scrollDelta.isZero()) | |
| 523 return; | |
| 524 scrollContents(m_scrollDelta); | |
| 525 m_scrollDelta = IntSize(); | |
| 526 } | |
| 527 | |
| 518 void ScrollView::scrollContents(const IntSize& scrollDelta) | 528 void ScrollView::scrollContents(const IntSize& scrollDelta) |
| 519 { | 529 { |
| 520 HostWindow* window = hostWindow(); | 530 HostWindow* window = hostWindow(); |
| 521 if (!window) | 531 if (!window) |
| 522 return; | 532 return; |
| 523 | 533 |
| 524 // Since scrolling is double buffered, we will be blitting the scroll view's intersection | 534 // 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. | 535 // with the clip rect every time to keep it smooth. |
| 526 IntRect clipRect = windowClipRect(); | 536 IntRect clipRect = windowClipRect(); |
| 527 IntRect scrollViewRect = rectToCopyOnScroll(); | 537 IntRect scrollViewRect = rectToCopyOnScroll(); |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1115 int ScrollView::pageStep(ScrollbarOrientation orientation) const | 1125 int ScrollView::pageStep(ScrollbarOrientation orientation) const |
| 1116 { | 1126 { |
| 1117 int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visible Height(); | 1127 int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visible Height(); |
| 1118 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging() ; | 1128 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging() ; |
| 1119 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages()); | 1129 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages()); |
| 1120 | 1130 |
| 1121 return std::max(pageStep, 1); | 1131 return std::max(pageStep, 1); |
| 1122 } | 1132 } |
| 1123 | 1133 |
| 1124 } // namespace WebCore | 1134 } // namespace WebCore |
| OLD | NEW |