Changeset 286115 in webkit
- Timestamp:
- Nov 22, 2021, 12:01:09 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 23 edited
-
ChangeLog (modified) (1 diff)
-
dom/Element.cpp (modified) (1 diff)
-
dom/Element.h (modified) (1 diff)
-
page/EventHandler.cpp (modified) (1 diff)
-
page/FrameView.cpp (modified) (1 diff)
-
page/FrameView.h (modified) (1 diff)
-
platform/KeyboardScrollingAnimator.cpp (modified) (1 diff)
-
platform/ScrollAnimator.cpp (modified) (3 diffs)
-
platform/ScrollAnimator.h (modified) (2 diffs)
-
platform/ScrollSnapAnimatorState.cpp (modified) (1 diff)
-
platform/ScrollTypes.h (modified) (2 diffs)
-
platform/ScrollableArea.cpp (modified) (2 diffs)
-
platform/ScrollableArea.h (modified) (3 diffs)
-
rendering/RenderBox.cpp (modified) (5 diffs)
-
rendering/RenderBox.h (modified) (2 diffs)
-
rendering/RenderEmbeddedObject.cpp (modified) (2 diffs)
-
rendering/RenderEmbeddedObject.h (modified) (1 diff)
-
rendering/RenderLayerScrollableArea.cpp (modified) (1 diff)
-
rendering/RenderLayerScrollableArea.h (modified) (1 diff)
-
rendering/RenderListBox.cpp (modified) (1 diff)
-
rendering/RenderListBox.h (modified) (2 diffs)
-
rendering/RenderTextControlSingleLine.cpp (modified) (2 diffs)
-
rendering/RenderTextControlSingleLine.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r286113 r286115 1 2021-11-20 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 Reviewed by Sam Weinig. 7 8 ScrollAnimator::scroll() was hard to reason about. It used ScrollbarOrientation but didn't 9 do anything with scrollbars. It took ScrollGranularity, "step" and "multiplier" and it 10 wasn't clear whether step had already accounted for ScrollGranularity, and whether 11 multiplier was anything other than 1 or -1. One of the behaviors was DoDirectionalSnapping 12 but it wasn't clear if the "directional" or "snapping" part of that was important. It also 13 called itself. 14 15 Bring clarity by using 'unsigned stepCount' in all the callers, using ScrollEventAxis 16 instead of ScrollbarOrientation, and having a single "delta" argument. It no longer 17 calls itself, instead just continuing from the snapping branch. 18 19 Add some helpers that ease interactions with FloatPoint/FloatSize and ScrollEventAxis. 20 21 * dom/Element.cpp: 22 (WebCore::Element::scrollByUnits): 23 * dom/Element.h: 24 * page/FrameView.cpp: 25 (WebCore::FrameView::adjustScrollStepForFixedContent): 26 * page/FrameView.h: 27 * platform/ScrollAnimator.cpp: 28 (WebCore::ScrollAnimator::scroll): 29 (WebCore::ScrollAnimator::deltaFromStep): 30 (WebCore::ScrollAnimator::handleWheelEvent): 31 * platform/ScrollAnimator.h: 32 * platform/ScrollSnapAnimatorState.cpp: 33 (WebCore::ScrollSnapAnimatorState::adjustedScrollDestination const): 34 * platform/ScrollTypes.h: 35 (WebCore::axisFromDirection): 36 (WebCore::valueForAxis): 37 (WebCore::setValueForAxis): 38 * platform/ScrollableArea.cpp: 39 (WebCore::ScrollableArea::adjustScrollStepForFixedContent): 40 (WebCore::ScrollableArea::scroll): 41 * platform/ScrollableArea.h: 42 * rendering/RenderBox.cpp: 43 (WebCore::RenderBox::scrollLayer): 44 (WebCore::RenderBox::scroll): 45 (WebCore::RenderBox::logicalScroll): 46 * rendering/RenderBox.h: 47 * rendering/RenderEmbeddedObject.cpp: 48 (WebCore::RenderEmbeddedObject::scroll): 49 (WebCore::RenderEmbeddedObject::logicalScroll): 50 * rendering/RenderEmbeddedObject.h: 51 * rendering/RenderLayerScrollableArea.cpp: 52 (WebCore::RenderLayerScrollableArea::scroll): 53 * rendering/RenderLayerScrollableArea.h: 54 * rendering/RenderListBox.cpp: 55 (WebCore::RenderListBox::scroll): 56 (WebCore::RenderListBox::logicalScroll): 57 * rendering/RenderListBox.h: 58 * rendering/RenderTextControlSingleLine.cpp: 59 (WebCore::RenderTextControlSingleLine::scroll): 60 (WebCore::RenderTextControlSingleLine::logicalScroll): 61 * rendering/RenderTextControlSingleLine.h: 62 1 63 2021-11-22 Antti Koivisto <antti@apple.com> 2 64 -
trunk/Source/WebCore/dom/Element.cpp
r286112 r286115 1120 1120 1121 1121 ScrollDirection direction = ScrollDown; 1122 if (units < 0) {1122 if (units < 0) 1123 1123 direction = ScrollUp; 1124 units = -units; 1125 } 1126 Element* stopElement = this; 1127 downcast<RenderBox>(*renderer).scroll(direction, granularity, units, &stopElement); 1124 1125 auto* stopElement = this; 1126 downcast<RenderBox>(*renderer).scroll(direction, granularity, std::abs(units), &stopElement); 1128 1127 } 1129 1128 -
trunk/Source/WebCore/dom/Element.h
r286112 r286115 176 176 void scrollTo(double x, double y); 177 177 178 // These are only used by WebKitLegacy DOM API. 178 179 WEBCORE_EXPORT void scrollByLines(int lines); 179 180 WEBCORE_EXPORT void scrollByPages(int pages); -
trunk/Source/WebCore/page/EventHandler.cpp
r286021 r286115 4301 4301 float EventHandler::scrollDistance(ScrollDirection direction, ScrollGranularity granularity) 4302 4302 { 4303 auto scrollbar = [&] { 4304 if (direction == ScrollDirection::ScrollUp || direction == ScrollDirection::ScrollDown) 4305 return m_frame.view()->verticalScrollbar(); 4306 return m_frame.view()->horizontalScrollbar(); 4307 }(); 4303 auto scrollbar = m_frame.view()->scrollbarForDirection(direction); 4308 4304 4309 4305 switch (granularity) { -
trunk/Source/WebCore/page/FrameView.cpp
r285893 r286115 3835 3835 } 3836 3836 3837 float FrameView::adjustScrollStepForFixedContent(float step, Scroll barOrientation orientation, ScrollGranularity granularity)3838 { 3839 if (granularity != ScrollGranularity::Page || orientation == ScrollbarOrientation::Horizontal)3837 float FrameView::adjustScrollStepForFixedContent(float step, ScrollEventAxis axis, ScrollGranularity granularity) 3838 { 3839 if (granularity != ScrollGranularity::Page || axis == ScrollEventAxis::Horizontal) 3840 3840 return step; 3841 3841 -
trunk/Source/WebCore/page/FrameView.h
r285893 r286115 662 662 void updateScrollingCoordinatorScrollSnapProperties() const; 663 663 664 float adjustScrollStepForFixedContent(float step, Scroll barOrientation, ScrollGranularity) final;664 float adjustScrollStepForFixedContent(float step, ScrollEventAxis, ScrollGranularity) final; 665 665 666 666 void didChangeScrollOffset(); -
trunk/Source/WebCore/platform/KeyboardScrollingAnimator.cpp
r285640 r286115 148 148 float KeyboardScrollingAnimator::scrollDistance(ScrollDirection direction, ScrollGranularity granularity) const 149 149 { 150 auto scrollbar = [&] { 151 if (direction == ScrollDirection::ScrollUp || direction == ScrollDirection::ScrollDown) 152 return m_scrollAnimator.scrollableArea().verticalScrollbar(); 153 return m_scrollAnimator.scrollableArea().horizontalScrollbar(); 154 }(); 155 150 auto scrollbar = m_scrollAnimator.scrollableArea().scrollbarForDirection(direction); 156 151 if (scrollbar) { 157 152 switch (granularity) { -
trunk/Source/WebCore/platform/ScrollAnimator.cpp
r285640 r286115 64 64 } 65 65 66 bool ScrollAnimator::s croll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier, OptionSet<ScrollBehavior> behavior)66 bool ScrollAnimator::singleAxisScroll(ScrollEventAxis axis, float scrollDelta, OptionSet<ScrollBehavior> behavior) 67 67 { 68 68 m_scrollableArea.scrollbarsController().setScrollbarAnimationsUnsuspendedByUserInteraction(true); 69 69 70 auto delta = deltaFromStep(orientation, step, multiplier); 71 if (behavior.contains(ScrollBehavior::DoDirectionalSnapping)) { 72 behavior.remove(ScrollBehavior::DoDirectionalSnapping); 73 if (!m_scrollController.usesScrollSnap()) 74 return ScrollAnimator::scroll(orientation, granularity, step, multiplier, behavior); 75 76 auto currentOffset = offsetFromPosition(currentPosition()); 77 auto newOffset = currentOffset + delta; 78 if (orientation == ScrollbarOrientation::Horizontal) 79 newOffset.setX(m_scrollController.adjustedScrollDestination(ScrollEventAxis::Horizontal, newOffset, multiplier, currentOffset.x())); 80 else 81 newOffset.setY(m_scrollController.adjustedScrollDestination(ScrollEventAxis::Vertical, newOffset, multiplier, currentOffset.y())); 82 83 auto newDelta = newOffset - currentOffset; 84 if (orientation == ScrollbarOrientation::Horizontal) 85 return scroll(ScrollbarOrientation::Horizontal, granularity, newDelta.width(), 1.0, behavior); 86 87 return scroll(ScrollbarOrientation::Vertical, granularity, newDelta.height(), 1.0, behavior); 70 auto delta = setValueForAxis(FloatSize { }, axis, scrollDelta); 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 } 88 82 } 89 83 … … 140 134 { 141 135 return ScrollableArea::scrollPositionFromOffset(offset, toFloatSize(m_scrollableArea.scrollOrigin())); 142 }143 144 FloatSize ScrollAnimator::deltaFromStep(ScrollbarOrientation orientation, float step, float multiplier)145 {146 FloatSize delta;147 if (orientation == ScrollbarOrientation::Horizontal)148 delta.setWidth(step * multiplier);149 else150 delta.setHeight(step * multiplier);151 return delta;152 136 } 153 137 … … 207 191 handled = true; 208 192 209 OptionSet<ScrollBehavior> behavior (ScrollBehavior::DoDirectionalSnapping);193 OptionSet<ScrollBehavior> behavior = { ScrollBehavior::RespectScrollSnap }; 210 194 if (e.hasPreciseScrollingDeltas()) 211 195 behavior.add(ScrollBehavior::NeverAnimate); 212 196 213 197 if (deltaY) { 214 if (e.granularity() == ScrollByPageWheelEvent) { 215 bool negative = deltaY < 0; 216 deltaY = Scrollbar::pageStepDelta(m_scrollableArea.visibleHeight()); 217 if (negative) 218 deltaY = -deltaY; 219 } 220 scroll(ScrollbarOrientation::Vertical, ScrollGranularity::Pixel, verticalScrollbar->pixelStep(), -deltaY, behavior); 198 if (e.granularity() == ScrollByPageWheelEvent) 199 deltaY = std::copysign(Scrollbar::pageStepDelta(m_scrollableArea.visibleHeight()), deltaY); 200 201 auto scrollDelta = verticalScrollbar->pixelStep() * -deltaY; // Wheel deltas are reversed from scrolling direction. 202 singleAxisScroll(ScrollEventAxis::Vertical, scrollDelta, behavior); 221 203 } 222 204 223 205 if (deltaX) { 224 if (e.granularity() == ScrollByPageWheelEvent) { 225 bool negative = deltaX < 0; 226 deltaX = Scrollbar::pageStepDelta(m_scrollableArea.visibleWidth()); 227 if (negative) 228 deltaX = -deltaX; 229 } 230 scroll(ScrollbarOrientation::Horizontal, ScrollGranularity::Pixel, horizontalScrollbar->pixelStep(), -deltaX, behavior); 206 if (e.granularity() == ScrollByPageWheelEvent) 207 deltaX = std::copysign(Scrollbar::pageStepDelta(m_scrollableArea.visibleWidth()), deltaX); 208 209 auto scrollDelta = horizontalScrollbar->pixelStep() * -deltaX; // Wheel deltas are reversed from scrolling direction. 210 singleAxisScroll(ScrollEventAxis::Horizontal, scrollDelta, behavior); 231 211 } 232 212 } -
trunk/Source/WebCore/platform/ScrollAnimator.h
r285205 r286115 67 67 68 68 enum ScrollBehavior { 69 DoDirectionalSnapping= 1 << 0,70 NeverAnimate = 1 << 1,69 RespectScrollSnap = 1 << 0, 70 NeverAnimate = 1 << 1, 71 71 }; 72 72 73 73 // Computes a scroll destination for the given parameters. Returns false if 74 // already at the destination. Otherwise, starts scrolling towards the75 // destination and returns true. Scrolling may be immediate or animated.74 // already at the destination. Otherwise, starts scrolling towards the 75 // destination and returns true. Scrolling may be immediate or animated. 76 76 // The base class implementation always scrolls immediately, never animates. 77 bool s croll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier, OptionSet<ScrollBehavior>);77 bool singleAxisScroll(ScrollEventAxis, float delta, OptionSet<ScrollBehavior>); 78 78 79 79 virtual bool scrollToPositionWithoutAnimation(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped); … … 172 172 #endif 173 173 174 static FloatSize deltaFromStep(ScrollbarOrientation, float step, float multiplier);175 176 174 protected: 177 175 ScrollableArea& m_scrollableArea; -
trunk/Source/WebCore/platform/ScrollSnapAnimatorState.cpp
r283851 r286115 84 84 auto snapOffsets = snapOffsetsForAxis(axis); 85 85 if (!snapOffsets.size()) 86 return axis == ScrollEventAxis::Horizontal ? destinationOffset.x() : destinationOffset.y();86 return valueForAxis(destinationOffset, axis); 87 87 88 88 std::optional<LayoutUnit> originalOffsetInLayoutUnits; -
trunk/Source/WebCore/platform/ScrollTypes.h
r285640 r286115 26 26 #pragma once 27 27 28 #include "FloatPoint.h" 29 #include "FloatSize.h" 28 30 #include <wtf/EnumTraits.h> 29 31 … … 169 171 Vertical 170 172 }; 173 174 inline constexpr ScrollEventAxis axisFromDirection(ScrollDirection direction) 175 { 176 switch (direction) { 177 case ScrollUp: return ScrollEventAxis::Vertical; 178 case ScrollDown: return ScrollEventAxis::Vertical; 179 case ScrollLeft: return ScrollEventAxis::Horizontal; 180 case ScrollRight: return ScrollEventAxis::Horizontal; 181 } 182 return ScrollEventAxis::Vertical; 183 } 184 185 inline float valueForAxis(FloatSize size, ScrollEventAxis axis) 186 { 187 switch (axis) { 188 case ScrollEventAxis::Horizontal: return size.width(); 189 case ScrollEventAxis::Vertical: return size.height(); 190 } 191 return 0; 192 } 193 194 inline FloatSize setValueForAxis(FloatSize size, ScrollEventAxis axis, float value) 195 { 196 switch (axis) { 197 case ScrollEventAxis::Horizontal: 198 size.setWidth(value); 199 return size; 200 case ScrollEventAxis::Vertical: 201 size.setHeight(value); 202 return size; 203 } 204 return size; 205 } 206 207 inline float valueForAxis(FloatPoint point, ScrollEventAxis axis) 208 { 209 switch (axis) { 210 case ScrollEventAxis::Horizontal: return point.x(); 211 case ScrollEventAxis::Vertical: return point.y(); 212 } 213 return 0; 214 } 215 216 inline FloatPoint setValueForAxis(FloatPoint point, ScrollEventAxis axis, float value) 217 { 218 switch (axis) { 219 case ScrollEventAxis::Horizontal: 220 point.setX(value); 221 return point; 222 case ScrollEventAxis::Vertical: point.setY(value); 223 return point; 224 } 225 return point; 226 } 171 227 172 228 enum ScrollbarControlStateMask { -
trunk/Source/WebCore/platform/ScrollableArea.cpp
r285640 r286115 92 92 } 93 93 94 float ScrollableArea::adjustScrollStepForFixedContent(float step, Scroll barOrientation, ScrollGranularity)94 float ScrollableArea::adjustScrollStepForFixedContent(float step, ScrollEventAxis, ScrollGranularity) 95 95 { 96 96 return step; 97 97 } 98 98 99 bool ScrollableArea::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier) 100 { 101 ScrollbarOrientation orientation; 102 Scrollbar* scrollbar; 103 if (direction == ScrollUp || direction == ScrollDown) { 104 orientation = ScrollbarOrientation::Vertical; 105 scrollbar = verticalScrollbar(); 106 } else { 107 orientation = ScrollbarOrientation::Horizontal; 108 scrollbar = horizontalScrollbar(); 109 } 110 99 bool ScrollableArea::scroll(ScrollDirection direction, ScrollGranularity granularity, unsigned stepCount) 100 { 101 auto* scrollbar = scrollbarForDirection(direction); 111 102 if (!scrollbar) 112 103 return false; … … 128 119 } 129 120 121 auto axis = axisFromDirection(direction); 122 step = adjustScrollStepForFixedContent(step, axis, granularity); 123 auto scrollDelta = step * stepCount; 124 130 125 if (direction == ScrollUp || direction == ScrollLeft) 131 multiplier = -multiplier; 132 133 step = adjustScrollStepForFixedContent(step, orientation, granularity); 134 return scrollAnimator().scroll(orientation, granularity, step, multiplier, ScrollAnimator::ScrollBehavior::DoDirectionalSnapping); 126 scrollDelta = -scrollDelta; 127 128 return scrollAnimator().singleAxisScroll(axis, scrollDelta, ScrollAnimator::ScrollBehavior::RespectScrollSnap); 135 129 } 136 130 -
trunk/Source/WebCore/platform/ScrollableArea.h
r285893 r286115 69 69 virtual bool isPDFPlugin() const { return false; } 70 70 71 WEBCORE_EXPORT bool scroll(ScrollDirection, ScrollGranularity, float multiplier= 1);71 WEBCORE_EXPORT bool scroll(ScrollDirection, ScrollGranularity, unsigned stepCount = 1); 72 72 WEBCORE_EXPORT void scrollToPositionWithAnimation(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped); 73 73 WEBCORE_EXPORT void scrollToPositionWithoutAnimation(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped); … … 216 216 virtual Scrollbar* horizontalScrollbar() const { return nullptr; } 217 217 virtual Scrollbar* verticalScrollbar() const { return nullptr; } 218 219 Scrollbar* scrollbarForDirection(ScrollDirection direction) const 220 { 221 switch (direction) { 222 case ScrollUp: 223 case ScrollDown: 224 return verticalScrollbar(); 225 case ScrollLeft: 226 case ScrollRight: 227 return horizontalScrollbar(); 228 } 229 return nullptr; 230 } 218 231 219 232 const IntPoint& scrollOrigin() const { return m_scrollOrigin; } … … 366 379 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } 367 380 368 WEBCORE_EXPORT virtual float adjustScrollStepForFixedContent(float step, Scroll barOrientation, ScrollGranularity);381 WEBCORE_EXPORT virtual float adjustScrollStepForFixedContent(float step, ScrollEventAxis, ScrollGranularity); 369 382 virtual void invalidateScrollbarRect(Scrollbar&, const IntRect&) = 0; 370 383 virtual void invalidateScrollCornerRect(const IntRect&) = 0; -
trunk/Source/WebCore/rendering/RenderBox.cpp
r286086 r286115 894 894 } 895 895 896 bool RenderBox::scrollLayer(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement)896 bool RenderBox::scrollLayer(ScrollDirection direction, ScrollGranularity granularity, unsigned stepCount, Element** stopElement) 897 897 { 898 898 auto* scrollableArea = layer() ? layer()->scrollableArea() : nullptr; 899 if (scrollableArea && scrollableArea->scroll(direction, granularity, multiplier)) {899 if (scrollableArea && scrollableArea->scroll(direction, granularity, stepCount)) { 900 900 if (stopElement) 901 901 *stopElement = element(); … … 907 907 } 908 908 909 bool RenderBox::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement, RenderBox* startBox, const IntPoint& wheelEventAbsolutePoint)910 { 911 if (scrollLayer(direction, granularity, multiplier, stopElement))909 bool RenderBox::scroll(ScrollDirection direction, ScrollGranularity granularity, unsigned stepCount, Element** stopElement, RenderBox* startBox, const IntPoint& wheelEventAbsolutePoint) 910 { 911 if (scrollLayer(direction, granularity, stepCount, stopElement)) 912 912 return true; 913 913 … … 918 918 919 919 if (nextScrollBlock && !nextScrollBlock->isRenderView()) 920 return nextScrollBlock->scroll(direction, granularity, multiplier, stopElement, startBox, wheelEventAbsolutePoint);920 return nextScrollBlock->scroll(direction, granularity, stepCount, stopElement, startBox, wheelEventAbsolutePoint); 921 921 922 922 return false; 923 923 } 924 924 925 bool RenderBox::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement)925 bool RenderBox::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity, unsigned stepCount, Element** stopElement) 926 926 { 927 927 bool scrolled = false; … … 931 931 // On Mac only we reset the inline direction position when doing a document scroll (e.g., hitting Home/End). 932 932 if (granularity == ScrollGranularity::Document) 933 scrolled = scrollableArea->scroll(logicalToPhysical(ScrollInlineDirectionBackward, isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), ScrollGranularity::Document, multiplier);933 scrolled = scrollableArea->scroll(logicalToPhysical(ScrollInlineDirectionBackward, isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), ScrollGranularity::Document, stepCount); 934 934 #endif 935 if (scrollableArea->scroll(logicalToPhysical(direction, isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), granularity, multiplier))935 if (scrollableArea->scroll(logicalToPhysical(direction, isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), granularity, stepCount)) 936 936 scrolled = true; 937 937 … … 948 948 RenderBlock* b = containingBlock(); 949 949 if (b && !b->isRenderView()) 950 return b->logicalScroll(direction, granularity, multiplier, stopElement);950 return b->logicalScroll(direction, granularity, stepCount, stopElement); 951 951 return false; 952 952 } -
trunk/Source/WebCore/rendering/RenderBox.h
r285623 r286115 493 493 int scrollbarLogicalWidth() const { return style().isHorizontalWritingMode() ? verticalScrollbarWidth() : horizontalScrollbarHeight(); } 494 494 int scrollbarLogicalHeight() const { return style().isHorizontalWritingMode() ? horizontalScrollbarHeight() : verticalScrollbarWidth(); } 495 virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier= 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint());496 virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier= 1, Element** stopElement = nullptr);495 virtual bool scroll(ScrollDirection, ScrollGranularity, unsigned stepCount = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()); 496 virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, unsigned stepCount = 1, Element** stopElement = nullptr); 497 497 WEBCORE_EXPORT bool canBeScrolledAndHasScrollableArea() const; 498 498 virtual bool canBeProgramaticallyScrolled() const; … … 745 745 void updateGridPositionAfterStyleChange(const RenderStyle&, const RenderStyle* oldStyle); 746 746 747 bool scrollLayer(ScrollDirection, ScrollGranularity, float multiplier, Element** stopElement);747 bool scrollLayer(ScrollDirection, ScrollGranularity, unsigned stepCount, Element** stopElement); 748 748 749 749 bool fixedElementLaysOutRelativeToFrame(const FrameView&) const; -
trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp
r283237 r286115 384 384 } 385 385 386 bool RenderEmbeddedObject::scroll(ScrollDirection direction, ScrollGranularity granularity, float, Element**, RenderBox*, const IntPoint&)386 bool RenderEmbeddedObject::scroll(ScrollDirection direction, ScrollGranularity granularity, unsigned, Element**, RenderBox*, const IntPoint&) 387 387 { 388 388 if (!is<PluginViewBase>(widget())) … … 392 392 } 393 393 394 bool RenderEmbeddedObject::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement)394 bool RenderEmbeddedObject::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity, unsigned stepCount, Element** stopElement) 395 395 { 396 396 // Plugins don't expose a writing direction, so assuming horizontal LTR. 397 return scroll(logicalToPhysical(direction, true, false), granularity, multiplier, stopElement);397 return scroll(logicalToPhysical(direction, true, false), granularity, stepCount, stopElement); 398 398 } 399 399 -
trunk/Source/WebCore/rendering/RenderEmbeddedObject.h
r269785 r286115 80 80 bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) final; 81 81 82 bool scroll(ScrollDirection, ScrollGranularity, float multiplier= 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) final;83 bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier, Element** stopElement) final;82 bool scroll(ScrollDirection, ScrollGranularity, unsigned stepCount = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) final; 83 bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, unsigned stepCount, Element** stopElement) final; 84 84 85 85 void setUnavailablePluginIndicatorIsPressed(bool); -
trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp
r285893 r286115 1492 1492 } 1493 1493 1494 bool RenderLayerScrollableArea::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier)1495 { 1496 return ScrollableArea::scroll(direction, granularity, multiplier);1494 bool RenderLayerScrollableArea::scroll(ScrollDirection direction, ScrollGranularity granularity, unsigned stepCount) 1495 { 1496 return ScrollableArea::scroll(direction, granularity, stepCount); 1497 1497 } 1498 1498 -
trunk/Source/WebCore/rendering/RenderLayerScrollableArea.h
r285893 r286115 131 131 void updateScrollbarSteps(); 132 132 133 bool scroll(ScrollDirection, ScrollGranularity, float multiplier= 1);133 bool scroll(ScrollDirection, ScrollGranularity, unsigned stepCount = 1); 134 134 135 135 public: -
trunk/Source/WebCore/rendering/RenderListBox.cpp
r285316 r286115 616 616 } 617 617 618 bool RenderListBox::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Element**, RenderBox*, const IntPoint&)619 { 620 return ScrollableArea::scroll(direction, granularity, multiplier);621 } 622 623 bool RenderListBox::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity, float multiplier, Element**)624 { 625 return ScrollableArea::scroll(logicalToPhysical(direction, style().isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), granularity, multiplier);618 bool RenderListBox::scroll(ScrollDirection direction, ScrollGranularity granularity, unsigned stepCount, Element**, RenderBox*, const IntPoint&) 619 { 620 return ScrollableArea::scroll(direction, granularity, stepCount); 621 } 622 623 bool RenderListBox::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity, unsigned stepCount, Element**) 624 { 625 return ScrollableArea::scroll(logicalToPhysical(direction, style().isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), granularity, stepCount); 626 626 } 627 627 -
trunk/Source/WebCore/rendering/RenderListBox.h
r285205 r286115 60 60 int size() const; 61 61 62 bool scroll(ScrollDirection, ScrollGranularity, float multiplier= 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) override;62 bool scroll(ScrollDirection, ScrollGranularity, unsigned stepCount = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) override; 63 63 64 64 bool scrolledToTop() const final; … … 83 83 bool isPointInOverflowControl(HitTestResult&, const LayoutPoint& locationInContainer, const LayoutPoint& accumulatedOffset) override; 84 84 85 bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier= 1, Element** stopElement = nullptr) override;85 bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, unsigned stepCount = 1, Element** stopElement = nullptr) override; 86 86 87 87 void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override; -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
r279918 r286115 397 397 } 398 398 399 bool RenderTextControlSingleLine::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement, RenderBox* startBox, const IntPoint& wheelEventAbsolutePoint)399 bool RenderTextControlSingleLine::scroll(ScrollDirection direction, ScrollGranularity granularity, unsigned stepCount, Element** stopElement, RenderBox* startBox, const IntPoint& wheelEventAbsolutePoint) 400 400 { 401 401 auto* renderer = innerTextElement()->renderer(); … … 403 403 return false; 404 404 auto* scrollableArea = renderer->layer() ? renderer->layer()->scrollableArea() : nullptr; 405 if (scrollableArea && scrollableArea->scroll(direction, granularity, multiplier))405 if (scrollableArea && scrollableArea->scroll(direction, granularity, stepCount)) 406 406 return true; 407 return RenderBlockFlow::scroll(direction, granularity, multiplier, stopElement, startBox, wheelEventAbsolutePoint);408 } 409 410 bool RenderTextControlSingleLine::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement)407 return RenderBlockFlow::scroll(direction, granularity, stepCount, stopElement, startBox, wheelEventAbsolutePoint); 408 } 409 410 bool RenderTextControlSingleLine::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity, unsigned stepCount, Element** stopElement) 411 411 { 412 412 auto* layer = innerTextElement()->renderer()->layer(); 413 413 auto* scrollableArea = layer ? layer->scrollableArea() : nullptr; 414 if (scrollableArea && scrollableArea->scroll(logicalToPhysical(direction, style().isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), granularity, multiplier))414 if (scrollableArea && scrollableArea->scroll(logicalToPhysical(direction, style().isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), granularity, stepCount)) 415 415 return true; 416 return RenderBlockFlow::logicalScroll(direction, granularity, multiplier, stopElement);416 return RenderBlockFlow::logicalScroll(direction, granularity, stepCount, stopElement); 417 417 } 418 418 -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h
r271439 r286115 60 60 void setScrollLeft(int, const ScrollPositionChangeOptions&) override; 61 61 void setScrollTop(int, const ScrollPositionChangeOptions&) override; 62 bool scroll(ScrollDirection, ScrollGranularity, float multiplier= 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) final;63 bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0) final;62 bool scroll(ScrollDirection, ScrollGranularity, unsigned stepCount = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) final; 63 bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, unsigned stepCount = 1, Element** stopElement = nullptr) final; 64 64 65 65 int textBlockWidth() const;
Note:
See TracChangeset
for help on using the changeset viewer.