Title: [283698] trunk/Source/WebCore
Revision
283698
Author
[email protected]
Date
2021-10-06 20:54:03 -0700 (Wed, 06 Oct 2021)

Log Message

Rename the AnimatedScroll enum to ScrollIsAnimated for consistency
https://bugs.webkit.org/show_bug.cgi?id=231336

Reviewed by Wenson Hsieh.

All the other scroll-related enums start with "Scroll" so rename AnimatedScroll to
ScrollIsAnimated to match, and ScrollIsAnimated::Yes and ScrollIsAnimated::No become more
readable.

* dom/Element.cpp:
(WebCore::Element::scrollTo):
(WebCore::Element::setScrollLeft):
(WebCore::Element::setScrollTop):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::scrollTo const):
* page/FrameView.cpp:
(WebCore::FrameView::setScrollPosition):
* platform/ScrollTypes.h:
(WebCore::ScrollPositionChangeOptions::createProgrammaticWithOptions):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::scrollToOffset):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (283697 => 283698)


--- trunk/Source/WebCore/ChangeLog	2021-10-07 02:22:48 UTC (rev 283697)
+++ trunk/Source/WebCore/ChangeLog	2021-10-07 03:54:03 UTC (rev 283698)
@@ -1,3 +1,29 @@
+2021-10-06  Simon Fraser  <[email protected]>
+
+        Rename the AnimatedScroll enum to ScrollIsAnimated for consistency
+        https://bugs.webkit.org/show_bug.cgi?id=231336
+
+        Reviewed by Wenson Hsieh.
+
+        All the other scroll-related enums start with "Scroll" so rename AnimatedScroll to
+        ScrollIsAnimated to match, and ScrollIsAnimated::Yes and ScrollIsAnimated::No become more
+        readable.
+
+        * dom/Element.cpp:
+        (WebCore::Element::scrollTo):
+        (WebCore::Element::setScrollLeft):
+        (WebCore::Element::setScrollTop):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::scrollTo const):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::setScrollPosition):
+        * platform/ScrollTypes.h:
+        (WebCore::ScrollPositionChangeOptions::createProgrammaticWithOptions):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::scrollRectToVisible):
+        * rendering/RenderLayerScrollableArea.cpp:
+        (WebCore::RenderLayerScrollableArea::scrollToOffset):
+
 2021-10-06  Wenson Hsieh  <[email protected]>
 
         Delete WebCore::DisplayList::SetInlineFillGradient

Modified: trunk/Source/WebCore/dom/Element.cpp (283697 => 283698)


--- trunk/Source/WebCore/dom/Element.cpp	2021-10-07 02:22:48 UTC (rev 283697)
+++ trunk/Source/WebCore/dom/Element.cpp	2021-10-07 03:54:03 UTC (rev 283698)
@@ -1036,7 +1036,7 @@
         clampToInteger(scrollToOptions.top.value() * renderer->style().effectiveZoom())
     );
 
-    auto animated = useSmoothScrolling(scrollToOptions.behavior.value_or(ScrollBehavior::Auto), this) ? AnimatedScroll::Yes : AnimatedScroll::No;
+    auto animated = useSmoothScrolling(scrollToOptions.behavior.value_or(ScrollBehavior::Auto), this) ? ScrollIsAnimated::Yes : ScrollIsAnimated::No;
     auto scrollPositionChangeOptions = ScrollPositionChangeOptions::createProgrammaticWithOptions(clamping, animated, snapPointSelectionMethod);
     renderer->setScrollPosition(scrollPosition, scrollPositionChangeOptions);
 }
@@ -1365,7 +1365,7 @@
     document().updateLayoutIgnorePendingStylesheets();
 
     auto options = ScrollPositionChangeOptions::createProgrammatic();
-    options.animated = useSmoothScrolling(ScrollBehavior::Auto, this) ? AnimatedScroll::Yes : AnimatedScroll::No;
+    options.animated = useSmoothScrolling(ScrollBehavior::Auto, this) ? ScrollIsAnimated::Yes : ScrollIsAnimated::No;
 
     if (document().scrollingElement() == this) {
         if (auto* frame = documentFrameWithNonNullView()) {
@@ -1388,7 +1388,7 @@
     document().updateLayoutIgnorePendingStylesheets();
 
     auto options = ScrollPositionChangeOptions::createProgrammatic();
-    options.animated = useSmoothScrolling(ScrollBehavior::Auto, this) ? AnimatedScroll::Yes : AnimatedScroll::No;
+    options.animated = useSmoothScrolling(ScrollBehavior::Auto, this) ? ScrollIsAnimated::Yes : ScrollIsAnimated::No;
 
     if (document().scrollingElement() == this) {
         if (auto* frame = documentFrameWithNonNullView()) {

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (283697 => 283698)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2021-10-07 02:22:48 UTC (rev 283697)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2021-10-07 03:54:03 UTC (rev 283698)
@@ -1721,7 +1721,7 @@
 
     // FIXME: Should we use document()->scrollingElement()?
     // See https://bugs.webkit.org/show_bug.cgi?id=205059
-    auto animated = useSmoothScrolling(scrollToOptions.behavior.value_or(ScrollBehavior::Auto), document()->documentElement()) ? AnimatedScroll::Yes : AnimatedScroll::No;
+    auto animated = useSmoothScrolling(scrollToOptions.behavior.value_or(ScrollBehavior::Auto), document()->documentElement()) ? ScrollIsAnimated::Yes : ScrollIsAnimated::No;
     auto scrollPositionChangeOptions = ScrollPositionChangeOptions::createProgrammaticWithOptions(clamping, animated, snapPointSelectionMethod);
     view->setContentsScrollPosition(layoutPos, scrollPositionChangeOptions);
 }

Modified: trunk/Source/WebCore/page/FrameView.cpp (283697 => 283698)


--- trunk/Source/WebCore/page/FrameView.cpp	2021-10-07 02:22:48 UTC (rev 283697)
+++ trunk/Source/WebCore/page/FrameView.cpp	2021-10-07 03:54:03 UTC (rev 283698)
@@ -2321,7 +2321,7 @@
     ScrollOffset snappedOffset = ceiledIntPoint(scrollAnimator().scrollOffsetAdjustedForSnapping(scrollOffsetFromPosition(scrollPosition), options.snapPointSelectionMethod));
     auto snappedPosition = scrollPositionFromOffset(snappedOffset);
 
-    if (options.animated == AnimatedScroll::Yes)
+    if (options.animated == ScrollIsAnimated::Yes)
         scrollToPositionWithAnimation(snappedPosition, currentScrollType(), options.clamping);
     else
         ScrollView::setScrollPosition(snappedPosition, options);

Modified: trunk/Source/WebCore/platform/ScrollTypes.h (283697 => 283698)


--- trunk/Source/WebCore/platform/ScrollTypes.h	2021-10-07 02:22:48 UTC (rev 283697)
+++ trunk/Source/WebCore/platform/ScrollTypes.h	2021-10-07 03:54:03 UTC (rev 283698)
@@ -74,7 +74,7 @@
     InNonNativeAnimation,
 };
 
-enum class AnimatedScroll : uint8_t {
+enum class ScrollIsAnimated : uint8_t {
     No,
     Yes
 };
@@ -279,7 +279,7 @@
 struct ScrollPositionChangeOptions {
     ScrollType type;
     ScrollClamping clamping = ScrollClamping::Clamped;
-    AnimatedScroll animated = AnimatedScroll::No;
+    ScrollIsAnimated animated = ScrollIsAnimated::No;
     ScrollSnapPointSelectionMethod snapPointSelectionMethod = ScrollSnapPointSelectionMethod::Closest;
 
     static ScrollPositionChangeOptions createProgrammatic()
@@ -287,7 +287,7 @@
         return { ScrollType::Programmatic };
     }
 
-    static ScrollPositionChangeOptions createProgrammaticWithOptions(ScrollClamping clamping, AnimatedScroll animated, ScrollSnapPointSelectionMethod snapPointSelectionMethod)
+    static ScrollPositionChangeOptions createProgrammaticWithOptions(ScrollClamping clamping, ScrollIsAnimated animated, ScrollSnapPointSelectionMethod snapPointSelectionMethod)
     {
         return { ScrollType::Programmatic, clamping, animated, snapPointSelectionMethod };
     }

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (283697 => 283698)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2021-10-07 02:22:48 UTC (rev 283697)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2021-10-07 03:54:03 UTC (rev 283698)
@@ -2444,7 +2444,7 @@
     {
         auto scrollPositionOptions = ScrollPositionChangeOptions::createProgrammatic();
         if (!renderer().frame().eventHandler().autoscrollInProgress() && element && useSmoothScrolling(options.behavior, element))
-            scrollPositionOptions.animated = AnimatedScroll::Yes;
+            scrollPositionOptions.animated = ScrollIsAnimated::Yes;
         return scrollPositionOptions;
     };
 

Modified: trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp (283697 => 283698)


--- trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp	2021-10-07 02:22:48 UTC (rev 283697)
+++ trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp	2021-10-07 03:54:03 UTC (rev 283698)
@@ -268,7 +268,7 @@
 
     ScrollOffset snappedOffset = ceiledIntPoint(scrollAnimator().scrollOffsetAdjustedForSnapping(clampedScrollOffset, options.snapPointSelectionMethod));
     auto snappedPosition = scrollPositionFromOffset(snappedOffset);
-    if (options.animated == AnimatedScroll::Yes)
+    if (options.animated == ScrollIsAnimated::Yes)
         ScrollableArea::scrollToPositionWithAnimation(snappedPosition);
     else {
         if (!requestScrollPositionUpdate(snappedPosition, options.type, options.clamping))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to