Title: [210741] trunk
Revision
210741
Author
[email protected]
Date
2017-01-13 13:19:55 -0800 (Fri, 13 Jan 2017)

Log Message

[WebIDL] Remove custom bindings for DeviceMotionEvent and DeviceOrientationEvent
https://bugs.webkit.org/show_bug.cgi?id=167006

Reviewed by Geoffrey Garen.

Source/WebCore:

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSDeviceMotionEventCustom.cpp: Removed.
* bindings/js/JSDeviceOrientationEventCustom.cpp: Removed.
Remove Custom bindings files.

* dom/DeviceMotionData.cpp:
(WebCore::DeviceMotionData::create):
(WebCore::DeviceMotionData::DeviceMotionData):
(WebCore::DeviceMotionData::Acceleration::create): Deleted.
(WebCore::DeviceMotionData::Acceleration::Acceleration): Deleted.
(WebCore::DeviceMotionData::RotationRate::create): Deleted.
(WebCore::DeviceMotionData::RotationRate::RotationRate): Deleted.
* dom/DeviceMotionData.h:
(WebCore::DeviceMotionData::Acceleration::create):
(WebCore::DeviceMotionData::Acceleration::x):
(WebCore::DeviceMotionData::Acceleration::y):
(WebCore::DeviceMotionData::Acceleration::z):
(WebCore::DeviceMotionData::Acceleration::Acceleration):
(WebCore::DeviceMotionData::RotationRate::create):
(WebCore::DeviceMotionData::RotationRate::alpha):
(WebCore::DeviceMotionData::RotationRate::beta):
(WebCore::DeviceMotionData::RotationRate::gamma):
(WebCore::DeviceMotionData::RotationRate::RotationRate):
(WebCore::DeviceMotionData::interval):
(WebCore::DeviceMotionData::Acceleration::canProvideX): Deleted.
(WebCore::DeviceMotionData::Acceleration::canProvideY): Deleted.
(WebCore::DeviceMotionData::Acceleration::canProvideZ): Deleted.
(WebCore::DeviceMotionData::RotationRate::canProvideAlpha): Deleted.
(WebCore::DeviceMotionData::RotationRate::canProvideBeta): Deleted.
(WebCore::DeviceMotionData::RotationRate::canProvideGamma): Deleted.
(WebCore::DeviceMotionData::canProvideInterval): Deleted.
Re-work using std::optional rather than an explicit bool/value pair.

* dom/DeviceMotionEvent.cpp:
(WebCore::convert):
(WebCore::DeviceMotionEvent::acceleration):
(WebCore::DeviceMotionEvent::accelerationIncludingGravity):
(WebCore::DeviceMotionEvent::rotationRate):
(WebCore::DeviceMotionEvent::interval):
(WebCore::DeviceMotionEvent::initDeviceMotionEvent):
* dom/DeviceMotionEvent.h:
Implement IDL interface. For now, we have duplicate structs for
Acceleration and RotationRate (one here, one in DeviceMotionData)
which can be consolidated in the future.

* dom/DeviceMotionEvent.idl:
Add dictionaries for Acceleration and RotationRate, and update IDL to
specify the correct nullability of attributes and arguments.

* dom/DeviceOrientationData.cpp:
(WebCore::DeviceOrientationData::create):
(WebCore::DeviceOrientationData::DeviceOrientationData):
(WebCore::DeviceOrientationData::alpha): Deleted.
(WebCore::DeviceOrientationData::beta): Deleted.
(WebCore::DeviceOrientationData::gamma): Deleted.
(WebCore::DeviceOrientationData::absolute): Deleted.
(WebCore::DeviceOrientationData::canProvideAlpha): Deleted.
(WebCore::DeviceOrientationData::canProvideBeta): Deleted.
(WebCore::DeviceOrientationData::canProvideGamma): Deleted.
(WebCore::DeviceOrientationData::compassHeading): Deleted.
(WebCore::DeviceOrientationData::compassAccuracy): Deleted.
(WebCore::DeviceOrientationData::canProvideCompassHeading): Deleted.
(WebCore::DeviceOrientationData::canProvideCompassAccuracy): Deleted.
(WebCore::DeviceOrientationData::canProvideAbsolute): Deleted.
* dom/DeviceOrientationData.h:
(WebCore::DeviceOrientationData::create):
(WebCore::DeviceOrientationData::alpha):
(WebCore::DeviceOrientationData::beta):
(WebCore::DeviceOrientationData::gamma):
(WebCore::DeviceOrientationData::compassHeading):
(WebCore::DeviceOrientationData::compassAccuracy):
(WebCore::DeviceOrientationData::absolute):
Re-work using std::optional rather than an explicit bool/value pair.

* dom/DeviceOrientationEvent.cpp:
(WebCore::DeviceOrientationEvent::alpha):
(WebCore::DeviceOrientationEvent::beta):
(WebCore::DeviceOrientationEvent::gamma):
(WebCore::DeviceOrientationEvent::compassHeading):
(WebCore::DeviceOrientationEvent::compassAccuracy):
(WebCore::DeviceOrientationEvent::initDeviceOrientationEvent):
(WebCore::DeviceOrientationEvent::absolute):
* dom/DeviceOrientationEvent.h:
Implement IDL interface.

* dom/DeviceOrientationEvent.idl:
Update IDL to specify the correct nullability of attributes and arguments.

* platform/ios/DeviceMotionClientIOS.mm:
(WebCore::DeviceMotionClientIOS::motionChanged):
* platform/ios/DeviceOrientationClientIOS.mm:
(WebCore::DeviceOrientationClientIOS::orientationChanged):
Update for use of std:optional.

Source/WebKit/mac:

* WebView/WebDeviceOrientation.mm:
(convert):
(-[WebDeviceOrientation initWithCanProvideAlpha:alpha:canProvideBeta:beta:canProvideGamma:gamma:]):
Update for new use of std::optional.

LayoutTests:

* fast/dom/DeviceMotion/optional-event-properties-expected.txt:
* fast/dom/DeviceMotion/script-tests/optional-event-properties.js:
Update test to account for slightly stricter, but more consistent IDL conversion rules.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (210740 => 210741)


--- trunk/LayoutTests/ChangeLog	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/LayoutTests/ChangeLog	2017-01-13 21:19:55 UTC (rev 210741)
@@ -1,3 +1,14 @@
+2017-01-13  Sam Weinig  <[email protected]>
+
+        [WebIDL] Remove custom bindings for DeviceMotionEvent and DeviceOrientationEvent
+        https://bugs.webkit.org/show_bug.cgi?id=167006
+
+        Reviewed by Geoffrey Garen.
+
+        * fast/dom/DeviceMotion/optional-event-properties-expected.txt:
+        * fast/dom/DeviceMotion/script-tests/optional-event-properties.js:
+        Update test to account for slightly stricter, but more consistent IDL conversion rules.
+
 2017-01-13  Eric Carlson  <[email protected]>
 
         REGRESSION (r210621): [mac-wk2] LayoutTest fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html timing out

Modified: trunk/LayoutTests/fast/dom/DeviceMotion/optional-event-properties-expected.txt (210740 => 210741)


--- trunk/LayoutTests/fast/dom/DeviceMotion/optional-event-properties-expected.txt	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/LayoutTests/fast/dom/DeviceMotion/optional-event-properties-expected.txt	2017-01-13 21:19:55 UTC (rev 210741)
@@ -25,6 +25,7 @@
 PASS event.initDeviceMotionEvent('', false, false, {x: objectThrowingException, y: 1, z: 2}, {x: 3, y: 4, z: 5}, {alpha: 6, beta: 7, gamma: 8}, 9) threw exception Error: valueOf threw exception.
 PASS event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, {x: 3, y: objectThrowingException, z: 5}, {alpha: 6, beta: 7, gamma: 8}, 9) threw exception Error: valueOf threw exception.
 PASS event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, {x: 3, y: 4, z: 5}, {alpha: 6, beta: 7, gamma: objectThrowingException}, 9) threw exception Error: valueOf threw exception.
+PASS event.initDeviceMotionEvent('', false, false, '', '', '', '') threw exception TypeError: Type error.
 event.initDeviceMotionEvent('', false, false, {y: 1, x: 0}, {x: 3, z: 5}, {gamma: 8, beta: 7}, 9)
 PASS event.acceleration.x == 0 is true
 PASS event.acceleration.y == 1 is true
@@ -51,11 +52,6 @@
 PASS event.accelerationIncludingGravity == null is true
 PASS event.rotationRate == null is true
 PASS event.interval == null is true
-event.initDeviceMotionEvent('', false, false, '', '', '', '')
-PASS event.acceleration == null is true
-PASS event.accelerationIncludingGravity == null is true
-PASS event.rotationRate == null is true
-PASS event.interval == 0 is true
 event.initDeviceMotionEvent('', false, false, null, null, null, null)
 PASS event.acceleration == null is true
 PASS event.accelerationIncludingGravity == null is true

Modified: trunk/LayoutTests/fast/dom/DeviceMotion/script-tests/optional-event-properties.js (210740 => 210741)


--- trunk/LayoutTests/fast/dom/DeviceMotion/script-tests/optional-event-properties.js	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/LayoutTests/fast/dom/DeviceMotion/script-tests/optional-event-properties.js	2017-01-13 21:19:55 UTC (rev 210741)
@@ -38,6 +38,7 @@
 testException("event.initDeviceMotionEvent('', false, false, {x: objectThrowingException, y: 1, z: 2}, {x: 3, y: 4, z: 5}, {alpha: 6, beta: 7, gamma: 8}, 9)", "Error: valueOf threw exception");
 testException("event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, {x: 3, y: objectThrowingException, z: 5}, {alpha: 6, beta: 7, gamma: 8}, 9)", "Error: valueOf threw exception");
 testException("event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, {x: 3, y: 4, z: 5}, {alpha: 6, beta: 7, gamma: objectThrowingException}, 9)", "Error: valueOf threw exception");
+testException("event.initDeviceMotionEvent('', false, false, '', '', '', '')", "TypeError: Type error");
 
 evalAndLog("event.initDeviceMotionEvent('', false, false, {y: 1, x: 0}, {x: 3, z: 5}, {gamma: 8, beta: 7}, 9)");
 shouldBeTrue("event.acceleration.x == 0");
@@ -69,12 +70,6 @@
 shouldBeTrue("event.rotationRate == null");
 shouldBeTrue("event.interval == null");
 
-evalAndLog("event.initDeviceMotionEvent('', false, false, '', '', '', '')");
-shouldBeTrue("event.acceleration == null");
-shouldBeTrue("event.accelerationIncludingGravity == null");
-shouldBeTrue("event.rotationRate == null");
-shouldBeTrue("event.interval == 0");
-
 evalAndLog("event.initDeviceMotionEvent('', false, false, null, null, null, null)");
 shouldBeTrue("event.acceleration == null");
 shouldBeTrue("event.accelerationIncludingGravity == null");

Modified: trunk/Source/WebCore/CMakeLists.txt (210740 => 210741)


--- trunk/Source/WebCore/CMakeLists.txt	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/CMakeLists.txt	2017-01-13 21:19:55 UTC (rev 210741)
@@ -1108,8 +1108,6 @@
     bindings/js/JSDOMWindowProperties.cpp
     bindings/js/JSDOMWindowShell.cpp
     bindings/js/JSDOMWrapper.cpp
-    bindings/js/JSDeviceMotionEventCustom.cpp
-    bindings/js/JSDeviceOrientationEventCustom.cpp
     bindings/js/JSDocumentCustom.cpp
     bindings/js/JSDocumentFragmentCustom.cpp
     bindings/js/JSElementCustom.cpp

Modified: trunk/Source/WebCore/ChangeLog (210740 => 210741)


--- trunk/Source/WebCore/ChangeLog	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/ChangeLog	2017-01-13 21:19:55 UTC (rev 210741)
@@ -1,3 +1,106 @@
+2017-01-13  Sam Weinig  <[email protected]>
+
+        [WebIDL] Remove custom bindings for DeviceMotionEvent and DeviceOrientationEvent
+        https://bugs.webkit.org/show_bug.cgi?id=167006
+
+        Reviewed by Geoffrey Garen.
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSBindingsAllInOne.cpp:
+        * bindings/js/JSDeviceMotionEventCustom.cpp: Removed.
+        * bindings/js/JSDeviceOrientationEventCustom.cpp: Removed.
+        Remove Custom bindings files.
+
+        * dom/DeviceMotionData.cpp:
+        (WebCore::DeviceMotionData::create):
+        (WebCore::DeviceMotionData::DeviceMotionData):
+        (WebCore::DeviceMotionData::Acceleration::create): Deleted.
+        (WebCore::DeviceMotionData::Acceleration::Acceleration): Deleted.
+        (WebCore::DeviceMotionData::RotationRate::create): Deleted.
+        (WebCore::DeviceMotionData::RotationRate::RotationRate): Deleted.
+        * dom/DeviceMotionData.h:
+        (WebCore::DeviceMotionData::Acceleration::create):
+        (WebCore::DeviceMotionData::Acceleration::x):
+        (WebCore::DeviceMotionData::Acceleration::y):
+        (WebCore::DeviceMotionData::Acceleration::z):
+        (WebCore::DeviceMotionData::Acceleration::Acceleration):
+        (WebCore::DeviceMotionData::RotationRate::create):
+        (WebCore::DeviceMotionData::RotationRate::alpha):
+        (WebCore::DeviceMotionData::RotationRate::beta):
+        (WebCore::DeviceMotionData::RotationRate::gamma):
+        (WebCore::DeviceMotionData::RotationRate::RotationRate):
+        (WebCore::DeviceMotionData::interval):
+        (WebCore::DeviceMotionData::Acceleration::canProvideX): Deleted.
+        (WebCore::DeviceMotionData::Acceleration::canProvideY): Deleted.
+        (WebCore::DeviceMotionData::Acceleration::canProvideZ): Deleted.
+        (WebCore::DeviceMotionData::RotationRate::canProvideAlpha): Deleted.
+        (WebCore::DeviceMotionData::RotationRate::canProvideBeta): Deleted.
+        (WebCore::DeviceMotionData::RotationRate::canProvideGamma): Deleted.
+        (WebCore::DeviceMotionData::canProvideInterval): Deleted.
+        Re-work using std::optional rather than an explicit bool/value pair.
+
+        * dom/DeviceMotionEvent.cpp:
+        (WebCore::convert):
+        (WebCore::DeviceMotionEvent::acceleration):
+        (WebCore::DeviceMotionEvent::accelerationIncludingGravity):
+        (WebCore::DeviceMotionEvent::rotationRate):
+        (WebCore::DeviceMotionEvent::interval):
+        (WebCore::DeviceMotionEvent::initDeviceMotionEvent):
+        * dom/DeviceMotionEvent.h:
+        Implement IDL interface. For now, we have duplicate structs for
+        Acceleration and RotationRate (one here, one in DeviceMotionData)
+        which can be consolidated in the future.
+
+        * dom/DeviceMotionEvent.idl:
+        Add dictionaries for Acceleration and RotationRate, and update IDL to
+        specify the correct nullability of attributes and arguments.
+
+        * dom/DeviceOrientationData.cpp:
+        (WebCore::DeviceOrientationData::create):
+        (WebCore::DeviceOrientationData::DeviceOrientationData):
+        (WebCore::DeviceOrientationData::alpha): Deleted.
+        (WebCore::DeviceOrientationData::beta): Deleted.
+        (WebCore::DeviceOrientationData::gamma): Deleted.
+        (WebCore::DeviceOrientationData::absolute): Deleted.
+        (WebCore::DeviceOrientationData::canProvideAlpha): Deleted.
+        (WebCore::DeviceOrientationData::canProvideBeta): Deleted.
+        (WebCore::DeviceOrientationData::canProvideGamma): Deleted.
+        (WebCore::DeviceOrientationData::compassHeading): Deleted.
+        (WebCore::DeviceOrientationData::compassAccuracy): Deleted.
+        (WebCore::DeviceOrientationData::canProvideCompassHeading): Deleted.
+        (WebCore::DeviceOrientationData::canProvideCompassAccuracy): Deleted.
+        (WebCore::DeviceOrientationData::canProvideAbsolute): Deleted.
+        * dom/DeviceOrientationData.h:
+        (WebCore::DeviceOrientationData::create):
+        (WebCore::DeviceOrientationData::alpha):
+        (WebCore::DeviceOrientationData::beta):
+        (WebCore::DeviceOrientationData::gamma):
+        (WebCore::DeviceOrientationData::compassHeading):
+        (WebCore::DeviceOrientationData::compassAccuracy):
+        (WebCore::DeviceOrientationData::absolute):
+        Re-work using std::optional rather than an explicit bool/value pair.
+
+        * dom/DeviceOrientationEvent.cpp:
+        (WebCore::DeviceOrientationEvent::alpha):
+        (WebCore::DeviceOrientationEvent::beta):
+        (WebCore::DeviceOrientationEvent::gamma):
+        (WebCore::DeviceOrientationEvent::compassHeading):
+        (WebCore::DeviceOrientationEvent::compassAccuracy):
+        (WebCore::DeviceOrientationEvent::initDeviceOrientationEvent):
+        (WebCore::DeviceOrientationEvent::absolute):
+        * dom/DeviceOrientationEvent.h:
+        Implement IDL interface.
+
+        * dom/DeviceOrientationEvent.idl:
+        Update IDL to specify the correct nullability of attributes and arguments.
+
+        * platform/ios/DeviceMotionClientIOS.mm:
+        (WebCore::DeviceMotionClientIOS::motionChanged):
+        * platform/ios/DeviceOrientationClientIOS.mm:
+        (WebCore::DeviceOrientationClientIOS::orientationChanged):
+        Update for use of std:optional.
+
 2017-01-13  Zan Dobersek  <[email protected]>
 
         [GStreamer] Cache the accelerated capability of MediaPlayerClient in MediaPlayerPrivateGStreamerBase

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (210740 => 210741)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-01-13 21:19:55 UTC (rev 210741)
@@ -1397,7 +1397,6 @@
 		31FB1A5D120A5D0600DC02A0 /* DeviceMotionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 31FB1A55120A5D0600DC02A0 /* DeviceMotionEvent.h */; };
 		31FB1A65120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31FB1A63120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp */; };
 		31FB1A66120A5D3F00DC02A0 /* JSDeviceMotionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 31FB1A64120A5D3F00DC02A0 /* JSDeviceMotionEvent.h */; };
-		31FB1A6C120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31FB1A6B120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp */; };
 		31FE6DFA15004C2A0004EBC4 /* NotificationPermissionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 31EC1DAC14FF26EA00C94662 /* NotificationPermissionCallback.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		3314ACEB10892086000F0E56 /* JSExceptionBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3314ACE910892086000F0E56 /* JSExceptionBase.cpp */; };
 		3314ACEC10892086000F0E56 /* JSExceptionBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 3314ACEA10892086000F0E56 /* JSExceptionBase.h */; };
@@ -2371,7 +2370,6 @@
 		5905ADBF1302F3CE00F116DF /* XMLTreeViewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5905ADBD1302F3CE00F116DF /* XMLTreeViewer.cpp */; };
 		5905ADC01302F3CE00F116DF /* XMLTreeViewer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5905ADBE1302F3CE00F116DF /* XMLTreeViewer.h */; };
 		590E1B4911E4EF4B0069F784 /* DeviceOrientationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 590E1B4811E4EF4B0069F784 /* DeviceOrientationData.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		590E1B4B11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */; };
 		59309A1111F4AE5800250603 /* DeviceOrientationClientMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */; };
 		59309A1311F4AE6A00250603 /* DeviceOrientationClientMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		598365DD1355F557001B185D /* JSPositionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 598365DC1355F53C001B185D /* JSPositionCallback.h */; };
@@ -8548,7 +8546,6 @@
 		31FB1A56120A5D0600DC02A0 /* DeviceMotionEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DeviceMotionEvent.idl; sourceTree = "<group>"; };
 		31FB1A63120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceMotionEvent.cpp; sourceTree = "<group>"; };
 		31FB1A64120A5D3F00DC02A0 /* JSDeviceMotionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDeviceMotionEvent.h; sourceTree = "<group>"; };
-		31FB1A6B120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceMotionEventCustom.cpp; sourceTree = "<group>"; };
 		3314ACE910892086000F0E56 /* JSExceptionBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSExceptionBase.cpp; sourceTree = "<group>"; };
 		3314ACEA10892086000F0E56 /* JSExceptionBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSExceptionBase.h; sourceTree = "<group>"; };
 		331FF67DE197B57393C46A7F /* RenderMathMLPadded.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLPadded.h; sourceTree = "<group>"; };
@@ -9624,7 +9621,6 @@
 		5905ADBD1302F3CE00F116DF /* XMLTreeViewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLTreeViewer.cpp; sourceTree = "<group>"; };
 		5905ADBE1302F3CE00F116DF /* XMLTreeViewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLTreeViewer.h; sourceTree = "<group>"; };
 		590E1B4811E4EF4B0069F784 /* DeviceOrientationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationData.h; sourceTree = "<group>"; };
-		590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceOrientationEventCustom.cpp; sourceTree = "<group>"; };
 		59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceOrientationClientMock.cpp; sourceTree = "<group>"; };
 		59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationClientMock.h; sourceTree = "<group>"; };
 		5958F1CB1343917C0080B31F /* XMLViewer.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = XMLViewer.css; sourceTree = "<group>"; };
@@ -22104,8 +22100,6 @@
 				AD726FEA16D9F40B003A4E6D /* JSCSSStyleDeclarationCustom.h */,
 				9BC5F9DF1D5AAF6A002B749D /* JSCustomElementRegistryCustom.cpp */,
 				DEC2975D1B4DEB2A005F5945 /* JSCustomEventCustom.cpp */,
-				31FB1A6B120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp */,
-				590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */,
 				49C7BA8C1042F5B10009D447 /* JSDocumentCustom.cpp */,
 				ADDA94BF19686F8000453029 /* JSDocumentCustom.h */,
 				BC64649B11D8238C006455B0 /* JSDOMStringMapCustom.cpp */,
@@ -29883,9 +29877,7 @@
 				4162A4571011464700DFF3ED /* JSDedicatedWorkerGlobalScope.cpp in Sources */,
 				FDA15ED112B03F94003A583A /* JSDelayNode.cpp in Sources */,
 				31FB1A65120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp in Sources */,
-				31FB1A6C120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp in Sources */,
 				59A86006119DAF7F00DEF1EF /* JSDeviceOrientationEvent.cpp in Sources */,
-				590E1B4B11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp in Sources */,
 				659DDC8209E198BA001BF3C6 /* JSDocument.cpp in Sources */,
 				1221E05D1C02B444006A1A00 /* JSDocumentAnimation.cpp in Sources */,
 				49C7BA8D1042F5B10009D447 /* JSDocumentCustom.cpp in Sources */,

Modified: trunk/Source/WebCore/bindings/IDLTypes.h (210740 => 210741)


--- trunk/Source/WebCore/bindings/IDLTypes.h	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/bindings/IDLTypes.h	2017-01-13 21:19:55 UTC (rev 210741)
@@ -139,9 +139,9 @@
     using InnerType = T;
 
     using NullableType = typename T::NullableType;
-    static inline decltype(T::nullValue()) nullValue() { return T::nullValue(); }
+    static inline auto nullValue() -> decltype(T::nullValue()) { return T::nullValue(); }
     template<typename U> static inline bool isNullValue(U&& value) { return T::isNullValue(std::forward<U>(value)); }
-    template<typename U> static inline U&& extractValueFromNullable(U&& value) { return T::extractValueFromNullable(std::forward<U>(value)); }
+    template<typename U> static inline auto extractValueFromNullable(U&& value) -> decltype(T::extractValueFromNullable(std::forward<U>(value))) { return T::extractValueFromNullable(std::forward<U>(value)); }
 };
 
 template<typename T> struct IDLSequence : IDLType<Vector<typename T::ImplementationType>> {

Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (210740 => 210741)


--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp	2017-01-13 21:19:55 UTC (rev 210741)
@@ -56,7 +56,6 @@
 #include "JSDOMWindowProperties.cpp"
 #include "JSDOMWindowShell.cpp"
 #include "JSDOMWrapper.cpp"
-#include "JSDeviceOrientationEventCustom.cpp"
 #include "JSDocumentCustom.cpp"
 #include "JSDocumentFragmentCustom.cpp"
 #include "JSElementCustom.cpp"

Deleted: trunk/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp (210740 => 210741)


--- trunk/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp	2017-01-13 21:19:55 UTC (rev 210741)
@@ -1,197 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(DEVICE_ORIENTATION)
-
-#include "JSDeviceMotionEvent.h"
-
-#include "DeviceMotionData.h"
-#include "DeviceMotionEvent.h"
-#include <heap/HeapInlines.h>
-#include <runtime/AuxiliaryBarrierInlines.h>
-#include <runtime/IdentifierInlines.h>
-#include <runtime/JSCJSValueInlines.h>
-#include <runtime/JSObjectInlines.h>
-#include <runtime/ObjectConstructor.h>
-#include <runtime/StructureInlines.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-static RefPtr<DeviceMotionData::Acceleration> readAccelerationArgument(JSValue value, ExecState& state)
-{
-    if (value.isUndefinedOrNull())
-        return nullptr;
-
-    VM& vm = state.vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-
-    // Given the above test, this will always yield an object.
-    JSObject* object = value.toObject(&state);
-    ASSERT(!scope.exception());
-
-    JSValue xValue = object->get(&state, Identifier::fromString(&state, "x"));
-    RETURN_IF_EXCEPTION(scope, nullptr);
-    bool canProvideX = !xValue.isUndefinedOrNull();
-    double x = xValue.toNumber(&state);
-    RETURN_IF_EXCEPTION(scope, nullptr);
-
-    JSValue yValue = object->get(&state, Identifier::fromString(&state, "y"));
-    RETURN_IF_EXCEPTION(scope, nullptr);
-    bool canProvideY = !yValue.isUndefinedOrNull();
-    double y = yValue.toNumber(&state);
-    RETURN_IF_EXCEPTION(scope, nullptr);
-
-    JSValue zValue = object->get(&state, Identifier::fromString(&state, "z"));
-    RETURN_IF_EXCEPTION(scope, nullptr);
-    bool canProvideZ = !zValue.isUndefinedOrNull();
-    double z = zValue.toNumber(&state);
-    RETURN_IF_EXCEPTION(scope, nullptr);
-
-    if (!canProvideX && !canProvideY && !canProvideZ)
-        return nullptr;
-
-    return DeviceMotionData::Acceleration::create(canProvideX, x, canProvideY, y, canProvideZ, z);
-}
-
-static RefPtr<DeviceMotionData::RotationRate> readRotationRateArgument(JSValue value, ExecState& state)
-{
-    if (value.isUndefinedOrNull())
-        return nullptr;
-
-    VM& vm = state.vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-
-    // Given the above test, this will always yield an object.
-    JSObject* object = value.toObject(&state);
-    ASSERT(!scope.exception());
-
-    JSValue alphaValue = object->get(&state, Identifier::fromString(&state, "alpha"));
-    RETURN_IF_EXCEPTION(scope, nullptr);
-    bool canProvideAlpha = !alphaValue.isUndefinedOrNull();
-    double alpha = alphaValue.toNumber(&state);
-    RETURN_IF_EXCEPTION(scope, nullptr);
-
-    JSValue betaValue = object->get(&state, Identifier::fromString(&state, "beta"));
-    RETURN_IF_EXCEPTION(scope, nullptr);
-    bool canProvideBeta = !betaValue.isUndefinedOrNull();
-    double beta = betaValue.toNumber(&state);
-    RETURN_IF_EXCEPTION(scope, nullptr);
-
-    JSValue gammaValue = object->get(&state, Identifier::fromString(&state, "gamma"));
-    RETURN_IF_EXCEPTION(scope, nullptr);
-    bool canProvideGamma = !gammaValue.isUndefinedOrNull();
-    double gamma = gammaValue.toNumber(&state);
-    RETURN_IF_EXCEPTION(scope, nullptr);
-
-    if (!canProvideAlpha && !canProvideBeta && !canProvideGamma)
-        return nullptr;
-
-    return DeviceMotionData::RotationRate::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma);
-}
-
-static JSObject* createAccelerationObject(const DeviceMotionData::Acceleration* acceleration, ExecState& state)
-{
-    JSObject* object = constructEmptyObject(&state);
-    object->putDirect(state.vm(), Identifier::fromString(&state, "x"), acceleration->canProvideX() ? jsNumber(acceleration->x()) : jsNull());
-    object->putDirect(state.vm(), Identifier::fromString(&state, "y"), acceleration->canProvideY() ? jsNumber(acceleration->y()) : jsNull());
-    object->putDirect(state.vm(), Identifier::fromString(&state, "z"), acceleration->canProvideZ() ? jsNumber(acceleration->z()) : jsNull());
-    return object;
-}
-
-static JSObject* createRotationRateObject(const DeviceMotionData::RotationRate* rotationRate, ExecState& state)
-{
-    JSObject* object = constructEmptyObject(&state);
-    object->putDirect(state.vm(), Identifier::fromString(&state, "alpha"), rotationRate->canProvideAlpha() ? jsNumber(rotationRate->alpha()) : jsNull());
-    object->putDirect(state.vm(), Identifier::fromString(&state, "beta"),  rotationRate->canProvideBeta()  ? jsNumber(rotationRate->beta())  : jsNull());
-    object->putDirect(state.vm(), Identifier::fromString(&state, "gamma"), rotationRate->canProvideGamma() ? jsNumber(rotationRate->gamma()) : jsNull());
-    return object;
-}
-
-JSValue JSDeviceMotionEvent::acceleration(ExecState& state) const
-{
-    DeviceMotionEvent& imp = wrapped();
-    if (!imp.deviceMotionData()->acceleration())
-        return jsNull();
-    return createAccelerationObject(imp.deviceMotionData()->acceleration(), state);
-}
-
-JSValue JSDeviceMotionEvent::accelerationIncludingGravity(ExecState& state) const
-{
-    DeviceMotionEvent& imp = wrapped();
-    if (!imp.deviceMotionData()->accelerationIncludingGravity())
-        return jsNull();
-    return createAccelerationObject(imp.deviceMotionData()->accelerationIncludingGravity(), state);
-}
-
-JSValue JSDeviceMotionEvent::rotationRate(ExecState& state) const
-{
-    DeviceMotionEvent& imp = wrapped();
-    if (!imp.deviceMotionData()->rotationRate())
-        return jsNull();
-    return createRotationRateObject(imp.deviceMotionData()->rotationRate(), state);
-}
-
-JSValue JSDeviceMotionEvent::interval(ExecState&) const
-{
-    DeviceMotionEvent& imp = wrapped();
-    if (!imp.deviceMotionData()->canProvideInterval())
-        return jsNull();
-    return jsNumber(imp.deviceMotionData()->interval());
-}
-
-JSValue JSDeviceMotionEvent::initDeviceMotionEvent(ExecState& state)
-{
-    VM& vm = state.vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-
-    const String type = state.argument(0).toWTFString(&state);
-    bool bubbles = state.argument(1).toBoolean(&state);
-    bool cancelable = state.argument(2).toBoolean(&state);
-
-    // If any of the parameters are null or undefined, mark them as not provided.
-    // Otherwise, use the standard _javascript_ conversion.
-    RefPtr<DeviceMotionData::Acceleration> acceleration = readAccelerationArgument(state.argument(3), state);
-    RETURN_IF_EXCEPTION(scope, JSValue());
-
-    RefPtr<DeviceMotionData::Acceleration> accelerationIncludingGravity = readAccelerationArgument(state.argument(4), state);
-    RETURN_IF_EXCEPTION(scope, JSValue());
-
-    RefPtr<DeviceMotionData::RotationRate> rotationRate = readRotationRateArgument(state.argument(5), state);
-    RETURN_IF_EXCEPTION(scope, JSValue());
-
-    bool intervalProvided = !state.argument(6).isUndefinedOrNull();
-    double interval = state.argument(6).toNumber(&state);
-    auto deviceMotionData = DeviceMotionData::create(WTFMove(acceleration), WTFMove(accelerationIncludingGravity), WTFMove(rotationRate), intervalProvided, interval);
-    wrapped().initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData.ptr());
-    return jsUndefined();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(DEVICE_ORIENTATION)

Deleted: trunk/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp (210740 => 210741)


--- trunk/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp	2017-01-13 21:19:55 UTC (rev 210741)
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(DEVICE_ORIENTATION)
-
-#include "JSDeviceOrientationEvent.h"
-
-#include "DeviceOrientationData.h"
-#include "DeviceOrientationEvent.h"
-#include <heap/HeapInlines.h>
-#include <runtime/JSCJSValueInlines.h>
-#include <runtime/StructureInlines.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-JSValue JSDeviceOrientationEvent::alpha(ExecState&) const
-{
-    DeviceOrientationEvent& imp = wrapped();
-    if (!imp.orientation()->canProvideAlpha())
-        return jsNull();
-    return jsNumber(imp.orientation()->alpha());
-}
-
-JSValue JSDeviceOrientationEvent::beta(ExecState&) const
-{
-    DeviceOrientationEvent& imp = wrapped();
-    if (!imp.orientation()->canProvideBeta())
-        return jsNull();
-    return jsNumber(imp.orientation()->beta());
-}
-
-JSValue JSDeviceOrientationEvent::gamma(ExecState&) const
-{
-    DeviceOrientationEvent& imp = wrapped();
-    if (!imp.orientation()->canProvideGamma())
-        return jsNull();
-    return jsNumber(imp.orientation()->gamma());
-}
-
-#if PLATFORM(IOS)
-JSValue JSDeviceOrientationEvent::webkitCompassHeading(ExecState&) const
-{
-    DeviceOrientationEvent& imp = wrapped();
-    if (!imp.orientation()->canProvideCompassHeading())
-        return jsNull();
-    return jsNumber(imp.orientation()->compassHeading());
-}
-
-JSValue JSDeviceOrientationEvent::webkitCompassAccuracy(ExecState&) const
-{
-    DeviceOrientationEvent& imp = wrapped();
-    if (!imp.orientation()->canProvideCompassAccuracy())
-        return jsNull();
-    return jsNumber(imp.orientation()->compassAccuracy());
-}
-#endif
-
-#if !PLATFORM(IOS)
-JSValue JSDeviceOrientationEvent::absolute(ExecState&) const
-{
-    DeviceOrientationEvent& imp = wrapped();
-    if (!imp.orientation()->canProvideAbsolute())
-        return jsNull();
-    return jsBoolean(imp.orientation()->absolute());
-}
-#endif
-
-JSValue JSDeviceOrientationEvent::initDeviceOrientationEvent(ExecState& state)
-{
-    const String type = state.argument(0).toWTFString(&state);
-    bool bubbles = state.argument(1).toBoolean(&state);
-    bool cancelable = state.argument(2).toBoolean(&state);
-    // If alpha, beta or gamma are null or undefined, mark them as not provided.
-    // Otherwise, use the standard _javascript_ conversion.
-    bool alphaProvided = !state.argument(3).isUndefinedOrNull();
-    double alpha = state.argument(3).toNumber(&state);
-    bool betaProvided = !state.argument(4).isUndefinedOrNull();
-    double beta = state.argument(4).toNumber(&state);
-    bool gammaProvided = !state.argument(5).isUndefinedOrNull();
-    double gamma = state.argument(5).toNumber(&state);
-#if PLATFORM(IOS)
-    bool compassHeadingProvided = !state.argument(6).isUndefinedOrNull();
-    double compassHeading = state.argument(6).toNumber(&state);
-    bool compassAccuracyProvided = !state.argument(7).isUndefinedOrNull();
-    double compassAccuracy = state.argument(7).toNumber(&state);
-    RefPtr<DeviceOrientationData> orientation = DeviceOrientationData::create(alphaProvided, alpha, betaProvided, beta, gammaProvided, gamma, compassHeadingProvided, compassHeading, compassAccuracyProvided, compassAccuracy);
-#else
-    bool absoluteProvided = !state.argument(6).isUndefinedOrNull();
-    bool absolute = state.argument(6).toBoolean(&state);
-    RefPtr<DeviceOrientationData> orientation = DeviceOrientationData::create(alphaProvided, alpha, betaProvided, beta, gammaProvided, gamma, absoluteProvided, absolute);
-#endif
-    wrapped().initDeviceOrientationEvent(type, bubbles, cancelable, orientation.get());
-    return jsUndefined();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(DEVICE_ORIENTATION)

Modified: trunk/Source/WebCore/dom/DeviceMotionData.cpp (210740 => 210741)


--- trunk/Source/WebCore/dom/DeviceMotionData.cpp	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/dom/DeviceMotionData.cpp	2017-01-13 21:19:55 UTC (rev 210741)
@@ -28,62 +28,20 @@
 
 namespace WebCore {
 
-Ref<DeviceMotionData::Acceleration> DeviceMotionData::Acceleration::create(bool canProvideX, double x,
-                                                                           bool canProvideY, double y,
-                                                                           bool canProvideZ, double z)
-{
-    return adoptRef(*new DeviceMotionData::Acceleration(canProvideX, x, canProvideY, y, canProvideZ, z));
-}
-
-DeviceMotionData::Acceleration::Acceleration(bool canProvideX, double x, bool canProvideY, double y, bool canProvideZ, double z)
-    : m_x(x)
-    , m_y(y)
-    , m_z(z)
-    , m_canProvideX(canProvideX)
-    , m_canProvideY(canProvideY)
-    , m_canProvideZ(canProvideZ)
-
-{
-}
-
-Ref<DeviceMotionData::RotationRate> DeviceMotionData::RotationRate::create(bool canProvideAlpha, double alpha,
-                                                                           bool canProvideBeta, double beta,
-                                                                           bool canProvideGamma, double gamma)
-{
-    return adoptRef(*new DeviceMotionData::RotationRate(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma));
-}
-
-DeviceMotionData::RotationRate::RotationRate(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
-    : m_alpha(alpha)
-    , m_beta(beta)
-    , m_gamma(gamma)
-    , m_canProvideAlpha(canProvideAlpha)
-    , m_canProvideBeta(canProvideBeta)
-    , m_canProvideGamma(canProvideGamma)
-{
-}
-
 Ref<DeviceMotionData> DeviceMotionData::create()
 {
     return adoptRef(*new DeviceMotionData);
 }
 
-Ref<DeviceMotionData> DeviceMotionData::create(RefPtr<Acceleration>&& acceleration, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&& rotationRate, bool canProvideInterval, double interval)
+Ref<DeviceMotionData> DeviceMotionData::create(RefPtr<Acceleration>&& acceleration, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&& rotationRate, std::optional<double> interval)
 {
-    return adoptRef(*new DeviceMotionData(WTFMove(acceleration), WTFMove(accelerationIncludingGravity), WTFMove(rotationRate), canProvideInterval, interval));
+    return adoptRef(*new DeviceMotionData(WTFMove(acceleration), WTFMove(accelerationIncludingGravity), WTFMove(rotationRate), interval));
 }
 
-DeviceMotionData::DeviceMotionData()
-    : m_canProvideInterval(false)
-    , m_interval(0)
-{
-}
-
-DeviceMotionData::DeviceMotionData(RefPtr<Acceleration>&& acceleration, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&& rotationRate, bool canProvideInterval, double interval)
+DeviceMotionData::DeviceMotionData(RefPtr<Acceleration>&& acceleration, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&& rotationRate, std::optional<double> interval)
     : m_acceleration(WTFMove(acceleration))
     , m_accelerationIncludingGravity(WTFMove(accelerationIncludingGravity))
     , m_rotationRate(WTFMove(rotationRate))
-    , m_canProvideInterval(canProvideInterval)
     , m_interval(interval)
 {
 }

Modified: trunk/Source/WebCore/dom/DeviceMotionData.h (210740 => 210741)


--- trunk/Source/WebCore/dom/DeviceMotionData.h	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/dom/DeviceMotionData.h	2017-01-13 21:19:55 UTC (rev 210741)
@@ -25,6 +25,7 @@
 
 #pragma once
 
+#include <wtf/Optional.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 
@@ -34,70 +35,79 @@
 public:
     class Acceleration : public RefCounted<DeviceMotionData::Acceleration> {
     public:
-        WEBCORE_EXPORT static Ref<Acceleration> create(bool canProvideX, double x, bool canProvideY, double y, bool canProvideZ, double z);
+        static Ref<Acceleration> create()
+        {
+            return adoptRef(*new Acceleration);
+        }
+        static Ref<Acceleration> create(std::optional<double> x, std::optional<double> y, std::optional<double> z)
+        {
+            return adoptRef(*new Acceleration(x, y, z));
+        }
 
-        bool canProvideX() const { return m_canProvideX; }
-        bool canProvideY() const { return m_canProvideY; }
-        bool canProvideZ() const { return m_canProvideZ; }
+        std::optional<double> x() const { return m_x; }
+        std::optional<double> y() const { return m_y; }
+        std::optional<double> z() const { return m_z; }
 
-        double x() const { return m_x; }
-        double y() const { return m_y; }
-        double z() const { return m_z; }
-
     private:
-        Acceleration(bool canProvideX, double x, bool canProvideY, double y, bool canProvideZ, double z);
+        Acceleration() = default;
+        Acceleration(std::optional<double> x, std::optional<double> y, std::optional<double> z)
+            : m_x(x)
+            , m_y(y)
+            , m_z(z)
+        {
+        }
 
-        double m_x;
-        double m_y;
-        double m_z;
-
-        bool m_canProvideX;
-        bool m_canProvideY;
-        bool m_canProvideZ;
+        std::optional<double> m_x;
+        std::optional<double> m_y;
+        std::optional<double> m_z;
     };
 
     class RotationRate : public RefCounted<DeviceMotionData::RotationRate> {
     public:
-        WEBCORE_EXPORT static Ref<RotationRate> create(bool canProvideAlpha, double alpha, bool canProvideBeta,  double beta, bool canProvideGamma, double gamma);
+        static Ref<RotationRate> create()
+        {
+            return adoptRef(*new RotationRate);
+        }
+        static Ref<RotationRate> create(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma)
+        {
+            return adoptRef(*new RotationRate(alpha, beta, gamma));
+        }
 
-        bool canProvideAlpha() const { return m_canProvideAlpha; }
-        bool canProvideBeta() const { return m_canProvideBeta; }
-        bool canProvideGamma() const { return m_canProvideGamma; }
+        std::optional<double> alpha() const { return m_alpha; }
+        std::optional<double> beta() const { return m_beta; }
+        std::optional<double> gamma() const { return m_gamma; }
 
-        double alpha() const { return m_alpha; }
-        double beta() const { return m_beta; }
-        double gamma() const { return m_gamma; }
-
     private:
-        RotationRate(bool canProvideAlpha, double alpha, bool canProvideBeta,  double beta, bool canProvideGamma, double gamma);
+        RotationRate() = default;
+        RotationRate(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma)
+            : m_alpha(alpha)
+            , m_beta(beta)
+            , m_gamma(gamma)
+        {
+        }
 
-        double m_alpha;
-        double m_beta;
-        double m_gamma;
-
-        bool m_canProvideAlpha;
-        bool m_canProvideBeta;
-        bool m_canProvideGamma;
+        std::optional<double> m_alpha;
+        std::optional<double> m_beta;
+        std::optional<double> m_gamma;
     };
 
     WEBCORE_EXPORT static Ref<DeviceMotionData> create();
-    WEBCORE_EXPORT static Ref<DeviceMotionData> create(RefPtr<Acceleration>&&, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&&, bool canProvideInterval, double interval);
+    WEBCORE_EXPORT static Ref<DeviceMotionData> create(RefPtr<Acceleration>&&, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&&, std::optional<double> interval);
 
     const Acceleration* acceleration() const { return m_acceleration.get(); }
     const Acceleration* accelerationIncludingGravity() const { return m_accelerationIncludingGravity.get(); }
     const RotationRate* rotationRate() const { return m_rotationRate.get(); }
-    double interval() const { return m_interval; }
-    bool canProvideInterval() const { return m_canProvideInterval; }
+    
+    std::optional<double> interval() const { return m_interval; }
 
 private:
-    DeviceMotionData();
-    DeviceMotionData(RefPtr<Acceleration>&&, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&&, bool canProvideInterval, double interval);
+    DeviceMotionData() = default;
+    DeviceMotionData(RefPtr<Acceleration>&&, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&&, std::optional<double> interval);
 
     RefPtr<Acceleration> m_acceleration;
     RefPtr<Acceleration> m_accelerationIncludingGravity;
     RefPtr<RotationRate> m_rotationRate;
-    bool m_canProvideInterval;
-    double m_interval;
+    std::optional<double> m_interval;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/DeviceMotionEvent.cpp (210740 => 210741)


--- trunk/Source/WebCore/dom/DeviceMotionEvent.cpp	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/dom/DeviceMotionEvent.cpp	2017-01-13 21:19:55 UTC (rev 210741)
@@ -46,13 +46,71 @@
 {
 }
 
-void DeviceMotionEvent::initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceMotionData* deviceMotionData)
+static std::optional<DeviceMotionEvent::Acceleration> convert(const DeviceMotionData::Acceleration* acceleration)
 {
+    if (!acceleration)
+        return std::nullopt;
+
+    return DeviceMotionEvent::Acceleration { acceleration->x(), acceleration->y(), acceleration->z() };
+}
+
+static std::optional<DeviceMotionEvent::RotationRate> convert(const DeviceMotionData::RotationRate* rotationRate)
+{
+    if (!rotationRate)
+        return std::nullopt;
+
+    return DeviceMotionEvent::RotationRate { rotationRate->alpha(), rotationRate->beta(), rotationRate->gamma() };
+}
+
+static RefPtr<DeviceMotionData::Acceleration> convert(std::optional<DeviceMotionEvent::Acceleration>&& acceleration)
+{
+    if (!acceleration)
+        return nullptr;
+
+    if (!acceleration->x && !acceleration->y && !acceleration->z)
+        return nullptr;
+
+    return DeviceMotionData::Acceleration::create(acceleration->x, acceleration->y, acceleration->z);
+}
+
+static RefPtr<DeviceMotionData::RotationRate> convert(std::optional<DeviceMotionEvent::RotationRate>&& rotationRate)
+{
+    if (!rotationRate)
+        return nullptr;
+
+    if (!rotationRate->alpha && !rotationRate->beta && !rotationRate->gamma)
+        return nullptr;
+
+    return DeviceMotionData::RotationRate::create(rotationRate->alpha, rotationRate->beta, rotationRate->gamma);
+}
+
+std::optional<DeviceMotionEvent::Acceleration> DeviceMotionEvent::acceleration() const
+{
+    return convert(m_deviceMotionData->acceleration());
+}
+
+std::optional<DeviceMotionEvent::Acceleration> DeviceMotionEvent::accelerationIncludingGravity() const
+{
+    return convert(m_deviceMotionData->accelerationIncludingGravity());
+}
+
+std::optional<DeviceMotionEvent::RotationRate> DeviceMotionEvent::rotationRate() const
+{
+    return convert(m_deviceMotionData->rotationRate());
+}
+
+std::optional<double> DeviceMotionEvent::interval() const
+{
+    return m_deviceMotionData->interval();
+}
+
+void DeviceMotionEvent::initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<DeviceMotionEvent::Acceleration>&& acceleration, std::optional<DeviceMotionEvent::Acceleration>&& accelerationIncludingGravity, std::optional<DeviceMotionEvent::RotationRate>&& rotationRate, std::optional<double> interval)
+{
     if (dispatched())
         return;
 
     initEvent(type, bubbles, cancelable);
-    m_deviceMotionData = deviceMotionData;
+    m_deviceMotionData = DeviceMotionData::create(convert(WTFMove(acceleration)), convert(WTFMove(accelerationIncludingGravity)), convert(WTFMove(rotationRate)), interval);
 }
 
 EventInterface DeviceMotionEvent::eventInterface() const

Modified: trunk/Source/WebCore/dom/DeviceMotionEvent.h (210740 => 210741)


--- trunk/Source/WebCore/dom/DeviceMotionEvent.h	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/dom/DeviceMotionEvent.h	2017-01-13 21:19:55 UTC (rev 210741)
@@ -35,6 +35,20 @@
 public:
     virtual ~DeviceMotionEvent();
 
+    // FIXME: Merge this with DeviceMotionData::Acceleration
+    struct Acceleration {
+        std::optional<double> x;
+        std::optional<double> y;
+        std::optional<double> z;
+    };
+
+    // FIXME: Merge this with DeviceMotionData::RotationRate
+    struct RotationRate {
+        std::optional<double> alpha;
+        std::optional<double> beta;
+        std::optional<double> gamma;
+    };
+
     static Ref<DeviceMotionEvent> create(const AtomicString& eventType, DeviceMotionData* deviceMotionData)
     {
         return adoptRef(*new DeviceMotionEvent(eventType, deviceMotionData));
@@ -45,16 +59,19 @@
         return adoptRef(*new DeviceMotionEvent);
     }
 
-    void initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceMotionData*);
+    std::optional<Acceleration> acceleration() const;
+    std::optional<Acceleration> accelerationIncludingGravity() const;
+    std::optional<RotationRate> rotationRate() const;
+    std::optional<double> interval() const;
 
-    DeviceMotionData* deviceMotionData() const { return m_deviceMotionData.get(); }
+    void initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<Acceleration>&&, std::optional<Acceleration>&&, std::optional<RotationRate>&&, std::optional<double>);
 
-    EventInterface eventInterface() const override;
-
 private:
     DeviceMotionEvent();
     DeviceMotionEvent(const AtomicString& eventType, DeviceMotionData*);
 
+    EventInterface eventInterface() const override;
+
     RefPtr<DeviceMotionData> m_deviceMotionData;
 };
 

Modified: trunk/Source/WebCore/dom/DeviceMotionEvent.idl (210740 => 210741)


--- trunk/Source/WebCore/dom/DeviceMotionEvent.idl	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/dom/DeviceMotionEvent.idl	2017-01-13 21:19:55 UTC (rev 210741)
@@ -24,19 +24,36 @@
  */
 
 [
-    Conditional=DEVICE_ORIENTATION,
+    Conditional=DEVICE_ORIENTATION
 ] interface DeviceMotionEvent : Event {
-    [Custom] readonly attribute Acceleration acceleration;
-    [Custom] readonly attribute Acceleration accelerationIncludingGravity;
-    [Custom] readonly attribute RotationRate rotationRate;
-    [Custom] readonly attribute unrestricted double interval;
+    readonly attribute Acceleration? acceleration;
+    readonly attribute Acceleration? accelerationIncludingGravity;
+    readonly attribute RotationRate? rotationRate;
+    readonly attribute unrestricted double? interval;
 
-    [Custom] void initDeviceMotionEvent(optional DOMString type,
-                                        optional boolean bubbles,
-                                        optional boolean cancelable,
-                                        optional Acceleration acceleration,
-                                        optional Acceleration accelerationIncludingGravity,
-                                        optional RotationRate rotationRate,
-                                        optional unrestricted double interval);
+    void initDeviceMotionEvent(optional DOMString type = "",
+                               optional boolean bubbles = false,
+                               optional boolean cancelable = false,
+                               optional Acceleration? acceleration = null,
+                               optional Acceleration? accelerationIncludingGravity = null,
+                               optional RotationRate? rotationRate = null,
+                               optional unrestricted double? interval = null);
 };
 
+[
+    Conditional=DEVICE_ORIENTATION,
+    JSGenerateToJSObject
+] dictionary Acceleration {
+    double? x;
+    double? y;
+    double? z;
+};
+
+[
+    Conditional=DEVICE_ORIENTATION,
+    JSGenerateToJSObject
+] dictionary RotationRate {
+    double? alpha;
+    double? beta;
+    double? gamma;
+};

Modified: trunk/Source/WebCore/dom/DeviceOrientationData.cpp (210740 => 210741)


--- trunk/Source/WebCore/dom/DeviceOrientationData.cpp	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/dom/DeviceOrientationData.cpp	2017-01-13 21:19:55 UTC (rev 210741)
@@ -28,134 +28,38 @@
 
 namespace WebCore {
 
-Ref<DeviceOrientationData> DeviceOrientationData::create()
-{
-    return adoptRef(*new DeviceOrientationData);
-}
+#if PLATFORM(IOS)
 
-#if PLATFORM(IOS)
 // FIXME: We should reconcile the iOS and OpenSource differences.
-Ref<DeviceOrientationData> DeviceOrientationData::create(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideCompassHeading, double compassHeading, bool canProvideCompassAccuracy, double compassAccuracy)
+Ref<DeviceOrientationData> DeviceOrientationData::create(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> compassAccuracy)
 {
-    return adoptRef(*new DeviceOrientationData(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma, canProvideCompassHeading, compassHeading, canProvideCompassAccuracy, compassAccuracy));
+    return adoptRef(*new DeviceOrientationData(alpha, beta, gamma, compassHeading, compassAccuracy));
 }
-#else
-Ref<DeviceOrientationData> DeviceOrientationData::create(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideAbsolute, bool absolute)
-{
-    return adoptRef(*new DeviceOrientationData(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma, canProvideAbsolute, absolute));
-}
-#endif
 
-
-DeviceOrientationData::DeviceOrientationData()
-    : m_canProvideAlpha(false)
-    , m_canProvideBeta(false)
-    , m_canProvideGamma(false)
-#if !PLATFORM(IOS)
-    , m_canProvideAbsolute(false)
-#endif
-    , m_alpha(0)
-    , m_beta(0)
-    , m_gamma(0)
-#if PLATFORM(IOS)
-    , m_canProvideCompassHeading(false)
-    , m_canProvideCompassAccuracy(false)
-#else
-    , m_absolute(false)
-#endif
-{
-}
-
-#if PLATFORM(IOS)
-DeviceOrientationData::DeviceOrientationData(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideCompassHeading, double compassHeading, bool canProvideCompassAccuracy, double compassAccuracy)
-    : m_canProvideAlpha(canProvideAlpha)
-    , m_canProvideBeta(canProvideBeta)
-    , m_canProvideGamma(canProvideGamma)
-    , m_alpha(alpha)
+DeviceOrientationData::DeviceOrientationData(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> compassAccuracy)
+    : m_alpha(alpha)
     , m_beta(beta)
     , m_gamma(gamma)
-    , m_canProvideCompassHeading(canProvideCompassHeading)
-    , m_canProvideCompassAccuracy(canProvideCompassAccuracy)
     , m_compassHeading(compassHeading)
     , m_compassAccuracy(compassAccuracy)
-#else
-DeviceOrientationData::DeviceOrientationData(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideAbsolute, bool absolute)
-    : m_canProvideAlpha(canProvideAlpha)
-    , m_canProvideBeta(canProvideBeta)
-    , m_canProvideGamma(canProvideGamma)
-    , m_canProvideAbsolute(canProvideAbsolute)
-    , m_alpha(alpha)
-    , m_beta(beta)
-    , m_gamma(gamma)
-    , m_absolute(absolute)
-#endif
 {
 }
 
-double DeviceOrientationData::alpha() const
-{
-    return m_alpha;
-}
+#else
 
-double DeviceOrientationData::beta() const
+Ref<DeviceOrientationData> DeviceOrientationData::create(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute)
 {
-    return m_beta;
+    return adoptRef(*new DeviceOrientationData(alpha, beta, gamma, absolute));
 }
 
-double DeviceOrientationData::gamma() const
+DeviceOrientationData::DeviceOrientationData(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute)
+    : m_alpha(alpha)
+    , m_beta(beta)
+    , m_gamma(gamma)
+    , m_absolute(absolute)
 {
-    return m_gamma;
 }
 
-#if !PLATFORM(IOS)
-bool DeviceOrientationData::absolute() const
-{
-    return m_absolute;
-}
 #endif
 
-bool DeviceOrientationData::canProvideAlpha() const
-{
-    return m_canProvideAlpha;
-}
-
-bool DeviceOrientationData::canProvideBeta() const
-{
-    return m_canProvideBeta;
-}
-
-bool DeviceOrientationData::canProvideGamma() const
-{
-    return m_canProvideGamma;
-}
-
-#if PLATFORM(IOS)
-double DeviceOrientationData::compassHeading() const
-{
-    return m_compassHeading;
-}
-
-double DeviceOrientationData::compassAccuracy() const
-{
-    return m_compassAccuracy;
-}
-
-bool DeviceOrientationData::canProvideCompassHeading() const
-{
-    return m_canProvideCompassHeading;
-}
-
-bool DeviceOrientationData::canProvideCompassAccuracy() const
-{
-    return m_canProvideCompassAccuracy;
-}
-#endif
-
-#if !PLATFORM(IOS)
-bool DeviceOrientationData::canProvideAbsolute() const
-{
-    return m_canProvideAbsolute;
-}
-#endif
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/DeviceOrientationData.h (210740 => 210741)


--- trunk/Source/WebCore/dom/DeviceOrientationData.h	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/dom/DeviceOrientationData.h	2017-01-13 21:19:55 UTC (rev 210741)
@@ -26,6 +26,7 @@
 #pragma once
 
 #include "PlatformExportMacros.h"
+#include <wtf/Optional.h>
 #include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
 
@@ -33,54 +34,43 @@
 
 class DeviceOrientationData : public RefCounted<DeviceOrientationData> {
 public:
-    static Ref<DeviceOrientationData> create();
+    static Ref<DeviceOrientationData> create()
+    {
+        return adoptRef(*new DeviceOrientationData);
+    }
+
 #if PLATFORM(IOS)
-    WEBCORE_EXPORT static Ref<DeviceOrientationData> create(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideCompassHeading, double compassHeading, bool canProvideCompassAccuracy, double compassAccuracy);
+    WEBCORE_EXPORT static Ref<DeviceOrientationData> create(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> compassAccuracy);
 #else
-    WEBCORE_EXPORT static Ref<DeviceOrientationData> create(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideAbsolute = false, bool absolute = false);
+    WEBCORE_EXPORT static Ref<DeviceOrientationData> create(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute);
 #endif
 
-    double alpha() const;
-    double beta() const;
-    double gamma() const;
-    bool absolute() const;
-    bool canProvideAlpha() const;
-    bool canProvideBeta() const;
-    bool canProvideGamma() const;
-    bool canProvideAbsolute() const;
-
+    std::optional<double> alpha() const { return m_alpha; }
+    std::optional<double> beta() const { return m_beta; }
+    std::optional<double> gamma() const { return m_gamma; }
 #if PLATFORM(IOS)
-    double compassHeading() const;
-    double compassAccuracy() const;
-    bool canProvideCompassHeading() const;
-    bool canProvideCompassAccuracy() const;
+    std::optional<double> compassHeading() const { return m_compassHeading; }
+    std::optional<double> compassAccuracy() const { return m_compassAccuracy; }
+#else
+    std::optional<bool> absolute() const { return m_absolute; }
 #endif
 
 private:
-    DeviceOrientationData();
+    DeviceOrientationData() = default;
 #if PLATFORM(IOS)
-    DeviceOrientationData(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideCompassHeading, double compassHeading, bool canProvideCompassAccuracy, double compassAccuracy);
+    DeviceOrientationData(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> compassAccuracy);
 #else
-    DeviceOrientationData(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideAbsolute, bool absolute);
+    DeviceOrientationData(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute);
 #endif
 
-    bool m_canProvideAlpha;
-    bool m_canProvideBeta;
-    bool m_canProvideGamma;
-#if !PLATFORM(IOS)
-    bool m_canProvideAbsolute;
-#endif
-    double m_alpha;
-    double m_beta;
-    double m_gamma;
-
+    std::optional<double> m_alpha;
+    std::optional<double> m_beta;
+    std::optional<double> m_gamma;
 #if PLATFORM(IOS)
-    bool m_canProvideCompassHeading;
-    bool m_canProvideCompassAccuracy;
-    double m_compassHeading;
-    double m_compassAccuracy;
+    std::optional<double> m_compassHeading;
+    std::optional<double> m_compassAccuracy;
 #else
-    bool m_absolute;
+    std::optional<bool> m_absolute;
 #endif
 };
 

Modified: trunk/Source/WebCore/dom/DeviceOrientationEvent.cpp (210740 => 210741)


--- trunk/Source/WebCore/dom/DeviceOrientationEvent.cpp	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/dom/DeviceOrientationEvent.cpp	2017-01-13 21:19:55 UTC (rev 210741)
@@ -46,15 +46,60 @@
 {
 }
 
-void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceOrientationData* orientation)
+std::optional<double> DeviceOrientationEvent::alpha() const
 {
+    return m_orientation->alpha();
+}
+
+std::optional<double> DeviceOrientationEvent::beta() const
+{
+    return m_orientation->beta();
+}
+
+std::optional<double> DeviceOrientationEvent::gamma() const
+{
+    return m_orientation->gamma();
+}
+
+#if PLATFORM(IOS)
+
+std::optional<double> DeviceOrientationEvent::compassHeading() const
+{
+    return m_orientation->compassHeading();
+}
+
+std::optional<double> DeviceOrientationEvent::compassAccuracy() const
+{
+    return m_orientation->compassAccuracy();
+}
+
+void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> compassAccuracy)
+{
     if (dispatched())
         return;
 
     initEvent(type, bubbles, cancelable);
-    m_orientation = orientation;
+    m_orientation = DeviceOrientationData::create(alpha, beta, gamma, compassHeading, compassAccuracy);
 }
 
+#else
+
+std::optional<bool> DeviceOrientationEvent::absolute() const
+{
+    return m_orientation->absolute();
+}
+
+void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute)
+{
+    if (dispatched())
+        return;
+
+    initEvent(type, bubbles, cancelable);
+    m_orientation = DeviceOrientationData::create(alpha, beta, gamma, absolute);
+}
+
+#endif
+
 EventInterface DeviceOrientationEvent::eventInterface() const
 {
 #if ENABLE(DEVICE_ORIENTATION)

Modified: trunk/Source/WebCore/dom/DeviceOrientationEvent.h (210740 => 210741)


--- trunk/Source/WebCore/dom/DeviceOrientationEvent.h	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/dom/DeviceOrientationEvent.h	2017-01-13 21:19:55 UTC (rev 210741)
@@ -33,7 +33,6 @@
 
 class DeviceOrientationEvent final : public Event {
 public:
-    virtual ~DeviceOrientationEvent();
     static Ref<DeviceOrientationEvent> create(const AtomicString& eventType, DeviceOrientationData* orientation)
     {
         return adoptRef(*new DeviceOrientationEvent(eventType, orientation));
@@ -44,16 +43,29 @@
         return adoptRef(*new DeviceOrientationEvent);
     }
 
-    void initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceOrientationData*);
+    virtual ~DeviceOrientationEvent();
 
-    DeviceOrientationData* orientation() const { return m_orientation.get(); }
+    std::optional<double> alpha() const;
+    std::optional<double> beta() const;
+    std::optional<double> gamma() const;
 
-    EventInterface eventInterface() const override;
+#if PLATFORM(IOS)
+    std::optional<double> compassHeading() const;
+    std::optional<double> compassAccuracy() const;
 
+    void initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> compassAccuracy);
+#else
+    std::optional<bool> absolute() const;
+
+    void initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute);
+#endif
+
 private:
     DeviceOrientationEvent();
     DeviceOrientationEvent(const AtomicString& eventType, DeviceOrientationData*);
 
+    EventInterface eventInterface() const override;
+
     RefPtr<DeviceOrientationData> m_orientation;
 };
 

Modified: trunk/Source/WebCore/dom/DeviceOrientationEvent.idl (210740 => 210741)


--- trunk/Source/WebCore/dom/DeviceOrientationEvent.idl	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/dom/DeviceOrientationEvent.idl	2017-01-13 21:19:55 UTC (rev 210741)
@@ -26,32 +26,32 @@
 [
     Conditional=DEVICE_ORIENTATION,
 ] interface DeviceOrientationEvent : Event {
-    [Custom] readonly attribute unrestricted double alpha;
-    [Custom] readonly attribute unrestricted double beta;
-    [Custom] readonly attribute unrestricted double gamma;
+    readonly attribute unrestricted double? alpha;
+    readonly attribute unrestricted double? beta;
+    readonly attribute unrestricted double? gamma;
 
     // FIXME: Consider defining an ENABLE macro for iOS device orientation code and/or modifying
     // the bindings scripts to support generating more complicated conditional code.
 #if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS
-    [Custom] readonly attribute unrestricted double webkitCompassHeading;
-    [Custom] readonly attribute unrestricted double webkitCompassAccuracy;
-    [Custom] void initDeviceOrientationEvent(optional DOMString type,
-                                             optional boolean bubbles,
-                                             optional boolean cancelable,
-                                             optional unrestricted double alpha,
-                                             optional unrestricted double beta,
-                                             optional unrestricted double gamma,
-                                             optional unrestricted double compassHeading,
-                                             optional unrestricted double compassAccuracy);
+    [ImplementedAs=compassHeading] readonly attribute unrestricted double? webkitCompassHeading;
+    [ImplementedAs=compassAccuracy] readonly attribute unrestricted double? webkitCompassAccuracy;
+    void initDeviceOrientationEvent(optional DOMString type = "",
+                                    optional boolean bubbles = false,
+                                    optional boolean cancelable = false,
+                                    optional unrestricted double? alpha = null,
+                                    optional unrestricted double? beta = null,
+                                    optional unrestricted double? gamma = null,
+                                    optional unrestricted double? compassHeading = null,
+                                    optional unrestricted double? compassAccuracy = null);
 #else
-    [Custom] readonly attribute boolean absolute;
-    [Custom] void initDeviceOrientationEvent(optional DOMString type,
-                                             optional boolean bubbles,
-                                             optional boolean cancelable,
-                                             optional unrestricted double alpha,
-                                             optional unrestricted double beta,
-                                             optional unrestricted double gamma,
-                                             optional boolean absolute);
+    readonly attribute boolean? absolute;
+    void initDeviceOrientationEvent(optional DOMString type = "",
+                                    optional boolean bubbles = false,
+                                    optional boolean cancelable = false,
+                                    optional unrestricted double? alpha = null,
+                                    optional unrestricted double? beta = null,
+                                    optional unrestricted double? gamma = null,
+                                    optional boolean? absolute = null);
 #endif
 };
 

Modified: trunk/Source/WebCore/platform/ios/DeviceMotionClientIOS.mm (210740 => 210741)


--- trunk/Source/WebCore/platform/ios/DeviceMotionClientIOS.mm	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/platform/ios/DeviceMotionClientIOS.mm	2017-01-13 21:19:55 UTC (rev 210741)
@@ -77,9 +77,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, double xRotationRate, double yRotationRate, double zRotationRate)
 {
     if (!m_updating)
         return;
@@ -95,32 +93,21 @@
     UNUSED_PARAM(yRotationRate);
     UNUSED_PARAM(zRotationRate);
 
-    RefPtr<DeviceMotionData::Acceleration> accelerationIncludingGravity = DeviceMotionData::Acceleration::create(false, 0,
-                                                                                                                 false, 0,
-                                                                                                                 false, 0);
-    RefPtr<DeviceMotionData::Acceleration> acceleration = DeviceMotionData::Acceleration::create(false, 0,
-                                                                                                 false, 0,
-                                                                                                 false, 0);
-    RefPtr<DeviceMotionData::RotationRate> rotationRate = DeviceMotionData::RotationRate::create(false, 0,
-                                                                                                 false, 0,
-                                                                                                 false, 0);
+    auto accelerationIncludingGravity = DeviceMotionData::Acceleration::create();
+    auto acceleration = DeviceMotionData::Acceleration::create();
+    auto rotationRate = DeviceMotionData::RotationRate::create();
 #else
-    RefPtr<DeviceMotionData::Acceleration> accelerationIncludingGravity = DeviceMotionData::Acceleration::create(true, xAccelerationIncludingGravity,
-                                                                                                                 true, yAccelerationIncludingGravity,
-                                                                                                                 true, zAccelerationIncludingGravity);
-    RefPtr<DeviceMotionData::Acceleration> acceleration = 0;
-    RefPtr<DeviceMotionData::RotationRate> rotationRate = 0;
+    auto accelerationIncludingGravity = DeviceMotionData::Acceleration::create(xAccelerationIncludingGravity, yAccelerationIncludingGravity, zAccelerationIncludingGravity);
+
+    RefPtr<DeviceMotionData::Acceleration> acceleration;
+    RefPtr<DeviceMotionData::RotationRate> rotationRate;
     if ([m_motionManager gyroAvailable]) {
-        acceleration = DeviceMotionData::Acceleration::create(true, xAcceleration,
-                                                              true, yAcceleration,
-                                                              true, zAcceleration);
-        rotationRate = DeviceMotionData::RotationRate::create(true, xRotationRate,
-                                                              true, yRotationRate,
-                                                              true, zRotationRate);
+        acceleration = DeviceMotionData::Acceleration::create(xAcceleration, yAcceleration, zAcceleration);
+        rotationRate = DeviceMotionData::RotationRate::create(xRotationRate, yRotationRate, zRotationRate);
     }
 #endif // PLATFORM(IOS_SIMULATOR)
 
-    m_currentDeviceMotionData = DeviceMotionData::create(WTFMove(acceleration), WTFMove(accelerationIncludingGravity), WTFMove(rotationRate), true, kMotionUpdateInterval);
+    m_currentDeviceMotionData = DeviceMotionData::create(WTFMove(acceleration), WTFMove(accelerationIncludingGravity), WTFMove(rotationRate), kMotionUpdateInterval);
     m_controller->didChangeDeviceMotion(m_currentDeviceMotionData.get());
 }
 

Modified: trunk/Source/WebCore/platform/ios/DeviceOrientationClientIOS.mm (210740 => 210741)


--- trunk/Source/WebCore/platform/ios/DeviceOrientationClientIOS.mm	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebCore/platform/ios/DeviceOrientationClientIOS.mm	2017-01-13 21:19:55 UTC (rev 210741)
@@ -88,18 +88,11 @@
     UNUSED_PARAM(gamma);
     UNUSED_PARAM(compassHeading);
     UNUSED_PARAM(compassAccuracy);
-    m_currentDeviceOrientation = DeviceOrientationData::create(false, 0,
-                                                           false, 0,
-                                                           false, 0,
-                                                           false, 0,
-                                                           false, 0);
+    m_currentDeviceOrientation = DeviceOrientationData::create();
 #else
-    m_currentDeviceOrientation = DeviceOrientationData::create(true, alpha,
-                                                           true, beta,
-                                                           true, gamma,
-                                                           true, compassHeading,
-                                                           true, compassAccuracy);
+    m_currentDeviceOrientation = DeviceOrientationData::create(alpha, beta, gamma, compassHeading, compassAccuracy);
 #endif
+
     m_controller->didChangeDeviceOrientation(m_currentDeviceOrientation.get());
 }
 

Modified: trunk/Source/WebKit/mac/ChangeLog (210740 => 210741)


--- trunk/Source/WebKit/mac/ChangeLog	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebKit/mac/ChangeLog	2017-01-13 21:19:55 UTC (rev 210741)
@@ -1,3 +1,15 @@
+2017-01-13  Sam Weinig  <[email protected]>
+
+        [WebIDL] Remove custom bindings for DeviceMotionEvent and DeviceOrientationEvent
+        https://bugs.webkit.org/show_bug.cgi?id=167006
+
+        Reviewed by Geoffrey Garen.
+
+        * WebView/WebDeviceOrientation.mm:
+        (convert):
+        (-[WebDeviceOrientation initWithCanProvideAlpha:alpha:canProvideBeta:beta:canProvideGamma:gamma:]):
+        Update for new use of std::optional.
+
 2017-01-12  Joseph Pecoraro  <[email protected]>
 
         Remove unnecessary includes of Page.h

Modified: trunk/Source/WebKit/mac/WebView/WebDeviceOrientation.mm (210740 => 210741)


--- trunk/Source/WebKit/mac/WebView/WebDeviceOrientation.mm	2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/Source/WebKit/mac/WebView/WebDeviceOrientation.mm	2017-01-13 21:19:55 UTC (rev 210741)
@@ -60,6 +60,13 @@
     return orientation ? orientation->m_internal->m_orientation.get() : 0;
 }
 
+static std::optional<double> convert(bool canProvide, double value)
+{
+    if (!canProvide)
+        return std::nullopt;
+    return value;
+}
+
 - (id)initWithCanProvideAlpha:(bool)canProvideAlpha alpha:(double)alpha canProvideBeta:(bool)canProvideBeta beta:(double)beta canProvideGamma:(bool)canProvideGamma gamma:(double)gamma
 {
     self = [super init];
@@ -68,9 +75,9 @@
 #if PLATFORM(IOS)
     // We don't use this API, but make sure that it compiles with the new
     // compass parameters.
-    m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientationData::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma, false, 0, false, 0)];
+    m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientationData::create(convert(canProvideAlpha, alpha), convert(canProvideBeta, beta), convert(canProvideGamma, gamma), std::nullopt, std::nullopt)];
 #else
-    m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientationData::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma)];
+    m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientationData::create(convert(canProvideAlpha, alpha), convert(canProvideBeta, beta), convert(canProvideGamma, gamma), std::nullopt)];
 #endif
     return self;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to