[webkit-changes] [WebKit/WebKit] 310ec1: Pass OptionSet<PlatformEventModifier> into WebKit ...

Abrar Rahman Protyasha noreply at github.com
Thu May 25 09:45:23 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 310ec15a368c09863afe46cc6179384bace485a7
      https://github.com/WebKit/WebKit/commit/310ec15a368c09863afe46cc6179384bace485a7
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M Source/WebCore/inspector/InspectorInstrumentation.cpp
    M Source/WebCore/inspector/InspectorInstrumentation.h
    M Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
    M Source/WebCore/inspector/agents/InspectorDOMAgent.h
    M Source/WebCore/loader/EmptyClients.h
    M Source/WebCore/page/Chrome.cpp
    M Source/WebCore/page/Chrome.h
    M Source/WebCore/page/ChromeClient.h
    M Source/WebCore/page/EventHandler.cpp
    M Source/WebKit/Shared/WebEventModifier.cpp
    M Source/WebKit/Shared/WebEventModifier.h
    M Source/WebKit/Sources.txt
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.messages.in
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h
    M Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm

  Log Message:
  -----------
  Pass OptionSet<PlatformEventModifier> into WebKit instead of raw modifier flags in mouseDidMoveOverElement codepath
https://bugs.webkit.org/show_bug.cgi?id=257175
rdar://109690336

Reviewed by Aditya Keerthi.

Currently we pass event modifiers as unsigned integral values rather than
option sets into WebCore::Chrome (and then upwards into the WebKit layer).
This is because we don't want to drag in WebKit types into WebCore,
understandably so. However, this means we can't roundtrip between the UI
process and web process without translating back and forth between raw
modifier flag values and option sets.

Instead, we should:

(a) Pass OptionSet<PlatformEventModifier> wherever the event modifier is
required within WebCore -- i.e. In the InspectorInstrumentation path.
(b) Pass OptionSet<PlatformEventModifier> into our first call in the
WebKit layer, following which we can early convert to WebKit's
OptionSet<WebEventModifier> and pass that around inside the WebKit
layers.

This commit achieves both of the above, as well as performing a drive-by
fix of actually adding WebEventModifier.cpp to the XCode project and
moving WebKit::modifiersFromPlatformEventModifiers from
WebChromeClient.cpp into WebEventModifier.cpp, where it should reside.
The status quo seems to have just been the result of a misstep from what
was originally the right intention in 256594 at main.

* Source/WebCore/inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::mouseDidMoveOverElementImpl):
* Source/WebCore/inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::mouseDidMoveOverElement):
* Source/WebCore/inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::mouseDidMoveOverElement):
* Source/WebCore/inspector/agents/InspectorDOMAgent.h:
* Source/WebCore/loader/EmptyClients.h:
* Source/WebCore/page/Chrome.cpp:
(WebCore::Chrome::mouseDidMoveOverElement):
* Source/WebCore/page/Chrome.h:
* Source/WebCore/page/ChromeClient.h:
* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::mouseMoved):
* Source/WebKit/Shared/WebEventModifier.cpp:
(WebKit::modifiersFromPlatformEventModifiers):

Define WebKit::modifiersFromPlatformEventModifiers that allows us to
pass a PlatformEventModifier option set into WebKit and conveniently
translate that to a WebEventModifier option set.

(WebKit::modifiersForNavigationAction):
* Source/WebKit/Shared/WebEventModifier.h:

WebCore contains the WebCore::platform function that translates from an
OptionSet<WebKit::WebEventModifier> to an
OptionSet<WebCore::PlatformEventModifier>, but the converse did not
exist. We declare WebKit::modifiersFromPlatformEventModifiers to serve
that need.

* Source/WebKit/Sources.txt:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::dispatchMouseDidMoveOverElementAsynchronously):
(WebKit::WebPageProxy::mouseDidMoveOverElement):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::mouseDidMoveOverElement):
(WebKit::modifiersForNavigationAction): Deleted.
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::performHitTestForMouseEvent):
* Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h:
* Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::mouseDidMoveOverElement):

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




More information about the webkit-changes mailing list