Changeset 286119 in webkit
- Timestamp:
- Nov 22, 2021, 1:30:08 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r286118 r286119 1 2021-11-22 Simon Fraser <simon.fraser@apple.com> 2 3 Clarify the behavior of ScrollAnimator::scroll() 4 https://bugs.webkit.org/show_bug.cgi?id=233403 5 6 Unreviewed. 7 8 Address patch feedback from Chris Lord. 9 10 * dom/Element.cpp: 11 (WebCore::Element::scrollByUnits): 12 * page/FrameView.cpp: 13 (WebCore::FrameView::adjustVerticalPageScrollStepForFixedContent): 14 (WebCore::FrameView::adjustScrollStepForFixedContent): Deleted. 15 * page/FrameView.h: 16 * platform/ScrollAnimator.cpp: 17 (WebCore::ScrollAnimator::singleAxisScroll): 18 * platform/ScrollTypes.h: 19 (WebCore::axisFromDirection): 20 (WebCore::valueForAxis): 21 (WebCore::setValueForAxis): 22 * platform/ScrollableArea.cpp: 23 (WebCore::ScrollableArea::adjustVerticalPageScrollStepForFixedContent): 24 (WebCore::ScrollableArea::scroll): 25 (WebCore::ScrollableArea::adjustScrollStepForFixedContent): Deleted. 26 * platform/ScrollableArea.h: 27 1 28 2021-11-22 Fujii Hironori <Hironori.Fujii@sony.com> 2 29 -
trunk/Source/WebCore/dom/Element.cpp
r286115 r286119 1119 1119 return; 1120 1120 1121 ScrollDirection direction = ScrollDown; 1122 if (units < 0) 1123 direction = ScrollUp; 1124 1121 auto direction = units < 0 ? ScrollUp : ScrollDown; 1125 1122 auto* stopElement = this; 1126 1123 downcast<RenderBox>(*renderer).scroll(direction, granularity, std::abs(units), &stopElement); -
trunk/Source/WebCore/page/FrameView.cpp
r286115 r286119 3835 3835 } 3836 3836 3837 float FrameView::adjustScrollStepForFixedContent(float step, ScrollEventAxis axis, ScrollGranularity granularity) 3838 { 3839 if (granularity != ScrollGranularity::Page || axis == ScrollEventAxis::Horizontal) 3840 return step; 3841 3837 float FrameView::adjustVerticalPageScrollStepForFixedContent(float step) 3838 { 3842 3839 TrackedRendererListHashSet* positionedObjects = nullptr; 3843 3840 if (RenderView* root = frame().contentRenderer()) { -
trunk/Source/WebCore/page/FrameView.h
r286115 r286119 662 662 void updateScrollingCoordinatorScrollSnapProperties() const; 663 663 664 float adjust ScrollStepForFixedContent(float step, ScrollEventAxis, ScrollGranularity) final;664 float adjustVerticalPageScrollStepForFixedContent(float step) final; 665 665 666 666 void didChangeScrollOffset(); -
trunk/Source/WebCore/platform/ScrollAnimator.cpp
r286115 r286119 70 70 auto delta = setValueForAxis(FloatSize { }, axis, scrollDelta); 71 71 72 if (behavior.contains(ScrollBehavior::RespectScrollSnap)) { 73 behavior.remove(ScrollBehavior::RespectScrollSnap); 74 if (m_scrollController.usesScrollSnap()) { 75 auto currentOffset = offsetFromPosition(currentPosition()); 76 auto newOffset = currentOffset + delta; 77 auto velocity = copysignf(1.0f, scrollDelta); 78 auto newOffsetOnAxis = m_scrollController.adjustedScrollDestination(axis, newOffset, velocity, valueForAxis(currentOffset, axis)); 79 newOffset = setValueForAxis(newOffset, axis, newOffsetOnAxis); 80 delta = newOffset - currentOffset; 81 } 72 if (behavior.contains(ScrollBehavior::RespectScrollSnap) && m_scrollController.usesScrollSnap()) { 73 auto currentOffset = offsetFromPosition(currentPosition()); 74 auto newOffset = currentOffset + delta; 75 auto velocity = copysignf(1.0f, scrollDelta); 76 auto newOffsetOnAxis = m_scrollController.adjustedScrollDestination(axis, newOffset, velocity, valueForAxis(currentOffset, axis)); 77 newOffset = setValueForAxis(newOffset, axis, newOffsetOnAxis); 78 delta = newOffset - currentOffset; 82 79 } 83 80 -
trunk/Source/WebCore/platform/ScrollTypes.h
r286115 r286119 180 180 case ScrollRight: return ScrollEventAxis::Horizontal; 181 181 } 182 ASSERT_NOT_REACHED(); 182 183 return ScrollEventAxis::Vertical; 183 184 } … … 189 190 case ScrollEventAxis::Vertical: return size.height(); 190 191 } 192 ASSERT_NOT_REACHED(); 191 193 return 0; 192 194 } … … 202 204 return size; 203 205 } 206 ASSERT_NOT_REACHED(); 204 207 return size; 205 208 } … … 211 214 case ScrollEventAxis::Vertical: return point.y(); 212 215 } 216 ASSERT_NOT_REACHED(); 213 217 return 0; 214 218 } … … 223 227 return point; 224 228 } 229 ASSERT_NOT_REACHED(); 225 230 return point; 226 231 } -
trunk/Source/WebCore/platform/ScrollableArea.cpp
r286115 r286119 92 92 } 93 93 94 float ScrollableArea::adjust ScrollStepForFixedContent(float step, ScrollEventAxis, ScrollGranularity)94 float ScrollableArea::adjustVerticalPageScrollStepForFixedContent(float step) 95 95 { 96 96 return step; … … 120 120 121 121 auto axis = axisFromDirection(direction); 122 step = adjustScrollStepForFixedContent(step, axis, granularity); 122 123 if (granularity == ScrollGranularity::Page && axis == ScrollEventAxis::Vertical) 124 step = adjustVerticalPageScrollStepForFixedContent(step); 125 123 126 auto scrollDelta = step * stepCount; 124 127 -
trunk/Source/WebCore/platform/ScrollableArea.h
r286115 r286119 379 379 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } 380 380 381 WEBCORE_EXPORT virtual float adjust ScrollStepForFixedContent(float step, ScrollEventAxis, ScrollGranularity);381 WEBCORE_EXPORT virtual float adjustVerticalPageScrollStepForFixedContent(float step); 382 382 virtual void invalidateScrollbarRect(Scrollbar&, const IntRect&) = 0; 383 383 virtual void invalidateScrollCornerRect(const IntRect&) = 0;
Note:
See TracChangeset
for help on using the changeset viewer.