WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-210171-20200408105309.patch (text/plain), 30.07 KB, created by
cathiechen
on 2020-04-07 19:53:10 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
cathiechen
Created:
2020-04-07 19:53:10 PDT
Size:
30.07 KB
patch
obsolete
>Subversion Revision: 259531 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index cb2b55d5f6eb74a28a2d660f50babb0c955a0b64..a7dd831cf3449cae2ce299bbdb02690631aabcf1 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,53 @@ >+2020-04-07 Cathie Chen <cathiechen@igalia.com> >+ >+ Fix up code style for scroll animation >+ https://bugs.webkit.org/show_bug.cgi?id=210171 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 1. Use AnimatedScroll instead of bool to indicate animated or not. >+ 2. Remove parameter ScrollRectToVisibleOptions, the autoscroll status is available from EventHandler. >+ 3. In order to keep consistent, use RenderLayer::setScrollPosition instead of RenderLayer::scrollToPosition. >+ 4. Add AnimatedScroll parameter to ScrollView::setContentsScrollPosition, then the scroll animation >+ can be dealt in FrameView::setScrollPosition. >+ 5. In ScrollView::setScrollPosition, the scroll animation should be cancled before return. >+ >+ * dom/Element.cpp: Use AnimatedScroll instead of bool. >+ (WebCore::Element::scrollTo): >+ (WebCore::Element::setScrollLeft): >+ (WebCore::Element::setScrollTop): >+ * page/DOMWindow.cpp: >+ (WebCore::DOMWindow::scrollTo const): No need to call scrollToOffsetWithAnimation here. >+ * page/FrameView.cpp: >+ (WebCore::FrameView::setScrollPosition): >+ * page/FrameView.h: >+ * platform/ScrollTypes.h: Add AnimatedScroll. >+ * platform/ScrollView.cpp: >+ (WebCore::ScrollView::setContentsScrollPosition): Add parameter AnimatedScroll. >+ (WebCore::ScrollView::setScrollPosition): Cancel the scroll animation before return. >+ * platform/ScrollView.h: >+ * rendering/RenderBox.cpp: >+ (WebCore::RenderBox::setScrollLeft): >+ (WebCore::RenderBox::setScrollTop): >+ (WebCore::RenderBox::setScrollPosition): >+ * rendering/RenderBox.h: >+ * rendering/RenderLayer.cpp: >+ (WebCore::RenderLayer::scrollToXPosition): >+ (WebCore::RenderLayer::scrollToYPosition): >+ (WebCore::RenderLayer::setScrollPosition): >+ (WebCore::RenderLayer::scrollRectToVisible): Remove AutoscrollStatus. >+ (WebCore::RenderLayer::autoscroll): >+ (WebCore::RenderLayer::scrollToPosition): Deleted. Use setScrollPosition instead. >+ * rendering/RenderLayer.h: >+ * rendering/RenderListBox.cpp: >+ (WebCore::RenderListBox::setScrollLeft): >+ (WebCore::RenderListBox::setScrollTop): >+ * rendering/RenderListBox.h: >+ * rendering/RenderTextControlSingleLine.cpp: >+ (WebCore::RenderTextControlSingleLine::setScrollLeft): >+ (WebCore::RenderTextControlSingleLine::setScrollTop): >+ * rendering/RenderTextControlSingleLine.h: >+ > 2020-04-04 Peng Liu <peng.liu6@apple.com> > > REGRESSION (r259095): ASSERTION FAILED: m_videoFullscreenMode != VideoFullscreenModeNone seen with TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS >diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp >index c9dbd5e53a3e62214ad8e47e884cb607353583ff..d90213466cdedc18cbd10d7843f1d0914cf0c9f5 100644 >--- a/Source/WebCore/dom/Element.cpp >+++ b/Source/WebCore/dom/Element.cpp >@@ -950,7 +950,7 @@ void Element::scrollTo(const ScrollToOptions& options, ScrollClamping clamping) > clampToInteger(scrollToOptions.left.value() * renderer->style().effectiveZoom()), > clampToInteger(scrollToOptions.top.value() * renderer->style().effectiveZoom()) > ); >- bool animated = useSmoothScrolling(scrollToOptions.behavior.valueOr(ScrollBehavior::Auto), this); >+ AnimatedScroll animated = useSmoothScrolling(scrollToOptions.behavior.valueOr(ScrollBehavior::Auto), this) ? AnimatedScroll::Yes : AnimatedScroll::No; > renderer->setScrollPosition(scrollPosition, ScrollType::Programmatic, clamping, animated); > } > >@@ -1293,7 +1293,7 @@ void Element::setScrollLeft(int newLeft) > if (auto* frame = documentFrameWithNonNullView()) { > // FIXME: Should we use document()->scrollingElement()? > // See https://bugs.webkit.org/show_bug.cgi?id=205059 >- bool animated = useSmoothScrolling(ScrollBehavior::Auto, document().documentElement()); >+ AnimatedScroll animated = useSmoothScrolling(ScrollBehavior::Auto, document().documentElement()) ? AnimatedScroll::Yes : AnimatedScroll::No; > IntPoint position(static_cast<int>(newLeft * frame->pageZoomFactor() * frame->frameScaleFactor()), frame->view()->scrollY()); > frame->view()->setScrollPosition(position, ScrollClamping::Clamped, animated); > } >@@ -1302,7 +1302,7 @@ void Element::setScrollLeft(int newLeft) > > if (auto* renderer = renderBox()) { > int clampedLeft = clampToInteger(newLeft * renderer->style().effectiveZoom()); >- bool animated = useSmoothScrolling(ScrollBehavior::Auto, this); >+ AnimatedScroll animated = useSmoothScrolling(ScrollBehavior::Auto, this) ? AnimatedScroll::Yes : AnimatedScroll::No; > renderer->setScrollLeft(clampedLeft, ScrollType::Programmatic, ScrollClamping::Clamped, animated); > if (auto* scrollableArea = renderer->layer()) > scrollableArea->setScrollShouldClearLatchedState(true); >@@ -1317,7 +1317,7 @@ void Element::setScrollTop(int newTop) > if (auto* frame = documentFrameWithNonNullView()) { > // FIXME: Should we use document()->scrollingElement()? > // See https://bugs.webkit.org/show_bug.cgi?id=205059 >- bool animated = useSmoothScrolling(ScrollBehavior::Auto, document().documentElement()); >+ AnimatedScroll animated = useSmoothScrolling(ScrollBehavior::Auto, document().documentElement()) ? AnimatedScroll::Yes : AnimatedScroll::No; > IntPoint position(frame->view()->scrollX(), static_cast<int>(newTop * frame->pageZoomFactor() * frame->frameScaleFactor())); > frame->view()->setScrollPosition(position, ScrollClamping::Clamped, animated); > } >@@ -1326,7 +1326,7 @@ void Element::setScrollTop(int newTop) > > if (auto* renderer = renderBox()) { > int clampedTop = clampToInteger(newTop * renderer->style().effectiveZoom()); >- bool animated = useSmoothScrolling(ScrollBehavior::Auto, this); >+ AnimatedScroll animated = useSmoothScrolling(ScrollBehavior::Auto, this) ? AnimatedScroll::Yes : AnimatedScroll::No; > renderer->setScrollTop(clampedTop, ScrollType::Programmatic, ScrollClamping::Clamped, animated); > if (auto* scrollableArea = renderer->layer()) > scrollableArea->setScrollShouldClearLatchedState(true); >diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp >index a7b22a96290b7c72bc3104c891fae1a57b826a0b..09aab6b23d7d7e750ddae8f411d0feff85ca76e9 100644 >--- a/Source/WebCore/page/DOMWindow.cpp >+++ b/Source/WebCore/page/DOMWindow.cpp >@@ -1688,12 +1688,9 @@ void DOMWindow::scrollTo(const ScrollToOptions& options, ScrollClamping clamping > > // FIXME: Should we use document()->scrollingElement()? > // See https://bugs.webkit.org/show_bug.cgi?id=205059 >- if (useSmoothScrolling(scrollToOptions.behavior.valueOr(ScrollBehavior::Auto), document()->documentElement())) { >- view->scrollToOffsetWithAnimation(layoutPos, ScrollType::Programmatic, clamping); >- return; >- } >+ AnimatedScroll animated = useSmoothScrolling(scrollToOptions.behavior.valueOr(ScrollBehavior::Auto), document()->documentElement()) ? AnimatedScroll::Yes : AnimatedScroll::No; > >- view->setContentsScrollPosition(layoutPos, clamping); >+ view->setContentsScrollPosition(layoutPos, clamping, animated); > } > > bool DOMWindow::allowedToChangeWindowGeometry() const >diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp >index c68f5d38c6e51e048887094c57ebff07aaf01ceb..7441d0c402c3d378a93eee8e810d5fc53eda2465 100644 >--- a/Source/WebCore/page/FrameView.cpp >+++ b/Source/WebCore/page/FrameView.cpp >@@ -2275,7 +2275,7 @@ void FrameView::scrollElementToRect(const Element& element, const IntRect& rect) > setScrollPosition(IntPoint(bounds.x() - centeringOffsetX - rect.x(), bounds.y() - centeringOffsetY - rect.y())); > } > >-void FrameView::setScrollPosition(const ScrollPosition& scrollPosition, ScrollClamping clamping, bool animated) >+void FrameView::setScrollPosition(const ScrollPosition& scrollPosition, ScrollClamping clamping, AnimatedScroll animated) > { > LOG_WITH_STREAM(Scrolling, stream << "FrameView::setScrollPosition " << scrollPosition << " , clearing anchor"); > >@@ -2288,7 +2288,7 @@ void FrameView::setScrollPosition(const ScrollPosition& scrollPosition, ScrollCl > Page* page = frame().page(); > if (page && page->isMonitoringWheelEvents()) > scrollAnimator().setWheelEventTestMonitor(page->wheelEventTestMonitor()); >- if (animated) >+ if (animated == AnimatedScroll::Yes) > scrollToOffsetWithAnimation(scrollOffsetFromPosition(scrollPosition), currentScrollType(), clamping); > else > ScrollView::setScrollPosition(scrollPosition, clamping); >diff --git a/Source/WebCore/page/FrameView.h b/Source/WebCore/page/FrameView.h >index bb95785cc8127a37ff61506ff68162f48157ddf4..04ae59a610cb16c8409abc9d7eb4299c44dfc860 100644 >--- a/Source/WebCore/page/FrameView.h >+++ b/Source/WebCore/page/FrameView.h >@@ -229,7 +229,7 @@ public: > #if USE(COORDINATED_GRAPHICS) > WEBCORE_EXPORT void setFixedVisibleContentRect(const IntRect&) final; > #endif >- WEBCORE_EXPORT void setScrollPosition(const ScrollPosition&, ScrollClamping = ScrollClamping::Clamped, bool animated = false) final; >+ WEBCORE_EXPORT void setScrollPosition(const ScrollPosition&, ScrollClamping = ScrollClamping::Clamped, AnimatedScroll = AnimatedScroll::No) final; > void restoreScrollbar(); > void scheduleScrollToFocusedElement(SelectionRevealMode); > void scrollToFocusedElementImmediatelyIfNeeded(); >diff --git a/Source/WebCore/platform/ScrollTypes.h b/Source/WebCore/platform/ScrollTypes.h >index 5c52d5bbde28346fa7c73b89d04dc565116e3743..b975fb0430b8de7e959158926703b0f90286ab95 100644 >--- a/Source/WebCore/platform/ScrollTypes.h >+++ b/Source/WebCore/platform/ScrollTypes.h >@@ -60,6 +60,11 @@ enum class ScrollBehaviorStatus : uint8_t { > InNonNativeAnimation, > }; > >+enum class AnimatedScroll : uint8_t { >+ No, >+ Yes >+}; >+ > inline ScrollDirection logicalToPhysical(ScrollLogicalDirection direction, bool isVertical, bool isFlipped) > { > switch (direction) { >diff --git a/Source/WebCore/platform/ScrollView.cpp b/Source/WebCore/platform/ScrollView.cpp >index 2fd15f7b3017b1c7ee7a21c8618654b951109227..d81d2444c056f3adec229f8ce6aaaed108ce78ae 100644 >--- a/Source/WebCore/platform/ScrollView.cpp >+++ b/Source/WebCore/platform/ScrollView.cpp >@@ -206,13 +206,13 @@ IntPoint ScrollView::contentsScrollPosition() const > return scrollPosition(); > } > >-void ScrollView::setContentsScrollPosition(const IntPoint& position, ScrollClamping clamping) >+void ScrollView::setContentsScrollPosition(const IntPoint& position, ScrollClamping clamping, AnimatedScroll animated) > { > #if PLATFORM(IOS_FAMILY) > if (platformWidget()) > setActualScrollPosition(position); > #endif >- setScrollPosition(position, clamping); >+ setScrollPosition(position, clamping, animated); > } > > FloatRect ScrollView::exposedContentRect() const >@@ -513,7 +513,7 @@ void ScrollView::completeUpdatesAfterScrollTo(const IntSize& scrollDelta) > updateCompositingLayersAfterScrolling(); > } > >-void ScrollView::setScrollPosition(const ScrollPosition& scrollPosition, ScrollClamping clamping, bool/* animated*/) >+void ScrollView::setScrollPosition(const ScrollPosition& scrollPosition, ScrollClamping clamping, AnimatedScroll/* animated*/) > { > LOG_WITH_STREAM(Scrolling, stream << "ScrollView::setScrollPosition " << scrollPosition); > >@@ -525,14 +525,13 @@ void ScrollView::setScrollPosition(const ScrollPosition& scrollPosition, ScrollC > return; > } > >- ScrollPosition newScrollPosition = (!delegatesScrolling() && clamping == ScrollClamping::Clamped) ? adjustScrollPositionWithinRange(scrollPosition) : scrollPosition; >+ if (currentScrollBehaviorStatus() == ScrollBehaviorStatus::InNonNativeAnimation) >+ scrollAnimator().cancelAnimations(); > >+ ScrollPosition newScrollPosition = (!delegatesScrolling() && clamping == ScrollClamping::Clamped) ? adjustScrollPositionWithinRange(scrollPosition) : scrollPosition; > if ((!delegatesScrolling() || currentScrollType() == ScrollType::User) && currentScrollBehaviorStatus() == ScrollBehaviorStatus::NotInAnimation && newScrollPosition == this->scrollPosition()) > return; > >- if (currentScrollBehaviorStatus() == ScrollBehaviorStatus::InNonNativeAnimation) >- scrollAnimator().cancelAnimations(); >- > if (!requestScrollPositionUpdate(newScrollPosition, currentScrollType(), clamping)) > updateScrollbars(newScrollPosition); > >diff --git a/Source/WebCore/platform/ScrollView.h b/Source/WebCore/platform/ScrollView.h >index b64aa3ba066c9cdad90a1fcba1a154b2030bb51e..060424c92181454ef13762db12dbe2d2a21fe513 100644 >--- a/Source/WebCore/platform/ScrollView.h >+++ b/Source/WebCore/platform/ScrollView.h >@@ -231,7 +231,7 @@ public: > > // Scroll position used by web-exposed features (has legacy iOS behavior). > WEBCORE_EXPORT IntPoint contentsScrollPosition() const; >- void setContentsScrollPosition(const IntPoint&, ScrollClamping = ScrollClamping::Clamped); >+ void setContentsScrollPosition(const IntPoint&, ScrollClamping = ScrollClamping::Clamped, AnimatedScroll = AnimatedScroll::No); > > #if PLATFORM(IOS_FAMILY) > int actualScrollX() const { return unobscuredContentRect().x(); } >@@ -261,7 +261,7 @@ public: > ScrollPosition cachedScrollPosition() const { return m_cachedScrollPosition; } > > // Functions for scrolling the view. >- virtual void setScrollPosition(const ScrollPosition&, ScrollClamping = ScrollClamping::Clamped, bool animated = false); >+ virtual void setScrollPosition(const ScrollPosition&, ScrollClamping = ScrollClamping::Clamped, AnimatedScroll = AnimatedScroll::No); > > void scrollBy(const IntSize& s) { return setScrollPosition(scrollPosition() + s); } > >diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp >index 40ba1ae217602582478f265078aadf23597a7509..8b286425c0a396ea15832f297188cd4ef87dd40d 100644 >--- a/Source/WebCore/rendering/RenderBox.cpp >+++ b/Source/WebCore/rendering/RenderBox.cpp >@@ -581,7 +581,7 @@ static void setupWheelEventMonitor(RenderLayer& layer) > layer.scrollAnimator().setWheelEventTestMonitor(page.wheelEventTestMonitor()); > } > >-void RenderBox::setScrollLeft(int newLeft, ScrollType scrollType, ScrollClamping clamping, bool animated) >+void RenderBox::setScrollLeft(int newLeft, ScrollType scrollType, ScrollClamping clamping, AnimatedScroll animated) > { > if (!hasOverflowClip() || !layer()) > return; >@@ -589,7 +589,7 @@ void RenderBox::setScrollLeft(int newLeft, ScrollType scrollType, ScrollClamping > layer()->scrollToXPosition(newLeft, scrollType, clamping, animated); > } > >-void RenderBox::setScrollTop(int newTop, ScrollType scrollType, ScrollClamping clamping, bool animated) >+void RenderBox::setScrollTop(int newTop, ScrollType scrollType, ScrollClamping clamping, AnimatedScroll animated) > { > if (!hasOverflowClip() || !layer()) > return; >@@ -597,12 +597,12 @@ void RenderBox::setScrollTop(int newTop, ScrollType scrollType, ScrollClamping c > layer()->scrollToYPosition(newTop, scrollType, clamping, animated); > } > >-void RenderBox::setScrollPosition(const ScrollPosition& position, ScrollType scrollType, ScrollClamping clamping, bool animated) >+void RenderBox::setScrollPosition(const ScrollPosition& position, ScrollType scrollType, ScrollClamping clamping, AnimatedScroll animated) > { > if (!hasOverflowClip() || !layer()) > return; > setupWheelEventMonitor(*layer()); >- layer()->scrollToPosition(position, scrollType, clamping, animated); >+ layer()->setScrollPosition(position, scrollType, clamping, animated); > } > > void RenderBox::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const >diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h >index 275220b6be0ddd3b1568032b80731276b66b2fe0..814344f75a9d71a0de91a77a00fef96ebc68d8a8 100644 >--- a/Source/WebCore/rendering/RenderBox.h >+++ b/Source/WebCore/rendering/RenderBox.h >@@ -247,9 +247,9 @@ public: > virtual int scrollTop() const; > virtual int scrollWidth() const; > virtual int scrollHeight() const; >- virtual void setScrollLeft(int, ScrollType, ScrollClamping = ScrollClamping::Clamped, bool animated = false); >- virtual void setScrollTop(int, ScrollType, ScrollClamping = ScrollClamping::Clamped, bool animated = false); >- void setScrollPosition(const ScrollPosition&, ScrollType, ScrollClamping = ScrollClamping::Clamped, bool animated = false); >+ virtual void setScrollLeft(int, ScrollType, ScrollClamping = ScrollClamping::Clamped, AnimatedScroll = AnimatedScroll::No); >+ virtual void setScrollTop(int, ScrollType, ScrollClamping = ScrollClamping::Clamped, AnimatedScroll = AnimatedScroll::No); >+ void setScrollPosition(const ScrollPosition&, ScrollType, ScrollClamping = ScrollClamping::Clamped, AnimatedScroll = AnimatedScroll::No); > > LayoutUnit marginTop() const override { return m_marginBox.top(); } > LayoutUnit marginBottom() const override { return m_marginBox.bottom(); } >diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp >index 21f52b97d7fce467a74286d75c8d16be7272954c..be2317a78234cc262eb320051f70880eb38eeb90 100644 >--- a/Source/WebCore/rendering/RenderLayer.cpp >+++ b/Source/WebCore/rendering/RenderLayer.cpp >@@ -2621,21 +2621,21 @@ void RenderLayer::applyPostLayoutScrollPositionIfNeeded() > m_postLayoutScrollPosition = WTF::nullopt; > } > >-void RenderLayer::scrollToXPosition(int x, ScrollType scrollType, ScrollClamping clamping, bool animated) >+void RenderLayer::scrollToXPosition(int x, ScrollType scrollType, ScrollClamping clamping, AnimatedScroll animated) > { > ScrollPosition position(x, m_scrollPosition.y()); >- scrollToPosition(position, scrollType, clamping, animated); >+ setScrollPosition(position, scrollType, clamping, animated); > } > >-void RenderLayer::scrollToYPosition(int y, ScrollType scrollType, ScrollClamping clamping, bool animated) >+void RenderLayer::scrollToYPosition(int y, ScrollType scrollType, ScrollClamping clamping, AnimatedScroll animated) > { > ScrollPosition position(m_scrollPosition.x(), y); >- scrollToPosition(position, scrollType, clamping, animated); >+ setScrollPosition(position, scrollType, clamping, animated); > } > >-void RenderLayer::scrollToPosition(const ScrollPosition& position, ScrollType scrollType, ScrollClamping clamping, bool animated) >+void RenderLayer::setScrollPosition(const ScrollPosition& position, ScrollType scrollType, ScrollClamping clamping, AnimatedScroll animated) > { >- if (animated) >+ if (animated == AnimatedScroll::Yes) > scrollToOffsetWithAnimation(scrollOffsetFromPosition(position), scrollType, clamping); > else > scrollToOffset(scrollOffsetFromPosition(position), scrollType, clamping); >@@ -2836,13 +2836,14 @@ bool RenderLayer::allowsCurrentScroll() const > return box->hasHorizontalOverflow() || box->hasVerticalOverflow(); > } > >-void RenderLayer::scrollRectToVisible(const LayoutRect& absoluteRect, bool insideFixed, const ScrollRectToVisibleOptions& options, AutoscrollStatus autoscrollStatus) >+void RenderLayer::scrollRectToVisible(const LayoutRect& absoluteRect, bool insideFixed, const ScrollRectToVisibleOptions& options) > { > LOG_WITH_STREAM(Scrolling, stream << "Layer " << this << " scrollRectToVisible " << absoluteRect); > > LayoutRect newRect = absoluteRect; > FrameView& frameView = renderer().view().frameView(); > auto* parentLayer = enclosingContainingBlockLayer(*this, CrossFrameBoundaries::No); >+ bool autoscrollNotInProgress = !renderer().frame().eventHandler().autoscrollInProgress(); > > if (allowsCurrentScroll()) { > // Don't scroll to reveal an overflow layer that is restricted by the -webkit-line-clamp property. >@@ -2861,8 +2862,10 @@ void RenderLayer::scrollRectToVisible(const LayoutRect& absoluteRect, bool insid > ScrollOffset clampedScrollOffset = clampScrollOffset(scrollOffset() + toIntSize(roundedIntRect(revealRect).location())); > if (clampedScrollOffset != scrollOffset() || currentScrollBehaviorStatus() != ScrollBehaviorStatus::NotInAnimation) { > ScrollOffset oldScrollOffset = scrollOffset(); >- bool animated = autoscrollStatus == AutoscrollStatus::NotInProgress && useSmoothScrolling(options.behavior, box->element()); >- scrollToPosition(scrollPositionFromOffset(clampedScrollOffset), ScrollType::Programmatic, ScrollClamping::Clamped, animated); >+ AnimatedScroll animated = AnimatedScroll::No; >+ if (autoscrollNotInProgress && useSmoothScrolling(options.behavior, box->element())) >+ animated = AnimatedScroll::Yes; >+ setScrollPosition(scrollPositionFromOffset(clampedScrollOffset), ScrollType::Programmatic, ScrollClamping::Clamped, animated); > IntSize scrollOffsetDifference = clampedScrollOffset - oldScrollOffset; > localExposeRect.move(-scrollOffsetDifference); > newRect = LayoutRect(box->localToAbsoluteQuad(FloatQuad(FloatRect(localExposeRect)), UseTransforms).boundingBox()); >@@ -2888,7 +2891,11 @@ void RenderLayer::scrollRectToVisible(const LayoutRect& absoluteRect, bool insid > scrollPosition = scrollPosition.constrainedBetween(IntPoint(), IntPoint(frameView.contentsSize())); > // FIXME: Should we use contentDocument()->scrollingElement()? > // See https://bugs.webkit.org/show_bug.cgi?id=205059 >- bool animated = autoscrollStatus == AutoscrollStatus::NotInProgress && ownerElement->contentDocument() && useSmoothScrolling(options.behavior, ownerElement->contentDocument()->documentElement()); >+ AnimatedScroll animated = AnimatedScroll::No; >+ if (autoscrollNotInProgress >+ && ownerElement->contentDocument() >+ && useSmoothScrolling(options.behavior, ownerElement->contentDocument()->documentElement())) >+ animated = AnimatedScroll::Yes; > frameView.setScrollPosition(scrollPosition, ScrollClamping::Clamped, animated); > > if (options.shouldAllowCrossOriginScrolling == ShouldAllowCrossOriginScrolling::Yes || frameView.safeToPropagateScrollToParent()) { >@@ -2931,7 +2938,9 @@ void RenderLayer::scrollRectToVisible(const LayoutRect& absoluteRect, bool insid > ScrollOffset clampedScrollPosition = roundedIntPoint(revealRect.location()).constrainedBetween(minScrollPosition, maxScrollPosition); > // FIXME: Should we use document()->scrollingElement()? > // See https://bugs.webkit.org/show_bug.cgi?id=205059 >- bool animated = autoscrollStatus == AutoscrollStatus::NotInProgress && useSmoothScrolling(options.behavior, renderer().document().documentElement()); >+ AnimatedScroll animated = AnimatedScroll::No; >+ if (autoscrollNotInProgress && useSmoothScrolling(options.behavior, renderer().document().documentElement())) >+ animated = AnimatedScroll::Yes; > frameView.setScrollPosition(clampedScrollPosition, ScrollClamping::Clamped, animated); > } > >@@ -3071,7 +3080,7 @@ LayoutRect RenderLayer::getRectToExpose(const LayoutRect& visibleRect, const Lay > void RenderLayer::autoscroll(const IntPoint& positionInWindow) > { > IntPoint currentDocumentPosition = renderer().view().frameView().windowToContents(positionInWindow); >- scrollRectToVisible(LayoutRect(currentDocumentPosition, LayoutSize(1, 1)), false, { SelectionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::Yes }, AutoscrollStatus::InProgress); >+ scrollRectToVisible(LayoutRect(currentDocumentPosition, LayoutSize(1, 1)), false, { SelectionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::Yes }); > } > > bool RenderLayer::canResize() const >diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h >index d11393e07debaacb85ba312492fcb04dcde57fc1..d708d26ed18609afe793d2c93d6628d2d91bd8bc 100644 >--- a/Source/WebCore/rendering/RenderLayer.h >+++ b/Source/WebCore/rendering/RenderLayer.h >@@ -450,9 +450,9 @@ public: > WEBCORE_EXPORT void scrollToOffset(const ScrollOffset&, ScrollType = ScrollType::Programmatic, ScrollClamping = ScrollClamping::Clamped); > WEBCORE_EXPORT void scrollToOffsetWithAnimation(const ScrollOffset&, ScrollType = ScrollType::Programmatic, ScrollClamping = ScrollClamping::Clamped); > >- void scrollToXPosition(int x, ScrollType, ScrollClamping = ScrollClamping::Clamped, bool animated = false); >- void scrollToYPosition(int y, ScrollType, ScrollClamping = ScrollClamping::Clamped, bool animated = false); >- void scrollToPosition(const ScrollPosition&, ScrollType, ScrollClamping = ScrollClamping::Clamped, bool animated = false); >+ void scrollToXPosition(int x, ScrollType, ScrollClamping = ScrollClamping::Clamped, AnimatedScroll = AnimatedScroll::No); >+ void scrollToYPosition(int y, ScrollType, ScrollClamping = ScrollClamping::Clamped, AnimatedScroll = AnimatedScroll::No); >+ void setScrollPosition(const ScrollPosition&, ScrollType, ScrollClamping = ScrollClamping::Clamped, AnimatedScroll = AnimatedScroll::No); > > // These are only used by marquee. > void scrollToXOffset(int x) { scrollToOffset(ScrollOffset(x, scrollOffset().y()), ScrollType::Programmatic, ScrollClamping::Unclamped); } >@@ -466,9 +466,8 @@ public: > > void availableContentSizeChanged(AvailableSizeChangeReason) final; > >- enum AutoscrollStatus { NotInProgress, InProgress }; > // "absoluteRect" is in scaled document coordinates. >- void scrollRectToVisible(const LayoutRect& absoluteRect, bool insideFixed, const ScrollRectToVisibleOptions&, AutoscrollStatus = AutoscrollStatus::NotInProgress); >+ void scrollRectToVisible(const LayoutRect& absoluteRect, bool insideFixed, const ScrollRectToVisibleOptions&); > > bool scrollsOverflow() const; > bool hasScrollableHorizontalOverflow() const; >diff --git a/Source/WebCore/rendering/RenderListBox.cpp b/Source/WebCore/rendering/RenderListBox.cpp >index 778df3823c0ef020f8d322f25d3caa6ed98dc285..4adae22f343cb7c16e7192c26409b12194829588 100644 >--- a/Source/WebCore/rendering/RenderListBox.cpp >+++ b/Source/WebCore/rendering/RenderListBox.cpp >@@ -743,7 +743,7 @@ int RenderListBox::scrollLeft() const > return 0; > } > >-void RenderListBox::setScrollLeft(int, ScrollType, ScrollClamping, bool) >+void RenderListBox::setScrollLeft(int, ScrollType, ScrollClamping, AnimatedScroll) > { > } > >@@ -760,7 +760,7 @@ static void setupWheelEventTestMonitor(RenderListBox& renderer) > renderer.scrollAnimator().setWheelEventTestMonitor(renderer.page().wheelEventTestMonitor()); > } > >-void RenderListBox::setScrollTop(int newTop, ScrollType, ScrollClamping, bool) >+void RenderListBox::setScrollTop(int newTop, ScrollType, ScrollClamping, AnimatedScroll) > { > // Determine an index and scroll to it. > int index = newTop / itemHeight(); >diff --git a/Source/WebCore/rendering/RenderListBox.h b/Source/WebCore/rendering/RenderListBox.h >index f48580a4c75c5bc807e7e9747f2db1de87efcbc7..b4e26a9418a718f2ca8dd089de2b9db8e18a561c 100644 >--- a/Source/WebCore/rendering/RenderListBox.h >+++ b/Source/WebCore/rendering/RenderListBox.h >@@ -106,8 +106,8 @@ private: > int scrollTop() const override; > int scrollWidth() const override; > int scrollHeight() const override; >- void setScrollLeft(int, ScrollType, ScrollClamping, bool) override; >- void setScrollTop(int, ScrollType, ScrollClamping, bool) override; >+ void setScrollLeft(int, ScrollType, ScrollClamping, AnimatedScroll) override; >+ void setScrollTop(int, ScrollType, ScrollClamping, AnimatedScroll) override; > > bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override; > >diff --git a/Source/WebCore/rendering/RenderTextControlSingleLine.cpp b/Source/WebCore/rendering/RenderTextControlSingleLine.cpp >index 74a80b0687d9db88260bda06ffc65b7817f3dcff..1660217309543babb56ae68ee281a733fe9d75e6 100644 >--- a/Source/WebCore/rendering/RenderTextControlSingleLine.cpp >+++ b/Source/WebCore/rendering/RenderTextControlSingleLine.cpp >@@ -380,13 +380,13 @@ int RenderTextControlSingleLine::scrollTop() const > return RenderBlockFlow::scrollTop(); > } > >-void RenderTextControlSingleLine::setScrollLeft(int newLeft, ScrollType, ScrollClamping, bool) >+void RenderTextControlSingleLine::setScrollLeft(int newLeft, ScrollType, ScrollClamping, AnimatedScroll) > { > if (innerTextElement()) > innerTextElement()->setScrollLeft(newLeft); > } > >-void RenderTextControlSingleLine::setScrollTop(int newTop, ScrollType, ScrollClamping, bool) >+void RenderTextControlSingleLine::setScrollTop(int newTop, ScrollType, ScrollClamping, AnimatedScroll) > { > if (innerTextElement()) > innerTextElement()->setScrollTop(newTop); >diff --git a/Source/WebCore/rendering/RenderTextControlSingleLine.h b/Source/WebCore/rendering/RenderTextControlSingleLine.h >index fd633019ed0404bcb411eee67123f8de69c01855..25a2c96d50ae727b60153964899e3780c31c799b 100644 >--- a/Source/WebCore/rendering/RenderTextControlSingleLine.h >+++ b/Source/WebCore/rendering/RenderTextControlSingleLine.h >@@ -57,8 +57,8 @@ private: > int scrollTop() const override; > int scrollWidth() const override; > int scrollHeight() const override; >- void setScrollLeft(int, ScrollType, ScrollClamping, bool) override; >- void setScrollTop(int, ScrollType, ScrollClamping, bool) override; >+ void setScrollLeft(int, ScrollType, ScrollClamping, AnimatedScroll) override; >+ void setScrollTop(int, ScrollType, ScrollClamping, AnimatedScroll) override; > bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) final; > bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0) final; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 210171
:
395766
|
396045