[webkit-changes] [WebKit/WebKit] a7d211: WebCore::Cursor::Type should be an enum class

Abrar Rahman Protyasha noreply at github.com
Thu Nov 16 11:14:54 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a7d211b90cd35048285c77d129432799d915be4a
      https://github.com/WebKit/WebKit/commit/a7d211b90cd35048285c77d129432799d915be4a
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2023-11-16 (Thu, 16 Nov 2023)

  Changed paths:
    M Source/WebCore/platform/Cursor.cpp
    M Source/WebCore/platform/Cursor.h
    M Source/WebCore/platform/gtk/CursorGtk.cpp
    M Source/WebCore/platform/mac/CursorMac.mm
    M Source/WebCore/platform/win/CursorWin.cpp
    M Source/WebCore/testing/Internals.cpp
    M Source/WebKit/Shared/WebCoreArgumentCoders.cpp
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

  Log Message:
  -----------
  WebCore::Cursor::Type should be an enum class
https://bugs.webkit.org/show_bug.cgi?id=264899
rdar://118477108

Reviewed by Aditya Keerthi.

This is a mechanical patch that makes `WebCore::Cursor::Type` an enum
class. There are only two interesting bits:

1. We remove the need for a sentinel `static_cast<-1>` to mark an
   invalid cursor value, which is possibly undefined behavior, and
   instead just introduce an `Invalid` enumeration case that
   `Cursor.type` defaults to.

2. We move the `Type` enumeration outside of the `Cursor` class scope
   and into the `WebCore` namespace, renaming it to `PlatformCursorType`
   in the process. Moving out this enumeration allows us to forward
   declare it instead of pulling in the entire `Cursor` class
   definition. The rename was necessary because `WebCore::CursorType`
   exists in RenderStyleConstants.cpp already.

* Source/WebCore/platform/Cursor.cpp:
(WebCore::Cursor::fromType):
(WebCore::Cursor::Cursor):
(WebCore::pointerCursor):
(WebCore::crossCursor):
(WebCore::handCursor):
(WebCore::moveCursor):
(WebCore::verticalTextCursor):
(WebCore::cellCursor):
(WebCore::contextMenuCursor):
(WebCore::aliasCursor):
(WebCore::zoomInCursor):
(WebCore::zoomOutCursor):
(WebCore::copyCursor):
(WebCore::noneCursor):
(WebCore::progressCursor):
(WebCore::noDropCursor):
(WebCore::notAllowedCursor):
(WebCore::iBeamCursor):
(WebCore::waitCursor):
(WebCore::helpCursor):
(WebCore::eastResizeCursor):
(WebCore::northResizeCursor):
(WebCore::northEastResizeCursor):
(WebCore::northWestResizeCursor):
(WebCore::southResizeCursor):
(WebCore::southEastResizeCursor):
(WebCore::southWestResizeCursor):
(WebCore::westResizeCursor):
(WebCore::northSouthResizeCursor):
(WebCore::eastWestResizeCursor):
(WebCore::northEastSouthWestResizeCursor):
(WebCore::northWestSouthEastResizeCursor):
(WebCore::columnResizeCursor):
(WebCore::rowResizeCursor):
(WebCore::middlePanningCursor):
(WebCore::eastPanningCursor):
(WebCore::northPanningCursor):
(WebCore::northEastPanningCursor):
(WebCore::northWestPanningCursor):
(WebCore::southPanningCursor):
(WebCore::southEastPanningCursor):
(WebCore::southWestPanningCursor):
(WebCore::westPanningCursor):
(WebCore::grabCursor):
(WebCore::grabbingCursor):
* Source/WebCore/platform/Cursor.h:
(WebCore::Cursor::type const):
* Source/WebCore/platform/gtk/CursorGtk.cpp:
(WebCore::Cursor::ensurePlatformCursor const):
* Source/WebCore/platform/mac/CursorMac.mm:
(WebCore::Cursor::ensurePlatformCursor const):
* Source/WebCore/platform/win/CursorWin.cpp:
(WebCore::Cursor::ensurePlatformCursor const):
* Source/WebCore/testing/Internals.cpp:
(WebCore::cursorTypeToString):
* Source/WebKit/Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<Cursor>::encode):
(IPC::ArgumentCoder<Cursor>::decode):
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView pointerRegionForPositionInformation:point:]):
(-[WKContentView pointerInteraction:styleForRegion:]):
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::populateCaretContext):

Canonical link: https://commits.webkit.org/270837@main




More information about the webkit-changes mailing list