Changeset 259601 in webkit
- Timestamp:
- Apr 6, 2020, 4:05:15 PM (6 years ago)
- Location:
- branches/safari-609-branch/Source
- Files:
-
- 12 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/platform/ios/DeviceMotionClientIOS.h (modified) (1 diff)
-
WebCore/platform/ios/DeviceMotionClientIOS.mm (modified) (2 diffs)
-
WebCore/platform/ios/DeviceOrientationUpdateProvider.h (modified) (1 diff)
-
WebCore/platform/ios/MotionManagerClient.h (modified) (1 diff)
-
WebCore/platform/ios/WebCoreMotionManager.mm (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h (modified) (1 diff)
-
WebKit/UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.mm (modified) (1 diff)
-
WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp (modified) (1 diff)
-
WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h (modified) (1 diff)
-
WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.messages.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-609-branch/Source/WebCore/ChangeLog
r259599 r259601 1 2020-04-06 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r259315. rdar://problem/61352448 4 5 Regression(r253357) DeviceMotionEvent acceleration and rotationRate are null 6 https://bugs.webkit.org/show_bug.cgi?id=209831 7 <rdar://problem/60720953> 8 9 Reviewed by Darin Adler. 10 11 Source/WebCore: 12 13 The issue was that DeviceMotionClientIOS::motionChanged() would only initialize the 14 acceleration and rotationRate if [m_motionManager gyroAvailable] returned YES. After 15 r253357, m_motionManager is nil because we get motion data from the UIProcess so 16 [m_motionManager gyroAvailable] would always resolve to NO. 17 18 To address the issue, I made the rotationRate parameters to motionChanged() optional 19 and we rely on them being set to know if gyro data is available. Note that I did not 20 make the acceleration optional because according to [1], all devices have an 21 accelerometer. 22 23 [1] https://developer.apple.com/documentation/coremotion/cmmotionmanager/1616094-devicemotionavailable?language=objc 24 25 * platform/ios/DeviceMotionClientIOS.h: 26 * platform/ios/DeviceMotionClientIOS.mm: 27 (WebCore::DeviceMotionClientIOS::motionChanged): 28 * platform/ios/DeviceOrientationUpdateProvider.h: 29 * platform/ios/MotionManagerClient.h: 30 (WebCore::MotionManagerClient::motionChanged): 31 * platform/ios/WebCoreMotionManager.mm: 32 (-[WebCoreMotionManager sendAccelerometerData:]): 33 34 Source/WebKit: 35 36 * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h: 37 * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.mm: 38 (WebKit::WebDeviceOrientationUpdateProviderProxy::motionChanged): 39 * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp: 40 (WebKit::WebDeviceOrientationUpdateProvider::deviceMotionChanged): 41 * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h: 42 * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.messages.in: 43 44 45 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259315 268f45cc-cd09-0410-ab3c-d52691b4dbfc 46 47 2020-03-31 Chris Dumez <cdumez@apple.com> 48 49 Regression(r253357) DeviceMotionEvent acceleration and rotationRate are null 50 https://bugs.webkit.org/show_bug.cgi?id=209831 51 <rdar://problem/60720953> 52 53 Reviewed by Darin Adler. 54 55 The issue was that DeviceMotionClientIOS::motionChanged() would only initialize the 56 acceleration and rotationRate if [m_motionManager gyroAvailable] returned YES. After 57 r253357, m_motionManager is nil because we get motion data from the UIProcess so 58 [m_motionManager gyroAvailable] would always resolve to NO. 59 60 To address the issue, I made the rotationRate parameters to motionChanged() optional 61 and we rely on them being set to know if gyro data is available. Note that I did not 62 make the acceleration optional because according to [1], all devices have an 63 accelerometer. 64 65 [1] https://developer.apple.com/documentation/coremotion/cmmotionmanager/1616094-devicemotionavailable?language=objc 66 67 * platform/ios/DeviceMotionClientIOS.h: 68 * platform/ios/DeviceMotionClientIOS.mm: 69 (WebCore::DeviceMotionClientIOS::motionChanged): 70 * platform/ios/DeviceOrientationUpdateProvider.h: 71 * platform/ios/MotionManagerClient.h: 72 (WebCore::MotionManagerClient::motionChanged): 73 * platform/ios/WebCoreMotionManager.mm: 74 (-[WebCoreMotionManager sendAccelerometerData:]): 75 1 76 2020-04-06 Alan Coon <alancoon@apple.com> 2 77 -
branches/safari-609-branch/Source/WebCore/platform/ios/DeviceMotionClientIOS.h
r253357 r259601 49 49 void deviceMotionControllerDestroyed() override; 50 50 51 void motionChanged(double, double, double, double, double, double, double, double, double) override;51 void motionChanged(double, double, double, double, double, double, Optional<double>, Optional<double>, Optional<double>) override; 52 52 53 53 private: -
branches/safari-609-branch/Source/WebCore/platform/ios/DeviceMotionClientIOS.mm
r253357 r259601 92 92 } 93 93 94 void DeviceMotionClientIOS::motionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, double xRotationRate, double yRotationRate, doublezRotationRate)94 void DeviceMotionClientIOS::motionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, Optional<double> xRotationRate, Optional<double> yRotationRate, Optional<double> zRotationRate) 95 95 { 96 96 if (!m_updating) … … 114 114 auto accelerationIncludingGravity = DeviceMotionData::Acceleration::create(xAccelerationIncludingGravity, yAccelerationIncludingGravity, zAccelerationIncludingGravity); 115 115 116 RefPtr<DeviceMotionData::Acceleration> acceleration ;116 RefPtr<DeviceMotionData::Acceleration> acceleration = DeviceMotionData::Acceleration::create(xAcceleration, yAcceleration, zAcceleration); 117 117 RefPtr<DeviceMotionData::RotationRate> rotationRate; 118 if ([m_motionManager gyroAvailable]) { 119 acceleration = DeviceMotionData::Acceleration::create(xAcceleration, yAcceleration, zAcceleration); 120 rotationRate = DeviceMotionData::RotationRate::create(xRotationRate, yRotationRate, zRotationRate); 121 } 118 // Not all devices have a gyroscope. 119 if (xRotationRate && yRotationRate && zRotationRate) 120 rotationRate = DeviceMotionData::RotationRate::create(*xRotationRate, *yRotationRate, *zRotationRate); 122 121 #endif // PLATFORM(IOS_FAMILY_SIMULATOR) 123 122 -
branches/safari-609-branch/Source/WebCore/platform/ios/DeviceOrientationUpdateProvider.h
r253357 r259601 45 45 46 46 virtual void deviceOrientationChanged(double, double, double, double, double) = 0; 47 virtual void deviceMotionChanged(double, double, double, double, double, double, double, double, double) = 0;47 virtual void deviceMotionChanged(double, double, double, double, double, double, Optional<double>, Optional<double>, Optional<double>) = 0; 48 48 49 49 protected: -
branches/safari-609-branch/Source/WebCore/platform/ios/MotionManagerClient.h
r253357 r259601 37 37 38 38 virtual void orientationChanged(double, double, double, double, double) { } 39 virtual void motionChanged(double, double, double, double, double, double, double, double, double) { }39 virtual void motionChanged(double, double, double, double, double, double, Optional<double>, Optional<double>, Optional<double>) { } 40 40 }; 41 41 -
branches/safari-609-branch/Source/WebCore/platform/ios/WebCoreMotionManager.mm
r253357 r259601 233 233 for (auto& client : motionClients) { 234 234 if (client) 235 client->motionChanged(0, 0, 0, accel.x * kGravity, accel.y * kGravity, accel.z * kGravity, 0, 0, 0);235 client->motionChanged(0, 0, 0, accel.x * kGravity, accel.y * kGravity, accel.z * kGravity, WTF::nullopt, WTF::nullopt, WTF::nullopt); 236 236 } 237 237 }); -
branches/safari-609-branch/Source/WebKit/ChangeLog
r259509 r259601 1 2020-04-06 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r259315. rdar://problem/61352448 4 5 Regression(r253357) DeviceMotionEvent acceleration and rotationRate are null 6 https://bugs.webkit.org/show_bug.cgi?id=209831 7 <rdar://problem/60720953> 8 9 Reviewed by Darin Adler. 10 11 Source/WebCore: 12 13 The issue was that DeviceMotionClientIOS::motionChanged() would only initialize the 14 acceleration and rotationRate if [m_motionManager gyroAvailable] returned YES. After 15 r253357, m_motionManager is nil because we get motion data from the UIProcess so 16 [m_motionManager gyroAvailable] would always resolve to NO. 17 18 To address the issue, I made the rotationRate parameters to motionChanged() optional 19 and we rely on them being set to know if gyro data is available. Note that I did not 20 make the acceleration optional because according to [1], all devices have an 21 accelerometer. 22 23 [1] https://developer.apple.com/documentation/coremotion/cmmotionmanager/1616094-devicemotionavailable?language=objc 24 25 * platform/ios/DeviceMotionClientIOS.h: 26 * platform/ios/DeviceMotionClientIOS.mm: 27 (WebCore::DeviceMotionClientIOS::motionChanged): 28 * platform/ios/DeviceOrientationUpdateProvider.h: 29 * platform/ios/MotionManagerClient.h: 30 (WebCore::MotionManagerClient::motionChanged): 31 * platform/ios/WebCoreMotionManager.mm: 32 (-[WebCoreMotionManager sendAccelerometerData:]): 33 34 Source/WebKit: 35 36 * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h: 37 * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.mm: 38 (WebKit::WebDeviceOrientationUpdateProviderProxy::motionChanged): 39 * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp: 40 (WebKit::WebDeviceOrientationUpdateProvider::deviceMotionChanged): 41 * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h: 42 * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.messages.in: 43 44 45 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259315 268f45cc-cd09-0410-ab3c-d52691b4dbfc 46 47 2020-03-31 Chris Dumez <cdumez@apple.com> 48 49 Regression(r253357) DeviceMotionEvent acceleration and rotationRate are null 50 https://bugs.webkit.org/show_bug.cgi?id=209831 51 <rdar://problem/60720953> 52 53 Reviewed by Darin Adler. 54 55 * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h: 56 * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.mm: 57 (WebKit::WebDeviceOrientationUpdateProviderProxy::motionChanged): 58 * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp: 59 (WebKit::WebDeviceOrientationUpdateProvider::deviceMotionChanged): 60 * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h: 61 * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.messages.in: 62 1 63 2020-04-03 Alan Coon <alancoon@apple.com> 2 64 -
branches/safari-609-branch/Source/WebKit/UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h
r253357 r259601 50 50 // WebCore::WebCoreMotionManagerClient 51 51 void orientationChanged(double, double, double, double, double) final; 52 void motionChanged(double, double, double, double, double, double, double, double, double) final;52 void motionChanged(double, double, double, double, double, double, Optional<double>, Optional<double>, Optional<double>) final; 53 53 54 54 // IPC::MessageReceiver -
branches/safari-609-branch/Source/WebKit/UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.mm
r253357 r259601 73 73 } 74 74 75 void WebDeviceOrientationUpdateProviderProxy::motionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, double xRotationRate, double yRotationRate, doublezRotationRate)75 void WebDeviceOrientationUpdateProviderProxy::motionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, Optional<double> xRotationRate, Optional<double> yRotationRate, Optional<double> zRotationRate) 76 76 { 77 77 m_page.send(Messages::WebDeviceOrientationUpdateProvider::DeviceMotionChanged(xAcceleration, yAcceleration, zAcceleration, xAccelerationIncludingGravity, yAccelerationIncludingGravity, zAccelerationIncludingGravity, xRotationRate, yRotationRate, zRotationRate)); -
branches/safari-609-branch/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp
r253357 r259601 94 94 } 95 95 96 void WebDeviceOrientationUpdateProvider::deviceMotionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, double xRotationRate, double yRotationRate, doublezRotationRate)96 void WebDeviceOrientationUpdateProvider::deviceMotionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, Optional<double> xRotationRate, Optional<double> yRotationRate, Optional<double> zRotationRate) 97 97 { 98 98 Vector<WeakPtr<WebCore::MotionManagerClient>> clients; -
branches/safari-609-branch/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h
r253357 r259601 52 52 void stopUpdatingDeviceMotion(WebCore::MotionManagerClient&) final; 53 53 void deviceOrientationChanged(double, double, double, double, double) final; 54 void deviceMotionChanged(double, double, double, double, double, double, double, double, double) final;54 void deviceMotionChanged(double, double, double, double, double, double, Optional<double>, Optional<double>, Optional<double>) final; 55 55 56 56 // IPC::MessageReceiver. -
branches/safari-609-branch/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.messages.in
r253357 r259601 24 24 messages -> WebDeviceOrientationUpdateProvider { 25 25 DeviceOrientationChanged(double alpha, double beta, double gamma, double compassHeading, double compassAccuracy) 26 DeviceMotionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, double xRotationRate, double yRotationRate, doublezRotationRate)26 DeviceMotionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, Optional<double> xRotationRate, Optional<double> yRotationRate, Optional<double> zRotationRate) 27 27 } 28 28 #endif
Note:
See TracChangeset
for help on using the changeset viewer.