[webkit-changes] [WebKit/WebKit] 287241: GamepadHapticActuator.playEffect() with a magnitud...

Chris Dumez noreply at github.com
Fri Jan 13 07:40:17 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2872417b1ad8e0f9e03e05a2fa6c6b0cf8a6ae59
      https://github.com/WebKit/WebKit/commit/2872417b1ad8e0f9e03e05a2fa6c6b0cf8a6ae59
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-01-13 (Fri, 13 Jan 2023)

  Changed paths:
    M Source/WebCore/platform/gamepad/cocoa/GameControllerHapticEffect.mm

  Log Message:
  -----------
  GamepadHapticActuator.playEffect() with a magnitude < 0.1 has no effect
https://bugs.webkit.org/show_bug.cgi?id=250522

Reviewed by Youenn Fablet.

GamepadHapticActuator.playEffect() with a magnitude < 0.1 has no effect in
Safari but triggers vibration in Chrome. This is causing the gamepad to
vibrate a lot less with Safari than Chrome when playing games such as
Forza on XBox Cloud.

I noticed that passing a value < 0.1 as intensity to GameController doesn't
result in any vibration of the gamepad. To address this we now scale the
magnitude value to be in the [0.1; 1] range before passing it as intensity
to the GameController framework. The exception is the value 0 which is still
treated as 0 (no vibration).

This makes the experience on XBox Cloud a lot more comparable between Safari
and Chrome.

* Source/WebCore/platform/gamepad/cocoa/GameControllerHapticEffect.mm:
(WebCore::magnitudeToIntensity):
(WebCore::GameControllerHapticEffect::create):

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




More information about the webkit-changes mailing list