Changeset 224260 in webkit
- Timestamp:
- Oct 31, 2017 4:26:52 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r224250 r224260 1 2017-10-31 Simon Fraser <simon.fraser@apple.com> 2 3 Make it possible to test rubber-banding in overflow scroll 4 https://bugs.webkit.org/show_bug.cgi?id=179078 5 6 Reviewed by Sam Weinig. 7 8 Test that internals.unconstrainedScrollTo() works. 9 10 * fast/scrolling/unconstrained-scrollto-expected.txt: Added. 11 * fast/scrolling/unconstrained-scrollto.html: Added. 12 1 13 2017-10-31 Youenn Fablet <youenn@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r224255 r224260 1 2017-10-31 Simon Fraser <simon.fraser@apple.com> 2 3 Make it possible to test rubber-banding in overflow scroll 4 https://bugs.webkit.org/show_bug.cgi?id=179078 5 6 Reviewed by Sam Weinig. 7 8 Test: fast/scrolling/unconstrained-scrollto.html 9 10 Add internals.unconstrainedScrollTo(element, x, y) and plumb through ScrollClamping 11 (which replaces RenderLayer::ScrollOffsetClamping) to support it. 12 13 Flip the default from unclamped to clamped for various RenderLayer scrolling-related 14 functions, since most callers want clamped. 15 16 * accessibility/AccessibilityRenderObject.cpp: 17 (WebCore::AccessibilityRenderObject::scrollTo const): 18 * dom/Element.cpp: 19 (WebCore::Element::scrollTo): 20 * dom/Element.h: 21 * html/HTMLBodyElement.cpp: 22 (WebCore::HTMLBodyElement::scrollTo): 23 * html/HTMLBodyElement.h: 24 * html/TextFieldInputType.cpp: 25 (WebCore::TextFieldInputType::elementDidBlur): 26 * page/DOMWindow.cpp: 27 (WebCore::DOMWindow::scrollTo const): 28 * page/DOMWindow.h: 29 * page/Frame.cpp: 30 (WebCore::Frame::scrollOverflowLayer): 31 (WebCore::Frame::checkOverflowScroll): 32 * platform/ScrollAnimator.cpp: 33 (WebCore::ScrollAnimator::scrollToOffsetWithoutAnimation): 34 * platform/ScrollAnimator.h: 35 * platform/ScrollTypes.h: 36 * platform/ScrollableArea.cpp: 37 (WebCore::ScrollableArea::scrollToOffsetWithoutAnimation): 38 * platform/ScrollableArea.h: 39 * platform/cocoa/ScrollController.h: 40 * platform/mac/ScrollAnimatorMac.h: 41 * platform/mac/ScrollAnimatorMac.mm: 42 (WebCore::ScrollAnimatorMac::scrollToOffsetWithoutAnimation): 43 (WebCore::ScrollAnimatorMac::immediateScrollToPosition): 44 * platform/mock/ScrollAnimatorMock.h: 45 * rendering/RenderBox.cpp: 46 (WebCore::RenderBox::setScrollLeft): 47 (WebCore::RenderBox::setScrollTop): 48 * rendering/RenderBox.h: 49 * rendering/RenderLayer.cpp: 50 (WebCore::RenderLayer::panScrollFromPoint): 51 (WebCore::RenderLayer::scrollByRecursively): 52 (WebCore::RenderLayer::applyPostLayoutScrollPositionIfNeeded): 53 (WebCore::RenderLayer::scrollToXPosition): 54 (WebCore::RenderLayer::scrollToYPosition): 55 (WebCore::RenderLayer::scrollToOffset): 56 * rendering/RenderLayer.h: 57 * rendering/RenderListBox.cpp: 58 (WebCore::RenderListBox::setScrollLeft): 59 (WebCore::RenderListBox::setScrollTop): 60 * rendering/RenderListBox.h: 61 * rendering/RenderTextControlSingleLine.cpp: 62 (WebCore::RenderTextControlSingleLine::setScrollLeft): 63 (WebCore::RenderTextControlSingleLine::setScrollTop): 64 * rendering/RenderTextControlSingleLine.h: 65 * testing/Internals.cpp: 66 (WebCore::Internals::unconstrainedScrollTo): 67 * testing/Internals.h: 68 * testing/Internals.idl: 69 1 70 2017-10-31 Dean Jackson <dino@apple.com> 2 71 -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r224213 r224260 3723 3723 3724 3724 // FIXME: is point a ScrollOffset or ScrollPosition? Test in RTL overflow. 3725 box.layer()->scrollToOffset(point , RenderLayer::ScrollOffsetClamped);3725 box.layer()->scrollToOffset(point); 3726 3726 } 3727 3727 -
trunk/Source/WebCore/dom/Element.cpp
r224213 r224260 704 704 } 705 705 706 void Element::scrollTo(const ScrollToOptions& options )706 void Element::scrollTo(const ScrollToOptions& options, ScrollClamping clamping) 707 707 { 708 708 // If the element is the root element and document is in quirks mode, terminate these steps. … … 723 723 double y = options.top ? normalizeNonFiniteValue(options.top.value()) : adjustForAbsoluteZoom(renderer->scrollTop(), *renderer); 724 724 725 renderer->setScrollLeft(clampToInteger(x * renderer->style().effectiveZoom()) );726 renderer->setScrollTop(clampToInteger(y * renderer->style().effectiveZoom()) );725 renderer->setScrollLeft(clampToInteger(x * renderer->style().effectiveZoom()), clamping); 726 renderer->setScrollTop(clampToInteger(y * renderer->style().effectiveZoom()), clamping); 727 727 } 728 728 -
trunk/Source/WebCore/dom/Element.h
r224053 r224260 138 138 void scrollBy(const ScrollToOptions&); 139 139 void scrollBy(double x, double y); 140 virtual void scrollTo(const ScrollToOptions& );140 virtual void scrollTo(const ScrollToOptions&, ScrollClamping = ScrollClamping::Clamped); 141 141 void scrollTo(double x, double y); 142 142 -
trunk/Source/WebCore/html/HTMLBodyElement.cpp
r224213 r224260 300 300 } 301 301 302 void HTMLBodyElement::scrollTo(const ScrollToOptions& options )302 void HTMLBodyElement::scrollTo(const ScrollToOptions& options, ScrollClamping clamping) 303 303 { 304 304 if (isFirstBodyElementOfDocument()) { … … 314 314 return; 315 315 } 316 return HTMLElement::scrollTo(options );316 return HTMLElement::scrollTo(options, clamping); 317 317 } 318 318 -
trunk/Source/WebCore/html/HTMLBodyElement.h
r223802 r224260 58 58 void setScrollTop(int) final; 59 59 60 void scrollTo(const ScrollToOptions& ) final;60 void scrollTo(const ScrollToOptions&, ScrollClamping) final; 61 61 62 62 int scrollHeight() final; -
trunk/Source/WebCore/html/TextFieldInputType.cpp
r223644 r224260 213 213 bool isLeftToRightDirection = downcast<RenderTextControlSingleLine>(*renderer).style().isLeftToRightDirection(); 214 214 ScrollOffset scrollOffset(isLeftToRightDirection ? 0 : innerLayer->scrollWidth(), 0); 215 innerLayer->scrollToOffset(scrollOffset , RenderLayer::ScrollOffsetClamped);215 innerLayer->scrollToOffset(scrollOffset); 216 216 } 217 217 -
trunk/Source/WebCore/page/DOMWindow.cpp
r224236 r224260 1552 1552 } 1553 1553 1554 void DOMWindow::scrollTo(const ScrollToOptions& options ) const1554 void DOMWindow::scrollTo(const ScrollToOptions& options, ScrollClamping clamping) const 1555 1555 { 1556 1556 if (!isCurrentlyDisplayedInFrame()) … … 1563 1563 double x = options.left ? options.left.value() : view->contentsScrollPosition().x(); 1564 1564 double y = options.top ? options.top.value() : view->contentsScrollPosition().y(); 1565 return scrollTo(x, y );1566 } 1567 1568 void DOMWindow::scrollTo(double x, double y ) const1565 return scrollTo(x, y, clamping); 1566 } 1567 1568 void DOMWindow::scrollTo(double x, double y, ScrollClamping) const 1569 1569 { 1570 1570 if (!isCurrentlyDisplayedInFrame()) -
trunk/Source/WebCore/page/DOMWindow.h
r223775 r224260 34 34 #include "ImageBitmap.h" 35 35 #include "ScrollToOptions.h" 36 #include "ScrollTypes.h" 36 37 #include "Supplementable.h" 37 38 #include <heap/HandleTypes.h> … … 233 234 void scrollBy(const ScrollToOptions&) const; 234 235 void scrollBy(double x, double y) const; 235 void scrollTo(const ScrollToOptions& ) const;236 void scrollTo(double x, double y ) const;236 void scrollTo(const ScrollToOptions&, ScrollClamping = ScrollClamping::Clamped) const; 237 void scrollTo(double x, double y, ScrollClamping = ScrollClamping::Clamped) const; 237 238 238 239 void moveBy(float x, float y) const; -
trunk/Source/WebCore/page/Frame.cpp
r224150 r224260 531 531 scrollOffset.setY(std::min(box->scrollHeight() - clientHeight, scrollOffset.y() + clientHeight / 2)); 532 532 533 layer->scrollToOffset(scrollOffset );533 layer->scrollToOffset(scrollOffset, ScrollClamping::Unclamped); 534 534 selection().setCaretRectNeedsUpdate(); 535 535 selection().updateAppearance(); … … 627 627 628 628 if (action == PerformOverflowScroll && (deltaX || deltaY)) { 629 layer->scrollToOffset(layer->scrollOffset() + IntSize(deltaX, deltaY) );629 layer->scrollToOffset(layer->scrollOffset() + IntSize(deltaX, deltaY), ScrollClamping::Unclamped); 630 630 631 631 // Handle making selection. -
trunk/Source/WebCore/platform/ScrollAnimator.cpp
r223728 r224260 76 76 } 77 77 78 void ScrollAnimator::scrollToOffsetWithoutAnimation(const FloatPoint& offset )78 void ScrollAnimator::scrollToOffsetWithoutAnimation(const FloatPoint& offset, ScrollClamping) 79 79 { 80 80 FloatPoint newPositon = ScrollableArea::scrollPositionFromOffset(offset, toFloatSize(m_scrollableArea.scrollOrigin())); -
trunk/Source/WebCore/platform/ScrollAnimator.h
r218799 r224260 30 30 */ 31 31 32 #ifndef ScrollAnimator_h 33 #define ScrollAnimator_h 32 #pragma once 34 33 35 34 #include "FloatPoint.h" … … 70 69 virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier); 71 70 72 virtual void scrollToOffsetWithoutAnimation(const FloatPoint& );71 virtual void scrollToOffsetWithoutAnimation(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped); 73 72 74 73 ScrollableArea& scrollableArea() const { return m_scrollableArea; } … … 156 155 } // namespace WebCore 157 156 158 #endif // ScrollAnimator_h -
trunk/Source/WebCore/platform/ScrollTypes.h
r215566 r224260 178 178 }; 179 179 180 enum class ScrollClamping { 181 Unclamped, 182 Clamped 183 }; 184 180 185 enum ScrollBehaviorForFixedElements { 181 186 StickToDocumentBounds, -
trunk/Source/WebCore/platform/ScrollableArea.cpp
r223728 r224260 140 140 } 141 141 142 void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset )142 void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset, ScrollClamping clamping) 143 143 { 144 144 LOG_WITH_STREAM(Scrolling, stream << "ScrollableArea " << this << " scrollToOffsetWithoutAnimation " << offset); 145 scrollAnimator().scrollToOffsetWithoutAnimation(offset );145 scrollAnimator().scrollToOffsetWithoutAnimation(offset, clamping); 146 146 } 147 147 -
trunk/Source/WebCore/platform/ScrollableArea.h
r222422 r224260 27 27 28 28 #include "ScrollSnapOffsetsInfo.h" 29 #include "ScrollTypes.h" 29 30 #include "Scrollbar.h" 30 31 #include <wtf/Forward.h> … … 51 52 public: 52 53 WEBCORE_EXPORT bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1); 53 WEBCORE_EXPORT void scrollToOffsetWithoutAnimation(const FloatPoint& );54 WEBCORE_EXPORT void scrollToOffsetWithoutAnimation(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped); 54 55 void scrollToOffsetWithoutAnimation(ScrollbarOrientation, float offset); 55 56 -
trunk/Source/WebCore/platform/cocoa/ScrollController.h
r223728 r224260 62 62 virtual bool shouldRubberBandInDirection(ScrollDirection) = 0; 63 63 64 // FIXME: use ScrollClamping to collapse these to one. 64 65 virtual void immediateScrollBy(const FloatSize&) = 0; 65 66 virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) = 0; -
trunk/Source/WebCore/platform/gtk/ScrollAnimatorGtk.cpp
r223728 r224260 92 92 #endif 93 93 94 void ScrollAnimatorGtk::scrollToOffsetWithoutAnimation(const FloatPoint& offset )94 void ScrollAnimatorGtk::scrollToOffsetWithoutAnimation(const FloatPoint& offset, ScrollClamping) 95 95 { 96 96 FloatPoint position = ScrollableArea::scrollPositionFromOffset(offset, toFloatSize(m_scrollableArea.scrollOrigin())); -
trunk/Source/WebCore/platform/gtk/ScrollAnimatorGtk.h
r217971 r224260 48 48 bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier) override; 49 49 #endif 50 void scrollToOffsetWithoutAnimation(const FloatPoint& ) override;50 void scrollToOffsetWithoutAnimation(const FloatPoint&, ScrollClamping) override; 51 51 void willEndLiveResize() override; 52 52 -
trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h
r198787 r224260 25 25 */ 26 26 27 #ifndef ScrollAnimatorMac_h 28 #define ScrollAnimatorMac_h 27 #pragma once 29 28 30 29 #if ENABLE(SMOOTH_SCROLLING) … … 83 82 84 83 bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier) override; 85 void scrollToOffsetWithoutAnimation(const FloatPoint& ) override;84 void scrollToOffsetWithoutAnimation(const FloatPoint&, ScrollClamping) override; 86 85 87 86 #if ENABLE(RUBBER_BANDING) … … 135 134 FloatPoint adjustScrollPositionIfNecessary(const FloatPoint&) const; 136 135 137 void immediateScrollToPosition(const FloatPoint& );136 void immediateScrollToPosition(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped); 138 137 139 138 bool isRubberBandInProgress() const override; … … 165 164 #endif // ENABLE(SMOOTH_SCROLLING) 166 165 167 #endif // ScrollAnimatorMac_h -
trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
r223476 r224260 710 710 711 711 // FIXME: Maybe this should take a position. 712 void ScrollAnimatorMac::scrollToOffsetWithoutAnimation(const FloatPoint& offset )712 void ScrollAnimatorMac::scrollToOffsetWithoutAnimation(const FloatPoint& offset, ScrollClamping clamping) 713 713 { 714 714 [m_scrollAnimationHelper _stopRun]; 715 immediateScrollToPosition(ScrollableArea::scrollPositionFromOffset(offset, toFloatSize(m_scrollableArea.scrollOrigin())) );715 immediateScrollToPosition(ScrollableArea::scrollPositionFromOffset(offset, toFloatSize(m_scrollableArea.scrollOrigin())), clamping); 716 716 } 717 717 … … 736 736 } 737 737 738 void ScrollAnimatorMac::immediateScrollToPosition(const FloatPoint& newPosition )738 void ScrollAnimatorMac::immediateScrollToPosition(const FloatPoint& newPosition, ScrollClamping clamping) 739 739 { 740 740 FloatPoint currentPosition = this->currentPosition(); 741 FloatPoint adjustedPosition = adjustScrollPositionIfNecessary(newPosition);741 FloatPoint adjustedPosition = clamping == ScrollClamping::Clamped ? adjustScrollPositionIfNecessary(newPosition) : newPosition; 742 742 743 743 bool positionChanged = adjustedPosition != currentPosition; -
trunk/Source/WebCore/platform/mock/ScrollAnimatorMock.h
r218615 r224260 29 29 */ 30 30 31 #ifndef ScrollAnimatorMock_h 32 #define ScrollAnimatorMock_h 31 #pragma once 33 32 34 33 #include "ScrollAnimator.h" … … 43 42 ScrollAnimatorMock(ScrollableArea&, WTF::Function<void(const String&)>&&); 44 43 virtual ~ScrollAnimatorMock(); 44 45 private: 45 46 46 47 #if ENABLE(RUBBER_BANDING) … … 57 58 #endif 58 59 59 private:60 60 void didAddVerticalScrollbar(Scrollbar*) override; 61 61 void didAddHorizontalScrollbar(Scrollbar*) override; … … 76 76 } // namespace WebCore 77 77 78 #endif // ScrollAnimatorMock_h -
trunk/Source/WebCore/rendering/RenderBox.cpp
r224150 r224260 573 573 } 574 574 575 void RenderBox::setScrollLeft(int newLeft )575 void RenderBox::setScrollLeft(int newLeft, ScrollClamping clamping) 576 576 { 577 577 if (!hasOverflowClip() || !layer()) 578 578 return; 579 579 setupWheelEventTestTrigger(*layer()); 580 layer()->scrollToXPosition(newLeft, RenderLayer::ScrollOffsetClamped);581 } 582 583 void RenderBox::setScrollTop(int newTop )580 layer()->scrollToXPosition(newLeft, clamping); 581 } 582 583 void RenderBox::setScrollTop(int newTop, ScrollClamping clamping) 584 584 { 585 585 if (!hasOverflowClip() || !layer()) 586 586 return; 587 587 setupWheelEventTestTrigger(*layer()); 588 layer()->scrollToYPosition(newTop, RenderLayer::ScrollOffsetClamped);588 layer()->scrollToYPosition(newTop, clamping); 589 589 } 590 590 -
trunk/Source/WebCore/rendering/RenderBox.h
r222823 r224260 241 241 virtual int scrollWidth() const; 242 242 virtual int scrollHeight() const; 243 virtual void setScrollLeft(int );244 virtual void setScrollTop(int );243 virtual void setScrollLeft(int, ScrollClamping = ScrollClamping::Clamped); 244 virtual void setScrollTop(int, ScrollClamping = ScrollClamping::Clamped); 245 245 246 246 LayoutUnit marginTop() const override { return m_marginBox.top(); } -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r224150 r224260 2271 2271 delta.setHeight(0); 2272 2272 2273 scrollByRecursively(adjustedScrollDelta(delta) , ScrollOffsetClamped);2273 scrollByRecursively(adjustedScrollDelta(delta)); 2274 2274 } 2275 2275 2276 2276 // FIXME: unify with the scrollRectToVisible() code below. 2277 void RenderLayer::scrollByRecursively(const IntSize& delta, Scroll OffsetClamping clamp, ScrollableArea** scrolledArea)2277 void RenderLayer::scrollByRecursively(const IntSize& delta, ScrollableArea** scrolledArea) 2278 2278 { 2279 2279 if (delta.isZero()) … … 2286 2286 if (renderer().hasOverflowClip() && !restrictedByLineClamp) { 2287 2287 ScrollOffset newScrollOffset = scrollOffset() + delta; 2288 scrollToOffset(newScrollOffset , clamp);2288 scrollToOffset(newScrollOffset); 2289 2289 if (scrolledArea) 2290 2290 *scrolledArea = this; … … 2294 2294 if (!remainingScrollOffset.isZero() && renderer().parent()) { 2295 2295 if (RenderLayer* scrollableLayer = enclosingScrollableLayer()) 2296 scrollableLayer->scrollByRecursively(remainingScrollOffset, clamp,scrolledArea);2296 scrollableLayer->scrollByRecursively(remainingScrollOffset, scrolledArea); 2297 2297 2298 2298 renderer().frame().eventHandler().updateAutoscrollRenderer(); … … 2320 2320 return; 2321 2321 2322 scrollToOffset(scrollOffsetFromPosition(m_postLayoutScrollPosition.value()) , ScrollOffsetClamped);2322 scrollToOffset(scrollOffsetFromPosition(m_postLayoutScrollPosition.value())); 2323 2323 m_postLayoutScrollPosition = std::nullopt; 2324 2324 } 2325 2325 2326 void RenderLayer::scrollToXPosition(int x, Scroll OffsetClamping clamp)2326 void RenderLayer::scrollToXPosition(int x, ScrollClamping clamping) 2327 2327 { 2328 2328 ScrollPosition position(x, m_scrollPosition.y()); 2329 scrollToOffset(scrollOffsetFromPosition(position), clamp );2330 } 2331 2332 void RenderLayer::scrollToYPosition(int y, Scroll OffsetClamping clamp)2329 scrollToOffset(scrollOffsetFromPosition(position), clamping); 2330 } 2331 2332 void RenderLayer::scrollToYPosition(int y, ScrollClamping clamping) 2333 2333 { 2334 2334 ScrollPosition position(m_scrollPosition.x(), y); 2335 scrollToOffset(scrollOffsetFromPosition(position), clamp );2335 scrollToOffset(scrollOffsetFromPosition(position), clamping); 2336 2336 } 2337 2337 … … 2341 2341 } 2342 2342 2343 void RenderLayer::scrollToOffset(const ScrollOffset& scrollOffset, Scroll OffsetClamping clamp)2344 { 2345 ScrollOffset newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffset(scrollOffset) : scrollOffset;2343 void RenderLayer::scrollToOffset(const ScrollOffset& scrollOffset, ScrollClamping clamping) 2344 { 2345 ScrollOffset newScrollOffset = clamping == ScrollClamping::Clamped ? clampScrollOffset(scrollOffset) : scrollOffset; 2346 2346 if (newScrollOffset != this->scrollOffset()) 2347 scrollToOffsetWithoutAnimation(newScrollOffset );2347 scrollToOffsetWithoutAnimation(newScrollOffset, clamping); 2348 2348 } 2349 2349 -
trunk/Source/WebCore/rendering/RenderLayer.h
r223210 r224260 198 198 void panScrollFromPoint(const IntPoint&); 199 199 200 enum ScrollOffsetClamping {201 ScrollOffsetUnclamped,202 ScrollOffsetClamped203 };204 205 200 // Scrolling methods for layers that can scroll their overflow. 206 void scrollByRecursively(const IntSize& delta, Scroll OffsetClamping = ScrollOffsetUnclamped, ScrollableArea** scrolledArea = nullptr);207 208 WEBCORE_EXPORT void scrollToOffset(const ScrollOffset&, Scroll OffsetClamping = ScrollOffsetUnclamped);209 void scrollToXOffset(int x, Scroll OffsetClamping clamp = ScrollOffsetUnclamped) { scrollToOffset(ScrollOffset(x, scrollOffset().y()), clamp); }210 void scrollToYOffset(int y, Scroll OffsetClamping clamp = ScrollOffsetUnclamped) { scrollToOffset(ScrollOffset(scrollOffset().x(), y), clamp); }211 212 void scrollToXPosition(int x, Scroll OffsetClamping = ScrollOffsetUnclamped);213 void scrollToYPosition(int y, Scroll OffsetClamping = ScrollOffsetUnclamped);201 void scrollByRecursively(const IntSize& delta, ScrollableArea** scrolledArea = nullptr); 202 203 WEBCORE_EXPORT void scrollToOffset(const ScrollOffset&, ScrollClamping = ScrollClamping::Clamped); 204 void scrollToXOffset(int x, ScrollClamping clamping = ScrollClamping::Clamped) { scrollToOffset(ScrollOffset(x, scrollOffset().y()), clamping); } 205 void scrollToYOffset(int y, ScrollClamping clamping = ScrollClamping::Clamped) { scrollToOffset(ScrollOffset(scrollOffset().x(), y), clamping); } 206 207 void scrollToXPosition(int x, ScrollClamping = ScrollClamping::Clamped); 208 void scrollToYPosition(int y, ScrollClamping = ScrollClamping::Clamped); 214 209 215 210 void setPostLayoutScrollPosition(std::optional<ScrollPosition>); -
trunk/Source/WebCore/rendering/RenderListBox.cpp
r223720 r224260 735 735 } 736 736 737 void RenderListBox::setScrollLeft(int )737 void RenderListBox::setScrollLeft(int, ScrollClamping) 738 738 { 739 739 } … … 752 752 } 753 753 754 void RenderListBox::setScrollTop(int newTop )754 void RenderListBox::setScrollTop(int newTop, ScrollClamping) 755 755 { 756 756 // Determine an index and scroll to it. -
trunk/Source/WebCore/rendering/RenderListBox.h
r218615 r224260 106 106 int scrollWidth() const override; 107 107 int scrollHeight() const override; 108 void setScrollLeft(int ) override;109 void setScrollTop(int ) override;108 void setScrollLeft(int, ScrollClamping) override; 109 void setScrollTop(int, ScrollClamping) override; 110 110 111 111 bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override; -
trunk/Source/WebCore/rendering/RenderMarquee.cpp
r223728 r224260 58 58 59 59 RenderMarquee::RenderMarquee(RenderLayer* l) 60 : m_layer(l), m_currentLoop(0) 61 , m_totalLoops(0) 60 : m_layer(l) 62 61 , m_timer(*this, &RenderMarquee::timerFired) 63 , m_start(0), m_end(0), m_speed(0), m_reset(false) 64 , m_suspended(false), m_stopped(false), m_direction(MAUTO) 62 , m_reset(false) 63 , m_suspended(false) 64 , m_stopped(false) 65 , m_direction(MAUTO) 65 66 { 66 67 l->setConstrainsScrollingToContentEdge(false); … … 158 159 if (!m_suspended && !m_stopped) { 159 160 if (isHorizontal()) 160 m_layer->scrollToOffset(ScrollOffset(m_start, 0) );161 m_layer->scrollToOffset(ScrollOffset(m_start, 0), ScrollClamping::Unclamped); 161 162 else 162 m_layer->scrollToOffset(ScrollOffset(0, m_start) );163 m_layer->scrollToOffset(ScrollOffset(0, m_start), ScrollClamping::Unclamped); 163 164 } 164 165 else { … … 233 234 m_reset = false; 234 235 if (isHorizontal()) 235 m_layer->scrollToXOffset(m_start );236 m_layer->scrollToXOffset(m_start, ScrollClamping::Unclamped); 236 237 else 237 m_layer->scrollToYOffset(m_start );238 m_layer->scrollToYOffset(m_start, ScrollClamping::Unclamped); 238 239 return; 239 240 } … … 275 276 276 277 if (isHorizontal()) 277 m_layer->scrollToXOffset(newPos );278 m_layer->scrollToXOffset(newPos, ScrollClamping::Unclamped); 278 279 else 279 m_layer->scrollToYOffset(newPos );280 m_layer->scrollToYOffset(newPos, ScrollClamping::Unclamped); 280 281 } 281 282 -
trunk/Source/WebCore/rendering/RenderMarquee.h
r208668 r224260 82 82 83 83 RenderLayer* m_layer; 84 int m_currentLoop;85 int m_totalLoops;86 84 Timer m_timer; 87 int m_start; 88 int m_end; 89 int m_speed; 85 int m_currentLoop { 0 }; 86 int m_totalLoops { 0 }; 87 int m_start { 0 }; 88 int m_end { 0 }; 89 int m_speed { 0 }; 90 90 Length m_height; 91 91 bool m_reset: 1; -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
r223728 r224260 341 341 } 342 342 343 void RenderTextControlSingleLine::setScrollLeft(int newLeft )343 void RenderTextControlSingleLine::setScrollLeft(int newLeft, ScrollClamping) 344 344 { 345 345 if (innerTextElement()) … … 347 347 } 348 348 349 void RenderTextControlSingleLine::setScrollTop(int newTop )349 void RenderTextControlSingleLine::setScrollTop(int newTop, ScrollClamping) 350 350 { 351 351 if (innerTextElement()) -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h
r217418 r224260 57 57 int scrollWidth() const override; 58 58 int scrollHeight() const override; 59 void setScrollLeft(int ) override;60 void setScrollTop(int ) override;59 void setScrollLeft(int, ScrollClamping) override; 60 void setScrollTop(int, ScrollClamping) override; 61 61 bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) final; 62 62 bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0) final; -
trunk/Source/WebCore/testing/Internals.cpp
r224150 r224260 1511 1511 } 1512 1512 1513 ExceptionOr<void> Internals::unconstrainedScrollTo(Element& element, double x, double y) 1514 { 1515 Document* document = contextDocument(); 1516 if (!document || !document->view()) 1517 return Exception { InvalidAccessError }; 1518 1519 element.scrollTo({ x, y }, ScrollClamping::Unclamped); 1520 return { }; 1521 } 1522 1513 1523 ExceptionOr<Ref<DOMRect>> Internals::layoutViewportRect() 1514 1524 { -
trunk/Source/WebCore/testing/Internals.h
r224128 r224260 212 212 213 213 ExceptionOr<void> setScrollViewPosition(int x, int y); 214 ExceptionOr<void> unconstrainedScrollTo(Element&, double x, double y); 214 215 215 216 ExceptionOr<Ref<DOMRect>> layoutViewportRect(); -
trunk/Source/WebCore/testing/Internals.idl
r224128 r224260 168 168 [MayThrowException] void setScrollViewPosition(long x, long y); 169 169 170 // Like Element.scrollTo(), but without constaints, for testing rubber-banding. 171 [MayThrowException] void unconstrainedScrollTo(Element element, unrestricted double x, unrestricted double y); 172 170 173 [MayThrowException] DOMRect layoutViewportRect(); 171 174 [MayThrowException] DOMRect visualViewportRect(); -
trunk/Source/WebKitLegacy/mac/ChangeLog
r224254 r224260 1 2017-10-31 Simon Fraser <simon.fraser@apple.com> 2 3 Make it possible to test rubber-banding in overflow scroll 4 https://bugs.webkit.org/show_bug.cgi?id=179078 5 6 Reviewed by Sam Weinig. 7 8 Add internals.unconstrainedScrollTo(element, x, y) and plumb through ScrollClamping 9 (which replaces RenderLayer::ScrollOffsetClamping) to support it. 10 11 Flip the default from unclamped to clamped for various RenderLayer scrolling-related 12 functions, since most callers want clamped. 13 14 * DOM/DOMHTML.mm: 15 (-[DOMHTMLElement setScrollXOffset:scrollYOffset:adjustForIOSCaret:]): 16 1 17 2017-10-31 Tim Horton <timothy_horton@apple.com> 2 18 -
trunk/Source/WebKitLegacy/mac/DOM/DOMHTML.mm
r211468 r224260 116 116 if (adjustForIOSCaret) 117 117 layer->setAdjustForIOSCaretWhenScrolling(true); 118 layer->scrollToOffset(ScrollOffset(x, y) );118 layer->scrollToOffset(ScrollOffset(x, y), ScrollClamping::Unclamped); 119 119 if (adjustForIOSCaret) 120 120 layer->setAdjustForIOSCaretWhenScrolling(false);
Note: See TracChangeset
for help on using the changeset viewer.