<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[210741] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/210741">210741</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2017-01-13 13:19:55 -0800 (Fri, 13 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomDeviceMotionoptionaleventpropertiesexpectedtxt">trunk/LayoutTests/fast/dom/DeviceMotion/optional-event-properties-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDeviceMotionscripttestsoptionaleventpropertiesjs">trunk/LayoutTests/fast/dom/DeviceMotion/script-tests/optional-event-properties.js</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsIDLTypesh">trunk/Source/WebCore/bindings/IDLTypes.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSBindingsAllInOnecpp">trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDeviceMotionDatacpp">trunk/Source/WebCore/dom/DeviceMotionData.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDeviceMotionDatah">trunk/Source/WebCore/dom/DeviceMotionData.h</a></li>
<li><a href="#trunkSourceWebCoredomDeviceMotionEventcpp">trunk/Source/WebCore/dom/DeviceMotionEvent.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDeviceMotionEventh">trunk/Source/WebCore/dom/DeviceMotionEvent.h</a></li>
<li><a href="#trunkSourceWebCoredomDeviceMotionEventidl">trunk/Source/WebCore/dom/DeviceMotionEvent.idl</a></li>
<li><a href="#trunkSourceWebCoredomDeviceOrientationDatacpp">trunk/Source/WebCore/dom/DeviceOrientationData.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDeviceOrientationDatah">trunk/Source/WebCore/dom/DeviceOrientationData.h</a></li>
<li><a href="#trunkSourceWebCoredomDeviceOrientationEventcpp">trunk/Source/WebCore/dom/DeviceOrientationEvent.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDeviceOrientationEventh">trunk/Source/WebCore/dom/DeviceOrientationEvent.h</a></li>
<li><a href="#trunkSourceWebCoredomDeviceOrientationEventidl">trunk/Source/WebCore/dom/DeviceOrientationEvent.idl</a></li>
<li><a href="#trunkSourceWebCoreplatformiosDeviceMotionClientIOSmm">trunk/Source/WebCore/platform/ios/DeviceMotionClientIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosDeviceOrientationClientIOSmm">trunk/Source/WebCore/platform/ios/DeviceOrientationClientIOS.mm</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebDeviceOrientationmm">trunk/Source/WebKit/mac/WebView/WebDeviceOrientation.mm</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorebindingsjsJSDeviceMotionEventCustomcpp">trunk/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDeviceOrientationEventCustomcpp">trunk/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-01-13 20:53:15 UTC (rev 210740)
+++ trunk/LayoutTests/ChangeLog        2017-01-13 21:19:55 UTC (rev 210741)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-01-13  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        [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.
+
</ins><span class="cx"> 2017-01-13  Eric Carlson  &lt;eric.carlson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION (r210621): [mac-wk2] LayoutTest fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html timing out
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomDeviceMotionoptionaleventpropertiesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/DeviceMotion/optional-event-properties-expected.txt (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> 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.
</span><span class="cx"> 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.
</span><span class="cx"> 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.
</span><ins>+PASS event.initDeviceMotionEvent('', false, false, '', '', '', '') threw exception TypeError: Type error.
</ins><span class="cx"> event.initDeviceMotionEvent('', false, false, {y: 1, x: 0}, {x: 3, z: 5}, {gamma: 8, beta: 7}, 9)
</span><span class="cx"> PASS event.acceleration.x == 0 is true
</span><span class="cx"> PASS event.acceleration.y == 1 is true
</span><span class="lines">@@ -51,11 +52,6 @@
</span><span class="cx"> PASS event.accelerationIncludingGravity == null is true
</span><span class="cx"> PASS event.rotationRate == null is true
</span><span class="cx"> PASS event.interval == null is true
</span><del>-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
</del><span class="cx"> event.initDeviceMotionEvent('', false, false, null, null, null, null)
</span><span class="cx"> PASS event.acceleration == null is true
</span><span class="cx"> PASS event.accelerationIncludingGravity == null is true
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomDeviceMotionscripttestsoptionaleventpropertiesjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/DeviceMotion/script-tests/optional-event-properties.js (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> testException(&quot;event.initDeviceMotionEvent('', false, false, {x: objectThrowingException, y: 1, z: 2}, {x: 3, y: 4, z: 5}, {alpha: 6, beta: 7, gamma: 8}, 9)&quot;, &quot;Error: valueOf threw exception&quot;);
</span><span class="cx"> testException(&quot;event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, {x: 3, y: objectThrowingException, z: 5}, {alpha: 6, beta: 7, gamma: 8}, 9)&quot;, &quot;Error: valueOf threw exception&quot;);
</span><span class="cx"> testException(&quot;event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, {x: 3, y: 4, z: 5}, {alpha: 6, beta: 7, gamma: objectThrowingException}, 9)&quot;, &quot;Error: valueOf threw exception&quot;);
</span><ins>+testException(&quot;event.initDeviceMotionEvent('', false, false, '', '', '', '')&quot;, &quot;TypeError: Type error&quot;);
</ins><span class="cx"> 
</span><span class="cx"> evalAndLog(&quot;event.initDeviceMotionEvent('', false, false, {y: 1, x: 0}, {x: 3, z: 5}, {gamma: 8, beta: 7}, 9)&quot;);
</span><span class="cx"> shouldBeTrue(&quot;event.acceleration.x == 0&quot;);
</span><span class="lines">@@ -69,12 +70,6 @@
</span><span class="cx"> shouldBeTrue(&quot;event.rotationRate == null&quot;);
</span><span class="cx"> shouldBeTrue(&quot;event.interval == null&quot;);
</span><span class="cx"> 
</span><del>-evalAndLog(&quot;event.initDeviceMotionEvent('', false, false, '', '', '', '')&quot;);
-shouldBeTrue(&quot;event.acceleration == null&quot;);
-shouldBeTrue(&quot;event.accelerationIncludingGravity == null&quot;);
-shouldBeTrue(&quot;event.rotationRate == null&quot;);
-shouldBeTrue(&quot;event.interval == 0&quot;);
-
</del><span class="cx"> evalAndLog(&quot;event.initDeviceMotionEvent('', false, false, null, null, null, null)&quot;);
</span><span class="cx"> shouldBeTrue(&quot;event.acceleration == null&quot;);
</span><span class="cx"> shouldBeTrue(&quot;event.accelerationIncludingGravity == null&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1108,8 +1108,6 @@
</span><span class="cx">     bindings/js/JSDOMWindowProperties.cpp
</span><span class="cx">     bindings/js/JSDOMWindowShell.cpp
</span><span class="cx">     bindings/js/JSDOMWrapper.cpp
</span><del>-    bindings/js/JSDeviceMotionEventCustom.cpp
-    bindings/js/JSDeviceOrientationEventCustom.cpp
</del><span class="cx">     bindings/js/JSDocumentCustom.cpp
</span><span class="cx">     bindings/js/JSDocumentFragmentCustom.cpp
</span><span class="cx">     bindings/js/JSElementCustom.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,106 @@
</span><ins>+2017-01-13  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        [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.
+
</ins><span class="cx"> 2017-01-13  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GStreamer] Cache the accelerated capability of MediaPlayerClient in MediaPlayerPrivateGStreamerBase
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1397,7 +1397,6 @@
</span><span class="cx">                 31FB1A5D120A5D0600DC02A0 /* DeviceMotionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 31FB1A55120A5D0600DC02A0 /* DeviceMotionEvent.h */; };
</span><span class="cx">                 31FB1A65120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31FB1A63120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp */; };
</span><span class="cx">                 31FB1A66120A5D3F00DC02A0 /* JSDeviceMotionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 31FB1A64120A5D3F00DC02A0 /* JSDeviceMotionEvent.h */; };
</span><del>-                31FB1A6C120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31FB1A6B120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp */; };
</del><span class="cx">                 31FE6DFA15004C2A0004EBC4 /* NotificationPermissionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 31EC1DAC14FF26EA00C94662 /* NotificationPermissionCallback.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 3314ACEB10892086000F0E56 /* JSExceptionBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3314ACE910892086000F0E56 /* JSExceptionBase.cpp */; };
</span><span class="cx">                 3314ACEC10892086000F0E56 /* JSExceptionBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 3314ACEA10892086000F0E56 /* JSExceptionBase.h */; };
</span><span class="lines">@@ -2371,7 +2370,6 @@
</span><span class="cx">                 5905ADBF1302F3CE00F116DF /* XMLTreeViewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5905ADBD1302F3CE00F116DF /* XMLTreeViewer.cpp */; };
</span><span class="cx">                 5905ADC01302F3CE00F116DF /* XMLTreeViewer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5905ADBE1302F3CE00F116DF /* XMLTreeViewer.h */; };
</span><span class="cx">                 590E1B4911E4EF4B0069F784 /* DeviceOrientationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 590E1B4811E4EF4B0069F784 /* DeviceOrientationData.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                590E1B4B11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */; };
</del><span class="cx">                 59309A1111F4AE5800250603 /* DeviceOrientationClientMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */; };
</span><span class="cx">                 59309A1311F4AE6A00250603 /* DeviceOrientationClientMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 598365DD1355F557001B185D /* JSPositionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 598365DC1355F53C001B185D /* JSPositionCallback.h */; };
</span><span class="lines">@@ -8548,7 +8546,6 @@
</span><span class="cx">                 31FB1A56120A5D0600DC02A0 /* DeviceMotionEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DeviceMotionEvent.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31FB1A63120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceMotionEvent.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31FB1A64120A5D3F00DC02A0 /* JSDeviceMotionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDeviceMotionEvent.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                31FB1A6B120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceMotionEventCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 3314ACE910892086000F0E56 /* JSExceptionBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSExceptionBase.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 3314ACEA10892086000F0E56 /* JSExceptionBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSExceptionBase.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 331FF67DE197B57393C46A7F /* RenderMathMLPadded.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLPadded.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -9624,7 +9621,6 @@
</span><span class="cx">                 5905ADBD1302F3CE00F116DF /* XMLTreeViewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLTreeViewer.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5905ADBE1302F3CE00F116DF /* XMLTreeViewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLTreeViewer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 590E1B4811E4EF4B0069F784 /* DeviceOrientationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationData.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceOrientationEventCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceOrientationClientMock.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationClientMock.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5958F1CB1343917C0080B31F /* XMLViewer.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = XMLViewer.css; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -22104,8 +22100,6 @@
</span><span class="cx">                                 AD726FEA16D9F40B003A4E6D /* JSCSSStyleDeclarationCustom.h */,
</span><span class="cx">                                 9BC5F9DF1D5AAF6A002B749D /* JSCustomElementRegistryCustom.cpp */,
</span><span class="cx">                                 DEC2975D1B4DEB2A005F5945 /* JSCustomEventCustom.cpp */,
</span><del>-                                31FB1A6B120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp */,
-                                590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */,
</del><span class="cx">                                 49C7BA8C1042F5B10009D447 /* JSDocumentCustom.cpp */,
</span><span class="cx">                                 ADDA94BF19686F8000453029 /* JSDocumentCustom.h */,
</span><span class="cx">                                 BC64649B11D8238C006455B0 /* JSDOMStringMapCustom.cpp */,
</span><span class="lines">@@ -29883,9 +29877,7 @@
</span><span class="cx">                                 4162A4571011464700DFF3ED /* JSDedicatedWorkerGlobalScope.cpp in Sources */,
</span><span class="cx">                                 FDA15ED112B03F94003A583A /* JSDelayNode.cpp in Sources */,
</span><span class="cx">                                 31FB1A65120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp in Sources */,
</span><del>-                                31FB1A6C120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp in Sources */,
</del><span class="cx">                                 59A86006119DAF7F00DEF1EF /* JSDeviceOrientationEvent.cpp in Sources */,
</span><del>-                                590E1B4B11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp in Sources */,
</del><span class="cx">                                 659DDC8209E198BA001BF3C6 /* JSDocument.cpp in Sources */,
</span><span class="cx">                                 1221E05D1C02B444006A1A00 /* JSDocumentAnimation.cpp in Sources */,
</span><span class="cx">                                 49C7BA8D1042F5B10009D447 /* JSDocumentCustom.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsIDLTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/IDLTypes.h (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -139,9 +139,9 @@
</span><span class="cx">     using InnerType = T;
</span><span class="cx"> 
</span><span class="cx">     using NullableType = typename T::NullableType;
</span><del>-    static inline decltype(T::nullValue()) nullValue() { return T::nullValue(); }
</del><ins>+    static inline auto nullValue() -&gt; decltype(T::nullValue()) { return T::nullValue(); }
</ins><span class="cx">     template&lt;typename U&gt; static inline bool isNullValue(U&amp;&amp; value) { return T::isNullValue(std::forward&lt;U&gt;(value)); }
</span><del>-    template&lt;typename U&gt; static inline U&amp;&amp; extractValueFromNullable(U&amp;&amp; value) { return T::extractValueFromNullable(std::forward&lt;U&gt;(value)); }
</del><ins>+    template&lt;typename U&gt; static inline auto extractValueFromNullable(U&amp;&amp; value) -&gt; decltype(T::extractValueFromNullable(std::forward&lt;U&gt;(value))) { return T::extractValueFromNullable(std::forward&lt;U&gt;(value)); }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename T&gt; struct IDLSequence : IDLType&lt;Vector&lt;typename T::ImplementationType&gt;&gt; {
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSBindingsAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -56,7 +56,6 @@
</span><span class="cx"> #include &quot;JSDOMWindowProperties.cpp&quot;
</span><span class="cx"> #include &quot;JSDOMWindowShell.cpp&quot;
</span><span class="cx"> #include &quot;JSDOMWrapper.cpp&quot;
</span><del>-#include &quot;JSDeviceOrientationEventCustom.cpp&quot;
</del><span class="cx"> #include &quot;JSDocumentCustom.cpp&quot;
</span><span class="cx"> #include &quot;JSDocumentFragmentCustom.cpp&quot;
</span><span class="cx"> #include &quot;JSElementCustom.cpp&quot;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDeviceMotionEventCustomcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,197 +0,0 @@
</span><del>-/*
- * 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 &quot;config.h&quot;
-
-#if ENABLE(DEVICE_ORIENTATION)
-
-#include &quot;JSDeviceMotionEvent.h&quot;
-
-#include &quot;DeviceMotionData.h&quot;
-#include &quot;DeviceMotionEvent.h&quot;
-#include &lt;heap/HeapInlines.h&gt;
-#include &lt;runtime/AuxiliaryBarrierInlines.h&gt;
-#include &lt;runtime/IdentifierInlines.h&gt;
-#include &lt;runtime/JSCJSValueInlines.h&gt;
-#include &lt;runtime/JSObjectInlines.h&gt;
-#include &lt;runtime/ObjectConstructor.h&gt;
-#include &lt;runtime/StructureInlines.h&gt;
-
-using namespace JSC;
-
-namespace WebCore {
-
-static RefPtr&lt;DeviceMotionData::Acceleration&gt; readAccelerationArgument(JSValue value, ExecState&amp; state)
-{
-    if (value.isUndefinedOrNull())
-        return nullptr;
-
-    VM&amp; vm = state.vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-
-    // Given the above test, this will always yield an object.
-    JSObject* object = value.toObject(&amp;state);
-    ASSERT(!scope.exception());
-
-    JSValue xValue = object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;x&quot;));
-    RETURN_IF_EXCEPTION(scope, nullptr);
-    bool canProvideX = !xValue.isUndefinedOrNull();
-    double x = xValue.toNumber(&amp;state);
-    RETURN_IF_EXCEPTION(scope, nullptr);
-
-    JSValue yValue = object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;y&quot;));
-    RETURN_IF_EXCEPTION(scope, nullptr);
-    bool canProvideY = !yValue.isUndefinedOrNull();
-    double y = yValue.toNumber(&amp;state);
-    RETURN_IF_EXCEPTION(scope, nullptr);
-
-    JSValue zValue = object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;z&quot;));
-    RETURN_IF_EXCEPTION(scope, nullptr);
-    bool canProvideZ = !zValue.isUndefinedOrNull();
-    double z = zValue.toNumber(&amp;state);
-    RETURN_IF_EXCEPTION(scope, nullptr);
-
-    if (!canProvideX &amp;&amp; !canProvideY &amp;&amp; !canProvideZ)
-        return nullptr;
-
-    return DeviceMotionData::Acceleration::create(canProvideX, x, canProvideY, y, canProvideZ, z);
-}
-
-static RefPtr&lt;DeviceMotionData::RotationRate&gt; readRotationRateArgument(JSValue value, ExecState&amp; state)
-{
-    if (value.isUndefinedOrNull())
-        return nullptr;
-
-    VM&amp; vm = state.vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-
-    // Given the above test, this will always yield an object.
-    JSObject* object = value.toObject(&amp;state);
-    ASSERT(!scope.exception());
-
-    JSValue alphaValue = object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;alpha&quot;));
-    RETURN_IF_EXCEPTION(scope, nullptr);
-    bool canProvideAlpha = !alphaValue.isUndefinedOrNull();
-    double alpha = alphaValue.toNumber(&amp;state);
-    RETURN_IF_EXCEPTION(scope, nullptr);
-
-    JSValue betaValue = object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;beta&quot;));
-    RETURN_IF_EXCEPTION(scope, nullptr);
-    bool canProvideBeta = !betaValue.isUndefinedOrNull();
-    double beta = betaValue.toNumber(&amp;state);
-    RETURN_IF_EXCEPTION(scope, nullptr);
-
-    JSValue gammaValue = object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;gamma&quot;));
-    RETURN_IF_EXCEPTION(scope, nullptr);
-    bool canProvideGamma = !gammaValue.isUndefinedOrNull();
-    double gamma = gammaValue.toNumber(&amp;state);
-    RETURN_IF_EXCEPTION(scope, nullptr);
-
-    if (!canProvideAlpha &amp;&amp; !canProvideBeta &amp;&amp; !canProvideGamma)
-        return nullptr;
-
-    return DeviceMotionData::RotationRate::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma);
-}
-
-static JSObject* createAccelerationObject(const DeviceMotionData::Acceleration* acceleration, ExecState&amp; state)
-{
-    JSObject* object = constructEmptyObject(&amp;state);
-    object-&gt;putDirect(state.vm(), Identifier::fromString(&amp;state, &quot;x&quot;), acceleration-&gt;canProvideX() ? jsNumber(acceleration-&gt;x()) : jsNull());
-    object-&gt;putDirect(state.vm(), Identifier::fromString(&amp;state, &quot;y&quot;), acceleration-&gt;canProvideY() ? jsNumber(acceleration-&gt;y()) : jsNull());
-    object-&gt;putDirect(state.vm(), Identifier::fromString(&amp;state, &quot;z&quot;), acceleration-&gt;canProvideZ() ? jsNumber(acceleration-&gt;z()) : jsNull());
-    return object;
-}
-
-static JSObject* createRotationRateObject(const DeviceMotionData::RotationRate* rotationRate, ExecState&amp; state)
-{
-    JSObject* object = constructEmptyObject(&amp;state);
-    object-&gt;putDirect(state.vm(), Identifier::fromString(&amp;state, &quot;alpha&quot;), rotationRate-&gt;canProvideAlpha() ? jsNumber(rotationRate-&gt;alpha()) : jsNull());
-    object-&gt;putDirect(state.vm(), Identifier::fromString(&amp;state, &quot;beta&quot;),  rotationRate-&gt;canProvideBeta()  ? jsNumber(rotationRate-&gt;beta())  : jsNull());
-    object-&gt;putDirect(state.vm(), Identifier::fromString(&amp;state, &quot;gamma&quot;), rotationRate-&gt;canProvideGamma() ? jsNumber(rotationRate-&gt;gamma()) : jsNull());
-    return object;
-}
-
-JSValue JSDeviceMotionEvent::acceleration(ExecState&amp; state) const
-{
-    DeviceMotionEvent&amp; imp = wrapped();
-    if (!imp.deviceMotionData()-&gt;acceleration())
-        return jsNull();
-    return createAccelerationObject(imp.deviceMotionData()-&gt;acceleration(), state);
-}
-
-JSValue JSDeviceMotionEvent::accelerationIncludingGravity(ExecState&amp; state) const
-{
-    DeviceMotionEvent&amp; imp = wrapped();
-    if (!imp.deviceMotionData()-&gt;accelerationIncludingGravity())
-        return jsNull();
-    return createAccelerationObject(imp.deviceMotionData()-&gt;accelerationIncludingGravity(), state);
-}
-
-JSValue JSDeviceMotionEvent::rotationRate(ExecState&amp; state) const
-{
-    DeviceMotionEvent&amp; imp = wrapped();
-    if (!imp.deviceMotionData()-&gt;rotationRate())
-        return jsNull();
-    return createRotationRateObject(imp.deviceMotionData()-&gt;rotationRate(), state);
-}
-
-JSValue JSDeviceMotionEvent::interval(ExecState&amp;) const
-{
-    DeviceMotionEvent&amp; imp = wrapped();
-    if (!imp.deviceMotionData()-&gt;canProvideInterval())
-        return jsNull();
-    return jsNumber(imp.deviceMotionData()-&gt;interval());
-}
-
-JSValue JSDeviceMotionEvent::initDeviceMotionEvent(ExecState&amp; state)
-{
-    VM&amp; vm = state.vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-
-    const String type = state.argument(0).toWTFString(&amp;state);
-    bool bubbles = state.argument(1).toBoolean(&amp;state);
-    bool cancelable = state.argument(2).toBoolean(&amp;state);
-
-    // If any of the parameters are null or undefined, mark them as not provided.
-    // Otherwise, use the standard JavaScript conversion.
-    RefPtr&lt;DeviceMotionData::Acceleration&gt; acceleration = readAccelerationArgument(state.argument(3), state);
-    RETURN_IF_EXCEPTION(scope, JSValue());
-
-    RefPtr&lt;DeviceMotionData::Acceleration&gt; accelerationIncludingGravity = readAccelerationArgument(state.argument(4), state);
-    RETURN_IF_EXCEPTION(scope, JSValue());
-
-    RefPtr&lt;DeviceMotionData::RotationRate&gt; rotationRate = readRotationRateArgument(state.argument(5), state);
-    RETURN_IF_EXCEPTION(scope, JSValue());
-
-    bool intervalProvided = !state.argument(6).isUndefinedOrNull();
-    double interval = state.argument(6).toNumber(&amp;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)
</del></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDeviceOrientationEventCustomcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,124 +0,0 @@
</span><del>-/*
- * 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 &quot;config.h&quot;
-
-#if ENABLE(DEVICE_ORIENTATION)
-
-#include &quot;JSDeviceOrientationEvent.h&quot;
-
-#include &quot;DeviceOrientationData.h&quot;
-#include &quot;DeviceOrientationEvent.h&quot;
-#include &lt;heap/HeapInlines.h&gt;
-#include &lt;runtime/JSCJSValueInlines.h&gt;
-#include &lt;runtime/StructureInlines.h&gt;
-
-using namespace JSC;
-
-namespace WebCore {
-
-JSValue JSDeviceOrientationEvent::alpha(ExecState&amp;) const
-{
-    DeviceOrientationEvent&amp; imp = wrapped();
-    if (!imp.orientation()-&gt;canProvideAlpha())
-        return jsNull();
-    return jsNumber(imp.orientation()-&gt;alpha());
-}
-
-JSValue JSDeviceOrientationEvent::beta(ExecState&amp;) const
-{
-    DeviceOrientationEvent&amp; imp = wrapped();
-    if (!imp.orientation()-&gt;canProvideBeta())
-        return jsNull();
-    return jsNumber(imp.orientation()-&gt;beta());
-}
-
-JSValue JSDeviceOrientationEvent::gamma(ExecState&amp;) const
-{
-    DeviceOrientationEvent&amp; imp = wrapped();
-    if (!imp.orientation()-&gt;canProvideGamma())
-        return jsNull();
-    return jsNumber(imp.orientation()-&gt;gamma());
-}
-
-#if PLATFORM(IOS)
-JSValue JSDeviceOrientationEvent::webkitCompassHeading(ExecState&amp;) const
-{
-    DeviceOrientationEvent&amp; imp = wrapped();
-    if (!imp.orientation()-&gt;canProvideCompassHeading())
-        return jsNull();
-    return jsNumber(imp.orientation()-&gt;compassHeading());
-}
-
-JSValue JSDeviceOrientationEvent::webkitCompassAccuracy(ExecState&amp;) const
-{
-    DeviceOrientationEvent&amp; imp = wrapped();
-    if (!imp.orientation()-&gt;canProvideCompassAccuracy())
-        return jsNull();
-    return jsNumber(imp.orientation()-&gt;compassAccuracy());
-}
-#endif
-
-#if !PLATFORM(IOS)
-JSValue JSDeviceOrientationEvent::absolute(ExecState&amp;) const
-{
-    DeviceOrientationEvent&amp; imp = wrapped();
-    if (!imp.orientation()-&gt;canProvideAbsolute())
-        return jsNull();
-    return jsBoolean(imp.orientation()-&gt;absolute());
-}
-#endif
-
-JSValue JSDeviceOrientationEvent::initDeviceOrientationEvent(ExecState&amp; state)
-{
-    const String type = state.argument(0).toWTFString(&amp;state);
-    bool bubbles = state.argument(1).toBoolean(&amp;state);
-    bool cancelable = state.argument(2).toBoolean(&amp;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(&amp;state);
-    bool betaProvided = !state.argument(4).isUndefinedOrNull();
-    double beta = state.argument(4).toNumber(&amp;state);
-    bool gammaProvided = !state.argument(5).isUndefinedOrNull();
-    double gamma = state.argument(5).toNumber(&amp;state);
-#if PLATFORM(IOS)
-    bool compassHeadingProvided = !state.argument(6).isUndefinedOrNull();
-    double compassHeading = state.argument(6).toNumber(&amp;state);
-    bool compassAccuracyProvided = !state.argument(7).isUndefinedOrNull();
-    double compassAccuracy = state.argument(7).toNumber(&amp;state);
-    RefPtr&lt;DeviceOrientationData&gt; 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(&amp;state);
-    RefPtr&lt;DeviceOrientationData&gt; 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)
</del></span></pre></div>
<a id="trunkSourceWebCoredomDeviceMotionDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DeviceMotionData.cpp (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -28,62 +28,20 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-Ref&lt;DeviceMotionData::Acceleration&gt; 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&lt;DeviceMotionData::RotationRate&gt; 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)
-{
-}
-
</del><span class="cx"> Ref&lt;DeviceMotionData&gt; DeviceMotionData::create()
</span><span class="cx"> {
</span><span class="cx">     return adoptRef(*new DeviceMotionData);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref&lt;DeviceMotionData&gt; DeviceMotionData::create(RefPtr&lt;Acceleration&gt;&amp;&amp; acceleration, RefPtr&lt;Acceleration&gt;&amp;&amp; accelerationIncludingGravity, RefPtr&lt;RotationRate&gt;&amp;&amp; rotationRate, bool canProvideInterval, double interval)
</del><ins>+Ref&lt;DeviceMotionData&gt; DeviceMotionData::create(RefPtr&lt;Acceleration&gt;&amp;&amp; acceleration, RefPtr&lt;Acceleration&gt;&amp;&amp; accelerationIncludingGravity, RefPtr&lt;RotationRate&gt;&amp;&amp; rotationRate, std::optional&lt;double&gt; interval)
</ins><span class="cx"> {
</span><del>-    return adoptRef(*new DeviceMotionData(WTFMove(acceleration), WTFMove(accelerationIncludingGravity), WTFMove(rotationRate), canProvideInterval, interval));
</del><ins>+    return adoptRef(*new DeviceMotionData(WTFMove(acceleration), WTFMove(accelerationIncludingGravity), WTFMove(rotationRate), interval));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-DeviceMotionData::DeviceMotionData()
-    : m_canProvideInterval(false)
-    , m_interval(0)
-{
-}
-
-DeviceMotionData::DeviceMotionData(RefPtr&lt;Acceleration&gt;&amp;&amp; acceleration, RefPtr&lt;Acceleration&gt;&amp;&amp; accelerationIncludingGravity, RefPtr&lt;RotationRate&gt;&amp;&amp; rotationRate, bool canProvideInterval, double interval)
</del><ins>+DeviceMotionData::DeviceMotionData(RefPtr&lt;Acceleration&gt;&amp;&amp; acceleration, RefPtr&lt;Acceleration&gt;&amp;&amp; accelerationIncludingGravity, RefPtr&lt;RotationRate&gt;&amp;&amp; rotationRate, std::optional&lt;double&gt; interval)
</ins><span class="cx">     : m_acceleration(WTFMove(acceleration))
</span><span class="cx">     , m_accelerationIncludingGravity(WTFMove(accelerationIncludingGravity))
</span><span class="cx">     , m_rotationRate(WTFMove(rotationRate))
</span><del>-    , m_canProvideInterval(canProvideInterval)
</del><span class="cx">     , m_interval(interval)
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomDeviceMotionDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DeviceMotionData.h (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#include &lt;wtf/Optional.h&gt;
</ins><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</span><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -34,70 +35,79 @@
</span><span class="cx"> public:
</span><span class="cx">     class Acceleration : public RefCounted&lt;DeviceMotionData::Acceleration&gt; {
</span><span class="cx">     public:
</span><del>-        WEBCORE_EXPORT static Ref&lt;Acceleration&gt; create(bool canProvideX, double x, bool canProvideY, double y, bool canProvideZ, double z);
</del><ins>+        static Ref&lt;Acceleration&gt; create()
+        {
+            return adoptRef(*new Acceleration);
+        }
+        static Ref&lt;Acceleration&gt; create(std::optional&lt;double&gt; x, std::optional&lt;double&gt; y, std::optional&lt;double&gt; z)
+        {
+            return adoptRef(*new Acceleration(x, y, z));
+        }
</ins><span class="cx"> 
</span><del>-        bool canProvideX() const { return m_canProvideX; }
-        bool canProvideY() const { return m_canProvideY; }
-        bool canProvideZ() const { return m_canProvideZ; }
</del><ins>+        std::optional&lt;double&gt; x() const { return m_x; }
+        std::optional&lt;double&gt; y() const { return m_y; }
+        std::optional&lt;double&gt; z() const { return m_z; }
</ins><span class="cx"> 
</span><del>-        double x() const { return m_x; }
-        double y() const { return m_y; }
-        double z() const { return m_z; }
-
</del><span class="cx">     private:
</span><del>-        Acceleration(bool canProvideX, double x, bool canProvideY, double y, bool canProvideZ, double z);
</del><ins>+        Acceleration() = default;
+        Acceleration(std::optional&lt;double&gt; x, std::optional&lt;double&gt; y, std::optional&lt;double&gt; z)
+            : m_x(x)
+            , m_y(y)
+            , m_z(z)
+        {
+        }
</ins><span class="cx"> 
</span><del>-        double m_x;
-        double m_y;
-        double m_z;
-
-        bool m_canProvideX;
-        bool m_canProvideY;
-        bool m_canProvideZ;
</del><ins>+        std::optional&lt;double&gt; m_x;
+        std::optional&lt;double&gt; m_y;
+        std::optional&lt;double&gt; m_z;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     class RotationRate : public RefCounted&lt;DeviceMotionData::RotationRate&gt; {
</span><span class="cx">     public:
</span><del>-        WEBCORE_EXPORT static Ref&lt;RotationRate&gt; create(bool canProvideAlpha, double alpha, bool canProvideBeta,  double beta, bool canProvideGamma, double gamma);
</del><ins>+        static Ref&lt;RotationRate&gt; create()
+        {
+            return adoptRef(*new RotationRate);
+        }
+        static Ref&lt;RotationRate&gt; create(std::optional&lt;double&gt; alpha, std::optional&lt;double&gt; beta, std::optional&lt;double&gt; gamma)
+        {
+            return adoptRef(*new RotationRate(alpha, beta, gamma));
+        }
</ins><span class="cx"> 
</span><del>-        bool canProvideAlpha() const { return m_canProvideAlpha; }
-        bool canProvideBeta() const { return m_canProvideBeta; }
-        bool canProvideGamma() const { return m_canProvideGamma; }
</del><ins>+        std::optional&lt;double&gt; alpha() const { return m_alpha; }
+        std::optional&lt;double&gt; beta() const { return m_beta; }
+        std::optional&lt;double&gt; gamma() const { return m_gamma; }
</ins><span class="cx"> 
</span><del>-        double alpha() const { return m_alpha; }
-        double beta() const { return m_beta; }
-        double gamma() const { return m_gamma; }
-
</del><span class="cx">     private:
</span><del>-        RotationRate(bool canProvideAlpha, double alpha, bool canProvideBeta,  double beta, bool canProvideGamma, double gamma);
</del><ins>+        RotationRate() = default;
+        RotationRate(std::optional&lt;double&gt; alpha, std::optional&lt;double&gt; beta, std::optional&lt;double&gt; gamma)
+            : m_alpha(alpha)
+            , m_beta(beta)
+            , m_gamma(gamma)
+        {
+        }
</ins><span class="cx"> 
</span><del>-        double m_alpha;
-        double m_beta;
-        double m_gamma;
-
-        bool m_canProvideAlpha;
-        bool m_canProvideBeta;
-        bool m_canProvideGamma;
</del><ins>+        std::optional&lt;double&gt; m_alpha;
+        std::optional&lt;double&gt; m_beta;
+        std::optional&lt;double&gt; m_gamma;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT static Ref&lt;DeviceMotionData&gt; create();
</span><del>-    WEBCORE_EXPORT static Ref&lt;DeviceMotionData&gt; create(RefPtr&lt;Acceleration&gt;&amp;&amp;, RefPtr&lt;Acceleration&gt;&amp;&amp; accelerationIncludingGravity, RefPtr&lt;RotationRate&gt;&amp;&amp;, bool canProvideInterval, double interval);
</del><ins>+    WEBCORE_EXPORT static Ref&lt;DeviceMotionData&gt; create(RefPtr&lt;Acceleration&gt;&amp;&amp;, RefPtr&lt;Acceleration&gt;&amp;&amp; accelerationIncludingGravity, RefPtr&lt;RotationRate&gt;&amp;&amp;, std::optional&lt;double&gt; interval);
</ins><span class="cx"> 
</span><span class="cx">     const Acceleration* acceleration() const { return m_acceleration.get(); }
</span><span class="cx">     const Acceleration* accelerationIncludingGravity() const { return m_accelerationIncludingGravity.get(); }
</span><span class="cx">     const RotationRate* rotationRate() const { return m_rotationRate.get(); }
</span><del>-    double interval() const { return m_interval; }
-    bool canProvideInterval() const { return m_canProvideInterval; }
</del><ins>+    
+    std::optional&lt;double&gt; interval() const { return m_interval; }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    DeviceMotionData();
-    DeviceMotionData(RefPtr&lt;Acceleration&gt;&amp;&amp;, RefPtr&lt;Acceleration&gt;&amp;&amp; accelerationIncludingGravity, RefPtr&lt;RotationRate&gt;&amp;&amp;, bool canProvideInterval, double interval);
</del><ins>+    DeviceMotionData() = default;
+    DeviceMotionData(RefPtr&lt;Acceleration&gt;&amp;&amp;, RefPtr&lt;Acceleration&gt;&amp;&amp; accelerationIncludingGravity, RefPtr&lt;RotationRate&gt;&amp;&amp;, std::optional&lt;double&gt; interval);
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Acceleration&gt; m_acceleration;
</span><span class="cx">     RefPtr&lt;Acceleration&gt; m_accelerationIncludingGravity;
</span><span class="cx">     RefPtr&lt;RotationRate&gt; m_rotationRate;
</span><del>-    bool m_canProvideInterval;
-    double m_interval;
</del><ins>+    std::optional&lt;double&gt; m_interval;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoredomDeviceMotionEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DeviceMotionEvent.cpp (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -46,13 +46,71 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DeviceMotionEvent::initDeviceMotionEvent(const AtomicString&amp; type, bool bubbles, bool cancelable, DeviceMotionData* deviceMotionData)
</del><ins>+static std::optional&lt;DeviceMotionEvent::Acceleration&gt; convert(const DeviceMotionData::Acceleration* acceleration)
</ins><span class="cx"> {
</span><ins>+    if (!acceleration)
+        return std::nullopt;
+
+    return DeviceMotionEvent::Acceleration { acceleration-&gt;x(), acceleration-&gt;y(), acceleration-&gt;z() };
+}
+
+static std::optional&lt;DeviceMotionEvent::RotationRate&gt; convert(const DeviceMotionData::RotationRate* rotationRate)
+{
+    if (!rotationRate)
+        return std::nullopt;
+
+    return DeviceMotionEvent::RotationRate { rotationRate-&gt;alpha(), rotationRate-&gt;beta(), rotationRate-&gt;gamma() };
+}
+
+static RefPtr&lt;DeviceMotionData::Acceleration&gt; convert(std::optional&lt;DeviceMotionEvent::Acceleration&gt;&amp;&amp; acceleration)
+{
+    if (!acceleration)
+        return nullptr;
+
+    if (!acceleration-&gt;x &amp;&amp; !acceleration-&gt;y &amp;&amp; !acceleration-&gt;z)
+        return nullptr;
+
+    return DeviceMotionData::Acceleration::create(acceleration-&gt;x, acceleration-&gt;y, acceleration-&gt;z);
+}
+
+static RefPtr&lt;DeviceMotionData::RotationRate&gt; convert(std::optional&lt;DeviceMotionEvent::RotationRate&gt;&amp;&amp; rotationRate)
+{
+    if (!rotationRate)
+        return nullptr;
+
+    if (!rotationRate-&gt;alpha &amp;&amp; !rotationRate-&gt;beta &amp;&amp; !rotationRate-&gt;gamma)
+        return nullptr;
+
+    return DeviceMotionData::RotationRate::create(rotationRate-&gt;alpha, rotationRate-&gt;beta, rotationRate-&gt;gamma);
+}
+
+std::optional&lt;DeviceMotionEvent::Acceleration&gt; DeviceMotionEvent::acceleration() const
+{
+    return convert(m_deviceMotionData-&gt;acceleration());
+}
+
+std::optional&lt;DeviceMotionEvent::Acceleration&gt; DeviceMotionEvent::accelerationIncludingGravity() const
+{
+    return convert(m_deviceMotionData-&gt;accelerationIncludingGravity());
+}
+
+std::optional&lt;DeviceMotionEvent::RotationRate&gt; DeviceMotionEvent::rotationRate() const
+{
+    return convert(m_deviceMotionData-&gt;rotationRate());
+}
+
+std::optional&lt;double&gt; DeviceMotionEvent::interval() const
+{
+    return m_deviceMotionData-&gt;interval();
+}
+
+void DeviceMotionEvent::initDeviceMotionEvent(const AtomicString&amp; type, bool bubbles, bool cancelable, std::optional&lt;DeviceMotionEvent::Acceleration&gt;&amp;&amp; acceleration, std::optional&lt;DeviceMotionEvent::Acceleration&gt;&amp;&amp; accelerationIncludingGravity, std::optional&lt;DeviceMotionEvent::RotationRate&gt;&amp;&amp; rotationRate, std::optional&lt;double&gt; interval)
+{
</ins><span class="cx">     if (dispatched())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     initEvent(type, bubbles, cancelable);
</span><del>-    m_deviceMotionData = deviceMotionData;
</del><ins>+    m_deviceMotionData = DeviceMotionData::create(convert(WTFMove(acceleration)), convert(WTFMove(accelerationIncludingGravity)), convert(WTFMove(rotationRate)), interval);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> EventInterface DeviceMotionEvent::eventInterface() const
</span></span></pre></div>
<a id="trunkSourceWebCoredomDeviceMotionEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DeviceMotionEvent.h (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -35,6 +35,20 @@
</span><span class="cx"> public:
</span><span class="cx">     virtual ~DeviceMotionEvent();
</span><span class="cx"> 
</span><ins>+    // FIXME: Merge this with DeviceMotionData::Acceleration
+    struct Acceleration {
+        std::optional&lt;double&gt; x;
+        std::optional&lt;double&gt; y;
+        std::optional&lt;double&gt; z;
+    };
+
+    // FIXME: Merge this with DeviceMotionData::RotationRate
+    struct RotationRate {
+        std::optional&lt;double&gt; alpha;
+        std::optional&lt;double&gt; beta;
+        std::optional&lt;double&gt; gamma;
+    };
+
</ins><span class="cx">     static Ref&lt;DeviceMotionEvent&gt; create(const AtomicString&amp; eventType, DeviceMotionData* deviceMotionData)
</span><span class="cx">     {
</span><span class="cx">         return adoptRef(*new DeviceMotionEvent(eventType, deviceMotionData));
</span><span class="lines">@@ -45,16 +59,19 @@
</span><span class="cx">         return adoptRef(*new DeviceMotionEvent);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void initDeviceMotionEvent(const AtomicString&amp; type, bool bubbles, bool cancelable, DeviceMotionData*);
</del><ins>+    std::optional&lt;Acceleration&gt; acceleration() const;
+    std::optional&lt;Acceleration&gt; accelerationIncludingGravity() const;
+    std::optional&lt;RotationRate&gt; rotationRate() const;
+    std::optional&lt;double&gt; interval() const;
</ins><span class="cx"> 
</span><del>-    DeviceMotionData* deviceMotionData() const { return m_deviceMotionData.get(); }
</del><ins>+    void initDeviceMotionEvent(const AtomicString&amp; type, bool bubbles, bool cancelable, std::optional&lt;Acceleration&gt;&amp;&amp;, std::optional&lt;Acceleration&gt;&amp;&amp;, std::optional&lt;RotationRate&gt;&amp;&amp;, std::optional&lt;double&gt;);
</ins><span class="cx"> 
</span><del>-    EventInterface eventInterface() const override;
-
</del><span class="cx"> private:
</span><span class="cx">     DeviceMotionEvent();
</span><span class="cx">     DeviceMotionEvent(const AtomicString&amp; eventType, DeviceMotionData*);
</span><span class="cx"> 
</span><ins>+    EventInterface eventInterface() const override;
+
</ins><span class="cx">     RefPtr&lt;DeviceMotionData&gt; m_deviceMotionData;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomDeviceMotionEventidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DeviceMotionEvent.idl (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -24,19 +24,36 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> [
</span><del>-    Conditional=DEVICE_ORIENTATION,
</del><ins>+    Conditional=DEVICE_ORIENTATION
</ins><span class="cx"> ] interface DeviceMotionEvent : Event {
</span><del>-    [Custom] readonly attribute Acceleration acceleration;
-    [Custom] readonly attribute Acceleration accelerationIncludingGravity;
-    [Custom] readonly attribute RotationRate rotationRate;
-    [Custom] readonly attribute unrestricted double interval;
</del><ins>+    readonly attribute Acceleration? acceleration;
+    readonly attribute Acceleration? accelerationIncludingGravity;
+    readonly attribute RotationRate? rotationRate;
+    readonly attribute unrestricted double? interval;
</ins><span class="cx"> 
</span><del>-    [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);
</del><ins>+    void initDeviceMotionEvent(optional DOMString type = &quot;&quot;,
+                               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);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><ins>+[
+    Conditional=DEVICE_ORIENTATION,
+    JSGenerateToJSObject
+] dictionary Acceleration {
+    double? x;
+    double? y;
+    double? z;
+};
+
+[
+    Conditional=DEVICE_ORIENTATION,
+    JSGenerateToJSObject
+] dictionary RotationRate {
+    double? alpha;
+    double? beta;
+    double? gamma;
+};
</ins></span></pre></div>
<a id="trunkSourceWebCoredomDeviceOrientationDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DeviceOrientationData.cpp (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -28,134 +28,38 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-Ref&lt;DeviceOrientationData&gt; DeviceOrientationData::create()
-{
-    return adoptRef(*new DeviceOrientationData);
-}
</del><ins>+#if PLATFORM(IOS)
</ins><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
</del><span class="cx"> // FIXME: We should reconcile the iOS and OpenSource differences.
</span><del>-Ref&lt;DeviceOrientationData&gt; DeviceOrientationData::create(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideCompassHeading, double compassHeading, bool canProvideCompassAccuracy, double compassAccuracy)
</del><ins>+Ref&lt;DeviceOrientationData&gt; DeviceOrientationData::create(std::optional&lt;double&gt; alpha, std::optional&lt;double&gt; beta, std::optional&lt;double&gt; gamma, std::optional&lt;double&gt; compassHeading, std::optional&lt;double&gt; compassAccuracy)
</ins><span class="cx"> {
</span><del>-    return adoptRef(*new DeviceOrientationData(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma, canProvideCompassHeading, compassHeading, canProvideCompassAccuracy, compassAccuracy));
</del><ins>+    return adoptRef(*new DeviceOrientationData(alpha, beta, gamma, compassHeading, compassAccuracy));
</ins><span class="cx"> }
</span><del>-#else
-Ref&lt;DeviceOrientationData&gt; 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
</del><span class="cx"> 
</span><del>-
-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)
</del><ins>+DeviceOrientationData::DeviceOrientationData(std::optional&lt;double&gt; alpha, std::optional&lt;double&gt; beta, std::optional&lt;double&gt; gamma, std::optional&lt;double&gt; compassHeading, std::optional&lt;double&gt; compassAccuracy)
+    : m_alpha(alpha)
</ins><span class="cx">     , m_beta(beta)
</span><span class="cx">     , m_gamma(gamma)
</span><del>-    , m_canProvideCompassHeading(canProvideCompassHeading)
-    , m_canProvideCompassAccuracy(canProvideCompassAccuracy)
</del><span class="cx">     , m_compassHeading(compassHeading)
</span><span class="cx">     , m_compassAccuracy(compassAccuracy)
</span><del>-#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
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-double DeviceOrientationData::alpha() const
-{
-    return m_alpha;
-}
</del><ins>+#else
</ins><span class="cx"> 
</span><del>-double DeviceOrientationData::beta() const
</del><ins>+Ref&lt;DeviceOrientationData&gt; DeviceOrientationData::create(std::optional&lt;double&gt; alpha, std::optional&lt;double&gt; beta, std::optional&lt;double&gt; gamma, std::optional&lt;bool&gt; absolute)
</ins><span class="cx"> {
</span><del>-    return m_beta;
</del><ins>+    return adoptRef(*new DeviceOrientationData(alpha, beta, gamma, absolute));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-double DeviceOrientationData::gamma() const
</del><ins>+DeviceOrientationData::DeviceOrientationData(std::optional&lt;double&gt; alpha, std::optional&lt;double&gt; beta, std::optional&lt;double&gt; gamma, std::optional&lt;bool&gt; absolute)
+    : m_alpha(alpha)
+    , m_beta(beta)
+    , m_gamma(gamma)
+    , m_absolute(absolute)
</ins><span class="cx"> {
</span><del>-    return m_gamma;
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if !PLATFORM(IOS)
-bool DeviceOrientationData::absolute() const
-{
-    return m_absolute;
-}
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-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
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoredomDeviceOrientationDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DeviceOrientationData.h (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include &quot;PlatformExportMacros.h&quot;
</span><ins>+#include &lt;wtf/Optional.h&gt;
</ins><span class="cx"> #include &lt;wtf/Ref.h&gt;
</span><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -33,54 +34,43 @@
</span><span class="cx"> 
</span><span class="cx"> class DeviceOrientationData : public RefCounted&lt;DeviceOrientationData&gt; {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;DeviceOrientationData&gt; create();
</del><ins>+    static Ref&lt;DeviceOrientationData&gt; create()
+    {
+        return adoptRef(*new DeviceOrientationData);
+    }
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><del>-    WEBCORE_EXPORT static Ref&lt;DeviceOrientationData&gt; create(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideCompassHeading, double compassHeading, bool canProvideCompassAccuracy, double compassAccuracy);
</del><ins>+    WEBCORE_EXPORT static Ref&lt;DeviceOrientationData&gt; create(std::optional&lt;double&gt; alpha, std::optional&lt;double&gt; beta, std::optional&lt;double&gt; gamma, std::optional&lt;double&gt; compassHeading, std::optional&lt;double&gt; compassAccuracy);
</ins><span class="cx"> #else
</span><del>-    WEBCORE_EXPORT static Ref&lt;DeviceOrientationData&gt; create(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideAbsolute = false, bool absolute = false);
</del><ins>+    WEBCORE_EXPORT static Ref&lt;DeviceOrientationData&gt; create(std::optional&lt;double&gt; alpha, std::optional&lt;double&gt; beta, std::optional&lt;double&gt; gamma, std::optional&lt;bool&gt; absolute);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    double alpha() const;
-    double beta() const;
-    double gamma() const;
-    bool absolute() const;
-    bool canProvideAlpha() const;
-    bool canProvideBeta() const;
-    bool canProvideGamma() const;
-    bool canProvideAbsolute() const;
-
</del><ins>+    std::optional&lt;double&gt; alpha() const { return m_alpha; }
+    std::optional&lt;double&gt; beta() const { return m_beta; }
+    std::optional&lt;double&gt; gamma() const { return m_gamma; }
</ins><span class="cx"> #if PLATFORM(IOS)
</span><del>-    double compassHeading() const;
-    double compassAccuracy() const;
-    bool canProvideCompassHeading() const;
-    bool canProvideCompassAccuracy() const;
</del><ins>+    std::optional&lt;double&gt; compassHeading() const { return m_compassHeading; }
+    std::optional&lt;double&gt; compassAccuracy() const { return m_compassAccuracy; }
+#else
+    std::optional&lt;bool&gt; absolute() const { return m_absolute; }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    DeviceOrientationData();
</del><ins>+    DeviceOrientationData() = default;
</ins><span class="cx"> #if PLATFORM(IOS)
</span><del>-    DeviceOrientationData(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideCompassHeading, double compassHeading, bool canProvideCompassAccuracy, double compassAccuracy);
</del><ins>+    DeviceOrientationData(std::optional&lt;double&gt; alpha, std::optional&lt;double&gt; beta, std::optional&lt;double&gt; gamma, std::optional&lt;double&gt; compassHeading, std::optional&lt;double&gt; compassAccuracy);
</ins><span class="cx"> #else
</span><del>-    DeviceOrientationData(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideAbsolute, bool absolute);
</del><ins>+    DeviceOrientationData(std::optional&lt;double&gt; alpha, std::optional&lt;double&gt; beta, std::optional&lt;double&gt; gamma, std::optional&lt;bool&gt; absolute);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    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;
-
</del><ins>+    std::optional&lt;double&gt; m_alpha;
+    std::optional&lt;double&gt; m_beta;
+    std::optional&lt;double&gt; m_gamma;
</ins><span class="cx"> #if PLATFORM(IOS)
</span><del>-    bool m_canProvideCompassHeading;
-    bool m_canProvideCompassAccuracy;
-    double m_compassHeading;
-    double m_compassAccuracy;
</del><ins>+    std::optional&lt;double&gt; m_compassHeading;
+    std::optional&lt;double&gt; m_compassAccuracy;
</ins><span class="cx"> #else
</span><del>-    bool m_absolute;
</del><ins>+    std::optional&lt;bool&gt; m_absolute;
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomDeviceOrientationEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DeviceOrientationEvent.cpp (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -46,15 +46,60 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString&amp; type, bool bubbles, bool cancelable, DeviceOrientationData* orientation)
</del><ins>+std::optional&lt;double&gt; DeviceOrientationEvent::alpha() const
</ins><span class="cx"> {
</span><ins>+    return m_orientation-&gt;alpha();
+}
+
+std::optional&lt;double&gt; DeviceOrientationEvent::beta() const
+{
+    return m_orientation-&gt;beta();
+}
+
+std::optional&lt;double&gt; DeviceOrientationEvent::gamma() const
+{
+    return m_orientation-&gt;gamma();
+}
+
+#if PLATFORM(IOS)
+
+std::optional&lt;double&gt; DeviceOrientationEvent::compassHeading() const
+{
+    return m_orientation-&gt;compassHeading();
+}
+
+std::optional&lt;double&gt; DeviceOrientationEvent::compassAccuracy() const
+{
+    return m_orientation-&gt;compassAccuracy();
+}
+
+void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString&amp; type, bool bubbles, bool cancelable, std::optional&lt;double&gt; alpha, std::optional&lt;double&gt; beta, std::optional&lt;double&gt; gamma, std::optional&lt;double&gt; compassHeading, std::optional&lt;double&gt; compassAccuracy)
+{
</ins><span class="cx">     if (dispatched())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     initEvent(type, bubbles, cancelable);
</span><del>-    m_orientation = orientation;
</del><ins>+    m_orientation = DeviceOrientationData::create(alpha, beta, gamma, compassHeading, compassAccuracy);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#else
+
+std::optional&lt;bool&gt; DeviceOrientationEvent::absolute() const
+{
+    return m_orientation-&gt;absolute();
+}
+
+void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString&amp; type, bool bubbles, bool cancelable, std::optional&lt;double&gt; alpha, std::optional&lt;double&gt; beta, std::optional&lt;double&gt; gamma, std::optional&lt;bool&gt; absolute)
+{
+    if (dispatched())
+        return;
+
+    initEvent(type, bubbles, cancelable);
+    m_orientation = DeviceOrientationData::create(alpha, beta, gamma, absolute);
+}
+
+#endif
+
</ins><span class="cx"> EventInterface DeviceOrientationEvent::eventInterface() const
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(DEVICE_ORIENTATION)
</span></span></pre></div>
<a id="trunkSourceWebCoredomDeviceOrientationEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DeviceOrientationEvent.h (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -33,7 +33,6 @@
</span><span class="cx"> 
</span><span class="cx"> class DeviceOrientationEvent final : public Event {
</span><span class="cx"> public:
</span><del>-    virtual ~DeviceOrientationEvent();
</del><span class="cx">     static Ref&lt;DeviceOrientationEvent&gt; create(const AtomicString&amp; eventType, DeviceOrientationData* orientation)
</span><span class="cx">     {
</span><span class="cx">         return adoptRef(*new DeviceOrientationEvent(eventType, orientation));
</span><span class="lines">@@ -44,16 +43,29 @@
</span><span class="cx">         return adoptRef(*new DeviceOrientationEvent);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void initDeviceOrientationEvent(const AtomicString&amp; type, bool bubbles, bool cancelable, DeviceOrientationData*);
</del><ins>+    virtual ~DeviceOrientationEvent();
</ins><span class="cx"> 
</span><del>-    DeviceOrientationData* orientation() const { return m_orientation.get(); }
</del><ins>+    std::optional&lt;double&gt; alpha() const;
+    std::optional&lt;double&gt; beta() const;
+    std::optional&lt;double&gt; gamma() const;
</ins><span class="cx"> 
</span><del>-    EventInterface eventInterface() const override;
</del><ins>+#if PLATFORM(IOS)
+    std::optional&lt;double&gt; compassHeading() const;
+    std::optional&lt;double&gt; compassAccuracy() const;
</ins><span class="cx"> 
</span><ins>+    void initDeviceOrientationEvent(const AtomicString&amp; type, bool bubbles, bool cancelable, std::optional&lt;double&gt; alpha, std::optional&lt;double&gt; beta, std::optional&lt;double&gt; gamma, std::optional&lt;double&gt; compassHeading, std::optional&lt;double&gt; compassAccuracy);
+#else
+    std::optional&lt;bool&gt; absolute() const;
+
+    void initDeviceOrientationEvent(const AtomicString&amp; type, bool bubbles, bool cancelable, std::optional&lt;double&gt; alpha, std::optional&lt;double&gt; beta, std::optional&lt;double&gt; gamma, std::optional&lt;bool&gt; absolute);
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     DeviceOrientationEvent();
</span><span class="cx">     DeviceOrientationEvent(const AtomicString&amp; eventType, DeviceOrientationData*);
</span><span class="cx"> 
</span><ins>+    EventInterface eventInterface() const override;
+
</ins><span class="cx">     RefPtr&lt;DeviceOrientationData&gt; m_orientation;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomDeviceOrientationEventidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DeviceOrientationEvent.idl (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -26,32 +26,32 @@
</span><span class="cx"> [
</span><span class="cx">     Conditional=DEVICE_ORIENTATION,
</span><span class="cx"> ] interface DeviceOrientationEvent : Event {
</span><del>-    [Custom] readonly attribute unrestricted double alpha;
-    [Custom] readonly attribute unrestricted double beta;
-    [Custom] readonly attribute unrestricted double gamma;
</del><ins>+    readonly attribute unrestricted double? alpha;
+    readonly attribute unrestricted double? beta;
+    readonly attribute unrestricted double? gamma;
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: Consider defining an ENABLE macro for iOS device orientation code and/or modifying
</span><span class="cx">     // the bindings scripts to support generating more complicated conditional code.
</span><span class="cx"> #if defined(WTF_PLATFORM_IOS) &amp;&amp; WTF_PLATFORM_IOS
</span><del>-    [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);
</del><ins>+    [ImplementedAs=compassHeading] readonly attribute unrestricted double? webkitCompassHeading;
+    [ImplementedAs=compassAccuracy] readonly attribute unrestricted double? webkitCompassAccuracy;
+    void initDeviceOrientationEvent(optional DOMString type = &quot;&quot;,
+                                    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);
</ins><span class="cx"> #else
</span><del>-    [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);
</del><ins>+    readonly attribute boolean? absolute;
+    void initDeviceOrientationEvent(optional DOMString type = &quot;&quot;,
+                                    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);
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosDeviceMotionClientIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/DeviceMotionClientIOS.mm (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -77,9 +77,7 @@
</span><span class="cx">     [m_motionManager removeMotionClient:this];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DeviceMotionClientIOS::motionChanged(double xAcceleration, double yAcceleration, double zAcceleration,
-                                             double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity,
-                                             double xRotationRate, double yRotationRate, double zRotationRate)
</del><ins>+void DeviceMotionClientIOS::motionChanged(double xAcceleration, double yAcceleration, double zAcceleration, double xAccelerationIncludingGravity, double yAccelerationIncludingGravity, double zAccelerationIncludingGravity, double xRotationRate, double yRotationRate, double zRotationRate)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_updating)
</span><span class="cx">         return;
</span><span class="lines">@@ -95,32 +93,21 @@
</span><span class="cx">     UNUSED_PARAM(yRotationRate);
</span><span class="cx">     UNUSED_PARAM(zRotationRate);
</span><span class="cx"> 
</span><del>-    RefPtr&lt;DeviceMotionData::Acceleration&gt; accelerationIncludingGravity = DeviceMotionData::Acceleration::create(false, 0,
-                                                                                                                 false, 0,
-                                                                                                                 false, 0);
-    RefPtr&lt;DeviceMotionData::Acceleration&gt; acceleration = DeviceMotionData::Acceleration::create(false, 0,
-                                                                                                 false, 0,
-                                                                                                 false, 0);
-    RefPtr&lt;DeviceMotionData::RotationRate&gt; rotationRate = DeviceMotionData::RotationRate::create(false, 0,
-                                                                                                 false, 0,
-                                                                                                 false, 0);
</del><ins>+    auto accelerationIncludingGravity = DeviceMotionData::Acceleration::create();
+    auto acceleration = DeviceMotionData::Acceleration::create();
+    auto rotationRate = DeviceMotionData::RotationRate::create();
</ins><span class="cx"> #else
</span><del>-    RefPtr&lt;DeviceMotionData::Acceleration&gt; accelerationIncludingGravity = DeviceMotionData::Acceleration::create(true, xAccelerationIncludingGravity,
-                                                                                                                 true, yAccelerationIncludingGravity,
-                                                                                                                 true, zAccelerationIncludingGravity);
-    RefPtr&lt;DeviceMotionData::Acceleration&gt; acceleration = 0;
-    RefPtr&lt;DeviceMotionData::RotationRate&gt; rotationRate = 0;
</del><ins>+    auto accelerationIncludingGravity = DeviceMotionData::Acceleration::create(xAccelerationIncludingGravity, yAccelerationIncludingGravity, zAccelerationIncludingGravity);
+
+    RefPtr&lt;DeviceMotionData::Acceleration&gt; acceleration;
+    RefPtr&lt;DeviceMotionData::RotationRate&gt; rotationRate;
</ins><span class="cx">     if ([m_motionManager gyroAvailable]) {
</span><del>-        acceleration = DeviceMotionData::Acceleration::create(true, xAcceleration,
-                                                              true, yAcceleration,
-                                                              true, zAcceleration);
-        rotationRate = DeviceMotionData::RotationRate::create(true, xRotationRate,
-                                                              true, yRotationRate,
-                                                              true, zRotationRate);
</del><ins>+        acceleration = DeviceMotionData::Acceleration::create(xAcceleration, yAcceleration, zAcceleration);
+        rotationRate = DeviceMotionData::RotationRate::create(xRotationRate, yRotationRate, zRotationRate);
</ins><span class="cx">     }
</span><span class="cx"> #endif // PLATFORM(IOS_SIMULATOR)
</span><span class="cx"> 
</span><del>-    m_currentDeviceMotionData = DeviceMotionData::create(WTFMove(acceleration), WTFMove(accelerationIncludingGravity), WTFMove(rotationRate), true, kMotionUpdateInterval);
</del><ins>+    m_currentDeviceMotionData = DeviceMotionData::create(WTFMove(acceleration), WTFMove(accelerationIncludingGravity), WTFMove(rotationRate), kMotionUpdateInterval);
</ins><span class="cx">     m_controller-&gt;didChangeDeviceMotion(m_currentDeviceMotionData.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosDeviceOrientationClientIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/DeviceOrientationClientIOS.mm (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -88,18 +88,11 @@
</span><span class="cx">     UNUSED_PARAM(gamma);
</span><span class="cx">     UNUSED_PARAM(compassHeading);
</span><span class="cx">     UNUSED_PARAM(compassAccuracy);
</span><del>-    m_currentDeviceOrientation = DeviceOrientationData::create(false, 0,
-                                                           false, 0,
-                                                           false, 0,
-                                                           false, 0,
-                                                           false, 0);
</del><ins>+    m_currentDeviceOrientation = DeviceOrientationData::create();
</ins><span class="cx"> #else
</span><del>-    m_currentDeviceOrientation = DeviceOrientationData::create(true, alpha,
-                                                           true, beta,
-                                                           true, gamma,
-                                                           true, compassHeading,
-                                                           true, compassAccuracy);
</del><ins>+    m_currentDeviceOrientation = DeviceOrientationData::create(alpha, beta, gamma, compassHeading, compassAccuracy);
</ins><span class="cx"> #endif
</span><ins>+
</ins><span class="cx">     m_controller-&gt;didChangeDeviceOrientation(m_currentDeviceOrientation.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2017-01-13  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        [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.
+
</ins><span class="cx"> 2017-01-12  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove unnecessary includes of Page.h
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebDeviceOrientationmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebDeviceOrientation.mm (210740 => 210741)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -60,6 +60,13 @@
</span><span class="cx">     return orientation ? orientation-&gt;m_internal-&gt;m_orientation.get() : 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static std::optional&lt;double&gt; convert(bool canProvide, double value)
+{
+    if (!canProvide)
+        return std::nullopt;
+    return value;
+}
+
</ins><span class="cx"> - (id)initWithCanProvideAlpha:(bool)canProvideAlpha alpha:(double)alpha canProvideBeta:(bool)canProvideBeta beta:(double)beta canProvideGamma:(bool)canProvideGamma gamma:(double)gamma
</span><span class="cx"> {
</span><span class="cx">     self = [super init];
</span><span class="lines">@@ -68,9 +75,9 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     // We don't use this API, but make sure that it compiles with the new
</span><span class="cx">     // compass parameters.
</span><del>-    m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientationData::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma, false, 0, false, 0)];
</del><ins>+    m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientationData::create(convert(canProvideAlpha, alpha), convert(canProvideBeta, beta), convert(canProvideGamma, gamma), std::nullopt, std::nullopt)];
</ins><span class="cx"> #else
</span><del>-    m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientationData::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma)];
</del><ins>+    m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientationData::create(convert(canProvideAlpha, alpha), convert(canProvideBeta, beta), convert(canProvideGamma, gamma), std::nullopt)];
</ins><span class="cx"> #endif
</span><span class="cx">     return self;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>