| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 if (scrollPosition().y() < minimumScrollPosition().y()) | 152 if (scrollPosition().y() < minimumScrollPosition().y()) |
| 153 stretch.setHeight(scrollPosition().y() - minimumScrollPosition().y()); | 153 stretch.setHeight(scrollPosition().y() - minimumScrollPosition().y()); |
| 154 else if (scrollPosition().y() > maximumScrollPosition().y()) | 154 else if (scrollPosition().y() > maximumScrollPosition().y()) |
| 155 stretch.setHeight(scrollPosition().y() - maximumScrollPosition().y()); | 155 stretch.setHeight(scrollPosition().y() - maximumScrollPosition().y()); |
| 156 | 156 |
| 157 if (scrollPosition().x() < minimumScrollPosition().x()) | 157 if (scrollPosition().x() < minimumScrollPosition().x()) |
| 158 stretch.setWidth(scrollPosition().x() - minimumScrollPosition().x()); | 158 stretch.setWidth(scrollPosition().x() - minimumScrollPosition().x()); |
| 159 else if (scrollPosition().x() > maximumScrollPosition().x()) | 159 else if (scrollPosition().x() > maximumScrollPosition().x()) |
| 160 stretch.setWidth(scrollPosition().x() - maximumScrollPosition().x()); | 160 stretch.setWidth(scrollPosition().x() - maximumScrollPosition().x()); |
| 161 | 161 |
| 162 if (scrollingTree()->rootNode() == this) { | |
| 163 if (stretch.isZero()) | |
| 164 scrollingTree()->setMainFrameIsRubberBanding(false); | |
| 165 else | |
| 166 scrollingTree()->setMainFrameIsRubberBanding(true); | |
| 167 } | |
| 168 | |
| 169 return stretch; | 162 return stretch; |
| 170 } | 163 } |
| 171 | 164 |
| 172 bool ScrollingTreeScrollingNodeMac::pinnedInDirection(const FloatSize& delta) | 165 bool ScrollingTreeScrollingNodeMac::pinnedInDirection(const FloatSize& delta) |
| 173 { | 166 { |
| 174 FloatSize limitDelta; | 167 FloatSize limitDelta; |
| 175 | 168 |
| 176 if (fabsf(delta.height()) >= fabsf(delta.width())) { | 169 if (fabsf(delta.height()) >= fabsf(delta.width())) { |
| 177 if (delta.height() < 0) { | 170 if (delta.height() < 0) { |
| 178 // We are trying to scroll up. Make sure we are not pinned to the t
op | 171 // We are trying to scroll up. Make sure we are not pinned to the t
op |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 m_scrollElasticityController.snapRubberBandTimerFired(); | 236 m_scrollElasticityController.snapRubberBandTimerFired(); |
| 244 })); | 237 })); |
| 245 CFRunLoopAddTimer(CFRunLoopGetCurrent(), m_snapRubberbandTimer.get(), kCFRun
LoopDefaultMode); | 238 CFRunLoopAddTimer(CFRunLoopGetCurrent(), m_snapRubberbandTimer.get(), kCFRun
LoopDefaultMode); |
| 246 } | 239 } |
| 247 | 240 |
| 248 void ScrollingTreeScrollingNodeMac::stopSnapRubberbandTimer() | 241 void ScrollingTreeScrollingNodeMac::stopSnapRubberbandTimer() |
| 249 { | 242 { |
| 250 if (!m_snapRubberbandTimer) | 243 if (!m_snapRubberbandTimer) |
| 251 return; | 244 return; |
| 252 | 245 |
| 253 scrollingTree()->setMainFrameIsRubberBanding(false); | |
| 254 | |
| 255 CFRunLoopTimerInvalidate(m_snapRubberbandTimer.get()); | 246 CFRunLoopTimerInvalidate(m_snapRubberbandTimer.get()); |
| 256 m_snapRubberbandTimer = nullptr; | 247 m_snapRubberbandTimer = nullptr; |
| 257 } | 248 } |
| 258 | 249 |
| 259 IntPoint ScrollingTreeScrollingNodeMac::scrollPosition() const | 250 IntPoint ScrollingTreeScrollingNodeMac::scrollPosition() const |
| 260 { | 251 { |
| 261 if (shouldUpdateScrollLayerPositionOnMainThread()) | 252 if (shouldUpdateScrollLayerPositionOnMainThread()) |
| 262 return m_probableMainThreadScrollPosition; | 253 return m_probableMainThreadScrollPosition; |
| 263 | 254 |
| 264 CGPoint scrollLayerPosition = m_scrollLayer.get().position; | 255 CGPoint scrollLayerPosition = m_scrollLayer.get().position; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 } | 395 } |
| 405 | 396 |
| 406 void logWheelEventHandlerCountChanged(unsigned count) | 397 void logWheelEventHandlerCountChanged(unsigned count) |
| 407 { | 398 { |
| 408 WTFLogAlways("SCROLLING: Wheel event handler count changed. Time: %f Count:
%u\n", WTF::monotonicallyIncreasingTime(), count); | 399 WTFLogAlways("SCROLLING: Wheel event handler count changed. Time: %f Count:
%u\n", WTF::monotonicallyIncreasingTime(), count); |
| 409 } | 400 } |
| 410 | 401 |
| 411 } // namespace WebCore | 402 } // namespace WebCore |
| 412 | 403 |
| 413 #endif // ENABLE(THREADED_SCROLLING) | 404 #endif // ENABLE(THREADED_SCROLLING) |
| OLD | NEW |