Changeset 185762 in webkit
- Timestamp:
- Jun 19, 2015, 12:24:59 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 32 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (modified) (2 diffs)
-
WebCore/page/scrolling/AsyncScrollingCoordinator.h (modified) (1 diff)
-
WebCore/page/scrolling/ScrollingCoordinator.h (modified) (1 diff)
-
WebCore/page/scrolling/ScrollingStateScrollingNode.cpp (modified) (1 diff)
-
WebCore/page/scrolling/ScrollingStateScrollingNode.h (modified) (3 diffs)
-
WebCore/page/scrolling/ScrollingTree.h (modified) (1 diff)
-
WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (modified) (1 diff)
-
WebCore/page/scrolling/ScrollingTreeScrollingNode.h (modified) (2 diffs)
-
WebCore/page/scrolling/ThreadedScrollingTree.cpp (modified) (1 diff)
-
WebCore/page/scrolling/ThreadedScrollingTree.h (modified) (1 diff)
-
WebCore/page/scrolling/ios/ScrollingTreeIOS.cpp (modified) (1 diff)
-
WebCore/page/scrolling/ios/ScrollingTreeIOS.h (modified) (1 diff)
-
WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm (modified) (2 diffs)
-
WebCore/platform/ScrollAnimator.cpp (modified) (4 diffs)
-
WebCore/platform/ScrollAnimator.h (modified) (4 diffs)
-
WebCore/platform/ScrollableArea.cpp (modified) (2 diffs)
-
WebCore/platform/cocoa/ScrollController.h (modified) (7 diffs)
-
WebCore/platform/cocoa/ScrollController.mm (modified) (15 diffs)
-
WebCore/rendering/RenderLayerCompositor.cpp (modified) (1 diff)
-
WebKit2/ChangeLog (modified) (1 diff)
-
WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp (modified) (2 diffs)
-
WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp (modified) (1 diff)
-
WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h (modified) (1 diff)
-
WebKit2/UIProcess/Scrolling/RemoteScrollingTree.cpp (modified) (1 diff)
-
WebKit2/UIProcess/Scrolling/RemoteScrollingTree.h (modified) (1 diff)
-
WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h (modified) (1 diff)
-
WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm (modified) (2 diffs)
-
WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm (modified) (1 diff)
-
WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.h (modified) (1 diff)
-
WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.messages.in (modified) (2 diffs)
-
WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r185761 r185762 1 2015-06-18 Brent Fulgham <bfulgham@apple.com> 2 3 [iOS] scrollIntoViewIfNeeded is not working with scroll-snap points 4 https://bugs.webkit.org/show_bug.cgi?id=145318 5 <rdar://problem/21081501> 6 7 Reviewed by Simon Fraser. 8 9 Use the ScrollController in iOS to track the scroll snap point state. 10 We do not need the animation implementation or timers since the actual 11 animation is handled by UIKit. 12 13 This change lets us communicate the current offset into the scroll snap 14 offset vector between the WebProcess and RemoteScrollingTree so that 15 both sides stay in sync regardless of whether user gestures or style 16 updates have caused us to shift to a different snap point. 17 18 * page/scrolling/AsyncScrollingCoordinator.cpp: 19 (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): Set the 20 current horizontal and vertical scroll snap offset indices. 21 (WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode): Ditto. 22 * page/scrolling/AsyncScrollingCoordinator.h: Mark the setActiveScrollSnapIndices 23 for export so that it can be reached by the UIProcess. 24 * page/scrolling/ScrollingCoordinator.h: Keep track of horizontal and 25 vertical scroll snap offset indices. 26 * page/scrolling/ScrollingStateScrollingNode.cpp: 27 (WebCore::ScrollingStateScrollingNode::setCurrentHorizontalSnapPointIndex): Added. 28 (WebCore::ScrollingStateScrollingNode::setCurrentVerticalSnapPointIndex): Added. 29 * page/scrolling/ScrollingStateScrollingNode.h: 30 (WebCore::ScrollingStateScrollingNode::currentHorizontalSnapPointIndex): Added. 31 (WebCore::ScrollingStateScrollingNode::currentVerticalSnapPointIndex): Added. 32 * page/scrolling/ScrollingTree.h: 33 * page/scrolling/ScrollingTreeScrollingNode.cpp: 34 (WebCore::ScrollingTreeScrollingNode::updateBeforeChildren): Update the scroll snap 35 point offset indices if either has changed. 36 * page/scrolling/ScrollingTreeScrollingNode.h: 37 (WebCore::ScrollingTreeScrollingNode::currentHorizontalSnapPointIndex): Added. 38 (WebCore::ScrollingTreeScrollingNode::currentVerticalSnapPointIndex): Added. 39 (WebCore::ScrollingTreeScrollingNode::setCurrentHorizontalSnapPointIndex): Added. 40 (WebCore::ScrollingTreeScrollingNode::setCurrentVerticalSnapPointIndex): Added. 41 * page/scrolling/ThreadedScrollingTree.cpp: 42 (WebCore::ThreadedScrollingTree::currentSnapPointIndicesDidChange): New method 43 to handle notifications about scroll snap index changes from the UIProcess. 44 * page/scrolling/ThreadedScrollingTree.h: 45 * page/scrolling/ios/ScrollingTreeIOS.cpp: 46 (WebCore::ScrollingTreeIOS::currentSnapPointIndicesDidChange): New method 47 to handle notifications about scroll snap index changes from the UIProcess. 48 * page/scrolling/ios/ScrollingTreeIOS.h: 49 * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: 50 (WebCore::ScrollingTreeFrameScrollingNodeMac::updateBeforeChildren): Update scroll 51 snap point current offset indices if they have changed. 52 (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollOffsetOnAxis): Remove unneeded 53 PLATFORM(MAC) macro. 54 * platform/ScrollAnimator.cpp: 55 (WebCore::ScrollAnimator::ScrollAnimator): We have a ScrollController if we are 56 supporting scroll snap points or rubber banding. 57 (WebCore::ScrollAnimator::processWheelEventForScrollSnap): This method is not needed 58 for iOS builds. 59 (WebCore::ScrollAnimator::updateActiveScrollSnapIndexForOffset): Enable this on iOS. 60 (WebCore::ScrollAnimator::updateScrollSnapState): Renamed from 'updateScrollAnimatorsAndTimers' 61 and enabled on iOS. 62 (WebCore::ScrollAnimator::updateScrollAnimatorsAndTimers): Deleted. 63 * platform/ScrollAnimator.h: Enable some scroll snap methods on iOS. 64 * platform/ScrollableArea.cpp: 65 (WebCore::ScrollableArea::handleWheelEvent): Enable scroll snap index bookkeeping on iOS, too. 66 (WebCore::ScrollableArea::updateScrollSnapState): Revise to call 'updateScrollSnapState' instead 67 of 'updateScrollAnimatorsAndTimers'. 68 * platform/cocoa/ScrollController.h: Enable some methods on iOS. Reorder methods to 69 reduce the number of macros needed to do so. 70 * platform/cocoa/ScrollController.mm: 71 (systemUptime): Only build for Mac. 72 (WebCore::ScrollController::ScrollController): Disable rubber band-specific members on iOS. 73 (WebCore::ScrollController::handleWheelEvent): Only build this on Mac. 74 (WebCore::ScrollController::isRubberBandInProgress): Always return 'false' on iOS. 75 (WebCore::ScrollController::startSnapRubberbandTimer): Only build this on Mac. 76 (WebCore::ScrollController::shouldRubberBandInHorizontalDirection): Ditto. 77 (WebCore::ScrollController::scrollSnapPointState): Enable on iOS. 78 (WebCore::ScrollController::hasActiveScrollSnapTimerForAxis): Only build on Mac. 79 (WebCore::ScrollController::updateScrollSnapState): renamed from 'updateScrollAnimatorsAndTimers' 80 (WebCore::ScrollController::startScrollSnapTimer): Only build on Mac. 81 (WebCore::ScrollController::initializeGlideParameters): Ditto. 82 (WebCore::ScrollController::activeScrollSnapIndexForAxis): Enable on iOS. 83 (WebCore::ScrollController::setActiveScrollSnapIndicesForOffset): Ditto. 84 (WebCore::ScrollController::beginScrollSnapAnimation): Only build on Mac. 85 (WebCore::ScrollController::computeGlideDelta): Ditto. 86 (WebCore::ScrollController::updateScrollAnimatorsAndTimers): Deleted. 87 * rendering/RenderLayerCompositor.cpp: 88 (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer): Capture any changes in scroll 89 snap offset indices. 90 1 91 2015-06-19 Jeremy Jones <jeremyj@apple.com> 2 92 -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
r185167 r185762 147 147 if (const Vector<LayoutUnit>* verticalSnapOffsets = frameView.verticalSnapOffsets()) 148 148 setStateScrollingNodeSnapOffsetsAsFloat(*node, ScrollEventAxis::Vertical, *verticalSnapOffsets, m_page->deviceScaleFactor()); 149 150 node->setCurrentHorizontalSnapPointIndex(frameView.currentHorizontalSnapPointIndex()); 151 node->setCurrentVerticalSnapPointIndex(frameView.currentVerticalSnapPointIndex()); 149 152 #endif 150 153 … … 485 488 setStateScrollingNodeSnapOffsetsAsFloat(*node, ScrollEventAxis::Horizontal, scrollingGeometry->horizontalSnapOffsets, m_page->deviceScaleFactor()); 486 489 setStateScrollingNodeSnapOffsetsAsFloat(*node, ScrollEventAxis::Vertical, scrollingGeometry->verticalSnapOffsets, m_page->deviceScaleFactor()); 490 node->setCurrentHorizontalSnapPointIndex(scrollingGeometry->currentHorizontalSnapPointIndex); 491 node->setCurrentVerticalSnapPointIndex(scrollingGeometry->currentVerticalSnapPointIndex); 487 492 #endif 488 493 } -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h
r184596 r185762 58 58 59 59 #if PLATFORM(COCOA) 60 void setActiveScrollSnapIndices(ScrollingNodeID, unsigned horizontalIndex, unsigned verticalIndex);60 WEBCORE_EXPORT void setActiveScrollSnapIndices(ScrollingNodeID, unsigned horizontalIndex, unsigned verticalIndex); 61 61 void deferTestsForReason(WheelEventTestTrigger::ScrollableAreaIdentifier, WheelEventTestTrigger::DeferTestTriggerReason) const; 62 62 void removeTestDeferralForReason(WheelEventTestTrigger::ScrollableAreaIdentifier, WheelEventTestTrigger::DeferTestTriggerReason) const; -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h
r184596 r185762 169 169 Vector<LayoutUnit> horizontalSnapOffsets; 170 170 Vector<LayoutUnit> verticalSnapOffsets; 171 unsigned currentHorizontalSnapPointIndex; 172 unsigned currentVerticalSnapPointIndex; 171 173 #endif 172 174 }; -
trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp
r183702 r185762 124 124 setPropertyChanged(VerticalSnapOffsets); 125 125 } 126 127 void ScrollingStateScrollingNode::setCurrentHorizontalSnapPointIndex(unsigned index) 128 { 129 if (m_currentHorizontalSnapPointIndex == index) 130 return; 131 132 m_currentHorizontalSnapPointIndex = index; 133 setPropertyChanged(CurrentHorizontalSnapOffsetIndex); 134 } 135 136 void ScrollingStateScrollingNode::setCurrentVerticalSnapPointIndex(unsigned index) 137 { 138 if (m_currentVerticalSnapPointIndex == index) 139 return; 140 141 m_currentVerticalSnapPointIndex = index; 142 setPropertyChanged(CurrentVerticalSnapOffsetIndex); 143 } 126 144 #endif 127 145 -
trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h
r183702 r185762 51 51 HorizontalSnapOffsets, 52 52 VerticalSnapOffsets, 53 CurrentHorizontalSnapOffsetIndex, 54 CurrentVerticalSnapOffsetIndex, 53 55 #endif 54 56 ExpectsWheelEventTestTrigger, … … 76 78 const Vector<float>& verticalSnapOffsets() const { return m_verticalSnapOffsets; } 77 79 WEBCORE_EXPORT void setVerticalSnapOffsets(const Vector<float>&); 80 81 unsigned currentHorizontalSnapPointIndex() const { return m_currentHorizontalSnapPointIndex; } 82 WEBCORE_EXPORT void setCurrentHorizontalSnapPointIndex(unsigned); 83 84 unsigned currentVerticalSnapPointIndex() const { return m_currentVerticalSnapPointIndex; } 85 WEBCORE_EXPORT void setCurrentVerticalSnapPointIndex(unsigned); 78 86 #endif 79 87 … … 104 112 Vector<float> m_horizontalSnapOffsets; 105 113 Vector<float> m_verticalSnapOffsets; 114 unsigned m_currentHorizontalSnapPointIndex { 0 }; 115 unsigned m_currentVerticalSnapPointIndex { 0 }; 106 116 #endif 107 117 ScrollableAreaParameters m_scrollableAreaParameters; -
trunk/Source/WebCore/page/scrolling/ScrollingTree.h
r184596 r185762 89 89 // and call scrollingTreeNodeDidScroll(). 90 90 WEBCORE_EXPORT virtual void scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, bool inUserInteration); 91 92 WEBCORE_EXPORT virtual void currentSnapPointIndicesDidChange(ScrollingNodeID, unsigned horizontal, unsigned vertical) = 0; 91 93 92 94 FloatPoint mainFrameScrollPosition(); -
trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp
r174340 r185762 74 74 if (state.hasChangedProperty(ScrollingStateScrollingNode::VerticalSnapOffsets)) 75 75 m_verticalSnapOffsets = state.verticalSnapOffsets(); 76 77 if (state.hasChangedProperty(ScrollingStateScrollingNode::CurrentHorizontalSnapOffsetIndex)) 78 m_currentHorizontalSnapPointIndex = state.currentHorizontalSnapPointIndex(); 79 80 if (state.hasChangedProperty(ScrollingStateScrollingNode::CurrentVerticalSnapOffsetIndex)) 81 m_currentVerticalSnapPointIndex = state.currentVerticalSnapPointIndex(); 76 82 #endif 77 83 -
trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h
r180493 r185762 60 60 const Vector<float>& horizontalSnapOffsets() const { return m_horizontalSnapOffsets; } 61 61 const Vector<float>& verticalSnapOffsets() const { return m_verticalSnapOffsets; } 62 unsigned currentHorizontalSnapPointIndex() const { return m_currentHorizontalSnapPointIndex; } 63 unsigned currentVerticalSnapPointIndex() const { return m_currentVerticalSnapPointIndex; } 64 void setCurrentHorizontalSnapPointIndex(unsigned index) { m_currentHorizontalSnapPointIndex = index; } 65 void setCurrentVerticalSnapPointIndex(unsigned index) { m_currentVerticalSnapPointIndex = index; } 62 66 #endif 63 67 … … 100 104 Vector<float> m_horizontalSnapOffsets; 101 105 Vector<float> m_verticalSnapOffsets; 106 unsigned m_currentHorizontalSnapPointIndex { 0 }; 107 unsigned m_currentVerticalSnapPointIndex { 0 }; 102 108 #endif 103 109 ScrollableAreaParameters m_scrollableAreaParameters; -
trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp
r184139 r185762 112 112 } 113 113 114 void ThreadedScrollingTree::currentSnapPointIndicesDidChange(ScrollingNodeID nodeID, unsigned horizontal, unsigned vertical) 115 { 116 if (!m_scrollingCoordinator) 117 return; 118 119 RefPtr<AsyncScrollingCoordinator> scrollingCoordinator = m_scrollingCoordinator; 120 RunLoop::main().dispatch([scrollingCoordinator, nodeID, horizontal, vertical] { 121 scrollingCoordinator->setActiveScrollSnapIndices(nodeID, horizontal, vertical); 122 }); 123 } 124 114 125 #if PLATFORM(MAC) 115 126 void ThreadedScrollingTree::handleWheelEventPhase(PlatformWheelEventPhase phase) -
trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h
r184139 r185762 61 61 62 62 virtual void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint& scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition) override; 63 void currentSnapPointIndicesDidChange(ScrollingNodeID, unsigned horizontal, unsigned vertical) override; 63 64 #if PLATFORM(MAC) 64 65 void handleWheelEventPhase(PlatformWheelEventPhase) override; -
trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.cpp
r184066 r185762 119 119 } 120 120 121 void ScrollingTreeIOS::currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID nodeID, unsigned horizontal, unsigned vertical) 122 { 123 if (!m_scrollingCoordinator) 124 return; 125 126 RefPtr<AsyncScrollingCoordinator> scrollingCoordinator = m_scrollingCoordinator; 127 callOnMainThread([scrollingCoordinator, nodeID, horizontal, vertical] { 128 scrollingCoordinator->setActiveScrollSnapIndices(nodeID, horizontal, vertical); 129 }); 130 } 131 121 132 } // namespace WebCore 122 133 -
trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.h
r184066 r185762 59 59 virtual void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint& scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition) override; 60 60 61 void currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID, unsigned horizontal, unsigned vertical) override; 62 61 63 virtual FloatRect fixedPositionRect() override; 62 64 -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm
r185681 r185762 138 138 if (scrollingStateNode.hasChangedProperty(ScrollingStateFrameScrollingNode::VerticalSnapOffsets)) 139 139 m_scrollController.updateScrollSnapPoints(ScrollEventAxis::Vertical, convertToLayoutUnits(scrollingStateNode.verticalSnapOffsets())); 140 141 if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::CurrentHorizontalSnapOffsetIndex)) 142 m_scrollController.setActiveScrollSnapIndexForAxis(ScrollEventAxis::Horizontal, scrollingStateNode.currentHorizontalSnapPointIndex()); 143 144 if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::CurrentVerticalSnapOffsetIndex)) 145 m_scrollController.setActiveScrollSnapIndexForAxis(ScrollEventAxis::Vertical, scrollingStateNode.currentVerticalSnapPointIndex()); 140 146 #endif 141 147 … … 554 560 } 555 561 556 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC)562 #if ENABLE(CSS_SCROLL_SNAP) 557 563 LayoutUnit ScrollingTreeFrameScrollingNodeMac::scrollOffsetOnAxis(ScrollEventAxis axis) const 558 564 { -
trunk/Source/WebCore/platform/ScrollAnimator.cpp
r185681 r185762 50 50 ScrollAnimator::ScrollAnimator(ScrollableArea& scrollableArea) 51 51 : m_scrollableArea(scrollableArea) 52 #if (ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING)) && PLATFORM(MAC)52 #if ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING) 53 53 , m_scrollController(*this) 54 54 #endif … … 85 85 } 86 86 87 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC) 87 #if ENABLE(CSS_SCROLL_SNAP) 88 #if PLATFORM(MAC) 88 89 bool ScrollAnimator::processWheelEventForScrollSnap(const PlatformWheelEvent& wheelEvent) 89 90 { 90 91 return m_scrollController.processWheelEventForScrollSnap(wheelEvent); 91 92 } 93 #endif 92 94 93 95 bool ScrollAnimator::activeScrollSnapIndexDidChange() const … … 181 183 void ScrollAnimator::updateActiveScrollSnapIndexForOffset() 182 184 { 183 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC)185 #if ENABLE(CSS_SCROLL_SNAP) 184 186 m_scrollController.setActiveScrollSnapIndicesForOffset(m_currentPosX, m_currentPosY); 185 187 if (m_scrollController.activeScrollSnapIndexDidChange()) { … … 196 198 } 197 199 198 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC)199 void ScrollAnimator::updateScroll AnimatorsAndTimers()200 { 201 m_scrollController.updateScroll AnimatorsAndTimers(m_scrollableArea);200 #if ENABLE(CSS_SCROLL_SNAP) 201 void ScrollAnimator::updateScrollSnapState() 202 { 203 m_scrollController.updateScrollSnapState(m_scrollableArea); 202 204 } 203 205 -
trunk/Source/WebCore/platform/ScrollAnimator.h
r185681 r185762 41 41 #include <wtf/Forward.h> 42 42 43 #if (ENABLE(RUBBER_BANDING) || ENABLE(CSS_SCROLL_SNAP)) && PLATFORM(MAC)43 #if ENABLE(RUBBER_BANDING) || ENABLE(CSS_SCROLL_SNAP) 44 44 #include "ScrollController.h" 45 45 #endif … … 53 53 class WheelEventTestTrigger; 54 54 55 #if (ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING)) && PLATFORM(MAC)55 #if ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING) 56 56 class ScrollAnimator : private ScrollControllerClient { 57 57 #else … … 129 129 #endif 130 130 131 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC) 131 #if ENABLE(CSS_SCROLL_SNAP) 132 #if PLATFORM(MAC) 132 133 bool processWheelEventForScrollSnap(const PlatformWheelEvent&); 133 void updateScrollAnimatorsAndTimers(); 134 #endif 135 void updateScrollSnapState(); 134 136 LayoutUnit scrollOffsetOnAxis(ScrollEventAxis) const override; 135 137 void immediateScrollOnAxis(ScrollEventAxis, float delta) override; … … 145 147 ScrollableArea& m_scrollableArea; 146 148 RefPtr<WheelEventTestTrigger> m_wheelEventTestTrigger; 147 #if (ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING)) && PLATFORM(MAC)149 #if ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING) 148 150 ScrollController m_scrollController; 149 151 #endif -
trunk/Source/WebCore/platform/ScrollableArea.cpp
r185431 r185762 191 191 192 192 bool handledEvent = scrollAnimator().handleWheelEvent(wheelEvent); 193 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC)193 #if ENABLE(CSS_SCROLL_SNAP) 194 194 if (scrollAnimator().activeScrollSnapIndexDidChange()) { 195 195 setCurrentHorizontalSnapPointIndex(scrollAnimator().activeScrollSnapIndexForAxis(ScrollEventAxis::Horizontal)); … … 462 462 void ScrollableArea::updateScrollSnapState() 463 463 { 464 #if PLATFORM(MAC) 465 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) 466 scrollAnimator->updateScrollAnimatorsAndTimers(); 467 #endif 464 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) 465 scrollAnimator->updateScrollSnapState(); 468 466 469 467 if (isScrollSnapInProgress()) -
trunk/Source/WebCore/platform/cocoa/ScrollController.h
r185681 r185762 27 27 #define ScrollController_h 28 28 29 #if ENABLE(RUBBER_BANDING) 29 #if ENABLE(RUBBER_BANDING) || ENABLE(CSS_SCROLL_SNAP) 30 30 31 31 #include "FloatPoint.h" … … 52 52 53 53 public: 54 #if ENABLE(RUBBER_BANDING) 54 55 virtual bool allowsHorizontalStretching(const PlatformWheelEvent&) = 0; 55 56 virtual bool allowsVerticalStretching(const PlatformWheelEvent&) = 0; … … 78 79 // the page to scroll to the nearest boundary point. 79 80 virtual void adjustScrollPositionToBoundsIfNecessary() = 0; 81 #endif 80 82 81 83 virtual void deferTestsForReason(WheelEventTestTrigger::ScrollableAreaIdentifier, WheelEventTestTrigger::DeferTestTriggerReason) const { /* Do nothing */ } 82 84 virtual void removeTestDeferralForReason(WheelEventTestTrigger::ScrollableAreaIdentifier, WheelEventTestTrigger::DeferTestTriggerReason) const { /* Do nothing */ } 83 85 84 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC)86 #if ENABLE(CSS_SCROLL_SNAP) 85 87 virtual LayoutUnit scrollOffsetOnAxis(ScrollEventAxis) const = 0; 86 88 virtual void immediateScrollOnAxis(ScrollEventAxis, float delta) = 0; … … 115 117 explicit ScrollController(ScrollControllerClient&); 116 118 119 #if PLATFORM(MAC) 117 120 bool handleWheelEvent(const PlatformWheelEvent&); 121 #endif 118 122 119 123 bool isRubberBandInProgress() const; 120 124 bool isScrollSnapInProgress() const; 121 125 122 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC) 123 bool processWheelEventForScrollSnap(const PlatformWheelEvent&); 124 void updateScrollAnimatorsAndTimers(const ScrollableArea&); 126 #if ENABLE(CSS_SCROLL_SNAP) 125 127 void updateScrollSnapPoints(ScrollEventAxis, const Vector<LayoutUnit>&); 126 unsigned activeScrollSnapIndexForAxis(ScrollEventAxis) const;127 128 void setActiveScrollSnapIndexForAxis(ScrollEventAxis, unsigned); 128 129 void setActiveScrollSnapIndicesForOffset(int x, int y); 129 130 bool activeScrollSnapIndexDidChange() const { return m_activeScrollSnapIndexDidChange; } 130 131 void setScrollSnapIndexDidChange(bool state) { m_activeScrollSnapIndexDidChange = state; } 132 unsigned activeScrollSnapIndexForAxis(ScrollEventAxis) const; 133 void updateScrollSnapState(const ScrollableArea&); 134 #if PLATFORM(MAC) 135 bool processWheelEventForScrollSnap(const PlatformWheelEvent&); 131 136 bool hasActiveScrollSnapTimerForAxis(ScrollEventAxis) const; 132 137 #endif 138 #endif 133 139 134 140 private: 141 #if ENABLE(RUBBER_BANDING) 135 142 void startSnapRubberbandTimer(); 136 143 void stopSnapRubberbandTimer(); … … 139 146 140 147 bool shouldRubberBandInHorizontalDirection(const PlatformWheelEvent&); 141 142 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC) 148 #endif 149 150 #if ENABLE(CSS_SCROLL_SNAP) 151 LayoutUnit scrollOffsetOnAxis(ScrollEventAxis) const; 152 void setNearestScrollSnapIndexForAxisAndOffset(ScrollEventAxis, int); 153 ScrollSnapAnimatorState& scrollSnapPointState(ScrollEventAxis); 154 const ScrollSnapAnimatorState& scrollSnapPointState(ScrollEventAxis) const; 155 #if PLATFORM(MAC) 143 156 void horizontalScrollSnapTimerFired(); 144 157 void verticalScrollSnapTimerFired(); … … 146 159 void stopScrollSnapTimer(ScrollEventAxis); 147 160 148 LayoutUnit scrollOffsetOnAxis(ScrollEventAxis) const;149 161 void processWheelEventForScrollSnapOnAxis(ScrollEventAxis, const PlatformWheelEvent&); 150 162 bool shouldOverrideWheelEvent(ScrollEventAxis, const PlatformWheelEvent&) const; 151 void setNearestScrollSnapIndexForAxisAndOffset(ScrollEventAxis, int);152 163 153 164 void beginScrollSnapAnimation(ScrollEventAxis, ScrollSnapState); … … 158 169 float computeSnapDelta(ScrollEventAxis) const; 159 170 float computeGlideDelta(ScrollEventAxis) const; 160 161 ScrollSnapAnimatorState& scrollSnapPointState(ScrollEventAxis); 162 const ScrollSnapAnimatorState& scrollSnapPointState(ScrollEventAxis) const; 171 #endif 163 172 #endif 164 173 165 174 ScrollControllerClient& m_client; 166 175 167 CFTimeInterval m_lastMomentumScrollTimestamp ;176 CFTimeInterval m_lastMomentumScrollTimestamp { 0 }; 168 177 FloatSize m_overflowScrollDelta; 169 178 FloatSize m_stretchScrollForce; 170 179 FloatSize m_momentumVelocity; 171 180 181 #if ENABLE(RUBBER_BANDING) 172 182 // Rubber band state. 173 CFTimeInterval m_startTime ;183 CFTimeInterval m_startTime { 0 }; 174 184 FloatSize m_startStretch; 175 185 FloatPoint m_origOrigin; 176 186 FloatSize m_origVelocity; 177 187 RunLoop::Timer<ScrollController> m_snapRubberbandTimer; 178 179 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC) 180 // FIXME: Find a way to consolidate both timers into one variable. 188 #endif 189 190 #if ENABLE(CSS_SCROLL_SNAP) 181 191 std::unique_ptr<ScrollSnapAnimatorState> m_horizontalScrollSnapState; 182 192 std::unique_ptr<ScrollSnapAnimatorState> m_verticalScrollSnapState; 193 #if PLATFORM(MAC) 194 // FIXME: Find a way to consolidate both timers into one variable. 183 195 RunLoop::Timer<ScrollController> m_horizontalScrollSnapTimer; 184 196 RunLoop::Timer<ScrollController> m_verticalScrollSnapTimer; 197 #endif 185 198 #endif 186 199 -
trunk/Source/WebCore/platform/cocoa/ScrollController.mm
r185681 r185762 39 39 #endif 40 40 41 #if ENABLE(RUBBER_BANDING) 42 41 #if ENABLE(RUBBER_BANDING) || ENABLE(CSS_SCROLL_SNAP) 42 43 #if PLATFORM(MAC) 43 44 static NSTimeInterval systemUptime() 44 45 { … … 63 64 return 0; 64 65 } 65 66 #endif 66 67 67 68 namespace WebCore { 68 69 70 #if ENABLE(RUBBER_BANDING) 69 71 static const float scrollVelocityZeroingTimeout = 0.10f; 70 72 static const float rubberbandDirectionLockStretchRatio = 1; 71 73 static const float rubberbandMinimumRequiredDeltaBeforeStretch = 10; 74 #endif 72 75 73 76 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC) … … 86 89 #endif 87 90 91 #if PLATFORM(MAC) 88 92 enum class WheelEventStatus { 89 93 UserScrollBegin, … … 122 126 return multiplier; 123 127 } 128 #endif 124 129 125 130 ScrollController::ScrollController(ScrollControllerClient& client) 126 131 : m_client(client) 127 , m_lastMomentumScrollTimestamp(0) 128 , m_startTime(0) 132 #if ENABLE(RUBBER_BANDING) 129 133 , m_snapRubberbandTimer(RunLoop::current(), this, &ScrollController::snapRubberBandTimerFired) 134 #endif 130 135 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC) 131 136 , m_horizontalScrollSnapTimer(RunLoop::current(), this, &ScrollController::horizontalScrollSnapTimerFired) … … 135 140 } 136 141 142 #if PLATFORM(MAC) 137 143 bool ScrollController::handleWheelEvent(const PlatformWheelEvent& wheelEvent) 138 144 { 139 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC)145 #if ENABLE(CSS_SCROLL_SNAP) 140 146 if (!processWheelEventForScrollSnap(wheelEvent)) 141 147 return false; … … 321 327 return true; 322 328 } 323 329 #endif 330 331 #if ENABLE(RUBBER_BANDING) 324 332 static inline float roundTowardZero(float num) 325 333 { … … 397 405 } 398 406 } 407 #endif 399 408 400 409 bool ScrollController::isRubberBandInProgress() const 401 410 { 411 #if ENABLE(RUBBER_BANDING) && PLATFORM(MAC) 402 412 if (!m_inScrollGesture && !m_momentumScrollInProgress && !m_snapRubberbandTimerIsActive) 403 413 return false; 404 414 405 415 return !m_client.stretchAmount().isZero(); 416 #else 417 return false; 418 #endif 406 419 } 407 420 … … 415 428 } 416 429 430 #if ENABLE(RUBBER_BANDING) 417 431 void ScrollController::startSnapRubberbandTimer() 418 432 { … … 461 475 return true; 462 476 } 463 464 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC) 477 #endif 478 479 #if ENABLE(CSS_SCROLL_SNAP) 465 480 ScrollSnapAnimatorState& ScrollController::scrollSnapPointState(ScrollEventAxis axis) 466 481 { … … 479 494 } 480 495 496 #if PLATFORM(MAC) 481 497 bool ScrollController::hasActiveScrollSnapTimerForAxis(ScrollEventAxis axis) const 482 498 { … … 598 614 return true; 599 615 } 600 601 void ScrollController::updateScrollAnimatorsAndTimers(const ScrollableArea& scrollableArea) 616 #endif 617 618 void ScrollController::updateScrollSnapState(const ScrollableArea& scrollableArea) 602 619 { 603 620 // FIXME: Currently, scroll snap animators are recreated even though the snap offsets alone can be updated. … … 623 640 } 624 641 642 #if PLATFORM(MAC) 625 643 void ScrollController::startScrollSnapTimer(ScrollEventAxis axis) 626 644 { … … 700 718 snapState.m_glidePhaseShift = acos((snapState.m_glideInitialWheelDelta - targetFinalWheelDelta) / (snapState.m_glideInitialWheelDelta + targetFinalWheelDelta)); 701 719 } 720 #endif 702 721 703 722 unsigned ScrollController::activeScrollSnapIndexForAxis(ScrollEventAxis axis) const … … 746 765 } 747 766 767 #if PLATFORM(MAC) 748 768 void ScrollController::beginScrollSnapAnimation(ScrollEventAxis axis, ScrollSnapState newState) 749 769 { … … 887 907 } 888 908 #endif 909 #endif 889 910 890 911 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r185288 r185762 3934 3934 if (const Vector<LayoutUnit>* offsets = layer.verticalSnapOffsets()) 3935 3935 scrollingGeometry.verticalSnapOffsets = *offsets; 3936 scrollingGeometry.currentHorizontalSnapPointIndex = layer.currentHorizontalSnapPointIndex(); 3937 scrollingGeometry.currentVerticalSnapPointIndex = layer.currentVerticalSnapPointIndex(); 3936 3938 #endif 3937 3939 scrollingCoordinator->updateOverflowScrollingNode(nodeID, backing->scrollingLayer(), backing->scrollingContentsLayer(), &scrollingGeometry); -
trunk/Source/WebKit2/ChangeLog
r185760 r185762 1 2015-06-18 Brent Fulgham <bfulgham@apple.com> 2 3 [iOS] scrollIntoViewIfNeeded is not working with scroll-snap points 4 https://bugs.webkit.org/show_bug.cgi?id=145318 5 <rdar://problem/21081501> 6 7 Reviewed by Simon Fraser. 8 9 * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp: 10 (ArgumentCoder<ScrollingStateScrollingNode>::encode): Handle scroll snap point offset indices. 11 (ArgumentCoder<ScrollingStateScrollingNode>::decode): Ditto. 12 * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp: 13 (WebKit::RemoteScrollingCoordinatorProxy::currentSnapPointIndicesDidChange): Added. Send message 14 to WebProcess when scroll snap indices have changed. 15 * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h: 16 * UIProcess/Scrolling/RemoteScrollingTree.cpp: 17 (WebKit::RemoteScrollingTree::currentSnapPointIndicesDidChange): Added. Notify the 18 RemoteScrollingCoordinatorProxy when scroll snap indices have changed. 19 * UIProcess/Scrolling/RemoteScrollingTree.h: 20 * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h: 21 * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm: 22 (-[WKOverflowScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Revised. 23 Identify changes in the current scroll snap point offset index (in either the horizontal or vertical 24 directions), and send a notification when this happens. 25 (WebKit::ScrollingTreeOverflowScrollingNodeIOS::currentSnapPointIndicesDidChange): Added. Notify the 26 Scrolling Tree when indices changed. 27 * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm: 28 (WebKit::RemoteScrollingCoordinatorProxy::adjustTargetContentOffsetForSnapping): Revised. Always compute 29 the new scroll snap offset index (even when we will rubber band). 30 * WebProcess/Scrolling/RemoteScrollingCoordinator.h: 31 * WebProcess/Scrolling/RemoteScrollingCoordinator.messages.in: Add a new message to relay changes in scroll 32 snap index. 33 * WebProcess/Scrolling/RemoteScrollingCoordinator.mm: 34 (WebKit::RemoteScrollingCoordinator::currentSnapPointIndicesChangedForNode): Added. 35 1 36 2015-06-19 Jeremy Jones <jeremyj@apple.com> 2 37 -
trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp
r183655 r185762 132 132 SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::HorizontalSnapOffsets, horizontalSnapOffsets) 133 133 SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::VerticalSnapOffsets, verticalSnapOffsets) 134 SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::CurrentHorizontalSnapOffsetIndex, currentHorizontalSnapPointIndex) 135 SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::CurrentVerticalSnapOffsetIndex, currentVerticalSnapPointIndex) 134 136 #endif 135 137 SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::ScrollableAreaParams, scrollableAreaParameters) … … 201 203 SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::HorizontalSnapOffsets, Vector<float>, setHorizontalSnapOffsets); 202 204 SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::VerticalSnapOffsets, Vector<float>, setVerticalSnapOffsets); 205 SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::CurrentHorizontalSnapOffsetIndex, unsigned, setCurrentHorizontalSnapPointIndex); 206 SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::CurrentVerticalSnapOffsetIndex, unsigned, setCurrentVerticalSnapPointIndex); 203 207 #endif 204 208 SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::ScrollableAreaParams, ScrollableAreaParameters, setScrollableAreaParameters); -
trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp
r177835 r185762 160 160 } 161 161 162 void RemoteScrollingCoordinatorProxy::currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID nodeID, unsigned horizontal, unsigned vertical) 163 { 164 m_webPageProxy.send(Messages::RemoteScrollingCoordinator::CurrentSnapPointIndicesChangedForNode(nodeID, horizontal, vertical)); 165 } 166 162 167 // This comes from the scrolling tree. 163 168 void RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll(ScrollingNodeID scrolledNodeID, const FloatPoint& newScrollPosition, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction) -
trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h
r184439 r185762 62 62 void viewportChangedViaDelegatedScrolling(WebCore::ScrollingNodeID, const WebCore::FloatRect& fixedPositionRect, double scale); 63 63 64 void currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID, unsigned horizontal, unsigned vertical); 65 64 66 // FIXME: expose the tree and pass this to that? 65 67 bool handleWheelEvent(const WebCore::PlatformWheelEvent&); -
trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.cpp
r171370 r185762 135 135 } 136 136 137 void RemoteScrollingTree::currentSnapPointIndicesDidChange(ScrollingNodeID nodeID, unsigned horizontal, unsigned vertical) 138 { 139 m_scrollingCoordinatorProxy.currentSnapPointIndicesDidChange(nodeID, horizontal, vertical); 140 } 141 137 142 } // namespace WebKit 138 143 -
trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.h
r174351 r185762 49 49 virtual void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, WebCore::SetOrSyncScrollingLayerPosition = WebCore::SyncScrollingLayerPosition) override; 50 50 virtual void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, bool representsProgrammaticScroll) override; 51 void currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID, unsigned horizontal, unsigned vertical) override; 51 52 52 53 private: -
trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h
r176915 r185762 45 45 void overflowScrollViewWillStartPanGesture(); 46 46 void scrollViewDidScroll(const WebCore::FloatPoint&, bool inUserInteration); 47 void currentSnapPointIndicesDidChange(unsigned horizontal, unsigned vertical); 47 48 48 49 CALayer *scrollLayer() const { return m_scrollLayer.get(); } -
trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm
r185681 r185762 84 84 CGFloat verticalTarget = targetContentOffset->y; 85 85 86 unsigned ignore; 87 if (!_scrollingTreeNode->horizontalSnapOffsets().isEmpty() && horizontalTarget >= 0 && horizontalTarget <= scrollView.contentSize.width) 88 targetContentOffset->x = closestSnapOffset<float, CGFloat>(_scrollingTreeNode->horizontalSnapOffsets(), horizontalTarget, velocity.x, ignore); 89 if (!_scrollingTreeNode->verticalSnapOffsets().isEmpty() && verticalTarget >= 0 && verticalTarget <= scrollView.contentSize.height) 90 targetContentOffset->y = closestSnapOffset<float, CGFloat>(_scrollingTreeNode->verticalSnapOffsets(), verticalTarget, velocity.y, ignore); 86 unsigned originalHorizontalSnapPosition = _scrollingTreeNode->currentHorizontalSnapPointIndex(); 87 unsigned originalVerticalSnapPosition = _scrollingTreeNode->currentVerticalSnapPointIndex(); 88 89 if (!_scrollingTreeNode->horizontalSnapOffsets().isEmpty()) { 90 unsigned index; 91 float potentialSnapPosition = closestSnapOffset<float, CGFloat>(_scrollingTreeNode->horizontalSnapOffsets(), horizontalTarget, velocity.x, index); 92 _scrollingTreeNode->setCurrentHorizontalSnapPointIndex(index); 93 if (horizontalTarget >= 0 && horizontalTarget <= scrollView.contentSize.width) 94 targetContentOffset->x = potentialSnapPosition; 95 } 96 97 if (!_scrollingTreeNode->verticalSnapOffsets().isEmpty()) { 98 unsigned index; 99 float potentialSnapPosition = closestSnapOffset<float, CGFloat>(_scrollingTreeNode->verticalSnapOffsets(), verticalTarget, velocity.y, index); 100 _scrollingTreeNode->setCurrentVerticalSnapPointIndex(index); 101 if (verticalTarget >= 0 && verticalTarget <= scrollView.contentSize.height) 102 targetContentOffset->y = potentialSnapPosition; 103 } 104 105 if (originalHorizontalSnapPosition != _scrollingTreeNode->currentHorizontalSnapPointIndex() 106 || originalVerticalSnapPosition != _scrollingTreeNode->currentVerticalSnapPointIndex()) { 107 _scrollingTreeNode->currentSnapPointIndicesDidChange(_scrollingTreeNode->currentHorizontalSnapPointIndex(), _scrollingTreeNode->currentVerticalSnapPointIndex()); 108 } 91 109 } 92 110 #endif … … 284 302 } 285 303 304 void ScrollingTreeOverflowScrollingNodeIOS::currentSnapPointIndicesDidChange(unsigned horizontal, unsigned vertical) 305 { 306 if (m_updatingFromStateNode) 307 return; 308 309 scrollingTree().currentSnapPointIndicesDidChange(scrollingNodeID(), horizontal, vertical); 310 } 311 286 312 } // namespace WebCore 287 313 -
trunk/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm
r184439 r185762 117 117 { 118 118 // The bounds checking with maxScrollOffsets is to ensure that we won't interfere with rubber-banding when scrolling to the edge of the page. 119 if (shouldSnapForMainFrameScrolling(WebCore::ScrollEventAxis::Horizontal) && targetContentOffset->x > 0 && targetContentOffset->x < maxScrollOffsets.width) {119 if (shouldSnapForMainFrameScrolling(WebCore::ScrollEventAxis::Horizontal)) { 120 120 float potentialSnapPosition = closestSnapOffsetForMainFrameScrolling(WebCore::ScrollEventAxis::Horizontal, targetContentOffset->x, velocity.x, m_currentHorizontalSnapPointIndex); 121 targetContentOffset->x = std::min<float>(maxScrollOffsets.width, potentialSnapPosition); 122 } 123 124 if (shouldSnapForMainFrameScrolling(WebCore::ScrollEventAxis::Vertical) && targetContentOffset->y > 0 && targetContentOffset->y < maxScrollOffsets.height) { 121 if (targetContentOffset->x > 0 && targetContentOffset->x < maxScrollOffsets.width) 122 targetContentOffset->x = std::min<float>(maxScrollOffsets.width, potentialSnapPosition); 123 } 124 125 if (shouldSnapForMainFrameScrolling(WebCore::ScrollEventAxis::Vertical)) { 125 126 float potentialSnapPosition = closestSnapOffsetForMainFrameScrolling(WebCore::ScrollEventAxis::Vertical, targetContentOffset->y, velocity.y, m_currentVerticalSnapPointIndex); 126 127 potentialSnapPosition -= topInset; 127 targetContentOffset->y = std::min<float>(maxScrollOffsets.height, potentialSnapPosition); 128 if (targetContentOffset->y > 0 && targetContentOffset->y < maxScrollOffsets.height) 129 targetContentOffset->y = std::min<float>(maxScrollOffsets.height, potentialSnapPosition); 128 130 } 129 131 } -
trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.h
r184596 r185762 74 74 // Respond to UI process changes. 75 75 void scrollPositionChangedForNode(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, bool syncLayerPosition); 76 void currentSnapPointIndicesChangedForNode(WebCore::ScrollingNodeID, unsigned horizontal, unsigned vertical); 76 77 77 78 WebPage* m_webPage; -
trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.messages.in
r168338 r185762 1 # Copyright (C) 2014 Apple Inc. All rights reserved.1 # Copyright (C) 2014-2015 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 25 25 messages -> RemoteScrollingCoordinator { 26 26 ScrollPositionChangedForNode(uint64_t nodeID, WebCore::FloatPoint scrollPosition, bool syncLayerPosition); 27 CurrentSnapPointIndicesChangedForNode(uint64_t nodeID, unsigned horizontal, unsigned vertical); 27 28 } 28 29 -
trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm
r184596 r185762 103 103 } 104 104 105 void RemoteScrollingCoordinator::currentSnapPointIndicesChangedForNode(ScrollingNodeID nodeID, unsigned horizontal, unsigned vertical) 106 { 107 setActiveScrollSnapIndices(nodeID, horizontal, vertical); 108 } 109 105 110 } // namespace WebKit 106 111
Note:
See TracChangeset
for help on using the changeset viewer.