Changeset 243919 in webkit
- Timestamp:
- Apr 4, 2019, 5:11:08 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r243917 r243919 1 2019-04-04 Simon Fraser <simon.fraser@apple.com> 2 3 Have ScrollableArea store a ScrollType for the current scroll 4 https://bugs.webkit.org/show_bug.cgi?id=196627 5 6 Reviewed by Zalan Bujtas. 7 8 RenderLayer had isInUserScroll() which is the opposite of ScrollableArea::inProgrammaticScroll(), 9 so just have ScrollableArea store a ScrollType. 10 11 RenderLayer's scrolling bottleneck, scrollToOffset(), now takes a ScrollType, and pushes 12 it onto the base class. 13 14 AsyncScrollingCoordinator::requestScrollPositionUpdate() can use the incoming scrollType (currently 15 incorrect for iOS WK2 overflow) rather than deducing a user scroll from ScrollingLayerPositionAction. 16 17 No behavior change. 18 19 * page/FrameView.cpp: 20 (WebCore::FrameView::setFrameRect): 21 (WebCore::FrameView::topContentInsetDidChange): 22 (WebCore::FrameView::updateLayoutViewport): 23 (WebCore::FrameView::setScrollPosition): 24 (WebCore::FrameView::shouldUpdateCompositingLayersAfterScrolling const): 25 (WebCore::FrameView::setWasScrolledByUser): 26 * page/FrameViewLayoutContext.cpp: 27 (WebCore::LayoutScope::LayoutScope): 28 (WebCore::LayoutScope::~LayoutScope): 29 * page/ios/FrameIOS.mm: 30 (WebCore::Frame::overflowScrollPositionChangedForNode): 31 * page/scrolling/AsyncScrollingCoordinator.cpp: 32 (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate): 33 (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): 34 (WebCore::AsyncScrollingCoordinator::reconcileScrollingState): 35 * platform/ScrollView.cpp: 36 (WebCore::ScrollView::setScrollPosition): 37 * platform/ScrollableArea.cpp: 38 (WebCore::ScrollableArea::ScrollableArea): 39 * platform/ScrollableArea.h: 40 (WebCore::ScrollableArea::currentScrollType const): 41 (WebCore::ScrollableArea::setCurrentScrollType): 42 (WebCore::ScrollableArea::setIsUserScroll): Deleted. 43 (WebCore::ScrollableArea::inProgrammaticScroll const): Deleted. 44 (WebCore::ScrollableArea::setInProgrammaticScroll): Deleted. 45 * rendering/RenderLayer.cpp: 46 (WebCore::RenderLayer::RenderLayer): 47 (WebCore::RenderLayer::scrollToXPosition): 48 (WebCore::RenderLayer::scrollToYPosition): 49 (WebCore::RenderLayer::scrollToOffset): 50 (WebCore::RenderLayer::scrollTo): 51 * rendering/RenderLayer.h: 52 * rendering/RenderLayerBacking.cpp: 53 (WebCore::RenderLayerBacking::updateScrollOffset): 54 * rendering/RenderMarquee.cpp: 55 (WebCore::RenderMarquee::start): 56 1 57 2019-04-04 Shawn Roberts <sroberts@apple.com> 2 58 -
trunk/Source/WebCore/page/FrameView.cpp
r243905 r243919 460 460 if (newRect == oldRect) 461 461 return; 462 462 463 // Every scroll that happens as the result of frame size change is programmatic. 463 bool wasInProgrammaticScroll = inProgrammaticScroll(); 464 setInProgrammaticScroll(true); 464 auto oldScrollType = currentScrollType(); 465 setCurrentScrollType(ScrollType::Programmatic); 466 465 467 ScrollView::setFrameRect(newRect); 466 468 … … 476 478 477 479 viewportContentsChanged(); 478 set InProgrammaticScroll(wasInProgrammaticScroll);480 setCurrentScrollType(oldScrollType); 479 481 } 480 482 … … 1093 1095 layoutContext().layout(); 1094 1096 // Every scroll that happens as the result of content inset change is programmatic. 1095 bool wasInProgrammaticScroll = inProgrammaticScroll(); 1096 setInProgrammaticScroll(true); 1097 auto oldScrollType = currentScrollType(); 1098 setCurrentScrollType(ScrollType::Programmatic); 1099 1097 1100 updateScrollbars(scrollPosition()); 1098 1101 if (renderView->usesCompositing()) … … 1102 1105 tiledBacking->setTopContentInset(newTopContentInset); 1103 1106 1104 set InProgrammaticScroll(wasInProgrammaticScroll);1107 setCurrentScrollType(oldScrollType); 1105 1108 } 1106 1109 … … 1676 1679 1677 1680 if (m_layoutViewportOverrideRect) { 1678 if ( inProgrammaticScroll()) {1681 if (currentScrollType() == ScrollType::Programmatic) { 1679 1682 LOG_WITH_STREAM(Scrolling, stream << "computing new override layout viewport because of programmatic scrolling"); 1680 1683 LayoutPoint newOrigin = computeLayoutViewportOrigin(visualViewportRect(), minStableLayoutViewportOrigin(), maxStableLayoutViewportOrigin(), layoutViewport, StickToDocumentBounds); … … 2280 2283 LOG_WITH_STREAM(Scrolling, stream << "FrameView::setScrollPosition " << scrollPosition << " , clearing anchor"); 2281 2284 2282 bool wasInProgrammaticScroll = inProgrammaticScroll();2283 set InProgrammaticScroll(true);2285 auto oldScrollType = currentScrollType(); 2286 setCurrentScrollType(ScrollType::Programmatic); 2284 2287 2285 2288 m_maintainScrollPositionAnchor = nullptr; … … 2291 2294 ScrollView::setScrollPosition(scrollPosition); 2292 2295 2293 set InProgrammaticScroll(wasInProgrammaticScroll);2296 setCurrentScrollType(oldScrollType); 2294 2297 } 2295 2298 … … 2565 2568 return true; 2566 2569 2567 if ( inProgrammaticScroll())2570 if (currentScrollType() == ScrollType::Programmatic) 2568 2571 return true; 2569 2572 … … 4110 4113 m_shouldScrollToFocusedElement = false; 4111 4114 m_delayedScrollToFocusedElementTimer.stop(); 4112 if ( inProgrammaticScroll())4115 if (currentScrollType() == ScrollType::Programmatic) 4113 4116 return; 4114 4117 m_maintainScrollPositionAnchor = nullptr; -
trunk/Source/WebCore/page/FrameViewLayoutContext.cpp
r243643 r243919 117 117 , m_nestedState(layoutContext.m_layoutNestedState, layoutContext.m_layoutNestedState == FrameViewLayoutContext::LayoutNestedState::NotInLayout ? FrameViewLayoutContext::LayoutNestedState::NotNested : FrameViewLayoutContext::LayoutNestedState::Nested) 118 118 , m_schedulingIsEnabled(layoutContext.m_layoutSchedulingIsEnabled, false) 119 , m_ inProgrammaticScroll(layoutContext.view().inProgrammaticScroll())120 { 121 m_view.set InProgrammaticScroll(true);119 , m_previousScrollType(layoutContext.view().currentScrollType()) 120 { 121 m_view.setCurrentScrollType(ScrollType::Programmatic); 122 122 } 123 123 124 124 ~LayoutScope() 125 125 { 126 m_view.set InProgrammaticScroll(m_inProgrammaticScroll);126 m_view.setCurrentScrollType(m_previousScrollType); 127 127 } 128 128 … … 131 131 SetForScope<FrameViewLayoutContext::LayoutNestedState> m_nestedState; 132 132 SetForScope<bool> m_schedulingIsEnabled; 133 bool m_inProgrammaticScroll { false };133 ScrollType m_previousScrollType; 134 134 }; 135 135 -
trunk/Source/WebCore/page/ios/FrameIOS.mm
r240237 r243919 706 706 RenderLayer& layer = *downcast<RenderBoxModelObject>(*renderer).layer(); 707 707 708 layer.setIsUserScroll(isUserScroll); 708 auto oldScrollType = layer.currentScrollType(); 709 layer.setCurrentScrollType(isUserScroll ? ScrollType::User : ScrollType::Programmatic); 709 710 layer.scrollToOffsetWithoutAnimation(position); 710 layer.setIsUserScroll(false); 711 layer.setCurrentScrollType(oldScrollType); 712 711 713 layer.didEndScroll(); // FIXME: Should we always call this? 712 714 } -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
r243855 r243919 214 214 215 215 bool inPageCache = frameView.frame().document()->pageCacheState() != Document::NotInPageCache; 216 bool inProgrammaticScroll = frameView. inProgrammaticScroll();216 bool inProgrammaticScroll = frameView.currentScrollType() == ScrollType::Programmatic; 217 217 if (inProgrammaticScroll || inPageCache) 218 218 updateScrollPositionAfterAsyncScroll(frameView.scrollingNodeID(), scrollPosition, { }, ScrollType::Programmatic, ScrollingLayerPositionAction::Set); … … 326 326 // Overflow-scroll area. 327 327 if (auto* scrollableArea = frameView.scrollableAreaForScrollLayerID(scrollingNodeID)) { 328 scrollableArea->setIsUserScroll(scrollingLayerPositionAction == ScrollingLayerPositionAction::Sync); 328 auto previousScrollType = scrollableArea->currentScrollType(); 329 scrollableArea->setCurrentScrollType(scrollType); 329 330 scrollableArea->scrollToOffsetWithoutAnimation(scrollPosition); 330 scrollableArea->setIsUserScroll(false); 331 scrollableArea->setCurrentScrollType(previousScrollType); 332 331 333 if (scrollingLayerPositionAction == ScrollingLayerPositionAction::Set) 332 334 m_page->editorClient().overflowScrollPositionChanged(); … … 344 346 void AsyncScrollingCoordinator::reconcileScrollingState(FrameView& frameView, const FloatPoint& scrollPosition, const LayoutViewportOriginOrOverrideRect& layoutViewportOriginOrOverrideRect, ScrollType scrollType, ViewportRectStability viewportRectStability, ScrollingLayerPositionAction scrollingLayerPositionAction) 345 347 { 346 bool oldProgrammaticScroll = frameView.inProgrammaticScroll();347 frameView.set InProgrammaticScroll(scrollType == ScrollType::Programmatic);348 auto previousScrollType = frameView.currentScrollType(); 349 frameView.setCurrentScrollType(scrollType); 348 350 349 351 LOG_WITH_STREAM(Scrolling, stream << getCurrentProcessID() << " AsyncScrollingCoordinator " << this << " reconcileScrollingState scrollPosition " << scrollPosition << " type " << scrollType << " stability " << viewportRectStability << " " << scrollingLayerPositionAction); … … 368 370 frameView.notifyScrollPositionChanged(roundedIntPoint(scrollPosition)); 369 371 frameView.setConstrainsScrollingToContentEdge(true); 370 frameView.setInProgrammaticScroll(oldProgrammaticScroll); 372 373 frameView.setCurrentScrollType(previousScrollType); 371 374 372 375 if (scrollType == ScrollType::User && scrollingLayerPositionAction != ScrollingLayerPositionAction::Set) { -
trunk/Source/WebCore/platform/ScrollView.cpp
r240249 r243919 502 502 ScrollPosition newScrollPosition = !delegatesScrolling() ? adjustScrollPositionWithinRange(scrollPosition) : scrollPosition; 503 503 504 if ((!delegatesScrolling() || !inProgrammaticScroll()) && newScrollPosition == this->scrollPosition())504 if ((!delegatesScrolling() || currentScrollType() == ScrollType::User) && newScrollPosition == this->scrollPosition()) 505 505 return; 506 506 -
trunk/Source/WebCore/platform/ScrollableArea.cpp
r243905 r243919 67 67 , m_scrollbarOverlayStyle(ScrollbarOverlayStyleDefault) 68 68 , m_scrollOriginChanged(false) 69 , m_ inProgrammaticScroll(false)69 , m_currentScrollType(static_cast<unsigned>(ScrollType::User)) 70 70 , m_scrollShouldClearLatchedState(false) 71 71 { -
trunk/Source/WebCore/platform/ScrollableArea.h
r243905 r243919 96 96 virtual void didUpdateScroll() { } 97 97 #endif 98 virtual void setIsUserScroll(bool) { }99 98 100 99 // Functions for controlling if you can scroll past the end of the document. … … 229 228 WEBCORE_EXPORT virtual bool scrolledToRight() const; 230 229 231 bool inProgrammaticScroll() const { return m_inProgrammaticScroll; }232 void set InProgrammaticScroll(bool inProgrammaticScroll) { m_inProgrammaticScroll = inProgrammaticScroll; }230 ScrollType currentScrollType() const { return static_cast<ScrollType>(m_currentScrollType); } 231 void setCurrentScrollType(ScrollType scrollType) { m_currentScrollType = static_cast<unsigned>(scrollType); } 233 232 234 233 bool scrollShouldClearLatchedState() const { return m_scrollShouldClearLatchedState; } … … 395 394 396 395 unsigned m_scrollOriginChanged : 1; 397 unsigned m_ inProgrammaticScroll : 1;396 unsigned m_currentScrollType : 1; // ScrollType 398 397 unsigned m_scrollShouldClearLatchedState : 1; 399 398 }; -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r243893 r243919 302 302 , m_adjustForIOSCaretWhenScrolling(false) 303 303 #endif 304 , m_inUserScroll(false)305 304 , m_requiresScrollPositionReconciliation(false) 306 305 , m_containsDirtyOverlayScrollbars(false) … … 2322 2321 } 2323 2322 2324 void RenderLayer::scrollToXPosition(int x, ScrollType , ScrollClamping clamping)2323 void RenderLayer::scrollToXPosition(int x, ScrollType scrollType, ScrollClamping clamping) 2325 2324 { 2326 2325 ScrollPosition position(x, m_scrollPosition.y()); 2327 scrollToOffset(scrollOffsetFromPosition(position), clamping);2328 } 2329 2330 void RenderLayer::scrollToYPosition(int y, ScrollType , ScrollClamping clamping)2326 scrollToOffset(scrollOffsetFromPosition(position), scrollType, clamping); 2327 } 2328 2329 void RenderLayer::scrollToYPosition(int y, ScrollType scrollType, ScrollClamping clamping) 2331 2330 { 2332 2331 ScrollPosition position(m_scrollPosition.x(), y); 2333 scrollToOffset(scrollOffsetFromPosition(position), clamping);2332 scrollToOffset(scrollOffsetFromPosition(position), scrollType, clamping); 2334 2333 } 2335 2334 … … 2339 2338 } 2340 2339 2341 void RenderLayer::scrollToOffset(const ScrollOffset& scrollOffset, Scroll Clamping clamping)2340 void RenderLayer::scrollToOffset(const ScrollOffset& scrollOffset, ScrollType scrollType, ScrollClamping clamping) 2342 2341 { 2343 2342 ScrollOffset newScrollOffset = clamping == ScrollClamping::Clamped ? clampScrollOffset(scrollOffset) : scrollOffset; 2344 if (newScrollOffset != this->scrollOffset()) 2345 scrollToOffsetWithoutAnimation(newScrollOffset, clamping); 2343 if (newScrollOffset == this->scrollOffset()) 2344 return; 2345 2346 auto previousScrollType = currentScrollType(); 2347 setCurrentScrollType(scrollType); 2348 2349 scrollToOffsetWithoutAnimation(newScrollOffset, clamping); 2350 2351 setCurrentScrollType(previousScrollType); 2346 2352 } 2347 2353 … … 2352 2358 return; 2353 2359 2354 LOG_WITH_STREAM(Scrolling, stream << "RenderLayer::scrollTo " << position << " from " << m_scrollPosition << " (i n user scroll " << isInUserScroll() << ")");2360 LOG_WITH_STREAM(Scrolling, stream << "RenderLayer::scrollTo " << position << " from " << m_scrollPosition << " (is user scroll " << (currentScrollType() == ScrollType::User) << ")"); 2355 2361 2356 2362 ScrollPosition newPosition = position; -
trunk/Source/WebCore/rendering/RenderLayer.h
r243893 r243919 415 415 void scrollByRecursively(const IntSize& delta, ScrollableArea** scrolledArea = nullptr); 416 416 417 WEBCORE_EXPORT void scrollToOffset(const ScrollOffset&, ScrollClamping = ScrollClamping::Clamped); 418 void scrollToXOffset(int x, ScrollClamping clamping = ScrollClamping::Clamped) { scrollToOffset(ScrollOffset(x, scrollOffset().y()), clamping); } 419 void scrollToYOffset(int y, ScrollClamping clamping = ScrollClamping::Clamped) { scrollToOffset(ScrollOffset(scrollOffset().x(), y), clamping); } 417 WEBCORE_EXPORT void scrollToOffset(const ScrollOffset&, ScrollType = ScrollType::Programmatic, ScrollClamping = ScrollClamping::Clamped); 420 418 421 419 void scrollToXPosition(int x, ScrollType, ScrollClamping = ScrollClamping::Clamped); 422 420 void scrollToYPosition(int y, ScrollType, ScrollClamping = ScrollClamping::Clamped); 421 422 // These are only used by marquee. 423 void scrollToXOffset(int x, ScrollClamping clamping = ScrollClamping::Clamped) { scrollToOffset(ScrollOffset(x, scrollOffset().y()), ScrollType::Programmatic, clamping); } 424 void scrollToYOffset(int y, ScrollClamping clamping = ScrollClamping::Clamped) { scrollToOffset(ScrollOffset(scrollOffset().x(), y), ScrollType::Programmatic, clamping); } 423 425 424 426 void setPostLayoutScrollPosition(Optional<ScrollPosition>); … … 459 461 void updateSnapOffsets() override; 460 462 #endif 461 462 void setIsUserScroll(bool isUserScroll) override { m_inUserScroll = isUserScroll; }463 bool isInUserScroll() const { return m_inUserScroll; }464 463 465 464 bool requiresScrollPositionReconciliation() const { return m_requiresScrollPositionReconciliation; } … … 1221 1220 #endif 1222 1221 1223 bool m_inUserScroll : 1;1224 1222 bool m_requiresScrollPositionReconciliation : 1; 1225 1223 bool m_containsDirtyOverlayScrollbars : 1; -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r243893 r243919 1263 1263 void RenderLayerBacking::updateScrollOffset(ScrollOffset scrollOffset) 1264 1264 { 1265 if (m_owningLayer. isInUserScroll()) {1265 if (m_owningLayer.currentScrollType() == ScrollType::User) { 1266 1266 // If scrolling is happening externally, we don't want to touch the layer bounds origin here because that will cause jitter. 1267 1267 setLocationOfScrolledContents(scrollOffset, ScrollingLayerPositionAction::Sync); -
trunk/Source/WebCore/rendering/RenderMarquee.cpp
r234808 r243919 174 174 if (!m_suspended && !m_stopped) { 175 175 if (isHorizontal()) 176 m_layer->scrollToOffset(ScrollOffset(m_start, 0), Scroll Clamping::Unclamped);176 m_layer->scrollToOffset(ScrollOffset(m_start, 0), ScrollType::Programmatic, ScrollClamping::Unclamped); 177 177 else 178 m_layer->scrollToOffset(ScrollOffset(0, m_start), Scroll Clamping::Unclamped);178 m_layer->scrollToOffset(ScrollOffset(0, m_start), ScrollType::Programmatic, ScrollClamping::Unclamped); 179 179 } else { 180 180 m_suspended = false; -
trunk/Source/WebKitLegacy/mac/ChangeLog
r243841 r243919 1 2019-04-04 Simon Fraser <simon.fraser@apple.com> 2 3 Have ScrollableArea store a ScrollType for the current scroll 4 https://bugs.webkit.org/show_bug.cgi?id=196627 5 6 Reviewed by Zalan Bujtas. 7 8 Send the programmatic scroll type. 9 10 * DOM/DOMHTML.mm: 11 (-[DOMHTMLElement setScrollXOffset:scrollYOffset:adjustForIOSCaret:]): 12 1 13 2019-04-03 Myles C. Maxfield <mmaxfield@apple.com> 2 14 -
trunk/Source/WebKitLegacy/mac/DOM/DOMHTML.mm
r237266 r243919 116 116 if (adjustForIOSCaret) 117 117 layer->setAdjustForIOSCaretWhenScrolling(true); 118 layer->scrollToOffset(ScrollOffset(x, y), Scroll Clamping::Unclamped);118 layer->scrollToOffset(ScrollOffset(x, y), ScrollType::Programmatic, ScrollClamping::Unclamped); 119 119 if (adjustForIOSCaret) 120 120 layer->setAdjustForIOSCaretWhenScrolling(false);
Note:
See TracChangeset
for help on using the changeset viewer.