| 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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 m_pendingScrollDelta = IntSize(); | 529 m_pendingScrollDelta = IntSize(); |
| 530 scrollContents(scrollDelta); | 530 scrollContents(scrollDelta); |
| 531 } | 531 } |
| 532 | 532 |
| 533 void ScrollView::scrollContents(const IntSize& scrollDelta) | 533 void ScrollView::scrollContents(const IntSize& scrollDelta) |
| 534 { | 534 { |
| 535 HostWindow* window = hostWindow(); | 535 HostWindow* window = hostWindow(); |
| 536 if (!window) | 536 if (!window) |
| 537 return; | 537 return; |
| 538 | 538 |
| 539 // Since scrolling is double buffered, we will be blitting the scroll view's
intersection | |
| 540 // with the clip rect every time to keep it smooth. | |
| 541 IntRect clipRect = windowClipRect(); | 539 IntRect clipRect = windowClipRect(); |
| 542 IntRect scrollViewRect = rectToCopyOnScroll(); | |
| 543 IntRect updateRect = clipRect; | 540 IntRect updateRect = clipRect; |
| 544 updateRect.intersect(scrollViewRect); | 541 updateRect.intersect(rectToCopyOnScroll()); |
| 545 | 542 |
| 546 if (m_drawPanScrollIcon) { | 543 if (m_drawPanScrollIcon) { |
| 547 // FIXME: the pan icon is broken when accelerated compositing is on, sin
ce it will draw under the compositing layers. | 544 // FIXME: the pan icon is broken when accelerated compositing is on, sin
ce it will draw under the compositing layers. |
| 548 // https://bugs.webkit.org/show_bug.cgi?id=47837 | 545 // https://bugs.webkit.org/show_bug.cgi?id=47837 |
| 549 int panIconDirtySquareSizeLength = 2 * (panIconSizeLength + max(abs(scro
llDelta.width()), abs(scrollDelta.height()))); // We only want to repaint what's
necessary | 546 int panIconDirtySquareSizeLength = 2 * (panIconSizeLength + max(abs(scro
llDelta.width()), abs(scrollDelta.height()))); // We only want to repaint what's
necessary |
| 550 IntPoint panIconDirtySquareLocation = IntPoint(m_panScrollIconPoint.x()
- (panIconDirtySquareSizeLength / 2), m_panScrollIconPoint.y() - (panIconDirtySq
uareSizeLength / 2)); | 547 IntPoint panIconDirtySquareLocation = IntPoint(m_panScrollIconPoint.x()
- (panIconDirtySquareSizeLength / 2), m_panScrollIconPoint.y() - (panIconDirtySq
uareSizeLength / 2)); |
| 551 IntRect panScrollIconDirtyRect = IntRect(panIconDirtySquareLocation, Int
Size(panIconDirtySquareSizeLength, panIconDirtySquareSizeLength)); | 548 IntRect panScrollIconDirtyRect = IntRect(panIconDirtySquareLocation, Int
Size(panIconDirtySquareSizeLength, panIconDirtySquareSizeLength)); |
| 552 panScrollIconDirtyRect.intersect(clipRect); | 549 panScrollIconDirtyRect.intersect(clipRect); |
| 553 window->invalidateContentsAndRootView(panScrollIconDirtyRect); | 550 window->invalidateContentsAndRootView(panScrollIconDirtyRect); |
| 554 } | 551 } |
| 555 | 552 |
| 556 if (!scrollContentsFastPath(-scrollDelta, scrollViewRect)) | 553 if (!scrollContentsFastPath(-scrollDelta)) |
| 557 scrollContentsSlowPath(updateRect); | 554 scrollContentsSlowPath(updateRect); |
| 558 | 555 |
| 559 // Invalidate the overhang areas if they are visible. | 556 // Invalidate the overhang areas if they are visible. |
| 560 updateOverhangAreas(); | 557 updateOverhangAreas(); |
| 561 | 558 |
| 562 // This call will move children with native widgets (plugins) and invalidate
them as well. | 559 // This call will move children with native widgets (plugins) and invalidate
them as well. |
| 563 frameRectsChanged(); | 560 frameRectsChanged(); |
| 564 } | 561 } |
| 565 | 562 |
| 566 bool ScrollView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRec
t& rectToScroll) | 563 bool ScrollView::scrollContentsFastPath(const IntSize& scrollDelta) |
| 567 { | 564 { |
| 568 hostWindow()->scroll(); | 565 hostWindow()->scroll(); |
| 569 return true; | 566 return true; |
| 570 } | 567 } |
| 571 | 568 |
| 572 void ScrollView::scrollContentsSlowPath(const IntRect& updateRect) | 569 void ScrollView::scrollContentsSlowPath(const IntRect& updateRect) |
| 573 { | 570 { |
| 574 hostWindow()->invalidateContentsForSlowScroll(updateRect); | 571 hostWindow()->invalidateContentsForSlowScroll(updateRect); |
| 575 } | 572 } |
| 576 | 573 |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 return; | 1120 return; |
| 1124 | 1121 |
| 1125 ScrollableArea::setScrollOrigin(origin); | 1122 ScrollableArea::setScrollOrigin(origin); |
| 1126 | 1123 |
| 1127 // Update if the scroll origin changes, since our position will be different
if the content size did not change. | 1124 // Update if the scroll origin changes, since our position will be different
if the content size did not change. |
| 1128 if (updatePositionAtAll && updatePositionSynchronously) | 1125 if (updatePositionAtAll && updatePositionSynchronously) |
| 1129 updateScrollbars(scrollOffset()); | 1126 updateScrollbars(scrollOffset()); |
| 1130 } | 1127 } |
| 1131 | 1128 |
| 1132 } // namespace blink | 1129 } // namespace blink |
| OLD | NEW |