Title: [285640] trunk/Source
Revision
285640
Author
[email protected]
Date
2021-11-11 10:31:29 -0800 (Thu, 11 Nov 2021)

Log Message

Make scroll granularity an enum class
https://bugs.webkit.org/show_bug.cgi?id=232641

Reviewed by Cameron McCormack.

Source/WebCore:

* dom/Element.cpp:
(WebCore::Element::scrollByLines):
(WebCore::Element::scrollByPages):
* editing/EditorCommand.cpp:
(WebCore::executeScrollPageBackward):
(WebCore::executeScrollPageForward):
(WebCore::executeScrollLineUp):
(WebCore::executeScrollLineDown):
(WebCore::executeScrollToBeginningOfDocument):
(WebCore::executeScrollToEndOfDocument):
* page/EventHandler.cpp:
(WebCore::wheelGranularityToScrollGranularity):
(WebCore::EventHandler::logicalScrollRecursively):
(WebCore::EventHandler::defaultSpaceEventHandler):
(WebCore::EventHandler::scrollDistance):
* page/FrameView.cpp:
(WebCore::FrameView::adjustScrollStepForFixedContent):
* platform/KeyboardScrollingAnimator.cpp:
(WebCore::KeyboardScrollingAnimator::scrollDistance const):
(WebCore::KeyboardScrollingAnimator::keyboardScrollForKeyboardEvent const):
(WebCore::KeyboardScrollingAnimator::beginKeyboardScrollGesture):
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::handleWheelEvent):
* platform/ScrollTypes.h:
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::scroll):
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::pressedPartScrollGranularity):
* platform/ios/ScrollAnimatorIOS.mm:
(WebCore::ScrollAnimatorIOS::handleTouchEvent):
* platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenuWin::wndProc):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::logicalScroll):

Source/WebKit:

* Scripts/webkit/messages.py:
(headers_for_type):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:inDirection:]):
* UIProcess/ios/WKKeyboardScrollingAnimator.mm:
(-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
(-[WKKeyboardScrollingAnimator beginWithEvent:]):
(-[WKKeyboardScrollViewAnimator distanceForIncrement:inDirection:]):
* UIProcess/win/WebPopupMenuProxyWin.cpp:
(WebKit::WebPopupMenuProxyWin::onMouseWheel):
* UIProcess/win/WebView.cpp:
(WebKit::WebView::onHorizontalScroll):
(WebKit::WebView::onVerticalScroll):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::scrollBy):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/gtk/WebPageGtk.cpp:
(WebKit::WebPage::performDefaultBehaviorForKeyEvent):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performNonEditingBehaviorForSelector):
* WebProcess/WebPage/win/WebPageWin.cpp:
(WebKit::WebPage::performDefaultBehaviorForKeyEvent):

Source/WebKitLegacy/mac:

* WebView/WebFrameView.mm:
(-[WebFrameView _scrollToBeginningOfDocument]):
(-[WebFrameView _scrollToEndOfDocument]):
(-[WebFrameView _pageVertically:]):
(-[WebFrameView _pageHorizontally:]):
(-[WebFrameView _scrollLineVertically:]):
(-[WebFrameView _scrollLineHorizontally:]):

Source/WebKitLegacy/win:

* WebView.cpp:
(WebView::verticalScroll):
(WebView::horizontalScroll):
(WebView::keyDown):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (285639 => 285640)


--- trunk/Source/WebCore/ChangeLog	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebCore/ChangeLog	2021-11-11 18:31:29 UTC (rev 285640)
@@ -1,3 +1,45 @@
+2021-11-11  Nikolaos Mouchtaris  <[email protected]>
+
+        Make scroll granularity an enum class
+        https://bugs.webkit.org/show_bug.cgi?id=232641
+
+        Reviewed by Cameron McCormack.
+
+        * dom/Element.cpp:
+        (WebCore::Element::scrollByLines):
+        (WebCore::Element::scrollByPages):
+        * editing/EditorCommand.cpp:
+        (WebCore::executeScrollPageBackward):
+        (WebCore::executeScrollPageForward):
+        (WebCore::executeScrollLineUp):
+        (WebCore::executeScrollLineDown):
+        (WebCore::executeScrollToBeginningOfDocument):
+        (WebCore::executeScrollToEndOfDocument):
+        * page/EventHandler.cpp:
+        (WebCore::wheelGranularityToScrollGranularity):
+        (WebCore::EventHandler::logicalScrollRecursively):
+        (WebCore::EventHandler::defaultSpaceEventHandler):
+        (WebCore::EventHandler::scrollDistance):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::adjustScrollStepForFixedContent):
+        * platform/KeyboardScrollingAnimator.cpp:
+        (WebCore::KeyboardScrollingAnimator::scrollDistance const):
+        (WebCore::KeyboardScrollingAnimator::keyboardScrollForKeyboardEvent const):
+        (WebCore::KeyboardScrollingAnimator::beginKeyboardScrollGesture):
+        * platform/ScrollAnimator.cpp:
+        (WebCore::ScrollAnimator::handleWheelEvent):
+        * platform/ScrollTypes.h:
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::scroll):
+        * platform/Scrollbar.cpp:
+        (WebCore::Scrollbar::pressedPartScrollGranularity):
+        * platform/ios/ScrollAnimatorIOS.mm:
+        (WebCore::ScrollAnimatorIOS::handleTouchEvent):
+        * platform/win/PopupMenuWin.cpp:
+        (WebCore::PopupMenuWin::wndProc):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::logicalScroll):
+
 2021-11-11  Alexey Shvayka  <[email protected]>
 
         JSCallbackData should use lexical global object for errors and lifecycle

Modified: trunk/Source/WebCore/dom/Element.cpp (285639 => 285640)


--- trunk/Source/WebCore/dom/Element.cpp	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebCore/dom/Element.cpp	2021-11-11 18:31:29 UTC (rev 285640)
@@ -1128,12 +1128,12 @@
 
 void Element::scrollByLines(int lines)
 {
-    scrollByUnits(lines, ScrollByLine);
+    scrollByUnits(lines, ScrollGranularity::Line);
 }
 
 void Element::scrollByPages(int pages)
 {
-    scrollByUnits(pages, ScrollByPage);
+    scrollByUnits(pages, ScrollGranularity::Page);
 }
 
 static double localZoomForRenderer(const RenderElement& renderer)

Modified: trunk/Source/WebCore/editing/EditorCommand.cpp (285639 => 285640)


--- trunk/Source/WebCore/editing/EditorCommand.cpp	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebCore/editing/EditorCommand.cpp	2021-11-11 18:31:29 UTC (rev 285640)
@@ -989,32 +989,32 @@
 
 static bool executeScrollPageBackward(Frame& frame, Event*, EditorCommandSource, const String&)
 {
-    return frame.eventHandler().logicalScrollRecursively(ScrollBlockDirectionBackward, ScrollByPage);
+    return frame.eventHandler().logicalScrollRecursively(ScrollBlockDirectionBackward, ScrollGranularity::Page);
 }
 
 static bool executeScrollPageForward(Frame& frame, Event*, EditorCommandSource, const String&)
 {
-    return frame.eventHandler().logicalScrollRecursively(ScrollBlockDirectionForward, ScrollByPage);
+    return frame.eventHandler().logicalScrollRecursively(ScrollBlockDirectionForward, ScrollGranularity::Page);
 }
 
 static bool executeScrollLineUp(Frame& frame, Event*, EditorCommandSource, const String&)
 {
-    return frame.eventHandler().scrollRecursively(ScrollUp, ScrollByLine);
+    return frame.eventHandler().scrollRecursively(ScrollUp, ScrollGranularity::Line);
 }
 
 static bool executeScrollLineDown(Frame& frame, Event*, EditorCommandSource, const String&)
 {
-    return frame.eventHandler().scrollRecursively(ScrollDown, ScrollByLine);
+    return frame.eventHandler().scrollRecursively(ScrollDown, ScrollGranularity::Line);
 }
 
 static bool executeScrollToBeginningOfDocument(Frame& frame, Event*, EditorCommandSource, const String&)
 {
-    return frame.eventHandler().logicalScrollRecursively(ScrollBlockDirectionBackward, ScrollByDocument);
+    return frame.eventHandler().logicalScrollRecursively(ScrollBlockDirectionBackward, ScrollGranularity::Document);
 }
 
 static bool executeScrollToEndOfDocument(Frame& frame, Event*, EditorCommandSource, const String&)
 {
-    return frame.eventHandler().logicalScrollRecursively(ScrollBlockDirectionForward, ScrollByDocument);
+    return frame.eventHandler().logicalScrollRecursively(ScrollBlockDirectionForward, ScrollGranularity::Document);
 }
 
 static bool executeSelectAll(Frame& frame, Event*, EditorCommandSource, const String&)

Modified: trunk/Source/WebCore/page/EventHandler.cpp (285639 => 285640)


--- trunk/Source/WebCore/page/EventHandler.cpp	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2021-11-11 18:31:29 UTC (rev 285640)
@@ -298,13 +298,13 @@
 {
     switch (deltaMode) {
     case WheelEvent::DOM_DELTA_PAGE:
-        return ScrollByPage;
+        return ScrollGranularity::Page;
     case WheelEvent::DOM_DELTA_LINE:
-        return ScrollByLine;
+        return ScrollGranularity::Line;
     case WheelEvent::DOM_DELTA_PIXEL:
-        return ScrollByPixel;
+        return ScrollGranularity::Pixel;
     default:
-        return ScrollByPixel;
+        return ScrollGranularity::Pixel;
     }
 }
 
@@ -1287,7 +1287,7 @@
     bool scrolled = false;
 #if PLATFORM(COCOA)
     // Mac also resets the scroll position in the inline direction.
-    if (granularity == ScrollByDocument && view && view->logicalScroll(ScrollInlineDirectionBackward, ScrollByDocument))
+    if (granularity == ScrollGranularity::Document && view && view->logicalScroll(ScrollInlineDirectionBackward, ScrollGranularity::Document))
         scrolled = true;
 #endif
     if (view && view->logicalScroll(direction, granularity))
@@ -4248,7 +4248,7 @@
         return;
 
     ScrollLogicalDirection direction = event.shiftKey() ? ScrollBlockDirectionBackward : ScrollBlockDirectionForward;
-    if (logicalScrollOverflow(direction, ScrollByPage)) {
+    if (logicalScrollOverflow(direction, ScrollGranularity::Page)) {
         event.setDefaultHandled();
         return;
     }
@@ -4257,7 +4257,7 @@
     if (!view)
         return;
 
-    bool defaultHandled = m_frame.settings().eventHandlerDrivenSmoothKeyboardScrollingEnabled() ? startKeyboardScrolling(event) : view->logicalScroll(direction, ScrollByPage);
+    bool defaultHandled = m_frame.settings().eventHandlerDrivenSmoothKeyboardScrollingEnabled() ? startKeyboardScrolling(event) : view->logicalScroll(direction, ScrollGranularity::Page);
     if (defaultHandled)
         event.setDefaultHandled();
 }
@@ -4299,13 +4299,13 @@
     }();
 
     switch (granularity) {
-    case ScrollGranularity::ScrollByLine:
+    case ScrollGranularity::Line:
         return scrollbar->lineStep();
-    case ScrollGranularity::ScrollByPage:
+    case ScrollGranularity::Page:
         return scrollbar->pageStep();
-    case ScrollGranularity::ScrollByDocument:
+    case ScrollGranularity::Document:
         return scrollbar->totalSize();
-    case ScrollGranularity::ScrollByPixel:
+    case ScrollGranularity::Pixel:
         return scrollbar->pixelStep();
     }
 

Modified: trunk/Source/WebCore/page/FrameView.cpp (285639 => 285640)


--- trunk/Source/WebCore/page/FrameView.cpp	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebCore/page/FrameView.cpp	2021-11-11 18:31:29 UTC (rev 285640)
@@ -3836,7 +3836,7 @@
 
 float FrameView::adjustScrollStepForFixedContent(float step, ScrollbarOrientation orientation, ScrollGranularity granularity)
 {
-    if (granularity != ScrollByPage || orientation == ScrollbarOrientation::Horizontal)
+    if (granularity != ScrollGranularity::Page || orientation == ScrollbarOrientation::Horizontal)
         return step;
 
     TrackedRendererListHashSet* positionedObjects = nullptr;

Modified: trunk/Source/WebCore/platform/KeyboardScrollingAnimator.cpp (285639 => 285640)


--- trunk/Source/WebCore/platform/KeyboardScrollingAnimator.cpp	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebCore/platform/KeyboardScrollingAnimator.cpp	2021-11-11 18:31:29 UTC (rev 285640)
@@ -155,13 +155,13 @@
 
     if (scrollbar) {
         switch (granularity) {
-        case ScrollGranularity::ScrollByLine:
+        case ScrollGranularity::Line:
             return scrollbar->lineStep();
-        case ScrollGranularity::ScrollByPage:
+        case ScrollGranularity::Page:
             return scrollbar->pageStep();
-        case ScrollGranularity::ScrollByDocument:
+        case ScrollGranularity::Document:
             return scrollbar->totalSize();
-        case ScrollGranularity::ScrollByPixel:
+        case ScrollGranularity::Pixel:
             return scrollbar->pixelStep();
         }
     }
@@ -202,18 +202,18 @@
         switch (key.value()) {
         case KeyboardScrollingKey::LeftArrow:
         case KeyboardScrollingKey::RightArrow:
-            return event.altKey() ? ScrollGranularity::ScrollByPage : ScrollGranularity::ScrollByLine;
+            return event.altKey() ? ScrollGranularity::Page : ScrollGranularity::Line;
         case KeyboardScrollingKey::UpArrow:
         case KeyboardScrollingKey::DownArrow:
             if (event.metaKey())
-                return ScrollGranularity::ScrollByDocument;
+                return ScrollGranularity::Document;
             if (event.altKey())
-                return ScrollGranularity::ScrollByPage;
-            return ScrollGranularity::ScrollByLine;
+                return ScrollGranularity::Page;
+            return ScrollGranularity::Line;
         case KeyboardScrollingKey::Space:
         case KeyboardScrollingKey::PageUp:
         case KeyboardScrollingKey::PageDown:
-            return ScrollGranularity::ScrollByPage;
+            return ScrollGranularity::Page;
         };
         RELEASE_ASSERT_NOT_REACHED();
     }();
@@ -267,7 +267,7 @@
     if (m_scrollTriggeringKeyIsPressed)
         return false;
 
-    if (m_currentKeyboardScroll->granularity == ScrollGranularity::ScrollByDocument) {
+    if (m_currentKeyboardScroll->granularity == ScrollGranularity::Document) {
         m_velocity = { };
         stopKeyboardScrollAnimation();
         auto newPosition = IntPoint(m_scrollAnimator.currentPosition() + m_currentKeyboardScroll->offset);

Modified: trunk/Source/WebCore/platform/ScrollAnimator.cpp (285639 => 285640)


--- trunk/Source/WebCore/platform/ScrollAnimator.cpp	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebCore/platform/ScrollAnimator.cpp	2021-11-11 18:31:29 UTC (rev 285640)
@@ -217,7 +217,7 @@
                 if (negative)
                     deltaY = -deltaY;
             }
-            scroll(ScrollbarOrientation::Vertical, ScrollByPixel, verticalScrollbar->pixelStep(), -deltaY, behavior);
+            scroll(ScrollbarOrientation::Vertical, ScrollGranularity::Pixel, verticalScrollbar->pixelStep(), -deltaY, behavior);
         }
 
         if (deltaX) {
@@ -227,7 +227,7 @@
                 if (negative)
                     deltaX = -deltaX;
             }
-            scroll(ScrollbarOrientation::Horizontal, ScrollByPixel, horizontalScrollbar->pixelStep(), -deltaX, behavior);
+            scroll(ScrollbarOrientation::Horizontal, ScrollGranularity::Pixel, horizontalScrollbar->pixelStep(), -deltaX, behavior);
         }
     }
     return handled;

Modified: trunk/Source/WebCore/platform/ScrollTypes.h (285639 => 285640)


--- trunk/Source/WebCore/platform/ScrollTypes.h	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebCore/platform/ScrollTypes.h	2021-11-11 18:31:29 UTC (rev 285640)
@@ -130,11 +130,11 @@
     return ScrollUp;
 }
 
-enum ScrollGranularity : uint8_t {
-    ScrollByLine,
-    ScrollByPage,
-    ScrollByDocument,
-    ScrollByPixel
+enum class ScrollGranularity : uint8_t {
+    Line,
+    Page,
+    Document,
+    Pixel
 };
 
 enum class ScrollElasticity : uint8_t {
@@ -330,4 +330,13 @@
     >;
 };
 
+template<> struct EnumTraits<WebCore::ScrollGranularity> {
+    using values = EnumValues<
+        WebCore::ScrollGranularity,
+        WebCore::ScrollGranularity::Line,
+        WebCore::ScrollGranularity::Page,
+        WebCore::ScrollGranularity::Document,
+        WebCore::ScrollGranularity::Pixel
+    >;
+};
 } // namespace WTF

Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (285639 => 285640)


--- trunk/Source/WebCore/platform/ScrollableArea.cpp	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp	2021-11-11 18:31:29 UTC (rev 285640)
@@ -113,16 +113,16 @@
 
     float step = 0;
     switch (granularity) {
-    case ScrollByLine:
+    case ScrollGranularity::Line:
         step = scrollbar->lineStep();
         break;
-    case ScrollByPage:
+    case ScrollGranularity::Page:
         step = scrollbar->pageStep();
         break;
-    case ScrollByDocument:
+    case ScrollGranularity::Document:
         step = scrollbar->totalSize();
         break;
-    case ScrollByPixel:
+    case ScrollGranularity::Pixel:
         step = scrollbar->pixelStep();
         break;
     }

Modified: trunk/Source/WebCore/platform/Scrollbar.cpp (285639 => 285640)


--- trunk/Source/WebCore/platform/Scrollbar.cpp	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebCore/platform/Scrollbar.cpp	2021-11-11 18:31:29 UTC (rev 285640)
@@ -234,8 +234,8 @@
 ScrollGranularity Scrollbar::pressedPartScrollGranularity()
 {
     if (m_pressedPart == BackButtonStartPart || m_pressedPart == BackButtonEndPart ||  m_pressedPart == ForwardButtonStartPart || m_pressedPart == ForwardButtonEndPart)
-        return ScrollByLine;
-    return ScrollByPage;
+        return ScrollGranularity::Line;
+    return ScrollGranularity::Page;
 }
 
 void Scrollbar::moveThumb(int pos, bool draggingDocument)

Modified: trunk/Source/WebCore/platform/ios/ScrollAnimatorIOS.mm (285639 => 285640)


--- trunk/Source/WebCore/platform/ios/ScrollAnimatorIOS.mm	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebCore/platform/ios/ScrollAnimatorIOS.mm	2021-11-11 18:31:29 UTC (rev 285640)
@@ -139,13 +139,13 @@
     // Horizontal
     if (m_touchScrollAxisLatch != AxisLatchVertical) {
         int delta = touchDelta.width();
-        handled |= m_scrollableAreaForTouchSequence->scroll(delta < 0 ? ScrollLeft : ScrollRight, ScrollByPixel, abs(delta));
+        handled |= m_scrollableAreaForTouchSequence->scroll(delta < 0 ? ScrollLeft : ScrollRight, ScrollGranularity::Pixel, abs(delta));
     }
     
     // Vertical
     if (m_touchScrollAxisLatch != AxisLatchHorizontal) {
         int delta = touchDelta.height();
-        handled |= m_scrollableAreaForTouchSequence->scroll(delta < 0 ? ScrollUp : ScrollDown, ScrollByPixel, abs(delta));
+        handled |= m_scrollableAreaForTouchSequence->scroll(delta < 0 ? ScrollUp : ScrollDown, ScrollGranularity::Pixel, abs(delta));
     }
     
     // Return false until we manage to scroll at all, and then keep returning true until the gesture ends.

Modified: trunk/Source/WebCore/platform/win/PopupMenuWin.cpp (285639 => 285640)


--- trunk/Source/WebCore/platform/win/PopupMenuWin.cpp	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebCore/platform/win/PopupMenuWin.cpp	2021-11-11 18:31:29 UTC (rev 285640)
@@ -1060,7 +1060,7 @@
                     --i;
             }
 
-            ScrollableArea::scroll(i > 0 ? ScrollUp : ScrollDown, ScrollByLine, abs(i));
+            ScrollableArea::scroll(i > 0 ? ScrollUp : ScrollDown, ScrollGranularity::Line, abs(i));
             break;
         }
 

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (285639 => 285640)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2021-11-11 18:31:29 UTC (rev 285640)
@@ -929,8 +929,8 @@
     if (auto* scrollableArea = layer() ? layer()->scrollableArea() : nullptr) {
 #if PLATFORM(COCOA)
         // On Mac only we reset the inline direction position when doing a document scroll (e.g., hitting Home/End).
-        if (granularity == ScrollByDocument)
-            scrolled = scrollableArea->scroll(logicalToPhysical(ScrollInlineDirectionBackward, isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), ScrollByDocument, multiplier);
+        if (granularity == ScrollGranularity::Document)
+            scrolled = scrollableArea->scroll(logicalToPhysical(ScrollInlineDirectionBackward, isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), ScrollGranularity::Document, multiplier);
 #endif
         if (scrollableArea->scroll(logicalToPhysical(direction, isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), granularity, multiplier))
             scrolled = true;

Modified: trunk/Source/WebKit/ChangeLog (285639 => 285640)


--- trunk/Source/WebKit/ChangeLog	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebKit/ChangeLog	2021-11-11 18:31:29 UTC (rev 285640)
@@ -1,3 +1,34 @@
+2021-11-11  Nikolaos Mouchtaris  <[email protected]>
+
+        Make scroll granularity an enum class
+        https://bugs.webkit.org/show_bug.cgi?id=232641
+
+        Reviewed by Cameron McCormack.
+
+        * Scripts/webkit/messages.py:
+        (headers_for_type):
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:inDirection:]):
+        * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
+        (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
+        (-[WKKeyboardScrollingAnimator beginWithEvent:]):
+        (-[WKKeyboardScrollViewAnimator distanceForIncrement:inDirection:]):
+        * UIProcess/win/WebPopupMenuProxyWin.cpp:
+        (WebKit::WebPopupMenuProxyWin::onMouseWheel):
+        * UIProcess/win/WebView.cpp:
+        (WebKit::WebView::onHorizontalScroll):
+        (WebKit::WebView::onVerticalScroll):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::scrollBy):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/gtk/WebPageGtk.cpp:
+        (WebKit::WebPage::performDefaultBehaviorForKeyEvent):
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::performNonEditingBehaviorForSelector):
+        * WebProcess/WebPage/win/WebPageWin.cpp:
+        (WebKit::WebPage::performDefaultBehaviorForKeyEvent):
+
 2021-11-11  Carlos Garcia Campos  <[email protected]>
 
         Drop support for <object usemap> making <object> interactive

Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (285639 => 285640)


--- trunk/Source/WebKit/Scripts/webkit/messages.py	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py	2021-11-11 18:31:29 UTC (rev 285640)
@@ -763,6 +763,7 @@
         'WebCore::RouteSharingPolicy': ['<WebCore/AudioSession.h>'],
         'WebCore::SWServerConnectionIdentifier': ['<WebCore/ServiceWorkerTypes.h>'],
         'WebCore::SameSiteStrictEnforcementEnabled': ['<WebCore/NetworkStorageSession.h>'],
+        'WebCore::ScrollGranularity': ['<WebCore/ScrollTypes.h>'],
         'WebCore::SecurityPolicyViolationEventInit': ['<WebCore/SecurityPolicyViolationEvent.h>'],
         'WebCore::SelectionDirection': ['<WebCore/VisibleSelection.h>'],
         'WebCore::SelectionGeometry': ['"EditorState.h"'],

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (285639 => 285640)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-11-11 18:31:29 UTC (rev 285640)
@@ -5932,17 +5932,17 @@
     BOOL directionIsHorizontal = direction == WebCore::ScrollDirection::ScrollLeft || direction == WebCore::ScrollDirection::ScrollRight;
 
     switch (increment) {
-    case WebCore::ScrollGranularity::ScrollByDocument: {
+    case WebCore::ScrollGranularity::Document: {
         CGSize documentSize = [self convertRect:self.bounds toView:self.webView].size;
         return directionIsHorizontal ? documentSize.width : documentSize.height;
     }
-    case WebCore::ScrollGranularity::ScrollByPage: {
+    case WebCore::ScrollGranularity::Page: {
         CGSize pageSize = [self convertSize:CGSizeMake(0, WebCore::Scrollbar::pageStep(_page->unobscuredContentRect().height(), self.bounds.size.height)) toView:self.webView];
         return directionIsHorizontal ? pageSize.width : pageSize.height;
     }
-    case WebCore::ScrollGranularity::ScrollByLine:
+    case WebCore::ScrollGranularity::Line:
         return [self convertSize:CGSizeMake(0, WebCore::Scrollbar::pixelsPerLineStep()) toView:self.webView].height;
-    case WebCore::ScrollGranularity::ScrollByPixel:
+    case WebCore::ScrollGranularity::Pixel:
         return 0;
     }
     ASSERT_NOT_REACHED();

Modified: trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm (285639 => 285640)


--- trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm	2021-11-11 18:31:29 UTC (rev 285640)
@@ -219,22 +219,22 @@
         case Key::LeftArrow:
         case Key::RightArrow:
             if (altPressed)
-                return WebCore::ScrollGranularity::ScrollByPage;
-            return WebCore::ScrollGranularity::ScrollByLine;
+                return WebCore::ScrollGranularity::Page;
+            return WebCore::ScrollGranularity::Line;
         case Key::UpArrow:
         case Key::DownArrow:
             if (altPressed)
-                return WebCore::ScrollGranularity::ScrollByPage;
+                return WebCore::ScrollGranularity::Page;
             if (cmdPressed)
-                return WebCore::ScrollGranularity::ScrollByDocument;
-            return WebCore::ScrollGranularity::ScrollByLine;
+                return WebCore::ScrollGranularity::Document;
+            return WebCore::ScrollGranularity::Line;
         case Key::PageUp:
         case Key::PageDown:
         case Key::Space:
-            return WebCore::ScrollGranularity::ScrollByPage;
+            return WebCore::ScrollGranularity::Page;
         case Key::Other:
             ASSERT_NOT_REACHED();
-            return WebCore::ScrollGranularity::ScrollByLine;
+            return WebCore::ScrollGranularity::Line;
         };
     }();
 
@@ -293,7 +293,7 @@
     _scrollTriggeringKeyIsPressed = YES;
     _currentScroll = scroll;
 
-    if (scroll->granularity == WebCore::ScrollGranularity::ScrollByDocument) {
+    if (scroll->granularity == WebCore::ScrollGranularity::Document) {
         _velocity = { };
         [self stopAnimatedScroll];
         [self stopDisplayLink];
@@ -545,13 +545,13 @@
 
     if (!_delegateRespondsToDistanceForIncrement) {
         switch (increment) {
-        case WebCore::ScrollGranularity::ScrollByDocument:
+        case WebCore::ScrollGranularity::Document:
             return directionIsHorizontal ? scrollView.contentSize.width : scrollView.contentSize.height;
-        case WebCore::ScrollGranularity::ScrollByPage:
+        case WebCore::ScrollGranularity::Page:
             return (directionIsHorizontal ? scrollView.frame.size.width : scrollView.frame.size.height) * defaultPageScrollFraction;
-        case WebCore::ScrollGranularity::ScrollByLine:
+        case WebCore::ScrollGranularity::Line:
             return defaultLineScrollHeight * scrollView.zoomScale;
-        case WebCore::ScrollGranularity::ScrollByPixel:
+        case WebCore::ScrollGranularity::Pixel:
             return 0;
         }
         ASSERT_NOT_REACHED();

Modified: trunk/Source/WebKit/UIProcess/win/WebPopupMenuProxyWin.cpp (285639 => 285640)


--- trunk/Source/WebKit/UIProcess/win/WebPopupMenuProxyWin.cpp	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebKit/UIProcess/win/WebPopupMenuProxyWin.cpp	2021-11-11 18:31:29 UTC (rev 285640)
@@ -763,7 +763,7 @@
             --i;
     }
 
-    ScrollableArea::scroll(i > 0 ? ScrollUp : ScrollDown, ScrollByLine, abs(i));
+    ScrollableArea::scroll(i > 0 ? ScrollUp : ScrollDown, ScrollGranularity::Line, abs(i));
     return 0;
 }
 

Modified: trunk/Source/WebKit/UIProcess/win/WebView.cpp (285639 => 285640)


--- trunk/Source/WebKit/UIProcess/win/WebView.cpp	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebKit/UIProcess/win/WebView.cpp	2021-11-11 18:31:29 UTC (rev 285640)
@@ -401,19 +401,19 @@
     ScrollGranularity granularity;
     switch (LOWORD(wParam)) {
     case SB_LINELEFT:
-        granularity = ScrollByLine;
+        granularity = ScrollGranularity::Line;
         direction = ScrollLeft;
         break;
     case SB_LINERIGHT:
-        granularity = ScrollByLine;
+        granularity = ScrollGranularity::Line;
         direction = ScrollRight;
         break;
     case SB_PAGELEFT:
-        granularity = ScrollByDocument;
+        granularity = ScrollGranularity::Document;
         direction = ScrollLeft;
         break;
     case SB_PAGERIGHT:
-        granularity = ScrollByDocument;
+        granularity = ScrollGranularity::Document;
         direction = ScrollRight;
         break;
     default:
@@ -433,19 +433,19 @@
     ScrollGranularity granularity;
     switch (LOWORD(wParam)) {
     case SB_LINEDOWN:
-        granularity = ScrollByLine;
+        granularity = ScrollGranularity::Line;
         direction = ScrollDown;
         break;
     case SB_LINEUP:
-        granularity = ScrollByLine;
+        granularity = ScrollGranularity::Line;
         direction = ScrollUp;
         break;
     case SB_PAGEDOWN:
-        granularity = ScrollByDocument;
+        granularity = ScrollGranularity::Document;
         direction = ScrollDown;
         break;
     case SB_PAGEUP:
-        granularity = ScrollByDocument;
+        granularity = ScrollGranularity::Document;
         direction = ScrollUp;
         break;
     default:

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (285639 => 285640)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-11-11 18:31:29 UTC (rev 285640)
@@ -3305,7 +3305,7 @@
     return page->userInputBridge().logicalScrollRecursively(direction, granularity);
 }
 
-bool WebPage::scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity)
+bool WebPage::scrollBy(uint32_t scrollDirection, WebCore::ScrollGranularity scrollGranularity)
 {
     return scroll(m_page.get(), static_cast<ScrollDirection>(scrollDirection), static_cast<ScrollGranularity>(scrollGranularity));
 }

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (285639 => 285640)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-11-11 18:31:29 UTC (rev 285640)
@@ -383,7 +383,7 @@
 
     void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset);
 
-    bool scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity);
+    bool scrollBy(uint32_t scrollDirection, WebCore::ScrollGranularity);
 
     void centerSelectionInVisibleArea();
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (285639 => 285640)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2021-11-11 18:31:29 UTC (rev 285640)
@@ -168,7 +168,7 @@
     DidEndDateTimePicker();
 #endif
 
-    ScrollBy(uint32_t scrollDirection, uint32_t scrollGranularity)
+    ScrollBy(uint32_t scrollDirection, enum:uint8_t WebCore::ScrollGranularity scrollGranularity)
     CenterSelectionInVisibleArea()
 
     GoToBackForwardItem(uint64_t navigationID, struct WebCore::BackForwardItemIdentifier backForwardItemID, enum:uint8_t WebCore::FrameLoadType backForwardType, enum:uint8_t WebCore::ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, std::optional<WebKit::WebsitePoliciesData> websitePolicies, bool lastNavigationWasAppInitiated)

Modified: trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp (285639 => 285640)


--- trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp	2021-11-11 18:31:29 UTC (rev 285640)
@@ -104,31 +104,31 @@
 
     switch (keyboardEvent.windowsVirtualKeyCode()) {
     case VK_SPACE:
-        scroll(m_page.get(), keyboardEvent.shiftKey() ? ScrollUp : ScrollDown, ScrollByPage);
+        scroll(m_page.get(), keyboardEvent.shiftKey() ? ScrollUp : ScrollDown, ScrollGranularity::Page);
         break;
     case VK_LEFT:
-        scroll(m_page.get(), ScrollLeft, ScrollByLine);
+        scroll(m_page.get(), ScrollLeft, ScrollGranularity::Line);
         break;
     case VK_RIGHT:
-        scroll(m_page.get(), ScrollRight, ScrollByLine);
+        scroll(m_page.get(), ScrollRight, ScrollGranularity::Line);
         break;
     case VK_UP:
-        scroll(m_page.get(), ScrollUp, ScrollByLine);
+        scroll(m_page.get(), ScrollUp, ScrollGranularity::Line);
         break;
     case VK_DOWN:
-        scroll(m_page.get(), ScrollDown, ScrollByLine);
+        scroll(m_page.get(), ScrollDown, ScrollGranularity::Line);
         break;
     case VK_HOME:
-        scroll(m_page.get(), ScrollUp, ScrollByDocument);
+        scroll(m_page.get(), ScrollUp, ScrollGranularity::Document);
         break;
     case VK_END:
-        scroll(m_page.get(), ScrollDown, ScrollByDocument);
+        scroll(m_page.get(), ScrollDown, ScrollGranularity::Document);
         break;
     case VK_PRIOR:
-        scroll(m_page.get(), ScrollUp, ScrollByPage);
+        scroll(m_page.get(), ScrollUp, ScrollGranularity::Page);
         break;
     case VK_NEXT:
-        scroll(m_page.get(), ScrollDown, ScrollByPage);
+        scroll(m_page.get(), ScrollDown, ScrollGranularity::Page);
         break;
     default:
         return false;

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm (285639 => 285640)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm	2021-11-11 18:31:29 UTC (rev 285640)
@@ -467,27 +467,27 @@
     
     if (!frame->settings().eventHandlerDrivenSmoothKeyboardScrollingEnabled()) {
         if (selector == "moveUp:")
-            didPerformAction = scroll(m_page.get(), ScrollUp, ScrollByLine);
+            didPerformAction = scroll(m_page.get(), ScrollUp, ScrollGranularity::Line);
         else if (selector == "moveToBeginningOfParagraph:")
-            didPerformAction = scroll(m_page.get(), ScrollUp, ScrollByPage);
+            didPerformAction = scroll(m_page.get(), ScrollUp, ScrollGranularity::Page);
         else if (selector == "moveToBeginningOfDocument:") {
-            didPerformAction = scroll(m_page.get(), ScrollUp, ScrollByDocument);
-            didPerformAction |= scroll(m_page.get(), ScrollLeft, ScrollByDocument);
+            didPerformAction = scroll(m_page.get(), ScrollUp, ScrollGranularity::Document);
+            didPerformAction |= scroll(m_page.get(), ScrollLeft, ScrollGranularity::Document);
         } else if (selector == "moveDown:")
-            didPerformAction = scroll(m_page.get(), ScrollDown, ScrollByLine);
+            didPerformAction = scroll(m_page.get(), ScrollDown, ScrollGranularity::Line);
         else if (selector == "moveToEndOfParagraph:")
-            didPerformAction = scroll(m_page.get(), ScrollDown, ScrollByPage);
+            didPerformAction = scroll(m_page.get(), ScrollDown, ScrollGranularity::Page);
         else if (selector == "moveToEndOfDocument:") {
-            didPerformAction = scroll(m_page.get(), ScrollDown, ScrollByDocument);
-            didPerformAction |= scroll(m_page.get(), ScrollLeft, ScrollByDocument);
+            didPerformAction = scroll(m_page.get(), ScrollDown, ScrollGranularity::Document);
+            didPerformAction |= scroll(m_page.get(), ScrollLeft, ScrollGranularity::Document);
         } else if (selector == "moveLeft:")
-            didPerformAction = scroll(m_page.get(), ScrollLeft, ScrollByLine);
+            didPerformAction = scroll(m_page.get(), ScrollLeft, ScrollGranularity::Line);
         else if (selector == "moveWordLeft:")
-            didPerformAction = scroll(m_page.get(), ScrollLeft, ScrollByPage);
+            didPerformAction = scroll(m_page.get(), ScrollLeft, ScrollGranularity::Page);
         else if (selector == "moveRight:")
-            didPerformAction = scroll(m_page.get(), ScrollRight, ScrollByLine);
+            didPerformAction = scroll(m_page.get(), ScrollRight, ScrollGranularity::Line);
         else if (selector == "moveWordRight:")
-            didPerformAction = scroll(m_page.get(), ScrollRight, ScrollByPage);
+            didPerformAction = scroll(m_page.get(), ScrollRight, ScrollGranularity::Page);
     }
 
     if (selector == "moveToLeftEndOfLine:")

Modified: trunk/Source/WebKit/WebProcess/WebPage/win/WebPageWin.cpp (285639 => 285640)


--- trunk/Source/WebKit/WebProcess/WebPage/win/WebPageWin.cpp	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebKit/WebProcess/WebPage/win/WebPageWin.cpp	2021-11-11 18:31:29 UTC (rev 285640)
@@ -75,28 +75,28 @@
 
     switch (keyboardEvent.windowsVirtualKeyCode()) {
     case VK_LEFT:
-        scroll(m_page.get(), ScrollLeft, ScrollByLine);
+        scroll(m_page.get(), ScrollLeft, ScrollGranularity::Line);
         break;
     case VK_RIGHT:
-        scroll(m_page.get(), ScrollRight, ScrollByLine);
+        scroll(m_page.get(), ScrollRight, ScrollGranularity::Line);
         break;
     case VK_UP:
-        scroll(m_page.get(), ScrollUp, ScrollByLine);
+        scroll(m_page.get(), ScrollUp, ScrollGranularity::Line);
         break;
     case VK_DOWN:
-        scroll(m_page.get(), ScrollDown, ScrollByLine);
+        scroll(m_page.get(), ScrollDown, ScrollGranularity::Line);
         break;
     case VK_HOME:
-        scroll(m_page.get(), ScrollUp, ScrollByDocument);
+        scroll(m_page.get(), ScrollUp, ScrollGranularity::Document);
         break;
     case VK_END:
-        scroll(m_page.get(), ScrollDown, ScrollByDocument);
+        scroll(m_page.get(), ScrollDown, ScrollGranularity::Document);
         break;
     case VK_PRIOR:
-        scroll(m_page.get(), ScrollUp, ScrollByPage);
+        scroll(m_page.get(), ScrollUp, ScrollGranularity::Page);
         break;
     case VK_NEXT:
-        scroll(m_page.get(), ScrollDown, ScrollByPage);
+        scroll(m_page.get(), ScrollDown, ScrollGranularity::Page);
         break;
     default:
         return false;

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (285639 => 285640)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2021-11-11 18:31:29 UTC (rev 285640)
@@ -1,3 +1,18 @@
+2021-11-11  Nikolaos Mouchtaris  <[email protected]>
+
+        Make scroll granularity an enum class
+        https://bugs.webkit.org/show_bug.cgi?id=232641
+
+        Reviewed by Cameron McCormack.
+
+        * WebView/WebFrameView.mm:
+        (-[WebFrameView _scrollToBeginningOfDocument]):
+        (-[WebFrameView _scrollToEndOfDocument]):
+        (-[WebFrameView _pageVertically:]):
+        (-[WebFrameView _pageHorizontally:]):
+        (-[WebFrameView _scrollLineVertically:]):
+        (-[WebFrameView _scrollLineHorizontally:]):
+
 2021-11-11  Sam Weinig  <[email protected]>
 
         Factor platform specific code out of HTMLModelElement

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebFrameView.mm (285639 => 285640)


--- trunk/Source/WebKitLegacy/mac/WebView/WebFrameView.mm	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebFrameView.mm	2021-11-11 18:31:29 UTC (rev 285640)
@@ -633,7 +633,7 @@
 
 - (BOOL)_scrollToBeginningOfDocument
 {
-    if ([self _scrollOverflowInDirection:WebCore::ScrollUp granularity:WebCore::ScrollByDocument])
+    if ([self _scrollOverflowInDirection:WebCore::ScrollUp granularity:WebCore::ScrollGranularity::Document])
         return YES;
     if (![self _isScrollable])
         return NO;
@@ -645,7 +645,7 @@
 
 - (BOOL)_scrollToEndOfDocument
 {
-    if ([self _scrollOverflowInDirection:WebCore::ScrollDown granularity:WebCore::ScrollByDocument])
+    if ([self _scrollOverflowInDirection:WebCore::ScrollDown granularity:WebCore::ScrollGranularity::Document])
         return YES;
     if (![self _isScrollable])
         return NO;
@@ -742,7 +742,7 @@
 
 - (BOOL)_pageVertically:(BOOL)up
 {
-    if ([self _scrollOverflowInDirection:up ? WebCore::ScrollUp : WebCore::ScrollDown granularity:WebCore::ScrollByPage])
+    if ([self _scrollOverflowInDirection:up ? WebCore::ScrollUp : WebCore::ScrollDown granularity:WebCore::ScrollGranularity::Page])
         return YES;
     
     if (![self _isScrollable])
@@ -754,7 +754,7 @@
 
 - (BOOL)_pageHorizontally:(BOOL)left
 {
-    if ([self _scrollOverflowInDirection:left ? WebCore::ScrollLeft : WebCore::ScrollRight granularity:WebCore::ScrollByPage])
+    if ([self _scrollOverflowInDirection:left ? WebCore::ScrollLeft : WebCore::ScrollRight granularity:WebCore::ScrollGranularity::Page])
         return YES;
 
     if (![self _isScrollable])
@@ -776,7 +776,7 @@
 
 - (BOOL)_scrollLineVertically:(BOOL)up
 {
-    if ([self _scrollOverflowInDirection:up ? WebCore::ScrollUp : WebCore::ScrollDown granularity:WebCore::ScrollByLine])
+    if ([self _scrollOverflowInDirection:up ? WebCore::ScrollUp : WebCore::ScrollDown granularity:WebCore::ScrollGranularity::Line])
         return YES;
 
     if (![self _isScrollable])
@@ -788,7 +788,7 @@
 
 - (BOOL)_scrollLineHorizontally:(BOOL)left
 {
-    if ([self _scrollOverflowInDirection:left ? WebCore::ScrollLeft : WebCore::ScrollRight granularity:WebCore::ScrollByLine])
+    if ([self _scrollOverflowInDirection:left ? WebCore::ScrollLeft : WebCore::ScrollRight granularity:WebCore::ScrollGranularity::Line])
         return YES;
 
     if (![self _isScrollable])

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (285639 => 285640)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2021-11-11 18:31:29 UTC (rev 285640)
@@ -1,3 +1,15 @@
+2021-11-11  Nikolaos Mouchtaris  <[email protected]>
+
+        Make scroll granularity an enum class
+        https://bugs.webkit.org/show_bug.cgi?id=232641
+
+        Reviewed by Cameron McCormack.
+
+        * WebView.cpp:
+        (WebView::verticalScroll):
+        (WebView::horizontalScroll):
+        (WebView::keyDown):
+
 2021-11-11  Sam Weinig  <[email protected]>
 
         Factor platform specific code out of HTMLModelElement

Modified: trunk/Source/WebKitLegacy/win/WebView.cpp (285639 => 285640)


--- trunk/Source/WebKitLegacy/win/WebView.cpp	2021-11-11 18:29:14 UTC (rev 285639)
+++ trunk/Source/WebKitLegacy/win/WebView.cpp	2021-11-11 18:31:29 UTC (rev 285640)
@@ -2085,19 +2085,19 @@
     ScrollGranularity granularity;
     switch (LOWORD(wParam)) {
     case SB_LINEDOWN:
-        granularity = ScrollByLine;
+        granularity = ScrollGranularity::Line;
         direction = ScrollDown;
         break;
     case SB_LINEUP:
-        granularity = ScrollByLine;
+        granularity = ScrollGranularity::Line;
         direction = ScrollUp;
         break;
     case SB_PAGEDOWN:
-        granularity = ScrollByDocument;
+        granularity = ScrollGranularity::Document;
         direction = ScrollDown;
         break;
     case SB_PAGEUP:
-        granularity = ScrollByDocument;
+        granularity = ScrollGranularity::Document;
         direction = ScrollUp;
         break;
     default:
@@ -2115,19 +2115,19 @@
     ScrollGranularity granularity;
     switch (LOWORD(wParam)) {
     case SB_LINELEFT:
-        granularity = ScrollByLine;
+        granularity = ScrollGranularity::Line;
         direction = ScrollLeft;
         break;
     case SB_LINERIGHT:
-        granularity = ScrollByLine;
+        granularity = ScrollGranularity::Line;
         direction = ScrollRight;
         break;
     case SB_PAGELEFT:
-        granularity = ScrollByDocument;
+        granularity = ScrollGranularity::Document;
         direction = ScrollLeft;
         break;
     case SB_PAGERIGHT:
-        granularity = ScrollByDocument;
+        granularity = ScrollGranularity::Document;
         direction = ScrollRight;
         break;
     default:
@@ -2360,35 +2360,35 @@
     ScrollGranularity granularity { };
     switch (virtualKeyCode) {
         case VK_LEFT:
-            granularity = ScrollByLine;
+            granularity = ScrollGranularity::Line;
             direction = ScrollLeft;
             break;
         case VK_RIGHT:
-            granularity = ScrollByLine;
+            granularity = ScrollGranularity::Line;
             direction = ScrollRight;
             break;
         case VK_UP:
-            granularity = ScrollByLine;
+            granularity = ScrollGranularity::Line;
             direction = ScrollUp;
             break;
         case VK_DOWN:
-            granularity = ScrollByLine;
+            granularity = ScrollGranularity::Line;
             direction = ScrollDown;
             break;
         case VK_HOME:
-            granularity = ScrollByDocument;
+            granularity = ScrollGranularity::Document;
             direction = ScrollUp;
             break;
         case VK_END:
-            granularity = ScrollByDocument;
+            granularity = ScrollGranularity::Document;
             direction = ScrollDown;
             break;
         case VK_PRIOR:
-            granularity = ScrollByPage;
+            granularity = ScrollGranularity::Page;
             direction = ScrollUp;
             break;
         case VK_NEXT:
-            granularity = ScrollByPage;
+            granularity = ScrollGranularity::Page;
             direction = ScrollDown;
             break;
         default:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to