Changeset 259672 in webkit
- Timestamp:
- Apr 7, 2020, 2:33:04 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 8 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/page/scrolling/ScrollingTree.cpp (modified) (2 diffs)
-
WebCore/page/scrolling/ScrollingTree.h (modified) (3 diffs)
-
WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (modified) (1 diff)
-
WebCore/page/scrolling/ScrollingTreeScrollingNode.h (modified) (2 diffs)
-
WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/WebProcess/WebPage/EventDispatcher.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r259671 r259672 1 2020-04-07 Simon Fraser <simon.fraser@apple.com> 2 3 Use RectEdges<> in some scrolling tree code 4 https://bugs.webkit.org/show_bug.cgi?id=210141 5 6 Reviewed by Tim Horton. 7 8 Add utility functions on ScrollingTreeScrollingNode to get pinned and rubberband state. 9 Use them to push main frame state to the scrolling tree (which we do so we can safely 10 access the state from the EventDispatcher thread). 11 12 * page/scrolling/ScrollingTree.cpp: 13 (WebCore::ScrollingTree::setMainFramePinnedState): 14 (WebCore::ScrollingTree::setMainFrameCanRubberBand): 15 (WebCore::ScrollingTree::willWheelEventStartSwipeGesture): 16 (WebCore::ScrollingTree::setMainFramePinState): Deleted. 17 (WebCore::ScrollingTree::setCanRubberBandState): Deleted. 18 * page/scrolling/ScrollingTree.h: 19 * page/scrolling/ScrollingTreeScrollingNode.cpp: 20 (WebCore::ScrollingTreeScrollingNode::edgePinnedState const): 21 (WebCore::ScrollingTreeScrollingNode::isRubberBanding const): 22 * page/scrolling/ScrollingTreeScrollingNode.h: 23 * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: 24 (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinAndRubberbandState): 25 1 26 2020-04-07 Joanmarie Diggs <jdiggs@igalia.com> 2 27 -
trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp
r259165 r259672 384 384 } 385 385 386 void ScrollingTree::setMainFramePin State(bool pinnedToTheLeft, bool pinnedToTheRight, bool pinnedToTheTop, bool pinnedToTheBottom)386 void ScrollingTree::setMainFramePinnedState(RectEdges<bool> edgePinningState) 387 387 { 388 388 LockHolder locker(m_swipeStateMutex); 389 389 390 m_swipeState.mainFramePinnedToTheLeft = pinnedToTheLeft; 391 m_swipeState.mainFramePinnedToTheRight = pinnedToTheRight; 392 m_swipeState.mainFramePinnedToTheTop = pinnedToTheTop; 393 m_swipeState.mainFramePinnedToTheBottom = pinnedToTheBottom; 394 } 395 396 void ScrollingTree::setCanRubberBandState(bool canRubberBandAtLeft, bool canRubberBandAtRight, bool canRubberBandAtTop, bool canRubberBandAtBottom) 390 m_swipeState.mainFramePinnedState = edgePinningState; 391 } 392 393 void ScrollingTree::setMainFrameCanRubberBand(RectEdges<bool> canRubberBand) 397 394 { 398 395 LockHolder locker(m_swipeStateMutex); 399 396 400 m_swipeState.rubberBandsAtLeft = canRubberBandAtLeft; 401 m_swipeState.rubberBandsAtRight = canRubberBandAtRight; 402 m_swipeState.rubberBandsAtTop = canRubberBandAtTop; 403 m_swipeState.rubberBandsAtBottom = canRubberBandAtBottom; 397 m_swipeState.canRubberBand = canRubberBand; 404 398 } 405 399 … … 426 420 LockHolder lock(m_swipeStateMutex); 427 421 428 if (wheelEvent.deltaX() > 0 && m_swipeState.mainFramePinned ToTheLeft && !m_swipeState.rubberBandsAtLeft)422 if (wheelEvent.deltaX() > 0 && m_swipeState.mainFramePinnedState.left() && !m_swipeState.canRubberBand.left()) 429 423 return true; 430 if (wheelEvent.deltaX() < 0 && m_swipeState.mainFramePinned ToTheRight && !m_swipeState.rubberBandsAtRight)424 if (wheelEvent.deltaX() < 0 && m_swipeState.mainFramePinnedState.right() && !m_swipeState.canRubberBand.right()) 431 425 return true; 432 if (wheelEvent.deltaY() > 0 && m_swipeState.mainFramePinned ToTheTop && !m_swipeState.rubberBandsAtTop)426 if (wheelEvent.deltaY() > 0 && m_swipeState.mainFramePinnedState.top() && !m_swipeState.canRubberBand.top()) 433 427 return true; 434 if (wheelEvent.deltaY() < 0 && m_swipeState.mainFramePinned ToTheBottom && !m_swipeState.rubberBandsAtBottom)428 if (wheelEvent.deltaY() < 0 && m_swipeState.mainFramePinnedState.bottom() && !m_swipeState.canRubberBand.bottom()) 435 429 return true; 436 430 -
trunk/Source/WebCore/page/scrolling/ScrollingTree.h
r258679 r259672 29 29 30 30 #include "PlatformWheelEvent.h" 31 #include "RectEdges.h" 31 32 #include "Region.h" 32 33 #include "ScrollingCoordinator.h" … … 119 120 #endif 120 121 121 void setMainFramePin State(bool pinnedToTheLeft, bool pinnedToTheRight, bool pinnedToTheTop, bool pinnedToTheBottom);122 void setMainFramePinnedState(RectEdges<bool>); 122 123 123 124 // Can be called from any thread. Will update what edges allow rubber-banding. 124 WEBCORE_EXPORT void set CanRubberBandState(bool canRubberBandAtLeft, bool canRubberBandAtRight, bool canRubberBandAtTop, bool canRubberBandAtBottom);125 WEBCORE_EXPORT void setMainFrameCanRubberBand(RectEdges<bool>); 125 126 126 127 bool isHandlingProgrammaticScroll() const { return m_isHandlingProgrammaticScroll; } … … 213 214 bool rubberBandsAtTop { true }; 214 215 bool rubberBandsAtBottom { true }; 215 bool mainFramePinnedToTheLeft { true }; 216 bool mainFramePinnedToTheRight { true }; 217 bool mainFramePinnedToTheTop { true }; 218 bool mainFramePinnedToTheBottom { true }; 216 217 RectEdges<bool> canRubberBand { true, true, true, true }; 218 RectEdges<bool> mainFramePinnedState { true, true, true, true }; 219 219 }; 220 220 -
trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp
r259112 r259672 152 152 } 153 153 154 RectEdges<bool> ScrollingTreeScrollingNode::edgePinnedState() const 155 { 156 auto scrollPosition = currentScrollPosition(); 157 auto minScrollPosition = minimumScrollPosition(); 158 auto maxScrollPosition = maximumScrollPosition(); 159 160 // Top, right, bottom, left. 161 return { 162 scrollPosition.y() <= minScrollPosition.y(), 163 scrollPosition.x() >= maxScrollPosition.x(), 164 scrollPosition.y() >= maxScrollPosition.y(), 165 scrollPosition.x() <= minScrollPosition.x() 166 }; 167 } 168 169 bool ScrollingTreeScrollingNode::isRubberBanding() const 170 { 171 auto scrollPosition = currentScrollPosition(); 172 auto minScrollPosition = minimumScrollPosition(); 173 auto maxScrollPosition = maximumScrollPosition(); 174 175 return scrollPosition.x() < minScrollPosition.x() 176 || scrollPosition.x() > maxScrollPosition.x() 177 || scrollPosition.y() < minScrollPosition.y() 178 || scrollPosition.y() > maxScrollPosition.y(); 179 } 180 154 181 FloatPoint ScrollingTreeScrollingNode::adjustedScrollPosition(const FloatPoint& scrollPosition, ScrollClamping clamping) const 155 182 { -
trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h
r259112 r259672 29 29 30 30 #include "IntRect.h" 31 #include "RectEdges.h" 31 32 #include "ScrollSnapOffsetsInfo.h" 32 33 #include "ScrollTypes.h" … … 59 60 FloatPoint lastCommittedScrollPosition() const { return m_lastCommittedScrollPosition; } 60 61 FloatSize scrollDeltaSinceLastCommit() const { return m_currentScrollPosition - m_lastCommittedScrollPosition; } 62 63 RectEdges<bool> edgePinnedState() const; 64 bool isRubberBanding() const; 61 65 62 66 // These are imperative; they adjust the scrolling layers. -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm
r255037 r259672 261 261 ASSERT(isRootNode()); 262 262 263 auto scrollPosition = currentScrollPosition(); 264 bool pinnedToTheLeft = scrollPosition.x() <= minimumScrollPosition().x(); 265 bool pinnedToTheRight = scrollPosition.x() >= maximumScrollPosition().x(); 266 bool pinnedToTheTop = scrollPosition.y() <= minimumScrollPosition().y(); 267 bool pinnedToTheBottom = scrollPosition.y() >= maximumScrollPosition().y(); 268 269 scrollingTree().setMainFramePinState(pinnedToTheLeft, pinnedToTheRight, pinnedToTheTop, pinnedToTheBottom); 270 271 bool rubberbanding = scrollPosition.x() < minimumScrollPosition().x() 272 || scrollPosition.x() > maximumScrollPosition().x() 273 || scrollPosition.y() < minimumScrollPosition().y() 274 || scrollPosition.y() > maximumScrollPosition().y(); 275 276 scrollingTree().setMainFrameIsRubberBanding(rubberbanding); 263 scrollingTree().setMainFramePinnedState(edgePinnedState()); 264 scrollingTree().setMainFrameIsRubberBanding(isRubberBanding()); 277 265 } 278 266 -
trunk/Source/WebKit/ChangeLog
r259670 r259672 1 2020-04-07 Simon Fraser <simon.fraser@apple.com> 2 3 Use RectEdges<> in some scrolling tree code 4 https://bugs.webkit.org/show_bug.cgi?id=210141 5 6 Reviewed by Tim Horton. 7 8 Construct a RectEdges<>. Order is top, right, bottom, left. 9 10 * WebProcess/WebPage/EventDispatcher.cpp: 11 (WebKit::EventDispatcher::wheelEvent): 12 1 13 2020-04-07 Lauro Moura <lmoura@igalia.com> 2 14 -
trunk/Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp
r257578 r259672 125 125 // We only need to do this at the beginning of the gesture. 126 126 if (platformWheelEvent.phase() == PlatformWheelEventPhaseBegan) 127 scrollingTree->set CanRubberBandState(canRubberBandAtLeft, canRubberBandAtRight, canRubberBandAtTop, canRubberBandAtBottom);127 scrollingTree->setMainFrameCanRubberBand({ canRubberBandAtTop, canRubberBandAtRight, canRubberBandAtBottom, canRubberBandAtLeft }); 128 128 129 129 ScrollingEventResult result = scrollingTree->tryToHandleWheelEvent(platformWheelEvent);
Note:
See TracChangeset
for help on using the changeset viewer.