Diff
Modified: branches/safari-609-branch/Source/WebCore/ChangeLog (259600 => 259601)
--- branches/safari-609-branch/Source/WebCore/ChangeLog 2020-04-06 23:05:11 UTC (rev 259600)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog 2020-04-06 23:05:15 UTC (rev 259601)
@@ -1,5 +1,80 @@
2020-04-06 Alan Coon <[email protected]>
+ Cherry-pick r259315. rdar://problem/61352448
+
+ Regression(r253357) DeviceMotionEvent acceleration and rotationRate are null
+ https://bugs.webkit.org/show_bug.cgi?id=209831
+ <rdar://problem/60720953>
+
+ Reviewed by Darin Adler.
+
+ Source/WebCore:
+
+ The issue was that DeviceMotionClientIOS::motionChanged() would only initialize the
+ acceleration and rotationRate if [m_motionManager gyroAvailable] returned YES. After
+ r253357, m_motionManager is nil because we get motion data from the UIProcess so
+ [m_motionManager gyroAvailable] would always resolve to NO.
+
+ To address the issue, I made the rotationRate parameters to motionChanged() optional
+ and we rely on them being set to know if gyro data is available. Note that I did not
+ make the acceleration optional because according to [1], all devices have an
+ accelerometer.
+
+ [1] https://developer.apple.com/documentation/coremotion/cmmotionmanager/1616094-devicemotionavailable?language=objc
+
+ * platform/ios/DeviceMotionClientIOS.h:
+ * platform/ios/DeviceMotionClientIOS.mm:
+ (WebCore::DeviceMotionClientIOS::motionChanged):
+ * platform/ios/DeviceOrientationUpdateProvider.h:
+ * platform/ios/MotionManagerClient.h:
+ (WebCore::MotionManagerClient::motionChanged):
+ * platform/ios/WebCoreMotionManager.mm:
+ (-[WebCoreMotionManager sendAccelerometerData:]):
+
+ Source/WebKit:
+
+ * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h:
+ * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.mm:
+ (WebKit::WebDeviceOrientationUpdateProviderProxy::motionChanged):
+ * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp:
+ (WebKit::WebDeviceOrientationUpdateProvider::deviceMotionChanged):
+ * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h:
+ * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.messages.in:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-03-31 Chris Dumez <[email protected]>
+
+ Regression(r253357) DeviceMotionEvent acceleration and rotationRate are null
+ https://bugs.webkit.org/show_bug.cgi?id=209831
+ <rdar://problem/60720953>
+
+ Reviewed by Darin Adler.
+
+ The issue was that DeviceMotionClientIOS::motionChanged() would only initialize the
+ acceleration and rotationRate if [m_motionManager gyroAvailable] returned YES. After
+ r253357, m_motionManager is nil because we get motion data from the UIProcess so
+ [m_motionManager gyroAvailable] would always resolve to NO.
+
+ To address the issue, I made the rotationRate parameters to motionChanged() optional
+ and we rely on them being set to know if gyro data is available. Note that I did not
+ make the acceleration optional because according to [1], all devices have an
+ accelerometer.
+
+ [1] https://developer.apple.com/documentation/coremotion/cmmotionmanager/1616094-devicemotionavailable?language=objc
+
+ * platform/ios/DeviceMotionClientIOS.h:
+ * platform/ios/DeviceMotionClientIOS.mm:
+ (WebCore::DeviceMotionClientIOS::motionChanged):
+ * platform/ios/DeviceOrientationUpdateProvider.h:
+ * platform/ios/MotionManagerClient.h:
+ (WebCore::MotionManagerClient::motionChanged):
+ * platform/ios/WebCoreMotionManager.mm:
+ (-[WebCoreMotionManager sendAccelerometerData:]):
+
+2020-04-06 Alan Coon <[email protected]>
+
Cherry-pick r258434. rdar://problem/61352465
Safari sometimes crashes when switch video into PiP mode
Modified: branches/safari-609-branch/Source/WebCore/platform/ios/DeviceMotionClientIOS.h (259600 => 259601)
--- branches/safari-609-branch/Source/WebCore/platform/ios/DeviceMotionClientIOS.h 2020-04-06 23:05:11 UTC (rev 259600)
+++ branches/safari-609-branch/Source/WebCore/platform/ios/DeviceMotionClientIOS.h 2020-04-06 23:05:15 UTC (rev 259601)
@@ -48,7 +48,7 @@
DeviceMotionData* lastMotion() const override;
void deviceMotionControllerDestroyed() override;
- void motionChanged(double, double, double, double, double, double, double, double, double) override;
+ void motionChanged(double, double, double, double, double, double, Optional<double>, Optional<double>, Optional<double>) override;
private:
WebCoreMotionManager* m_motionManager { nullptr };
Modified: branches/safari-609-branch/Source/WebCore/platform/ios/DeviceMotionClientIOS.mm (259600 => 259601)
--- branches/safari-609-branch/Source/WebCore/platform/ios/DeviceMotionClientIOS.mm 2020-04-06 23:05:11 UTC (rev 259600)
+++ branches/safari-609-branch/Source/WebCore/platform/ios/DeviceMotionClientIOS.mm 2020-04-06 23:05:15 UTC (rev 259601)
@@ -91,7 +91,7 @@
[m_motionManager removeMotionClient:this];
}
-void DeviceMotionClientIOS::motionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, double xRotationRate, double yRotationRate, double zRotationRate)
+void DeviceMotionClientIOS::motionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, Optional<double> xRotationRate, Optional<double> yRotationRate, Optional<double> zRotationRate)
{
if (!m_updating)
return;
@@ -113,12 +113,11 @@
#else
auto accelerationIncludingGravity = DeviceMotionData::Acceleration::create(xAccelerationIncludingGravity, yAccelerationIncludingGravity, zAccelerationIncludingGravity);
- RefPtr<DeviceMotionData::Acceleration> acceleration;
+ RefPtr<DeviceMotionData::Acceleration> acceleration = DeviceMotionData::Acceleration::create(xAcceleration, yAcceleration, zAcceleration);
RefPtr<DeviceMotionData::RotationRate> rotationRate;
- if ([m_motionManager gyroAvailable]) {
- acceleration = DeviceMotionData::Acceleration::create(xAcceleration, yAcceleration, zAcceleration);
- rotationRate = DeviceMotionData::RotationRate::create(xRotationRate, yRotationRate, zRotationRate);
- }
+ // Not all devices have a gyroscope.
+ if (xRotationRate && yRotationRate && zRotationRate)
+ rotationRate = DeviceMotionData::RotationRate::create(*xRotationRate, *yRotationRate, *zRotationRate);
#endif // PLATFORM(IOS_FAMILY_SIMULATOR)
m_currentDeviceMotionData = DeviceMotionData::create(WTFMove(acceleration), WTFMove(accelerationIncludingGravity), WTFMove(rotationRate), kMotionUpdateInterval);
Modified: branches/safari-609-branch/Source/WebCore/platform/ios/DeviceOrientationUpdateProvider.h (259600 => 259601)
--- branches/safari-609-branch/Source/WebCore/platform/ios/DeviceOrientationUpdateProvider.h 2020-04-06 23:05:11 UTC (rev 259600)
+++ branches/safari-609-branch/Source/WebCore/platform/ios/DeviceOrientationUpdateProvider.h 2020-04-06 23:05:15 UTC (rev 259601)
@@ -44,7 +44,7 @@
virtual void stopUpdatingDeviceMotion(MotionManagerClient&) = 0;
virtual void deviceOrientationChanged(double, double, double, double, double) = 0;
- virtual void deviceMotionChanged(double, double, double, double, double, double, double, double, double) = 0;
+ virtual void deviceMotionChanged(double, double, double, double, double, double, Optional<double>, Optional<double>, Optional<double>) = 0;
protected:
DeviceOrientationUpdateProvider() = default;
Modified: branches/safari-609-branch/Source/WebCore/platform/ios/MotionManagerClient.h (259600 => 259601)
--- branches/safari-609-branch/Source/WebCore/platform/ios/MotionManagerClient.h 2020-04-06 23:05:11 UTC (rev 259600)
+++ branches/safari-609-branch/Source/WebCore/platform/ios/MotionManagerClient.h 2020-04-06 23:05:15 UTC (rev 259601)
@@ -36,7 +36,7 @@
virtual ~MotionManagerClient() { };
virtual void orientationChanged(double, double, double, double, double) { }
- virtual void motionChanged(double, double, double, double, double, double, double, double, double) { }
+ virtual void motionChanged(double, double, double, double, double, double, Optional<double>, Optional<double>, Optional<double>) { }
};
};
Modified: branches/safari-609-branch/Source/WebCore/platform/ios/WebCoreMotionManager.mm (259600 => 259601)
--- branches/safari-609-branch/Source/WebCore/platform/ios/WebCoreMotionManager.mm 2020-04-06 23:05:11 UTC (rev 259600)
+++ branches/safari-609-branch/Source/WebCore/platform/ios/WebCoreMotionManager.mm 2020-04-06 23:05:15 UTC (rev 259601)
@@ -232,7 +232,7 @@
for (auto& client : motionClients) {
if (client)
- client->motionChanged(0, 0, 0, accel.x * kGravity, accel.y * kGravity, accel.z * kGravity, 0, 0, 0);
+ client->motionChanged(0, 0, 0, accel.x * kGravity, accel.y * kGravity, accel.z * kGravity, WTF::nullopt, WTF::nullopt, WTF::nullopt);
}
});
}
Modified: branches/safari-609-branch/Source/WebKit/ChangeLog (259600 => 259601)
--- branches/safari-609-branch/Source/WebKit/ChangeLog 2020-04-06 23:05:11 UTC (rev 259600)
+++ branches/safari-609-branch/Source/WebKit/ChangeLog 2020-04-06 23:05:15 UTC (rev 259601)
@@ -1,3 +1,65 @@
+2020-04-06 Alan Coon <[email protected]>
+
+ Cherry-pick r259315. rdar://problem/61352448
+
+ Regression(r253357) DeviceMotionEvent acceleration and rotationRate are null
+ https://bugs.webkit.org/show_bug.cgi?id=209831
+ <rdar://problem/60720953>
+
+ Reviewed by Darin Adler.
+
+ Source/WebCore:
+
+ The issue was that DeviceMotionClientIOS::motionChanged() would only initialize the
+ acceleration and rotationRate if [m_motionManager gyroAvailable] returned YES. After
+ r253357, m_motionManager is nil because we get motion data from the UIProcess so
+ [m_motionManager gyroAvailable] would always resolve to NO.
+
+ To address the issue, I made the rotationRate parameters to motionChanged() optional
+ and we rely on them being set to know if gyro data is available. Note that I did not
+ make the acceleration optional because according to [1], all devices have an
+ accelerometer.
+
+ [1] https://developer.apple.com/documentation/coremotion/cmmotionmanager/1616094-devicemotionavailable?language=objc
+
+ * platform/ios/DeviceMotionClientIOS.h:
+ * platform/ios/DeviceMotionClientIOS.mm:
+ (WebCore::DeviceMotionClientIOS::motionChanged):
+ * platform/ios/DeviceOrientationUpdateProvider.h:
+ * platform/ios/MotionManagerClient.h:
+ (WebCore::MotionManagerClient::motionChanged):
+ * platform/ios/WebCoreMotionManager.mm:
+ (-[WebCoreMotionManager sendAccelerometerData:]):
+
+ Source/WebKit:
+
+ * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h:
+ * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.mm:
+ (WebKit::WebDeviceOrientationUpdateProviderProxy::motionChanged):
+ * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp:
+ (WebKit::WebDeviceOrientationUpdateProvider::deviceMotionChanged):
+ * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h:
+ * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.messages.in:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-03-31 Chris Dumez <[email protected]>
+
+ Regression(r253357) DeviceMotionEvent acceleration and rotationRate are null
+ https://bugs.webkit.org/show_bug.cgi?id=209831
+ <rdar://problem/60720953>
+
+ Reviewed by Darin Adler.
+
+ * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h:
+ * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.mm:
+ (WebKit::WebDeviceOrientationUpdateProviderProxy::motionChanged):
+ * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp:
+ (WebKit::WebDeviceOrientationUpdateProvider::deviceMotionChanged):
+ * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h:
+ * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.messages.in:
+
2020-04-03 Alan Coon <[email protected]>
Cherry-pick r257209. rdar://problem/61269710
Modified: branches/safari-609-branch/Source/WebKit/UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h (259600 => 259601)
--- branches/safari-609-branch/Source/WebKit/UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h 2020-04-06 23:05:11 UTC (rev 259600)
+++ branches/safari-609-branch/Source/WebKit/UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h 2020-04-06 23:05:15 UTC (rev 259601)
@@ -49,7 +49,7 @@
private:
// WebCore::WebCoreMotionManagerClient
void orientationChanged(double, double, double, double, double) final;
- void motionChanged(double, double, double, double, double, double, double, double, double) final;
+ void motionChanged(double, double, double, double, double, double, Optional<double>, Optional<double>, Optional<double>) final;
// IPC::MessageReceiver
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
Modified: branches/safari-609-branch/Source/WebKit/UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.mm (259600 => 259601)
--- branches/safari-609-branch/Source/WebKit/UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.mm 2020-04-06 23:05:11 UTC (rev 259600)
+++ branches/safari-609-branch/Source/WebKit/UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.mm 2020-04-06 23:05:15 UTC (rev 259601)
@@ -72,7 +72,7 @@
m_page.send(Messages::WebDeviceOrientationUpdateProvider::DeviceOrientationChanged(alpha, beta, gamma, compassHeading, compassAccuracy));
}
-void WebDeviceOrientationUpdateProviderProxy::motionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, double xRotationRate, double yRotationRate, double zRotationRate)
+void WebDeviceOrientationUpdateProviderProxy::motionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, Optional<double> xRotationRate, Optional<double> yRotationRate, Optional<double> zRotationRate)
{
m_page.send(Messages::WebDeviceOrientationUpdateProvider::DeviceMotionChanged(xAcceleration, yAcceleration, zAcceleration, xAccelerationIncludingGravity, yAccelerationIncludingGravity, zAccelerationIncludingGravity, xRotationRate, yRotationRate, zRotationRate));
}
Modified: branches/safari-609-branch/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp (259600 => 259601)
--- branches/safari-609-branch/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp 2020-04-06 23:05:11 UTC (rev 259600)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp 2020-04-06 23:05:15 UTC (rev 259601)
@@ -93,7 +93,7 @@
}
}
-void WebDeviceOrientationUpdateProvider::deviceMotionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, double xRotationRate, double yRotationRate, double zRotationRate)
+void WebDeviceOrientationUpdateProvider::deviceMotionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, Optional<double> xRotationRate, Optional<double> yRotationRate, Optional<double> zRotationRate)
{
Vector<WeakPtr<WebCore::MotionManagerClient>> clients;
for (auto& client : m_deviceMotionClients)
Modified: branches/safari-609-branch/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h (259600 => 259601)
--- branches/safari-609-branch/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h 2020-04-06 23:05:11 UTC (rev 259600)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h 2020-04-06 23:05:15 UTC (rev 259601)
@@ -51,7 +51,7 @@
void startUpdatingDeviceMotion(WebCore::MotionManagerClient&) final;
void stopUpdatingDeviceMotion(WebCore::MotionManagerClient&) final;
void deviceOrientationChanged(double, double, double, double, double) final;
- void deviceMotionChanged(double, double, double, double, double, double, double, double, double) final;
+ void deviceMotionChanged(double, double, double, double, double, double, Optional<double>, Optional<double>, Optional<double>) final;
// IPC::MessageReceiver.
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
Modified: branches/safari-609-branch/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.messages.in (259600 => 259601)
--- branches/safari-609-branch/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.messages.in 2020-04-06 23:05:11 UTC (rev 259600)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.messages.in 2020-04-06 23:05:15 UTC (rev 259601)
@@ -23,6 +23,6 @@
#if PLATFORM(IOS_FAMILY) && ENABLE(DEVICE_ORIENTATION)
messages -> WebDeviceOrientationUpdateProvider {
DeviceOrientationChanged(double alpha, double beta, double gamma, double compassHeading, double compassAccuracy)
- DeviceMotionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, double xRotationRate, double yRotationRate, double zRotationRate)
+ DeviceMotionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, Optional<double> xRotationRate, Optional<double> yRotationRate, Optional<double> zRotationRate)
}
#endif